@breeztech/breez-sdk-spark 0.16.1-dev1 → 0.17.1

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.
@@ -605,6 +605,7 @@ export interface Config {
605
605
  maxConcurrentClaims: number;
606
606
  sparkConfig?: SparkConfig;
607
607
  backgroundTasksEnabled: boolean;
608
+ crossChainConfig?: CrossChainConfig;
608
609
  }
609
610
 
610
611
  export interface ConnectRequest {
@@ -621,10 +622,23 @@ export interface Contact {
621
622
  updatedAt: number;
622
623
  }
623
624
 
625
+ export interface Conversion {
626
+ provider: ConversionProvider;
627
+ status: ConversionStatus;
628
+ from: ConversionSide;
629
+ to: ConversionSide;
630
+ amountAdjustment?: AmountAdjustmentReason;
631
+ }
632
+
633
+ export interface ConversionAsset {
634
+ ticker: string;
635
+ identifier?: string;
636
+ decimals: number;
637
+ }
638
+
624
639
  export interface ConversionDetails {
625
640
  status: ConversionStatus;
626
- from?: ConversionStep;
627
- to?: ConversionStep;
641
+ conversions?: Conversion[];
628
642
  }
629
643
 
630
644
  export interface ConversionEstimate {
@@ -635,28 +649,17 @@ export interface ConversionEstimate {
635
649
  amountAdjustment?: AmountAdjustmentReason;
636
650
  }
637
651
 
638
- export interface ConversionInfo {
639
- poolId: string;
640
- conversionId: string;
641
- status: ConversionStatus;
642
- fee?: string;
643
- purpose?: ConversionPurpose;
644
- amountAdjustment?: AmountAdjustmentReason;
645
- }
646
-
647
652
  export interface ConversionOptions {
648
653
  conversionType: ConversionType;
649
654
  maxSlippageBps?: number;
650
655
  completionTimeoutSecs?: number;
651
656
  }
652
657
 
653
- export interface ConversionStep {
654
- paymentId: string;
655
- amount: bigint;
656
- fee: bigint;
657
- method: PaymentMethod;
658
- tokenMetadata?: TokenMetadata;
659
- amountAdjustment?: AmountAdjustmentReason;
658
+ export interface ConversionSide {
659
+ chain: ConversionChain;
660
+ asset: ConversionAsset;
661
+ amount: string;
662
+ fee: string;
660
663
  }
661
664
 
662
665
  export interface CreateIssuerTokenRequest {
@@ -672,6 +675,30 @@ export interface Credentials {
672
675
  password: string;
673
676
  }
674
677
 
678
+ export interface CrossChainAddressDetails {
679
+ address: string;
680
+ addressFamily: CrossChainAddressFamily;
681
+ contractAddress?: string;
682
+ chainId?: number;
683
+ amount?: bigint;
684
+ }
685
+
686
+ export interface CrossChainConfig {
687
+ defaultSlippageBps?: number;
688
+ defaultTargetOverpayBps?: number;
689
+ }
690
+
691
+ export interface CrossChainRoutePair {
692
+ provider: CrossChainProvider;
693
+ chain: string;
694
+ chainId?: string;
695
+ asset: string;
696
+ contractAddress?: string;
697
+ decimals: number;
698
+ exactOutEligible: boolean;
699
+ supportedSources: SourceAsset[];
700
+ }
701
+
675
702
  export interface CurrencyInfo {
676
703
  name: string;
677
704
  fractionSize: number;
@@ -1208,7 +1235,7 @@ export interface PrepareLnurlPayResponse {
1208
1235
  }
1209
1236
 
1210
1237
  export interface PrepareSendPaymentRequest {
1211
- paymentRequest: string;
1238
+ paymentRequest: PaymentRequest;
1212
1239
  amount?: bigint;
1213
1240
  tokenIdentifier?: string;
1214
1241
  conversionOptions?: ConversionOptions;
@@ -1429,6 +1456,7 @@ export interface SparkSigningOperator {
1429
1456
  identifier: string;
1430
1457
  address: string;
1431
1458
  identityPublicKey: string;
1459
+ caCertPem?: string;
1432
1460
  }
1433
1461
 
1434
1462
  export interface SparkSspConfig {
@@ -1481,6 +1509,9 @@ export interface Storage {
1481
1509
  getContact: (id: string) => Promise<Contact>;
1482
1510
  insertContact: (contact: Contact) => Promise<void>;
1483
1511
  deleteContact: (id: string) => Promise<void>;
1512
+ setCrossChainSwap: (swap: StoredCrossChainSwap) => Promise<void>;
1513
+ getCrossChainSwap: (provider: string, id: string) => Promise<StoredCrossChainSwap | null>;
1514
+ listActiveCrossChainSwaps: (provider: string) => Promise<StoredCrossChainSwap[]>;
1484
1515
  syncAddOutgoingChange: (record: UnversionedRecordChange) => Promise<number>;
1485
1516
  syncCompleteOutgoingSync: (record: Record) => Promise<void>;
1486
1517
  syncGetPendingOutgoingChanges: (limit: number) => Promise<OutgoingChange[]>;
@@ -1504,6 +1535,15 @@ export interface StorageListPaymentsRequest {
1504
1535
  sortAscending?: boolean;
1505
1536
  }
1506
1537
 
1538
+ export interface StoredCrossChainSwap {
1539
+ provider: string;
1540
+ id: string;
1541
+ isTerminal: boolean;
1542
+ updatedAt: number;
1543
+ data: string;
1544
+ secrets: string;
1545
+ }
1546
+
1507
1547
  export interface Symbol {
1508
1548
  grapheme?: string;
1509
1549
  template?: string;
@@ -1637,12 +1677,30 @@ export type BuyBitcoinRequest = { type: "moonpay"; lockedAmountSat?: number; red
1637
1677
 
1638
1678
  export type ChainApiType = "esplora" | "mempoolSpace";
1639
1679
 
1680
+ export type ConversionChain = { type: "spark" } | { type: "lightning" } | { type: "external"; name: string; chainId?: string };
1681
+
1682
+ export type ConversionFilter = "ammRefundNeeded" | "orchestraPending" | "boltzPending";
1683
+
1684
+ export type ConversionInfo = { type: "amm"; poolId: string; conversionId: string; status: ConversionStatus; fee?: string; purpose?: ConversionPurpose; amountAdjustment?: AmountAdjustmentReason } | { 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 };
1685
+
1686
+ export type ConversionProvider = "amm" | "orchestra" | "boltz";
1687
+
1640
1688
  export type ConversionPurpose = { type: "ongoingPayment"; paymentRequest: string } | { type: "selfTransfer" } | { type: "autoConversion" };
1641
1689
 
1642
1690
  export type ConversionStatus = "pending" | "completed" | "failed" | "refundNeeded" | "refunded";
1643
1691
 
1644
1692
  export type ConversionType = { type: "fromBitcoin" } | { type: "toBitcoin"; fromTokenIdentifier: string };
1645
1693
 
1694
+ export type CrossChainAddressFamily = "evm" | "solana" | "tron";
1695
+
1696
+ export type CrossChainFeeMode = "feesExcluded" | "feesIncluded";
1697
+
1698
+ export type CrossChainProvider = "orchestra" | "boltz";
1699
+
1700
+ export type CrossChainProviderContext = { type: "orchestra"; quoteId: string; depositAddress: string; depositAmount?: string } | { type: "boltz"; swapId: string; invoice: string; invoiceAmountSats?: number; maxSlippageBps: number };
1701
+
1702
+ export type CrossChainRouteFilter = { type: "send"; addressDetails: CrossChainAddressDetails } | { type: "receive"; contractAddress?: string };
1703
+
1646
1704
  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 };
1647
1705
 
1648
1706
  export type ExternalFrostDerivation = { type: "signingLeaf"; leafId: ExternalTreeNodeId } | { type: "staticDeposit"; index: number } | { type: "htlcPreimage" } | { type: "identity" };
@@ -1655,7 +1713,7 @@ export type Fee = { type: "fixed"; amount: number } | { type: "rate"; satPerVbyt
1655
1713
 
1656
1714
  export type FeePolicy = "feesExcluded" | "feesIncluded";
1657
1715
 
1658
- 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);
1716
+ 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);
1659
1717
 
1660
1718
  export type LnurlCallbackStatus = { type: "ok" } | { type: "errorStatus"; errorDetails: LnurlErrorDetails };
1661
1719
 
@@ -1669,12 +1727,14 @@ export type OptimizationMode = "full" | "singleRound";
1669
1727
 
1670
1728
  export type OptimizationOutcome = { type: "completed"; roundsExecuted: number } | { type: "inProgress" };
1671
1729
 
1672
- 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 } | { type: "withdraw"; txId: string } | { type: "deposit"; txId: string; vout: number };
1730
+ 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 };
1673
1731
 
1674
1732
  export type PaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
1675
1733
 
1676
1734
  export type PaymentMethod = "lightning" | "spark" | "token" | "deposit" | "withdraw" | "unknown";
1677
1735
 
1736
+ export type PaymentRequest = { type: "input"; input: string } | { type: "crossChain"; address: string; route: CrossChainRoutePair; maxSlippageBps?: number; targetOverpayBps?: number };
1737
+
1678
1738
  export type PaymentStatus = "completed" | "pending" | "failed";
1679
1739
 
1680
1740
  export type PaymentType = "send" | "receive";
@@ -1687,7 +1747,7 @@ export type SdkEvent = { type: "synced" } | { type: "unclaimedDeposits"; unclaim
1687
1747
 
1688
1748
  export type Seed = { type: "mnemonic"; mnemonic: string; passphrase?: string } | ({ type: "entropy" } & number[]);
1689
1749
 
1690
- 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 };
1750
+ 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 };
1691
1751
 
1692
1752
  export type SendPaymentOptions = { type: "bitcoinAddress"; confirmationSpeed: OnchainConfirmationSpeed } | { type: "bolt11Invoice"; preferSpark: boolean; completionTimeoutSecs?: number } | { type: "sparkAddress"; htlcOptions?: SparkHtlcOptions };
1693
1753
 
@@ -1695,11 +1755,13 @@ export type ServiceStatus = "operational" | "degraded" | "partial" | "unknown" |
1695
1755
 
1696
1756
  export type SessionStoreError = { type: "notFound" } | ({ type: "generic" } & string);
1697
1757
 
1758
+ export type SourceAsset = { type: "bitcoin" } | { type: "token"; tokenIdentifier: string };
1759
+
1698
1760
  export type SparkHtlcStatus = "waitingForPreimage" | "preimageShared" | "returned";
1699
1761
 
1700
1762
  export type StableBalanceActiveLabel = { type: "set"; label: string } | { type: "unset" };
1701
1763
 
1702
- export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionRefundNeeded?: boolean } | { type: "token"; conversionRefundNeeded?: boolean; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[] };
1764
+ export type StoragePaymentDetailsFilter = { type: "spark"; htlcStatus?: SparkHtlcStatus[]; conversionFilter?: ConversionFilter } | { type: "token"; conversionFilter?: ConversionFilter; txHash?: string; txType?: TokenTransactionType } | { type: "lightning"; htlcStatus?: SparkHtlcStatus[]; conversionFilter?: ConversionFilter };
1703
1765
 
1704
1766
  export type SuccessAction = { type: "aes"; data: AesSuccessActionData } | { type: "message"; data: MessageSuccessActionData } | { type: "url"; data: UrlSuccessActionData };
1705
1767
 
@@ -1748,6 +1810,7 @@ export class BreezSdk {
1748
1810
  deleteLightningAddress(): Promise<void>;
1749
1811
  disconnect(): Promise<void>;
1750
1812
  fetchConversionLimits(request: FetchConversionLimitsRequest): Promise<FetchConversionLimitsResponse>;
1813
+ getCrossChainRoutes(filter: CrossChainRouteFilter): Promise<CrossChainRoutePair[]>;
1751
1814
  getInfo(request: GetInfoRequest): Promise<GetInfoResponse>;
1752
1815
  getLightningAddress(): Promise<LightningAddressInfo | undefined>;
1753
1816
  getPayment(request: GetPaymentRequest): Promise<GetPaymentResponse>;
@@ -2092,6 +2155,14 @@ export function newSharedSdkContext(config: WasmSdkContextConfig): Promise<WasmS
2092
2155
  */
2093
2156
  export function postgresStorage(config: PostgresStorageConfig): WasmStorageConfig;
2094
2157
 
2158
+ /**
2159
+ * Runs automatically when the wasm module is instantiated. Installs the
2160
+ * panic hook so Rust panics surface as readable `console.error` output
2161
+ * (with the panic message + `file.rs:line`) instead of a bare
2162
+ * `RuntimeError: unreachable`.
2163
+ */
2164
+ export function start(): void;
2165
+
2095
2166
  /**
2096
2167
  * Entry point invoked by JavaScript in a worker.
2097
2168
  */