lightning 4.3.0 → 4.6.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 +31 -0
- package/grpc/protos/lightning.proto +115 -1
- package/grpc/protos/stateservice.proto +3 -0
- package/index.js +2 -0
- package/lnd_methods/index.js +2 -0
- package/lnd_methods/offchain/delete_failed_pay_attempts.js +25 -4
- package/lnd_methods/offchain/delete_payment.js +58 -0
- package/lnd_methods/offchain/emit_payment.d.ts +3 -3
- package/lnd_methods/offchain/finished_payment.js +3 -0
- package/lnd_methods/offchain/get_payment.d.ts +4 -0
- package/lnd_methods/offchain/get_payment.js +2 -0
- package/lnd_methods/offchain/get_payments.d.ts +4 -0
- package/lnd_methods/offchain/get_payments.js +2 -0
- package/lnd_methods/offchain/get_pending_channels.d.ts +4 -0
- package/lnd_methods/offchain/index.d.ts +1 -0
- package/lnd_methods/offchain/index.js +2 -0
- package/lnd_methods/offchain/pay.d.ts +2 -0
- package/lnd_methods/offchain/pay.js +2 -0
- package/lnd_methods/offchain/pay_via_payment_details.d.ts +2 -0
- package/lnd_methods/offchain/pay_via_payment_details.js +1 -0
- package/lnd_methods/offchain/pay_via_payment_request.d.ts +2 -0
- package/lnd_methods/offchain/pay_via_payment_request.js +1 -0
- package/lnd_methods/offchain/pay_via_routes.d.ts +2 -0
- package/lnd_methods/offchain/pay_via_routes.js +2 -0
- package/lnd_methods/offchain/subscribe_to_past_payment.d.ts +6 -0
- package/lnd_methods/offchain/subscribe_to_past_payment.js +2 -0
- package/lnd_methods/offchain/subscribe_to_past_payments.d.ts +70 -0
- package/lnd_methods/offchain/subscribe_to_past_payments.js +2 -0
- package/lnd_methods/offchain/subscribe_to_pay.js +1 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_details.d.ts +2 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_details.js +1 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_request.d.ts +2 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_request.js +1 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_routes.d.ts +2 -0
- package/lnd_methods/offchain/subscribe_to_pay_via_routes.js +11 -1
- package/lnd_methods/offchain/subscribe_to_probe_for_route.d.ts +1 -1
- package/lnd_methods/unauthenticated/get_wallet_status.d.ts +3 -0
- package/lnd_methods/unauthenticated/get_wallet_status.js +3 -0
- package/lnd_methods/unauthenticated/subscribe_to_wallet_status.d.ts +4 -1
- package/lnd_methods/unauthenticated/subscribe_to_wallet_status.js +9 -0
- package/lnd_responses/confirmed_from_payment.js +7 -0
- package/lnd_responses/rpc_attempt_htlc_as_attempt.js +8 -27
- package/lnd_responses/rpc_payment_as_payment.js +3 -0
- package/lnd_responses/rpc_wallet_state_as_state.js +5 -0
- package/package.json +2 -2
- package/test/lnd_methods/offchain/test_delete_failed_pay_attempts.js +18 -0
- package/test/lnd_methods/offchain/test_delete_payment.js +51 -0
- package/test/lnd_methods/offchain/test_delete_payments.js +1 -1
- package/test/lnd_methods/offchain/test_finished_payment.js +2 -0
- package/test/lnd_methods/offchain/test_get_payments.js +4 -2
- package/test/lnd_methods/offchain/test_subscribe_to_past_payments.js +2 -0
- package/test/lnd_methods/offchain/test_subscribe_to_pay_via_routes.js +1 -0
- package/test/lnd_responses/test_confirmed_from_payment.js +2 -0
- package/test/lnd_responses/test_rpc_attempt_htlc_as_attempt.js +35 -21
- package/test/lnd_responses/test_rpc_payment_as_payment.js +4 -0
- package/test/lnd_responses/test_rpc_wallet_state_as_state.js +5 -0
- package/test/protos/protos.json +1 -1
- package/test/typescript/subscribe_to_past_payments.test-d.ts +11 -0
- package/typescript/shared.d.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,36 @@
|
|
|
1
1
|
# Versions
|
|
2
2
|
|
|
3
|
+
## 4.6.0
|
|
4
|
+
|
|
5
|
+
- `getPayment`: Add `destination` to indicate the destination of the payment
|
|
6
|
+
- `subscribeToPastPayment`: Add `destination` to indicate the destination of the payment
|
|
7
|
+
- `subscribeToPastPayments`: Add `destination` to indicate the destination of the payment
|
|
8
|
+
|
|
9
|
+
## 4.5.0
|
|
10
|
+
|
|
11
|
+
- `deletePayment`: Add method to delete a single payment
|
|
12
|
+
- `deleteFailedPayAttempts`: Add `id` argument to delete failed attempts for a payment
|
|
13
|
+
- `getWalletStatus`: `is_ready`: Add wallet server ready status
|
|
14
|
+
- `subscribeToWalletStatus`: Add `ready` event to indicate server ready status
|
|
15
|
+
|
|
16
|
+
## 4.4.0
|
|
17
|
+
|
|
18
|
+
- `getPayment`: Add `confirmed_at` to indicate when payment resolved successfully
|
|
19
|
+
- `getPayments`: Add `confirmed_at` to indicate when payments resolve successfully
|
|
20
|
+
- `pay`: Add `confirmed_at` to indicate when payment resolved successfully
|
|
21
|
+
- `payViaPaymentDetails`: Add `confirmed_at` to indicate when payment was sent
|
|
22
|
+
- `payViaPaymentRequest`: Add `confirmed_at` to indicate when payment was sent
|
|
23
|
+
- `payViaRoutes`: Add `confirmed_at` to indicate when payment resolved successfully
|
|
24
|
+
- `subscribeToPastPayment`: Add `confirmed_at` to indicate when payment succeeded
|
|
25
|
+
- `subscribeToPastPayments`: Add `confirmed_at` to indicate when payments succeed
|
|
26
|
+
- `subscribeToPayViaDetails`: Add `confirmed_at` to indicate when payment was sent
|
|
27
|
+
- `subscribeToPayViaRequest`: Add `confirmed_at` to indicate when payment was sent
|
|
28
|
+
- `subscribeToPayViaRoutes`: Add `confirmed_at` to indicate when payment was sent
|
|
29
|
+
|
|
30
|
+
## 4.3.1
|
|
31
|
+
|
|
32
|
+
- `getPendingChannels`: Add typescript annotations to result
|
|
33
|
+
|
|
3
34
|
## 4.3.0
|
|
4
35
|
|
|
5
36
|
- `getPendingChannels`: Add `is_timelocked` and `timelock_blocks` to force closes
|
|
@@ -200,6 +200,16 @@ service Lightning {
|
|
|
200
200
|
*/
|
|
201
201
|
rpc OpenChannel (OpenChannelRequest) returns (stream OpenStatusUpdate);
|
|
202
202
|
|
|
203
|
+
/* lncli: `batchopenchannel`
|
|
204
|
+
BatchOpenChannel attempts to open multiple single-funded channels in a
|
|
205
|
+
single transaction in an atomic way. This means either all channel open
|
|
206
|
+
requests succeed at once or all attempts are aborted if any of them fail.
|
|
207
|
+
This is the safer variant of using PSBTs to manually fund a batch of
|
|
208
|
+
channels through the OpenChannel RPC.
|
|
209
|
+
*/
|
|
210
|
+
rpc BatchOpenChannel (BatchOpenChannelRequest)
|
|
211
|
+
returns (BatchOpenChannelResponse);
|
|
212
|
+
|
|
203
213
|
/*
|
|
204
214
|
FundingStateStep is an advanced funding related call that allows the caller
|
|
205
215
|
to either execute some preparatory steps for a funding workflow, or
|
|
@@ -330,7 +340,14 @@ service Lightning {
|
|
|
330
340
|
rpc ListPayments (ListPaymentsRequest) returns (ListPaymentsResponse);
|
|
331
341
|
|
|
332
342
|
/*
|
|
333
|
-
|
|
343
|
+
DeletePayment deletes an outgoing payment from DB. Note that it will not
|
|
344
|
+
attempt to delete an In-Flight payment, since that would be unsafe.
|
|
345
|
+
*/
|
|
346
|
+
rpc DeletePayment (DeletePaymentRequest) returns (DeletePaymentResponse);
|
|
347
|
+
|
|
348
|
+
/*
|
|
349
|
+
DeleteAllPayments deletes all outgoing payments from DB. Note that it will
|
|
350
|
+
not attempt to delete In-Flight payments, since that would be unsafe.
|
|
334
351
|
*/
|
|
335
352
|
rpc DeleteAllPayments (DeleteAllPaymentsRequest)
|
|
336
353
|
returns (DeleteAllPaymentsResponse);
|
|
@@ -1776,6 +1793,84 @@ message ReadyForPsbtFunding {
|
|
|
1776
1793
|
bytes psbt = 3;
|
|
1777
1794
|
}
|
|
1778
1795
|
|
|
1796
|
+
message BatchOpenChannelRequest {
|
|
1797
|
+
// The list of channels to open.
|
|
1798
|
+
repeated BatchOpenChannel channels = 1;
|
|
1799
|
+
|
|
1800
|
+
// The target number of blocks that the funding transaction should be
|
|
1801
|
+
// confirmed by.
|
|
1802
|
+
int32 target_conf = 2;
|
|
1803
|
+
|
|
1804
|
+
// A manual fee rate set in sat/vByte that should be used when crafting the
|
|
1805
|
+
// funding transaction.
|
|
1806
|
+
int64 sat_per_vbyte = 3;
|
|
1807
|
+
|
|
1808
|
+
// The minimum number of confirmations each one of your outputs used for
|
|
1809
|
+
// the funding transaction must satisfy.
|
|
1810
|
+
int32 min_confs = 4;
|
|
1811
|
+
|
|
1812
|
+
// Whether unconfirmed outputs should be used as inputs for the funding
|
|
1813
|
+
// transaction.
|
|
1814
|
+
bool spend_unconfirmed = 5;
|
|
1815
|
+
|
|
1816
|
+
// An optional label for the batch transaction, limited to 500 characters.
|
|
1817
|
+
string label = 6;
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
message BatchOpenChannel {
|
|
1821
|
+
// The pubkey of the node to open a channel with. When using REST, this
|
|
1822
|
+
// field must be encoded as base64.
|
|
1823
|
+
bytes node_pubkey = 1;
|
|
1824
|
+
|
|
1825
|
+
// The number of satoshis the wallet should commit to the channel.
|
|
1826
|
+
int64 local_funding_amount = 2;
|
|
1827
|
+
|
|
1828
|
+
// The number of satoshis to push to the remote side as part of the initial
|
|
1829
|
+
// commitment state.
|
|
1830
|
+
int64 push_sat = 3;
|
|
1831
|
+
|
|
1832
|
+
// Whether this channel should be private, not announced to the greater
|
|
1833
|
+
// network.
|
|
1834
|
+
bool private = 4;
|
|
1835
|
+
|
|
1836
|
+
// The minimum value in millisatoshi we will require for incoming HTLCs on
|
|
1837
|
+
// the channel.
|
|
1838
|
+
int64 min_htlc_msat = 5;
|
|
1839
|
+
|
|
1840
|
+
// The delay we require on the remote's commitment transaction. If this is
|
|
1841
|
+
// not set, it will be scaled automatically with the channel size.
|
|
1842
|
+
uint32 remote_csv_delay = 6;
|
|
1843
|
+
|
|
1844
|
+
/*
|
|
1845
|
+
Close address is an optional address which specifies the address to which
|
|
1846
|
+
funds should be paid out to upon cooperative close. This field may only be
|
|
1847
|
+
set if the peer supports the option upfront feature bit (call listpeers
|
|
1848
|
+
to check). The remote peer will only accept cooperative closes to this
|
|
1849
|
+
address if it is set.
|
|
1850
|
+
|
|
1851
|
+
Note: If this value is set on channel creation, you will *not* be able to
|
|
1852
|
+
cooperatively close out to a different address.
|
|
1853
|
+
*/
|
|
1854
|
+
string close_address = 7;
|
|
1855
|
+
|
|
1856
|
+
/*
|
|
1857
|
+
An optional, unique identifier of 32 random bytes that will be used as the
|
|
1858
|
+
pending channel ID to identify the channel while it is in the pre-pending
|
|
1859
|
+
state.
|
|
1860
|
+
*/
|
|
1861
|
+
bytes pending_chan_id = 8;
|
|
1862
|
+
|
|
1863
|
+
/*
|
|
1864
|
+
The explicit commitment type to use. Note this field will only be used if
|
|
1865
|
+
the remote peer supports explicit channel negotiation.
|
|
1866
|
+
*/
|
|
1867
|
+
CommitmentType commitment_type = 9;
|
|
1868
|
+
}
|
|
1869
|
+
|
|
1870
|
+
message BatchOpenChannelResponse {
|
|
1871
|
+
repeated PendingUpdate pending_channels = 1;
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1779
1874
|
message OpenChannelRequest {
|
|
1780
1875
|
// A manual fee rate set in sat/vbyte that should be used when crafting the
|
|
1781
1876
|
// funding transaction.
|
|
@@ -1867,6 +1962,12 @@ message OpenChannelRequest {
|
|
|
1867
1962
|
transaction.
|
|
1868
1963
|
*/
|
|
1869
1964
|
uint32 max_local_csv = 17;
|
|
1965
|
+
|
|
1966
|
+
/*
|
|
1967
|
+
The explicit commitment type to use. Note this field will only be used if
|
|
1968
|
+
the remote peer supports explicit channel negotiation.
|
|
1969
|
+
*/
|
|
1970
|
+
CommitmentType commitment_type = 18;
|
|
1870
1971
|
}
|
|
1871
1972
|
message OpenStatusUpdate {
|
|
1872
1973
|
oneof update {
|
|
@@ -3354,6 +3455,16 @@ message ListPaymentsResponse {
|
|
|
3354
3455
|
uint64 last_index_offset = 3;
|
|
3355
3456
|
}
|
|
3356
3457
|
|
|
3458
|
+
message DeletePaymentRequest {
|
|
3459
|
+
// Payment hash to delete.
|
|
3460
|
+
bytes payment_hash = 1;
|
|
3461
|
+
|
|
3462
|
+
/*
|
|
3463
|
+
Only delete failed HTLCs from the payment, not the payment itself.
|
|
3464
|
+
*/
|
|
3465
|
+
bool failed_htlcs_only = 2;
|
|
3466
|
+
}
|
|
3467
|
+
|
|
3357
3468
|
message DeleteAllPaymentsRequest {
|
|
3358
3469
|
// Only delete failed payments.
|
|
3359
3470
|
bool failed_payments_only = 1;
|
|
@@ -3364,6 +3475,9 @@ message DeleteAllPaymentsRequest {
|
|
|
3364
3475
|
bool failed_htlcs_only = 2;
|
|
3365
3476
|
}
|
|
3366
3477
|
|
|
3478
|
+
message DeletePaymentResponse {
|
|
3479
|
+
}
|
|
3480
|
+
|
|
3367
3481
|
message DeleteAllPaymentsResponse {
|
|
3368
3482
|
}
|
|
3369
3483
|
|
package/index.js
CHANGED
|
@@ -107,6 +107,7 @@ const {subscribeToInvoice} = require('./lnd_methods');
|
|
|
107
107
|
const {subscribeToInvoices} = require('./lnd_methods');
|
|
108
108
|
const {subscribeToOpenRequests} = require('./lnd_methods');
|
|
109
109
|
const {subscribeToPastPayment} = require('./lnd_methods');
|
|
110
|
+
const {subscribeToPastPayments} = require('./lnd_methods');
|
|
110
111
|
const {subscribeToPayViaDetails} = require('./lnd_methods');
|
|
111
112
|
const {subscribeToPayViaRequest} = require('./lnd_methods');
|
|
112
113
|
const {subscribeToPayViaRoutes} = require('./lnd_methods');
|
|
@@ -236,6 +237,7 @@ module.exports = {
|
|
|
236
237
|
subscribeToInvoices,
|
|
237
238
|
subscribeToOpenRequests,
|
|
238
239
|
subscribeToPastPayment,
|
|
240
|
+
subscribeToPastPayments,
|
|
239
241
|
subscribeToPayViaDetails,
|
|
240
242
|
subscribeToPayViaRequest,
|
|
241
243
|
subscribeToPayViaRoutes,
|
package/lnd_methods/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const {decodePaymentRequest} = require('./offchain');
|
|
|
14
14
|
const {deleteFailedPayAttempts} = require('./offchain');
|
|
15
15
|
const {deleteFailedPayments} = require('./offchain');
|
|
16
16
|
const {deleteForwardingReputations} = require('./offchain');
|
|
17
|
+
const {deletePayment} = require('./offchain');
|
|
17
18
|
const {deletePayments} = require('./offchain');
|
|
18
19
|
const {diffieHellmanComputeSecret} = require('./signer');
|
|
19
20
|
const {disableChannel} = require('./offchain');
|
|
@@ -140,6 +141,7 @@ module.exports = {
|
|
|
140
141
|
deleteFailedPayAttempts,
|
|
141
142
|
deleteFailedPayments,
|
|
142
143
|
deleteForwardingReputations,
|
|
144
|
+
deletePayment,
|
|
143
145
|
deletePayments,
|
|
144
146
|
diffieHellmanComputeSecret,
|
|
145
147
|
disableChannel,
|
|
@@ -3,7 +3,11 @@ const {returnResult} = require('asyncjs-util');
|
|
|
3
3
|
|
|
4
4
|
const {isLnd} = require('./../../lnd_requests');
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const deleteAllMethod = 'deleteAllPayments';
|
|
7
|
+
const deleteOneMethod = 'deletePayment';
|
|
8
|
+
const hexAsBuffer = hex => Buffer.from(hex, 'hex');
|
|
9
|
+
const isHash = n => /^[0-9A-F]{64}$/i.test(n);
|
|
10
|
+
const notSupported = /unknown/;
|
|
7
11
|
const type = 'default';
|
|
8
12
|
|
|
9
13
|
/** Delete failed payment attempt records
|
|
@@ -12,18 +16,25 @@ const type = 'default';
|
|
|
12
16
|
|
|
13
17
|
Method not supported on LND 0.12.1 or below
|
|
14
18
|
|
|
19
|
+
`id` is not supported on LND 0.13.1 or below
|
|
20
|
+
|
|
15
21
|
{
|
|
22
|
+
[id]: <Delete Only Failed Attempt Records For Payment With Hash Hex String>
|
|
16
23
|
lnd: <Authenticated LND API Object>
|
|
17
24
|
}
|
|
18
25
|
|
|
19
26
|
@returns via cbk or Promise
|
|
20
27
|
*/
|
|
21
|
-
module.exports = ({lnd}, cbk) => {
|
|
28
|
+
module.exports = ({id, lnd}, cbk) => {
|
|
22
29
|
return new Promise((resolve, reject) => {
|
|
23
30
|
return asyncAuto({
|
|
24
31
|
// Check arguments
|
|
25
32
|
validate: cbk => {
|
|
26
|
-
if (!
|
|
33
|
+
if (!!id && !isHash(id)) {
|
|
34
|
+
return cbk([400, 'ExpectedPaymentHashToDeleteFailedPayAttempts']);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (!isLnd({lnd, type, method: deleteAllMethod})) {
|
|
27
38
|
return cbk([400, 'ExpectedAuthenticatedLndToDeleteFailedAttempts']);
|
|
28
39
|
}
|
|
29
40
|
|
|
@@ -32,7 +43,17 @@ module.exports = ({lnd}, cbk) => {
|
|
|
32
43
|
|
|
33
44
|
// Delete failed payments
|
|
34
45
|
deletePayments: ['validate', ({}, cbk) => {
|
|
35
|
-
|
|
46
|
+
const method = !id ? deleteAllMethod : deleteOneMethod;
|
|
47
|
+
|
|
48
|
+
return lnd[type][method]({
|
|
49
|
+
failed_htlcs_only: true,
|
|
50
|
+
id: !!id ? hexAsBuffer(id) : undefined,
|
|
51
|
+
},
|
|
52
|
+
err => {
|
|
53
|
+
if (!!err && notSupported.test(err.details)) {
|
|
54
|
+
return cbk([501, 'DeleteFailedPaymentAttemptsMethodNotSupported']);
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
if (!!err) {
|
|
37
58
|
return cbk([503, 'UnexpectedErrorDeletingFailedAttempts', {err}]);
|
|
38
59
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
const asyncAuto = require('async/auto');
|
|
2
|
+
const {returnResult} = require('asyncjs-util');
|
|
3
|
+
|
|
4
|
+
const {isLnd} = require('./../../lnd_requests');
|
|
5
|
+
|
|
6
|
+
const hexAsBytes = hex => Buffer.from(hex, 'hex');
|
|
7
|
+
const isHash = n => !!n && /^[0-9A-F]{64}$/i.test(n);
|
|
8
|
+
const method = 'deletePayment';
|
|
9
|
+
const notSupported = /unknown/;
|
|
10
|
+
const type = 'default';
|
|
11
|
+
|
|
12
|
+
/** Delete a payment record
|
|
13
|
+
|
|
14
|
+
Requires `offchain:write` permission
|
|
15
|
+
|
|
16
|
+
Note: this method is not supported on LND 0.13.1 and below
|
|
17
|
+
|
|
18
|
+
{
|
|
19
|
+
id: <Payment Preimage Hash Hex String>
|
|
20
|
+
lnd: <Authenticated LND API Object>
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@returns via cbk or Promise
|
|
24
|
+
*/
|
|
25
|
+
module.exports = ({id, lnd}, cbk) => {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
return asyncAuto({
|
|
28
|
+
// Check arguments
|
|
29
|
+
validate: cbk => {
|
|
30
|
+
if (!isHash(id)) {
|
|
31
|
+
return cbk([400, 'ExpectedPaymentHashToDeletePaymentRecord']);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!isLnd({lnd, method, type})) {
|
|
35
|
+
return cbk([400, 'ExpectedAuthenticatedLndToDeletePayment']);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return cbk();
|
|
39
|
+
},
|
|
40
|
+
|
|
41
|
+
// Delete all payments
|
|
42
|
+
deletePayments: ['validate', ({}, cbk) => {
|
|
43
|
+
return lnd[type][method]({payment_hash: hexAsBytes(id)}, err => {
|
|
44
|
+
if (!!err && notSupported.test(err.details)) {
|
|
45
|
+
return cbk([501, 'DeletePaymentMethodNotSupported']);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (!!err) {
|
|
49
|
+
return cbk([503, 'UnexpectedErrorDeletingPayment', {err}]);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return cbk();
|
|
53
|
+
});
|
|
54
|
+
}],
|
|
55
|
+
},
|
|
56
|
+
returnResult({reject, resolve}, cbk));
|
|
57
|
+
});
|
|
58
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as events from 'events';
|
|
2
2
|
import {ConfirmedFromPaymentResult} from '../../lnd_responses/confirmed_from_payment';
|
|
3
3
|
import {FailureFromPaymentResult} from '../../lnd_responses/failure_from_payment';
|
|
4
|
-
import {LightningError, PaymentState} from '../../typescript';
|
|
4
|
+
import {EmptyObject, LightningError, PaymentState} from '../../typescript';
|
|
5
5
|
|
|
6
6
|
export type EmitPaymentArgs = {
|
|
7
7
|
data: {
|
|
@@ -14,8 +14,8 @@ export type EmitPaymentConfirmedEvent = ConfirmedFromPaymentResult;
|
|
|
14
14
|
|
|
15
15
|
export type EmitPaymentFailedEvent = FailureFromPaymentResult;
|
|
16
16
|
|
|
17
|
-
export type EmitPaymentPayingEvent =
|
|
17
|
+
export type EmitPaymentPayingEvent = EmptyObject;
|
|
18
18
|
|
|
19
|
-
export type EmitPaymentError = LightningError<
|
|
19
|
+
export type EmitPaymentError = LightningError<undefined>;
|
|
20
20
|
|
|
21
21
|
export const emitPayment: (args: EmitPaymentArgs) => boolean | undefined;
|
|
@@ -5,6 +5,7 @@ const {returnResult} = require('asyncjs-util');
|
|
|
5
5
|
|
|
6
6
|
{
|
|
7
7
|
[confirmed]: {
|
|
8
|
+
confirmed_at: <Payment Confirmed At ISO 8601 Date String>
|
|
8
9
|
fee: <Total Fee Tokens Paid Rounded Down Number>
|
|
9
10
|
fee_mtokens: <Total Fee Millitokens Paid String>
|
|
10
11
|
hops: [{
|
|
@@ -66,6 +67,7 @@ const {returnResult} = require('asyncjs-util');
|
|
|
66
67
|
|
|
67
68
|
@returns via cbk or Promise
|
|
68
69
|
{
|
|
70
|
+
confirmed_at: <Payment Confirmed At ISO 8601 Date String>
|
|
69
71
|
fee: <Fee Tokens Number>
|
|
70
72
|
fee_mtokens: <Total Fee Millitokens To Pay String>
|
|
71
73
|
hops: [{
|
|
@@ -134,6 +136,7 @@ module.exports = ({confirmed, failed}, cbk) => {
|
|
|
134
136
|
// Return the payment resolution
|
|
135
137
|
payment: ['checkFailure', ({}, cbk) => {
|
|
136
138
|
return cbk(null, {
|
|
139
|
+
confirmed_at: confirmed.confirmed_at,
|
|
137
140
|
fee: confirmed.fee,
|
|
138
141
|
fee_mtokens: confirmed.fee_mtokens,
|
|
139
142
|
hops: confirmed.hops,
|
|
@@ -26,6 +26,10 @@ export type GetPaymentResult = {
|
|
|
26
26
|
/** Payment Is Pending */
|
|
27
27
|
is_pending?: boolean;
|
|
28
28
|
payment?: {
|
|
29
|
+
/** Confirmed at ISO-8601 Date */
|
|
30
|
+
confirmed_at: string;
|
|
31
|
+
/** Payment Destination Public Key Hex */
|
|
32
|
+
destination: string;
|
|
29
33
|
/** Total Fee Millitokens To Pay */
|
|
30
34
|
fee_mtokens: string;
|
|
31
35
|
hops: {
|
|
@@ -29,6 +29,8 @@ const type = 'router';
|
|
|
29
29
|
[is_failed]: <Payment Is Failed Bool>
|
|
30
30
|
[is_pending]: <Payment Is Pending Bool>
|
|
31
31
|
[payment]: {
|
|
32
|
+
confirmed_at: <Payment Confirmed At ISO 8601 Date String>
|
|
33
|
+
destination: <Payment Destination Hex String>
|
|
32
34
|
fee: <Total Fees Paid Rounded Down Number>
|
|
33
35
|
fee_mtokens: <Total Fee Millitokens Paid String>
|
|
34
36
|
hops: [{
|
|
@@ -55,6 +55,8 @@ export type GetPaymentsResult = {
|
|
|
55
55
|
/** Error Message */
|
|
56
56
|
message: string;
|
|
57
57
|
};
|
|
58
|
+
/** Confirmed at ISO-8601 Date */
|
|
59
|
+
confirmed_at?: string;
|
|
58
60
|
/** Payment Attempt Succeeded */
|
|
59
61
|
is_confirmed: boolean;
|
|
60
62
|
/** Payment Attempt Failed */
|
|
@@ -96,6 +98,8 @@ export type GetPaymentsResult = {
|
|
|
96
98
|
total_mtokens?: string;
|
|
97
99
|
};
|
|
98
100
|
}[];
|
|
101
|
+
/** Confirmed at ISO-8601 Date */
|
|
102
|
+
confirmed_at: string;
|
|
99
103
|
/** Payment at ISO-8601 Date */
|
|
100
104
|
created_at: string;
|
|
101
105
|
/** Destination Node Public Key Hex */
|
|
@@ -55,6 +55,7 @@ const type = 'default';
|
|
|
55
55
|
message: <Error Message String>
|
|
56
56
|
}
|
|
57
57
|
[index]: <Payment Add Index Number>
|
|
58
|
+
[confirmed_at]: <Payment Confirmed At ISO 8601 Date String>
|
|
58
59
|
is_confirmed: <Payment Attempt Succeeded Bool>
|
|
59
60
|
is_failed: <Payment Attempt Failed Bool>
|
|
60
61
|
is_pending: <Payment Attempt is Waiting For Resolution Bool>
|
|
@@ -78,6 +79,7 @@ const type = 'default';
|
|
|
78
79
|
[total_mtokens]: <Total Millitokens String>
|
|
79
80
|
}
|
|
80
81
|
}]
|
|
82
|
+
confirmed_at: <Payment Confirmed At ISO 8601 Date String>
|
|
81
83
|
created_at: <Payment at ISO-8601 Date String>
|
|
82
84
|
destination: <Destination Node Public Key Hex String>
|
|
83
85
|
fee: <Paid Routing Fee Rounded Down Tokens Number>
|