11var https = require ( 'https' )
22
3- function faucetWithdraw ( address , amount , done ) {
4- var url = " https://coconut-macaroon.herokuapp.com/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 ) )
3+ function faucetWithdraw ( address , amount , done ) {
4+ var url = ' https://coconut-macaroon.herokuapp.com/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 ) )
77 } ) . on ( 'error' , done )
88}
99
10- function pollUnspent ( blockchain , address , done ) {
10+ function pollUnspent ( blockchain , address , done ) {
1111 blockchain . addresses . unspents ( address , function ( err , unspents ) {
1212 if ( err ) return done ( err )
1313
14- if ( unspents == null || unspents . length === 0 ) {
15- return setTimeout ( function ( ) {
14+ if ( ! unspents || unspents . length === 0 ) {
15+ return setTimeout ( function ( ) {
1616 pollUnspent ( blockchain , address , done )
1717 } , 200 )
1818 }
@@ -21,12 +21,12 @@ function pollUnspent(blockchain, address, done) {
2121 } )
2222}
2323
24- function pollSummary ( blockchain , address , done ) {
24+ function pollSummary ( blockchain , address , done ) {
2525 blockchain . addresses . summary ( address , function ( err , result ) {
2626 if ( err ) return done ( err )
2727
28- if ( result . balance == 0 ) {
29- return setTimeout ( function ( ) {
28+ if ( result . balance = == 0 ) {
29+ return setTimeout ( function ( ) {
3030 pollSummary ( blockchain , address , done )
3131 } , 200 )
3232 }
0 commit comments