1.0.0-testnet • Published 1 year ago

@money-protocol/lib-ethers v1.0.0-testnet

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@money-protocol/lib-ethers

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

Quickstart

Install in your project:

npm install --save @money-protocol/lib-base @money-protocol/lib-ethers ethers@^5.0.0

Connecting to an Ethereum node and sending a transaction:

const { Wallet, providers } = require("ethers");
const { BitcoinsMoneyp } = require("@money-protocol/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 @money-protocol/lib-ethers use.

API Reference

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

1.0.0-testnet

1 year ago