Skip to content

Releases: lendroidproject/lendroid-js

Support Multiple Coins

17 Jun 13:00
bf5b5a7
Compare
Choose a tag to compare
Merge pull request #42 from lendroidproject/v3.0

V3.0

Wrap Contracts into on Contract - Protocol

27 Mar 16:29
Compare
Choose a tag to compare
  • Wrap all loan contracts into Protocol
  • Transaction check via Status
  • Use reliable updates
  • No 3rd API calls, but all wrapped in Library

Version 2.1.2

13 Aug 08:12
667d275
Compare
Choose a tag to compare

ReadMe Update and Quick Fix.

Version 2.1.1

13 Aug 07:00
Compare
Choose a tag to compare
Version 2.1.1 Pre-release
Pre-release
v2.1.1

create branch

Version 2.1.0

12 Aug 10:21
Compare
Choose a tag to compare
Version 2.1.0 Pre-release
Pre-release
v2.1.0

merge develop

Initial Lendroid Release (v1.0)

23 Jun 15:34
Compare
Choose a tag to compare
Pre-release

lendroid-js

A library to wrapper the lendroid Server and Lendroid Contract API's

Pre-reqs:

npm install

npm install -g tslint

To serve app on localhost:9100:

Create an index.ts under src. This will be executed on Webpack server initialization

npm start (serves files via Webpack, compiles on file changes)

To watch and compile TypeScript to Javascript:

npm run watch

To build:

npm run build

To test:

npm run test

On the Lendroid UI

  1. On Lendroid UI, Lender deposits 1000 OMG.
    • Contract Code Wallet.deposit
    • lendroidJS.Wallet.deposit(‘OMG’, 1000).sender(lender)
  2. On Lendroid UI, Lender commits 1000 OMG:
    • Contract Code Wallet.commit
    • lendroidJS.Wallet.commit(‘OMG’, 1000).sender(lender)
  3. On Lendroid UI, Lender creates a loan offer for the loan terms
       {  
          "lenderAddress": "0x012345",
          "market": "OMG/ETH",
          "loanQuantity": 100,
          "loanToken": "OMG",
          "costAmount": 100,
          "costToken": "ETH",
          "wrangler": "0xWrangler",
          "ecSignature": {
            "v": 27,
            "r": "0x61a3ed31",
            "s": "0x40349190"
          }
        }
  4. Sends a HTTP POST request with a Loan Offer object to /offers endpoint of Lendroid API server API service whenever Lender creates the loan offer.
    • Server code: POST /offers
    • On the API server, this Loan Offer object is saved.
    • Method Signature: lendroidJS.createOffer(loanTerms)
    • HTTP Signature:
      curl -v -XPOST  http://localhost:8080/offers \
      -H 'application/json' \
      -d @- << EOF
       {  
          "lenderAddress": "0x012345",
          "market": "OMG/ETH",
          "loanQuantity": 100,
          "loanToken": "OMG",
          "costAmount": 100,
          "costToken": "ETH",
          "wrangler": "0xWrangler",
          "ecSignature": {
            "v": 27,
            "r": "0x61a3ed31",
            "s": "0x40349190"
          }
        }
       EOF
      

On the Relayer UI

  1. Retrieves loan offers via HTTP GET from the API service
    • Server code: GET /offers
    • Method Signature: lendroidJS.getOffers()
    • HTTP Signature:
      curl -v -XGET  http://localhost:8080/offers
      
  2. Sends the picked pair of (0x order, loan offer) to Lendroid’s Smart Contracts via Web3.js to open a position.
    • Contract Code: PositionManager.openPosition)
    •  lendroidJS.PositionManager
                 .openPosition(orderValues[],
                               orderAddresses[],
                               orderV,
                               orderRS[],
                               offerValues[],     
                               offerAddresses[])
                 .sender(marginTrader)