lightning 9.9.0 → 9.10.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
package/README.md
CHANGED
|
@@ -22,6 +22,8 @@ Methods for working with the Lightning Network
|
|
|
22
22
|
https://github.com/lnmarkets/umbrel
|
|
23
23
|
- [LNPingBot](https://github.com/swissrouting/lnpingbot) -
|
|
24
24
|
https://github.com/swissrouting/lnpingbot
|
|
25
|
+
- [MutinyWallet faucet](https://github.com/MutinyWallet/mutinynet-faucet) -
|
|
26
|
+
https://www.mutinywallet.com/
|
|
25
27
|
- [p2plnbot](https://telegram.me/lnp2pbot) - https://github.com/grunch/p2plnbot
|
|
26
28
|
- [rekr](https://rekr.app/) - https://github.com/ryan-lingle/rekr
|
|
27
29
|
- [stackernews](https://stacker.news/) -
|
|
@@ -7,6 +7,7 @@ const {returnResult} = require('asyncjs-util');
|
|
|
7
7
|
|
|
8
8
|
const {createChainAddress} = require('./../address');
|
|
9
9
|
const {isLnd} = require('./../../lnd_requests');
|
|
10
|
+
const {routeHintFromRoute} = require('./../../lnd_requests');
|
|
10
11
|
|
|
11
12
|
const hexAsBuffer = hex => !!hex ? Buffer.from(hex, 'hex') : undefined;
|
|
12
13
|
const {isArray} = Array;
|
|
@@ -41,6 +42,13 @@ const type = 'invoices';
|
|
|
41
42
|
[is_including_private_channels]: <Invoice Includes Private Channels Bool>
|
|
42
43
|
lnd: <Authenticated LND API Object>
|
|
43
44
|
[mtokens]: <Millitokens String>
|
|
45
|
+
[routes]: [[{
|
|
46
|
+
[base_fee_mtokens]: <Base Routing Fee In Millitokens String>
|
|
47
|
+
[channel]: <Standard Format Channel Id String>
|
|
48
|
+
[cltv_delta]: <CLTV Blocks Delta Number>
|
|
49
|
+
[fee_rate]: <Fee Rate In Millitokens Per Million Number>
|
|
50
|
+
public_key: <Forward Edge Public Key Hex String>
|
|
51
|
+
}]]
|
|
44
52
|
[tokens]: <Tokens Number>
|
|
45
53
|
}
|
|
46
54
|
|
|
@@ -65,6 +73,10 @@ module.exports = (args, cbk) => {
|
|
|
65
73
|
return cbk([400, 'ExpectedInvoicesLndToCreateHodlInvoice']);
|
|
66
74
|
}
|
|
67
75
|
|
|
76
|
+
if (!!args.routes && !isArray(args.routes)) {
|
|
77
|
+
return cbk([400, 'ExpectedArrayOfHopHintPathsForRoutes']);
|
|
78
|
+
}
|
|
79
|
+
|
|
68
80
|
return cbk();
|
|
69
81
|
},
|
|
70
82
|
|
|
@@ -80,6 +92,20 @@ module.exports = (args, cbk) => {
|
|
|
80
92
|
return createChainAddress({format, lnd: args.lnd}, cbk);
|
|
81
93
|
}],
|
|
82
94
|
|
|
95
|
+
// Determine the route hints
|
|
96
|
+
hints: ['validate', ({}, cbk) => {
|
|
97
|
+
// Exit early when there are no route hints for the invoice
|
|
98
|
+
if (!args.routes) {
|
|
99
|
+
return cbk();
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const hints = args.routes.map(route => {
|
|
103
|
+
return {hop_hints: routeHintFromRoute({route}).hops};
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
return cbk(null, hints);
|
|
107
|
+
}],
|
|
108
|
+
|
|
83
109
|
// Generate id if needed
|
|
84
110
|
invoiceId: ['validate', ({}, cbk) => {
|
|
85
111
|
if (!!args.id) {
|
|
@@ -97,8 +123,9 @@ module.exports = (args, cbk) => {
|
|
|
97
123
|
// Add invoice
|
|
98
124
|
addInvoice: [
|
|
99
125
|
'addAddress',
|
|
126
|
+
'hints',
|
|
100
127
|
'invoiceId',
|
|
101
|
-
({addAddress, invoiceId}, cbk) =>
|
|
128
|
+
({addAddress, hints, invoiceId}, cbk) =>
|
|
102
129
|
{
|
|
103
130
|
const fallbackAddress = !addAddress ? undefined : addAddress.address;
|
|
104
131
|
const createdAt = new Date();
|
|
@@ -117,6 +144,7 @@ module.exports = (args, cbk) => {
|
|
|
117
144
|
hash: Buffer.from(invoiceId.id, 'hex'),
|
|
118
145
|
memo: args.description,
|
|
119
146
|
private: !!args.is_including_private_channels,
|
|
147
|
+
route_hints: hints || undefined,
|
|
120
148
|
value: args.tokens || undefined,
|
|
121
149
|
value_msat: args.mtokens || undefined,
|
|
122
150
|
},
|
|
@@ -6,6 +6,7 @@ const {createChainAddress} = require('./../address');
|
|
|
6
6
|
const getInvoice = require('./get_invoice');
|
|
7
7
|
const {isLnd} = require('./../../lnd_requests');
|
|
8
8
|
const {mtokensAmount} = require('./../../bolt00');
|
|
9
|
+
const {routeHintFromRoute} = require('./../../lnd_requests');
|
|
9
10
|
|
|
10
11
|
const defaultExpirySec = 60 * 60 * 3;
|
|
11
12
|
const hexAsBuffer = hex => !!hex ? Buffer.from(hex, 'hex') : undefined;
|
|
@@ -36,6 +37,13 @@ const type = 'default';
|
|
|
36
37
|
lnd: <Authenticated LND API Object>
|
|
37
38
|
[secret]: <Payment Preimage Hex String>
|
|
38
39
|
[mtokens]: <Millitokens String>
|
|
40
|
+
[routes]: [[{
|
|
41
|
+
[base_fee_mtokens]: <Base Routing Fee In Millitokens String>
|
|
42
|
+
[channel]: <Standard Format Channel Id String>
|
|
43
|
+
[cltv_delta]: <CLTV Blocks Delta Number>
|
|
44
|
+
[fee_rate]: <Fee Rate In Millitokens Per Million Number>
|
|
45
|
+
public_key: <Forward Edge Public Key Hex String>
|
|
46
|
+
}]]
|
|
39
47
|
[tokens]: <Tokens Number>
|
|
40
48
|
}
|
|
41
49
|
|
|
@@ -86,6 +94,10 @@ module.exports = (args, cbk) => {
|
|
|
86
94
|
}
|
|
87
95
|
}
|
|
88
96
|
|
|
97
|
+
if (!!args.routes && !isArray(args.routes)) {
|
|
98
|
+
return cbk([400, 'ExpectedArrayOfHopHintPathsForRoutes']);
|
|
99
|
+
}
|
|
100
|
+
|
|
89
101
|
return cbk();
|
|
90
102
|
},
|
|
91
103
|
|
|
@@ -101,6 +113,20 @@ module.exports = (args, cbk) => {
|
|
|
101
113
|
return createChainAddress({format, lnd: args.lnd}, cbk);
|
|
102
114
|
}],
|
|
103
115
|
|
|
116
|
+
// Determine the route hints
|
|
117
|
+
hints: ['validate', ({}, cbk) => {
|
|
118
|
+
// Exit early when there are no route hints for the invoice
|
|
119
|
+
if (!args.routes) {
|
|
120
|
+
return cbk();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const hints = args.routes.map(route => {
|
|
124
|
+
return {hop_hints: routeHintFromRoute({route}).hops};
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
return cbk(null, hints);
|
|
128
|
+
}],
|
|
129
|
+
|
|
104
130
|
// Determine the value of the invoice
|
|
105
131
|
mtokens: ['validate', ({}, cbk) => {
|
|
106
132
|
// Exit early when there are no mtokens
|
|
@@ -119,9 +145,10 @@ module.exports = (args, cbk) => {
|
|
|
119
145
|
// Add invoice
|
|
120
146
|
addInvoice: [
|
|
121
147
|
'addAddress',
|
|
148
|
+
'hints',
|
|
122
149
|
'mtokens',
|
|
123
150
|
'preimage',
|
|
124
|
-
({addAddress, mtokens, preimage}, cbk) =>
|
|
151
|
+
({addAddress, hints, mtokens, preimage}, cbk) =>
|
|
125
152
|
{
|
|
126
153
|
const fallbackAddress = !addAddress ? String() : addAddress.address;
|
|
127
154
|
const createdAt = new Date();
|
|
@@ -137,6 +164,7 @@ module.exports = (args, cbk) => {
|
|
|
137
164
|
memo: args.description,
|
|
138
165
|
private: !!args.is_including_private_channels,
|
|
139
166
|
r_preimage: preimage || undefined,
|
|
167
|
+
route_hints: hints || undefined,
|
|
140
168
|
value_msat: mtokens,
|
|
141
169
|
},
|
|
142
170
|
(err, response) => {
|
package/package.json
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
"url": "https://github.com/alexbosworth/lightning/issues"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@grpc/grpc-js": "1.8.
|
|
10
|
+
"@grpc/grpc-js": "1.8.21",
|
|
11
11
|
"@grpc/proto-loader": "0.7.8",
|
|
12
12
|
"@types/express": "4.17.17",
|
|
13
|
-
"@types/node": "20.4.
|
|
13
|
+
"@types/node": "20.4.5",
|
|
14
14
|
"@types/request": "2.48.8",
|
|
15
15
|
"@types/ws": "8.5.5",
|
|
16
16
|
"async": "3.2.4",
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"body-parser": "1.20.2",
|
|
21
21
|
"bolt07": "1.8.4",
|
|
22
22
|
"bolt09": "1.0.0",
|
|
23
|
-
"cbor": "9.0.
|
|
23
|
+
"cbor": "9.0.1",
|
|
24
24
|
"ecpair": "2.1.0",
|
|
25
25
|
"express": "4.18.2",
|
|
26
26
|
"invoices": "3.0.0",
|
|
27
27
|
"psbt": "3.0.0",
|
|
28
28
|
"tiny-secp256k1": "2.2.3",
|
|
29
|
-
"type-fest": "4.
|
|
29
|
+
"type-fest": "4.1.0"
|
|
30
30
|
},
|
|
31
31
|
"description": "Lightning Network client library",
|
|
32
32
|
"devDependencies": {
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"directory": "test/typescript"
|
|
59
59
|
},
|
|
60
60
|
"types": "index.d.ts",
|
|
61
|
-
"version": "9.
|
|
61
|
+
"version": "9.10.0"
|
|
62
62
|
}
|