Comparing version 1.0.1 to 1.1.0
var sys = require('sys'); | ||
var http = require('http'); | ||
var METHOD_NOT_ALLOWED = "Method Not Allowed\n"; | ||
@@ -64,3 +63,6 @@ var INVALID_REQUEST = "Invalid Request\n"; | ||
var decoded = JSON.parse(buffer); | ||
if(decoded.hasOwnProperty('result')) { | ||
if(decoded.hasOwnProperty('error') && decoded.error != null) { | ||
if (errback) | ||
errback(decoded.error) | ||
} else if(decoded.hasOwnProperty('result')) { | ||
if (callback) | ||
@@ -67,0 +69,0 @@ callback(decoded.result); |
{ | ||
"name": "bitcoin", | ||
"description": "Communicate with bitcoind via JSON-RPC", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"main": "./lib/bitcoin", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -5,8 +5,7 @@ | ||
doCmd('getWork'); | ||
function doCmd(cmd) { | ||
client[cmd](function(data) { | ||
client[cmd](function(err, data) { | ||
console.log(cmd); | ||
console.log(data); | ||
console.log("err: ", err); | ||
console.log(''); | ||
@@ -16,1 +15,2 @@ }); | ||
doCmd('getWork'); |
@@ -7,3 +7,3 @@ var path = require('path'); | ||
var test = { | ||
account: "test" | ||
account: "test" | ||
} | ||
@@ -36,3 +36,3 @@ | ||
'is valid': function(address){ | ||
assert.ok(address, "Update test variables with a valid address?"); | ||
assert.ok(address); | ||
}, | ||
@@ -46,4 +46,18 @@ 'after getting the account name again': { | ||
} | ||
} | ||
}, | ||
}, | ||
'listTransactions with specific amount': { | ||
topic: function(client){ | ||
client.listTransactions(test.account, 15, this.callback); | ||
}, | ||
'should not be empty': function(txs){ assert.ok(txs); }, | ||
'is an array': function(txs) { assert.isTrue(txs instanceof Array); } | ||
}, | ||
'listTransactions without specific amount': { | ||
topic: function(client){ | ||
client.listTransactions(test.account, this.callback); | ||
}, | ||
'should not be empty': function(txs){ assert.ok(txs); }, | ||
'is an array': function(txs) { assert.isTrue(txs instanceof Array); } | ||
}, | ||
'account addresses': { | ||
@@ -81,2 +95,6 @@ topic: function(client){ | ||
}, | ||
'getWork': { | ||
topic: function(client) { client.getWork(this.callback); }, | ||
'should not be empty': notEmpty, | ||
}, | ||
'getTransaction': { | ||
@@ -88,4 +106,4 @@ topic: "TODO: get valid transaction", | ||
}).run(); | ||
}).export(module); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15232
399