Socket
Socket
Sign inDemoInstall

chain-node

Package Overview
Dependencies
Maintainers
3
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chain-node - npm Package Compare versions

Comparing version 0.0.13 to 0.0.15

133

index.js

@@ -12,2 +12,11 @@ var request = require('request');

},
getApiKeyId: function() {
return this.apiKeyId || this.getKey();
},
getApiKeySecret: function() {
return this.apiKeySecret;
},
getAuth: function() {
return {user: this.getApiKeyId(), pass: this.getApiKeySecret()};
},
getVersion: function() {

@@ -22,2 +31,5 @@ return this.version || 'v1';

},
getWebhooksURL: function() {
return URL + '/' + this.getVersion();
},
getAddress: function(address, cb) {

@@ -29,3 +41,3 @@ request({

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -50,3 +62,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -65,3 +77,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -80,3 +92,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -92,3 +104,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -104,3 +116,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -116,3 +128,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
json: {hex: hex},

@@ -129,3 +141,3 @@ }, function(err, msg, resp) {

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -141,3 +153,3 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {

@@ -153,7 +165,108 @@ cb(err, JSON.parse(resp));

cert: PEM,
auth: {user: this.getKey()},
auth: this.getAuth(),
}, function(err, msg, resp) {
cb(err, JSON.parse(resp));
});
},
createWebhookUrl: function(url, alias, cb) {
var body = {};
body['url'] = url;
if(alias != null) {
body['alias'] = alias;
}
request({
method: 'POST',
uri: this.getWebhooksURL() + '/webhooks',
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
json: body,
}, function(err, msg, resp) {
cb(err, resp);
});
},
listWebhookUrls: function(cb) {
request({
method: 'GET',
uri: this.getWebhooksURL() + '/webhooks',
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
}, function(err, msg, resp) {
cb(err, JSON.parse(resp));
});
},
updateWebhookUrl: function(identifier, url, cb) {
request({
method: 'PUT',
uri: this.getWebhooksURL() + '/webhooks/' + identifier,
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
json: {url: url},
}, function(err, msg, resp) {
cb(err, resp);
});
},
deleteWebhookUrl: function(identifier, cb) {
request({
method: 'DELETE',
uri: this.getWebhooksURL() + '/webhooks/' + identifier,
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
}, function(err, msg, resp) {
cb(err, JSON.parse(resp));
});
},
createWebhookEvent: function(identifier, opts, cb) {
if(opts['event'] == null) {
opts['event'] = 'address-transaction';
}
if(opts['block_chain'] == null) {
opts['block_chain'] = this.getBlockChain();
}
if(opts['address'] == null) {
cb('Missing address parameter', null);
}
if(opts['confirmations'] == null) {
opts['confirmations'] = 1;
}
request({
method: 'POST',
uri: this.getWebhooksURL() + '/webhooks/' + identifier + '/events',
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
json: opts
}, function(err, msg, resp) {
cb(err, resp);
});
},
listWebhookEvents: function(identifier, cb) {
request({
method: 'GET',
uri: this.getWebhooksURL() + '/webhooks/' + identifier + '/events',
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
}, function(err, msg, resp) {
cb(err, JSON.parse(resp));
});
},
deleteWebhookEvent: function(identifier, eventType, address, cb) {
var url = this.getWebhooksURL();
url += '/webhooks/' + identifier;
url += '/events/' + eventType;
url += '/' + address;
request({
method: 'DELETE',
uri: url,
strictSSL: true,
cert: PEM,
auth: this.getAuth(),
}, function(err, msg, resp) {
cb(err, JSON.parse(resp));
});
}
};

2

package.json
{
"name": "chain-node",
"version": "0.0.13",
"version": "0.0.15",
"description": "The Official Node.js SDK for Chain's Bitcoin API",

@@ -5,0 +5,0 @@ "main": "index.js",

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