https://github.com/lendroidproject/lendroid-js
Web3.js wrapper library to call Lendroid Smart Contracts and additional functionality
https://github.com/lendroidproject/lendroid-js
ethereum javascript typescript web3 webpack
Last synced: 4 months ago
JSON representation
Web3.js wrapper library to call Lendroid Smart Contracts and additional functionality
- Host: GitHub
- URL: https://github.com/lendroidproject/lendroid-js
- Owner: lendroidproject
- License: apache-2.0
- Created: 2018-02-05T04:48:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-12-29T04:52:29.000Z (over 3 years ago)
- Last Synced: 2025-11-27T09:18:37.278Z (7 months ago)
- Topics: ethereum, javascript, typescript, web3, webpack
- Language: TypeScript
- Homepage:
- Size: 967 KB
- Stars: 2
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# lendroid-js
A library to wrapper the lendroid Server and Lendroid Contract API's
## installation
```
yarn add lendroid
// or
npm install --save lendroid
```
for the specific versions check on [Releases](https://github.com/lendroidproject/lendroid-js/releases)
## how to use
```javascript
import { Lendroid } from 'lendroid'
const options = {
provider: window.web3.currentProvider, // optional
apiEndpoint: 'http://localhost:8080', // default
apiLoanRequrests: 'http://localhost:5000', //default
stateCallback: () => { }, // required: in React, Vue frontend, do run `this.forceUpdate()`
}
const LendroidJS = new Lendroid(options)
// properties
const { loading, orders, exchangeRates, contracts, web3Utils, metamask = {} } = LendroidJS
const { address, network } = metamask;
const { currentWETHExchangeRate, currentDAIExchangeRate } = exchangeRates
const offers = orders.orders
const myLendOffers = orders.myOrders.lend
const myBorrowOffers = orders.myOrders.borrow
// methods
const methods = {
onCreateOrder: LendroidJS.onCreateOrder,
onWrapETH: LendroidJS.onWrapETH,
onAllowance: LendroidJS.onAllowance,
onPostLoans: LendroidJS.onPostLoans,
onFillLoan: LendroidJS.onFillLoan,
onClosePosition: LendroidJS.onClosePosition,
onTopUpPosition: LendroidJS.onTopUpPosition,
onLiquidatePosition: LendroidJS.onLiquidatePosition,
onFillOrderServer: LendroidJS.onFillOrderServer,
onDeleteOrder: LendroidJS.onDeleteOrder,
onCancelOrder: LendroidJS.onCancelOrder,
}
methods.onWrapETH(amount, operation === 'Wrap')
```
## how to develop
- First clone repository and install dependencies via Yarn(`yarn`) or NPM(`npm install`)
via HTTPS - `git clone https://github.com/lendroidproject/lendroid-js.git`
or SSH - `git clone git@github.com:lendroidproject/lendroid-js.git`
- On UI, update `package.json` to use custom library as follow and install dependencies via Yarn(`yarn`) or NPM(`npm install`)
```
"dependencies": {
...
"lendroid": "../lendroid-js",
...
}
```
- To update library, go to `lendroid-js` and run `tsc`
- Copy `dist` folder to `/node_modules/lendroid/`
e.g: `cp -rf ./dist ../reloanr-ui/node_modules/lendroid/`
## relations
- [Reloanr UI](https://github.com/lendroidproject/reloanr-ui)
- [Deployed](https://app.reloanr.com)