lightning 6.3.0 → 6.3.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # Versions
2
2
 
3
- ## 6.3.0
3
+ ## 6.3.1
4
4
 
5
5
  - `getSettlementStatus`: Add method to lookup received htlc settlement status
6
6
 
@@ -0,0 +1,30 @@
1
+ import {
2
+ AuthenticatedLightningArgs,
3
+ AuthenticatedLightningMethod,
4
+ } from '../../typescript';
5
+
6
+ export type GetSettlementStatusArgs = AuthenticatedLightningArgs<{
7
+ /** Standard Format Channel Id String */
8
+ channel: string;
9
+ /** Payment Id Number */
10
+ payment: number;
11
+ }>;
12
+
13
+ export type GetSettlementStatusResult = {
14
+ /** Payment Went to Chain Bool */
15
+ is_onchain: boolean;
16
+ /** Payment Is Settled Into Non-HTLC Balance Bool */
17
+ is_settled: boolean;
18
+ };
19
+
20
+ /**
21
+ * Get the settlement status of a received HTLC
22
+ *
23
+ * Note: this method is not supported in LND versions 0.15.4 and below
24
+ *
25
+ * Requires `offchain:read` permissions
26
+ */
27
+ export const getSettlementStatus: AuthenticatedLightningMethod<
28
+ GetSettlementStatusArgs,
29
+ GetSettlementStatusResult
30
+ >;
@@ -18,6 +18,7 @@ const type = 'default';
18
18
 
19
19
  {
20
20
  channel: <Standard Format Channel Id String>
21
+ lnd: <Authenticated LND API Object>
21
22
  payment: <Payment Id Number>
22
23
  }
23
24
 
@@ -27,6 +27,7 @@ export * from './get_payments';
27
27
  export * from './get_pending_channels';
28
28
  export * from './get_pending_payments';
29
29
  export * from './get_route_through_hops';
30
+ export * from './get_settlement_status';
30
31
  export * from './is_destination_payable';
31
32
  export * from './pay_via_payment_details';
32
33
  export * from './pay_via_payment_request';
@@ -83,7 +83,7 @@ module.exports = ({lnd}) => {
83
83
  const request = rpcForwardAsForwardRequest(data);
84
84
 
85
85
  return emitter.emit(event, {
86
- accept: () => sub.write({
86
+ accept: async () => await sub.write({
87
87
  action: forwardPaymentActions.accept,
88
88
  incoming_circuit_key: data.incoming_circuit_key,
89
89
  }),
@@ -97,11 +97,11 @@ module.exports = ({lnd}) => {
97
97
  mtokens: request.mtokens,
98
98
  onion: request.onion,
99
99
  out_channel: request.out_channel,
100
- reject: () => sub.write({
100
+ reject: async () => await sub.write({
101
101
  action: forwardPaymentActions.reject,
102
102
  incoming_circuit_key: data.incoming_circuit_key,
103
103
  }),
104
- settle: ({secret}) => sub.write({
104
+ settle: async ({secret}) => await sub.write({
105
105
  action: forwardPaymentActions.settle,
106
106
  incoming_circuit_key: data.incoming_circuit_key,
107
107
  preimage: bufferFromHex(secret),
package/package.json CHANGED
@@ -23,7 +23,7 @@
23
23
  "cbor": "8.1.0",
24
24
  "ecpair": "2.1.0",
25
25
  "express": "4.18.2",
26
- "invoices": "2.2.1",
26
+ "invoices": "2.2.2",
27
27
  "psbt": "2.7.1",
28
28
  "tiny-secp256k1": "2.2.1",
29
29
  "type-fest": "3.2.0"
@@ -59,5 +59,5 @@
59
59
  "directory": "test/typescript"
60
60
  },
61
61
  "types": "index.d.ts",
62
- "version": "6.3.0"
62
+ "version": "6.3.1"
63
63
  }
@@ -0,0 +1,26 @@
1
+ import {expectError, expectType} from 'tsd';
2
+ import {AuthenticatedLnd} from '../../lnd_grpc';
3
+ import {
4
+ getSettlementStatus,
5
+ GetSettlementStatusResult,
6
+ } from '../../lnd_methods';
7
+
8
+ const lnd = {} as AuthenticatedLnd;
9
+ const channel = 'channel id';
10
+ const payment = 0;
11
+
12
+ expectError(getSettlementStatus());
13
+ expectError(getSettlementStatus({}));
14
+ expectError(getSettlementStatus({lnd}));
15
+ expectError(getSettlementStatus({lnd, channel}));
16
+ expectError(getSettlementStatus({lnd, payment}));
17
+
18
+ expectType<GetSettlementStatusResult>(
19
+ await getSettlementStatus({lnd, channel, payment})
20
+ );
21
+
22
+ expectType<void>(
23
+ getSettlementStatus({lnd, channel, payment}, (error, result) => {
24
+ expectType<GetSettlementStatusResult>(result);
25
+ })
26
+ );