import { BigNumber, BigNumberish, PopulatedTransaction } from 'ethers'; import { SynapseModuleSet, Query } from '../module'; import { SynapseSDK } from '../sdk'; import { BridgeQuote, BridgeQuoteV2, BridgeV2Parameters } from '../types'; import { Prettify } from '../utils'; declare type BridgeV2InternalParameters = Prettify; export declare function bridgeV2(this: SynapseSDK, params: BridgeV2Parameters): Promise; export declare function _bridgeV2Internal(this: SynapseSDK, params: BridgeV2InternalParameters): Promise; /** * Creates a populated bridge transaction ready for signing and submission to the origin chain. * The method selects the appropriate router based on the origin router address: * - `SynapseRouter` is used for SynapseBridge module * - `SynapseCCTPRouter` is used for SynapseCCTP module * - `FastBridgeRouter` is used for SynapseRFQ module * * @param to - Recipient address for the bridged tokens on the destination chain. * @param originRouterAddress - Address of the router on the origin chain. * @param originChainId - ID of the origin chain. * @param destChainId - ID of the destination chain. * @param token - Address of the token to be bridged. * @param amount - Amount of tokens to bridge. * @param originQuery - Query for the origin chain, obtained from `allBridgeQuotes()` or `bridgeQuote()`. * @param destQuery - Query for the destination chain, obtained from `allBridgeQuotes()` or `bridgeQuote()`. * * @returns A Promise resolving to a populated transaction object, ready for sending. * * @throws Error if any issues arise during the bridge operation. */ export declare function bridge(this: SynapseSDK, to: string, originRouterAddress: string, originChainId: number, destChainId: number, token: string, amount: BigNumberish, originQuery: Query, destQuery: Query): Promise; /** * Options for the bridgeQuote and allBridgeQuotes functions. * * @param deadline - Optional transaction deadline on the origin chain. * @param excludedModules - Optional array of module names to exclude from the quote. * @param originUserAddress - Optional address of the user on the origin chain. This parameter must be * specified if a smart contract will initiate the bridge operation on behalf of the user. */ interface BridgeQuoteOptions { deadline?: BigNumber; excludedModules?: string[]; originUserAddress?: string; } /** * Retrieves the best quote from all available bridge modules (SynapseBridge, SynapseCCTP, and SynapseRFQ). * Users can customize the query by specifying a deadline, excluding certain modules, and providing the user's address on the origin chain. * * Important: The originUserAddress MUST be provided if a smart contract will initiate the bridge operation on the user's behalf. * This applies to smart wallets (e.g., Safe) and third-party integrations (such as bridge aggregator smart contracts). * * The returned quote will not have any slippage settings applied. To add slippage to the quote, use the `applyBridgeSlippage` function. * The returned quote will use the origin chain deadline provided in the options. If no deadline is provided, the module's default origin deadline is used. * The returned quote will use the module's default destination deadline. * * @param originChainId - ID of the origin chain. * @param destChainId - ID of the destination chain. * @param tokenIn - Address of the token to be bridged from the origin chain. * @param tokenOut - Address of the token to be received on the destination chain. * @param amountIn - Amount of input tokens on the origin chain. * @param options - Optional parameters including origin deadline, excludedModules, and originUserAddress. * * @returns A promise resolving to the best available bridge quote. * * @throws An error if no bridge route is found. */ export declare function bridgeQuote(this: SynapseSDK, originChainId: number, destChainId: number, tokenIn: string, tokenOut: string, amountIn: BigNumberish, options?: BridgeQuoteOptions): Promise; /** * Fetches all available quotes from the supported bridge modules (SynapseBridge, SynapseCCTP, and SynapseRFQ). * Users can customize the query by specifying a deadline, excluding certain modules, and providing the user's address on the origin chain. * * Important: The originUserAddress MUST be provided if a smart contract will initiate the bridge operation on the user's behalf. * This applies to smart wallets (e.g., Safe) and third-party integrations (such as bridge aggregator smart contracts). * * The returned quotes will not have any slippage settings applied. To add slippage to the quotes, use the `applyBridgeSlippage` function. * The returned quotes will use the origin chain deadline provided in the options. If no deadline is provided, the module's default origin deadline is used. * The returned quotes will use the module's default destination deadline. * * @param originChainId - ID of the origin chain. * @param destChainId - ID of the destination chain. * @param tokenIn - Address of the token to be bridged from the origin chain. * @param tokenOut - Address of the token to be received on the destination chain. * @param amountIn - Amount of input tokens on the origin chain. * @param options - Optional parameters including origin deadline, excludedModules, and originUserAddress. * * @returns A promise that resolves to an array of bridge quotes. * The returned array is sorted by maxAmountOut in descending order, with all quotes having a non-zero amountOut. */ export declare function allBridgeQuotes(this: SynapseSDK, originChainId: number, destChainId: number, tokenIn: string, tokenOut: string, amountIn: BigNumberish, options?: BridgeQuoteOptions): Promise; /** * Applies the deadlines to the given bridge queries, according to bridge module's default deadline settings. * * @param moduleName - The name of the bridge module. * @param originQueryInitial - The query for the origin chain * @param destQueryInitial - The query for the destination chain * @param originDeadline - The deadline to use on the origin chain (optional, default depends on the module). * @param destDeadline - The deadline to use on the destination chain (optional, default depends on the module). * @returns The origin and destination queries with the deadlines applied. */ export declare function applyBridgeDeadline(this: SynapseSDK, moduleName: string, originQueryInitial: Query, destQueryInitial: Query, originDeadline?: BigNumber, destDeadline?: BigNumber): { originQuery: Query; destQuery: Query; }; /** * Applies slippage to the given bridge queries, according to bridge module's slippage tolerance. * Note: default slippage is 10 bips (0.1%). * * @param moduleName - The name of the bridge module. * @param originQueryInitial - The query for the origin chain, coming from `allBridgeQuotes()`. * @param destQueryInitial - The query for the destination chain, coming from `allBridgeQuotes()`. * @param slipNumerator - The numerator of the slippage tolerance, defaults to 10. * @param slipDenominator - The denominator of the slippage tolerance, defaults to 10000. * @returns - The origin and destination queries with slippage applied. */ export declare function applyBridgeSlippage(this: SynapseSDK, moduleName: string, originQueryInitial: Query, destQueryInitial: Query, slipNumerator?: number, slipDenominator?: number): { originQuery: Query; destQuery: Query; }; /** * Gets the unique Synapse txId for a bridge operation that happened within a given transaction. * Synapse txId is known as "kappa" for SynapseBridge contract and "requestID" for SynapseCCTP contract. * This function is meant to abstract away the differences between the two bridge modules. * * @param originChainId - The ID of the origin chain. * @param moduleName - The name of the bridge module. * @param txHash - The transaction hash of the bridge operation on the origin chain. * @returns A promise that resolves to the unique Synapse txId of the bridge operation. */ export declare function getSynapseTxId(this: SynapseSDK, originChainId: number, moduleName: string, txHash: string): Promise; /** * Checks whether a bridge operation has been completed on the destination chain. * * @param destChainId - The ID of the destination chain. * @param moduleName - The name of the bridge module. * @param synapseTxId - The unique Synapse txId of the bridge operation. * @returns A promise that resolves to a boolean indicating whether the bridge operation has been completed. */ export declare function getBridgeTxStatus(this: SynapseSDK, destChainId: number, moduleName: string, synapseTxId: string): Promise; /** * Returns the name of the bridge module that emits the given event. * This will be either SynapseBridge or SynapseCCTP. * * @param eventName - The name of the event. * @returns - The name of the bridge module. */ export declare function getBridgeModuleName(this: SynapseSDK, eventName: string): string; /** * Returns the estimated time for a bridge operation from a given origin chain using a given bridge module. * This will be the estimated time for the bridge operation to be completed regardless of the destination chain, * or the bridge token. * * @param originChainId - The ID of the origin chain. * @param moduleName - The name of the bridge module. * @returns - The estimated time for a bridge operation, in seconds. * @throws - Will throw an error if the bridge module is unknown for the given chain. */ export declare function getEstimatedTime(this: SynapseSDK, originChainId: number, moduleName: string): number; /** * Gets the chain gas amount for the Synapse bridge. * * @param chainId The chain ID * @returns The chain gas amount * @throws Will throw an error if SynapseRouter is not deployed on the given chain. */ export declare function getBridgeGas(this: SynapseSDK, chainId: number): Promise; /** * Extracts the SynapseModuleSet from the SynapseSDK based on the given bridge module name. * * @param moduleName - The name of the bridge module, SynapseBridge or SynapseCCTP. * @returns The corresponding SynapseModuleSet. * @throws Will throw an error if the bridge module is unknown. */ export declare function getModuleSet(this: SynapseSDK, moduleName: string): SynapseModuleSet; export {};