@dashevo/dashd-rpc
Advanced tools
Comparing version 2.3.1 to 2.3.2
@@ -201,2 +201,3 @@ /* eslint-disable */ | ||
getBlockHeaders: 'str int bool', | ||
getBlockStats: 'int_str obj', | ||
getBlockTemplate: '', | ||
@@ -335,2 +336,9 @@ getConnectionCount: '', | ||
}, | ||
int_str(arg) { | ||
if (typeof arg === 'number') { | ||
return parseFloat(arg) | ||
} | ||
return arg.toString() | ||
}, | ||
float(arg) { | ||
@@ -337,0 +345,0 @@ return parseFloat(arg); |
{ | ||
"name": "@dashevo/dashd-rpc", | ||
"description": "Dash Client Library to connect to Dash Core (dashd) via RPC", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Stephen Pair", |
@@ -164,5 +164,4 @@ 'use strict'; | ||
it('should process object arguments', function(done) { | ||
var client = new RpcClient({ | ||
it('should process int_str arguments', async () => { | ||
const client = new RpcClient({ | ||
user: 'user', | ||
@@ -173,9 +172,9 @@ pass: 'pass', | ||
rejectUnauthorized: true, | ||
disableAgent: false | ||
disableAgent: false, | ||
}); | ||
var requestStub = sinon.stub(client.protocol, 'request').callsFake(function(options, callback){ | ||
var res = new FakeResponse(); | ||
var req = new FakeRequest(); | ||
setImmediate(function(){ | ||
const requestStub = sinon.stub(client.protocol, 'request').callsFake(function(options, callback){ | ||
const res = new FakeResponse(); | ||
const req = new FakeRequest(); | ||
setImmediate(() => { | ||
res.emit('data', req.data); | ||
@@ -188,15 +187,15 @@ res.emit('end'); | ||
var obj = {'n28S35tqEMbt6vNad7A5K3mZ7vdn8dZ86X': 1}; | ||
async.eachSeries([obj, JSON.stringify(obj)], function(i, next) { | ||
client.sendMany('account', i, function(error, parsedBuf) { | ||
should.not.exist(error); | ||
should.exist(parsedBuf); | ||
parsedBuf.params[1].should.have.property('n28S35tqEMbt6vNad7A5K3mZ7vdn8dZ86X', 1); | ||
next(); | ||
}); | ||
}, function(err) { | ||
requestStub.restore(); | ||
done(); | ||
}); | ||
const blockByHeight = await (new Promise((res) => client.getBlockStats(1, ['height'], (err, data) => res(data)))); | ||
should.exist(blockByHeight); | ||
blockByHeight.params[0].should.equal(1); | ||
blockByHeight.params[1].should.deep.equal(['height']); | ||
const blockByHash = await (new Promise((res) => client.getBlockStats('fake_hash', ['height'], (err, data) => res(data)))); | ||
should.exist(blockByHash); | ||
blockByHash.params[0].should.equal('fake_hash'); | ||
blockByHash.params[1].should.deep.equal(['height']); | ||
requestStub.restore(); | ||
}); | ||
@@ -203,0 +202,0 @@ |
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
31802
798