lightning 10.19.0 → 10.20.1

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,10 @@
1
1
  # Versions
2
2
 
3
+ ## 10.20.1
4
+
5
+ - `payViaPaymentRequest`, `subscribeToPayViaRequest`: Add `index` to response
6
+ for payment offset number in payments set
7
+
3
8
  ## 10.19.0
4
9
 
5
10
  - `createInvoice`: add `is_encrypting_routes` to enable blinded paths feature
@@ -13,6 +13,8 @@ export type CreateInvoiceArgs = AuthenticatedLightningArgs<{
13
13
  description_hash?: string;
14
14
  /** Expires At ISO 8601 Date */
15
15
  expires_at?: string;
16
+ /** Use Blinded Paths For Inbound Routes */
17
+ is_encrypting_routes?: boolean;
16
18
  /** Is Fallback Address Included */
17
19
  is_fallback_included?: boolean;
18
20
  /** Is Fallback Address Nested */
@@ -27,6 +27,8 @@ export type FinishedPaymentArgs = AuthenticatedLightningArgs<{
27
27
  }[];
28
28
  /** Payment Hash Hex String */
29
29
  id: string;
30
+ /** Payment Index String */
31
+ index: string;
30
32
  /** Total Millitokens Paid String */
31
33
  mtokens: string;
32
34
  paths: {
@@ -129,6 +131,8 @@ export type FinishedPaymentResult = {
129
131
  }[];
130
132
  /** Payment Hash Hex String */
131
133
  id?: string;
134
+ /** Payment Index String */
135
+ index: string;
132
136
  /** Total Millitokens Paid String */
133
137
  mtokens: string;
134
138
  paths: {
@@ -80,6 +80,7 @@ const {returnResult} = require('asyncjs-util');
80
80
  timeout: <Timeout Block Height Number>
81
81
  }]
82
82
  [id]: <Payment Hash Hex String>
83
+ index: <Payment Index Offset Number String>
83
84
  mtokens: <Total Millitokens Paid String>
84
85
  paths: [{
85
86
  fee_mtokens: <Total Fee Millitokens Paid String>
@@ -146,6 +147,7 @@ module.exports = ({confirmed, failed}, cbk) => {
146
147
  fee_mtokens: confirmed.fee_mtokens,
147
148
  hops: confirmed.hops,
148
149
  id: confirmed.id,
150
+ index: confirmed.index,
149
151
  mtokens: confirmed.mtokens,
150
152
  paths: confirmed.paths,
151
153
  secret: confirmed.secret,
@@ -61,6 +61,8 @@ export type PayViaPaymentRequestResult = {
61
61
  }[];
62
62
  /** Payment Hash Hex */
63
63
  id: string;
64
+ /** Payment Index String */
65
+ index: string;
64
66
  /** Total Millitokens Paid */
65
67
  mtokens: string;
66
68
  paths: {
@@ -52,6 +52,7 @@ const type = 'router';
52
52
  timeout: <First Route Timeout Block Height Number>
53
53
  }]
54
54
  id: <Payment Hash Hex String>
55
+ index: <Payment Index Offset Number String>
55
56
  mtokens: <Total Millitokens Paid String>
56
57
  paths: [{
57
58
  fee_mtokens: <Total Fee Millitokens Paid String>
@@ -58,6 +58,8 @@ export type SubscribeToPastPaymentConfirmedEvent = {
58
58
  export type SubscribeToPastPaymentFailedEvent = {
59
59
  /** Payment Hash Hex */
60
60
  id: string;
61
+ /** Payment Canceled */
62
+ is_canceled: boolean;
61
63
  /** Failed Due To Lack of Balance */
62
64
  is_insufficient_balance: boolean;
63
65
  /** Failed Due to Payment Rejected At Destination */
@@ -101,6 +101,8 @@ export type SubscribeToPayConfirmedEvent = {
101
101
  }[];
102
102
  /** Payment Hash Hex String> */
103
103
  id: string;
104
+ /** Payment Index String */
105
+ index: string;
104
106
  /** Total Millitokens Paid String> */
105
107
  mtokens: string;
106
108
  paths: {
@@ -140,7 +142,9 @@ export type SubscribeToPayConfirmedEvent = {
140
142
  export type SubscribeToPayFailedEvent = {
141
143
  /** Payment Hash Hex */
142
144
  id: string;
143
- /** Failed Due To Lack of Balance Bool> */
145
+ /** Payment Canceled */
146
+ is_canceled: boolean;
147
+ /** Failed Due To Lack of Balance */
144
148
  is_insufficient_balance: boolean;
145
149
  /** Failed Due to Invalid Payment Bool> */
146
150
  is_invalid_payment: boolean;
@@ -191,6 +195,8 @@ export type SubscribeToPayPayingEvent = {
191
195
  destination: string;
192
196
  /** Payment Hash Hex String> */
193
197
  id: string;
198
+ /** Payment Index String */
199
+ index: string;
194
200
  /** Total Millitokens Pending String> */
195
201
  mtokens: string;
196
202
  paths: {
@@ -54,6 +54,7 @@ const type = 'router';
54
54
  timeout: <First Route Timeout Block Height Number>
55
55
  }]
56
56
  id: <Payment Hash Hex String>
57
+ index: <Payment Index Offset Number String>
57
58
  mtokens: <Total Millitokens Paid String>
58
59
  paths: [{
59
60
  fee_mtokens: <Total Fee Millitokens Paid String>
@@ -109,6 +110,7 @@ const type = 'router';
109
110
  created_at: <Payment Created At ISO 8601 Date String>
110
111
  destination: <Payment Destination Hex String>
111
112
  id: <Payment Hash Hex String>
113
+ index: <Payment Index Offset Number String>
112
114
  mtokens: <Total Millitokens Pending String>
113
115
  paths: [{
114
116
  fee: <Total Fee Tokens Pending Number>
@@ -7,10 +7,145 @@ import type {SubscribeToPastPaymentsPaymentEvent} from './subscribe_to_past_paym
7
7
 
8
8
  export type SubscribeToPaymentsArgs = AuthenticatedLightningArgs;
9
9
 
10
- export type SubscribeToPaymentsErrorEvent = LightningError;
10
+ /** A confirmed payment event
11
+ * @event 'confirmed'
12
+ */
13
+ export interface SubscribeToPaymentsConfirmedEvent {
14
+ /** Payment Confirmed At ISO 8601 Date String */
15
+ confirmed_at: string;
16
+ /** Payment Created At ISO 8601 Date String */
17
+ created_at: string;
18
+ /** Payment Destination Hex String */
19
+ destination: string;
20
+ /** Total Fee Tokens Paid Rounded Down Number */
21
+ fee: number;
22
+ /** Total Fee Millitokens Paid String */
23
+ fee_mtokens: string;
24
+ /** Payment Hash Hex String */
25
+ id: string;
26
+ /** Total Millitokens Paid String */
27
+ mtokens: string;
28
+ /** Payment paths */
29
+ paths?: Array<{
30
+ /** Total Fee Tokens Paid Number */
31
+ fee: number;
32
+ /** Total Fee Millitokens Paid String */
33
+ fee_mtokens: string;
34
+ /** Hops in the path */
35
+ hops: Array<{
36
+ /** Standard Format Channel Id String */
37
+ channel: string;
38
+ /** Channel Capacity Tokens Number */
39
+ channel_capacity: number;
40
+ /** Fee Tokens Rounded Down Number */
41
+ fee: number;
42
+ /** Fee Millitokens String */
43
+ fee_mtokens: string;
44
+ /** Forward Tokens Number */
45
+ forward: number;
46
+ /** Forward Millitokens String */
47
+ forward_mtokens: string;
48
+ /** Public Key Hex String */
49
+ public_key: string;
50
+ /** Timeout Block Height Number */
51
+ timeout: number;
52
+ }>;
53
+ /** Total Millitokens Paid String */
54
+ mtokens: string;
55
+ /** Total Fee Tokens Paid Rounded Up Number */
56
+ safe_fee: number;
57
+ /** Total Tokens Paid, Rounded Up Number */
58
+ safe_tokens: number;
59
+ /** Expiration Block Height Number */
60
+ timeout: number;
61
+ }>;
62
+ /** BOLT 11 Encoded Payment Request String */
63
+ request?: string;
64
+ /** Total Fee Tokens Paid Rounded Up Number */
65
+ safe_fee: number;
66
+ /** Total Tokens Paid, Rounded Up Number */
67
+ safe_tokens: number;
68
+ /** Payment Preimage Hex String */
69
+ secret: string;
70
+ /** Expiration Block Height Number */
71
+ timeout: number;
72
+ /** Total Tokens Paid Rounded Down Number */
73
+ tokens: number;
74
+ }
75
+
76
+ /** A failed payment event
77
+ * @event 'failed'
78
+ */
79
+ export interface SubscribeToPaymentsFailedEvent {
80
+ /** Payment Hash Hex String */
81
+ id: string;
82
+ /** Payment Canceled Bool */
83
+ is_canceled: boolean;
84
+ /** Failed Due To Lack of Balance Bool */
85
+ is_insufficient_balance: boolean;
86
+ /** Failed Due to Payment Rejected At Destination Bool */
87
+ is_invalid_payment: boolean;
88
+ /** Failed Due to Pathfinding Timeout Bool */
89
+ is_pathfinding_timeout: boolean;
90
+ /** Failed Due to Absence of Path Through Graph Bool */
91
+ is_route_not_found: boolean;
92
+ }
11
93
 
12
- export type SubscribeToPaymentsPaymentEvent =
13
- SubscribeToPastPaymentsPaymentEvent;
94
+ /** A paying (in-progress) payment event
95
+ * @event 'paying'
96
+ */
97
+ export interface SubscribeToPaymentsPayingEvent {
98
+ /** Payment Created At ISO 8601 Date String */
99
+ created_at: string;
100
+ /** Payment Destination Hex String */
101
+ destination: string;
102
+ /** Payment Hash Hex String */
103
+ id: string;
104
+ /** Total Millitokens Pending String */
105
+ mtokens: string;
106
+ /** Payment paths */
107
+ paths?: Array<{
108
+ /** Total Fee Tokens Pending Number */
109
+ fee: number;
110
+ /** Total Fee Millitokens Pending String */
111
+ fee_mtokens: string;
112
+ /** Hops in the path */
113
+ hops: Array<{
114
+ /** Standard Format Channel Id String */
115
+ channel: string;
116
+ /** Channel Capacity Tokens Number */
117
+ channel_capacity: number;
118
+ /** Fee Tokens Rounded Down Number */
119
+ fee: number;
120
+ /** Fee Millitokens String */
121
+ fee_mtokens: string;
122
+ /** Forward Tokens Number */
123
+ forward: number;
124
+ /** Forward Millitokens String */
125
+ forward_mtokens: string;
126
+ /** Public Key Hex String */
127
+ public_key: string;
128
+ /** Timeout Block Height Number */
129
+ timeout: number;
130
+ }>;
131
+ /** Total Millitokens Pending String */
132
+ mtokens: string;
133
+ /** Total Fee Tokens Pending Rounded Up Number */
134
+ safe_fee: number;
135
+ /** Total Tokens Pending, Rounded Up Number */
136
+ safe_tokens: number;
137
+ /** Expiration Block Height Number */
138
+ timeout: number;
139
+ }>;
140
+ /** BOLT 11 Encoded Payment Request String */
141
+ request?: string;
142
+ /** Total Tokens Pending, Rounded Up Number */
143
+ safe_tokens: number;
144
+ /** Expiration Block Height Number */
145
+ timeout?: number;
146
+ /** Total Tokens Pending Rounded Down Number */
147
+ tokens: number;
148
+ }
14
149
 
15
150
  /**
16
151
  * Subscribe to outgoing payments
@@ -105,6 +105,8 @@ export type ConfirmedFromPaymentResult = {
105
105
  }[];
106
106
  /** Payment Hash Hex String */
107
107
  id: string;
108
+ /** Payment Index String */
109
+ index: string;
108
110
  /** Total Millitokens Paid String */
109
111
  mtokens: string;
110
112
  paths: {
@@ -81,6 +81,7 @@ const nsAsDate = ns => new Date(Number(BigInt(ns) / BigInt(1e6)));
81
81
  timeout: <First Path Timeout Block Height Number>
82
82
  }]
83
83
  id: <Payment Hash Hex String>
84
+ index: <Payment Index Offset Number String>
84
85
  mtokens: <Total Millitokens Paid String>
85
86
  paths: [{
86
87
  fee: <Total Fee Tokens Paid Number>
@@ -159,6 +160,7 @@ module.exports = payment => {
159
160
  fee_mtokens: payment.fee_msat,
160
161
  hops: success.route.hops,
161
162
  id: payment.payment_hash,
163
+ index: payment.payment_index,
162
164
  mtokens: mtokens.toString(),
163
165
  paths: successes.map(n => n.route),
164
166
  request: payment.payment_request || undefined,
@@ -67,6 +67,7 @@ const nsAsDate = ns => new Date(Number(BigInt(ns) / BigInt(1e6)));
67
67
  created_at: <Payment Created At ISO 8601 Date String>
68
68
  destination: <Payment Destination Public Key Hex String>
69
69
  id: <Payment Hash Hex String>
70
+ index: <Payment Index Offset Number String>
70
71
  mtokens: <Total Millitokens Pending String>
71
72
  paths: [{
72
73
  fee: <Total Fee Tokens Pending Number>
@@ -134,6 +135,7 @@ module.exports = payment => {
134
135
  destination,
135
136
  created_at: nsAsDate(payment.creation_time_ns).toISOString(),
136
137
  id: payment.payment_hash,
138
+ index: payment.payment_index,
137
139
  mtokens: mtokens.toString(),
138
140
  paths: pending.map(n => n.route),
139
141
  request: payment.payment_request || undefined,
package/package.json CHANGED
@@ -7,9 +7,9 @@
7
7
  "url": "https://github.com/alexbosworth/lightning/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@grpc/grpc-js": "1.11.1",
10
+ "@grpc/grpc-js": "1.11.2",
11
11
  "@grpc/proto-loader": "0.7.13",
12
- "@types/node": "22.5.0",
12
+ "@types/node": "22.5.4",
13
13
  "@types/request": "2.48.12",
14
14
  "@types/ws": "8.5.12",
15
15
  "async": "3.2.6",
@@ -22,11 +22,11 @@
22
22
  "invoices": "3.0.0",
23
23
  "psbt": "3.0.0",
24
24
  "tiny-secp256k1": "2.2.3",
25
- "type-fest": "4.25.0"
25
+ "type-fest": "4.26.0"
26
26
  },
27
27
  "description": "Lightning Network client library",
28
28
  "devDependencies": {
29
- "tsd": "0.31.1",
29
+ "tsd": "0.31.2",
30
30
  "typescript": "5.5.4"
31
31
  },
32
32
  "engines": {
@@ -53,5 +53,5 @@
53
53
  "directory": "test/typescript"
54
54
  },
55
55
  "types": "index.d.ts",
56
- "version": "10.19.0"
56
+ "version": "10.20.1"
57
57
  }
@@ -20,6 +20,7 @@ const makeArgs = overrides => {
20
20
  timeout: 1,
21
21
  }],
22
22
  id: Buffer.alloc(32).toString('hex'),
23
+ index: '1',
23
24
  mtokens: '1000',
24
25
  paths: [{
25
26
  fee_mtokens: '1000',
@@ -107,6 +108,7 @@ const tests = [
107
108
  timeout: 1,
108
109
  }],
109
110
  id: '0000000000000000000000000000000000000000000000000000000000000000',
111
+ index: '1',
110
112
  mtokens: '1000',
111
113
  paths: [{
112
114
  fee_mtokens: '1000',
@@ -194,6 +194,7 @@ const tests = [
194
194
  created_at: '1970-01-01T00:00:00.000Z',
195
195
  destination: Buffer.alloc(33).toString('hex'),
196
196
  id: Buffer.alloc(32).toString('hex'),
197
+ index: '1',
197
198
  mtokens: '2000',
198
199
  paths: [{
199
200
  fee: 1,
@@ -222,6 +222,7 @@ const tests = [
222
222
  }
223
223
  ],
224
224
  id: '0000000000000000000000000000000000000000000000000000000000000000',
225
+ index: '1',
225
226
  mtokens: '2000',
226
227
  paths: [
227
228
  {
@@ -111,6 +111,7 @@ const tests = [
111
111
  timeout: 1,
112
112
  }],
113
113
  id: Buffer.alloc(32).toString('hex'),
114
+ index: '1',
114
115
  mtokens: '2000',
115
116
  paths: [{
116
117
  fee: 1,
@@ -71,6 +71,7 @@ const makeExpected = overrides => {
71
71
  timeout: 1,
72
72
  }],
73
73
  id: Buffer.alloc(32).toString('hex'),
74
+ index: '1',
74
75
  mtokens: '2000',
75
76
  paths: [{
76
77
  fee: 1,
@@ -58,6 +58,7 @@ const makeExpected = overrides => {
58
58
  created_at: '1970-01-01T00:00:00.000Z',
59
59
  destination: Buffer.alloc(33).toString('hex'),
60
60
  id: Buffer.alloc(32).toString('hex'),
61
+ index: '1',
61
62
  mtokens: '2000',
62
63
  paths: [{
63
64
  fee: 1,
@@ -22,6 +22,7 @@ const args = {
22
22
  },
23
23
  ],
24
24
  id: Buffer.alloc(32).toString('hex'),
25
+ index: '1',
25
26
  mtokens: '1000',
26
27
  paths: [
27
28
  {