import { ExecuteInstruction, JsonObject } from "@cosmjs/cosmwasm-stargate"; import { Coin, EncodeObject } from "@cosmjs/proto-signing"; import { Attribute, Event } from "@cosmjs/tendermint-rpc/build/tendermint37"; import { AssetInfo, Uint128 } from "@oraichain/oraidex-contracts-sdk"; import { TokenInfoResponse } from "@oraichain/oraidex-contracts-sdk/build/OraiswapToken.types"; import { MsgExecuteContract } from "cosmjs-types/cosmwasm/wasm/v1/tx"; import { StargateMsg, Tx } from "./tx"; import { CustomChainInfo, AmountDetails, TokenInfo, TokenItemType, CoinGeckoPrices } from "./format-types"; import { CoinGeckoId } from "./network"; export declare const getEvmAddress: (bech32Address: string) => string; export declare const tronToEthAddress: (base58: string) => string; export declare const ethToTronAddress: (address: string) => string; export declare const validateNumber: (amount: number | string) => number; export declare const toAmount: (amount: number | string, decimals?: number) => bigint; /** * Converts a fraction to its equivalent decimal value as a number. * * @param {bigint} numerator - The numerator of the fraction * @param {bigint} denominator - The denominator of the fraction * @return {number} - The decimal value equivalent to the input fraction, returned as a number. */ export declare const toDecimal: (numerator: bigint, denominator: bigint) => number; /** * Convert the amount to be displayed on the user interface. * * @param {string|bigint} amount - The amount to be converted. * @param {number} sourceDecimals - The number of decimal places in the original `amount`. * @param {number} desDecimals - The number of decimal places in the `amount` after conversion. * @return {number} The value of `amount` after conversion. */ export declare const toDisplay: (amount: string | bigint, sourceDecimals?: number, desDecimals?: number) => number; export declare const getSubAmountDetails: (amounts: AmountDetails, tokenInfo: TokenItemType) => AmountDetails; export declare const toTokenInfo: (token: TokenItemType, info?: TokenInfoResponse) => TokenInfo; export declare const toAssetInfo: (token: TokenInfo) => AssetInfo; export declare const calculateTimeoutTimestamp: (timeout: number, dateNow?: number) => string; export declare const generateError: (message: string) => { ex: { message: string; }; }; export declare const getEncodedExecuteContractMsgs: (senderAddress: string, msgs: ExecuteInstruction[]) => EncodeObject[]; export declare const buildMultipleExecuteMessages: (mainMsg?: ExecuteInstruction[], ...preMessages: ExecuteInstruction[]) => ExecuteInstruction[]; export declare const marshalEncodeObjsToStargateMsgs: (messages: EncodeObject[]) => StargateMsg[]; export declare const calculateMinReceive: (simulateAverage: string, fromAmount: string, userSlippage: number, decimals: number) => Uint128; export declare const parseAssetInfoFromContractAddrOrDenom: (addressOrDenomToken: string, cosmosTokens: TokenItemType[]) => AssetInfo; export declare const parseTokenInfo: (tokenInfo: TokenItemType, amount?: string) => { fund?: Coin; info: AssetInfo; }; export declare const handleSentFunds: (...funds: (Coin | undefined)[]) => Coin[] | null; export declare const proxyContractInfo: { [x: string]: { wrapNativeAddr: string; routerAddr: string; }; }; export declare const findToTokenOnOraiBridge: (fromCoingeckoId: CoinGeckoId, toNetwork: string, cosmosTokens: TokenItemType[]) => TokenItemType; export declare const parseAssetInfo: (assetInfo: AssetInfo) => string; export declare const getTokenOnSpecificChainId: (coingeckoId: CoinGeckoId, chainId: string, flattenTokens: TokenItemType[]) => TokenItemType | undefined; /** * This function get token on oraichain from coingeckoId * @param coingeckoId - coingeckoId of tokenInOraichain * @param isNative - isNative token * @returns token on oraichain */ export declare const getTokenOnOraichain: (coingeckoId: CoinGeckoId, oraichainTokens: TokenItemType[], isNative?: boolean) => TokenItemType; export declare const parseTokenInfoRawDenom: (tokenInfo: TokenItemType) => string; export declare const isEthAddress: (address: string) => boolean; export declare const parseRpcEvents: (events: readonly Event[]) => Event[]; export declare const parseTxToMsgExecuteContractMsgs: (tx: Tx) => MsgExecuteContract[]; export declare const getCosmosGasPrice: (gasPriceStep?: { low: number; average: number; high: number; }) => number; export declare function toObject(data: any): any; export declare const AMOUNT_BALANCE_ENTRIES: [number, string, string][]; export type SwapType = "Swap" | "Bridge" | "Universal Swap"; export declare const getSwapType: ({ fromChainId, toChainId, fromCoingeckoId, toCoingeckoId }: { fromChainId: string; toChainId: string; fromCoingeckoId: CoinGeckoId; toCoingeckoId: CoinGeckoId; }) => SwapType; export declare const feeEstimate: (tokenInfo: TokenItemType, gasDefault: number) => number; export declare const calcMaxAmount: ({ maxAmount, token, coeff, gas }: { maxAmount: number; token: TokenItemType; coeff: number; gas?: number; }) => number; export declare const getTotalUsd: (amounts: AmountDetails, prices: CoinGeckoPrices, tokenMap: Record) => number; export declare const toSubDisplay: (amounts: AmountDetails, tokenInfo: TokenItemType, tokenMap: Record) => number; export declare const toSubAmount: (amounts: AmountDetails, tokenInfo: TokenItemType, tokenMap: Record) => bigint; export declare const toSumDisplay: (amounts: AmountDetails, tokenMap: Record) => number; export type RetryOptions = { retry?: number; timeout?: number; callback?: (retry: number) => void; }; export declare const fetchRetry: (url: RequestInfo | URL, options?: RequestInit & RetryOptions) => Promise; /** * @deprecated since version 1.0.76. Use `parseAssetInfo` instead. */ export declare function parseAssetInfoOnlyDenom(info: AssetInfo): string; export declare const decodeProto: (value: JsonObject) => any; export declare const parseWasmEvents: (events: readonly Event[]) => { [key: string]: string; }[]; export declare const parseTxToMsgsAndEvents: (indexedTx: Tx, eventsParser?: (events: readonly Event[]) => Attribute[]) => { attrs: { [key: string]: string; }[] | Attribute[]; message: any; }[]; export declare const validateAndIdentifyCosmosAddress: (address: string, network: string, cosmosChains: CustomChainInfo[]) => { isValid: boolean; network: string; error?: undefined; } | { isValid: boolean; error: any; network?: undefined; }; export declare const validateEvmAddress: (address: string, network: string) => { isValid: boolean; network: string; } | { isValid: boolean; network?: undefined; }; export declare const validateAddressTonTron: (address: string, network: string) => { isValid: boolean; network: "0x2b6653dc" | "ton"; error?: undefined; } | { isValid: boolean; error: any; network?: undefined; }; export declare const checkValidateAddressWithNetwork: (address: string, network: string, cosmosChains: CustomChainInfo[]) => { isValid: boolean; network: string; } | { isValid: boolean; network?: undefined; }; export declare const isCosmosChain: (chainId: string, cosmosChains?: any[]) => boolean; export declare const isEvmChain: (chainId: string, evmChains?: any[]) => boolean; export declare const isTonChain: (chainId: string) => boolean;