Giter Club home page Giter Club logo

multichain-wallet-sdk's Introduction

Vipay-Wallet

installation

npm install vipay-multichain-wallet

import (es5)

const vipay = require('vipay-multichain-wallet');

import (es6)

import vipay from 'vipay-multichain-wallet';

Create Wallet (Phrase words) using common function

const mnemonic = vipay.Common.generateMnemonic();
console.log(mnemonic); //sea gulp tiger cup zoo ...

functions (ethereum)

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

usage (ethereum)

//Create Wallet
const wallet = await vipay.Ethereum.createWallet({});

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

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

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

//Send ETH
const tx = await vipay.Ethereum.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
});

//Token Transfer
const tx = await vipay.Ethereum.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
});

//Token Approve
const tx = await vipay.Ethereum.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
})

functions (solana)

  • Create Wallet
  • Recover wallet from phrase words
  • Import account from private key
  • Send SOL token
  • Get token info
  • Get availale token list
  • Get balance
  • Get transaction

usage (solana)

const wallet = await vipay.Solana.createWallet({});

const importWallet = await vipay.Solana.importWallet({
	mnemonic: 'xxx'//mnemonic
})

const importAccount = await vipay.Solana.importWallet({
	privateKey: 'xxx' //privatekey
})

const tx = await vipay.Solana.transfer({
	rpcUrl: 'https://api.devnet.solana.com', //rpcurl
	privateKey: 'xxx',
	from: 'xxx',
	to: 'xxx',
	amount: 0.1
})

// please refer library for more functions

More blockchains and networks will be added.

Enjoy your work ~!!!

multichain-wallet-sdk's People

Contributors

ericlewis966 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.