Socket
Socket
Sign inDemoInstall

opennode

Package Overview
Dependencies
2
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.4.0

8

package.json

@@ -29,9 +29,9 @@ {

"main": "src/lib.js",
"version": "1.3.0",
"version": "1.4.0",
"dependencies": {
"axios": "^0.21.1"
"axios": "^0.26.1"
},
"devDependencies": {
"chai": "^4.2.0",
"mocha": "^5.2.0"
"chai": "^4.3.6",
"mocha": "^9.2.2"
},

@@ -38,0 +38,0 @@ "scripts": {

@@ -27,2 +27,6 @@ const OpenNodeClient = require('../submodules/client')

async function initiateExchange(exchange) {
return await instance.initiateExchange(exchange);
}
async function withdrawalInfo(id) {

@@ -52,4 +56,4 @@ return await instance.withdrawalInfo(id);

async function verifySignature(charge) {
return await instance.verifySignature(charge);
function verifySignature(charge) {
return instance.verifySignature(charge);
}

@@ -69,2 +73,10 @@

async function initiatePayout(payout) {
return await instance.initiatePayout(payout);
}
async function payoutInfo(id) {
return await instance.payoutInfo(id);
}
async function createLnUrlWithdrawal(withdrawal) {

@@ -80,2 +92,3 @@ return await instance.createLnUrlWithdrawal(withdrawal);

initiateWithdrawal: initiateWithdrawal,
initiateExchange: initiateExchange,
initiateWithdrawalAsync: initiateWithdrawalAsync,

@@ -91,4 +104,5 @@ withdrawalInfo: withdrawalInfo,

refundInfo: refundInfo,
initiatePayout: initiatePayout,
payoutInfo: payoutInfo,
createLnUrlWithdrawal: createLnUrlWithdrawal,
};

@@ -60,2 +60,18 @@ const axios = require('axios');

async initiateExchange(exchange) {
try {
let new_instance = axios.create();
new_instance.defaults.baseURL = (this.env === 'live') ? 'https://api.opennode.com/v2' : 'https://dev-api.opennode.com/v2';
new_instance.defaults.timeout = 15000;
new_instance.defaults.headers = { 'Authorization': this.api_key, 'user_agent': version };
const response = await new_instance.post('/exchanges', exchange);
return response.data;
}
catch (error) {
throw Exception(error.response.status, error.response.statusText, error.response.data.message);
}
}
async withdrawalInfo(id) {

@@ -130,3 +146,3 @@ try {

async verifySignature(charge) {
verifySignature(charge) {
const hash = crypto.createHmac('sha256', this.api_key).update(charge.id).digest('hex');

@@ -166,2 +182,22 @@ return hash === charge.hashed_order;

async initiatePayout(payout) {
try {
const response = await this.instance.post(`/payouts`, payout);
return response.data.data;
}
catch (error) {
throw Exception(error.response.status, error.response.statusText, error.response.data.message);
}
}
async payoutInfo(id) {
try {
const response = await this.instance.get(`/payout/${id}`);
return response.data.data;
}
catch (error) {
throw Exception(error.response.status, error.response.statusText, error.response.data.message);
}
}
async createLnUrlWithdrawal(withdrawal) {

@@ -168,0 +204,0 @@ try {

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