5.4.3-stable-testnet • Published 2 years ago

@moneyprotocol/lib-ethers v5.4.3-stable-testnet

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@moneyprotocol/lib-ethers

Bitcoins-based library for reading Moneyp protocol state and sending transactions.

Quickstart

Install in your project:

npm install --save @moneyprotocol/lib-base @moneyprotocol/lib-ethers ethers@^5.0.0

Connecting to an Ethereum node and sending a transaction:

const { Wallet, providers } = require("ethers");
const { BitcoinsMoneyp } = require("@moneyprotocol/lib-ethers");

async function example() {
  const provider = new providers.JsonRpcProvider("http://localhost:8545");
  const wallet = new Wallet(process.env.PRIVATE_KEY).connect(provider);
  const moneyp = await BitcoinsMoneyp.connect(wallet);

  const { newVault } = await moneyp.openVault({
    depositCollateral: 5, // RBTC
    borrowBPD: 2000
  });

  console.log(`Successfully opened a Moneyp Vault (${newVault})!`);
}

More examples

See packages/examples in the repo.

Moneyp's Dev UI itself contains many examples of @moneyprotocol/lib-ethers use.

API Reference

For now, it can be found in the public Moneyp repo.