Skip to content

Commit a2b4558

Browse files
committed
replace helloblock with insight and blockr
1 parent 88cc904 commit a2b4558

File tree

5 files changed

+21
-6
lines changed

5 files changed

+21
-6
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
"async": "^0.9.0",
5858
"browserify": "^10.0.0",
5959
"bs58": "^2.0.1",
60-
"cb-helloblock": "^0.4.13",
60+
"cb-blockr": "^3.1.1",
61+
"cb-insight": "git://github.com/weilu/cb-insight",
6162
"coveralls": "^2.11.2",
6263
"istanbul": "^0.3.5",
6364
"mocha": "^2.2.0",

test/integration/advanced.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
var assert = require('assert')
44
var bitcoin = require('../../')
5-
var blockchain = new (require('cb-helloblock'))('testnet')
5+
var blockchain = new (require('cb-insight'))('https://test-insight.bitpay.com')
6+
var faucetWithdraw = require('./utils').faucetWithdraw
67

78
describe('bitcoinjs-lib (advanced)', function () {
89
it('can sign a Bitcoin message', function () {
@@ -29,7 +30,7 @@ describe('bitcoinjs-lib (advanced)', function () {
2930
})
3031
var address = keyPair.getAddress().toString()
3132

32-
blockchain.addresses.__faucetWithdraw(address, 2e4, function (err) {
33+
faucetWithdraw(address, 2e4, function (err) {
3334
if (err) return done(err)
3435

3536
blockchain.addresses.unspents(address, function (err, unspents) {

test/integration/crypto.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var assert = require('assert')
44
var async = require('async')
55
var bigi = require('bigi')
66
var bitcoin = require('../../')
7-
var blockchain = new (require('cb-helloblock'))('bitcoin')
7+
var blockchain = new (require('cb-blockr'))('bitcoin')
88
var crypto = require('crypto')
99

1010
describe('bitcoinjs-lib (crypto)', function () {

test/integration/multisig.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
var assert = require('assert')
44
var bitcoin = require('../../')
5-
var blockchain = new (require('cb-helloblock'))('testnet')
5+
var blockchain = new (require('cb-insight'))('https://test-insight.bitpay.com')
6+
var faucetWithdraw = require('./utils').faucetWithdraw
67

78
describe('bitcoinjs-lib (multisig)', function () {
89
it('can create a 2-of-3 multisig P2SH address', function () {
@@ -37,7 +38,7 @@ describe('bitcoinjs-lib (multisig)', function () {
3738
var address = bitcoin.Address.fromOutputScript(scriptPubKey, bitcoin.networks.testnet).toString()
3839

3940
// Attempt to send funds to the source address
40-
blockchain.addresses.__faucetWithdraw(address, 2e4, function (err) {
41+
faucetWithdraw(address, 2e4, function (err) {
4142
if (err) return done(err)
4243

4344
// get latest unspents from the address

test/integration/utils.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
var https = require('https')
2+
3+
function faucetWithdraw(address, amount, done) {
4+
var url = "https://coconut-macaroon.herokuapp.com/bitcoin/testnet/withdrawal?address=" + address + "&amount=" + amount
5+
https.get(url, function(res) {
6+
res.statusCode == 200 ? done(null) : done(new Error("non-200 status: " + res.statusCode))
7+
}).on('error', done)
8+
}
9+
10+
module.exports = {
11+
faucetWithdraw: faucetWithdraw
12+
}

0 commit comments

Comments
 (0)