1.0.1 • Published 6 years ago

rmethereumwallet v1.0.1

Weekly downloads
2
License
ISC
Repository
github
Last release
6 years ago

RMEthereumWallet

Provides a simple Ethereum Wallet Interface for easy-to-use. Uses etherescan api.

Install

npm install rmethereumwallet --save

Use

Import

import Wallet from 'rmethereumwallet'

Init Wallet

const wallet = new Wallet(isTestnet);
wallet.init();   //Initialize Wallet by generating new keychain - privateKey, publicKey and address
wallet.import(privateKey, publicKey, address)     //Initalize Wallet by importing keychain.

Get Wallet Info

const balance = wallet.getBalance()               //get balance of wallet
const price = wallet.price                        //get price of 1ETH as USD

Set Update Handler

wallet.setUpdateHandler((coins, price) => {       //Add Handler for balance or price updates
  this.setState({
    coins: coins,
    price: price
  })
})

wallet.setResyncDuration(duration)                //Set resync duration -- default is 10s

Send

const txId = await wallet.send(address, amount)   //Send coin to another wallet