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/README.md +49 -24
- package/dist/{client-Cc5gtjGV.d.ts → bank-B5MxT_6u.d.ts} +367 -42
- package/dist/{client-CzGZcByI.d.cts → bank-Bg6RjuO-.d.cts} +367 -42
- package/dist/bank.cjs +196 -0
- package/dist/bank.d.cts +4 -2
- package/dist/bank.d.ts +4 -2
- package/dist/bank.js +195 -0
- package/dist/{errors-Dmh-Uoh8.d.cts → errors-DJmsalYZ.d.cts} +3 -3
- package/dist/{errors-0vbVoISA.d.ts → errors-VX0R18oE.d.ts} +3 -3
- package/dist/index.cjs +1313 -395
- package/dist/index.d.cts +19 -10
- package/dist/index.d.ts +19 -10
- package/dist/index.js +1312 -395
- package/dist/nwc.cjs +183 -42
- package/dist/nwc.d.cts +10 -111
- package/dist/nwc.d.ts +10 -111
- package/dist/nwc.js +180 -39
- package/dist/price.d.cts +2 -2
- package/dist/price.d.ts +2 -2
- package/dist/qr.cjs +20 -23
- package/dist/qr.js +20 -23
- package/dist/{types-BNPmVnA7.d.cts → types-DYZ9EkmJ.d.cts} +11 -2
- package/dist/{types-BNPmVnA7.d.ts → types-DYZ9EkmJ.d.ts} +11 -2
- package/openapi.yaml +30 -40
- package/package.json +1 -1
- package/dist/bank-B3mHISn1.d.cts +0 -92
- package/dist/bank-B3mHISn1.d.ts +0 -92
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,
|
|
3
|
-
export {
|
|
4
|
-
import { H as Handover, P as Payment } from './types-
|
|
5
|
-
export { A as Amount, C as Charge, F as FiatOptions,
|
|
6
|
-
|
|
7
|
-
export { A as AmountError, a as AmountFault,
|
|
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(
|
|
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,
|
|
3
|
-
export {
|
|
4
|
-
import { H as Handover, P as Payment } from './types-
|
|
5
|
-
export { A as Amount, C as Charge, F as FiatOptions,
|
|
6
|
-
|
|
7
|
-
export { A as AmountError, a as AmountFault,
|
|
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(
|
|
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 };
|