1.2.0 • Published 5 years ago

leap-provider v1.2.0

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

leap-provider

Ethers.js provider to work with Leap Network.

Install

yarn add leap-provider

Usage

Connect to a Wallet:

const LeapProvider = require('leap-provider');
const provider = new LeapProvider('https://testnet-node.leapdao.org');

// can be passed in a Wallet
const plasmaWallet = new ethers.Wallet(privKey, provider);

// or connected to existing wallet
const otherWallet = Wallet.createRandom();
otherWallet.connect(provider);

Send transaction to Leap Network:

const LeapProvider = require('leap-provider');
const provider = new LeapProvider('https://testnet-node.leapdao.org');

// create some LeapTransaction
const tx = Tx.transfer(
  ...
);

// tx should be signed
tx.signAll(wallet.privateKey);

// send via provider
const resp = await wallet.provider.sendTransaction(tx);

// wait for inclusion, you will get a proper TransactionReceipt once tx is included in a block
const receipt = await resp.wait();
console.log(receipt);