@mahadao/arth-ethers
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

@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.

Package Sidebar

Install

npm i @mahadao/arth-ethers

Weekly Downloads

1

Version

2.0.1

License

MIT

Unpacked Size

1.13 MB

Total Files

126

Last publish

Collaborators

  • enamakel