1.0.1 • Published 2 years ago

vipay-ethereum-wallet v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Vipay-Wallet (ethereum)

installation

npm install vipay-ethereum-wallet

import (es5)

const vipay = require('vipay-ethereum-wallet/src');

import (es6)

import vipay from 'vipay-ethereum-wallet/src';

functions

  • Create Wallet
  • Recover wallet from phrase words
  • Import account from private key
  • Get ETH balance
  • Send ETH
  • Approve/Transfer Token

usage

//Create Wallet
const wallet = await vipay.createWallet({network: 'ETHEREUM'});

//Import Wallet
const wallet = await vipay.importWallet({
	mnemonic: 'sea glup tiger cup zoo ...', //phrase words
	network: 'ETHEREUM'
});

//Import Account
const account = await vipay.importAccount({
	privateKey: '0x....', //private key
	network: 'ETHEREUM'
});

//Get ETH balance
const balance = await vipay.getBalance({
	defaultProviderRpcUrl: 'https://https://bsc-dataseed1.defibit.io/', //this is bsc mainnet rpc url (put any ethereum network rpc url here)
	address: '0x...', 
	network: 'ETHEREUM'
});

//Send ETH
const tx = await vipay.sendEther({
	rpcUrl: 'https://....',// (pur rpc url here)
	privateKey: '0x....',
	receiveAddress: '0x...',
	amount: '0.1' //ETH amount
	gasPrice: 'xxx', //transaction gas fee
	gasLimit: 'xxx', //gas limit
	network: 'ETHEREUM'
});

//Token Transfer
const tx = await vipay.tokenTransfer({
	rpcUrl: 'https://....',// (pur rpc url here)
	privateKey: '0x....',
	receiveAddress: '0x...',
	tokenAddress: '0x...',
	amount: '0.1' //Token amount
	gasPrice: 'xxx', //transaction gas fee
	gasLimit: 'xxx', //gas limit
	network: 'ETHEREUM'
});

//Token Approve
const tx = await vipay.tokenApprove({
	rpcUrl: 'https://....',// (pur rpc url here)
	privateKey: '0x....',
	receiveAddress: '0x...',
	tokenAddress: '0x...',
	amount: '0.1' //Token amount
	gasPrice: 'xxx', //transaction gas fee
	gasLimit: 'xxx', //gas limit
	network: 'ETHEREUM'
})

Enjoy your work ~!!!

1.0.1

2 years ago

1.0.0

2 years ago