@breeztech/breez-sdk-spark 0.27.1 → 0.27.3-dev

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
@@ -27,7 +27,7 @@ class MigrationManager {
27
27
  const transaction = event.target.transaction;
28
28
 
29
29
  this._log(
30
- "info",
30
+ "INFO",
31
31
  `Upgrading IndexedDB from version ${oldVersion} to ${newVersion}`
32
32
  );
33
33
 
@@ -35,14 +35,14 @@ class MigrationManager {
35
35
  for (let i = oldVersion; i < newVersion; i++) {
36
36
  const migration = this.migrations[i];
37
37
  if (migration) {
38
- this._log("debug", `Running migration ${i + 1}: ${migration.name}`);
38
+ this._log("DEBUG", `Running migration ${i + 1}: ${migration.name}`);
39
39
  migration.upgrade(db, transaction);
40
40
  }
41
41
  }
42
- this._log("info", `Database migration completed successfully`);
42
+ this._log("INFO", `Database migration completed successfully`);
43
43
  } catch (error) {
44
44
  this._log(
45
- "error",
45
+ "ERROR",
46
46
  `Migration failed at version ${oldVersion}: ${error.message}`
47
47
  );
48
48
  throw new this.StorageError(
@@ -53,14 +53,7 @@ class MigrationManager {
53
53
  }
54
54
 
55
55
  _log(level, message) {
56
- if (this.logger && typeof this.logger.log === "function") {
57
- this.logger.log({
58
- line: message,
59
- level: level,
60
- });
61
- } else if (level === "error") {
62
- console.error(`[MigrationManager] ${message}`);
63
- }
56
+ this.logger?.log({ line: message, level });
64
57
  }
65
58
 
66
59
  /**
@@ -149,7 +142,7 @@ class MigrationManager {
149
142
  }
150
143
  });
151
144
 
152
- console.log(`Migrated ${updated} payment records to BigInt format`);
145
+ this._log("INFO", `Migrated ${updated} payment records to BigInt format`);
153
146
  };
154
147
  },
155
148
  },
@@ -653,6 +646,77 @@ class MigrationManager {
653
646
  }
654
647
  },
655
648
  },
649
+ {
650
+ // A withdrawal stored before the SDK kept its destination address and
651
+ // output index loses its details, which the SDK cannot rebuild here.
652
+ // With the sync offset at 0, the SDK re-fetches every transfer on its
653
+ // next sync and rewrites past withdrawals with both values.
654
+ name: "Clear legacy withdrawal details and reset sync offset",
655
+ upgrade: (db, transaction) => {
656
+ if (db.objectStoreNames.contains("payments")) {
657
+ const paymentStore = transaction.objectStore("payments");
658
+ // The cursor opens from a callback, so it reads the payments after
659
+ // the earlier steps of this upgrade have written theirs.
660
+ paymentStore.count().onsuccess = () => {
661
+ const cursorRequest = paymentStore.openCursor();
662
+ cursorRequest.onsuccess = (event) => {
663
+ const cursor = event.target.result;
664
+ if (!cursor) return;
665
+ const payment = cursor.value;
666
+ let details = null;
667
+ if (payment.details && typeof payment.details === "string") {
668
+ try {
669
+ details = JSON.parse(payment.details);
670
+ } catch (e) {
671
+ details = null;
672
+ }
673
+ } else {
674
+ details = payment.details;
675
+ }
676
+ if (
677
+ details &&
678
+ details.type === "withdraw" &&
679
+ (details.vout == null || details.destinationAddress == null)
680
+ ) {
681
+ payment.details = null;
682
+ cursor.update(payment);
683
+ }
684
+ cursor.continue();
685
+ };
686
+ };
687
+ }
688
+ if (!db.objectStoreNames.contains("settings")) {
689
+ return;
690
+ }
691
+ const settingsStore = transaction.objectStore("settings");
692
+ const getRequest = settingsStore.get("sync_offset");
693
+ getRequest.onsuccess = () => {
694
+ const syncCache = getRequest.result;
695
+ if (!syncCache || !syncCache.value) {
696
+ return;
697
+ }
698
+ try {
699
+ const syncInfo = JSON.parse(syncCache.value);
700
+ syncInfo.offset = 0;
701
+ settingsStore.put({
702
+ key: "sync_offset",
703
+ value: toJson(syncInfo),
704
+ });
705
+ } catch (e) {
706
+ // If parsing fails, just continue
707
+ }
708
+ };
709
+ },
710
+ },
711
+ {
712
+ name: "Force lnurl_receive_metadata re-sync for the lightning address",
713
+ upgrade: (db, transaction) => {
714
+ if (db.objectStoreNames.contains("settings")) {
715
+ const settings = transaction.objectStore("settings");
716
+ settings.delete("lnurl_metadata_updated_after");
717
+ }
718
+ },
719
+ },
656
720
  ];
657
721
  }
658
722
  }
@@ -681,7 +745,7 @@ class IndexedDBStorage {
681
745
  // so existing databases depend on indices never shifting. Never insert,
682
746
  // reorder, or delete a migration — only append. dbVersion MUST equal the
683
747
  // number of migrations (enforced by the guard in initialize()).
684
- this.dbVersion = 23; // Current schema version (= migration count)
748
+ this.dbVersion = 25; // Current schema version (= migration count)
685
749
  }
686
750
 
687
751
  /**
@@ -1071,13 +1135,15 @@ class IndexedDBStorage {
1071
1135
  shouldPersist = true;
1072
1136
  shouldEmit = true;
1073
1137
  } else if (stored === next) {
1074
- console.debug(
1138
+ this._log(
1139
+ "DEBUG",
1075
1140
  `Skipping redundant payment event: id=${payment.id} status=${next}`
1076
1141
  );
1077
1142
  shouldPersist = true;
1078
1143
  shouldEmit = false;
1079
1144
  } else if (this._isFinalPaymentStatus(stored)) {
1080
- console.warn(
1145
+ this._log(
1146
+ "WARN",
1081
1147
  `Skipping payment update (would replace terminal status): id=${payment.id} stored=${stored} new=${next}`
1082
1148
  );
1083
1149
  shouldPersist = false;
@@ -1293,7 +1359,7 @@ class IndexedDBStorage {
1293
1359
  /**
1294
1360
  * Gets payments that have any of the specified parent payment IDs.
1295
1361
  * @param {string[]} parentPaymentIds - Array of parent payment IDs
1296
- * @returns {Promise<Object>} Map of parentPaymentId -> array of RelatedPayment objects
1362
+ * @returns {Promise<Object>} Map of parentPaymentId -> array of Payment objects
1297
1363
  */
1298
1364
  async getPaymentsByParentIds(parentPaymentIds) {
1299
1365
  if (!this.db) {
@@ -2007,6 +2073,7 @@ class IndexedDBStorage {
2007
2073
  nostrZapRequest: item.nostrZapRequest || null,
2008
2074
  nostrZapReceipt: item.nostrZapReceipt || null,
2009
2075
  senderComment: item.senderComment || null,
2076
+ lightningAddress: item.lightningAddress || null,
2010
2077
  });
2011
2078
 
2012
2079
  request.onsuccess = () => {
@@ -2725,6 +2792,10 @@ class IndexedDBStorage {
2725
2792
  };
2726
2793
  }
2727
2794
 
2795
+ _log(level, line) {
2796
+ this.logger?.log({ line, level });
2797
+ }
2798
+
2728
2799
  _normalizePaymentStatus(status) {
2729
2800
  return typeof status === "string" ? status.toLowerCase() : status;
2730
2801
  }
@@ -3040,6 +3111,7 @@ class IndexedDBStorage {
3040
3111
  nostrZapRequest: lnurlReceiveMetadata.nostrZapRequest || null,
3041
3112
  nostrZapReceipt: lnurlReceiveMetadata.nostrZapReceipt || null,
3042
3113
  senderComment: lnurlReceiveMetadata.senderComment || null,
3114
+ lightningAddress: lnurlReceiveMetadata.lightningAddress || null,
3043
3115
  };
3044
3116
  }
3045
3117
  resolve(payment);
@@ -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
  *