0.2.1-alpha.0 • Published 4 years ago

tsoposki-ptokens-pbtc v0.2.1-alpha.0

Weekly downloads
1
License
ISC
Repository
-
Last release
4 years ago

ptokens-pbtc

Module for interacting only with pBTC.

 


 

Installation:

npm install ptokens-pbtc

 


 

Usage:

const pBTC = require('ptokens-pbtc')

const pbtc = new pBTC({
  ethPrivateKey: 'Eth private key',
  ethProvider: 'Eth provider',
  btcNetwork: 'testnet' //'testnet' or 'bitcoin', default 'testnet'
})

It is possible to pass a standard Ethereum Provider as the ethProvider value, such as the one injected into the content script of each web page by Metamask(window.web3.currentProvider).

const pBTC = require('ptokens-pbtc')

if (window.web3) {
  
  const pbtc = new pBTC({
    ethProvider: window.web3.currentProvider,
    btcNetwork: 'testnet'
  })
} else {
  console.log('No web3 detected')
}