mirror of
https://github.com/Permissionless-Software-Foundation/bch-js.git
synced 2026-09-21 16:51:59 -07:00
33 lines
952 B
JavaScript
33 lines
952 B
JavaScript
const chai = require("chai")
|
|
const assert = chai.assert
|
|
const sinon = require("sinon")
|
|
|
|
const BCHJS = require("../../src/bch-js")
|
|
const bchjs = new BCHJS()
|
|
|
|
describe(`#ElectrumX`, () => {
|
|
let sandbox
|
|
beforeEach(() => (sandbox = sinon.createSandbox()))
|
|
afterEach(() => sandbox.restore())
|
|
|
|
describe(`#utxo`, () => {
|
|
it(`should GET utxos for a single address`, async () => {
|
|
const addr = "bitcoincash:qqh793x9au6ehvh7r2zflzguanlme760wuzehgzjh9"
|
|
|
|
const result = await bchjs.Electrumx.utxo(addr)
|
|
// console.log(`result: ${JSON.stringify(result, null, 2)}`)
|
|
|
|
assert.property(result, "success")
|
|
assert.equal(result.success, true)
|
|
|
|
assert.property(result, "utxos")
|
|
assert.isArray(result.utxos)
|
|
|
|
assert.property(result.utxos[0], "height")
|
|
assert.property(result.utxos[0], "tx_hash")
|
|
assert.property(result.utxos[0], "tx_pos")
|
|
assert.property(result.utxos[0], "value")
|
|
})
|
|
})
|
|
})
|