balanceofsatoshis 16.0.2 → 17.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Versions
2
2
 
3
+ ## 17.0.0
4
+
5
+ ### Breaking Changes
6
+
7
+ - Remove `gateway` command
8
+ - Remove support for node.js 16 and require 18+
9
+
3
10
  ## 16.0.2
4
11
 
5
12
  - `trade-secret`: Fix advertising when node is behind TorV3
package/README.md CHANGED
@@ -7,12 +7,13 @@ Commands for working with LND balances.
7
7
 
8
8
  Supported LND versions:
9
9
 
10
+ - v0.17.0-beta
10
11
  - v0.16.0-beta to v0.16.4-beta
11
12
  - v0.15.2-beta to v0.15.5-beta
12
13
 
13
14
  ## Install
14
15
 
15
- - Requires an [installation of Node v16+][nodejs-install-guide]
16
+ - Requires an [installation of Node v18+][nodejs-install-guide]
16
17
 
17
18
  ```shell
18
19
  npm install -g balanceofsatoshis
package/bos CHANGED
@@ -802,36 +802,6 @@ prog
802
802
  });
803
803
  })
804
804
 
805
- // Gateway service
806
- .command('gateway', 'Request gateway for https://ln-operator.github.io/')
807
- .visible(false)
808
- .help('Start LND gateway server listening for Web UI access')
809
- .help('Using the --remote option generates credentials for a remote gateway')
810
- .option('--minutes <minutes>', 'Minutes credentials valid for', INT, 10)
811
- .option('--node <node_name>', 'Node for gateway')
812
- .option('--nospend', 'Credentials do not include spending privileges')
813
- .option('--port <port>', 'Port for gateway', INT, 4805)
814
- .option('--remote <url>', 'Output credentials for a remote gateway')
815
- .action((args, options, logger) => {
816
- return new Promise(async (resolve, reject) => {
817
- try {
818
- return lnd.gateway({
819
- logger,
820
- credentials: await lnd.lndCredentials({
821
- is_nospend: options.nospend,
822
- node: options.node,
823
- }),
824
- minutes: options.minutes,
825
- is_nospend: options.nospend || undefined,
826
- port: options.port,
827
- remote: options.remote,
828
- });
829
- } catch (err) {
830
- return logger.error({err}) && reject();
831
- }
832
- });
833
- })
834
-
835
805
  // Give a peer some tokens
836
806
  .command('gift', 'Give a direct peer some free funds off-chain')
837
807
  .visible(false)
package/lnd/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  const authenticatedLnd = require('./authenticated_lnd');
2
2
  const findRecord = require('./find_record');
3
- const gateway = require('./gateway');
4
3
  const getCertValidityDays = require('./get_cert_validity_days');
5
4
  const getCredentials = require('./get_credentials');
6
5
  const getLnds = require('./get_lnds');
@@ -9,7 +8,6 @@ const lndCredentials = require('./lnd_credentials');
9
8
  module.exports = {
10
9
  authenticatedLnd,
11
10
  findRecord,
12
- gateway,
13
11
  getCertValidityDays,
14
12
  getCredentials,
15
13
  getLnds,
package/package.json CHANGED
@@ -37,7 +37,7 @@
37
37
  "ini": "4.1.1",
38
38
  "inquirer": "9.2.11",
39
39
  "ln-accounting": "7.0.2",
40
- "ln-service": "56.14.0",
40
+ "ln-service": "57.0.0",
41
41
  "ln-sync": "5.2.3",
42
42
  "ln-telegram": "5.0.0",
43
43
  "moment": "2.29.4",
@@ -54,11 +54,11 @@
54
54
  "description": "Lightning balance CLI",
55
55
  "devDependencies": {
56
56
  "invoices": "3.0.0",
57
- "ln-docker-daemons": "5.1.3",
57
+ "ln-docker-daemons": "6.0.1",
58
58
  "mock-lnd": "1.4.4"
59
59
  },
60
60
  "engines": {
61
- "node": ">=16"
61
+ "node": ">=18"
62
62
  },
63
63
  "keywords": [
64
64
  "cli",
@@ -82,5 +82,5 @@
82
82
  "postpublish": "docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t alexbosworth/balanceofsatoshis -t alexbosworth/balanceofsatoshis:$npm_package_version --push .",
83
83
  "test": "npx nyc@15.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"
84
84
  },
85
- "version": "16.0.2"
85
+ "version": "17.0.0"
86
86
  }
package/lnd/gateway.js DELETED
@@ -1,101 +0,0 @@
1
- const {encode} = require('cbor');
2
- const {grpcProxyServer} = require('ln-service/routers');
3
- const moment = require('moment');
4
- const {restrictMacaroon} = require('ln-service');
5
-
6
- const base64AsBuf = base64 => Buffer.from(base64, 'base64');
7
- const bufferAsHex = buffer => buffer.toString('hex');
8
- const expiryMs = n => 1000 * 60 * n;
9
- const maxTimeLimitMinutes = 60;
10
- const {now} = Date;
11
- const path = '/v0/grpc/';
12
-
13
- /** Start an LND gateway server
14
-
15
- {
16
- credentials: {
17
- cert: <LND Base64 Encoded String>
18
- socket: <LND Socket String>
19
- }
20
- [is_nospend]: <Restrict Credentials To Non-Spending Permissions Bool>
21
- logger: <Winston Logger Object>
22
- minutes: <Expire Access in Minutes Number>
23
- port: <Listen Port Number>
24
- remote: <Remote Gateway URL String>
25
- }
26
-
27
- @returns
28
- {}
29
- */
30
- module.exports = args => {
31
- if (!args.credentials) {
32
- throw new Error('ExpectedCredentialsForLndGateway');
33
- }
34
-
35
- if (!args.credentials.cert) {
36
- throw new Error('ExpectedCertToStartLndGateway');
37
- }
38
-
39
- if (!args.logger) {
40
- throw new Error('ExpectedLoggerToStartLndGateway');
41
- }
42
-
43
- if (!args.minutes) {
44
- throw new Error('ExpectedMinutesToStartLndGateway');
45
- }
46
-
47
- if (args.minutes > maxTimeLimitMinutes) {
48
- throw new Error('ExpectedMinutesToBeLessThanOrEqualToOneHour');
49
- }
50
-
51
- if (!args.port) {
52
- throw new Error('ExpectedPortToStartLndGateway');
53
- }
54
-
55
- if (!args.credentials.socket) {
56
- throw new Error('ExpectedLndRpcSocketToStartLndGateway');
57
- }
58
-
59
- const expiry = new Date(now() + expiryMs(args.minutes));
60
-
61
- const {macaroon} = restrictMacaroon({
62
- expires_at: expiry.toISOString(),
63
- macaroon: args.credentials.macaroon,
64
- });
65
-
66
- const code = encode({
67
- macaroon: base64AsBuf(macaroon),
68
- port: !args.remote ? args.port : undefined,
69
- url: args.remote || undefined,
70
- });
71
-
72
- args.logger.info({
73
- connection_code: bufferAsHex(code),
74
- expires_at: moment(expiry).calendar(),
75
- });
76
-
77
- if (!!args.remote) {
78
- return;
79
- }
80
-
81
- const log = (err, line) => {
82
- if (!!err) {
83
- return args.logger.error({gateway: err});
84
- }
85
-
86
- return args.logger.info({
87
- gateway: line,
88
- is_nospend: !!args.is_nospend,
89
- })
90
- };
91
-
92
- const {app, server, wss} = grpcProxyServer({
93
- log,
94
- path,
95
- cert: args.credentials.cert,
96
- port: args.port,
97
- socket: args.credentials.socket,
98
- });
99
-
100
- return {};
101
- };