lightning 5.15.1 → 5.15.2

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,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## 5.15.1
3
+ ## 5.15.2
4
4
 
5
5
  - `getFailedPayments`, `getPayments`, `getPendingPayments`: Remove
6
6
  `confirmed_at` date when a payment is not confirmed, add `created_at` and
package/README.md CHANGED
@@ -66,9 +66,13 @@ To access unauthenticated methods like the wallet unlocker, use
66
66
 
67
67
  ## Methods
68
68
 
69
+ - [addExternalSocket](https://github.com/alexbosworth/ln-service#addexternalsocket):
70
+ Add a new LN p2p network socket to node advertisement
69
71
  - [addPeer](https://github.com/alexbosworth/ln-service#addpeer): Connect to a new peer
70
72
  - [authenticatedLndGrpc](https://github.com/alexbosworth/ln-service#authenticatedlndgrpc):
71
73
  Instantiate connection to authenticated lnd methods.
74
+ - [beginGroupSigningSession](https://github.com/alexbosworth/ln-service#begingroupsigningsession):
75
+ Start a new MuSig2 signing session
72
76
  - [broadcastChainTransaction](https://github.com/alexbosworth/ln-service#broadcastchaintransaction):
73
77
  Publish an on-chain transaction to the network.
74
78
  - [cancelHodlInvoice](https://github.com/alexbosworth/ln-service#cancelhodlinvoice): Cancel an
@@ -111,6 +115,8 @@ To access unauthenticated methods like the wallet unlocker, use
111
115
  Remove a connected watchtower
112
116
  - [enableChannel](https://github.com/alexbosworth/ln-service#enablechannel): Signal forwarding
113
117
  enabled towards a peer.
118
+ - [endGroupSigningSession](https://github.com/alexbosworth/ln-service#endgroupsigningsession):
119
+ End a MuSig2 signing session
114
120
  - [fundPendingChannels](https://github.com/alexbosworth/ln-service#fundpendingchannels):
115
121
  Provide a signed funding source for opening channels.
116
122
  - [fundPsbt](https://github.com/alexbosworth/ln-service#fundpsbt): Make a PSBT with funds and
@@ -235,6 +241,8 @@ To access unauthenticated methods like the wallet unlocker, use
235
241
  Attempt to recover channel funds from a specific channel backup.
236
242
  - [recoverFundsFromChannels](https://github.com/alexbosworth/ln-service#recoverfundsfromchannels):
237
243
  Attempt to recover funds from multiple channels using a multiple channel backup.
244
+ - [removeExternalSocket](https://github.com/alexbosworth/ln-service#removeexternalsocket):
245
+ Remove a LN p2p network socket from the node advertisement
238
246
  - [removePeer](https://github.com/alexbosworth/ln-service#removepeer): Disconnect from a
239
247
  connected peer.
240
248
  - [requestChainFeeIncrease](https://github.com/alexbosworth/ln-service#requestchainfeeincrease):
@@ -313,10 +321,16 @@ To access unauthenticated methods like the wallet unlocker, use
313
321
  UTXO to allow it to be selected for spending again.
314
322
  - [unlockWallet](https://github.com/alexbosworth/ln-service#unlockwallet): Decrypt the wallet and
315
323
  start the daemon
324
+ - [updateAlias](https://github.com/alexbosworth/ln-service#updatealias):
325
+ Update the advertised node alias
316
326
  - [updateChainTransaction](https://github.com/alexbosworth/ln-service#updatechaintransaction):
317
327
  Edit the metadata of an on-chain transaction record.
328
+ - [updateColor](https://github.com/alexbosworth/ln-service#updatecolor):
329
+ Update the advertised node color
318
330
  - [updateConnectedWatchtower](https://github.com/alexbosworth/ln-service#updateconnectedwatchtower):
319
331
  Edit the settings on an added watchtower
332
+ - [updateGroupSigningSession](https://github.com/alexbosworth/ln-service#updategroupsigningsession):
333
+ Update a MuSig2 signing session with nonces and get a partial signature
320
334
  - [updatePathfindingSettings](https://github.com/alexbosworth/ln-service#updatepathfindingsettings):
321
335
  Edit the configuration for routing calculations
322
336
  - [updateRoutingFees](https://github.com/alexbosworth/ln-service#updateroutingfees): Set the
@@ -129,6 +129,14 @@ module.exports = (args, cbk) => {
129
129
  return cbk([400, 'ExpectedLndApiObjectToGetRouteToDestination']);
130
130
  }
131
131
 
132
+ if (!!args.outgoing_channel) {
133
+ try {
134
+ chanNumber({channel: args.outgoing_channel});
135
+ } catch (err) {
136
+ return cbk([400, 'ExpectedStandardFormatChannelIdForOutChannel']);
137
+ }
138
+ }
139
+
132
140
  if (!!args.total_mtokens && !args.payment) {
133
141
  return cbk([400, 'ExpectedTotalMtokensWithPaymentIdentifier']);
134
142
  }
@@ -0,0 +1,20 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type AddExternalSocketArgs = AuthenticatedLightningArgs<{
7
+ /** Add Socket Address String */
8
+ socket: string;
9
+ }>;
10
+
11
+ /**
12
+ * Add a new advertised p2p socket address
13
+ *
14
+ * Note: this method is not supported in LND versions 0.14.3 and below
15
+ *
16
+ * Requires LND built with `peersrpc` build tag
17
+ *
18
+ * Requires `peers:write` permissions
19
+ */
20
+ export const addExternalSocket: AuthenticatedLightningMethod<AddExternalSocketArgs>;
@@ -1,4 +1,8 @@
1
+ export * from './add_external_socket';
1
2
  export * from './add_peer';
2
3
  export * from './get_peers';
4
+ export * from './remove_external_socket';
3
5
  export * from './remove_peer';
4
6
  export * from './subscribe_to_peers';
7
+ export * from './update_alias';
8
+ export * from './update_color';
@@ -0,0 +1,20 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type RemoveExternalSocketArgs = AuthenticatedLightningArgs<{
7
+ /** Remove Socket Address String */
8
+ socket: string;
9
+ }>;
10
+
11
+ /**
12
+ * Remove an existing advertised p2p socket address
13
+ *
14
+ * Note: this method is not supported in LND versions 0.14.3 and below
15
+ *
16
+ * Requires LND built with `peersrpc` build tag
17
+ *
18
+ * Requires `peers:write` permissions
19
+ */
20
+ export const removeExternalSocket: AuthenticatedLightningMethod<RemoveExternalSocketArgs>;
@@ -0,0 +1,11 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type UpdateAliasArgs = AuthenticatedLightningArgs<{
7
+ /** Node Alias String */
8
+ node: string;
9
+ }>;
10
+
11
+ export const updateAlias: AuthenticatedLightningMethod<UpdateAliasArgs>;
@@ -0,0 +1,11 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type UpdateColorArgs = AuthenticatedLightningArgs<{
7
+ /** Node Color String */
8
+ color: string;
9
+ }>;
10
+
11
+ export const updateColor: AuthenticatedLightningMethod<UpdateColorArgs>;
@@ -0,0 +1,33 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type BeginGroupSigningSessionArgs = AuthenticatedLightningArgs<{
7
+ /** Key Is BIP 86 Key Spend Key Bool */
8
+ is_key_spend?: boolean;
9
+ /** HD Seed Key Family Number */
10
+ key_family: number;
11
+ /** Key Index Number */
12
+ key_index: number;
13
+ /** External Public Key Hex String */
14
+ public_keys: string[];
15
+ /** Taproot Script Root Hash Hex String */
16
+ root_hash?: string;
17
+ }>;
18
+
19
+ export type BeginGroupSigningSessionResult = {
20
+ /** Final Script or Top Level Public Key Hex String */
21
+ external_key: string;
22
+ /** Session Id Hex String */
23
+ id: string;
24
+ /** Internal Top Level Public Key Hex String */
25
+ internal_key?: string;
26
+ /** Session Compound Nonces Hex String */
27
+ nonce: string;
28
+ };
29
+
30
+ export const beginGroupSigningSession: AuthenticatedLightningMethod<
31
+ BeginGroupSigningSessionArgs,
32
+ BeginGroupSigningSessionResult
33
+ >;
@@ -0,0 +1,21 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type EndGroupSigningSessionArgs = AuthenticatedLightningArgs<{
7
+ /** Session Id Hex String */
8
+ id: string;
9
+ /** Combine External Partial Signature Hex Strings */
10
+ signatures?: string[];
11
+ }>;
12
+
13
+ export type EndGroupSigningSessionResult = {
14
+ /** Combined Signature Hex String */
15
+ signature?: string;
16
+ };
17
+
18
+ export const endGroupSigningSession: AuthenticatedLightningMethod<
19
+ EndGroupSigningSessionArgs,
20
+ EndGroupSigningSessionResult
21
+ >;
@@ -1,4 +1,7 @@
1
+ export * from './begin_group_signing_session';
1
2
  export * from './diffie_hellman_compute_secret';
3
+ export * from './end_group_signing_session';
2
4
  export * from './sign_bytes';
3
5
  export * from './sign_transaction';
6
+ export * from './update_group_signing_session';
4
7
  export * from './verify_bytes_signature';
@@ -0,0 +1,23 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript/shared';
5
+
6
+ export type UpdateGroupSigningSessionArgs = AuthenticatedLightningArgs<{
7
+ /** Hash to Sign Hex String */
8
+ hash: string;
9
+ /** MuSig2 Session Id Hex String */
10
+ id: string;
11
+ /** Nonce Hex Strings */
12
+ nonces: string[];
13
+ }>;
14
+
15
+ export type UpdateGroupSigningSessionResult = {
16
+ /** Partial Signature Hex String */
17
+ signature: string;
18
+ };
19
+
20
+ export const updateGroupSigningSession: AuthenticatedLightningMethod<
21
+ UpdateGroupSigningSessionArgs,
22
+ UpdateGroupSigningSessionResult
23
+ >;
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "@grpc/grpc-js": "1.6.7",
11
11
  "@grpc/proto-loader": "0.6.12",
12
12
  "@types/express": "4.17.13",
13
- "@types/node": "17.0.31",
13
+ "@types/node": "17.0.32",
14
14
  "@types/request": "2.48.8",
15
15
  "@types/ws": "8.5.3",
16
16
  "async": "3.2.3",
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "5.15.1"
62
+ "version": "5.15.2"
63
63
  }
@@ -70,6 +70,11 @@ const makeArgs = override => {
70
70
  };
71
71
 
72
72
  const tests = [
73
+ {
74
+ args: makeArgs({confidence: NaN}),
75
+ description: 'Valid confidence is required',
76
+ error: [400, 'ExpectedConfidenceInPartsPerMillionForQuery'],
77
+ },
73
78
  {
74
79
  args: makeArgs({destination: undefined}),
75
80
  description: 'A destination is required',
@@ -85,6 +90,11 @@ const tests = [
85
90
  description: 'LND is required',
86
91
  error: [400, 'ExpectedLndApiObjectToGetRouteToDestination'],
87
92
  },
93
+ {
94
+ args: makeArgs({outgoing_channel: 12345}),
95
+ description: 'Outgoing channel is expected in standard format',
96
+ error: [400, 'ExpectedStandardFormatChannelIdForOutChannel'],
97
+ },
88
98
  {
89
99
  args: makeArgs({payment: undefined}),
90
100
  description: 'Total mtokens requires linking payment identifier',
@@ -132,6 +142,11 @@ const tests = [
132
142
  description: 'No route is found with error',
133
143
  expected: {},
134
144
  },
145
+ {
146
+ args: makeArgs({lnd: makeLnd({err: {details: 'is too large'}})}),
147
+ description: 'Payment cannot exceed maximum size',
148
+ error: [400, 'PaymentTooLargeToFindRoute'],
149
+ },
135
150
  {
136
151
  args: makeArgs({lnd: makeLnd({res: {routes: []}})}),
137
152
  description: 'No route is found',
@@ -0,0 +1,14 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {addExternalSocket} from '../../lnd_methods';
3
+ import {AuthenticatedLnd} from '../../lnd_grpc';
4
+
5
+ const lnd = {} as AuthenticatedLnd;
6
+ const socket = 'socket';
7
+
8
+ expectError(addExternalSocket());
9
+ expectError(addExternalSocket({}));
10
+ expectError(addExternalSocket({lnd}));
11
+ expectError(addExternalSocket({socket}));
12
+
13
+ expectType<void>(await addExternalSocket({lnd, socket}));
14
+ expectType<void>(addExternalSocket({lnd, socket}, () => {}));
@@ -0,0 +1,60 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {
3
+ beginGroupSigningSession,
4
+ BeginGroupSigningSessionResult,
5
+ } from '../../lnd_methods';
6
+ import {AuthenticatedLnd} from '../../lnd_grpc';
7
+
8
+ const lnd = {} as AuthenticatedLnd;
9
+ const is_key_spend = true;
10
+ const key_family = 0;
11
+ const key_index = 0;
12
+ const public_keys = ['pubkey'];
13
+ const root_hash = 'root hash';
14
+
15
+ expectError(beginGroupSigningSession());
16
+ expectError(beginGroupSigningSession({}));
17
+ expectError(beginGroupSigningSession({lnd}));
18
+ expectError(beginGroupSigningSession({key_family}));
19
+ expectError(beginGroupSigningSession({key_index}));
20
+ expectError(beginGroupSigningSession({public_keys}));
21
+ expectError(beginGroupSigningSession({lnd, key_family}));
22
+ expectError(beginGroupSigningSession({lnd, key_index}));
23
+ expectError(beginGroupSigningSession({lnd, public_keys}));
24
+ expectError(beginGroupSigningSession({key_family, key_index}));
25
+ expectError(beginGroupSigningSession({key_family, public_keys}));
26
+ expectError(beginGroupSigningSession({key_index, public_keys}));
27
+ expectError(beginGroupSigningSession({lnd, key_family, key_index}));
28
+ expectError(beginGroupSigningSession({lnd, key_family, public_keys}));
29
+ expectError(beginGroupSigningSession({lnd, key_index, public_keys}));
30
+ expectError(beginGroupSigningSession({key_family, key_index, public_keys}));
31
+
32
+ expectType<BeginGroupSigningSessionResult>(
33
+ await beginGroupSigningSession({lnd, key_family, key_index, public_keys})
34
+ );
35
+ expectType<BeginGroupSigningSessionResult>(
36
+ await beginGroupSigningSession({
37
+ lnd,
38
+ key_family,
39
+ key_index,
40
+ public_keys,
41
+ is_key_spend,
42
+ root_hash,
43
+ })
44
+ );
45
+ expectType<void>(
46
+ beginGroupSigningSession(
47
+ {lnd, key_family, key_index, public_keys},
48
+ (err, res) => {
49
+ expectType<BeginGroupSigningSessionResult>(res);
50
+ }
51
+ )
52
+ );
53
+ expectType<void>(
54
+ beginGroupSigningSession(
55
+ {lnd, key_family, key_index, public_keys, is_key_spend, root_hash},
56
+ (err, res) => {
57
+ expectType<BeginGroupSigningSessionResult>(res);
58
+ }
59
+ )
60
+ );
@@ -0,0 +1,32 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {
3
+ endGroupSigningSession,
4
+ EndGroupSigningSessionResult,
5
+ } from '../../lnd_methods';
6
+ import {AuthenticatedLnd} from '../../lnd_grpc';
7
+
8
+ const lnd = {} as AuthenticatedLnd;
9
+ const id = 'id';
10
+ const signatures = ['signature'];
11
+
12
+ expectError(endGroupSigningSession());
13
+ expectError(endGroupSigningSession({}));
14
+ expectError(endGroupSigningSession({lnd}));
15
+ expectError(endGroupSigningSession({id}));
16
+
17
+ expectType<EndGroupSigningSessionResult>(
18
+ await endGroupSigningSession({lnd, id})
19
+ );
20
+ expectType<EndGroupSigningSessionResult>(
21
+ await endGroupSigningSession({lnd, id, signatures})
22
+ );
23
+ expectType<void>(
24
+ endGroupSigningSession({lnd, id}, (err, res) => {
25
+ expectType<EndGroupSigningSessionResult>(res);
26
+ })
27
+ );
28
+ expectType<void>(
29
+ endGroupSigningSession({lnd, id, signatures}, (err, res) => {
30
+ expectType<EndGroupSigningSessionResult>(res);
31
+ })
32
+ );
@@ -0,0 +1,14 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {removeExternalSocket} from '../../lnd_methods';
3
+ import {AuthenticatedLnd} from '../../lnd_grpc';
4
+
5
+ const lnd = {} as AuthenticatedLnd;
6
+ const socket = 'socket';
7
+
8
+ expectError(removeExternalSocket());
9
+ expectError(removeExternalSocket({}));
10
+ expectError(removeExternalSocket({lnd}));
11
+ expectError(removeExternalSocket({socket}));
12
+
13
+ expectType<void>(await removeExternalSocket({lnd, socket}));
14
+ expectType<void>(removeExternalSocket({lnd, socket}, () => {}));
@@ -0,0 +1,14 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {updateAlias} from '../../lnd_methods';
3
+ import {AuthenticatedLnd} from '../../lnd_grpc';
4
+
5
+ const lnd = {} as AuthenticatedLnd;
6
+ const node = 'node';
7
+
8
+ expectError(updateAlias());
9
+ expectError(updateAlias({}));
10
+ expectError(updateAlias({lnd}));
11
+ expectError(updateAlias({node}));
12
+
13
+ expectType<void>(await updateAlias({lnd, node}));
14
+ expectType<void>(updateAlias({lnd, node}, () => {}));
@@ -0,0 +1,14 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {updateColor} from '../../lnd_methods';
3
+ import {AuthenticatedLnd} from '../../lnd_grpc';
4
+
5
+ const lnd = {} as AuthenticatedLnd;
6
+ const color = 'color';
7
+
8
+ expectError(updateColor());
9
+ expectError(updateColor({}));
10
+ expectError(updateColor({lnd}));
11
+ expectError(updateColor({color}));
12
+
13
+ expectType<void>(await updateColor({lnd, color}));
14
+ expectType<void>(updateColor({lnd, color}, () => {}));
@@ -0,0 +1,29 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {
3
+ updateGroupSigningSession,
4
+ UpdateGroupSigningSessionResult,
5
+ } from '../../lnd_methods';
6
+ import {AuthenticatedLnd} from '../../lnd_grpc';
7
+
8
+ const lnd = {} as AuthenticatedLnd;
9
+ const hash = 'hash';
10
+ const id = 'id';
11
+ const nonces = ['nonce'];
12
+
13
+ expectError(updateGroupSigningSession());
14
+ expectError(updateGroupSigningSession({}));
15
+ expectError(updateGroupSigningSession({lnd}));
16
+ expectError(updateGroupSigningSession({hash}));
17
+ expectError(updateGroupSigningSession({id}));
18
+ expectError(updateGroupSigningSession({nonces}));
19
+ expectError(updateGroupSigningSession({lnd, hash}));
20
+ expectError(updateGroupSigningSession({lnd, id}));
21
+ expectError(updateGroupSigningSession({lnd, nonces}));
22
+ expectError(updateGroupSigningSession({lnd, hash, id}));
23
+ expectError(updateGroupSigningSession({lnd, hash, nonces}));
24
+ expectError(updateGroupSigningSession({lnd, id, nonces}));
25
+
26
+ expectType<UpdateGroupSigningSessionResult>(
27
+ await updateGroupSigningSession({lnd, hash, id, nonces})
28
+ );
29
+ expectType<void>(updateGroupSigningSession({lnd, hash, id, nonces}, () => {}));