lightning 4.5.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 CHANGED
@@ -1,5 +1,11 @@
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
+
3
9
  ## 4.5.0
4
10
 
5
11
  - `deletePayment`: Add method to delete a single payment
@@ -28,6 +28,8 @@ export type GetPaymentResult = {
28
28
  payment?: {
29
29
  /** Confirmed at ISO-8601 Date */
30
30
  confirmed_at: string;
31
+ /** Payment Destination Public Key Hex */
32
+ destination: string;
31
33
  /** Total Fee Millitokens To Pay */
32
34
  fee_mtokens: string;
33
35
  hops: {
@@ -30,6 +30,7 @@ const type = 'router';
30
30
  [is_pending]: <Payment Is Pending Bool>
31
31
  [payment]: {
32
32
  confirmed_at: <Payment Confirmed At ISO 8601 Date String>
33
+ destination: <Payment Destination Hex String>
33
34
  fee: <Total Fees Paid Rounded Down Number>
34
35
  fee_mtokens: <Total Fee Millitokens Paid String>
35
36
  hops: [{
@@ -11,6 +11,8 @@ export type SubscribeToPastPaymentArgs = AuthenticatedLightningArgs<{
11
11
  export type SubscribeToPastPaymentConfirmedEvent = {
12
12
  /** Confirmed at ISO-8601 Date */
13
13
  confirmed: string;
14
+ /** Payment Destination Public Key Hex */
15
+ destination: string;
14
16
  /** Payment Forwarding Fee Rounded Down Tokens */
15
17
  fee: number;
16
18
  /** Total Fee Millitokens To Pay */
@@ -41,6 +41,7 @@ const unknownServiceErr = 'unknown service verrpc.Versioner';
41
41
  @event 'confirmed'
42
42
  {
43
43
  confirmed_at: <Payment Confirmed At ISO 8601 Date String>
44
+ destination: <Payment Destination Hex String>
44
45
  fee: <Total Fee Tokens Paid Rounded Down Number>
45
46
  fee_mtokens: <Total Fee Millitokens Paid String>
46
47
  id: <Payment Hash Hex String>
@@ -12,6 +12,8 @@ export type SubscribeToPastPaymentsErrorEvent = LightningError;
12
12
  export type SubscribeToPastPaymentsPaymentEvent = {
13
13
  /** Payment Confirmed At ISO 8601 Date String */
14
14
  confirmed_at: string;
15
+ /** Payment Destination Public Key Hex */
16
+ destination: string;
15
17
  /** Paid Routing Fee Rounded Down Tokens Number */
16
18
  fee: number;
17
19
  /** Paid Routing Fee in Millitokens String */
@@ -41,6 +41,7 @@ const unknownFailureMessage = '2 UNKNOWN: unknown failure detail type: <nil>';
41
41
  @event 'payment'
42
42
  {
43
43
  confirmed_at: <Payment Confirmed At ISO 8601 Date String>
44
+ destination: <Payment Destination Hex String>
44
45
  fee: <Paid Routing Fee Rounded Down Tokens Number>
45
46
  fee_mtokens: <Paid Routing Fee in Millitokens String>
46
47
  id: <Payment Preimage Hash String>
@@ -65,6 +65,7 @@ const mtokensAsTokens = mtokens => safeTokens({mtokens}).tokens;
65
65
  @returns
66
66
  {
67
67
  confirmed_at: <Payment Confirmed At ISO 8601 Date String>
68
+ destination: <Payment Destination Public Key Hex String>
68
69
  fee: <Total Fee Tokens Paid Rounded Down Number>
69
70
  fee_mtokens: <Total Fee Millitokens Paid String>
70
71
  hops: [{
@@ -141,7 +142,10 @@ module.exports = payment => {
141
142
  const [confirmedAt] = successes.map(n => n.confirmed_at).sort().reverse();
142
143
  const [success] = successes;
143
144
 
145
+ const [destination] = success.route.hops.map(n => n.public_key).reverse();
146
+
144
147
  return {
148
+ destination,
145
149
  confirmed_at: confirmedAt,
146
150
  fee: safeTokens({mtokens: payment.fee_msat}).tokens,
147
151
  fee_mtokens: payment.fee_msat,
package/package.json CHANGED
@@ -56,5 +56,5 @@
56
56
  "directory": "test/typescript"
57
57
  },
58
58
  "types": "index.d.ts",
59
- "version": "4.5.0"
59
+ "version": "4.6.0"
60
60
  }
@@ -204,6 +204,7 @@ const tests = [
204
204
  description: 'A past payment is emitted',
205
205
  expected: {
206
206
  confirmed_at: '1970-01-01T00:00:00.000Z',
207
+ destination: '000000000000000000000000000000000000000000000000000000000000000000',
207
208
  fee: 1,
208
209
  fee_mtokens: '1000',
209
210
  hops: [
@@ -54,6 +54,7 @@ const makeArgs = overrides => {
54
54
  const makeExpected = overrides => {
55
55
  const expected = {
56
56
  confirmed_at: '1970-01-01T00:00:00.000Z',
57
+ destination: Buffer.alloc(33).toString('hex'),
57
58
  fee: 1,
58
59
  fee_mtokens: '1000',
59
60
  hops: [{