broadcast.ts 521 B

12345678910111213141516
  1. // REST API servers.
  2. const BCHN_MAINNET = 'https://bchn.fullstack.cash/v5/'
  3. // bch-js-examples require code from the main bch-js repo
  4. import BCHJS from '@psf/bch-js'
  5. // Instantiate bch-js based on the network.
  6. const bchjs = new BCHJS({ restURL: BCHN_MAINNET })
  7. export default async function (_network = 'NEXA', _rawTx) {
  8. // FIXME Add Nexa broadcast functions.
  9. /* Send raw transaction. */
  10. const txid = await bchjs.RawTransactions.sendRawTransaction([ _rawTx ])
  11. console.log(`Transaction ID: ${txid}`)
  12. }