@breeztech/breez-sdk-spark 0.27.2 → 0.28.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.
Files changed (55) hide show
  1. package/README.md +9 -8
  2. package/bundler/breez_sdk_spark_wasm.d.ts +141 -16
  3. package/bundler/breez_sdk_spark_wasm.js +1 -1
  4. package/bundler/breez_sdk_spark_wasm_bg.js +190 -40
  5. package/bundler/breez_sdk_spark_wasm_bg.wasm +0 -0
  6. package/bundler/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  7. package/bundler/index.js +6 -13
  8. package/bundler/storage/index.js +89 -17
  9. package/deno/breez_sdk_spark_wasm.d.ts +141 -16
  10. package/deno/breez_sdk_spark_wasm.js +190 -40
  11. package/deno/breez_sdk_spark_wasm_bg.wasm +0 -0
  12. package/deno/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  13. package/nodejs/breez_sdk_spark_wasm.d.ts +141 -16
  14. package/nodejs/breez_sdk_spark_wasm.js +194 -40
  15. package/nodejs/breez_sdk_spark_wasm_bg.wasm +0 -0
  16. package/nodejs/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  17. package/nodejs/index.d.mts +3 -0
  18. package/nodejs/index.js +30 -120
  19. package/nodejs/index.mjs +4 -0
  20. package/nodejs/mysql-session-store/index.cjs +24 -7
  21. package/nodejs/mysql-session-store/migrations.cjs +6 -0
  22. package/nodejs/mysql-storage/index.cjs +36 -19
  23. package/nodejs/mysql-storage/migrations.cjs +24 -9
  24. package/nodejs/mysql-token-store/index.cjs +28 -18
  25. package/nodejs/postgres-session-store/index.cjs +25 -7
  26. package/nodejs/postgres-session-store/migrations.cjs +12 -9
  27. package/nodejs/postgres-storage/index.cjs +36 -19
  28. package/nodejs/postgres-storage/migrations.cjs +24 -9
  29. package/nodejs/postgres-token-store/index.cjs +32 -18
  30. package/nodejs/postgres-token-store/migrations.cjs +5 -9
  31. package/nodejs/postgres-tree-store/migrations.cjs +5 -9
  32. package/nodejs/storage/index.cjs +35 -14
  33. package/nodejs/storage/migrations.cjs +25 -15
  34. package/nodejs/tree-store/index.cjs +1 -1
  35. package/nodejs/tree-store/migrations.cjs +6 -13
  36. package/package.json +27 -6
  37. package/ssr/index.js +24 -0
  38. package/web/breez_sdk_spark_wasm.d.ts +164 -27
  39. package/web/breez_sdk_spark_wasm.js +190 -40
  40. package/web/breez_sdk_spark_wasm_bg.wasm +0 -0
  41. package/web/breez_sdk_spark_wasm_bg.wasm.d.ts +23 -11
  42. package/web/index.js +6 -13
  43. package/web/passkey-prf-provider/index.js +1 -0
  44. package/web/storage/index.js +89 -17
  45. package/breez-sdk-spark.tgz +0 -0
  46. package/itest/.gitignore +0 -2
  47. package/itest/database-drivers.test.js +0 -45
  48. package/itest/helpers/assert.test.js +0 -70
  49. package/itest/helpers/faucet.js +0 -68
  50. package/itest/helpers/lnurl-fixture.js +0 -229
  51. package/itest/helpers/scenario.js +0 -444
  52. package/itest/package-lock.json +0 -519
  53. package/itest/package.json +0 -18
  54. package/itest/scenarios.test.js +0 -47
  55. package/itest/smoke.test.js +0 -184
package/README.md CHANGED
@@ -1,12 +1,13 @@
1
- # Breez SDK - Spark
1
+ # Breez SDK
2
2
 
3
- ## **What is the Breez SDK?**
3
+ ## **Overview**
4
+
5
+ The Breez SDK provides developers with an end-to-end solution for integrating instant, non-custodial bitcoin and stablecoins into their apps and services. It eliminates the need for third parties, simplifies the complexities of Bitcoin and Lightning, and enables seamless onboarding for billions of users to the future of value transfer.
4
6
 
5
- The Breez SDK provides developers with an end-to-end solution for integrating self-custodial Lightning into their apps and services. It eliminates the need for third parties, simplifies the complexities of Bitcoin and Lightning, and enables seamless onboarding for billions of users to the future of value transfer.
7
+ ## **What is the Breez SDK?**
6
8
 
