@sovryn-zero/lib-ethers
v0.2.6-early.access.1
Published
Sovryn Zero SDK Ethers-based implementation
Downloads
369
Readme
@sovryn-zero/lib-ethers
Ethers-based library for reading Zero protocol state and sending transactions.
Quickstart
Install in your project:
npm install @sovryn-zero/lib-base @sovryn-zero/lib-ethers ethers@^5.0.0
To install early access releases (pre-releases) - use a specific version to install:
npm install @sovryn-zero/[email protected]
The actual early access release version is here.
Connecting to an Ethereum node and sending a transaction:
const { Wallet, providers } = require("ethers");
const { EthersLiquity } = require("@sovryn-zero/lib-ethers");
async function example() {
const provider = new providers.JsonRpcProvider("http://localhost:8545");
const wallet = new Wallet(process.env.PRIVATE_KEY).connect(provider);
const zero = await EthersLiquity.connect(wallet);
const { newTrove } = await zero.openTrove({
depositCollateral: 5, // ETH
borrowZUSD: 2000
});
console.log(`Successfully opened a Zero Trove (${newTrove})!`);
}
More examples
See packages/examples in the repo.