lightning 5.15.0 → 5.15.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 +6 -0
- package/lnd_methods/offchain/get_failed_payments.js +3 -1
- package/lnd_methods/offchain/get_payments.js +3 -1
- package/lnd_methods/offchain/get_pending_payments.js +2 -0
- package/lnd_responses/rpc_attempt_htlc_as_attempt.js +39 -5
- package/lnd_responses/rpc_payment_as_payment.js +6 -0
- package/package.json +1 -1
- package/test/lnd_methods/offchain/test_get_payments.js +2 -0
- package/test/lnd_responses/test_rpc_attempt_htlc_as_attempt.js +19 -3
- package/test/lnd_responses/test_rpc_payment_as_payment.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 5.15.1
|
|
4
|
+
|
|
5
|
+
- `getFailedPayments`, `getPayments`, `getPendingPayments`: Remove
|
|
6
|
+
`confirmed_at` date when a payment is not confirmed, add `created_at` and
|
|
7
|
+
`failed_at` dates for attempt start and attempt failed dates.
|
|
8
|
+
|
|
3
9
|
## 5.15.0
|
|
4
10
|
|
|
5
11
|
- `beginGroupSigningSession`: Add method to start a MuSig2 signing session
|
|
@@ -56,7 +56,9 @@ const type = 'default';
|
|
|
56
56
|
message: <Error Message String>
|
|
57
57
|
}
|
|
58
58
|
[index]: <Payment Add Index Number>
|
|
59
|
-
[confirmed_at]: <Payment
|
|
59
|
+
[confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
|
|
60
|
+
created_at: <Attempt Was Started At ISO 8601 Date String>
|
|
61
|
+
[failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
|
|
60
62
|
is_confirmed: <Payment Attempt Succeeded Bool>
|
|
61
63
|
is_failed: <Payment Attempt Failed Bool>
|
|
62
64
|
is_pending: <Payment Attempt is Waiting For Resolution Bool>
|
|
@@ -55,7 +55,9 @@ const type = 'default';
|
|
|
55
55
|
message: <Error Message String>
|
|
56
56
|
}
|
|
57
57
|
[index]: <Payment Add Index Number>
|
|
58
|
-
[confirmed_at]: <Payment
|
|
58
|
+
[confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
|
|
59
|
+
created_at: <Attempt Was Started At ISO 8601 Date String>
|
|
60
|
+
[failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
|
|
59
61
|
is_confirmed: <Payment Attempt Succeeded Bool>
|
|
60
62
|
is_failed: <Payment Attempt Failed Bool>
|
|
61
63
|
is_pending: <Payment Attempt is Waiting For Resolution Bool>
|
|
@@ -57,6 +57,8 @@ const type = 'default';
|
|
|
57
57
|
}
|
|
58
58
|
[index]: <Payment Add Index Number>
|
|
59
59
|
[confirmed_at]: <Payment Confirmed At ISO 8601 Date String>
|
|
60
|
+
created_at: <Attempt Was Started At ISO 8601 Date String>
|
|
61
|
+
[failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
|
|
60
62
|
is_confirmed: <Payment Attempt Succeeded Bool>
|
|
61
63
|
is_failed: <Payment Attempt Failed Bool>
|
|
62
64
|
is_pending: <Payment Attempt is Waiting For Resolution Bool>
|
|
@@ -61,7 +61,9 @@ const nsAsMs = ns => Number(BigInt(ns) / BigInt(1e6));
|
|
|
61
61
|
|
|
62
62
|
@returns
|
|
63
63
|
{
|
|
64
|
-
confirmed_at: <Payment Succeeded At ISO 8601 Date String>
|
|
64
|
+
[confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
|
|
65
|
+
created_at: <Attempt Was Started At ISO 8601 Date String>
|
|
66
|
+
[failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
|
|
65
67
|
is_confirmed: <Payment Attempt Succeeded Bool>
|
|
66
68
|
is_failed: <Payment Attempt Failed Bool>
|
|
67
69
|
is_pending: <Payment Attempt is Waiting For Resolution Bool>
|
|
@@ -91,6 +93,10 @@ module.exports = attempt => {
|
|
|
91
93
|
throw new Error('ExpectedRpcAttemptDetailsToDeriveAttempt');
|
|
92
94
|
}
|
|
93
95
|
|
|
96
|
+
if (!attempt.attempt_time_ns) {
|
|
97
|
+
throw new Error('ExpectedRpcAttemptStartTimeNs');
|
|
98
|
+
}
|
|
99
|
+
|
|
94
100
|
if (!attempt.resolve_time_ns) {
|
|
95
101
|
throw new Error('ExpectedRpcAttemptResolveTimeNs');
|
|
96
102
|
}
|
|
@@ -103,11 +109,39 @@ module.exports = attempt => {
|
|
|
103
109
|
throw new Error('ExpectedAttemptStatusInRpcAttemptDetails');
|
|
104
110
|
}
|
|
105
111
|
|
|
112
|
+
const route = rpcRouteAsRoute(attempt.route);
|
|
113
|
+
|
|
114
|
+
if (attempt.status === attemptStates.confirmed) {
|
|
115
|
+
return {
|
|
116
|
+
route,
|
|
117
|
+
confirmed_at: new Date(nsAsMs(attempt.resolve_time_ns)).toISOString(),
|
|
118
|
+
created_at: new Date(nsAsMs(attempt.attempt_time_ns)).toISOString(),
|
|
119
|
+
failed_at: undefined,
|
|
120
|
+
is_confirmed: true,
|
|
121
|
+
is_failed: false,
|
|
122
|
+
is_pending: false,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
if (attempt.status === attemptStates.failed) {
|
|
127
|
+
return {
|
|
128
|
+
route,
|
|
129
|
+
confirmed_at: undefined,
|
|
130
|
+
created_at: new Date(nsAsMs(attempt.attempt_time_ns)).toISOString(),
|
|
131
|
+
failed_at: new Date(nsAsMs(attempt.resolve_time_ns)).toISOString(),
|
|
132
|
+
is_confirmed: false,
|
|
133
|
+
is_failed: true,
|
|
134
|
+
is_pending: false,
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
106
138
|
return {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
139
|
+
route,
|
|
140
|
+
confirmed_at: undefined,
|
|
141
|
+
created_at: new Date(nsAsMs(attempt.attempt_time_ns)).toISOString(),
|
|
142
|
+
failed_at: undefined,
|
|
143
|
+
is_confirmed: false,
|
|
144
|
+
is_failed: false,
|
|
110
145
|
is_pending: attempt.status === attemptStates.pending,
|
|
111
|
-
route: rpcRouteAsRoute(attempt.route),
|
|
112
146
|
};
|
|
113
147
|
};
|
|
@@ -81,6 +81,9 @@ const routePublicKeys = route => route.hops.map(n => n.public_key);
|
|
|
81
81
|
@returns
|
|
82
82
|
{
|
|
83
83
|
attempts: [{
|
|
84
|
+
[confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
|
|
85
|
+
created_at: <Attempt Was Started At ISO 8601 Date String>
|
|
86
|
+
[failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
|
|
84
87
|
[failure]: {
|
|
85
88
|
code: <Error Type Code Number>
|
|
86
89
|
[details]: {
|
|
@@ -108,6 +111,9 @@ const routePublicKeys = route => route.hops.map(n => n.public_key);
|
|
|
108
111
|
}
|
|
109
112
|
message: <Error Message String>
|
|
110
113
|
}
|
|
114
|
+
[confirmed_at]: <Payment Attempt Succeeded At ISO 8601 Date String>
|
|
115
|
+
created_at: <Attempt Was Started At ISO 8601 Date String>
|
|
116
|
+
[failed_at]: <Payment Attempt Failed At ISO 8601 Date String>
|
|
111
117
|
is_confirmed: <Payment Attempt Succeeded Bool>
|
|
112
118
|
is_failed: <Payment Attempt Failed Bool>
|
|
113
119
|
is_pending: <Payment Attempt is Waiting For Resolution Bool>
|
package/package.json
CHANGED
|
@@ -65,6 +65,8 @@ const makeExpectedPayment = ({}) => {
|
|
|
65
65
|
destination: '020202020202020202020202020202020202020202020202020202020202020202',
|
|
66
66
|
attempts: [{
|
|
67
67
|
confirmed_at: '1970-01-01T00:00:00.000Z',
|
|
68
|
+
created_at: '1970-01-01T00:00:00.000Z',
|
|
69
|
+
failed_at: undefined,
|
|
68
70
|
is_confirmed: true,
|
|
69
71
|
is_failed: false,
|
|
70
72
|
is_pending: false,
|
|
@@ -19,7 +19,12 @@ const route = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
const makeArgs = overrides => {
|
|
22
|
-
const args = {
|
|
22
|
+
const args = {
|
|
23
|
+
route,
|
|
24
|
+
attempt_time_ns: '1',
|
|
25
|
+
resolve_time_ns: '1',
|
|
26
|
+
status: 'IN_FLIGHT',
|
|
27
|
+
};
|
|
23
28
|
|
|
24
29
|
Object.keys(overrides).forEach(k => args[k] = overrides[k]);
|
|
25
30
|
|
|
@@ -29,6 +34,8 @@ const makeArgs = overrides => {
|
|
|
29
34
|
const makeExpected = overrides => {
|
|
30
35
|
const attempt = {
|
|
31
36
|
confirmed_at: '1970-01-01T00:00:00.000Z',
|
|
37
|
+
created_at: '1970-01-01T00:00:00.000Z',
|
|
38
|
+
failed_at: undefined,
|
|
32
39
|
is_confirmed: false,
|
|
33
40
|
is_failed: false,
|
|
34
41
|
is_pending: false,
|
|
@@ -64,6 +71,11 @@ const tests = [
|
|
|
64
71
|
description: 'An rpc attempt is required to map to an attempt',
|
|
65
72
|
error: 'ExpectedRpcAttemptDetailsToDeriveAttempt',
|
|
66
73
|
},
|
|
74
|
+
{
|
|
75
|
+
args: makeArgs({attempt_time_ns: undefined}),
|
|
76
|
+
description: 'Expected attempt time in rpc attempt details',
|
|
77
|
+
error: 'ExpectedRpcAttemptStartTimeNs',
|
|
78
|
+
},
|
|
67
79
|
{
|
|
68
80
|
args: makeArgs({resolve_time_ns: undefined}),
|
|
69
81
|
description: 'Expected resolve time in rpc attempt details',
|
|
@@ -82,7 +94,7 @@ const tests = [
|
|
|
82
94
|
{
|
|
83
95
|
args: makeArgs({}),
|
|
84
96
|
description: 'An in flight rpc attempt is mapped to an attempt',
|
|
85
|
-
expected: makeExpected({is_pending: true}),
|
|
97
|
+
expected: makeExpected({confirmed_at: undefined, is_pending: true}),
|
|
86
98
|
},
|
|
87
99
|
{
|
|
88
100
|
args: makeArgs({status: 'SUCCEEDED'}),
|
|
@@ -92,7 +104,11 @@ const tests = [
|
|
|
92
104
|
{
|
|
93
105
|
args: makeArgs({status: 'FAILED'}),
|
|
94
106
|
description: 'An rpc attempt is mapped to an attempt',
|
|
95
|
-
expected: makeExpected({
|
|
107
|
+
expected: makeExpected({
|
|
108
|
+
confirmed_at: undefined,
|
|
109
|
+
failed_at: '1970-01-01T00:00:00.000Z',
|
|
110
|
+
is_failed: true,
|
|
111
|
+
}),
|
|
96
112
|
},
|
|
97
113
|
];
|
|
98
114
|
|
|
@@ -73,7 +73,9 @@ const makeArgs = overrides => {
|
|
|
73
73
|
const makeExpected = overrides => {
|
|
74
74
|
const expected = {
|
|
75
75
|
attempts: [{
|
|
76
|
-
confirmed_at:
|
|
76
|
+
confirmed_at: undefined,
|
|
77
|
+
created_at: '1970-01-01T00:00:00.001Z',
|
|
78
|
+
failed_at: '1970-01-01T00:00:00.001Z',
|
|
77
79
|
is_confirmed: false,
|
|
78
80
|
is_failed: true,
|
|
79
81
|
is_pending: false,
|
|
@@ -272,6 +274,8 @@ const tests = [
|
|
|
272
274
|
expected: makeExpected({
|
|
273
275
|
attempts: [{
|
|
274
276
|
confirmed_at: '2020-04-20T19:17:16.160Z',
|
|
277
|
+
created_at: '2020-04-20T19:17:15.428Z',
|
|
278
|
+
failed_at: undefined,
|
|
275
279
|
is_confirmed: true,
|
|
276
280
|
is_failed: false,
|
|
277
281
|
is_pending: false,
|