@mahadao/arth-ethers
v2.0.1
Published
ARTH SDK Ethers-based implementation
Downloads
8
Readme
@mahadao/arth-ethers
Ethers-based library for reading ARTH protocol state and sending transactions.
Quickstart
Install in your project:
npm install --save @mahadao/arth-base @mahadao/arth-ethers ethers@^5.0.0
Connecting to an Ethereum node and sending a transaction:
const { Wallet, providers } = require("ethers");
const { EthersARTH } = require("@mahadao/arth-ethers");
async function example() {
const provider = new providers.JsonRpcProvider("http://localhost:8545");
const wallet = new Wallet(process.env.PRIVATE_KEY).connect(provider);
const arth = await EthersARTH.connect(wallet);
const { newTrove } = await arth.openTrove({
depositCollateral: 5, // ETH
borrowARTH: 2000
});
console.log(`Successfully opened a ARTH Loan (${newTrove})!`);
}
More examples
See packages/examples in the repo.
ARTH's Dev UI itself contains many examples of @mahadao/arth-ethers
use.
API Reference
For now, it can be found in the public ARTH repo.