7
- ## **What is the Breez SDK - Spark?**
9
+ It’s a nodeless integration that offers a non-custodial, end-to-end solution for integrating bitcoin and stablecoins, utilizing the Bitcoin-native Layer 2 Lightning & Spark, with on-chain interoperability and third-party fiat on-ramps.
8
10
 
9
- It’s a nodeless integration that offers a self-custodial, end-to-end solution for integrating Lightning payments, utilizing Spark with on-chain interoperability and third-party fiat on-ramps.
10
11
 
11
12
  ## Installation
12
13
 
@@ -24,7 +25,7 @@ yarn add @breeztech/breez-sdk-spark
24
25
 
25
26
  ## Usage
26
27
 
27
- Head over to the Breez SDK - Spark [documentation](https://sdk-doc-spark.breez.technology/) to start implementing Lightning in your app.
28
+ Head over to the Breez SDK [documentation](https://docs.breez.technology/) to start implementing instant bitcoin and stablecoins in your app or service.
28
29
 
29
30
  ### Web
30
31
 
@@ -84,7 +85,7 @@ export default function Wallet() {
84
85
 
85
86
  > **Note**: This package requires Node.js v22 or higher.
86
87
 
87
- When developing a Node.js application, use `require("@breeztech/breez-sdk-spark")` (or the explicit `@breeztech/breez-sdk-spark/nodejs` subpath). No `init()` call is needed — the WASM module loads automatically.
88
+ When developing a Node.js application, use `require("@breeztech/breez-sdk-spark")` or `import` from it (or the explicit `@breeztech/breez-sdk-spark/nodejs` subpath). No `init()` call is needed: the WASM module loads automatically.
88
89
 
89
90
  ```js
90
91
  const {
@@ -111,7 +112,7 @@ console.log(`Balance: ${info.balanceSats} sats`);
111
112
  |---------|-------------|---------------|
112
113
  | `@breeztech/breez-sdk-spark` | Node.js / Browser (default) | CJS / ESM |
113
114
  | `@breeztech/breez-sdk-spark/web` | Browser | ESM |
114
- | `@breeztech/breez-sdk-spark/nodejs` | Node.js | CJS |
115
+ | `@breeztech/breez-sdk-spark/nodejs` | Node.js | CJS / ESM |
115
116
  | `@breeztech/breez-sdk-spark/bundler` | Bundler (Webpack, Vite) | ESM |
116
117
  | `@breeztech/breez-sdk-spark/deno` | Deno | ESM |
117
118
  | `@breeztech/breez-sdk-spark/ssr` | SSR (explicit) | ESM |
@@ -1,3 +1,8 @@
1
+ declare global {
2
+ interface SymbolConstructor {
3
+ readonly dispose: unique symbol;
4
+ }
5
+ }
1
6
  /* tslint:disable */
2
7
  /* eslint-disable */
3
8
  /**
@@ -674,6 +679,21 @@ export interface BridgeFromCashAppResponse {
674
679
  expiresAt: number;
675
680
  }
676
681
 
682
+ export interface BridgeRoutePair {
683
+ provider: CrossChainProvider;
684
+ source: BridgeRoutePairSide;
685
+ destination: BridgeRoutePairSide;
686
+ limits?: CrossChainRouteLimits;
687
+ }
688
+
689
+ export interface BridgeRoutePairSide {
690
+ chain: string;
691
+ chainId?: string;
692
+ asset: string;
693
+ contractAddress?: string;
694
+ decimals: number;
695
+ }
696
+
677
697
  export interface BridgeToCashAppRequest {
678
698
  recipient: string;
679
699
  route: CrossChainRoutePair;
@@ -688,6 +708,15 @@ export interface BridgeToCashAppResponse {
688
708
  info: CrossChainReceiveInfo;
689
709
  }
690
710
 
711
+ export interface BridgingConfig {
712
+ apiKey: string;
713
+ /**
714
+ * Not supported on WASM: setting this always fails validation.
715
+ */
716
+ proxy?: ProxyConfig;
717
+ crossChainConfig?: CrossChainConfig;
718
+ }
719
+
691
720
  export interface BuildUnsignedBatchPackageRequest {
692
721
  prepareResponse: PrepareSendBatchResponse;
693
722
  }
@@ -879,6 +908,22 @@ export interface CpfpSigner {
879
908
  signPsbt(psbtBytes: Uint8Array): Promise<Uint8Array>;
880
909
  }
881
910
 
911
+ export interface CreateBridgeRequest {
912
+ recipient: string;
913
+ route: BridgeRoutePair;
914
+ amount: bigint;
915
+ refundAddress?: string;
916
+ feePolicy?: FeePolicy;
917
+ maxSlippageBps?: number;
918
+ }
919
+
920
+ export interface CreateBridgeResponse {
921
+ bridgeId: string;
922
+ statusToken?: string;
923
+ paymentRequest: string;
924
+ info: CrossChainReceiveInfo;
925
+ }
926
+
882
927
  export interface CreateIssuerTokenRequest {
883
928
  name: string;
884
929
  ticker: string;
@@ -924,6 +969,7 @@ export interface CrossChainConfig {
924
969
  }
925
970
 
926
971
  export interface CrossChainReceiveInfo {
972
+ quoteId: string;
927
973
  depositAddress: string;
928
974
  depositAmount: bigint;
929
975
  expectedReceivedAmount: bigint;
@@ -1276,6 +1322,31 @@ export interface FreezeIssuerTokenResponse {
1276
1322
  impactedTokenAmount: bigint;
1277
1323
  }
1278
1324
 
1325
+ export interface GetBridgeRoutesRequest {
1326
+ recipient: string;
1327
+ }
1328
+
1329
+ export interface GetBridgeRoutesResponse {
1330
+ routes: BridgeRoutePair[];
1331
+ }
1332
+
1333
+ export interface GetBridgeStatusRequest {
1334
+ bridgeId: string;
1335
+ statusToken?: string;
1336
+ }
1337
+
1338
+ export interface GetBridgeStatusResponse {
1339
+ status: BridgeStatus;
1340
+ providerStatus?: string;
1341
+ orderId?: string;
1342
+ amountIn?: bigint;
1343
+ amountOut?: bigint;
1344
+ depositTxHash?: string;
1345
+ deliveryTxHash?: string;
1346
+ refundTxHash?: string;
1347
+ errorCode?: string;
1348
+ }
1349
+
1279
1350
  export interface GetInfoRequest {
1280
1351
  ensureSynced?: boolean;
1281
1352
  }
@@ -1285,6 +1356,8 @@ export interface GetInfoResponse {
1285
1356
  balanceSats: number;
1286
1357
  tokenBalances: Map<string, TokenBalance>;
1287
1358
  recoverableFundsSats: number;
1359
+ lastSyncError?: SyncError;
1360
+ lastSyncedAt?: number;
1288
1361
  }
1289
1362
 
1290
1363
  export interface GetPaymentRequest {
@@ -1470,6 +1543,7 @@ export interface LnurlReceiveMetadata {
1470
1543
  nostrZapRequest?: string;
1471
1544
  nostrZapReceipt?: string;
1472
1545
  senderComment?: string;
1546
+ lightningAddress?: string;
1473
1547
  }
1474
1548
 
1475
1549
  export interface LnurlWithdrawInfo {
@@ -1653,6 +1727,7 @@ export interface PreparePullPaymentResponse {
1653
1727
  export interface PrepareRecoverFundsRequest {
1654
1728
  feeRateSatPerVbyte: number;
1655
1729
  fundingKind?: CpfpFundingKind;
1730
+ fundingStrategy?: CpfpFundingStrategy;
1656
1731
  destination: string;
1657
1732
  selection: ExitLeafSelection;
1658
1733
  }
@@ -1818,6 +1893,7 @@ export interface RecoverableEcdsaSignatureBytes {
1818
1893
  export interface RecoveryFunding {
1819
1894
  singleUtxoSats: number;
1820
1895
  perBranch: PerBranchFunding[];
1896
+ strategy?: CpfpFundingStrategy;
1821
1897
  }
1822
1898
 
1823
1899
  export interface RecoveryTransaction {
@@ -1871,9 +1947,9 @@ export interface ResolvedBatchRecipient {
1871
1947
  }
1872
1948
 
1873
1949
  export interface RestClient {
1874
- getRequest(url: string, headers?: Record<string, string>): Promise<RestResponse>;
1875
- postRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
1876
- deleteRequest(url: string, headers?: Record<string, string>, body?: string): Promise<RestResponse>;
1950
+ getRequest(url: string, headers?: { [key: string]: string }): Promise<RestResponse>;
1951
+ postRequest(url: string, headers?: { [key: string]: string }, body?: string): Promise<RestResponse>;
1952
+ deleteRequest(url: string, headers?: { [key: string]: string }, body?: string): Promise<RestResponse>;
1877
1953
  }
1878
1954
 
1879
1955
  export interface RestResponse {
@@ -1928,6 +2004,8 @@ export interface SendPaymentResponse {
1928
2004
  export interface Session {
1929
2005
  token: string;
1930
2006
  expiration: number;
2007
+ refreshToken?: string;
2008
+ refreshTokenExpiration?: number;
1931
2009
  }
1932
2010
 
1933
2011
  export interface SessionStore {
@@ -1940,6 +2018,7 @@ export interface SetLnurlMetadataItem {
1940
2018
  senderComment?: string;
1941
2019
  nostrZapRequest?: string;
1942
2020
  nostrZapReceipt?: string;
2021
+ lightningAddress?: string;
1943
2022
  }
1944
2023
 
1945
2024
  export interface SignMessageRequest {
@@ -1957,12 +2036,6 @@ export interface SignedTransferPackage {
1957
2036
  signature: TransferSignature;
1958
2037
  }
1959
2038
 
1960
- export interface SilentPaymentAddressDetails {
1961
- address: string;
1962
- network: BitcoinNetwork;
1963
- source: PaymentRequestSource;
1964
- }
1965
-
1966
2039
  export interface SkippedLeaf {
1967
2040
  leafId: string;
1968
2041
  valueSats: number;
@@ -2071,7 +2144,7 @@ export interface Storage {
2071
2144
  listLeafRecoveries: () => Promise<LeafRecovery[]>;
2072
2145
  updateLeafRecovery: (update: UpdateLeafRecovery) => Promise<void>;
2073
2146
  setLnurlMetadata: (metadata: SetLnurlMetadataItem[]) => Promise<void>;
2074
- getPaymentsByParentIds: (parentPaymentIds: string[]) => Promise<{ [parentId: string]: RelatedPayment[] }>;
2147
+ getPaymentsByParentIds: (parentPaymentIds: string[]) => Promise<{ [parentId: string]: Payment[] }>;
2075
2148
  listContacts: (request: ListContactsRequest) => Promise<Contact[]>;
2076
2149
  getContact: (id: string) => Promise<Contact>;
2077
2150
  insertContact: (contact: Contact) => Promise<void>;
@@ -2128,7 +2201,10 @@ export interface Symbol {
2128
2201
 
2129
2202
  export interface SyncWalletRequest {}
2130
2203
 
2131
- export interface SyncWalletResponse {}
2204
+ export interface SyncWalletResponse {
2205
+ lastSyncError?: SyncError;
2206
+ lastSyncedAt?: number;
2207
+ }
2132
2208
 
2133
2209
  export interface TokenAllowance {
2134
2210
  id: string;
@@ -2296,6 +2372,8 @@ export type BatchDestination = { type: "sparkAddress"; address: string } | { typ
2296
2372
 
2297
2373
  export type BitcoinNetwork = "bitcoin" | "testnet3" | "testnet4" | "signet" | "regtest";
2298
2374
 
2375
+ export type BridgeStatus = "created" | "pending" | "refunding" | "completed" | "refunded" | "failed" | "expired";
2376
+
2299
2377
  export type BuildTransferPackageOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number };
2300
2378
 
2301
2379
  export type BuyBitcoinRequest = { type: "moonpay"; delivery?: MoonpayDelivery; redirectUrl?: string } | { type: "cashApp"; amountSats: number };
@@ -2324,6 +2402,8 @@ export type CooperativeRecoveryError = { type: "replacementFeeTooLow"; requiredF
2324
2402
 
2325
2403
  export type CpfpFundingKind = { type: "p2wpkh" } | { type: "p2tr" } | { type: "custom"; scriptPubkeyHex: string; signedInputWeight: number };
2326
2404
 
2405
+ export type CpfpFundingStrategy = "perBranch" | "perNode";
2406
+
2327
2407
  export type CpfpInput = { type: "p2wpkh"; txid: string; vout: number; valueSats: number; pubkey: string } | { type: "p2tr"; txid: string; vout: number; valueSats: number; pubkey: string } | { type: "custom"; txid: string; vout: number; valueSats: number; scriptPubkeyHex: string; signedInputWeight: number };
2328
2408
 
2329
2409
  export type CrossChainAddressFamily = "evm" | "solana" | "tron";
@@ -2358,7 +2438,7 @@ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyt
2358
2438
 
2359
2439
  export type FeePolicy = "feesExcluded" | "feesIncluded";
2360
2440
 
2361
- export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & SilentPaymentAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails) | ({ type: "crossChainAddress" } & CrossChainAddressDetails);
2441
+ export type InputType = ({ type: "bitcoinAddress" } & BitcoinAddressDetails) | ({ type: "bolt11Invoice" } & Bolt11InvoiceDetails) | ({ type: "bolt12Invoice" } & Bolt12InvoiceDetails) | ({ type: "bolt12Offer" } & Bolt12OfferDetails) | ({ type: "lightningAddress" } & LightningAddressDetails) | ({ type: "lnurlPay" } & LnurlPayRequestDetails) | ({ type: "silentPaymentAddress" } & BitcoinAddressDetails) | ({ type: "lnurlAuth" } & LnurlAuthRequestDetails) | ({ type: "url" } & string) | ({ type: "bip21" } & Bip21Details) | ({ type: "bolt12InvoiceRequest" } & Bolt12InvoiceRequestDetails) | ({ type: "lnurlWithdraw" } & LnurlWithdrawRequestDetails) | ({ type: "sparkAddress" } & SparkAddressDetails) | ({ type: "sparkInvoice" } & SparkInvoiceDetails) | ({ type: "crossChainAddress" } & CrossChainAddressDetails);
2362
2442
 
2363
2443
  export type InstantClaimStatus = { type: "declined"; maxFeeSats?: number; confirmations?: number } | { type: "submitted"; claimId: string } | { type: "claimed" };
2364
2444
 
@@ -2378,7 +2458,7 @@ export type OptimizationOutcome = { type: "completed"; roundsExecuted: number }
2378
2458
 
2379
2459
  export type Outspend = { type: "unspent" } | { type: "spent"; txid: string; vin: number; status: TxStatus };
2380
2460
 
2381
- export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata; conversionInfo?: ConversionInfo } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string; vout: number };
2461
+ export type PaymentDetails = { type: "spark"; invoiceDetails?: SparkInvoicePaymentDetails; htlcDetails?: SparkHtlcDetails; conversionInfo?: ConversionInfo } | { type: "token"; metadata: TokenMetadata; txHash: string; txType: TokenTransactionType; invoiceDetails?: SparkInvoicePaymentDetails; conversionInfo?: ConversionInfo } | { type: "lightning"; description?: string; invoice: string; destinationPubkey: string; htlcDetails: SparkHtlcDetails; lnurlPayInfo?: LnurlPayInfo; lnurlWithdrawInfo?: LnurlWithdrawInfo; lnurlReceiveMetadata?: LnurlReceiveMetadata; conversionInfo?: ConversionInfo } | { type: "withdraw"; txId: string; vout: number; destinationAddress: string } | { type: "deposit"; txId: string; vout: number };
2382
2462
 
2383
2463
  export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
2384
2464
 
@@ -2396,7 +2476,7 @@ export type PublishSignedLnurlPayResponse = { type: "swapCompleted" } | { type:
2396
2476
 
2397
2477
  export type PublishSignedTransferPackageResponse = { type: "swapCompleted" } | { type: "paymentSent"; payment: Payment } | { type: "paymentsSent"; payments: Payment[] };
2398
2478
 
2399
- export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: bigint; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string; receiverIdentityPublicKey?: string } | { type: "crossChain"; route: CrossChainRoutePair; amount: bigint; destination?: SparkAsset; feeMode?: CrossChainFeeMode; maxSlippageBps?: number; targetOverpayBps?: number };
2479
+ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: bigint; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string; receiverIdentityPublicKey?: string; preimage?: string } | { type: "crossChain"; route: CrossChainRoutePair; amount: bigint; destination?: SparkAsset; feeMode?: CrossChainFeeMode; maxSlippageBps?: number; targetOverpayBps?: number };
2400
2480
 
2401
2481
  export type RecoveryMethod = "cooperative" | "unilateral";
2402
2482
 
@@ -2420,7 +2500,7 @@ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" |
2420
2500
 
2421
2501
  export type SessionStoreError = { type: "notFound" } | ({ type: "generic" } & string);
2422
2502
 
2423
- export type SkippedLeafReason = { type: "feeExceedsValue" } | { type: "fundsNotFound" } | { type: "unverified" } | { type: "notRecoverable"; message: string };
2503
+ export type SkippedLeafReason = { type: "feeExceedsValue" } | { type: "fundsNotFound" } | { type: "unverified" } | { type: "operatorsUnavailable" } | { type: "notRecoverable"; message: string };
2424
2504
 
2425
2505
  export type SparkAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier: string };
2426
2506
 
@@ -2440,6 +2520,8 @@ export type SuccessActionProcessed = { type: "aes"; result: AesSuccessActionData
2440
2520
 
2441
2521
  export type SwapDegradation = "belowMinimum" | "unexpectedAsset" | "missingInfo";
2442
2522
 
2523
+ export type SyncError = { type: "network"; message: string } | { type: "generic"; message: string };
2524
+
2443
2525
  export type TokenAllowanceLimit = { type: "unlimited" } | { type: "amount"; amount: bigint };
2444
2526
 
2445
2527
  export type TokenAllowanceRole = "owner" | "spender";
@@ -2490,7 +2572,13 @@ export class BreezSdk {
2490
2572
  addContact(request: AddContactRequest): Promise<Contact>;
2491
2573
  addEventListener(listener: EventListener): Promise<string>;
2492
2574
  authorizeLightningAddressTransfer(request: AuthorizeTransferRequest): Promise<TransferAuthorization>;
2575
+ /**
2576
+ * @deprecated Use `bridgeFromCashApp` on the client from `getBridgingClient`.
2577
+ */
2493
2578
  bridgeFromCashApp(request: BridgeFromCashAppRequest): Promise<BridgeFromCashAppResponse>;
2579
+ /**
2580
+ * @deprecated Use `bridgeToCashApp` on the client from `getBridgingClient`.
2581
+ */
2494
2582
  bridgeToCashApp(request: BridgeToCashAppRequest): Promise<BridgeToCashAppResponse>;
2495
2583
  buildUnsignedBatchPackage(request: BuildUnsignedBatchPackageRequest): Promise<UnsignedTransferPackage>;
2496
2584
  buildUnsignedLnurlPayPackage(request: BuildUnsignedLnurlPayPackageRequest): Promise<UnsignedTransferPackage>;
@@ -2510,6 +2598,7 @@ export class BreezSdk {
2510
2598
  exportUnilateralExitState(): Promise<ExportUnilateralExitStateResponse>;
2511
2599
  fetchClaimDepositQuote(request: FetchClaimDepositQuoteRequest): Promise<FetchClaimDepositQuoteResponse>;
2512
2600
  fetchConversionLimits(request: FetchConversionLimitsRequest): Promise<FetchConversionLimitsResponse>;
2601
+ getBridgingClient(): BridgingClient;
2513
2602
  getCrossChainRoutes(filter: CrossChainRouteFilter): Promise<CrossChainRoutePair[]>;
2514
2603
  getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
2515
2604
  getLightningAddress(): Promise<LightningAddressInfo | undefined>;
@@ -2532,7 +2621,7 @@ export class BreezSdk {
2532
2621
  parse(input: string): Promise<InputType>;
2533
2622
  prepareLnurlPay(request: PrepareLnurlPayRequest): Promise<PrepareLnurlPayResponse>;
2534
2623
  /**
2535
- * @deprecated Use `bridgeFromCashApp`.
2624
+ * @deprecated Use `bridgeFromCashApp` on the client from `getBridgingClient`.
2536
2625
  */
2537
2626
  preparePaymentLink(request: PreparePaymentLinkRequest): Promise<PreparePaymentLinkResponse>;
2538
2627
  preparePullPayment(request: PreparePullPaymentRequest): Promise<PreparePullPaymentResponse>;
@@ -2561,6 +2650,32 @@ export class BreezSdk {
2561
2650
  updateUserSettings(request: UpdateUserSettingsRequest): Promise<void>;
2562
2651
  }
2563
2652
 
2653
+ /**
2654
+ * Creates bridges: orders that pay a recipient from another chain or over
2655
+ * Lightning, with no funds moving through the SDK. Only available on mainnet.
2656
+ */
2657
+ export class BridgingClient {
2658
+ private constructor();
2659
+ free(): void;
2660
+ [Symbol.dispose](): void;
2661
+ bridgeFromCashApp(request: CreateBridgeRequest): Promise<CreateBridgeResponse>;
2662
+ bridgeToCashApp(request: CreateBridgeRequest): Promise<CreateBridgeResponse>;
2663
+ createBridge(request: CreateBridgeRequest): Promise<CreateBridgeResponse>;
2664
+ getBridgeStatus(request: GetBridgeStatusRequest): Promise<GetBridgeStatusResponse>;
2665
+ getRoutes(request: GetBridgeRoutesRequest): Promise<GetBridgeRoutesResponse>;
2666
+ }
2667
+
2668
+ /**
2669
+ * A logger that prints each log entry to the JavaScript console, with the console method that
2670
+ * matches the entry's level.
2671
+ */
2672
+ export class ConsoleLogger {
2673
+ free(): void;
2674
+ [Symbol.dispose](): void;
2675
+ log(entry: LogEntry): void;
2676
+ constructor();
2677
+ }
2678
+
2564
2679
  /**
2565
2680
  * A CPFP signer matching the `CpfpSigner` TypeScript interface.
2566
2681
  */
@@ -2917,6 +3032,11 @@ export function createTurnkeySigner(config: TurnkeyConfig): Promise<ExternalSign
2917
3032
  */
2918
3033
  export function createTurnkeySigningOnlySigner(config: TurnkeyConfig): Promise<SigningOnlyExternalSigners>;
2919
3034
 
3035
+ /**
3036
+ * Settings for `newBridgingClient` with every optional field unset.
3037
+ */
3038
+ export function defaultBridgingConfig(api_key: string): BridgingConfig;
3039
+
2920
3040
  export function defaultConfig(network: Network): Config;
2921
3041
 
2922
3042
  /**
@@ -2973,6 +3093,11 @@ export function initLogging(logger: Logger, filter?: string | null): Promise<voi
2973
3093
  */
2974
3094
  export function mysqlStorage(config: MysqlStorageConfig): WasmStorageConfig;
2975
3095
 
3096
+ /**
3097
+ * Builds a `BridgingClient` from an API key, with no seed or storage.
3098
+ */
3099
+ export function newBridgingClient(config: BridgingConfig): Promise<BridgingClient>;
3100
+
2976
3101
  /**
2977
3102
  * Constructs a shareable REST-based Bitcoin chain service.
2978
3103
  *
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./breez_sdk_spark_wasm_bg.js";
5
5
  __wbg_set_wasm(wasm);
6
6
  wasm.__wbindgen_start();
7
7
  export {
8
- BitcoinChainServiceHandle, BreezSdk, DefaultCpfpSigner, DefaultSessionStore, ExternalBreezSignerHandle, ExternalSigners, ExternalSigningSignerHandle, ExternalSparkSignerHandle, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, PasskeyClient, PasskeyLabels, SdkBuilder, SigningOnlyExternalSigners, TokenIssuer, WasmSdkContext, WasmStorageConfig, connect, connectWithSigner, connectWithSigningOnlySigner, createTurnkeySigner, createTurnkeySigningOnlySigner, defaultConfig, defaultExternalSigners, defaultMysqlStorageConfig, defaultPostgresStorageConfig, defaultServerConfig, defaultSessionStore, defaultStorage, getSparkStatus, initLogging, mysqlStorage, newRestChainService, newSharedSdkContext, parseSparkConfig, postgresStorage, singleKeyCpfpSigner, start, task_worker_entry_point
8
+ BitcoinChainServiceHandle, BreezSdk, BridgingClient, ConsoleLogger, DefaultCpfpSigner, DefaultSessionStore, ExternalBreezSignerHandle, ExternalSigners, ExternalSigningSignerHandle, ExternalSparkSignerHandle, IntoUnderlyingByteSource, IntoUnderlyingSink, IntoUnderlyingSource, PasskeyClient, PasskeyLabels, SdkBuilder, SigningOnlyExternalSigners, TokenIssuer, WasmSdkContext, WasmStorageConfig, connect, connectWithSigner, connectWithSigningOnlySigner, createTurnkeySigner, createTurnkeySigningOnlySigner, defaultBridgingConfig, defaultConfig, defaultExternalSigners, defaultMysqlStorageConfig, defaultPostgresStorageConfig, defaultServerConfig, defaultSessionStore, defaultStorage, getSparkStatus, initLogging, mysqlStorage, newBridgingClient, newRestChainService, newSharedSdkContext, parseSparkConfig, postgresStorage, singleKeyCpfpSigner, start, task_worker_entry_point
9
9
  } from "./breez_sdk_spark_wasm_bg.js";