lightning 10.21.0 → 10.22.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
|
@@ -5,12 +5,13 @@ const {returnResult} = require('asyncjs-util');
|
|
|
5
5
|
const {isLnd} = require('./../../lnd_requests');
|
|
6
6
|
|
|
7
7
|
const bufferAsHex = buffer => buffer.toString('hex');
|
|
8
|
-
const defaultChangeType = 'CHANGE_ADDRESS_TYPE_P2TR';
|
|
8
|
+
const defaultChangeType = () => 'CHANGE_ADDRESS_TYPE_P2TR';
|
|
9
9
|
const defaultConfirmationTarget = 6;
|
|
10
10
|
const errorUnsupported = 'transaction template missing, need to specify either PSBT or raw TX template';
|
|
11
11
|
const hexAsBuffer = hex => Buffer.from(hex, 'hex');
|
|
12
12
|
const indexNotFound = -1;
|
|
13
13
|
const {isBuffer} = Buffer;
|
|
14
|
+
const isKnownChangeFormat = format => !format || format === 'p2tr';
|
|
14
15
|
const method = 'fundPsbt';
|
|
15
16
|
const strategy = type => !type ? undefined : `STRATEGY_${type.toUpperCase()}`;
|
|
16
17
|
const type = 'wallet';
|
|
@@ -22,6 +23,8 @@ const unconfirmedConfirmationsCount = 0;
|
|
|
22
23
|
|
|
23
24
|
`utxo_selection` methods: 'largest', 'random'
|
|
24
25
|
|
|
26
|
+
`change_format` options: `p2tr` (only one change type is supported)
|
|
27
|
+
|
|
25
28
|
Requires `onchain:write` permission
|
|
26
29
|
|
|
27
30
|
Requires LND built with `walletrpc` tag
|
|
@@ -29,6 +32,7 @@ const unconfirmedConfirmationsCount = 0;
|
|
|
29
32
|
This method is not supported on LND 0.17.5 or below
|
|
30
33
|
|
|
31
34
|
{
|
|
35
|
+
[change_format]: <Change Address Address Format String>
|
|
32
36
|
[fee_tokens_per_vbyte]: <Chain Fee Tokens Per Virtual Byte Number>
|
|
33
37
|
[inputs]: [{
|
|
34
38
|
[sequence]: <Sequence Number>
|
|
@@ -58,6 +62,10 @@ module.exports = (args, cbk) => {
|
|
|
58
62
|
return asyncAuto({
|
|
59
63
|
// Check arguments
|
|
60
64
|
validate: cbk => {
|
|
65
|
+
if (!isKnownChangeFormat(args.change_format)) {
|
|
66
|
+
return cbk([400, 'ExpectedKnownChangeFormatToFundPsbt']);
|
|
67
|
+
}
|
|
68
|
+
|
|
61
69
|
if (!isLnd({method, type, lnd: args.lnd})) {
|
|
62
70
|
return cbk([400, 'ExpectedAuthenticatedLndToCreateFundedPsbt']);
|
|
63
71
|
}
|
|
@@ -97,6 +105,7 @@ module.exports = (args, cbk) => {
|
|
|
97
105
|
// Construct the PSBT that is needed for coin select type funding
|
|
98
106
|
funding: ['validate', ({}, cbk) => {
|
|
99
107
|
const {psbt} = createPsbt({
|
|
108
|
+
change_type: defaultChangeType(args.change_type),
|
|
100
109
|
outputs: args.outputs || [],
|
|
101
110
|
timelock: args.timelock,
|
|
102
111
|
utxos: (args.inputs || []).map(input => ({
|
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"description": "Lightning Network client library",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"tsd": "0.31.2",
|
|
30
|
-
"typescript": "5.6.
|
|
30
|
+
"typescript": "5.6.3"
|
|
31
31
|
},
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"directory": "test/typescript"
|
|
54
54
|
},
|
|
55
55
|
"types": "index.d.ts",
|
|
56
|
-
"version": "10.
|
|
56
|
+
"version": "10.22.0"
|
|
57
57
|
}
|
|
@@ -48,6 +48,11 @@ const makeExpected = overrides => {
|
|
|
48
48
|
};
|
|
49
49
|
|
|
50
50
|
const tests = [
|
|
51
|
+
{
|
|
52
|
+
args: makeArgs({change_format: 'change_format'}),
|
|
53
|
+
description: 'A valid change format is required',
|
|
54
|
+
error: [400, 'ExpectedKnownChangeFormatToFundPsbt'],
|
|
55
|
+
},
|
|
51
56
|
{
|
|
52
57
|
args: makeArgs({lnd: undefined}),
|
|
53
58
|
description: 'An LND object is required',
|