@breeztech/breez-sdk-spark 0.24.1 → 0.26.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.
@@ -396,9 +396,9 @@ class PostgresTreeStore {
396
396
  async getVerifiedLeafKeys() {
397
397
  try {
398
398
  // Project just the two pubkeys out of the JSON, skipping each leaf's
399
- // `data` blob (up to five transactions). The filter matches the verified
400
- // categories the SDK expects: every reserved leaf plus every Available
401
- // one, and nothing non-Available and unreserved.
399
+ // `data` blob (up to five transactions). Every stored leaf passed the
400
+ // ownership check on its way in, whatever its status, so all are
401
+ // projected.
402
402
  const result = await this.pool.query(
403
403
  `
404
404
  SELECT l.id AS id,
@@ -408,7 +408,6 @@ class PostgresTreeStore {
408
408
  LEFT JOIN brz_tree_reservations r
409
409
  ON l.reservation_id = r.id AND l.user_id = r.user_id
410
410
  WHERE l.user_id = $1
411
- AND (r.purpose IS NOT NULL OR l.status = 'Available')
412
411
  `,
413
412
  [this.identity]
414
413
  );
@@ -700,7 +700,7 @@ class SqliteStorage {
700
700
  listDeposits() {
701
701
  try {
702
702
  const stmt = this.db.prepare(`
703
- SELECT txid, vout, amount_sats, is_mature, claim_error, refund_tx, refund_tx_id, instant_claim_status, refund_state
703
+ SELECT txid, vout, amount_sats, is_mature, claim_error, refund_tx, refund_tx_id, instant_claim_status, refund_state, max_claim_fee
704
704
  FROM unclaimed_deposits
705
705
  `);
706
706
 
@@ -718,6 +718,9 @@ class SqliteStorage {
718
718
  ? JSON.parse(row.instant_claim_status)
719
719
  : null,
720
720
  refundState: row.refund_state ? JSON.parse(row.refund_state) : null,
721
+ maxClaimFee: row.max_claim_fee
722
+ ? JSON.parse(row.max_claim_fee)
723
+ : null,
721
724
  }))
722
725
  );
723
726
  } catch (error) {
@@ -767,6 +770,18 @@ class SqliteStorage {
767
770
  `);
768
771
 
769
772
  stmt.run(JSON.stringify(payload.state), txid, vout, payload.refundTxid);
773
+ } else if (payload.type === "maxClaimFee") {
774
+ const stmt = this.db.prepare(`
775
+ UPDATE unclaimed_deposits
776
+ SET max_claim_fee = ?
777
+ WHERE txid = ? AND vout = ?
778
+ `);
779
+
780
+ stmt.run(
781
+ payload.maxFee ? JSON.stringify(payload.maxFee) : null,
782
+ txid,
783
+ vout
784
+ );
770
785
  } else {
771
786
  return Promise.reject(
772
787
  new StorageError(`Unknown payload type: ${payload.type}`)
@@ -784,6 +799,71 @@ class SqliteStorage {
784
799
  }
785
800
  }
786
801
 
802
+ listWatchedDepositAddresses() {
803
+ try {
804
+ const rows = this.db
805
+ .prepare(
806
+ `SELECT address, issued_at, seen FROM watched_deposit_addresses
807
+ ORDER BY issued_at DESC`
808
+ )
809
+ .all();
810
+ return Promise.resolve(
811
+ rows.map((row) => ({
812
+ address: row.address,
813
+ issuedAt: row.issued_at,
814
+ seen: Boolean(row.seen),
815
+ }))
816
+ );
817
+ } catch (error) {
818
+ return Promise.reject(
819
+ new StorageError(
820
+ `Failed to list watched deposit addresses: ${error.message}`,
821
+ error
822
+ )
823
+ );
824
+ }
825
+ }
826
+
827
+ updateWatchedDepositAddress(address, payload) {
828
+ try {
829
+ if (payload.type === "watch") {
830
+ this.db
831
+ .prepare(
832
+ `INSERT INTO watched_deposit_addresses (address, issued_at, seen)
833
+ VALUES (?, ?, 0)
834
+ ON CONFLICT(address) DO UPDATE SET issued_at = excluded.issued_at, seen = 0`
835
+ )
836
+ .run(address, payload.issuedAt);
837
+ } else if (payload.type === "seen") {
838
+ this.db
839
+ .prepare(
840
+ "UPDATE watched_deposit_addresses SET seen = 1 WHERE address = ?"
841
+ )
842
+ .run(address);
843
+ } else if (payload.type === "unwatch") {
844
+ this.db
845
+ .prepare(
846
+ `DELETE FROM watched_deposit_addresses
847
+ WHERE address = ? AND issued_at = ?`
848
+ )
849
+ .run(address, payload.issuedAt);
850
+ } else {
851
+ return Promise.reject(
852
+ new StorageError(`Unknown payload type: ${payload.type}`)
853
+ );
854
+ }
855
+ return Promise.resolve();
856
+ } catch (error) {
857
+ if (error instanceof StorageError) return Promise.reject(error);
858
+ return Promise.reject(
859
+ new StorageError(
860
+ `Failed to update watched deposit address '${address}': ${error.message}`,
861
+ error
862
+ )
863
+ );
864
+ }
865
+ }
866
+
787
867
  setLnurlMetadata(metadata) {
788
868
  try {
789
869
  const stmt = this.db.prepare(
@@ -500,6 +500,27 @@ class MigrationManager {
500
500
  name: "Add refund state to unclaimed_deposits",
501
501
  sql: [`ALTER TABLE unclaimed_deposits ADD COLUMN refund_state TEXT`],
502
502
  },
503
+ {
504
+ // Deposit addresses polled on-chain for deposits still in the mempool.
505
+ // Rows are removed once watching them can no longer lead to an early
506
+ // claim, so the table holds only the live watch set.
507
+ name: "Add watched_deposit_addresses",
508
+ sql: [
509
+ `CREATE TABLE IF NOT EXISTS watched_deposit_addresses (
510
+ address TEXT PRIMARY KEY,
511
+ issued_at INTEGER NOT NULL,
512
+ seen INTEGER NOT NULL DEFAULT 0
513
+ )`,
514
+ ],
515
+ },
516
+ {
517
+ // The fee ceiling standing for one deposit as a JSON-encoded MaxFee,
518
+ // overriding the configured one. NULL when the configured one applies.
519
+ name: "Add max claim fee to unclaimed_deposits",
520
+ sql: [
521
+ `ALTER TABLE unclaimed_deposits ADD COLUMN max_claim_fee TEXT`,
522
+ ],
523
+ },
503
524
  ];
504
525
  }
505
526
  }
@@ -349,9 +349,7 @@ class NodeTreeStore {
349
349
  `SELECT l.id AS id,
350
350
  l.verifying_public_key AS verifying,
351
351
  l.signing_public_key AS keyshare
352
- FROM brz_tree_leaves l
353
- LEFT JOIN brz_tree_reservations r ON l.reservation_id = r.id
354
- WHERE r.purpose IS NOT NULL OR l.status = 'Available'`
352
+ FROM brz_tree_leaves l`
355
353
  )
356
354
  .all();
357
355
  return rows.map((row) => [row.id, row.verifying, row.keyshare]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@breeztech/breez-sdk-spark",
3
- "version": "0.24.1",
3
+ "version": "0.26.0",
4
4
  "description": "Breez Spark SDK",
5
5
  "repository": "https://github.com/breez/spark-sdk",
6
6
  "author": "Breez <contact@breez.technology> (https://github.com/breez)",
@@ -545,7 +545,7 @@ export interface BatchRecipient {
545
545
 
546
546
  export interface BatchTotal {
547
547
  tokenIdentifier?: string;
548
- amount: bigint;
548
+ amount: string;
549
549
  }
550
550
 
551
551
  export interface Bip21Details {
@@ -681,6 +681,15 @@ export interface CheckMessageResponse {
681
681
  isValid: boolean;
682
682
  }
683
683
 
684
+ export interface CheckUnilateralExitRequest {
685
+ exit: UnilateralExitResponse;
686
+ }
687
+
688
+ export interface CheckUnilateralExitResponse {
689
+ exit: UnilateralExitResponse;
690
+ verdict: UnilateralExitVerdict;
691
+ }
692
+
684
693
  export interface ClaimDepositQuote {
685
694
  confirmationsRequired: number;
686
695
  creditAmountSats: number;
@@ -696,7 +705,7 @@ export interface ClaimDepositRequest {
696
705
  }
697
706
 
698
707
  export interface ClaimDepositResponse {
699
- payment?: Payment;
708
+ outcome: ClaimDepositOutcome;
700
709
  }
701
710
 
702
711
  export interface ClaimHtlcPaymentRequest {
@@ -746,6 +755,12 @@ export interface Config {
746
755
  crossChainConfig?: CrossChainConfig;
747
756
  }
748
757
 
758
+ export interface ConfirmedExitNode {
759
+ nodeId: string;
760
+ confirmedBy: ExitNodeConfirmation;
761
+ blockHeight?: number;
762
+ }
763
+
749
764
  export interface ConnectRequest {
750
765
  config: Config;
751
766
  seed: Seed;
@@ -817,12 +832,17 @@ export interface Credentials {
817
832
  password: string;
818
833
  }
819
834
 
835
+ export interface CrossChainAcceptedAsset {
836
+ asset: SparkAsset;
837
+ limits?: CrossChainRouteLimits;
838
+ }
839
+
820
840
  export interface CrossChainAddressDetails {
821
841
  address: string;
822
842
  addressFamily: CrossChainAddressFamily;
823
843
  contractAddress?: string;
824
844
  chainId?: number;
825
- amount?: bigint;
845
+ amount?: string;
826
846
  }
827
847
 
828
848
  export interface CrossChainConfig {
@@ -830,6 +850,25 @@ export interface CrossChainConfig {
830
850
  defaultTargetOverpayBps?: number;
831
851
  }
832
852
 
853
+ export interface CrossChainReceiveInfo {
854
+ depositAddress: string;
855
+ depositAmount: string;
856
+ expectedReceivedAmount: string;
857
+ destinationAsset: string;
858
+ tokenIdentifier?: string;
859
+ serviceFeeAmount: string;
860
+ serviceFeeAsset?: string;
861
+ serviceFeeAssetDecimals?: number;
862
+ expiresAt: number;
863
+ }
864
+
865
+ export interface CrossChainRouteLimits {
866
+ minAmount?: string;
867
+ maxAmount?: string;
868
+ minUsdCents?: number;
869
+ maxUsdCents?: number;
870
+ }
871
+
833
872
  export interface CrossChainRoutePair {
834
873
  provider: CrossChainProvider;
835
874
  chain: string;
@@ -838,8 +877,8 @@ export interface CrossChainRoutePair {
838
877
  contractAddress?: string;
839
878
  decimals: number;
840
879
  exactOutEligible: boolean;
841
- supportedSources: SourceAsset[];
842
- supportedSourceChains: SourceChain[];
880
+ acceptedAssets: CrossChainAcceptedAsset[];
881
+ deliveryMethods: DeliveryMethod[];
843
882
  }
844
883
 
845
884
  export interface CurrencyInfo {
@@ -862,6 +901,7 @@ export interface DepositInfo {
862
901
  claimError?: DepositClaimError;
863
902
  instantClaimStatus?: InstantClaimStatus;
864
903
  refundState?: RefundState;
904
+ maxClaimFee?: MaxFee;
865
905
  }
866
906
 
867
907
  export interface EcdsaSignatureBytes {
@@ -872,6 +912,19 @@ export interface EventListener {
872
912
  onEvent: (e: SdkEvent) => void;
873
913
  }
874
914
 
915
+ export interface ExitChainState {
916
+ confirmedNodes: ConfirmedExitNode[];
917
+ refunds: ExitRefund[];
918
+ stoppedLeafIds: string[];
919
+ unverifiedNodeIds: string[];
920
+ unverifiableConfirmedNodeIds: string[];
921
+ }
922
+
923
+ export interface ExitRefund {
924
+ leafId: string;
925
+ state: ExitRefundState;
926
+ }
927
+
875
928
  export interface ExportUnilateralExitStateResponse {
876
929
  exitState: string;
877
930
  }
@@ -929,6 +982,10 @@ export interface ExternalInputParser {
929
982
  parserUrl: string;
930
983
  }
931
984
 
985
+ export interface ExternalLeafSigningKey {
986
+ derivedFrom: ExternalTreeNodeId;
987
+ }
988
+
932
989
  export interface ExternalNewLeafKey {
933
990
  nodeId: ExternalTreeNodeId;
934
991
  newSigningPublicKey: number[];
@@ -1075,6 +1132,7 @@ export interface ExternalStartedStaticDepositRefund {
1075
1132
  export interface ExternalTransferLeafInput {
1076
1133
  nodeId: ExternalTreeNodeId;
1077
1134
  newLeafId: ExternalTreeNodeId;
1135
+ signingKey: ExternalLeafSigningKey;
1078
1136
  }
1079
1137
 
1080
1138
  export interface ExternalTreeNodeId {
@@ -1447,6 +1505,7 @@ export interface PreparePaymentLinkResponse {
1447
1505
  asset: string;
1448
1506
  serviceFeeAmount: bigint;
1449
1507
  serviceFeeAsset?: string;
1508
+ serviceFeeAssetDecimals?: number;
1450
1509
  expiresAt: string;
1451
1510
  }
1452
1511
 
@@ -1486,11 +1545,14 @@ export interface PrepareUnilateralExitResponse {
1486
1545
  leaves: UnilateralExitLeaf[];
1487
1546
  recoverableValueSat: number;
1488
1547
  totalFeeSat: number;
1548
+ cpfpFeeSat: number;
1489
1549
  fanoutFeeSat: number;
1550
+ sweepFeeSat: number;
1490
1551
  singleUtxoFundingSat: number;
1491
1552
  perBranchFunding: PerBranchFunding[];
1492
1553
  feeRateSatPerVbyte: number;
1493
1554
  destination: string;
1555
+ exitChainState: ExitChainState;
1494
1556
  }
1495
1557
 
1496
1558
  export interface ProvisionalPayment {
@@ -1530,6 +1592,7 @@ export interface ReceivePaymentRequest {
1530
1592
  export interface ReceivePaymentResponse {
1531
1593
  paymentRequest: string;
1532
1594
  fee: bigint;
1595
+ crossChainInfo?: CrossChainReceiveInfo;
1533
1596
  }
1534
1597
 
1535
1598
  export interface RecommendedFees {
@@ -1635,6 +1698,7 @@ export interface SendOnchainFeeQuote {
1635
1698
  speedFast: SendOnchainSpeedFeeQuote;
1636
1699
  speedMedium: SendOnchainSpeedFeeQuote;
1637
1700
  speedSlow: SendOnchainSpeedFeeQuote;
1701
+ isEstimate: boolean;
1638
1702
  }
1639
1703
 
1640
1704
  export interface SendOnchainSpeedFeeQuote {
@@ -1787,6 +1851,8 @@ export interface Storage {
1787
1851
  deleteDeposit: (txid: string, vout: number) => Promise<void>;
1788
1852
  listDeposits: () => Promise<DepositInfo[]>;
1789
1853
  updateDeposit: (txid: string, vout: number, payload: UpdateDepositPayload) => Promise<void>;
1854
+ listWatchedDepositAddresses: () => Promise<WatchedDepositAddress[]>;
1855
+ updateWatchedDepositAddress: (address: string, payload: UpdateWatchedAddressPayload) => Promise<void>;
1790
1856
  setLnurlMetadata: (metadata: SetLnurlMetadataItem[]) => Promise<void>;
1791
1857
  getPaymentsByParentIds: (parentPaymentIds: string[]) => Promise<{ [parentId: string]: RelatedPayment[] }>;
1792
1858
  listContacts: (request: ListContactsRequest) => Promise<Contact[]>;
@@ -1921,8 +1987,12 @@ export interface UnilateralExitRequest {
1921
1987
  export interface UnilateralExitResponse {
1922
1988
  recoverableValueSat: number;
1923
1989
  totalFeeSat: number;
1990
+ cpfpFeeSat: number;
1991
+ fanoutFeeSat: number;
1992
+ sweepFeeSat: number;
1924
1993
  leaves: UnilateralExitLeaf[];
1925
1994
  transactions: UnilateralExitTransaction[];
1995
+ fundingInputs: CpfpInput[];
1926
1996
  }
1927
1997
 
1928
1998
  export interface UnilateralExitTransaction {
@@ -1933,7 +2003,7 @@ export interface UnilateralExitTransaction {
1933
2003
  cpfpTxHex?: string;
1934
2004
  csvTimelockBlocks?: number;
1935
2005
  dependsOn: string[];
1936
- status: ConfirmationStatus;
2006
+ status: ExitTransactionStatus;
1937
2007
  }
1938
2008
 
1939
2009
  export interface UnregisterWebhookRequest {
@@ -1977,6 +2047,12 @@ export interface Utxo {
1977
2047
  status: TxStatus;
1978
2048
  }
1979
2049
 
2050
+ export interface WatchedDepositAddress {
2051
+ address: string;
2052
+ issuedAt: number;
2053
+ seen: boolean;
2054
+ }
2055
+
1980
2056
  export interface Webhook {
1981
2057
  id: string;
1982
2058
  url: string;
@@ -2003,13 +2079,15 @@ export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; red
2003
2079
 
2004
2080
  export type ChainApiType = "esplora" | "mempoolSpace";
2005
2081
 
2006
- export type ConfirmationStatus = "confirmed" | "unconfirmed" | "unverified";
2082
+ export type ClaimDeferredReason = { type: "maxFeeExceeded"; requiredFeeSats: number; maxFeeSats: number } | { type: "noEarlyClaimAvailable" } | { type: "providerDeclined"; message: string };
2083
+
2084
+ export type ClaimDepositOutcome = { type: "settled"; payment: Payment } | { type: "submitted" } | { type: "deferred"; reason: ClaimDeferredReason };
2007
2085
 
2008
2086
  export type ConversionChain = { type: "spark" } | { type: "lightning" } | { type: "external"; name: string; chainId?: string };
2009
2087
 
2010
2088
  export type ConversionFilter = "ammRefundNeeded" | "orchestraPending" | "boltzPending";
2011
2089
 
2012
- export type ConversionInfo = { type: "amm"; poolId: string; conversionId: string; status: ConversionStatus; fee?: string; purpose?: ConversionPurpose; amountAdjustment?: AmountAdjustmentReason; degradation?: SwapDegradation } | { type: "orchestra"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; assetDecimals: number; orderId: string; quoteId: string; readToken?: string } | { type: "boltz"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; assetDecimals: number; swapId: string; invoice: string; invoiceAmountSats: number; bridgeRef?: string; maxSlippageBps: number; quoteDegraded?: boolean };
2090
+ export type ConversionInfo = { type: "amm"; poolId: string; conversionId: string; status: ConversionStatus; fee?: string; purpose?: ConversionPurpose; amountAdjustment?: AmountAdjustmentReason; degradation?: SwapDegradation } | { type: "orchestra"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; externalTxHash?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; serviceFeeAssetDecimals?: number; assetDecimals: number; orderId: string; quoteId: string; readToken?: string } | { type: "boltz"; chain: string; chainId?: string; asset?: string; assetContract?: string; recipientAddress: string; assetAmountIn?: string; estimatedOut: string; deliveredAmount?: string; status: ConversionStatus; feeAmount?: string; serviceFeeAmount?: string; serviceFeeAsset?: string; assetDecimals: number; swapId: string; invoice: string; invoiceAmountSats: number; bridgeRef?: string; maxSlippageBps: number; quoteDegraded?: boolean };
2013
2091
 
2014
2092
  export type ConversionProvider = "amm" | "orchestra" | "boltz";
2015
2093
 
@@ -2033,10 +2111,18 @@ export type CrossChainProviderContext = { type: "orchestra"; quoteId: string; de
2033
2111
 
2034
2112
  export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAddressDetails } | { type: "receive"; contractAddress?: string } | { type: "paymentLink"; addressDetails: CrossChainAddressDetails };
2035
2113
 
2114
+ export type DeliveryMethod = "spark" | "lightning" | "bitcoin";
2115
+
2036
2116
  export type DepositClaimError = { type: "maxDepositClaimFeeExceeded"; tx: string; vout: number; maxFee?: Fee; requiredFeeSats: number; requiredFeeRateSatPerVbyte: number } | { type: "missingUtxo"; tx: string; vout: number } | { type: "generic"; message: string };
2037
2117
 
2038
2118
  export type ExitLeafSelection = { type: "auto" } | { type: "specific"; leafIds: string[] };
2039
2119
 
2120
+ export type ExitNodeConfirmation = "cpfp" | "direct";
2121
+
2122
+ export type ExitRefundState = { type: "onChain"; txHex: string; vout: number; valueSat: number; blockHeight?: number } | { type: "swept" };
2123
+
2124
+ export type ExitTransactionStatus = { type: "confirmed"; blockHeight?: number } | { type: "ready" } | { type: "waitingForDependencies" } | { type: "waitingForTimelock"; spendableAtHeight?: number } | { type: "unverified" };
2125
+
2040
2126
  export type ExternalFrostDerivation = { type: "signingLeaf"; leafId: ExternalTreeNodeId } | { type: "staticDeposit"; index: number } | { type: "htlcPreimage" } | { type: "identity" };
2041
2127
 
2042
2128
  export type ExternalSparkInvoiceKind = "sats" | "tokens";
@@ -2049,13 +2135,13 @@ export type FeePolicy = "feesExcluded" | "feesIncluded";
2049
2135
 
2050
2136
  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);
2051
2137
 
2052
- export type InstantClaimStatus = { type: "declined"; maxFeeSats?: number; confirmations?: number } | { type: "submitted"; claimId: string };
2138
+ export type InstantClaimStatus = { type: "declined"; maxFeeSats?: number; confirmations?: number } | { type: "submitted"; claimId: string } | { type: "claimed" };
2053
2139
 
2054
2140
  export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
2055
2141
 
2056
2142
  export type MaxFee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyte: number } | { type: "networkRecommended"; leewaySatPerVbyte: number };
2057
2143
 
2058
- export type Network = "mainnet" | "regtest";
2144
+ export type Network = "mainnet" | "regtest" | "signet";
2059
2145
 
2060
2146
  export type OnchainConfirmationSpeed = "fast" | "medium" | "slow";
2061
2147
 
@@ -2083,15 +2169,15 @@ export type PublishSignedLnurlPayResponse = { type: "swapCompleted" } | { type:
2083
2169
 
2084
2170
  export type PublishSignedTransferPackageResponse = { type: "swapCompleted" } | { type: "paymentSent"; payment: Payment } | { type: "paymentsSent"; payments: Payment[] };
2085
2171
 
2086
- export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; tokenIdentifier?: string; expiryTime?: number; description?: string; senderPublicKey?: string } | { type: "bitcoinAddress"; newAddress?: boolean } | { type: "bolt11Invoice"; description: string; amountSats?: number; expirySecs?: number; paymentHash?: string; receiverIdentityPublicKey?: string };
2172
+ export type ReceivePaymentMethod = { type: "sparkAddress" } | { type: "sparkInvoice"; amount?: string; 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: string; destination?: SparkAsset; feeMode?: CrossChainFeeMode; maxSlippageBps?: number; targetOverpayBps?: number };
2087
2173
 
2088
2174
  export type RefundState = { type: "broadcastPending"; lastError?: string } | { type: "broadcast" };
2089
2175
 
2090
- export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] } | { type: "unilateralExitStateChanged" };
2176
+ export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaimedDeposits: DepositInfo[] } | { type: "claimedDeposits"; claimedDeposits: DepositInfo[] } | { type: "paymentSucceeded"; payment: Payment } | { type: "paymentPending"; payment: Payment } | { type: "paymentFailed"; payment: Payment } | { type: "paymentMetadataUpdated"; payment: Payment } | { type: "autoOptimization"; optimizationEvent: AutoOptimizationEvent } | { type: "lightningAddressChanged"; lightningAddress?: LightningAddressInfo } | { type: "newDeposits"; newDeposits: DepositInfo[] } | { type: "unilateralExitStateChanged" };
2091
2177
 
2092
2178
  export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
2093
2179
 
2094
- export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string } | { type: "crossChainAddress"; route: CrossChainRoutePair; recipientAddress: string; amountIn: string; assetAmountIn: string; estimatedOut: string; feeAmount: string; serviceFeeAmount: string; serviceFeeAsset?: string; sourceTransferFeeSats: number; feeMode: CrossChainFeeMode; expiresAt: string; providerContext: CrossChainProviderContext };
2180
+ export type SendPaymentMethod = { type: "bitcoinAddress"; address: BitcoinAddressDetails; feeQuote: SendOnchainFeeQuote } | { type: "bolt11Invoice"; invoiceDetails: Bolt11InvoiceDetails; sparkTransferFeeSats?: number; lightningFeeSats: number } | { type: "sparkAddress"; address: string; fee: string; tokenIdentifier?: string } | { type: "sparkInvoice"; sparkInvoiceDetails: SparkInvoiceDetails; fee: string; tokenIdentifier?: string } | { type: "crossChainAddress"; route: CrossChainRoutePair; recipientAddress: string; amountIn: string; assetAmountIn: string; estimatedOut: string; feeAmount: string; serviceFeeAmount: string; serviceFeeAsset?: string; serviceFeeAssetDecimals?: number; sourceTransferFeeSats: number; feeMode: CrossChainFeeMode; expiresAt: string; providerContext: CrossChainProviderContext };
2095
2181
 
2096
2182
  export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
2097
2183
 
@@ -2099,9 +2185,7 @@ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" |
2099
2185
 
2100
2186
  export type SessionStoreError = { type: "notFound" } | ({ type: "generic" } & string);
2101
2187
 
2102
- export type SourceAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier: string };
2103
-
2104
- export type SourceChain = "spark" | "lightning" | "bitcoin";
2188
+ export type SparkAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier: string };
2105
2189
 
2106
2190
  export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
2107
2191
 
@@ -2123,11 +2207,17 @@ export type TransferSignature = { type: "transfer"; signed: ExternalPreparedTran
2123
2207
 
2124
2208
  export type TransferTarget = { type: "spark"; address: string; sparkInvoice?: string } | { type: "lightning"; bolt11: string; lnurlPay?: LnurlPayContext; feePolicy: FeePolicy; completionTimeoutSecs?: number } | { type: "coopExit"; address: string; feeQuote: SendOnchainFeeQuote; confirmationSpeed: OnchainConfirmationSpeed };
2125
2209
 
2210
+ export type UnilateralExitRedoReason = "onChainStateDiverged";
2211
+
2126
2212
  export type UnilateralExitTxKind = "fanOut" | "node" | "refund" | "sweep";
2127
2213
 
2214
+ export type UnilateralExitVerdict = { type: "valid" } | { type: "done" } | { type: "redo"; reason: UnilateralExitRedoReason };
2215
+
2128
2216
  export type UnsignedTransferPackage = { type: "swap"; prepareTransfer: ExternalPrepareTransferRequest; targetAmounts: number[]; amountSat: number; feeSat: number } | { type: "transfer"; prepareTransfer: ExternalPrepareTransferRequest; amountSat: number; feeSat: number; target: TransferTarget } | { type: "token"; prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: number[]; tokenIdentifier: string; amount: string; fee: string; isSwap: boolean } | { type: "tokenBatch"; prepareTokenTransaction: ExternalPrepareTokenTransactionRequest; tokenContext: number[]; totals: BatchTotal[]; isSwap: boolean };
2129
2217
 
2130
- export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string; state: RefundState } | { type: "instantClaim"; status: InstantClaimStatus } | { type: "refundBroadcastState"; refundTxid: string; state: RefundState };
2218
+ export type UpdateDepositPayload = { type: "claimError"; error: DepositClaimError } | { type: "refund"; refundTxid: string; refundTx: string; state: RefundState } | { type: "instantClaim"; status: InstantClaimStatus } | { type: "refundBroadcastState"; refundTxid: string; state: RefundState } | { type: "maxClaimFee"; maxFee?: MaxFee };
2219
+
2220
+ export type UpdateWatchedAddressPayload = { type: "watch"; issuedAt: number } | { type: "seen" } | { type: "unwatch"; issuedAt: number };
2131
2221
 
2132
2222
  export type WebhookEventType = { type: "lightningReceiveFinished" } | { type: "lightningSendFinished" } | { type: "coopExitFinished" } | { type: "staticDepositFinished" } | ({ type: "unknown" } & string);
2133
2223
 
@@ -2167,6 +2257,7 @@ export class BreezSdk {
2167
2257
  buyBitcoin(request: BuyBitcoinRequest): Promise<BuyBitcoinResponse>;
2168
2258
  checkLightningAddressAvailable(request: CheckLightningAddressRequest): Promise<boolean>;
2169
2259
  checkMessage(request: CheckMessageRequest): Promise<CheckMessageResponse>;
2260
+ checkUnilateralExit(request: CheckUnilateralExitRequest): Promise<CheckUnilateralExitResponse>;
2170
2261
  claimDeposit(request: ClaimDepositRequest): Promise<ClaimDepositResponse>;
2171
2262
  claimHtlcPayment(request: ClaimHtlcPaymentRequest): Promise<ClaimHtlcPaymentResponse>;
2172
2263
  claimLightningAddressTransfer(request: ClaimTransferRequest): Promise<LightningAddressInfo>;
@@ -2698,6 +2789,7 @@ export interface InitOutput {
2698
2789
  readonly breezsdk_buyBitcoin: (a: number, b: any) => any;
2699
2790
  readonly breezsdk_checkLightningAddressAvailable: (a: number, b: any) => any;
2700
2791
  readonly breezsdk_checkMessage: (a: number, b: any) => any;
2792
+ readonly breezsdk_checkUnilateralExit: (a: number, b: any) => any;
2701
2793
  readonly breezsdk_claimDeposit: (a: number, b: any) => any;
2702
2794
  readonly breezsdk_claimHtlcPayment: (a: number, b: any) => any;
2703
2795
  readonly breezsdk_claimLightningAddressTransfer: (a: number, b: any) => any;
@@ -2858,19 +2950,16 @@ export interface InitOutput {
2858
2950
  readonly __wbg_signingonlyexternalsigners_free: (a: number, b: number) => void;
2859
2951
  readonly signingonlyexternalsigners_breezSigner: (a: number) => number;
2860
2952
  readonly signingonlyexternalsigners_sparkSigner: (a: number) => number;
2861
- readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522: (a: number, b: number, c: any) => [number, number];
2862
- readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_6: (a: number, b: number, c: any) => [number, number];
2863
- readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_7: (a: number, b: number, c: any) => [number, number];
2864
- readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_8: (a: number, b: number, c: any) => [number, number];
2865
- readonly wasm_bindgen__convert__closures_____invoke__h62bc116e0c266522_9: (a: number, b: number, c: any) => [number, number];
2953
+ readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a: (a: number, b: number, c: any) => [number, number];
2954
+ readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_4: (a: number, b: number, c: any) => [number, number];
2955
+ readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_5: (a: number, b: number, c: any) => [number, number];
2956
+ readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_6: (a: number, b: number, c: any) => [number, number];
2957
+ readonly wasm_bindgen__convert__closures_____invoke__h2f6500191cedbf1a_7: (a: number, b: number, c: any) => [number, number];
2866
2958
  readonly wasm_bindgen__convert__closures_____invoke__h41057d61edf43a32: (a: number, b: number, c: any, d: any) => void;
2867
- readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2: (a: number, b: number, c: any) => void;
2868
- readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_2: (a: number, b: number, c: any) => void;
2869
- readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_3: (a: number, b: number, c: any) => void;
2870
- readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_4: (a: number, b: number, c: any) => void;
2871
- readonly wasm_bindgen__convert__closures_____invoke__h3120db8c4a8a92b2_5: (a: number, b: number, c: any) => void;
2959
+ readonly wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25: (a: number, b: number, c: any) => void;
2960
+ readonly wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_2: (a: number, b: number, c: any) => void;
2961
+ readonly wasm_bindgen__convert__closures_____invoke__h3b28fbbc8b451a25_3: (a: number, b: number, c: any) => void;
2872
2962
  readonly wasm_bindgen__convert__closures_____invoke__h484cd36e13f37bd7: (a: number, b: number) => void;
2873
- readonly wasm_bindgen__convert__closures_____invoke__h0fa3f876e31d2a3e: (a: number, b: number) => void;
2874
2963
  readonly __wbindgen_malloc: (a: number, b: number) => number;
2875
2964
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
2876
2965
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;