Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@dashevo/dashd-rpc

Package Overview
Dependencies
Maintainers
7
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dashevo/dashd-rpc - npm Package Compare versions

Comparing version 2.3.2 to 2.4.0

14

lib/index.js

@@ -13,2 +13,3 @@ /* eslint-disable */

this.pass = opts.pass || 'pass';
this.timeout = opts.timeout;
this.protocol = opts.protocol === 'http' ? http : https;

@@ -78,2 +79,6 @@ this.batchedCalls = null;

agent: self.disableAgent ? false : undefined,
};
if (self.timeout) {
options.timeout = self.timeout;
};

@@ -147,2 +152,7 @@

req.on('timeout', () => {
const err = new Error(`Timeout Error: ${options.timeout}ms exceeded`);
callback(err);
});
req.setHeader('Content-Length', request.length);

@@ -162,2 +172,6 @@ req.setHeader('Content-Type', 'application/json');

RpcClient.prototype.setTimeout = function (timeout) {
this.timeout = timeout;
}
// For definitions of RPC calls, see various files in: https://github.com/dashpay/dash/tree/master/src

@@ -164,0 +178,0 @@ RpcClient.callspec = {

2

package.json
{
"name": "@dashevo/dashd-rpc",
"description": "Dash Client Library to connect to Dash Core (dashd) via RPC",
"version": "2.3.2",
"version": "2.4.0",
"author": {

@@ -6,0 +6,0 @@ "name": "Stephen Pair",

@@ -124,3 +124,4 @@ # dashd-rpc

host: '127.0.0.1',
port: 19998
port: 19998,
timeout: 1000
});

@@ -127,0 +128,0 @@

@@ -528,2 +528,30 @@ 'use strict';

});
it('should throw error when timeout is triggered', (done) => {
var client = new RpcClient({
user: 'user',
pass: 'pass',
host: 'localhost',
port: 8332,
});
client.httpOptions = {
timeout: 100
};
var requestStub = sinon.stub(client.protocol, 'request').callsFake(function (options, callback) {
var req = new FakeRequest();
setTimeout(function () {
req.emit('timeout');
}, options.timeout);
return req;
});
client.getDifficulty((error, parsedBuf) => {
should.exist(error);
should.not.exist(parsedBuf);
error.message.should.equal(`Timeout Error: ${client.httpOptions.timeout}ms exceeded`);
requestStub.restore();
done();
})
});
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc