lightning 10.20.2 → 10.21.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/bolt02/ids.json
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
"chains": {
|
|
3
3
|
"bitcoinmainnet": "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f",
|
|
4
4
|
"bitcoinregtest": "0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206",
|
|
5
|
+
"bitcoinsignet": "00000008819873e925422c1ff0f99f7cc9bbb232af63a077a480a3633bee1ef6",
|
|
5
6
|
"bitcointestnet": "000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943",
|
|
6
7
|
"litecoinmainnet": "12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2",
|
|
7
8
|
"litecoinregtest": "530827f38f93b43ed12af0b3ad25a288dc02ed74d6d7857862df51fc56c416f9",
|
|
@@ -7,13 +7,14 @@ const {Transaction} = require('bitcoinjs-lib');
|
|
|
7
7
|
const {isLnd} = require('./../../lnd_requests');
|
|
8
8
|
|
|
9
9
|
const asOutpoint = n => `${n.transaction_id}:${n.transaction_vout}`;
|
|
10
|
-
const defaultChangeType = 'CHANGE_ADDRESS_TYPE_P2TR';
|
|
10
|
+
const defaultChangeType = () => 'CHANGE_ADDRESS_TYPE_P2TR';
|
|
11
11
|
const defaultConfirmationTarget = 6;
|
|
12
12
|
const expirationAsDate = epoch => new Date(Number(epoch) * 1e3).toISOString();
|
|
13
13
|
const {fromHex} = Transaction;
|
|
14
14
|
const hexFromBuffer = buffer => buffer.toString('hex');
|
|
15
15
|
const {isArray} = Array;
|
|
16
16
|
const {isBuffer} = Buffer;
|
|
17
|
+
const isKnownChangeFormat = format => !format || format === 'p2tr';
|
|
17
18
|
const method = 'fundPsbt';
|
|
18
19
|
const notSupported = /unknown.*walletrpc.WalletKit/;
|
|
19
20
|
const strategy = type => !type ? undefined : `STRATEGY_${type.toUpperCase()}`;
|
|
@@ -29,6 +30,8 @@ const txIdFromHash = hash => hash.reverse().toString('hex');
|
|
|
29
30
|
|
|
30
31
|
`utxo_selection` methods: 'largest', 'random'
|
|
31
32
|
|
|
33
|
+
`change_format` options: `p2tr` (only one change type is supported)
|
|
34
|
+
|
|
32
35
|
Requires `onchain:write` permission
|
|
33
36
|
|
|
34
37
|
Requires LND built with `walletrpc` tag
|
|
@@ -40,6 +43,7 @@ const txIdFromHash = hash => hash.reverse().toString('hex');
|
|
|
40
43
|
`utxo_selection` is not supported in LND 0.17.5 and below
|
|
41
44
|
|
|
42
45
|
{
|
|
46
|
+
[change_format]: <Change Address Address Format String>
|
|
43
47
|
[fee_tokens_per_vbyte]: <Chain Fee Tokens Per Virtual Byte Number>
|
|
44
48
|
[inputs]: [{
|
|
45
49
|
transaction_id: <Unspent Transaction Id Hex String>
|
|
@@ -80,6 +84,10 @@ module.exports = (args, cbk) => {
|
|
|
80
84
|
|
|
81
85
|
// Check arguments
|
|
82
86
|
validate: cbk => {
|
|
87
|
+
if (!isKnownChangeFormat(args.change_format)) {
|
|
88
|
+
return cbk([400, 'ExpectedKnownChangeFormatToFundPsbt']);
|
|
89
|
+
}
|
|
90
|
+
|
|
83
91
|
if (!isLnd({method, type, lnd: args.lnd})) {
|
|
84
92
|
return cbk([400, 'ExpectedAuthenticatedLndToFundPsbt']);
|
|
85
93
|
}
|
|
@@ -163,7 +171,7 @@ module.exports = (args, cbk) => {
|
|
|
163
171
|
// Fund the PSBT
|
|
164
172
|
fund: ['fee', 'funding', 'minConfs', ({fee, funding, minConfs}, cbk) => {
|
|
165
173
|
return args.lnd[type][method]({
|
|
166
|
-
change_type: defaultChangeType,
|
|
174
|
+
change_type: defaultChangeType(args.change_type),
|
|
167
175
|
coin_selection_strategy: strategy(args.utxo_selection),
|
|
168
176
|
min_confs: minConfs !== undefined ? minConfs : undefined,
|
|
169
177
|
psbt: !!args.psbt ? Buffer.from(args.psbt, 'hex') : 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.
|
|
10
|
+
"@grpc/grpc-js": "1.12.0",
|
|
11
11
|
"@grpc/proto-loader": "0.7.13",
|
|
12
|
-
"@types/node": "22.5
|
|
12
|
+
"@types/node": "22.7.5",
|
|
13
13
|
"@types/request": "2.48.12",
|
|
14
14
|
"@types/ws": "8.5.12",
|
|
15
15
|
"async": "3.2.6",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"directory": "test/typescript"
|
|
54
54
|
},
|
|
55
55
|
"types": "index.d.ts",
|
|
56
|
-
"version": "10.
|
|
56
|
+
"version": "10.21.0"
|
|
57
57
|
}
|
|
@@ -74,6 +74,11 @@ const makeExpected = overrides => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
const tests = [
|
|
77
|
+
{
|
|
78
|
+
args: makeArgs({change_format: 'change_format'}),
|
|
79
|
+
description: 'A valid change format is required',
|
|
80
|
+
error: [400, 'ExpectedKnownChangeFormatToFundPsbt'],
|
|
81
|
+
},
|
|
77
82
|
{
|
|
78
83
|
args: makeArgs({lnd: undefined}),
|
|
79
84
|
description: 'An LND object is required',
|