Socket
Socket
Sign inDemoInstall

bitcoind-rpc

Package Overview
Dependencies
0
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.2 to 0.8.0

47

lib/index.js

@@ -5,4 +5,30 @@ 'use strict';

var https = require('https');
var url = require('url');
function decodeURL(str) {
var parsedUrl = url.parse(str);
var hostname = parsedUrl.hostname;
var port = parseInt(parsedUrl.port, 10);
var protocol = parsedUrl.protocol;
// strip trailing ":"
protocol = protocol.substring(0, protocol.length - 1);
var auth = parsedUrl.auth;
var parts = auth.split(':');
var user = parts[0] ? decodeURIComponent(parts[0]) : null;
var pass = parts[1] ? decodeURIComponent(parts[1]) : null;
var opts = {
host: hostname,
port: port,
protocol: protocol,
user: user,
pass: pass,
};
return opts;
}
function RpcClient(opts) {
// opts can ba an URL string
if (typeof opts === 'string') {
opts = decodeURL(opts);
}
opts = opts || {};

@@ -145,3 +171,3 @@ this.host = opts.host || '127.0.0.1';

encryptWallet: '',
estimateFee: 'int',
estimateFee: '',
estimateSmartFee: 'int str',

@@ -163,3 +189,3 @@ estimatePriority: 'int',

getBlockDeltas: 'str',
getBlock: 'str bool',
getBlock: 'str int',
getBlockchainInfo: '',

@@ -197,2 +223,3 @@ getBlockCount: '',

importAddress: 'str str bool',
importMulti: 'obj obj',
importPrivKey: 'str str bool',

@@ -221,2 +248,3 @@ invalidateBlock: 'str',

signRawTransaction: '',
signRawTransactionWithWallet: 'str',
stop: '',

@@ -292,8 +320,11 @@ submitBlock: '',

for(var k in apiCalls) {
var spec = apiCalls[k].split(' ');
for (var i = 0; i < spec.length; i++) {
if(types[spec[i]]) {
spec[i] = types[spec[i]];
} else {
spec[i] = types.str;
var spec = [];
if (apiCalls[k].length) {
spec = apiCalls[k].split(' ');
for (var i = 0; i < spec.length; i++) {
if(types[spec[i]]) {
spec[i] = types[spec[i]];
} else {
spec[i] = types.str;
}
}

@@ -300,0 +331,0 @@ }

2

package.json
{
"name": "bitcoind-rpc",
"description": "Bitcoin Client Library to connect to Bitcoin Core via RPC",
"version": "0.7.2",
"version": "0.8.0",
"author": {

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

@@ -33,2 +33,5 @@ bitcoind-rpc.js

// config can also be an url, e.g.:
// var config = 'http://user:pass@127.0.0.1:18332';
var rpc = new RpcClient(config);

@@ -35,0 +38,0 @@

@@ -97,2 +97,11 @@ 'use strict';

it('should accept URL', function() {
var client = new RpcClient('http://abc:def@ghi.xyz:1337');
client.protocol.should.equal(http);
client.host.should.equal('ghi.xyz');
client.port.should.equal(1337);
client.user.should.equal('abc');
client.pass.should.equal('def');
});
it('should call a method and receive response', function(done) {

@@ -99,0 +108,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc