Browse Source

Merge pull request #426 from bitcoinjs/fixfaucet

use BlockTrail for testnet faucet
hk-custom-address
Daniel Cousens 9 years ago
parent
commit
ddc69d5042
  1. 1
      package.json
  2. 19
      test/integration/utils.js

1
package.json

@ -60,6 +60,7 @@
"cb-blockr": "^3.1.1",
"cb-insight": "git://github.com/weilu/cb-insight",
"coveralls": "^2.11.2",
"httpify": "^1.0.0",
"istanbul": "^0.3.5",
"mocha": "^2.2.0",
"proxyquire": "^1.4.0",

19
test/integration/utils.js

@ -1,10 +1,15 @@
var https = require('https')
function faucetWithdraw (address, amount, done) {
var url = 'https://coconut-macaroon.herokuapp.com/withdrawal?address=' + address + '&amount=' + amount
https.get(url, function (res) {
res.statusCode === 200 ? done(null) : done(new Error('non-200 status: ' + res.statusCode))
}).on('error', done)
var httpify = require('httpify')
function faucetWithdraw (address, amount, callback) {
httpify({
method: 'POST',
url: 'https://api.blocktrail.com/v1/tBTC/faucet/withdrawl?api_key=c0bd8155c66e3fb148bb1664adc1e4dacd872548',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
address: address,
amount: amount
})
}, callback)
}
function pollUnspent (blockchain, address, done) {

Loading…
Cancel
Save