@sip-protocol/sdk 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.d.mts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +1334 -199
- package/dist/browser.mjs +19 -1
- package/dist/chunk-4IFOPYJF.mjs +11950 -0
- package/dist/chunk-4VJHI66K.mjs +12120 -0
- package/dist/chunk-5BAS4D44.mjs +10283 -0
- package/dist/chunk-6WOV2YNG.mjs +10179 -0
- package/dist/chunk-7IMRM7LN.mjs +12149 -0
- package/dist/chunk-DU7LQDD2.mjs +10148 -0
- package/dist/{chunk-AV37IZST.mjs → chunk-JNNXNTSS.mjs} +14 -0
- package/dist/chunk-KXN6IWL5.mjs +10736 -0
- package/dist/chunk-MR7HRCRS.mjs +10165 -0
- package/dist/chunk-NDGUWOOZ.mjs +10157 -0
- package/dist/chunk-O4Y2ZUDL.mjs +12721 -0
- package/dist/chunk-UPTISVCY.mjs +10304 -0
- package/dist/chunk-VITVG25F.mjs +982 -0
- package/dist/chunk-VXSHK7US.mjs +10158 -0
- package/dist/chunk-W3YXIQ7L.mjs +11950 -0
- package/dist/index-Ba7njCU3.d.ts +6925 -0
- package/dist/index-Co26-vbG.d.mts +6925 -0
- package/dist/{index-CAhjA4kh.d.mts → index-DqZoHYKI.d.mts} +362 -6
- package/dist/index-dTtK_DTl.d.ts +6762 -0
- package/dist/index-jnkYu-Z4.d.mts +6762 -0
- package/dist/{index-BFOKTz2z.d.ts → index-vB1N1mHd.d.ts} +362 -6
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1334 -199
- package/dist/index.mjs +19 -1
- package/dist/noir-BHQtFvRk.d.mts +467 -0
- package/dist/noir-BHQtFvRk.d.ts +467 -0
- package/package.json +14 -14
- package/src/index.ts +32 -0
- package/src/settlement/README.md +439 -0
- package/src/settlement/backends/direct-chain.ts +569 -0
- package/src/settlement/backends/index.ts +22 -0
- package/src/settlement/backends/near-intents.ts +480 -0
- package/src/settlement/backends/zcash-native.ts +516 -0
- package/src/settlement/index.ts +47 -0
- package/src/settlement/interface.ts +397 -0
- package/src/settlement/registry.ts +269 -0
- package/src/settlement/router.ts +383 -0
- package/LICENSE +0 -21
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _sip_protocol_types from '@sip-protocol/types';
|
|
2
|
-
import { ZKProof, PrivacyLevel, ShieldedIntent, CreateIntentParams, TrackedIntent, OneClickConfig, OneClickToken, OneClickQuoteRequest, OneClickQuoteResponse, OneClickDepositSubmit, OneClickStatusResponse, OneClickWithdrawal, ChainId, StealthMetaAddress, HexString, StealthAddress, StealthAddressRecovery, DefuseAssetId, Asset, OneClickSwapStatus, Quote, FulfillmentResult, ViewingKey, EncryptedTransaction, Commitment, Hash, IntentInput, IntentOutput, SIPSolver, Solver, SolverCapabilities, SolverVisibleIntent, SolverQuote, FulfillmentStatus, ZcashConfig, ZcashAddressInfo, ZcashNewAccount, ZcashReceiverType, ZcashAccountAddress, ZcashAccountBalance, ZcashUnspentNote, ZcashShieldedSendParams, ZcashOperation, ZcashBlockHeader, ZcashBlock, ZcashBlockchainInfo, ZcashNetworkInfo, StablecoinSymbol, PaymentPurpose, ShieldedPayment, CreatePaymentParams, TrackedPayment, CreateTreasuryParams, TreasuryConfig, TreasuryMember, CreatePaymentProposalParams, TreasuryProposal, CreateBatchProposalParams, AuditorViewingKey, TreasuryBalance, CreateComplianceConfigParams, ComplianceConfig, RegisterAuditorParams, AuditorRegistration, AuditScope, DisclosedTransaction, DisclosureRequest, GenerateReportParams, ComplianceReport, AuditLogEntry, WalletAdapter as WalletAdapter$1, WalletConnectionState, WalletEventType, WalletEventHandler, WalletEvent, Signature, UnsignedTransaction, SignedTransaction, TransactionReceipt, WalletErrorCodeType, WalletRegistryEntry, WalletInfo, PrivateWalletAdapter, WalletAdapterFactory } from '@sip-protocol/types';
|
|
2
|
+
import { ZKProof, PrivacyLevel, ShieldedIntent, CreateIntentParams, TrackedIntent, OneClickConfig, OneClickToken, OneClickQuoteRequest, OneClickQuoteResponse, OneClickDepositSubmit, OneClickStatusResponse, OneClickWithdrawal, ChainId, StealthMetaAddress, HexString, StealthAddress, StealthAddressRecovery, DefuseAssetId, Asset, OneClickSwapStatus, Quote as Quote$1, FulfillmentResult, ViewingKey, EncryptedTransaction, Commitment, Hash, IntentInput, IntentOutput, SIPSolver, Solver, SolverCapabilities, SolverVisibleIntent, SolverQuote, FulfillmentStatus, ZcashConfig, ZcashAddressInfo, ZcashNewAccount, ZcashReceiverType, ZcashAccountAddress, ZcashAccountBalance, ZcashUnspentNote, ZcashShieldedSendParams, ZcashOperation, ZcashBlockHeader, ZcashBlock, ZcashBlockchainInfo, ZcashNetworkInfo, StablecoinSymbol, PaymentPurpose, ShieldedPayment, CreatePaymentParams, TrackedPayment, CreateTreasuryParams, TreasuryConfig, TreasuryMember, CreatePaymentProposalParams, TreasuryProposal, CreateBatchProposalParams, AuditorViewingKey, TreasuryBalance, CreateComplianceConfigParams, ComplianceConfig, RegisterAuditorParams, AuditorRegistration, AuditScope, DisclosedTransaction, DisclosureRequest, GenerateReportParams, ComplianceReport, AuditLogEntry, WalletAdapter as WalletAdapter$1, WalletConnectionState, WalletEventType, WalletEventHandler, WalletEvent, Signature, UnsignedTransaction, SignedTransaction, TransactionReceipt, WalletErrorCodeType, WalletRegistryEntry, WalletInfo, PrivateWalletAdapter, WalletAdapterFactory } from '@sip-protocol/types';
|
|
3
3
|
import { c as ProofProvider, d as ProofFramework, F as FundingProofParams, P as ProofResult, V as ValidityProofParams, a as FulfillmentProofParams } from './noir-BTyLXLlZ.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -1379,7 +1379,7 @@ interface PreparedSwap {
|
|
|
1379
1379
|
/**
|
|
1380
1380
|
* Result of executing a swap
|
|
1381
1381
|
*/
|
|
1382
|
-
interface SwapResult {
|
|
1382
|
+
interface SwapResult$1 {
|
|
1383
1383
|
/** Request ID */
|
|
1384
1384
|
requestId: string;
|
|
1385
1385
|
/** 1Click quote ID */
|
|
@@ -1522,7 +1522,7 @@ declare class NEARIntentsAdapter {
|
|
|
1522
1522
|
* @param senderAddress - Sender's address for refunds
|
|
1523
1523
|
* @returns Swap result with deposit instructions
|
|
1524
1524
|
*/
|
|
1525
|
-
initiateSwap(request: SwapRequest, recipientMetaAddress?: StealthMetaAddress | string, senderAddress?: string): Promise<SwapResult>;
|
|
1525
|
+
initiateSwap(request: SwapRequest, recipientMetaAddress?: StealthMetaAddress | string, senderAddress?: string): Promise<SwapResult$1>;
|
|
1526
1526
|
/**
|
|
1527
1527
|
* Convert SIP asset to Defuse asset identifier
|
|
1528
1528
|
*/
|
|
@@ -1618,7 +1618,7 @@ interface WalletAdapter {
|
|
|
1618
1618
|
/**
|
|
1619
1619
|
* Extended quote with deposit info for production mode
|
|
1620
1620
|
*/
|
|
1621
|
-
interface ProductionQuote extends Quote {
|
|
1621
|
+
interface ProductionQuote extends Quote$1 {
|
|
1622
1622
|
/** Deposit address for input tokens (production mode only) */
|
|
1623
1623
|
depositAddress?: string;
|
|
1624
1624
|
/** Raw 1Click quote response (production mode only) */
|
|
@@ -1736,7 +1736,7 @@ declare class SIP {
|
|
|
1736
1736
|
* @param options - Execution options
|
|
1737
1737
|
* @returns Fulfillment result with transaction hash (when available)
|
|
1738
1738
|
*/
|
|
1739
|
-
execute(intent: TrackedIntent, quote: Quote | ProductionQuote, options?: {
|
|
1739
|
+
execute(intent: TrackedIntent, quote: Quote$1 | ProductionQuote, options?: {
|
|
1740
1740
|
/** Callback when deposit is required */
|
|
1741
1741
|
onDepositRequired?: (depositAddress: string, amount: string) => Promise<string>;
|
|
1742
1742
|
/** Callback for status updates */
|
|
@@ -2649,6 +2649,362 @@ declare class MockSolver implements SIPSolver {
|
|
|
2649
2649
|
*/
|
|
2650
2650
|
declare function createMockSolver(config?: MockSolverConfig): MockSolver;
|
|
2651
2651
|
|
|
2652
|
+
/**
|
|
2653
|
+
* Settlement Backend Interface for SIP Protocol
|
|
2654
|
+
*
|
|
2655
|
+
* Defines a pluggable settlement layer abstraction for executing cross-chain swaps.
|
|
2656
|
+
* Implementations can use NEAR Intents, Zcash, THORChain, or direct on-chain execution.
|
|
2657
|
+
*
|
|
2658
|
+
* @module settlement/interface
|
|
2659
|
+
*/
|
|
2660
|
+
|
|
2661
|
+
/**
|
|
2662
|
+
* Settlement backend name type
|
|
2663
|
+
*/
|
|
2664
|
+
type SettlementBackendName = 'near-intents' | 'zcash' | 'thorchain' | 'direct-chain' | string;
|
|
2665
|
+
/**
|
|
2666
|
+
* Swap status enum
|
|
2667
|
+
*/
|
|
2668
|
+
declare enum SwapStatus {
|
|
2669
|
+
/** Quote generated, awaiting deposit */
|
|
2670
|
+
PENDING_DEPOSIT = "pending_deposit",
|
|
2671
|
+
/** Deposit confirmed, awaiting execution */
|
|
2672
|
+
DEPOSIT_CONFIRMED = "deposit_confirmed",
|
|
2673
|
+
/** Swap in progress */
|
|
2674
|
+
IN_PROGRESS = "in_progress",
|
|
2675
|
+
/** Swap completed successfully */
|
|
2676
|
+
SUCCESS = "success",
|
|
2677
|
+
/** Swap failed */
|
|
2678
|
+
FAILED = "failed",
|
|
2679
|
+
/** Swap cancelled or expired */
|
|
2680
|
+
CANCELLED = "cancelled",
|
|
2681
|
+
/** Refund initiated */
|
|
2682
|
+
REFUNDING = "refunding",
|
|
2683
|
+
/** Refund completed */
|
|
2684
|
+
REFUNDED = "refunded"
|
|
2685
|
+
}
|
|
2686
|
+
/**
|
|
2687
|
+
* Parameters for requesting a quote
|
|
2688
|
+
*/
|
|
2689
|
+
interface QuoteParams {
|
|
2690
|
+
/** Source chain */
|
|
2691
|
+
fromChain: ChainId;
|
|
2692
|
+
/** Destination chain */
|
|
2693
|
+
toChain: ChainId;
|
|
2694
|
+
/** Source token symbol */
|
|
2695
|
+
fromToken: string;
|
|
2696
|
+
/** Destination token symbol */
|
|
2697
|
+
toToken: string;
|
|
2698
|
+
/** Amount to swap (in smallest units) */
|
|
2699
|
+
amount: bigint;
|
|
2700
|
+
/** Privacy level */
|
|
2701
|
+
privacyLevel: PrivacyLevel;
|
|
2702
|
+
/** Recipient's stealth meta-address (for shielded/compliant modes) */
|
|
2703
|
+
recipientMetaAddress?: StealthMetaAddress | string;
|
|
2704
|
+
/** Sender's address for refunds (for transparent mode or refunds) */
|
|
2705
|
+
senderAddress?: string;
|
|
2706
|
+
/** Maximum acceptable slippage in basis points (100 = 1%) */
|
|
2707
|
+
slippageTolerance?: number;
|
|
2708
|
+
/** Deadline for swap expiry (Unix timestamp in seconds) */
|
|
2709
|
+
deadline?: number;
|
|
2710
|
+
}
|
|
2711
|
+
/**
|
|
2712
|
+
* Quote response
|
|
2713
|
+
*/
|
|
2714
|
+
interface Quote {
|
|
2715
|
+
/** Unique quote identifier */
|
|
2716
|
+
quoteId: string;
|
|
2717
|
+
/** Expected input amount (in smallest units) */
|
|
2718
|
+
amountIn: string;
|
|
2719
|
+
/** Expected output amount (in smallest units) */
|
|
2720
|
+
amountOut: string;
|
|
2721
|
+
/** Minimum output amount after slippage (in smallest units) */
|
|
2722
|
+
minAmountOut: string;
|
|
2723
|
+
/** Estimated price impact in basis points */
|
|
2724
|
+
priceImpact?: number;
|
|
2725
|
+
/** Estimated fees (network + protocol) */
|
|
2726
|
+
fees: {
|
|
2727
|
+
/** Network gas fees (in native token) */
|
|
2728
|
+
networkFee: string;
|
|
2729
|
+
/** Protocol/solver fees (in output token) */
|
|
2730
|
+
protocolFee: string;
|
|
2731
|
+
/** Total fees in USD (optional) */
|
|
2732
|
+
totalFeeUSD?: string;
|
|
2733
|
+
};
|
|
2734
|
+
/** Deposit address for input tokens */
|
|
2735
|
+
depositAddress: string;
|
|
2736
|
+
/** Recipient address (stealth address if privacy mode) */
|
|
2737
|
+
recipientAddress: string;
|
|
2738
|
+
/** Refund address (if deposit fails or expires) */
|
|
2739
|
+
refundAddress?: string;
|
|
2740
|
+
/** Quote expiration timestamp */
|
|
2741
|
+
expiresAt: number;
|
|
2742
|
+
/** Expected execution time in seconds */
|
|
2743
|
+
estimatedTime?: number;
|
|
2744
|
+
/** Swap route details (optional, for transparency) */
|
|
2745
|
+
route?: SwapRoute;
|
|
2746
|
+
/** Backend-specific metadata */
|
|
2747
|
+
metadata?: Record<string, unknown>;
|
|
2748
|
+
}
|
|
2749
|
+
/**
|
|
2750
|
+
* Swap route details
|
|
2751
|
+
*/
|
|
2752
|
+
interface SwapRoute {
|
|
2753
|
+
/** Route steps */
|
|
2754
|
+
steps: SwapRouteStep[];
|
|
2755
|
+
/** Total number of hops */
|
|
2756
|
+
hops: number;
|
|
2757
|
+
}
|
|
2758
|
+
/**
|
|
2759
|
+
* Individual swap route step
|
|
2760
|
+
*/
|
|
2761
|
+
interface SwapRouteStep {
|
|
2762
|
+
/** Protocol/DEX name */
|
|
2763
|
+
protocol: string;
|
|
2764
|
+
/** Input token */
|
|
2765
|
+
tokenIn: Asset;
|
|
2766
|
+
/** Output token */
|
|
2767
|
+
tokenOut: Asset;
|
|
2768
|
+
/** Pool/pair identifier */
|
|
2769
|
+
poolId?: string;
|
|
2770
|
+
}
|
|
2771
|
+
/**
|
|
2772
|
+
* Parameters for executing a swap
|
|
2773
|
+
*/
|
|
2774
|
+
interface SwapParams {
|
|
2775
|
+
/** Quote identifier from getQuote() */
|
|
2776
|
+
quoteId: string;
|
|
2777
|
+
/** Transaction hash of deposit (if already deposited) */
|
|
2778
|
+
depositTxHash?: string;
|
|
2779
|
+
/** NEAR account (if depositing from NEAR) */
|
|
2780
|
+
nearAccount?: string;
|
|
2781
|
+
/** Additional backend-specific parameters */
|
|
2782
|
+
metadata?: Record<string, unknown>;
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Swap execution result
|
|
2786
|
+
*/
|
|
2787
|
+
interface SwapResult {
|
|
2788
|
+
/** Unique swap identifier */
|
|
2789
|
+
swapId: string;
|
|
2790
|
+
/** Current status */
|
|
2791
|
+
status: SwapStatus;
|
|
2792
|
+
/** Quote ID */
|
|
2793
|
+
quoteId: string;
|
|
2794
|
+
/** Deposit address */
|
|
2795
|
+
depositAddress: string;
|
|
2796
|
+
/** Deposit transaction hash (after deposit) */
|
|
2797
|
+
depositTxHash?: string;
|
|
2798
|
+
/** Settlement transaction hash (after completion) */
|
|
2799
|
+
settlementTxHash?: string;
|
|
2800
|
+
/** Refund transaction hash (if refunded) */
|
|
2801
|
+
refundTxHash?: string;
|
|
2802
|
+
/** Actual output amount (after completion) */
|
|
2803
|
+
actualAmountOut?: string;
|
|
2804
|
+
/** Error message (if failed) */
|
|
2805
|
+
errorMessage?: string;
|
|
2806
|
+
/** Backend-specific metadata */
|
|
2807
|
+
metadata?: Record<string, unknown>;
|
|
2808
|
+
}
|
|
2809
|
+
/**
|
|
2810
|
+
* Swap status response
|
|
2811
|
+
*/
|
|
2812
|
+
interface SwapStatusResponse {
|
|
2813
|
+
/** Unique swap identifier */
|
|
2814
|
+
swapId: string;
|
|
2815
|
+
/** Current status */
|
|
2816
|
+
status: SwapStatus;
|
|
2817
|
+
/** Quote ID */
|
|
2818
|
+
quoteId: string;
|
|
2819
|
+
/** Deposit address */
|
|
2820
|
+
depositAddress: string;
|
|
2821
|
+
/** Expected input amount */
|
|
2822
|
+
amountIn: string;
|
|
2823
|
+
/** Expected output amount */
|
|
2824
|
+
amountOut: string;
|
|
2825
|
+
/** Deposit transaction hash (after deposit) */
|
|
2826
|
+
depositTxHash?: string;
|
|
2827
|
+
/** Settlement transaction hash (after completion) */
|
|
2828
|
+
settlementTxHash?: string;
|
|
2829
|
+
/** Refund transaction hash (if refunded) */
|
|
2830
|
+
refundTxHash?: string;
|
|
2831
|
+
/** Actual output amount (after completion) */
|
|
2832
|
+
actualAmountOut?: string;
|
|
2833
|
+
/** Error message (if failed) */
|
|
2834
|
+
errorMessage?: string;
|
|
2835
|
+
/** Stealth address for recipient (if privacy mode) */
|
|
2836
|
+
stealthRecipient?: string;
|
|
2837
|
+
/** Ephemeral public key (for recipient to derive stealth key) */
|
|
2838
|
+
ephemeralPublicKey?: string;
|
|
2839
|
+
/** Last updated timestamp */
|
|
2840
|
+
updatedAt: number;
|
|
2841
|
+
/** Backend-specific metadata */
|
|
2842
|
+
metadata?: Record<string, unknown>;
|
|
2843
|
+
}
|
|
2844
|
+
/**
|
|
2845
|
+
* Backend capabilities descriptor
|
|
2846
|
+
*/
|
|
2847
|
+
interface BackendCapabilities {
|
|
2848
|
+
/** Supported source chains */
|
|
2849
|
+
supportedSourceChains: ChainId[];
|
|
2850
|
+
/** Supported destination chains */
|
|
2851
|
+
supportedDestinationChains: ChainId[];
|
|
2852
|
+
/** Supported privacy levels */
|
|
2853
|
+
supportedPrivacyLevels: PrivacyLevel[];
|
|
2854
|
+
/** Maximum swap amount (in USD, undefined = no limit) */
|
|
2855
|
+
maxSwapAmountUSD?: number;
|
|
2856
|
+
/** Minimum swap amount (in USD, undefined = no limit) */
|
|
2857
|
+
minSwapAmountUSD?: number;
|
|
2858
|
+
/** Supports cancellation */
|
|
2859
|
+
supportsCancellation: boolean;
|
|
2860
|
+
/** Supports refunds */
|
|
2861
|
+
supportsRefunds: boolean;
|
|
2862
|
+
/** Average execution time in seconds */
|
|
2863
|
+
averageExecutionTime?: number;
|
|
2864
|
+
/** Additional backend-specific capabilities */
|
|
2865
|
+
features?: string[];
|
|
2866
|
+
}
|
|
2867
|
+
/**
|
|
2868
|
+
* Settlement Backend Interface
|
|
2869
|
+
*
|
|
2870
|
+
* All settlement backends must implement this interface.
|
|
2871
|
+
* This allows SIP to support multiple settlement layers (NEAR Intents, Zcash, THORChain, etc.)
|
|
2872
|
+
*
|
|
2873
|
+
* @example
|
|
2874
|
+
* ```typescript
|
|
2875
|
+
* class MySettlementBackend implements SettlementBackend {
|
|
2876
|
+
* name = 'my-backend'
|
|
2877
|
+
* supportedChains = ['ethereum', 'solana']
|
|
2878
|
+
*
|
|
2879
|
+
* async getQuote(params: QuoteParams): Promise<Quote> {
|
|
2880
|
+
* // Implementation
|
|
2881
|
+
* }
|
|
2882
|
+
*
|
|
2883
|
+
* async executeSwap(params: SwapParams): Promise<SwapResult> {
|
|
2884
|
+
* // Implementation
|
|
2885
|
+
* }
|
|
2886
|
+
*
|
|
2887
|
+
* async getStatus(swapId: string): Promise<SwapStatusResponse> {
|
|
2888
|
+
* // Implementation
|
|
2889
|
+
* }
|
|
2890
|
+
* }
|
|
2891
|
+
* ```
|
|
2892
|
+
*/
|
|
2893
|
+
interface SettlementBackend {
|
|
2894
|
+
/**
|
|
2895
|
+
* Backend name (e.g., 'near-intents', 'zcash', 'thorchain')
|
|
2896
|
+
*/
|
|
2897
|
+
readonly name: SettlementBackendName;
|
|
2898
|
+
/**
|
|
2899
|
+
* Backend capabilities
|
|
2900
|
+
*/
|
|
2901
|
+
readonly capabilities: BackendCapabilities;
|
|
2902
|
+
/**
|
|
2903
|
+
* Get a quote for a cross-chain swap
|
|
2904
|
+
*
|
|
2905
|
+
* @param params - Quote parameters
|
|
2906
|
+
* @returns Quote with pricing, fees, and deposit address
|
|
2907
|
+
* @throws {ValidationError} If parameters are invalid
|
|
2908
|
+
* @throws {NetworkError} If backend API is unavailable
|
|
2909
|
+
*/
|
|
2910
|
+
getQuote(params: QuoteParams): Promise<Quote>;
|
|
2911
|
+
/**
|
|
2912
|
+
* Execute a swap using a quote
|
|
2913
|
+
*
|
|
2914
|
+
* For most backends, this returns a deposit address and waits for user deposit.
|
|
2915
|
+
* Some backends may require additional signing or approval.
|
|
2916
|
+
*
|
|
2917
|
+
* @param params - Swap execution parameters
|
|
2918
|
+
* @returns Swap result with status and transaction details
|
|
2919
|
+
* @throws {ValidationError} If quote is invalid or expired
|
|
2920
|
+
* @throws {NetworkError} If backend API is unavailable
|
|
2921
|
+
*/
|
|
2922
|
+
executeSwap(params: SwapParams): Promise<SwapResult>;
|
|
2923
|
+
/**
|
|
2924
|
+
* Get current swap status
|
|
2925
|
+
*
|
|
2926
|
+
* @param swapId - Swap identifier (typically the deposit address)
|
|
2927
|
+
* @returns Current swap status
|
|
2928
|
+
* @throws {ValidationError} If swap ID is invalid
|
|
2929
|
+
* @throws {NetworkError} If backend API is unavailable
|
|
2930
|
+
*/
|
|
2931
|
+
getStatus(swapId: string): Promise<SwapStatusResponse>;
|
|
2932
|
+
/**
|
|
2933
|
+
* Cancel a pending swap (optional)
|
|
2934
|
+
*
|
|
2935
|
+
* Only supported by backends with cancellation capabilities.
|
|
2936
|
+
* Check `capabilities.supportsCancellation` before calling.
|
|
2937
|
+
*
|
|
2938
|
+
* @param swapId - Swap identifier to cancel
|
|
2939
|
+
* @throws {ValidationError} If swap cannot be cancelled (already executed, etc.)
|
|
2940
|
+
* @throws {NetworkError} If backend API is unavailable
|
|
2941
|
+
* @throws {ProofError} If cancellation is not supported
|
|
2942
|
+
*/
|
|
2943
|
+
cancel?(swapId: string): Promise<void>;
|
|
2944
|
+
/**
|
|
2945
|
+
* Wait for swap completion (optional)
|
|
2946
|
+
*
|
|
2947
|
+
* Polls swap status until completion or timeout.
|
|
2948
|
+
* Backends may provide more efficient implementations (webhooks, subscriptions).
|
|
2949
|
+
*
|
|
2950
|
+
* @param swapId - Swap identifier to monitor
|
|
2951
|
+
* @param options - Polling options
|
|
2952
|
+
* @returns Final swap status
|
|
2953
|
+
* @throws {ValidationError} If swap ID is invalid
|
|
2954
|
+
* @throws {NetworkError} If backend API is unavailable
|
|
2955
|
+
*/
|
|
2956
|
+
waitForCompletion?(swapId: string, options?: {
|
|
2957
|
+
/** Polling interval in milliseconds (default: 5000) */
|
|
2958
|
+
interval?: number;
|
|
2959
|
+
/** Maximum wait time in milliseconds (default: 600000 = 10 minutes) */
|
|
2960
|
+
timeout?: number;
|
|
2961
|
+
/** Status change callback */
|
|
2962
|
+
onStatusChange?: (status: SwapStatusResponse) => void;
|
|
2963
|
+
}): Promise<SwapStatusResponse>;
|
|
2964
|
+
/**
|
|
2965
|
+
* Get a dry quote (preview without creating deposit address)
|
|
2966
|
+
*
|
|
2967
|
+
* Useful for showing estimates without committing to a swap.
|
|
2968
|
+
* Not all backends support this (return same as getQuote if not).
|
|
2969
|
+
*
|
|
2970
|
+
* @param params - Quote parameters
|
|
2971
|
+
* @returns Quote preview
|
|
2972
|
+
*/
|
|
2973
|
+
getDryQuote?(params: QuoteParams): Promise<Quote>;
|
|
2974
|
+
/**
|
|
2975
|
+
* Notify backend of deposit transaction (optional)
|
|
2976
|
+
*
|
|
2977
|
+
* Some backends require explicit notification after user deposits.
|
|
2978
|
+
* Check backend documentation for requirements.
|
|
2979
|
+
*
|
|
2980
|
+
* @param swapId - Swap identifier (typically deposit address)
|
|
2981
|
+
* @param txHash - Deposit transaction hash
|
|
2982
|
+
* @param metadata - Additional backend-specific data
|
|
2983
|
+
*/
|
|
2984
|
+
notifyDeposit?(swapId: string, txHash: string, metadata?: Record<string, unknown>): Promise<void>;
|
|
2985
|
+
}
|
|
2986
|
+
/**
|
|
2987
|
+
* Settlement backend factory function type
|
|
2988
|
+
*/
|
|
2989
|
+
type SettlementBackendFactory<TConfig = unknown> = (config: TConfig) => SettlementBackend;
|
|
2990
|
+
/**
|
|
2991
|
+
* Settlement backend registry entry
|
|
2992
|
+
*/
|
|
2993
|
+
interface SettlementBackendRegistry {
|
|
2994
|
+
/** Backend name */
|
|
2995
|
+
name: SettlementBackendName;
|
|
2996
|
+
/** Factory function */
|
|
2997
|
+
factory: SettlementBackendFactory;
|
|
2998
|
+
/** Human-readable display name */
|
|
2999
|
+
displayName: string;
|
|
3000
|
+
/** Description */
|
|
3001
|
+
description: string;
|
|
3002
|
+
/** Homepage URL */
|
|
3003
|
+
homepage?: string;
|
|
3004
|
+
/** Documentation URL */
|
|
3005
|
+
docs?: string;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
2652
3008
|
/**
|
|
2653
3009
|
* Zcash RPC Client
|
|
2654
3010
|
*
|
|
@@ -6059,4 +6415,4 @@ declare function createMockLedgerAdapter(config: Omit<MockHardwareConfig, 'devic
|
|
|
6059
6415
|
*/
|
|
6060
6416
|
declare function createMockTrezorAdapter(config: Omit<MockHardwareConfig, 'deviceType'>): MockTrezorAdapter;
|
|
6061
6417
|
|
|
6062
|
-
export { type CreateIntentOptions as $, getErrorMessage as A, BrowserNoirProvider as B, CryptoError as C, type SerializedError as D, ErrorCode as E, SIP as F, createSIP as G, createProductionSIP as H, IntentError as I, type SIPConfig as J, type ProductionQuote as K, IntentBuilder as L, type MobilePlatform as M, NetworkError as N, createShieldedIntent as O, type ProofProgressCallback as P, attachProofs as Q, hasRequiredProofs as R, SIPError as S, trackIntent as T, isExpired as U, ValidationError as V, type WalletAdapter as W, getTimeRemaining as X, serializeIntent as Y, deserializeIntent as Z, getIntentSummary as _, supportsSharedArrayBuffer as a, validateIntentInput as a$, generateStealthMetaAddress as a0, generateStealthAddress as a1, deriveStealthPrivateKey as a2, checkStealthAddress as a3, encodeStealthMetaAddress as a4, decodeStealthMetaAddress as a5, publicKeyToEthAddress as a6, isEd25519Chain as a7, getCurveForChain as a8, generateEd25519StealthMetaAddress as a9, withSecureBuffer as aA, withSecureBufferSync as aB, commit as aC, verifyOpening as aD, commitZero as aE, addCommitments as aF, subtractCommitments as aG, addBlindings as aH, subtractBlindings as aI, getGenerators as aJ, generateBlinding as aK, type PedersenCommitment as aL, type CommitmentPoint as aM, isValidChainId as aN, isValidPrivacyLevel as aO, isValidHex as aP, isValidHexLength as aQ, isValidAmount as aR, isNonNegativeAmount as aS, isValidSlippage as aT, isValidStealthMetaAddress as aU, isValidCompressedPublicKey as aV, isValidEd25519PublicKey as aW, isValidPrivateKey as aX, isValidScalar as aY, validateCreateIntentParams as aZ, validateAsset as a_, generateEd25519StealthAddress as aa, deriveEd25519StealthPrivateKey as ab, checkEd25519StealthAddress as ac, ed25519PublicKeyToSolanaAddress as ad, solanaAddressToEd25519PublicKey as ae, isValidSolanaAddress as af, ed25519PublicKeyToNearAddress as ag, nearAddressToEd25519PublicKey as ah, isValidNearImplicitAddress as ai, isValidNearAccountId as aj, type StealthCurve as ak, getPrivacyConfig as al, generateViewingKey as am, deriveViewingKey as an, encryptForViewing as ao, decryptWithViewing as ap, getPrivacyDescription as aq, type PrivacyConfig as ar, type TransactionData as as, createCommitment as at, verifyCommitment as au, generateIntentId as av, hash as aw, generateRandomBytes as ax, secureWipe as ay, secureWipeAll as az, bytesToHex as b,
|
|
6418
|
+
export { type CreateIntentOptions as $, getErrorMessage as A, BrowserNoirProvider as B, CryptoError as C, type SerializedError as D, ErrorCode as E, SIP as F, createSIP as G, createProductionSIP as H, IntentError as I, type SIPConfig as J, type ProductionQuote as K, IntentBuilder as L, type MobilePlatform as M, NetworkError as N, createShieldedIntent as O, type ProofProgressCallback as P, attachProofs as Q, hasRequiredProofs as R, SIPError as S, trackIntent as T, isExpired as U, ValidationError as V, type WalletAdapter as W, getTimeRemaining as X, serializeIntent as Y, deserializeIntent as Z, getIntentSummary as _, supportsSharedArrayBuffer as a, validateIntentInput as a$, generateStealthMetaAddress as a0, generateStealthAddress as a1, deriveStealthPrivateKey as a2, checkStealthAddress as a3, encodeStealthMetaAddress as a4, decodeStealthMetaAddress as a5, publicKeyToEthAddress as a6, isEd25519Chain as a7, getCurveForChain as a8, generateEd25519StealthMetaAddress as a9, withSecureBuffer as aA, withSecureBufferSync as aB, commit as aC, verifyOpening as aD, commitZero as aE, addCommitments as aF, subtractCommitments as aG, addBlindings as aH, subtractBlindings as aI, getGenerators as aJ, generateBlinding as aK, type PedersenCommitment as aL, type CommitmentPoint as aM, isValidChainId as aN, isValidPrivacyLevel as aO, isValidHex as aP, isValidHexLength as aQ, isValidAmount as aR, isNonNegativeAmount as aS, isValidSlippage as aT, isValidStealthMetaAddress as aU, isValidCompressedPublicKey as aV, isValidEd25519PublicKey as aW, isValidPrivateKey as aX, isValidScalar as aY, validateCreateIntentParams as aZ, validateAsset as a_, generateEd25519StealthAddress as aa, deriveEd25519StealthPrivateKey as ab, checkEd25519StealthAddress as ac, ed25519PublicKeyToSolanaAddress as ad, solanaAddressToEd25519PublicKey as ae, isValidSolanaAddress as af, ed25519PublicKeyToNearAddress as ag, nearAddressToEd25519PublicKey as ah, isValidNearImplicitAddress as ai, isValidNearAccountId as aj, type StealthCurve as ak, getPrivacyConfig as al, generateViewingKey as am, deriveViewingKey as an, encryptForViewing as ao, decryptWithViewing as ap, getPrivacyDescription as aq, type PrivacyConfig as ar, type TransactionData as as, createCommitment as at, verifyCommitment as au, generateIntentId as av, hash as aw, generateRandomBytes as ax, secureWipe as ay, secureWipeAll as az, bytesToHex as b, createZcashSwapService as b$, validateIntentOutput as b0, validateViewingKey as b1, validateScalar as b2, MockProofProvider as b3, verifyAttestation as b4, verifyOracleSignature as b5, signAttestationMessage as b6, deriveOracleId as b7, createOracleRegistry as b8, addOracle as b9, createNEARIntentsAdapter as bA, type SwapRequest as bB, type PreparedSwap as bC, type SwapResult$1 as bD, type NEARIntentsAdapterConfig as bE, MockSolver as bF, createMockSolver as bG, type MockSolverConfig as bH, SwapStatus as bI, type SettlementBackendName as bJ, type QuoteParams as bK, type Quote as bL, type SwapRoute as bM, type SwapRouteStep as bN, type SwapParams as bO, type SwapResult as bP, type SwapStatusResponse as bQ, type BackendCapabilities as bR, type SettlementBackend as bS, type SettlementBackendFactory as bT, type SettlementBackendRegistry as bU, ZcashRPCClient as bV, ZcashRPCError as bW, createZcashClient as bX, ZcashShieldedService as bY, createZcashShieldedService as bZ, ZcashSwapService as b_, removeOracle as ba, updateOracleStatus as bb, getActiveOracles as bc, hasEnoughOracles as bd, serializeAttestationMessage as be, deserializeAttestationMessage as bf, computeAttestationHash as bg, getChainNumericId as bh, ORACLE_DOMAIN as bi, ATTESTATION_VERSION as bj, DEFAULT_THRESHOLD as bk, DEFAULT_TOTAL_ORACLES as bl, CHAIN_NUMERIC_IDS as bm, type OracleId as bn, type OracleStatus as bo, type OracleInfo as bp, type OracleAttestationMessage as bq, type OracleSignature as br, type SignedOracleAttestation as bs, type OracleRegistry as bt, type OracleRegistryConfig as bu, type AttestationRequest as bv, type AttestationResult as bw, type VerificationResult as bx, OneClickClient as by, NEARIntentsAdapter as bz, detectMobileBrowser as c, MockEthereumAdapter as c$, type ZcashShieldedServiceConfig as c0, type ShieldedSendParams as c1, type ShieldedSendResult as c2, type ReceivedNote as c3, type ShieldedBalance as c4, type ExportedViewingKey as c5, type ZcashSwapServiceConfig as c6, type ZcashSwapSourceChain as c7, type ZcashSwapSourceToken as c8, type ZcashQuoteParams as c9, fromStablecoinUnits as cA, formatStablecoinAmount as cB, type CreatePaymentOptions as cC, type StablecoinInfo as cD, Treasury as cE, ComplianceManager as cF, BaseWalletAdapter as cG, MockWalletAdapter as cH, WalletError as cI, notConnectedError as cJ, featureNotSupportedError as cK, walletRegistry as cL, registerWallet as cM, createWalletFactory as cN, isPrivateWalletAdapter as cO, SolanaWalletAdapter as cP, createSolanaAdapter as cQ, MockSolanaAdapter as cR, createMockSolanaAdapter as cS, createMockSolanaProvider as cT, createMockSolanaConnection as cU, getSolanaProvider as cV, detectSolanaWallets as cW, solanaPublicKeyToHex as cX, base58ToHex as cY, EthereumWalletAdapter as cZ, createEthereumAdapter as c_, type ZcashQuote as ca, type ZcashSwapParams as cb, type ZcashSwapResult as cc, type ZcashSwapStatus as cd, type BridgeProvider as ce, type PriceFeed as cf, PaymentBuilder as cg, createShieldedPayment as ch, decryptMemo as ci, trackPayment as cj, isPaymentExpired as ck, getPaymentTimeRemaining as cl, serializePayment as cm, deserializePayment as cn, getPaymentSummary as co, STABLECOIN_INFO as cp, STABLECOIN_ADDRESSES as cq, STABLECOIN_DECIMALS as cr, getStablecoin as cs, getStablecoinsForChain as ct, isStablecoin as cu, getStablecoinInfo as cv, getSupportedStablecoins as cw, isStablecoinOnChain as cx, getChainsForStablecoin as cy, toStablecoinUnits as cz, detectMobilePlatform as d, type LedgerConfig as d$, createMockEthereumAdapter as d0, createMockEthereumProvider as d1, getEthereumProvider as d2, detectEthereumWallets as d3, toHex as d4, fromHex as d5, hexToNumber as d6, normalizeAddress as d7, getDefaultRpcEndpoint as d8, EthereumChainId as d9, type SolanaUnsignedTransaction as dA, type SolanaSignature as dB, type MockSolanaAdapterConfig as dC, type EIP1193Provider as dD, type EIP1193RequestArguments as dE, type EIP1193Event as dF, type EIP1193ConnectInfo as dG, type EIP1193ProviderRpcError as dH, type EIP712Domain as dI, type EIP712TypeDefinition as dJ, type EIP712Types as dK, type EIP712TypedData as dL, type EthereumTransactionRequest as dM, type EthereumTransactionReceipt as dN, type EthereumTokenMetadata as dO, type EthereumChainMetadata as dP, type EthereumWalletName as dQ, type EthereumAdapterConfig as dR, type EthereumChainIdType as dS, type MockEthereumAdapterConfig as dT, type HardwareWalletType as dU, type LedgerModel as dV, type TrezorModel as dW, type HardwareConnectionStatus as dX, type TransportType as dY, type HardwareDeviceInfo as dZ, type HardwareWalletConfig as d_, HardwareErrorCode as da, HardwareWalletError as db, DerivationPath as dc, getDerivationPath as dd, supportsWebUSB as de, supportsWebHID as df, supportsWebBluetooth as dg, getAvailableTransports as dh, LedgerWalletAdapter as di, createLedgerAdapter as dj, TrezorWalletAdapter as dk, createTrezorAdapter as dl, MockLedgerAdapter as dm, MockTrezorAdapter as dn, createMockLedgerAdapter as dp, createMockTrezorAdapter as dq, type SolanaPublicKey as dr, type SolanaTransaction as ds, type SolanaVersionedTransaction as dt, type SolanaWalletProvider as du, type SolanaWalletName as dv, type SolanaCluster as dw, type SolanaAdapterConfig as dx, type SolanaConnection as dy, type SolanaSendOptions as dz, getMobileDeviceInfo as e, type TrezorConfig as e0, type HardwareSignRequest as e1, type HardwareEthereumTx as e2, type HardwareSignature as e3, type HardwareAccount as e4, type HardwareTransport as e5, type HardwareErrorCodeType as e6, type MockHardwareConfig as e7, checkMobileWASMCompatibility as f, getBrowserInfo as g, hexToBytes as h, isBrowser as i, getBrowserVersion as j, getOSVersion as k, isTablet as l, supportsTouch as m, supportsWASMSimd as n, supportsWASMBulkMemory as o, type MobileBrowser as p, type MobileDeviceInfo as q, type MobileWASMCompatibility as r, supportsWebWorkers as s, type BrowserNoirProviderConfig as t, ProofError as u, ProofNotImplementedError as v, EncryptionNotImplementedError as w, isSIPError as x, hasErrorCode as y, wrapError as z };
|