thunder-bridge 1.5.0 → 2.2.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/dist/index.d.cts CHANGED
@@ -1,16 +1,17 @@
1
1
  export { R as Resolved } from './qr-CF-YeXU1.cjs';
2
- import { T as ThunderBridge, b as ThunderBridgeOptions, W as WaitOptions } from './client-CzGZcByI.cjs';
3
- export { B as BankRailConfig, c as BlindLightningRailConfig, C as CreateOptions, F as FollowOptions, H as Handler, L as Leg, d as LightningRailConfig, e as LightningVerifyConfig, M as Minted, O as Order, P as PaymentRequest, f as PaymentRequestInit, g as PaymentRequestOptions, h as Provable, i as Proven, a as Rail, R as RailConfig, j as Rails, k as Range, l as Relayed, S as Send, m as Serve, n as TicketOptions, o as TriggerConfig, p as WatchTicketConfig, q as WebhookCredential, r as WebhookHandlers, s as WebhookOptions, t as WrapAllowance, u as answerVerifyChallenge, v as carriesProof, w as invoiceFrom, x as proveOrigin, y as proveSettlement, z as proveWrapped, A as relayedVerifyUrl, D as wrapFeeCeiling } from './client-CzGZcByI.cjs';
4
- import { H as Handover, P as Payment } from './types-BNPmVnA7.cjs';
5
- export { A as Amount, C as Charge, F as FiatOptions, e as MintedPayment, f as Msat, g as PaymentStatus, h as Priced, Q as Quote, S as Settlement, i as SocketTicket, W as WalletFailure, j as WalletReason, l as WatchedPayment, n as fiat, o as msat, s as sats } from './types-BNPmVnA7.cjs';
6
- export { b as BankVerifyConfig } from './bank-B3mHISn1.cjs';
7
- export { A as AmountError, a as AmountFault, G as GatewayCheatCode, b as GatewayCheatError, I as IdempotencyConflict, c as IdempotencyConflictError, N as NoWalletAvailableError, P as ProblemError, U as UnverifiedRecipientError, W as WrapRefusalCode, d as WrapRefusedError } from './errors-Dmh-Uoh8.cjs';
2
+ import { T as ThunderBridge, r as ThunderBridgeOptions, W as WaitOptions } from './bank-Bg6RjuO-.cjs';
3
+ export { A as AttendOptions, s as BankRailConfig, d as BankVerifyConfig, t as BlindLightningRailConfig, u as CreateOptions, F as FollowOptions, H as Handler, L as Leg, v as LightningRailConfig, w as LightningVerifyConfig, M as Minted, N as NwcConnection, h as NwcRailConfig, i as NwcVerifyConfig, O as Order, P as PaymentRequest, x as PaymentRequestInit, y as PaymentRequestOptions, z as Provable, D as Proven, R as Rail, E as RailConfig, G as Rails, I as Range, J as Relayed, K as SelfConsistent, Q as Send, U as Serve, V as TicketOptions, X as TriggerConfig, Y as WatchTicketConfig, Z as WebhookCredential, _ as WebhookHandlers, $ as WebhookOptions, a0 as WrapAllowance, a1 as agreesWithItself, a2 as answerVerifyChallenge, a3 as carriesProof, a4 as invoiceFrom, a5 as proveOrigin, a6 as proveSettlement, a7 as proveWrapped, a8 as relayedVerifyUrl, a9 as wrapFeeCeiling } from './bank-Bg6RjuO-.cjs';
4
+ import { H as Handover, P as Payment, e as Held } from './types-DYZ9EkmJ.cjs';
5
+ export { A as Amount, C as Charge, F as FiatOptions, f as MintedPayment, g as Msat, h as PaymentStatus, i as Priced, Q as Quote, S as Settlement, j as SocketTicket, W as WalletFailure, l as WalletReason, n as WatchedPayment, o as fiat, p as msat, s as sats } from './types-DYZ9EkmJ.cjs';
6
+ import { G as GatewayCheatError } from './errors-DJmsalYZ.cjs';
7
+ export { A as AmountError, a as AmountFault, b as GatewayCheatCode, I as IdempotencyConflict, c as IdempotencyConflictError, N as NoWalletAvailableError, P as ProblemError, U as UnverifiedRecipientError, W as WrapRefusalCode, d as WrapRefusedError } from './errors-DJmsalYZ.cjs';
8
8
 
