New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

lendroid-js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lendroid-js

Web3.js wrapper that interacts with Lendroid Smart Contracts

latest
Source
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

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:8080:

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

  • On Lendroid UI, Lender deposits 1000 OMG.
    • Contract Code Wallet.deposit
    • lendroidJS.Wallet.deposit(‘OMG’, 1000).sender(lender)
  • On Lendroid UI, Lender commits 1000 OMG:
    • Contract Code Wallet.commit
    • lendroidJS.Wallet.commit(‘OMG’, 1000).sender(lender)
  • 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"
          }
        }
    
  • 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

  • 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
      
  • 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)
      

FAQs

Package last updated on 13 Feb 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts