BC RPC SDK
Tests
Tests are written in Jest framework.
Run them using yarn run test
.
Examples
examples/get-balance.ts
:
;; ;;req.setAddress'<your address>';client.getBalancereq.then
Before running install ts-node with yarn global add ts-node
Then run like NODE_TLS_REJECT_UNAUTHORIZED=0 BC_RPC_ADDRESS=https://localhost:3001 BC_RPC_SCOOKIE=trololo ts-node examples/get-balance.ts
And you should get response similar to this:
confirmed: '7536' unconfirmed: '0' collateralized: '96' collateralizedspendable: '0' unit: 'nrg'