9
9
  /** What a BOLT11 invoice says about itself, every field null when it does not carry one */
10
10
  interface Invoice {
11
11
  paymentHash: string | null;
12
12
  descriptionHash: string | null;
13
13
  amountMsat: number | null;
14
+ issuedAt: number | null;
14
15
  expiresAt: number | null;
15
16
  }
16
17
  /**
@@ -26,13 +27,13 @@ declare function preimageMatchesHash(preimage: string, paymentHash: string): boo
26
27
  * stores the result and hands it back untouched, so anything readable you put
27
28
  * in `sealed` is something you told it, which is what blind mode exists to avoid
28
29
  */
29
- declare function seal(secret: string, plaintext: string): Promise<string>;
30
+ declare function seal(secret: string, plaintext: string, paymentHash?: string): Promise<string>;
30
31
  /**
31
32
  * Read a sealed blob back, null when it was sealed with another secret, edited
32
33
  * on the way, or is not one of ours. A secret too short to be a key throws,
33
34
  * because that is your bug rather than someone else's input
34
35
  */
35
- declare function unseal(secret: string, sealed: string): Promise<string | null>;
36
+ declare function unseal(secret: string, sealed: string, paymentHash?: string): Promise<string | null>;
36
37
 
37
38
  /** The client's own options, plus what to do about a gateway that will not take the watch */
