Skip to content

Instantly share code, notes, and snippets.

@zh
Last active December 9, 2020 02:57
Show Gist options
  • Save zh/a7c58bca277ebbb7f7edbd0b8461bccd to your computer and use it in GitHub Desktop.
Save zh/a7c58bca277ebbb7f7edbd0b8461bccd to your computer and use it in GitHub Desktop.

Code

const fromBchAddress = 'bitcoincash:qzkrtx54agr74kxduuz3me4a2p2v7z74psgg9lkl5q'
const bitbox = new BITBOX()
const client = new GrpcClient({url: 'bchd.ny1.simpleledger.io' })
const validator = new slpjs.BchdValidator(client, console)
const bchdNetwork = new slpjs.BchdNetwork({ BITBOX: bitbox, client, validator })

async function genGroupNFT (from, fromWif) {
    const balances = await bchdNetwork.getAllSlpBalancesAndUtxos(fromBchAddress)
    console.log(`balances: ${JSON.stringify(balances, null, 2)}`)
    console.log("BCH balance:", balances.satoshis_available_bch)
}

Address seems perfectly good in the explorer

Error

error in genGroupNFT:  Error: 1 CANCELLED: Received http2 header with status: 502
    at Object.exports.createStatusError (/bch/node_modules/grpc/src/common.js:91:15)
    at Object.onReceiveStatus (/bch/node_modules/grpc/src/client_interceptors.js:1209:28)
    at InterceptingListener._callNext (/bch/node_modules/grpc/src/client_interceptors.js:568:42)
    at InterceptingListener.onReceiveStatus (/bch/node_modules/grpc/src/client_interceptors.js:618:8)
    at callback (/bch/node_modules/grpc/src/client_interceptors.js:847:24) {
  code: 1,
  metadata: Metadata { _internal_repr: {}, flags: 0 },
  details: 'Received http2 header with status: 502'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment