Ethers-based library for reading U protocol state and sending transactions.
Install in your project:
npm install --save lib-base-u lib-ethers-u ethers@^5.0.0
Connecting to an Ethereum node and sending a transaction:
const { Wallet, providers } = require("ethers");
const { EthersLiquity } = require("lib-ethers-u");
async function example() {
const provider = new providers.JsonRpcProvider("http://localhost:8545");
const wallet = new Wallet(process.env.PRIVATE_KEY).connect(provider);
const liquity = await EthersLiquity.connect(wallet);
const { newTrove } = await liquity.openTrove({
depositCollateral: 5, // ETH
borrowLUSD: 2000
});
console.log(`Successfully opened a Liquity Trove (${newTrove})!`);
}
See packages/examples in the repo.
For now, it can be found in the public Liquity repo.