Browse Source
Merge pull request #1105 from bitcoinjs/3pbpfix
use blockchain.info for 3PBP address example
addLowRGrinding
Daniel Cousens
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
11 deletions
-
test/integration/addresses.js
|
|
@ -115,21 +115,19 @@ describe('bitcoinjs-lib (addresses)', function () { |
|
|
|
}) |
|
|
|
|
|
|
|
it('can support the retrieval of transactions for an address (via 3PBP)', function (done) { |
|
|
|
var keyPair = bitcoin.ECPair.makeRandom() |
|
|
|
var address = getAddress(keyPair) |
|
|
|
const keyPair = bitcoin.ECPair.makeRandom() |
|
|
|
const address = getAddress(keyPair) |
|
|
|
|
|
|
|
dhttp({ |
|
|
|
method: 'POST', |
|
|
|
url: 'https://api.ei8ht.com.au/3/addrtxs', |
|
|
|
body: { |
|
|
|
addrs: [address], |
|
|
|
height: 0 |
|
|
|
} |
|
|
|
}, function (err, transactions) { |
|
|
|
method: 'GET', |
|
|
|
url: 'https://blockchain.info/rawaddr/' + address |
|
|
|
}, function (err, result) { |
|
|
|
if (err) return done(err) |
|
|
|
|
|
|
|
// random private keys [probably] have no transactions
|
|
|
|
assert.strictEqual(Object.keys(transactions).length, 0) |
|
|
|
// random private keys [probably!] have no transactions
|
|
|
|
assert.strictEqual(result.n_tx, 0) |
|
|
|
assert.strictEqual(result.total_received, 0) |
|
|
|
assert.strictEqual(result.total_sent, 0) |
|
|
|
done() |
|
|
|
}) |
|
|
|
}) |
|
|
|