@liquidloans/lib-ethers-dev
v1.0.3
Published
Liquid Loans SDK Ethers-based implementation
Downloads
82
Readme
@liquidloans/lib-ethers
Ethers-based library for reading Liquid Loans protocol state and sending transactions.
Quickstart
Install in your project:
npm install --save @liquidloans/lib-base @liquidloans/lib-ethers ethers@^5.0.0
Connecting to an Ethereum node and sending a transaction:
const { Wallet, providers } = require("ethers");
const { EthersLiquidLoans } = require("@liquidloans/lib-ethers");
async function example() {
const provider = new providers.JsonRpcProvider("http://localhost:8545");
const wallet = new Wallet(process.env.PRIVATE_KEY).connect(provider);
const liquidLoans = await EthersLiquidLoans.connect(wallet);
const { newVault } = await liquidLoans.openVault({
depositCollateral: 5, // PLS
borrowUSDL: 2000
});
console.log(`Successfully opened a LiquidLoans Vault (${newVault})!`);
}
More examples
See packages/examples in the repo.
Liquid Loans's Dev UI itself contains many examples of @liquidloans/lib-ethers
use.
API Reference
For now, it can be found in the public Liquid Loans repo.