tsoposki-ptokens-pbtc

repo holding the code for interacting with pBTC

Usage no npm install needed!

<script type="module">
  import tsoposkiPtokensPbtc from 'https://cdn.skypack.dev/tsoposki-ptokens-pbtc';
</script>

README

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')
}