diff --git a/CHANGELOG.md b/CHANGELOG.md index ce39cf0..1a2a76e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Versions +## 22.1.1 + +- Improve support for SOCKS proxy on old node versions + ## 22.1.0 - Add support for LND 0.21.0 diff --git a/offchain/sign_payment_request.js b/offchain/sign_payment_request.js index afd7a45..04be8ed 100644 --- a/offchain/sign_payment_request.js +++ b/offchain/sign_payment_request.js @@ -104,7 +104,7 @@ module.exports = (args, cbk) => { }, // Create a key pair for a virtual channel invoice - getKeyPair: ['validate', async ({}, cbk) => { + getKeyPair: ['validate', async ({}) => { // Exit early when not using a virtual channel if (!args.is_virtual) { return; diff --git a/package-lock.json b/package-lock.json index db4ac9b..b6b157a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "balanceofsatoshis", - "version": "22.1.0", + "version": "22.1.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "balanceofsatoshis", - "version": "22.1.0", + "version": "22.1.1", "license": "MIT", "dependencies": { "@alexbosworth/blockchain": "3.2.0", diff --git a/package.json b/package.json index 11f0522..04f19b9 100644 --- a/package.json +++ b/package.json @@ -81,5 +81,5 @@ "postpublish": "docker buildx build --platform linux/amd64,linux/arm64 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .", "test": "npx nyc@17.1.0 node --experimental-test-coverage --test test/arrays/*.js test/balances/*.js test/chain/*.js test/display/*.js test/encryption/*.js test/lnd/*.js test/network/*.js test/nodes/*.js test/peers/*.js test/responses/*.js test/routing/*.js test/services/*.js test/swaps/*.js test/tags/*.js test/telegram/*.js test/wallets/*.js" }, - "version": "22.1.0" + "version": "22.1.1" } diff --git a/telegram/get_socks_proxy.js b/telegram/get_socks_proxy.js index 971d345..091229e 100644 --- a/telegram/get_socks_proxy.js +++ b/telegram/get_socks_proxy.js @@ -1,5 +1,6 @@ const asyncAuto = require('async/auto'); const {returnResult} = require('asyncjs-util'); + const {parse} = JSON; /** Get a SOCKS proxy given a JSON configuration file path @@ -32,12 +33,13 @@ module.exports = ({fs, path}, cbk) => { }, // Import socks-proxy-agent as ESM - getSocksProxyAgent: ['validate', async ({}, cbk) => { + getSocksAgent: ['validate', async ({}) => { try { const {SocksProxyAgent} = await import('socks-proxy-agent'); - return cbk(null, SocksProxyAgent); + + return SocksProxyAgent; } catch (err) { - return cbk([503, 'FailedToImportSocksProxyAgent', {err}]); + throw([503, 'FailedToImportSocksProxyAgent', {err}]); } }], @@ -57,7 +59,7 @@ module.exports = ({fs, path}, cbk) => { }], // Construct the SOCKS proxy agent - agent: ['getFile', 'getSocksProxyAgent', ({getFile, getSocksProxyAgent}, cbk) => { + agent: ['getFile', 'getSocksAgent', ({getFile, getSocksAgent}, cbk) => { try { parse(getFile); } catch (err) { @@ -65,7 +67,6 @@ module.exports = ({fs, path}, cbk) => { } const {host, password, port, userId} = parse(getFile); - const SocksProxyAgent = getSocksProxyAgent; try { if (!host) { @@ -86,7 +87,7 @@ module.exports = ({fs, path}, cbk) => { url.username = userId; } - const agent = new SocksProxyAgent(url.toString()); + const agent = new getSocksAgent(url.toString()); return cbk(null, {agent}); } catch (err) {