import { cowAppDataLatestScheme } from '@cowprotocol/sdk-app-data'; import { Amounts, OrderKind, Address, EnrichedOrder, OrderBookApi } from '@cowprotocol/sdk-order-book'; import { ChainInfo, TargetChainId, SupportedChainId, TokenInfo, ChainId, AddressPerChain, EvmCall, CowEnv } from '@cowprotocol/sdk-config'; import { QuoterParameters, TraderParameters, TradeOptionalParameters, QuoteAndPost, QuoteResults, SwapAdvancedSettings, SigningStepManager, OrderPostingResult, TradingSdk } from '@cowprotocol/sdk-trading'; import { AccountAddress, SignerLike, TTLCache, AbstractProviderAdapter } from '@cowprotocol/sdk-common'; import { CowShedSdk, CowShedSdkOptions } from '@cowprotocol/sdk-cow-shed'; import { TokenResponse, QuoteRequest, QuoteResponse, GetExecutionStatusResponse } from '@defuse-protocol/one-click-sdk-typescript'; import { Address as Address$1, Hex } from 'viem'; type BridgeProviderType = 'ReceiverAccountBridgeProvider' | 'HookBridgeProvider'; interface BridgeProviderInfo { name: string; logoUrl: string; dappId: string; website: string; type: BridgeProviderType; } interface WithSellToken { sellTokenChainId: SupportedChainId; sellTokenAddress: Address; sellTokenDecimals: number; } interface WithBuyToken { buyTokenChainId: TargetChainId; buyTokenAddress: Address; buyTokenDecimals: number; } type WithQuoter = Omit; type WithTrader = Pick; type WithSwapAndBrideSlippage = Partial<{ swapSlippageBps: cowAppDataLatestScheme.SlippageBips; bridgeSlippageBps: cowAppDataLatestScheme.SlippageBips; }>; /** * Parameters for getting a bridge quote */ type QuoteBridgeRequest = { kind: OrderKind; amount: bigint; owner?: AccountAddress; /** Final recipient on destination chain. Can be non-EVM (Solana/BTC). * Used by bridge providers. Falls back to `receiver` then `account`. */ bridgeRecipient?: string; } & WithSellToken & WithBuyToken & WithQuoter & WithTrader & Omit & WithSwapAndBrideSlippage; type QuoteBridgeRequestWithoutAmount = Omit; interface BridgeQuoteResult { /** * Unique ID of a quote */ id?: string; /** * Provider who implement ReceiverAccountBridgeProvider must return a signature of a quote than will be used to verify the quote deposit address validity */ signature?: string; /** * For ReceiverAccountBridgeProvider, this is the attestation signature from the bridge provider that validates the deposit address. Empty for other provider types. */ attestationSignature?: string; /** * A stringified JSON of quote which is associated with the order. */ quoteBody?: string; /** * Whether the quote is a sell or buy order. */ isSell: boolean; /** * Costs and amounts of the bridging. */ amountsAndCosts: BridgeQuoteAmountsAndCosts; /** * The estimated time in seconds it takes to fill the order. */ expectedFillTimeSeconds?: number; /** * The timestamp of the quote. */ quoteTimestamp: number; fees: { /** * The amount that should go to the relayer as a fee to cover relayer capital costs. * In token atoms. */ bridgeFee: bigint; /** * The amount that should go to the relayer as a fee to cover relayer gas costs. * In token atoms. */ destinationGasFee: bigint; }; limits: { /** * The minimum amount that should be deposited in the source chain. * In token atoms. */ minDeposit: bigint; /** * The maximum amount that can be deposited in the source chain. * In token atoms. */ maxDeposit: bigint; }; } interface BridgeHook { postHook: cowAppDataLatestScheme.CoWHook; recipient: string; } declare enum BridgeStatus { IN_PROGRESS = "in_progress", EXECUTED = "executed", EXPIRED = "expired", REFUND = "refund", UNKNOWN = "unknown" } interface BridgeStatusResult { status: BridgeStatus; fillTimeInSeconds?: number; /** * Transaction hash of the deposit on the origin chain. */ depositTxHash?: string; /** * Transaction hash of the fill on the destination chain. * Only present when fillStatus is 'filled'. */ fillTxHash?: string; } /** * When sellChainId and/or sellTokenAddress are specified * then the buy tokens list will be additionally filtered */ interface BuyTokensParams { buyChainId: TargetChainId; sellChainId?: SupportedChainId; sellTokenAddress?: string; } interface GetProviderBuyTokens { tokens: TokenInfo[]; isRouteAvailable: boolean; } /** * A bridge deposit. It includes the provideer information, sell amount and the minimum buy amount. * * It models the minimal information for a bridging order. * */ interface BridgeDeposit extends Omit { readonly provider: BridgeProviderInfo; sellTokenAmount: string; minBuyAmount: string; } /** * Main interface for a bridge provider. * * It contains the main information about the provider, and the methods to get the quote, the bridging params, the status, the cancelling and the refunding of the bridging. */ interface BridgeProvider { type: BridgeProviderType; info: BridgeProviderInfo; /** * Get basic supported chains */ getNetworks(): Promise; /** * Get supported tokens for a chain */ getBuyTokens(params: BuyTokensParams): Promise; /** * Get intermediate tokens given a quote request. * * An intermediate token, is a token in the source chain, that could be used to bridge the tokens to the destination chain. * This method returns a sorted list of tokens, they are sorted by priority, so first tokens are more likely to be more liquid. * * @param request - The quote request */ getIntermediateTokens(request: QuoteBridgeRequest): Promise; /** * Get a quote for a bridge request. * * @param request - The quote request */ getQuote(request: QuoteBridgeRequest): Promise; /** * Get the identifier of the bridging transaction from the settlement transaction. * @param chainId * @param order - CoW Protocol order * @param txHash - The hash of the settlement transaction in which the bridging post-hook was executed * @param settlementContractOverride - Custom settlement contract address */ getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string, settlementContractOverride?: Partial): Promise<{ params: BridgingDepositParams; status: BridgeStatusResult; } | null>; /** * Get the explorer url for a bridging id. * * @param bridgingId - The bridging id */ getExplorerUrl(bridgingId: string): string; /** * Get the status of a bridging transaction. * * @param bridgingId - The bridging id * @param originChainId - id of network where funds were deposited */ getStatus(bridgingId: string, originChainId: SupportedChainId): Promise; getCancelBridgingTx(bridgingId: string): Promise; getRefundBridgingTx(bridgingId: string): Promise; } /** * A basic bridge provider that relies on sending the tokens to a specific account. * This provider doesn't rely on hooks to initiate the bridge. */ interface ReceiverAccountBridgeProvider extends BridgeProvider { type: 'ReceiverAccountBridgeProvider'; /** * Get the receiver account to where the tokens will be sent in the source chain so they are automatically bridged to the destination chain. * * @param quoteRequest - The quote request * @param quoteResult - The quote result * @returns The receiver account */ getBridgeReceiverOverride(quoteRequest: QuoteBridgeRequest, quoteResult: Q): Promise; } /** * A bridge provider that uses a hook to initiate the bridge. * */ interface HookBridgeProvider extends BridgeProvider { type: 'HookBridgeProvider'; /** * Get an unsigned bridge call for a quote. * * The transaction details should be executed in the context of cow-shed account. * * @param request - The quote request * @param quote - The quote * @returns The unsigned transaction details that cow-shed needs to sign */ getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: Q): Promise; /** * Returns the estimated gas cost for executing the bridge hook. * * This method helps calculate the final amount of tokens the user will receive more accurately. * The estimation is done without the amount parameter to break a circular dependency: * 1. Hook gas costs affect the final amount * 2. The final amount could affect hook gas costs * * By estimating gas costs independently, we can resolve this dependency cycle. * For some providers, the `extraGas` parameter adds additional gas‐unit buffer to the hook * and `extraGasProxyCreation` parameter adds additional gas‐unit buffer for the proxy creation * (see DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION and DEFAULT_EXTRA_GAS_PROXY_CREATION). */ getGasLimitEstimationForHook(request: Omit & { extraGas?: number; extraGasProxyCreation?: number; }): Promise; /** * Get a pre-authorized hook for initiating a bridge. * * The hook contains the ethereum call that the trampoline contract will need to execute during the settlement to initate the bridge. * * Typically, this hook will: * - Get the balance of cow-shed account * - Ensure the approval for the bridge lock contract is set * - Deposit into the bridge contract * * This hook will include the pre-authorization (signature) of the owner of the cow-shed account (the trader). */ getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise; /** * Decode a bridge hook into a bridge deposit information. * * This method is used to recover the information about the limit order placed into the bridge locking contract. * This allows to load an order from the orderbook and decode the bridging hook and understand what was the minimum buy amount the user signed to receive in the destination chain. * * @param hook - The bridge hook */ decodeBridgeHook(hook: cowAppDataLatestScheme.CoWHook): Promise; } /** * A quote and post for a cross-chain swap. * * If the order happens in a single chain, it returns the quote and post details for CoW Protocol. * If the order happens in multiple chains, it returns the quote and post details for CoW Protocol, the bridging * details, and a summary of the overall multi-step order. */ type CrossChainQuoteAndPost = QuoteAndPost | BridgeQuoteAndPost; interface BridgeQuoteAndPost { /** * The quote results for the CoW Protocol order. */ swap: QuoteResults; /** * The quote results for the bridging. * * Includes the bridging details. */ bridge: BridgeQuoteResults; /** * Callback to post the swap order. */ postSwapOrderFromQuote(advancedSettings?: SwapAdvancedSettings, signingStepManager?: SigningStepManager): Promise; } interface BridgeCosts { bridgingFee: { feeBps: number; amountInSellCurrency: T; amountInBuyCurrency: T; }; } interface BridgeQuoteAmountsAndCosts { /** * Costs of the bridging. */ costs: BridgeCosts; /** * Amounts before fees */ beforeFee: Amounts; /** * Amounts after fees. */ afterFee: Amounts; /** * Amounts after slippage tolerance. * * It includes the fees and the slippage tolerance, so its the minimum amount that the user will receive. */ afterSlippage: Amounts; /** * The slippage tolerance in basis points. */ slippageBps: number; } /** * Details about the bridge call. */ interface BridgeCallDetails { /** * Unsigned call to initiate the bridge. This call should be executed in the context of user's cow-shed account. */ unsignedBridgeCall: EvmCall; /** * Pre-authorized hook to initiate the bridge. This hook has been signed, and is ready to be executed by the * CoW Protocol Trampoline contract after settling the swap order that buys the intermediate token. */ preAuthorizedBridgingHook: BridgeHook; } interface BridgeQuoteResults extends BridgeQuoteResult { /** * Bridge provider information */ providerInfo: BridgeProviderInfo; /** * Trade parameters */ tradeParameters: QuoteBridgeRequest; /** * Bridge call details */ bridgeCallDetails?: BridgeCallDetails; /** * Bridge recipient override */ bridgeReceiverOverride?: string; } interface BridgingDepositParams { inputTokenAddress: Address; outputTokenAddress: Address; inputAmount: bigint; outputAmount: bigint | null; owner: Address; quoteTimestamp: number | null; fillDeadline: number | null; recipient: Address; sourceChainId: number; destinationChainId: number; bridgingId: string; } interface CrossChainOrder { provider: BridgeProvider; chainId: SupportedChainId; order: EnrichedOrder; statusResult: BridgeStatusResult; bridgingParams: BridgingDepositParams; tradeTxHash: string; explorerUrl?: string; } interface MultiQuoteResult { providerDappId: string; quote: BridgeQuoteAndPost | null; error?: Error; } /** * Callback function called when a quote result is available from a provider */ type MultiQuoteProgressCallback = (result: MultiQuoteResult) => void; /** * Callback function called when a better quote is found */ type BestQuoteProgressCallback = (result: MultiQuoteResult) => void; /** * Options for controlling the behavior of getMultiQuotes */ interface MultiQuoteOptions { /** * Callback function called as soon as each provider returns a result * Allows for progressive display of quotes without waiting for all providers */ onQuoteResult?: MultiQuoteProgressCallback; /** * Maximum time to wait for all providers to respond (in milliseconds) * Default: 40000 (40 seconds) */ totalTimeout?: number; /** * Maximum time to wait for each individual provider to respond (in milliseconds) * If a provider takes longer than this, it will be considered timed out * Default: 20000 (20 seconds) */ providerTimeout?: number; } interface MultiQuoteRequest { quoteBridgeRequest: QuoteBridgeRequest; intermediateTokensCache?: TTLCache; intermediateTokensTtl?: number; providerDappIds?: string[]; advancedSettings?: SwapAdvancedSettings; options?: MultiQuoteOptions; } interface MultiQuoteContext { provider: BridgeProvider; quoteBridgeRequest: QuoteBridgeRequest; advancedSettings: SwapAdvancedSettings | undefined; providerTimeout: number; onQuoteResult: MultiQuoteProgressCallback | undefined; } interface ProviderQuoteContext extends MultiQuoteContext { results: MultiQuoteResult[]; index: number; } interface BestQuoteProviderContext extends MultiQuoteContext { bestResult: { current: MultiQuoteResult | null; }; bestError: { current: MultiQuoteResult | null; }; } type DefaultBridgeProvider = BridgeProvider; declare enum BridgeQuoteErrors { NO_INTERMEDIATE_TOKENS = "NO_INTERMEDIATE_TOKENS", API_ERROR = "API_ERROR", INVALID_API_JSON_RESPONSE = "INVALID_API_JSON_RESPONSE", ONLY_SELL_ORDER_SUPPORTED = "ONLY_SELL_ORDER_SUPPORTED", TX_BUILD_ERROR = "TX_BUILD_ERROR", QUOTE_ERROR = "QUOTE_ERROR", NO_ROUTES = "NO_ROUTES", INVALID_BRIDGE = "INVALID_BRIDGE", QUOTE_DOES_NOT_MATCH_DEPOSIT_ADDRESS = "QUOTE_DOES_NOT_MATCH_DEPOSIT_ADDRESS", SELL_AMOUNT_TOO_SMALL = "SELL_AMOUNT_TOO_SMALL" } declare const BridgeQuoteErrorPriorities: Record; declare class BridgeProviderQuoteError extends Error { readonly context?: unknown | undefined; constructor(message: BridgeQuoteErrors, context?: unknown | undefined); } declare class BridgeProviderError extends Error { readonly context: unknown; constructor(message: string, context: unknown); } declare class BridgeOrderParsingError extends Error { readonly context?: unknown | undefined; constructor(message: string, context?: unknown | undefined); } declare function isBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): quote is BridgeQuoteAndPost; declare function isQuoteAndPost(quote: CrossChainQuoteAndPost): quote is QuoteAndPost; declare function assertIsBridgeQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is BridgeQuoteAndPost; declare function assertIsQuoteAndPost(quote: CrossChainQuoteAndPost): asserts quote is QuoteAndPost; declare function getPostHooks(fullAppData?: string | object): cowAppDataLatestScheme.CoWHook[]; declare function isAppDoc(appData: unknown): appData is cowAppDataLatestScheme.AppDataRootSchema; declare function isHookBridgeProvider(provider: BridgeProvider): provider is HookBridgeProvider; declare function isReceiverAccountBridgeProvider(provider: BridgeProvider): provider is ReceiverAccountBridgeProvider; type BridgingSdkConfig = Required>; /** * Cache configuration for BridgingSdk */ interface BridgingSdkCacheConfig { /** * Enable caching for target networks and buy tokens */ enabled: boolean; /** * TTL in milliseconds for getIntermediateTokens cache */ intermediateTokensTtl: number; /** * TTL in milliseconds for getBuyTokens cache */ buyTokensTtl: number; } interface BridgingSdkOptions { /** * Providers for the bridging. */ providers: BridgeProvider[]; /** * Trading SDK. */ tradingSdk?: TradingSdk; /** * Order book API. */ orderBookApi?: OrderBookApi; /** * Enable logging for the bridging SDK. */ enableLogging?: boolean; /** * Cache configuration for BridgingSdk */ cacheConfig?: BridgingSdkCacheConfig; } /** * Parameters for the `getOrder` method. */ interface GetOrderParams { /** * Id of a network where order was settled */ chainId: SupportedChainId; /** * The unique identifier of the order. */ orderId: string; /** * The environment of the order */ env?: CowEnv; /** * Custom settlement contract address */ settlementContractOverride?: Partial; } /** * SDK for bridging for swapping tokens between different chains. */ declare class BridgingSdk { readonly options: BridgingSdkOptions; protected config: BridgingSdkConfig; private cacheConfig; private intermediateTokensCache; private buyTokensCache; private singleQuoteStrategy; private multiQuoteStrategy; private bestQuoteStrategy; private availableProvidersIds; constructor(options: BridgingSdkOptions, adapter?: AbstractProviderAdapter); setAvailableProviders(ids: string[]): void; /** * Get the providers for the bridging. */ getAvailableProviders(): DefaultBridgeProvider[]; /** * Get the available sources networks for the bridging. */ getSourceNetworks(): Promise; /** * Get the available target networks for the bridging. */ getTargetNetworks(): Promise; /** * Get the available buy tokens for buying in a specific target chain * @param params */ getBuyTokens(params: BuyTokensParams): Promise; /** * Get quote details, including a callback function to post the order on-chain. * * This method support both, cross-chain swaps and single-chain swap. * * The return type will be either `QuoteAndPost` or `BridgeQuoteAndPost`. * * To safely assert the type in Typescript, you can use: * - `isBridgeQuoteAndPost(result)` utility. * - `isQuoteAndPost(result)` utility. * - `assertIsBridgeQuoteAndPost(result)` assertion. * - `assertIsQuoteAndPost(result)` assertion. * * @throws Error if no path is found */ getQuote(quoteBridgeRequest: QuoteBridgeRequest, advancedSettings?: SwapAdvancedSettings): Promise; /** * Get quotes from multiple bridge providers in parallel with progressive results. * * This method is specifically for cross-chain bridging quotes. For single-chain swaps, use getQuote() instead. * * Features: * - Progressive results: Use the `onQuoteResult` callback to receive quotes as soon as each provider responds * - Timeout support: Configure maximum wait time for all providers and individual provider timeouts * - Parallel execution: All providers are queried simultaneously for best performance * * @param request - The multi-quote request containing quote parameters, provider dappIds, and options * @returns Array of results, one for each provider (successful quotes or errors) * @throws Error if the request is for a single-chain swap (sellTokenChainId === buyTokenChainId) * ``` */ getMultiQuotes(request: MultiQuoteRequest): Promise; /** * Get the best quote from multiple bridge providers with progressive updates. * * This method is specifically for cross-chain bridging quotes. For single-chain swaps, use getQuote() instead. * * Features: * - Returns only the best quote based on buyAmount after slippage * - Progressive updates: Use the `onQuoteResult` callback to receive updates whenever a better quote is found * - Timeout support: Configure maximum wait time for all providers and individual provider timeouts * - Parallel execution: All providers are queried simultaneously for best performance * * @param request - The best quote request containing quote parameters, provider dappIds, and options * @returns The best quote result found, or null if no successful quotes were obtained * @throws Error if the request is for a single-chain swap (sellTokenChainId === buyTokenChainId) */ getBestQuote(request: MultiQuoteRequest): Promise; getOrder(params: GetOrderParams): Promise; getProviderFromAppData(fullAppData: string): DefaultBridgeProvider | undefined; /** * Clear all caches. Useful for testing and debugging. */ clearCache(): void; /** * Clean up expired cache entries. Useful for maintenance. */ cleanupExpiredCache(): void; /** * Get cache statistics for debugging. */ getCacheStats(): { intermediateTokens: number; buyTokens: number; }; getProviderByDappId(dappId: string): DefaultBridgeProvider | undefined; private getBuyTokensFromProvider; } declare const RAW_PROVIDERS_FILES_PATH = "https://files.cow.fi/cow-sdk/bridging/providers"; declare const DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION = 400000; declare const DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION = 350000; declare const COW_SHED_PROXY_CREATION_GAS = 360000; declare const DEFAULT_EXTRA_GAS_PROXY_CREATION = 400000; declare const HOOK_DAPP_BRIDGE_PROVIDER_PREFIX = "cow-sdk://bridging/providers"; declare const DEFAULT_BRIDGE_SLIPPAGE_BPS = 50; interface GetCrossChainOrderParams { chainId: SupportedChainId; orderId: string; orderBookApi: OrderBookApi; providers: BridgeProvider[]; env: CowEnv; settlementContractOverride?: Partial; } /** * Fetch a cross-chain order and its status. */ declare function getCrossChainOrder(params: GetCrossChainOrderParams): Promise; interface AvailableRoutesRequest { originChainId: string; originToken: string; destinationChainId: string; destinationToken: string; } interface Route { originChainId: string; originToken: string; destinationChainId: string; destinationToken: string; originTokenSymbol: string; destinationTokenSymbol: string; } interface SuggestedFeesRequest { token: string; originChainId: TargetChainId; destinationChainId: TargetChainId; /** * Amount of the token to transfer. * * Note that this amount is in the native decimals of the token. So, for WETH, this would be the amount of * human-readable WETH multiplied by 1e18. * * For USDC, you would multiply the number of human-readable USDC by 1e6. * * Example: 1000000000000000000 */ amount: bigint; /** * Recipient of the deposit. Can be an EOA or a contract. If this is an EOA and message is defined, then the API will throw a 4xx error. * * Example: 0xc186fA914353c44b2E33eBE05f21846F1048bEda */ recipient?: string; /** * The quote timestamp used to compute the LP fees. When bridging with across, the user only specifies the quote * timestamp in their transaction. The relayer then determines the utilization at that timestamp to determine the * user's fee. This timestamp must be close (within 10 minutes or so) to the current time on the chain where the * user is depositing funds and it should be <= the current block timestamp on mainnet. This allows the user to know * exactly what LP fee they will pay before sending the transaction. * * If this value isn't provided in the request, the API will assume the latest block timestamp on mainnet. * * Example: 1653547649 */ timestamp?: number; /** * Optionally override the relayer address used to simulate the fillRelay() call that estimates the gas costs * needed to fill a deposit. This simulation result impacts the returned suggested-fees. The reason to customize the * EOA would be primarily if the recipientAddress is a contract and requires a certain relayer to submit the fill, * or if one specific relayer has the necessary token balance to make the fill. * * Example: 0x428AB2BA90Eba0a4Be7aF34C9Ac451ab061AC010 */ relayer?: string; } interface SuggestedFeesLimits { /** * The minimum deposit size in the tokens' units. * * Note: USDC has 6 decimals, so this value would be the number of USDC multiplied by 1e6. For WETH, that would be 1e18. */ minDeposit: string; /** * The maximum deposit size in the tokens' units. Note: The formatting of this number is the same as minDeposit. */ maxDeposit: string; /** * The max deposit size that can be relayed "instantly" on the destination chain. * * Instantly means that there is relayer capital readily available and that a relayer is expected to relay within * seconds to 5 minutes of the deposit. */ maxDepositInstant: string; /** * The max deposit size that can be relayed with a "short delay" on the destination chain. * * This means that there is relayer capital available on mainnet and that a relayer will immediately begin moving * that capital over the canonical bridge to relay the deposit. Depending on the chain, the time for this can vary. * * Polygon is the worst case where it can take between 20 and 35 minutes for the relayer to receive the funds * and relay. * * Arbitrum is much faster, with a range between 5 and 15 minutes. Note: if the transfer size is greater than this, * the estimate should be between 2-4 hours for a slow relay to be processed from the mainnet pool. */ maxDepositShortDelay: string; /** * The recommended deposit size that can be relayed "instantly" on the destination chain. * * Instantly means that there is relayer capital readily available and that a relayer is expected to relay * within seconds to 5 minutes of the deposit. Value is in the smallest unit of the respective token. */ recommendedDepositInstant: string; } interface SuggestedFeesResponse { /** * Percentage of the transfer amount that should go to the relayer as a fee in total. The value is inclusive of lpFee.pct. * * This is the strongly recommended minimum value to ensure a relayer will perform the transfer under the current * network conditions. * * The value returned in this field is guaranteed to be at least 0.03% in order to meet minimum relayer fee requirements */ totalRelayFee: PctFee; /** * The percentage of the transfer amount that should go the relayer as a fee to cover relayer capital costs. */ relayerCapitalFee: PctFee; /** * The percentage of the transfer amount that should go the relayer as a fee to cover relayer gas costs. */ relayerGasFee: PctFee; /** * The percent of the amount that will go to the LPs as a fee for borrowing their funds. */ lpFee: PctFee; /** * The quote timestamp that was used to compute the lpFeePct. To pay the quoted LP fee, the user would need to pass * this quote timestamp to the protocol when sending their bridge transaction. */ timestamp: string; /** * Is the input amount below the minimum transfer amount. */ isAmountTooLow: boolean; /** * The block used associated with this quote, used to compute lpFeePct. */ quoteBlock: string; /** * The contract address of the origin SpokePool. */ spokePoolAddress: string; /** * The relayer that is suggested to be set as the exclusive relayer for in the depositV3 call for the fastest fill. * * Note: when set to "0x0000000000000000000000000000000000000000", relayer exclusivity will be disabled. * This value is returned in cases where using an exclusive relayer is not recommended. */ exclusiveRelayer: string; /** * The suggested exclusivity period (in seconds) the exclusive relayer should be given to fill before other relayers * are allowed to take the fill. Note: when set to "0", relayer exclusivity will be disabled. * * This value is returned in cases where using an exclusive relayer is not recommended. */ exclusivityDeadline: string; /** * The expected time (in seconds) for a fill to be made. Represents 75th percentile of the 7-day rolling average of times (updated daily). Times are dynamic by origin/destination token/chain for a given amount. */ estimatedFillTimeSec: string; /** * The recommended deadline (UNIX timestamp in seconds) for the relayer to fill the deposit. After this destination chain timestamp, the fill will revert on the destination chain. */ fillDeadline: string; limits: SuggestedFeesLimits; } interface PctFee { /** * Note: 1% is represented as 1e16, 100% is 1e18, 50% is 5e17, etc. These values are in the same format that the contract understands. * * Example: 100200000000000 */ pct: string; total: string; } interface DepositStatusRequest { originChainId: string; depositId: string; } interface DepositStatusResponse { /** * Status of the deposit: * - filled: Deposit has been filled on destination chain (FilledV3Relay event emitted) * - pending: Deposit not yet filled * - expired: Deposit expired and will be refunded * - refunded: Deposit expired and depositor refunded on originChain * - slowFillRequested: Across' relayer fills without requiring another relayer to front capital * (requires input token and output token to be the same asset) */ status: 'filled' | 'pending' | 'expired' | 'refunded' | 'slowFillRequested'; /** * Origin chain ID where the deposit was made. */ originChainId: string; /** * Unique identifier of the deposit. */ depositId: string; /** * Transaction hash of the deposit on the origin chain. */ depositTxHash?: string; /** * Transaction hash of the fill on the destination chain. * Only present when fillStatus is 'filled'. */ fillTx?: string; /** * Destination chain ID where the fill transaction will occur. */ destinationChainId?: string; /** * Transaction hash of the refund on the origin chain. * Only present when fillStatus is 'refunded'. */ depositRefundTxHash?: string; /** * Pagination information for the response. */ pagination?: { currentIndex: number; maxIndex: number; }; } interface AcrossApiOptions { apiBaseUrl?: string; } declare class AcrossApi { private readonly options; constructor(options?: AcrossApiOptions); /** * Retrieve available routes for transfers * * Returns available routes based on specified parameters. If no parameters are provided, available routes on all * chains are returned. * * See https://docs.across.to/reference/api-reference#available-routes */ getAvailableRoutes({ originChainId, originToken, destinationChainId, destinationToken, }: AvailableRoutesRequest): Promise; /** * Retrieve suggested fee quote for a deposit. * * Returns suggested fees based inputToken+outputToken, originChainId, destinationChainId, and amount. * Also includes data used to compute the fees. * * * See https://docs.across.to/reference/api-reference#suggested-fees */ getSuggestedFees(request: SuggestedFeesRequest): Promise; getSupportedTokens(): Promise; getDepositStatus(request: DepositStatusRequest): Promise; protected fetchApi(path: string, params: Record, isValidResponse?: (response: unknown) => response is T): Promise; } interface AcrossBridgeProviderOptions { apiOptions?: AcrossApiOptions; cowShedOptions?: CowShedSdkOptions; } interface AcrossQuoteResult extends BridgeQuoteResult { suggestedFees: SuggestedFeesResponse; } declare class AcrossBridgeProvider implements HookBridgeProvider { type: "HookBridgeProvider"; protected api: AcrossApi; protected cowShedSdk: CowShedSdk; private supportedTokens; constructor(options?: AcrossBridgeProviderOptions, _adapter?: AbstractProviderAdapter); info: BridgeProviderInfo; getNetworks(): Promise; getBuyTokens(params: BuyTokensParams): Promise; getIntermediateTokens(request: QuoteBridgeRequest): Promise; getQuote(request: QuoteBridgeRequest): Promise; getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: AcrossQuoteResult): Promise; getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise; getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise; decodeBridgeHook(_hook: cowAppDataLatestScheme.CoWHook): Promise; getBridgingParams(chainId: ChainId, order: EnrichedOrder, txHash: string, settlementContractOverride?: Partial): Promise<{ params: BridgingDepositParams; status: BridgeStatusResult; } | null>; getExplorerUrl(_: string): string; getStatus(bridgingId: string, originChainId: SupportedChainId): Promise; getCancelBridgingTx(_bridgingId: string): Promise; getRefundBridgingTx(_bridgingId: string): Promise; private getSupportedTokensState; } type SupportedBridge = 'across' | 'cctp-v2-fast' | 'cctp-v2' | 'cctp' | 'gnosis-native-bridge'; interface BungeeQuoteAPIRequest { userAddress: string; originChainId: string; destinationChainId: string; inputToken: string; inputAmount: string; receiverAddress: string; outputToken: string; enableManual: true; disableSwapping: true; disableAuto: true; includeBridges?: SupportedBridge[]; } interface BungeeQuoteAPIResponse { success: boolean; statusCode: number; result: { originChainId: number; destinationChainId: number; userAddress: string; receiverAddress: string; input: { token: { chainId: number; address: string; name: string; symbol: string; decimals: number; logoURI: string; icon: string; }; amount: string; priceInUsd: number; valueInUsd: number; }; destinationExec: unknown; autoRoute: unknown; manualRoutes: Array<{ quoteId: string; quoteExpiry: number; output: { token: { chainId: number; address: string; name: string; symbol: string; decimals: number; logoURI: string; icon: string; }; amount: string; priceInUsd: number; valueInUsd: number; minAmountOut: string; effectiveReceivedInUsd: number; }; affiliateFee: unknown; approvalData: { spenderAddress: string; amount: string; tokenAddress: string; userAddress: string; }; gasFee: { gasToken: { chainId: number; address: string; symbol: string; name: string; decimals: number; icon: string; logoURI: string; chainAgnosticId: unknown; }; gasLimit: string; gasPrice: string; estimatedFee: string; feeInUsd: number; }; slippage: number; estimatedTime: number; routeDetails: { name: string; logoURI: string; routeFee: { token: { chainId: number; address: string; name: string; symbol: string; decimals: number; logoURI: string; icon: string; }; amount: string; feeInUsd: number; priceInUsd: number; }; dexDetails: unknown; }; refuel: unknown; }>; }; } declare enum BungeeBridge { 'Across' = "across", 'CircleCCTPV2' = "cctp-v2", 'CircleCCTPV2Fast' = "cctp-v2-fast", 'GnosisNative' = "gnosis-native-bridge" } interface BungeeQuote { originChainId: number; destinationChainId: number; userAddress: string; receiverAddress: string; input: BungeeQuoteAPIResponse['result']['input']; route: BungeeQuoteAPIResponse['result']['manualRoutes'][0]; routeBridge: BungeeBridge; quoteTimestamp: number; } type BungeeQuoteWithBuildTx = { bungeeQuote: BungeeQuote; buildTx: BungeeBuildTx; }; interface BungeeBuildTxAPIResponse { success: boolean; statusCode: number; result: { approvalData: { spenderAddress: string; amount: string; tokenAddress: string; userAddress: string; }; txData: { data: string; to: string; chainId: number; value: string; }; userOp: string; }; } type BungeeBuildTx = BungeeBuildTxAPIResponse['result']; type SocketRequest = { amount: string; recipient: string; toChainId: string; token: string; signature: string; }; declare enum BungeeEventStatus { COMPLETED = "COMPLETED", PENDING = "PENDING" } declare enum BungeeBridgeName { ACROSS = "across", CCTP_V2 = "cctp-v2", CCTP_V2_FAST = "cctp-v2-fast", GNOSIS_NATIVE = "gnosis-native-bridge" } type BungeeEvent = { identifier: string; srcTransactionHash?: string; bridgeName: BungeeBridgeName; fromChainId: number; gasUsed: string; isCowswapTrade: boolean; isSocketTx: boolean; metadata: string; orderId: string; recipient: string; sender: string; socketContractVersion: string; srcAmount: string; srcBlockHash: string; srcBlockNumber: number; srcBlockTimeStamp: number; srcTokenAddress: string; srcTokenDecimals: number; srcTokenLogoURI: string; srcTokenName: string; srcTokenSymbol: string; to: string; toChainId: number; destTransactionHash?: string; destAmount?: string; destBlockHash: string; destBlockNumber: number; destBlockTimeStamp: number; destTokenAddress: string; destTokenDecimals: number; destTokenLogoURI: string; destTokenName: string; destTokenSymbol: string; srcTxStatus: BungeeEventStatus; destTxStatus: BungeeEventStatus; }; interface AcrossStatusAPIResponse { status: 'filled' | 'pending' | 'expired' | 'refunded' | 'slowFillRequested'; originChainId: string; depositId: string; depositTxHash?: string; fillTx?: string; destinationChainId?: string; depositRefundTxHash?: string; pagination?: { currentIndex: number; maxIndex: number; }; } type AcrossStatus = AcrossStatusAPIResponse['status']; interface BungeeApiUrlOptions { apiBaseUrl: string; manualApiBaseUrl: string; eventsApiBaseUrl: string; acrossApiBaseUrl: string; } interface BungeeApiOptions extends Partial { includeBridges?: SupportedBridge[]; affiliate?: string; fallbackTimeoutMs?: number; apiKey?: string; customApiBaseUrl?: string; } interface IntermediateTokensParams { fromChainId: SupportedChainId; toChainId: TargetChainId; toTokenAddress: string; includeBridges?: SupportedBridge[]; } declare class BungeeApi { private readonly options; private fallbackStates; private readonly fallbackTimeoutMs; constructor(options?: BungeeApiOptions); validateBridges(includeBridges: SupportedBridge[]): void; getBuyTokens(params: BuyTokensParams, bridgeParams?: { includeBridges?: SupportedBridge[]; }): Promise; getIntermediateTokens(params: IntermediateTokensParams): Promise; /** * Makes a GET request to Bungee APIs for quote and build tx */ getBungeeQuoteWithBuildTx(params: BungeeQuoteAPIRequest): Promise; /** * Makes a GET request to Bungee APIs for quote * https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-quote-v-1 */ getBungeeQuote(params: BungeeQuoteAPIRequest): Promise; /** * Makes a GET request to Bungee APIs for build tx * https://docs.bungee.exchange/bungee-api/api-reference/bungee-controller-build-tx-v-1 */ getBungeeBuildTx(quote: BungeeQuote): Promise; /** * Verifies the build tx data for a quote using the SocketVerifier contract * @param quote - The quote object * @param buildTx - The build tx object * @param signer - The signer object * @returns True if the build tx data is valid, false otherwise */ verifyBungeeBuildTx(quote: BungeeQuote, buildTx: BungeeBuildTx): Promise; /** * Verifies the bungee tx data using the SocketVerifier contract * @param originChainId - The origin chain id * @param txData - The tx data * @param routeId - The route id * @param expectedSocketRequest - The expected socket request * @param signer - The signer object * @returns True if the bungee tx data is valid, false otherwise */ verifyBungeeBuildTxData(originChainId: SupportedChainId, txData: string, routeId: string, expectedSocketRequest: SocketRequest): Promise; getEvents(params: { orderId: string; } | { txHash: string; }): Promise; getAcrossStatus(depositTxHash: string): Promise; private getSupportedBridges; private isBungeeApi; private shouldAddApiKey; private shouldUseFallback; private enableFallback; private shouldAddAffiliate; private makeApiCall; } interface BungeeBridgeProviderOptions { apiOptions?: BungeeApiOptions; cowShedOptions?: CowShedSdkOptions; } interface BungeeQuoteResult extends BridgeQuoteResult { bungeeQuote: BungeeQuote; buildTx: BungeeBuildTx; } declare class BungeeBridgeProvider implements HookBridgeProvider { private options; type: "HookBridgeProvider"; protected api: BungeeApi; protected cowShedSdk: CowShedSdk; constructor(options: BungeeBridgeProviderOptions, _adapter?: AbstractProviderAdapter); info: BridgeProviderInfo; getNetworks(): Promise; getBuyTokens(params: BuyTokensParams): Promise; getIntermediateTokens(request: QuoteBridgeRequest): Promise; getQuote(request: QuoteBridgeRequest): Promise; getUnsignedBridgeCall(request: QuoteBridgeRequest, quote: BungeeQuoteResult): Promise; getGasLimitEstimationForHook(request: QuoteBridgeRequest): Promise; getSignedHook(chainId: SupportedChainId, unsignedCall: EvmCall, bridgeHookNonce: string, deadline: bigint, hookGasLimit: number, signer?: SignerLike): Promise; getBridgingParams(_chainId: ChainId, order: EnrichedOrder, _txHash: string): Promise<{ params: BridgingDepositParams; status: BridgeStatusResult; } | null>; decodeBridgeHook(_hook: cowAppDataLatestScheme.CoWHook): Promise; getExplorerUrl(bridgingId: string): string; getStatus(_bridgingId: string): Promise; getCancelBridgingTx(_bridgingId: string): Promise; getRefundBridgingTx(_bridgingId: string): Promise; private isExtraGasRequired; } interface GetAttestationRequest { depositAddress: Address$1; quoteHash: Hex; } interface GetAttestationResponse { signature: Hex; version: number; } declare class NearIntentsApi { private static readonly DEPRECATED_ASSET_IDS; private cachedTokens; constructor(apiKey?: string); getTokens(): Promise; getQuote(request: QuoteRequest): Promise; getStatus(depositAddress: string): Promise; getAttestation(request: GetAttestationRequest): Promise; } interface DepositAddressContext { address: Address$1; quoteHash: string; stringifiedQuote: string; attestationSignature: string; } interface NearIntentsQuoteResult extends BridgeQuoteResult { depositAddress: Hex; attestationSignature: string; quoteBody: string; } interface NearIntentsBridgeProviderOptions { cowShedOptions?: CowShedSdkOptions; apiKey?: string; } declare class NearIntentsBridgeProvider implements ReceiverAccountBridgeProvider { type: "ReceiverAccountBridgeProvider"; protected api: NearIntentsApi; protected cowShedSdk: CowShedSdk; info: BridgeProviderInfo; constructor(options?: NearIntentsBridgeProviderOptions, _adapter?: AbstractProviderAdapter); getNetworks(): Promise; getBuyTokens(params: BuyTokensParams): Promise; getIntermediateTokens(request: QuoteBridgeRequest): Promise; getQuote(request: QuoteBridgeRequest): Promise; getBridgeReceiverOverride(_request: QuoteBridgeRequest, quote: NearIntentsQuoteResult): Promise; getBridgingParams(_chainId: ChainId, order: EnrichedOrder, _txHash: string): Promise<{ params: BridgingDepositParams; status: BridgeStatusResult; } | null>; getExplorerUrl(bridgingId: string): string; getStatus(bridgingId: string, _originChainId: SupportedChainId): Promise; getCancelBridgingTx(_bridgingId: string): Promise; getRefundBridgingTx(_bridgingId: string): Promise; /** * A script to verify depositAddress from appData: https://codesandbox.io/p/sandbox/h7tngy */ recoverDepositAddress({ quote, quoteRequest, timestamp, }: QuoteResponse): Promise; } export { AcrossBridgeProvider, type AcrossBridgeProviderOptions, type AcrossQuoteResult, type BestQuoteProgressCallback, type BestQuoteProviderContext, type BridgeCallDetails, type BridgeCosts, type BridgeDeposit, type BridgeHook, BridgeOrderParsingError, type BridgeProvider, BridgeProviderError, type BridgeProviderInfo, BridgeProviderQuoteError, type BridgeProviderType, type BridgeQuoteAmountsAndCosts, type BridgeQuoteAndPost, BridgeQuoteErrorPriorities, BridgeQuoteErrors, type BridgeQuoteResult, type BridgeQuoteResults, BridgeStatus, type BridgeStatusResult, type BridgingDepositParams, BridgingSdk, BungeeBridgeProvider, type BungeeBridgeProviderOptions, type BungeeQuoteResult, type BuyTokensParams, COW_SHED_PROXY_CREATION_GAS, type CrossChainOrder, type CrossChainQuoteAndPost, DEFAULT_BRIDGE_SLIPPAGE_BPS, DEFAULT_EXTRA_GAS_FOR_HOOK_ESTIMATION, DEFAULT_EXTRA_GAS_PROXY_CREATION, DEFAULT_GAS_COST_FOR_HOOK_ESTIMATION, type DefaultBridgeProvider, type GetProviderBuyTokens, HOOK_DAPP_BRIDGE_PROVIDER_PREFIX, type HookBridgeProvider, type MultiQuoteContext, type MultiQuoteOptions, type MultiQuoteProgressCallback, type MultiQuoteRequest, type MultiQuoteResult, NearIntentsBridgeProvider, type NearIntentsBridgeProviderOptions, type NearIntentsQuoteResult, type ProviderQuoteContext, type QuoteBridgeRequest, type QuoteBridgeRequestWithoutAmount, RAW_PROVIDERS_FILES_PATH, type ReceiverAccountBridgeProvider, assertIsBridgeQuoteAndPost, assertIsQuoteAndPost, getCrossChainOrder, getPostHooks, isAppDoc, isBridgeQuoteAndPost, isHookBridgeProvider, isQuoteAndPost, isReceiverAccountBridgeProvider };