38
39
  interface GatewaysOptions extends ThunderBridgeOptions {
@@ -43,6 +44,13 @@ interface GatewaysOptions extends ThunderBridgeOptions {
43
44
  * than finding out when the one that took it goes away
44
45
  */
45
46
  onRefused?: (baseUrl: string, refusal: unknown) => void;
47
+ /**
48
+ * Called for a gateway caught lying about the payment while you waited on it,
49
+ * with its url and what gave it away. The wait goes on at the others, because
50
+ * one gateway that lies is what watching at several is for, so this is how you
51
+ * learn which one to stop trusting rather than never hearing of it
52
+ */
53
+ onCaught?: (baseUrl: string, cheat: GatewayCheatError) => void;
46
54
  }
47
55
  /**
48
56
  * The same payment watched at several gateways at once, which is what makes any
@@ -57,6 +65,7 @@ declare class Gateways {
57
65
  readonly each: readonly ThunderBridge[];
58
66
  private readonly urls;
59
67
  private readonly onRefused;
68
+ private readonly onCaught;
60
69
  constructor(baseUrls: string[], options?: GatewaysOptions);
61
70
  /** What this payment is called, which every gateway here will agree on */
62
71
  nameFor(paymentHash: string): Promise<string | null>;
@@ -72,7 +81,7 @@ declare class Gateways {
72
81
  * saying so. When they all end without a payment, the first ending is the answer,
73
82
  * and when they all fail, the first failure is thrown
74
83
  */
75
- settled(id: string, options?: WaitOptions): Promise<Payment>;
84
+ settled(held: Held, options?: WaitOptions): Promise<Payment>;
76
85
  }
77
86
 
78
- export { Gateways, type GatewaysOptions, Handover, type Invoice, Payment, ThunderBridge, ThunderBridgeOptions, WaitOptions, decodeInvoice, preimageMatchesHash, seal, unseal };
87
+ export { GatewayCheatError, Gateways, type GatewaysOptions, Handover, Held, type Invoice, Payment, ThunderBridge, ThunderBridgeOptions, WaitOptions, decodeInvoice, preimageMatchesHash, seal, unseal };
package/dist/index.d.ts CHANGED
@@ -1,16 +1,17 @@
1
1
  export { R as Resolved } from './qr-CF-YeXU1.js';
2
- import { T as ThunderBridge, b as ThunderBridgeOptions, W as WaitOptions } from './client-Cc5gtjGV.js';
3
- export { B as BankRailConfig, c as BlindLightningRailConfig, C as CreateOptions, F as FollowOptions, H as Handler, L as Leg, d as LightningRailConfig, e as LightningVerifyConfig, M as Minted, O as Order, P as PaymentRequest, f as PaymentRequestInit, g as PaymentRequestOptions, h as Provable, i as Proven, a as Rail, R as RailConfig, j as Rails, k as Range, l as Relayed, S as Send, m as Serve, n as TicketOptions, o as TriggerConfig, p as WatchTicketConfig, q as WebhookCredential, r as WebhookHandlers, s as WebhookOptions, t as WrapAllowance, u as answerVerifyChallenge, v as carriesProof, w as invoiceFrom, x as proveOrigin, y as proveSettlement, z as proveWrapped, A as relayedVerifyUrl, D as wrapFeeCeiling } from './client-Cc5gtjGV.js';
4
- import { H as Handover, P as Payment } from './types-BNPmVnA7.js';
5
- export { A as Amount, C as Charge, F as FiatOptions, e as MintedPayment, f as Msat, g as PaymentStatus, h as Priced, Q as Quote, S as Settlement, i as SocketTicket, W as WalletFailure, j as WalletReason, l as WatchedPayment, n as fiat, o as msat, s as sats } from './types-BNPmVnA7.js';
6
- export { b as BankVerifyConfig } from './bank-B3mHISn1.js';
7
- export { A as AmountError, a as AmountFault, G as GatewayCheatCode, b as GatewayCheatError, I as IdempotencyConflict, c as IdempotencyConflictError, N as NoWalletAvailableError, P as ProblemError, U as UnverifiedRecipientError, W as WrapRefusalCode, d as WrapRefusedError } from './errors-0vbVoISA.js';
2
+ import { T as ThunderBridge, r as ThunderBridgeOptions, W as WaitOptions } from './bank-B5MxT_6u.js';
3
+ export { A as AttendOptions, s as BankRailConfig, d as BankVerifyConfig, t as BlindLightningRailConfig, u as CreateOptions, F as FollowOptions, H as Handler, L as Leg, v as LightningRailConfig, w as LightningVerifyConfig, M as Minted, N as NwcConnection, h as NwcRailConfig, i as NwcVerifyConfig, O as Order, P as PaymentRequest, x as PaymentRequestInit, y as PaymentRequestOptions, z as Provable, D as Proven, R as Rail, E as RailConfig, G as Rails, I as Range, J as Relayed, K as SelfConsistent, Q as Send, U as Serve, V as TicketOptions, X as TriggerConfig, Y as WatchTicketConfig, Z as WebhookCredential, _ as WebhookHandlers, $ as WebhookOptions, a0 as WrapAllowance, a1 as agreesWithItself, a2 as answerVerifyChallenge, a3 as carriesProof, a4 as invoiceFrom, a5 as proveOrigin, a6 as proveSettlement, a7 as proveWrapped, a8 as relayedVerifyUrl, a9 as wrapFeeCeiling } from './bank-B5MxT_6u.js';
4
+ import { H as Handover, P as Payment, e as Held } from './types-DYZ9EkmJ.js';
5
+ export { A as Amount, C as Charge, F as FiatOptions, f as MintedPayment, g as Msat, h as PaymentStatus, i as Priced, Q as Quote, S as Settlement, j as SocketTicket, W as WalletFailure, l as WalletReason, n as WatchedPayment, o as fiat, p as msat, s as sats } from './types-DYZ9EkmJ.js';
6
+ import { G as GatewayCheatError } from './errors-VX0R18oE.js';
7
+ export { A as AmountError, a as AmountFault, b as GatewayCheatCode, I as IdempotencyConflict, c as IdempotencyConflictError, N as NoWalletAvailableError, P as ProblemError, U as UnverifiedRecipientError, W as WrapRefusalCode, d as WrapRefusedError } from './errors-VX0R18oE.js';
8
8
 
9
9
  /** What a BOLT11 invoice says about itself, every field null when it does not carry one */
10
10
  interface Invoice {
11
11
  paymentHash: string | null;
12
12
  descriptionHash: string | null;
13
13
  amountMsat: number | null;
14
+ issuedAt: number | null;
14
15
  expiresAt: number | null;
15
16
  }
16
17
  /**
@@ -26,13 +27,13 @@ declare function preimageMatchesHash(preimage: string, paymentHash: string): boo
26
27
  * stores the result and hands it back untouched, so anything readable you put
27
28
  * in `sealed` is something you told it, which is what blind mode exists to avoid
28
29
  */
29
- declare function seal(secret: string, plaintext: string): Promise<string>;
30
+ declare function seal(secret: string, plaintext: string, paymentHash?: string): Promise<string>;
30
31
  /**
31
32
  * Read a sealed blob back, null when it was sealed with another secret, edited
32
33
  * on the way, or is not one of ours. A secret too short to be a key throws,
33
34
  * because that is your bug rather than someone else's input
34
35
  */
35
- declare function unseal(secret: string, sealed: string): Promise<string | null>;
36
+ declare function unseal(secret: string, sealed: string, paymentHash?: string): Promise<string | null>;
36
37
 
37
38
  /** The client's own options, plus what to do about a gateway that will not take the watch */
38
39
  interface GatewaysOptions extends ThunderBridgeOptions {
@@ -43,6 +44,13 @@ interface GatewaysOptions extends ThunderBridgeOptions {
43
44
  * than finding out when the one that took it goes away
44
45
  */
45
46
  onRefused?: (baseUrl: string, refusal: unknown) => void;
47
+ /**
48
+ * Called for a gateway caught lying about the payment while you waited on it,
49
+ * with its url and what gave it away. The wait goes on at the others, because
50
+ * one gateway that lies is what watching at several is for, so this is how you
51
+ * learn which one to stop trusting rather than never hearing of it
52
+ */
53
+ onCaught?: (baseUrl: string, cheat: GatewayCheatError) => void;
46
54
  }
47
55
  /**
48
56
  * The same payment watched at several gateways at once, which is what makes any
@@ -57,6 +65,7 @@ declare class Gateways {
57
65
  readonly each: readonly ThunderBridge[];
58
66
  private readonly urls;
59
67
  private readonly onRefused;
68
+ private readonly onCaught;
60
69
  constructor(baseUrls: string[], options?: GatewaysOptions);
61
70
  /** What this payment is called, which every gateway here will agree on */
62
71
  nameFor(paymentHash: string): Promise<string | null>;
@@ -72,7 +81,7 @@ declare class Gateways {
72
81
  * saying so. When they all end without a payment, the first ending is the answer,
73
82
  * and when they all fail, the first failure is thrown
74
83
  */
75
- settled(id: string, options?: WaitOptions): Promise<Payment>;
84
+ settled(held: Held, options?: WaitOptions): Promise<Payment>;
76
85
  }
77
86
 
78
- export { Gateways, type GatewaysOptions, Handover, type Invoice, Payment, ThunderBridge, ThunderBridgeOptions, WaitOptions, decodeInvoice, preimageMatchesHash, seal, unseal };
87
+ export { GatewayCheatError, Gateways, type GatewaysOptions, Handover, Held, type Invoice, Payment, ThunderBridge, ThunderBridgeOptions, WaitOptions, decodeInvoice, preimageMatchesHash, seal, unseal };