use BlockTrail for testnet faucet

This commit is contained in:
Daniel Cousens 2015-07-24 13:54:41 +10:00
parent 5ce093739e
commit c3a3f17ef0
2 changed files with 12 additions and 6 deletions

View file

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

View file

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