import { RouteResponse } from "@0xsquid/sdk/dist/types"; import { ChainData, ChainType, Estimate, FeeCost, GasCost, Token } from "@0xsquid/squid-types"; import { SimplifiedRouteAction } from "../../core/types/transaction"; import { ChainFeeParams } from "./tempoService"; export type PartialFeeCost = Pick & { token?: Pick; }; export declare const formatAmount: (amountInWei: string | undefined, decimals: number | undefined) => string; export declare const parseToAmountUSD: (toAmountUSD: string | undefined) => number; /** * Calculates the expected gas refund * * Currently we only refund when source chain supports gas refunds * and Axelar is one of the bridge actions */ export declare const calculateExpectedGasRefundCost: (firstFeeCost: PartialFeeCost | undefined, fromChainType: ChainType | undefined, actions: SimplifiedRouteAction[] | undefined) => bigint; export declare const calculateTotalNativeFees: ({ expressFeeCost, firstFeeCost, firstGasCost, sameTokenBetweenFees, }: { expressFeeCost: Pick | undefined; firstFeeCost: Pick | undefined; firstGasCost: Pick | undefined; sameTokenBetweenFees: boolean; }) => bigint; export declare const checkIsGasBalanceEnough: ({ fromAmount, networkFeesWei, chainFeeParams, }: { fromAmount: string | undefined; networkFeesWei: bigint; chainFeeParams: ChainFeeParams | null; }) => boolean; export declare const calculateMinAmountValueWarnMsg: ({ networkFeesWei, chainFeeParams, fromTokenDecimals, }: { networkFeesWei: bigint; chainFeeParams: ChainFeeParams | null; fromTokenDecimals: number | undefined; }) => string | undefined; /** * Calculates the estimated duration of a route * * @param {number} estimatedRouteDuration - The estimated route duration in seconds * @param {boolean} isSingleChainRoute - Flag indicating whether the route is single chain * * @returns {Object} An object containing the estimated duration and a formatter function */ export declare const formatEstimatedRouteDuration: ({ estimatedRouteDuration, isSingleChainRoute, }: { estimatedRouteDuration?: number | undefined; isSingleChainRoute: boolean; }) => { seconds: number; format: (sTemplate?: string, mTemplate?: string, hTemplate?: string) => string; }; /** * Calculates and formats various estimate results based on the provided Squid route and additional parameters. * * @param {RouteResponse["route"]} squidRoute - The Squid route containing estimate information. * @param {Token[]} tokens - An array of token objects. * @param {ChainData} fromChain - The source chain object. * @param {ChainData} toChain - The destination chain object. * @param {boolean} collectFees - Flag indicating whether to collect fees. * @param {string} nativeTokenBalanceFromChain - The native token balance on the source chain. * @param {boolean} expressActivatedUI - Flag indicating whether express mode is activated in the UI. * @returns {Object} An object containing various estimate results and calculations, including token information, * amounts, fees, gas costs, and other relevant data for the transaction. */ export type EstimateRouteInput = { params: Pick; estimate: Pick & { toToken: Pick; gasCosts: (Omit & { token: Pick; })[]; actions?: Estimate["actions"]; }; }; export declare const calculateEstimateResults: = Token>({ squidRoute, tokens, fromChain, toChain, collectFees, chainFeeParams, gasToken, }: { squidRoute: EstimateRouteInput | undefined; tokens: T[]; fromChain?: Pick | undefined; toChain?: Pick | undefined; collectFees: boolean; chainFeeParams: ChainFeeParams | null; gasToken: Pick | undefined; }) => { fromToken: T | undefined; fromAmount: string | undefined; fromAmountFormatted: string; toAmountUSD: string | undefined; exchangeRate: string; toAmountMinUSD: string; toAmountMin: string; toAmount: string; allFeeCosts: FeeCost[]; allGasCosts: GasCost[]; firstFeeCost: FeeCost | undefined; firstGasCost: GasCost | undefined; expressFeeCost: FeeCost | undefined; integratorFeeCost: FeeCost | undefined; expectedGasRefundCost: bigint; expectedGasRefundCostUSD: string; sameTokenBetweenFees: boolean; fromTokenPaysGasFees: boolean; totalNativeFees: bigint; isGasBalanceEnough: boolean; minAmountValueWarnMsg: string | undefined; estimatedRouteDuration: { seconds: number; format: (sTemplate?: string, mTemplate?: string, hTemplate?: string) => string; }; gasBalanceNeeded: string | undefined; }; /** * Calculates the total estimate with refund for a transaction. * * @param allFeeCosts - Total fee costs of the transaction * @param expectedGasRefundCost - The expected gas refund cost as a bigint. * @param getUSDValue - A function to convert an amount to its USD value. * @returns An object containing the total amount, total amount in USD, and the fee token. */ export declare const calculateTotalWithRefundEstimate: (allFeeCosts: FeeCost[] | undefined, expectedGasRefundCost: bigint, getUSDValue: (amount: string) => string) => { totalAmount: string; totalAmountUSD: number; feeToken: Token | undefined; };