import { Provider } from '@ethersproject/abstract-provider'; import { BigNumber } from '@ethersproject/bignumber'; import { BigNumberish, PopulatedTransaction } from 'ethers'; import { DestRequest } from './types'; import { BridgeToken, FeeConfig, SynapseModule } from '../module'; import { Query } from '../module/query'; /** * Abstract class for a router contract deployed on a chain. * Handles contract interaction: the Router users don't need to know about the contract, * or the data structures used to interact with it. * * Instead, they use the Router class and generic types such as Query and BridgeToken. * * @property address The address of the router contract. * @property chainId The chain ID of chain the router is deployed on. * @property provider The provider used to interact with the chain router is deployed on. */ export declare abstract class Router implements SynapseModule { abstract readonly address: string; readonly chainId: number; readonly provider: Provider; private bridgeTokensCache; constructor(chainId: number, provider: Provider); abstract getOriginAmountOut(tokenIn: string, bridgeTokens: string[], amountIn: BigNumberish): Promise; abstract getDestinationAmountOut(requests: DestRequest[], tokenOut: string): Promise; abstract getConnectedBridgeTokens(tokenOut: string): Promise; abstract getBridgeFees(token: string, amount: BigNumber, isSwap: boolean): Promise<{ feeAmount: BigNumber; feeConfig: FeeConfig; }>; /** * @inheritdoc SynapseModule.bridge */ abstract bridge(to: string, chainId: number, token: string, amount: BigNumberish, originQuery: Query, destQuery: Query): Promise; /** * @inheritdoc SynapseModule.getSynapseTxId */ abstract getSynapseTxId(txHash: string): Promise; /** * @inheritdoc SynapseModule.getBridgeTxStatus */ abstract getBridgeTxStatus(synapseTxId: string): Promise; /** * Fetches bridge tokens for a destination chain and output token. * * Checks the cache first, and fetches from the router if not cached. Filters invalid tokens and caches the result. * * @param destChainId - The destination chain ID. * @param tokenOut - The output token. * @param destRouter - The SynapseRouter or SynapseCCTPRouter to use. * @returns An array of BridgeToken objects for valid bridge tokens. */ getBridgeTokens(tokenOut: string): Promise; /** * Fetches origin queries from either a SynapseRouter or SynapseCCTPRouter. * * @param tokenIn - The input token * @param tokenSymbols - The token symbols * @param amountIn - The input amount * @returns A promise that resolves to an array of Query objects with the same length as tokenSymbols. * @throws Will throw an error if unable to fetch origin queries */ getOriginQueries(tokenIn: string, tokenSymbols: string[], amountIn: BigNumberish): Promise; /** * Fetches destination queries from either a SynapseRouter or SynapseCCTPRouter. * * @param requests - The requests with symbol and amount in. * @param tokenOut - The output token. * @returns A promise that resolves to an array of Query objects with the same length as requests. * @throws Will throw an error if unable to fetch destination queries. */ getDestinationQueries(requests: DestRequest[], tokenOut: string): Promise; }