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AI,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,KAAKxa,IAAI2X,EAAoBlB,EAAGkB,IAAsBgC,KAAKpW,EACnI,C,ICF0BoU,EAAoBvQ,G","sources":["components/NumberFormat/index.tsx","constants/chain.ts","constants/global.ts","constants/storage.ts","utils/chain.tsx","utils/index.ts","utils/numberUtil.ts","utils/storage.ts","utils/token.ts","worker/ERC20Worker.ts","worker/UserWorker.ts","../webpack/bootstrap","../webpack/runtime/amd options","../webpack/runtime/chunk loaded","../webpack/runtime/compat get default export","../webpack/runtime/create fake namespace object","../webpack/runtime/define property getters","../webpack/runtime/ensure chunk","../webpack/runtime/get javascript chunk filename","../webpack/runtime/get mini-css chunk filename","../webpack/runtime/global","../webpack/runtime/hasOwnProperty shorthand","../webpack/runtime/make namespace object","../webpack/runtime/node module decorator","../webpack/runtime/runtimeId","../webpack/runtime/publicPath","../webpack/runtime/importScripts chunk loading","../webpack/runtime/nonce","../webpack/runtime/startup chunk dependencies","../webpack/startup"],"sourcesContent":["import './index.less';\n\nimport { AbstractTooltipProps } from 'antd/lib/tooltip';\nimport BN from 'bignumber.js';\nimport classNames from 'classnames';\nimport { BigNumber, BigNumberish } from 'ethers';\nimport React, { FC, ReactNode, useCallback, useMemo } from 'react';\nimport CountUp, { CountUpProps } from 'react-countup';\n\nimport { WrappedBigNumber } from '@/entities/WrappedBigNumber';\nimport { bNToS, formatDisplayNumber, formatEther, formatNumber, toBN, toWad } from '@/utils/numberUtil';\n\nimport { Tooltip } from '../ToolTip';\ninterface IFormatNumberTooltipWrapProps {\n num: BigNumberish | BN;\n formattedNumStr?: string | undefined;\n colorShader?: boolean;\n isBold?: boolean;\n isShowTBMK?: boolean;\n toolTipProps?: AbstractTooltipProps;\n showToolTip?: boolean;\n prefix?: string;\n suffix?: string;\n colorSuffix?: boolean;\n isShowApproximatelyEqualTo?: boolean;\n showZeroIfNegative?: boolean;\n countUpProps?: Omit;\n showPositive?: boolean;\n minDecimalPlaces?: number;\n isUseMockNumber?: boolean;\n isShowSuffixInTooltip?: boolean;\n}\n\ntype DisplayStrWithCountUpTypes = {\n num: BN;\n iProps?: Omit;\n formattedNumStr?: string;\n isShowTBMK?: boolean;\n};\n/**\n * TODO: temp for start\n * @param num\n * @returns\n */\nexport function negativeNumberColor(num: BN): string {\n return toBN(num).gte(0) ? '#14B84B' : '#FF6666';\n}\n\nconst DisplayStrWithCountUp: FC = ({ num, iProps }) => {\n // get number decimals;\n\n const defaultProps = {\n duration: 1,\n useEasing: true,\n useGrouping: true,\n preserveValue: true,\n ...iProps,\n decimals: 9,\n } as CountUpProps;\n const formattingFn = useCallback((value: number | null) => {\n const formatNum = formatDisplayNumber({ num: value || 0, type: 'price' });\n return formatNum;\n }, []);\n\n return (\n \n );\n};\nconst formatNumberTooltipWrap: FC = function ({\n num,\n formattedNumStr,\n colorShader = false,\n isBold = false,\n isShowTBMK = false,\n toolTipProps,\n prefix,\n suffix,\n showToolTip = true,\n countUpProps,\n showPositive,\n colorSuffix = false,\n isShowApproximatelyEqualTo,\n minDecimalPlaces,\n showZeroIfNegative,\n isUseMockNumber = false,\n isShowSuffixInTooltip = false,\n}) {\n let numRes = toBN(isUseMockNumber ? '1234567899876' : num || '');\n if (numRes.lt(0) && showZeroIfNegative) {\n numRes = toBN(0);\n }\n function displayStrWithCountUp(num: BN, disPlayStr: string) {\n return countUpProps && !num.isNaN() && !num.isZero() ? (\n \n ) : (\n disPlayStr\n );\n }\n\n const suffixDom = suffix && {suffix};\n\n function showColorNumber(colorShader: boolean, num: BN, disPlayStr: string, isBold = false): JSX.Element {\n if (isBold) {\n return colorShader && !num.eq(0) ? (\n \n \n {prefix}\n {displayStrWithCountUp(num, disPlayStr)}\n \n {suffixDom}\n \n ) : (\n \n \n {prefix}\n {displayStrWithCountUp(num, disPlayStr)}\n \n {suffixDom}\n \n );\n }\n return colorShader && !num.eq(0) ? (\n \n \n {prefix}\n {displayStrWithCountUp(num, disPlayStr)}\n {colorSuffix && suffixDom}\n \n {!colorSuffix && suffixDom}\n \n ) : (\n \n \n {prefix}\n {displayStrWithCountUp(num, disPlayStr)}\n \n {suffixDom}\n \n );\n }\n\n let displayNumStr = numRes.eq(0) ? '0.00' : numRes.toString();\n if (formattedNumStr) {\n displayNumStr = formattedNumStr;\n } else {\n displayNumStr = formatDisplayNumber({\n num: numRes,\n showPositive,\n isShowTBMK,\n isShowApproximatelyEqualTo,\n minDecimalPlaces,\n });\n }\n\n if (prefix === '$') {\n if (displayNumStr.startsWith('-')) {\n prefix = '-$';\n displayNumStr = displayNumStr.slice(1);\n }\n if (displayNumStr.startsWith('+')) {\n prefix = '+$';\n displayNumStr = displayNumStr.slice(1);\n }\n if (displayNumStr.startsWith('<')) {\n prefix = '<$';\n displayNumStr = displayNumStr.slice(1);\n }\n }\n\n return showToolTip && !numRes.eq(0) ? (\n \n {showColorNumber(colorShader, numRes, displayNumStr, isBold)}\n \n ) : (\n showColorNumber(colorShader, numRes, displayNumStr, isBold)\n );\n};\n\n/**\n * formatNumberWithTooltip\n * @param num orgin number\n * @param showTooltip Whether tooltip is displayed\n * @param colorShader Whether to color negative numbers,\n * @returns\n */\nexport type FormatNumberWithTooltipType = Omit;\nexport const formatNumberWithTooltip = ({\n num,\n colorShader = false,\n isBold = false,\n isShowTBMK = false,\n toolTipProps,\n prefix,\n suffix,\n showPositive,\n colorSuffix,\n countUpProps,\n isShowApproximatelyEqualTo,\n showZeroIfNegative,\n showToolTip,\n minDecimalPlaces,\n isUseMockNumber,\n isShowSuffixInTooltip,\n}: FormatNumberWithTooltipType): React.ReactNode => {\n return formatNumberTooltipWrap({\n num,\n colorShader,\n isBold,\n toolTipProps,\n isShowTBMK,\n prefix,\n suffix,\n colorSuffix,\n countUpProps,\n showPositive,\n isShowApproximatelyEqualTo,\n showToolTip,\n minDecimalPlaces,\n showZeroIfNegative,\n isUseMockNumber,\n isShowSuffixInTooltip,\n });\n};\n\n/**\n * format price num display\n * @param num price\n * @param decimals default decimals\n * @param colorShader is show diff color\n * @param keepMaxOriginalNumber is keep original number\n * @returns\n */\nexport const formatPriceNumberWithTooltip = ({\n num,\n colorShader = false,\n isOperateNum = false,\n isShowTBMK = false,\n prefix,\n isShowApproximatelyEqualTo,\n suffix,\n showPositive,\n significantDigits,\n roundingMode,\n}: {\n num: BigNumberish | BN;\n colorShader?: boolean;\n isBold?: boolean;\n toolTipProps?: AbstractTooltipProps;\n isOperateNum?: boolean;\n isShowTBMK?: boolean;\n prefix?: string;\n isShowApproximatelyEqualTo?: boolean;\n suffix?: string;\n showPositive?: boolean;\n significantDigits?: number;\n roundingMode?: BN.RoundingMode;\n}): React.ReactNode => {\n const formattedNumStr = formatDisplayNumber({\n num,\n type: 'price',\n isOperateNum,\n isShowApproximatelyEqualTo,\n showPositive,\n significantDigits,\n roundingMode,\n });\n return formatNumberTooltipWrap({\n num,\n formattedNumStr,\n colorShader,\n isShowTBMK,\n prefix,\n suffix,\n });\n};\n\n/**\n * format liquidation price num display\n * if price >= 1e6 display as 0\n * @param num price\n * @param decimals default decimals\n * @param colorShader is show diff color\n * @param keepMaxOriginalNumber is keep original number\n * @returns\n */\nexport const formatLiqPriceNumberWithTooltip = ({\n num,\n colorShader = false,\n suffix,\n ...options\n}: FormatNumberWithTooltipType): React.ReactNode => {\n const price = toBN(num);\n let formattedNumStr = '';\n if (!price.eq(0)) {\n if (price.abs().gte(1e6)) {\n num = Infinity;\n } else if (price.lt(0)) {\n num = 0;\n }\n formattedNumStr = formatDisplayNumber({ num, type: 'price' });\n }\n return formatNumberTooltipWrap({ num, formattedNumStr, colorShader, suffix, ...options });\n};\n\nexport const useFormatLiqPriceNumberWithTooltip = ({\n num,\n colorShader = false,\n}: {\n num: BigNumberish;\n colorShader?: boolean;\n}): React.ReactNode => {\n return useMemo(() => {\n return formatLiqPriceNumberWithTooltip({ num, colorShader });\n }, [colorShader, num]);\n};\n\nexport const formatStringWithTooltip = ({\n str,\n title,\n isBold = false,\n toolTipProps,\n}: {\n str: string;\n title: string;\n isBold?: boolean;\n toolTipProps?: AbstractTooltipProps;\n}): React.ReactNode => {\n return (\n \n {isBold ? {str} : {str}}\n \n );\n};\n\nexport function formatLeverageWithTooltip(leverage: BigNumber | undefined): ReactNode {\n const leverageFormatted = formatEther(leverage);\n if (leverage?.lt(0)) return <>-;\n return <>{leverage?.eq(0) ? 0 : leverage?.lt(toWad(0.1)) ? <>< 0.1 : formatNumber(leverageFormatted, 1)}x;\n // return (\n // \n // {leverage?.eq(0) ? 0 : leverage?.lt(toWad(0.1)) ? <>< 0.1 : formatNumber(leverageFormated, 2)}x\n // \n // );\n}\n\nexport function formatPercentage({\n percentage,\n hundredfold = true,\n colorShader = true,\n customTitle,\n decimals = 2,\n withThreshHold,\n prefix = '',\n suffix = '',\n isColorShaderWhiteIfZero = false,\n isHiddenIfZero = false,\n requirePlusSymbol = false,\n className,\n}: {\n percentage: number | string;\n hundredfold?: boolean;\n colorShader?: boolean;\n customTitle?: ReactNode;\n decimals?: number;\n withThreshHold?: boolean;\n prefix?: string;\n suffix?: string;\n isColorShaderWhiteIfZero?: boolean;\n isHiddenIfZero?: boolean;\n requirePlusSymbol?: boolean;\n className?: string;\n}): ReactNode {\n const percentageNumber = WrappedBigNumber.from(percentage).mul(hundredfold ? 100 : 1);\n let displayString = formatNumber(percentageNumber, decimals);\n\n if (withThreshHold) {\n const percentageBN = WrappedBigNumber.from(percentageNumber);\n const threshold = WrappedBigNumber.from(1 / 10 ** decimals);\n if (percentageBN.notEq(0) && percentageBN.abs().lt(threshold)) {\n displayString = '<' + (percentageNumber.gt(0) ? '' : '-') + threshold.stringValue;\n }\n }\n let colorShaderClassname = colorShader ? (percentageNumber.lt(0) ? 'text-danger' : 'text-success') : '';\n if (isColorShaderWhiteIfZero && percentageNumber.eq(0)) {\n colorShaderClassname = '';\n }\n if (percentageNumber.eq(0) && isHiddenIfZero) {\n return null;\n }\n let plusMinusSymbol = '';\n if (requirePlusSymbol) {\n if (percentageNumber.gt(0)) {\n plusMinusSymbol = '+';\n }\n }\n return (\n \n {`${plusMinusSymbol}${prefix}${displayString}%${suffix}`}\n \n );\n}\n","import { CHAIN_ID } from '@derivation-tech/context';\nimport { arbitrum, base, blast, blastSepolia, linea } from 'wagmi/chains';\n\nimport { getDappChainConfig } from '@/configs/chain';\nimport { IDappChainConfig, ISynfConfigInfo } from '@/types/chain';\nimport { BackendChainsConfig } from '@/types/config';\nimport { getChainConfigInfo } from '@/utils/chainConfig';\n\n/**\n * available chain id array\n */\nlet SUPPORTED_CHAIN_ID = [CHAIN_ID.BLAST, CHAIN_ID.BASE];\n\nif (process.env.REACT_APP_AVAILABLE_CHAIN_ID) {\n const arr = process.env.REACT_APP_AVAILABLE_CHAIN_ID.split(',');\n if (arr && arr.length > 0) {\n SUPPORTED_CHAIN_ID = arr.map((chainIdStr) => Number(chainIdStr));\n }\n}\n\n/**\n * display chain id array in [Select a Network] modal\n * Usually remove the test network\n */\nlet DISPLAYABLE_CHAIN_ID = [CHAIN_ID.BASE, CHAIN_ID.BLAST];\n\nif (process.env.REACT_APP_DISPLAYABLE_CHAIN_ID) {\n const arr = process.env.REACT_APP_DISPLAYABLE_CHAIN_ID.split(',');\n if (arr && arr.length > 0) {\n DISPLAYABLE_CHAIN_ID = arr.map((chainIdStr) => Number(chainIdStr));\n }\n}\n\n/**\n * default chain id for wrong network\n */\nconst DEFAULT_CHAIN_ID: number = parseInt(process.env.REACT_APP_CHAIN_ID ?? '1');\n\nconst chainConfigs: {\n [chainId: number]: ISynfConfigInfo;\n} = {\n [CHAIN_ID.LINEA]: getChainConfigInfo(CHAIN_ID.LINEA),\n [CHAIN_ID.BLASTSEPOLIA]: getChainConfigInfo(CHAIN_ID.BLASTSEPOLIA),\n [CHAIN_ID.BLAST]: getChainConfigInfo(CHAIN_ID.BLAST),\n [CHAIN_ID.ARBITRUM]: getChainConfigInfo(CHAIN_ID.ARBITRUM),\n [CHAIN_ID.BASE]: getChainConfigInfo(CHAIN_ID.BASE),\n};\n\nconst DAPP_CHAIN_CONFIGS: {\n [chainId: number]: IDappChainConfig;\n} = {\n [CHAIN_ID.LINEA]: getDappChainConfig(CHAIN_ID.LINEA, linea),\n [CHAIN_ID.BLASTSEPOLIA]: getDappChainConfig(CHAIN_ID.BLASTSEPOLIA, blastSepolia),\n [CHAIN_ID.BLAST]: getDappChainConfig(CHAIN_ID.BLAST, blast),\n [CHAIN_ID.ARBITRUM]: getDappChainConfig(CHAIN_ID.ARBITRUM, arbitrum),\n [CHAIN_ID.BASE]: getDappChainConfig(CHAIN_ID.BASE, base),\n};\n\nexport const getAllDisplayableChainMarketCustomPairs = (backendChainsConfig: BackendChainsConfig) =>\n DISPLAYABLE_CHAIN_ID.reduce(\n (prev, curr) => {\n return [\n ...prev,\n ...(backendChainsConfig[curr]?.marketCustomPairs || []).map((pairInfo) => ({ ...pairInfo, chainId: curr })),\n ];\n },\n [] as {\n id: string;\n title: string;\n pairs: string[];\n chainId: CHAIN_ID;\n }[],\n );\nexport const quoteTokenSymbolColors = [\n '#00BFBF',\n '#00CC99',\n '#1B9844',\n '#30E84F',\n '#396A93',\n '#4D88FF',\n '#5555F6',\n '#5C5CD6',\n '#6495ED',\n '#66CCFF',\n '#7C67E4',\n '#88CC00',\n '#8FBC8F',\n '#99BBFF',\n '#BF40BF',\n '#C270C2',\n '#CCAA00',\n '#F98686',\n '#FF69B4',\n '#FF8C00',\n '#FF4500',\n '#FFD700',\n '#ADFF2F',\n '#7FFF00',\n '#32CD32',\n '#00FA9A',\n '#00CED1',\n '#4682B4',\n '#4169E1',\n '#8A2BE2',\n '#9400D3',\n '#9932CC',\n '#8B008B',\n '#FF1493',\n '#FF6347',\n '#FF7F50',\n '#FFDAB9',\n '#EEE8AA',\n '#98FB98',\n '#AFEEEE',\n '#DDA0DD',\n];\n\nconst CHAIN_NAME_ID: { [key: string]: number } = {\n base: CHAIN_ID.BASE,\n blast: CHAIN_ID.BLAST,\n blastsepolia: CHAIN_ID.BLASTSEPOLIA,\n arbitrum: CHAIN_ID.ARBITRUM,\n linea: CHAIN_ID.LINEA,\n goerli: CHAIN_ID.GOERLI,\n};\n\nexport const SHOW_BUILD_CHAIN = [CHAIN_ID.BLAST, CHAIN_ID.BASE];\n\nexport {\n CHAIN_ID,\n CHAIN_NAME_ID,\n chainConfigs,\n DAPP_CHAIN_CONFIGS,\n DEFAULT_CHAIN_ID,\n DISPLAYABLE_CHAIN_ID,\n SUPPORTED_CHAIN_ID,\n};\n","export const DEFAULT_EMPTY_ACCOUNT = '0x0000000000000000000000000000000000000000';\n// leverage\nexport const DynamicLeverage = 'DynamicLeverage';\n\n// liquidity\nexport const CREATE_POOL_KEY = 'CREATING_POOL';\nexport enum LIQUIDITY_FORM_TYPE {\n CREATE = 'CREATE',\n ADD_REMOVE = 'ADD_REMOVE',\n}\nexport enum PAIR_PAGE_TYPE {\n TRADE = 'trade',\n EARN = 'earn',\n}\n\nexport const enum TRADE_LEVERAGE_THRESHOLDS {\n MIN = 0.1,\n MAX = 10,\n ACTUAL_MAX = 9.9,\n DEFAULT = 5,\n STEP = 0.1,\n ACTUAL_MAX_STEP = 0.1,\n}\n\n/**\n * show warning when slippage is higher than threshold\n */\nexport const enum SLIPPAGE_THRESHOLDS {\n LOW = 0.1,\n HIGH = 5, // show warning when bigger than 5%\n MIN = 0.01,\n MAX = 5,\n DEFAULT = 0.1,\n}\n\nexport const enum DEADLINE_THRESHOLDS {\n MIN = 1,\n MAX = 60,\n DEFAULT = 5,\n}\n\nexport enum FLEX_TABLE_TYPE {\n ACCOUNTS = 'ACCOUNTS',\n SEARCH = 'SEARCH',\n}\n\nexport const enum EARN_ALPHA_THRESHOLDS {\n MIN = 1,\n MAX = 5,\n DEFAULT = 4,\n DEFAULT_TICK = 20,\n DEFAULT_IMR = 0.1,\n}\n\nexport enum TABLE_TYPES {\n POSITION = 'Position',\n LIQUIDITY = 'Liquidity',\n LIQUIDITY_HISTORY = 'Liquidity History',\n OPEN_ORDERS = 'Open Orders',\n TRADE_HISTORY = 'Trade History',\n ORDER_HISTORY = 'Order History',\n TRANSFERS = 'Transfers',\n FUNDING = 'Funding',\n TRADING_PAIR = 'Trading Pair',\n ASSETS = 'Assets',\n PORTFOLIO_POSITIONS = 'Portfolio Positions',\n PORTFOLIO_LIQUIDITIES = 'Portfolio Liquidities',\n PORTFOLIO_OPEN_ORDERS = 'Portfolio Open Orders',\n EARN_LIST = 'Earn List',\n VOLUME_DETAIL = 'Volume-Detail',\n HISTORY = 'HISTORY',\n}\n\nexport const DEFAULT_DECIMALS = 18;\nexport const INPUT_NUMBER_STEP = 0.001;\n\nexport enum SEARCH_PAIR_SORTERS {\n FAVORITE = 'favorite',\n EARN_FAVORITE = 'earn.favorite',\n VOLUME_24H = '24HV',\n CHANGE_24H = '24HC',\n BOOSTED_LIQUIDITY = 'effectLiq',\n TVL = 'tvl',\n OI = 'oi',\n APY = 'apy',\n}\nexport const SEARCH_PAIR_SORTERS_TRANSLATION = {\n [SEARCH_PAIR_SORTERS.FAVORITE]: '24HV',\n [SEARCH_PAIR_SORTERS.EARN_FAVORITE]: 'earn.estApy',\n [SEARCH_PAIR_SORTERS.VOLUME_24H]: '24HV',\n [SEARCH_PAIR_SORTERS.CHANGE_24H]: '24HC',\n [SEARCH_PAIR_SORTERS.TVL]: 'tvl',\n [SEARCH_PAIR_SORTERS.OI]: 'oiS',\n [SEARCH_PAIR_SORTERS.APY]: 'table.liqApy',\n [SEARCH_PAIR_SORTERS.BOOSTED_LIQUIDITY]: 'effectLiq',\n};\nexport enum SEARCH_PAIR_DIRECTION {\n ASC = 'asc',\n DSC = 'desc',\n}\n\nexport const BATCH_INSTRUMENT_SIZE = 20;\n\nexport const SIGNIFICANT_DIGITS = 5;\n\nexport const PAIR_RATIO_BASE = 10000;\nexport const MMR_RATIO = 0.2;\nexport const TVL_THRESHHOLD = 0;\nexport const GLOBAL_TVL_THRESHHOLD = 100;\nexport const MARK_FAIR_DEV_THRESHHOLD = 0.005;\nexport const AIP_DOMAIN = 'https://api.synfutures.com';\n","const prefix = 'syn';\n\n/**\n * localStorage start\n */\nexport const LOCAL_THEME = `${prefix}-theme`;\nexport const ALL_USER_INFO = `${prefix}-all-user-info`;\nexport const LAST_POSITIONS_NUMBER = 'LAST_POSITIONS_NUMBER';\nexport const LAST_HISTORY_UNDERLYING_ADDR = 'LAST_HISTORY_UNDERLYING_ADDR';\nexport const MOBILE_ROUTE_BEFORE_SEARCH = 'MOBILE_ROUTE_BEFORE_SEARCH';\nexport const SYN_AGREE_TERM = `syn-agree-term`;\nexport const INITIAL_CHAIN_SELECTED = 'syn-initial-chain-selected';\nexport const GLOBAL_CONFIG = `global-config`;\nexport const GOT_PRICE_ROUNDED = `got-price-rounded`;\nexport const HIDE_HISTORY_TOOLTIP = `hide-history-tooltip`;\nexport const MOBILE_MINT_TOASTER = `mobile-mint-toaster`;\nexport const HIDE_REFRESH_HISTORY_DATA = 'hide_refresh_history_data';\nexport const FIRST_MYSTERY_BOX_POPPED = 'first_mystery_box_popped';\nexport const MOBILE_SHOW_CHART = 'mobile_show_chart';\nexport const MOBILE_SHOW_CHART_EARN = 'mobile_show_chart_earn';\nexport const CLAIM_TOKEN_MODAL_OPENED = 'claim_token_modal_opened';\nexport const TOKEN_ADDRESS_WARNING = 'token_address_warning';\nexport const SIGN_UP_SKIPPED = 'sign_up_skipped';\nexport const LAST_EPOCH_OPENED = 'last_epoch_opened';\nexport const PRICE_BASIS_FOR_PNL = 'price_basis_for_pnl';\nexport const HIDE_TVL_MODAL = 'HIDE_TVL_MODAL';\nexport const NO_SHOW_PNL_NOTIFICATION = 'NO_SHOW_PNL_NOTIFICATION';\nexport const WALLET_TYPE = 'WALLET_TYPE';\nexport const SEARCH_PAIR_SORTER = 'SEARCH_PAIR_SORTER';\nexport const SEARCH_PAIR_SORTER_DIRECTION = 'SEARCH_PAIR_SORTER_DIRECTION';\nexport const SYN_YEAR2024_SUMMARY = 'SYN_YEAR2024_SUMMARY_0';\nexport const GET_SYN_SPOT_SWAP_BUY_TOKEN = (chainId: number) => `SYN_SPOT_SWAP_BUY_TOKEN_${chainId}`;\nexport const GET_SYN_SPOT_SWAP_SELL_TOKEN = (chainId: number) => `SYN_SPOT_SWAP_SELL_TOKEN_${chainId}`;\n/**\n * localStorage end\n */\n\n/**\n * localForage start\n */\n// the localforage sometimes needs to be clean for newer releases\n// to achieve this simply bump up the keys down\n\nexport const S3_PAIRS_KEY = 'S3_PAIRS-3.4.2';\nexport const PAIRS_FAVORITES_KEY = 'PAIRS_FAVORITES-3.4.2';\nexport const LOCAL_SIGNED_UP = 'LOCAL_SIGNED_UP';\nexport const APP_CHAIN_ID = 'APP_CHAIN_ID';\nexport const LEVERAGE_CHOSEN = 'LEVERAGE_CHOSEN_3.4.2';\nexport const PAIR_CHOSEN = 'PAIR_CHOSEN_3.4.2';\nexport const SIGNATURE_FOR_ODYSSEY = 'SIGNATURE_FOR_ODYSSEY_1';\nexport const REFERRAL_CODE_FOR_ODYSSEY = 'REFERRAL_CODE_FOR_ODYSSEY_2';\nexport const JWT_FOR_ODYSSEY = 'JWT_FOR_ODYSSEY';\nexport const TGP_SHARED_JOIN_STATUS = 'tgp_shared_join_status';\nexport const JWT_FOR_TGP = 'JWT_FOR_TGP';\nexport const LOCAL_RPC_URL = 'LOCAL_RPC_URL';\nexport const PAIRS_PARTICIPATED = 'PAIRS_PARTICIPATED';\n\n/**\n * localForage end\n */\n","import { CHAIN_ID } from '@derivation-tech/context';\nimport { JsonRpcProvider, StaticJsonRpcProvider } from '@ethersproject/providers';\nimport { Overrides, providers } from 'ethers';\n\nimport { ReconnectingWebSocketProvider } from '@/connectors/WebSocketConnector/ReconnectingWebSocketProvider';\nimport { DAPP_CHAIN_CONFIGS, DEFAULT_CHAIN_ID, SUPPORTED_CHAIN_ID } from '@/constants/chain';\nimport { CHAIN_HTTP_RPC_URLS, CHAIN_WSS_RPC_URLS } from '@/constants/rpc';\nimport { APP_CHAIN_ID } from '@/constants/storage';\nimport { getRpcFromLocalForage } from './storage';\n/**\n * get chainName by Chain id\n * @param chainId\n * @returnschain\n */\nexport function getChainName(chainId: CHAIN_ID): string {\n let chainName = '';\n const dappChainConfig = DAPP_CHAIN_CONFIGS[chainId];\n if (dappChainConfig) {\n chainName = dappChainConfig.network.name || '';\n }\n\n return chainName;\n}\n\nexport function getChainShortName(chainId: CHAIN_ID): string {\n let chainName = '';\n if (DAPP_CHAIN_CONFIGS[chainId]) {\n chainName = DAPP_CHAIN_CONFIGS[chainId].network.shortName || '';\n }\n\n return chainName;\n}\n\nexport function getChainIdByChainShortName(chainShortName: string): CHAIN_ID | null | undefined {\n if (chainShortName) {\n let chainId: CHAIN_ID | null = null;\n Object.entries(DAPP_CHAIN_CONFIGS).map(([chainIdStr, chainConfig]) => {\n if (chainConfig.network.shortName === chainShortName) {\n chainId = Number(chainIdStr) as CHAIN_ID;\n }\n });\n\n return chainId;\n }\n}\n\nexport function getGasSettings(): Overrides {\n return { gasLimit: 2500000 };\n}\n\n/**\n * get default chainId from localStorage or default config\n * @returns\n */\nexport function getDefaultChainId(): number {\n const localChainId = localStorage.getItem(APP_CHAIN_ID);\n if (localChainId !== null) {\n if (SUPPORTED_CHAIN_ID.includes(Number(localChainId))) {\n return Number(localChainId);\n }\n }\n return DEFAULT_CHAIN_ID;\n}\n\nexport function isTestnet(chainId: number | undefined): boolean {\n return chainId ? DAPP_CHAIN_CONFIGS[chainId]?.network.isTestnet || false : false;\n}\n\nexport async function getWssProvider(\n chainId: number | undefined,\n url?: string,\n): Promise {\n if (!chainId || !CHAIN_WSS_RPC_URLS[chainId]) return undefined;\n if (!url) url = CHAIN_WSS_RPC_URLS?.[chainId]?.[0];\n return ReconnectingWebSocketProvider.getInstance(chainId, url);\n}\n\nexport function getHttpProvider(chainId: number | undefined, url?: string): JsonRpcProvider | undefined {\n if (chainId && !url) url = CHAIN_HTTP_RPC_URLS?.[chainId]?.[0];\n if (chainId && !url) {\n const dappChainConfig = DAPP_CHAIN_CONFIGS[chainId];\n url = dappChainConfig?.network.rpcUrl.public;\n }\n return new JsonRpcProvider(url, chainId);\n}\n\nconst chainBlockExplorerLinks = Object.values(DAPP_CHAIN_CONFIGS).map((config) => config.network.blockExplorer.url);\nexport const checkLinkIsBlockExplorer = (link: string) => {\n return chainBlockExplorerLinks.some((blockExplorerLink) =>\n link.toLowerCase().includes(blockExplorerLink.toLowerCase()),\n );\n};\n\nexport async function getProviderFromLocalOrSetting(chainId: number): Promise<\n | {\n type: 'wss';\n provider: ReconnectingWebSocketProvider;\n }\n | {\n type: 'https';\n provider: JsonRpcProvider;\n }\n> {\n const localRpcUrl = await getRpcFromLocalForage(chainId);\n // if no local rpc url, use the default rpc url\n if (!localRpcUrl) {\n const wssRpcUrl = CHAIN_WSS_RPC_URLS?.[chainId]?.[0];\n if (wssRpcUrl) {\n return {\n type: 'wss',\n provider: ReconnectingWebSocketProvider.getInstance(chainId, wssRpcUrl),\n };\n } else {\n return {\n type: 'https',\n provider: getFallbackProvider(chainId, CHAIN_HTTP_RPC_URLS?.[chainId]) as unknown as JsonRpcProvider, //new StaticJsonRpcProvider(httpsUrl, chainId),\n };\n }\n }\n // if local rpc url exists, use the local rpc url\n if (localRpcUrl.type === 'wss') {\n return {\n type: 'wss',\n provider: ReconnectingWebSocketProvider.getInstance(chainId, localRpcUrl.rpc),\n };\n } else {\n return {\n type: 'https',\n provider: new StaticJsonRpcProvider(localRpcUrl.rpc, chainId),\n };\n }\n}\n\nexport function getFallbackProvider(chainId: number, urls: string[]) {\n const stallTimeout = 1000;\n const proiders = urls.map((url) => new providers.StaticJsonRpcProvider(url, chainId));\n const params = proiders.map((provider, index) => {\n return {\n provider: provider,\n priority: 1 + index,\n weight: 1,\n stallTimeout,\n };\n });\n const provider = new providers.FallbackProvider(params);\n\n return provider;\n}\n","import { DEFAULT_THEME, THEME_ENUM } from '@/constants';\nimport { LOCAL_THEME } from '@/constants/storage';\nimport { WrappedBigNumber } from '@/entities/WrappedBigNumber';\nimport { WrappedQuote } from '@/entities/WrappedQuote';\nimport { BigNumber } from 'ethers';\nimport _ from 'lodash';\n\n/**\n * polling func\n * @param {Function} func\n * @param {Number} interval\n */\nexport const pollingFunc = (func: () => void, interval = 3000, immediately = true): NodeJS.Timeout => {\n if (immediately) {\n func();\n }\n return setInterval(() => {\n func();\n }, interval);\n};\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types\nexport function bigNumberObjectCheck(obj: any): any {\n const cloneObj = _.clone(obj);\n if (cloneObj) {\n if (cloneObj) {\n try {\n Object.keys(cloneObj).forEach((key) => {\n const val = cloneObj[key];\n //reset bignumber if number is not correct class\n if (val?.bn && val?.value) {\n cloneObj[key] = BigNumber.from(val.value);\n } else if (val?._hex && BigNumber.isBigNumber(val) && !(val instanceof BigNumber)) {\n cloneObj[key] = BigNumber.from(val);\n } else if (val?.hex && val?.type === 'BigNumber') {\n cloneObj[key] = BigNumber.from(val);\n } else if (typeof val === 'object' && val && Object.keys(val).length > 0) {\n if (val instanceof WrappedBigNumber || val instanceof WrappedQuote) {\n cloneObj[key] = val;\n } else {\n const newVal = bigNumberObjectCheck(val);\n cloneObj[key] = newVal;\n }\n }\n });\n } catch (error) {\n console.error(error);\n }\n }\n }\n return cloneObj;\n}\n\nexport function getDefaultTheme(): THEME_ENUM {\n const localTheme = localStorage.getItem(LOCAL_THEME);\n if (localTheme) {\n return localTheme as THEME_ENUM;\n }\n return DEFAULT_THEME;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function debounceRequest Promise>(\n func: T,\n wait = 300,\n): (...args: Parameters) => Promise> {\n let timeout: NodeJS.Timeout | null = null;\n\n return (...args: Parameters) => {\n return new Promise((resolve, reject) => {\n if (timeout) {\n clearTimeout(timeout);\n }\n\n timeout = setTimeout(() => {\n func(...args)\n .then(resolve)\n .catch(reject);\n }, wait);\n });\n };\n}\n","import BN from 'bignumber.js';\nimport { BigNumber, BigNumberish, utils } from 'ethers';\nimport { parseUnits } from 'ethers/lib/utils';\nimport _ from 'lodash';\n\nimport { DEFAULT_DECIMAL_PLACES, ZERO } from '@/constants';\nimport { SIGNIFICANT_DIGITS } from '@/constants/global';\nimport { decimalShortFormSymbolMap, minExclusiveNumToShowShortDecimal } from '@/constants/number';\nimport { WrappedBigNumber } from '@/entities/WrappedBigNumber';\nimport { wdiv } from '@synfutures/sdks-perp';\n\n/**\n * Get the number of zeros behind the decimal point to the right of the first non-zero digit.\n *\n * @param {BigNumberish | BN} num - The input number for which to calculate the number of trailing zeros.\n * @returns {number} The number of zeros behind the decimal point to the right of the first non-zero digit.\n */\nexport function countNumTrailingZeros(num: BigNumberish | BN): number {\n const numBN = toBN(num);\n const numStr = numBN.toString(10);\n const decimalPart = numStr.split('.')[1];\n if (decimalPart) {\n let countZeros = 0;\n for (let i = 0; i < decimalPart.length; i++) {\n if (decimalPart[i] === '0') {\n countZeros++;\n } else {\n break;\n }\n }\n return countZeros;\n } else {\n return 0;\n }\n}\n\n/**\n * Get the short form of a decimal number with trailing zeros replaced by subscript symbols.\n *\n * @param {BN} numBN - The input BigNumber (BN) for which to create the short form of the decimal number.\n * @returns {string} The short form of the decimal number with trailing zeros replaced by subscript symbols.\n */\nexport function getShortFormDeciamal(numBN: BigNumberish | BN, tailSignificantDigits = 4): string {\n const maxCountZeros = 20;\n const numStr = numBN.toString(10);\n const countZeros = countNumTrailingZeros(numBN);\n const [integerPart, decimalPart] = numStr.split('.');\n if (countZeros > maxCountZeros || countZeros === 0) {\n return numStr;\n }\n\n const tail = decimalPart.slice(countZeros, decimalPart.length).slice(0, tailSignificantDigits);\n const tailWithPaddingZero = `${tail}${'0'.repeat(tailSignificantDigits - tail.length)}`;\n return `${integerPart}.0${decimalShortFormSymbolMap[countZeros]}${tailWithPaddingZero}`;\n}\n// the util function to make a bignumber, should be used whenever making a big number is need.\nexport function toBN(value: BigNumberish | BN, unit: 'normal' | 'ether' = 'normal'): BN {\n let number = value;\n if (unit === 'ether' && BigNumber.isBigNumber(value)) {\n number = utils.formatEther(value);\n }\n if (typeof number === 'undefined') {\n number = 0;\n }\n return new BN(number.toString(10), 10);\n}\n\n// equivalent to math.floor\nexport function bNRDown(value: BigNumberish | BN): BN {\n return toBN(value).integerValue(BN.ROUND_FLOOR);\n}\n\n// converting a bigNumber to string, should be used whenever converting is needed\nexport function bNToS(value: BigNumberish | BN, radix = 10): string {\n const res = toBN(value);\n return res.isNaN() ? '' : res.toString(radix);\n}\n\n/**\n * to show currency number with comma\n */\nconst toCurrencyNumber = (x: number | string): string => {\n const parts = x.toString().split('.');\n if (parts.length > 0) {\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n return parts.join('.');\n }\n return '';\n};\n\nconst CURRENCY_UNITS: ('K' | 'M' | 'B' | 'T')[] = ['K', 'M', 'B', 'T'];\nconst CURRENCY_UNIT_NUM = 10 ** 3; // 1000\n\nfunction getBigCurrencyNum(\n numBN: BN,\n unit: 'K' | 'M' | 'B' | 'T',\n roundingMode?: BN.RoundingMode,\n minDecimalPlaces = DEFAULT_DECIMAL_PLACES,\n): { numBN: BN; numStr: string; minDecimalPlaces?: number } {\n if (!roundingMode) roundingMode = BN.ROUND_DOWN;\n const i = CURRENCY_UNITS.findIndex((u) => u === unit);\n let numStr = numBN.toString(10);\n numBN = numBN.div(CURRENCY_UNIT_NUM);\n // get the biggest unit\n if (numBN.gte(CURRENCY_UNIT_NUM) && unit !== 'T') {\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n return getBigCurrencyNum(numBN, CURRENCY_UNITS[i + 1], roundingMode, minDecimalPlaces);\n }\n if (unit === 'T' && numBN.gte(CURRENCY_UNIT_NUM)) {\n numBN = numBN.integerValue(roundingMode);\n } else if (minDecimalPlaces !== 0) {\n numBN = numBN.precision(minDecimalPlaces, roundingMode);\n }\n\n numStr = `${\n minDecimalPlaces === 0 ? numBN.toFixed(0, roundingMode) : numBN.toPrecision(minDecimalPlaces, roundingMode)\n }${CURRENCY_UNITS[i]}`;\n\n return {\n numBN,\n numStr,\n };\n}\n\n/**\n * Format the given number for display with various options.\n *\n * @param {Object} options - The formatting options.\n * @param {BigNumberish | BN} options.num - The input number to be formatted.\n * @param {boolean} [options.isShowSeparator=true] - Whether to show separators in the formatted number.\n * @param {'price' | 'normal'} [options.type='normal'] - The type of formatting to apply.\n * @param {boolean} [options.isOperateNum=false] - Whether to the number is input which operate by user\n * @param {boolean} [options.isShowTBMK=false] - Whether to show TBMK unit for numbers greater than or equal to 10000.\n * @param {boolean} [options.showPositive] - Whether to show a positive sign for positive numbers.\n * @param {BN.RoundingMode} [options.roundingMode=BN.ROUND_DOWN] - The rounding mode to be used for formatting.\n * @param {number} [options.significantDigits=SIGNIFICANT_DIGITS] - The number of significant digits to display in the formatted number.\n * @param {number} [options.minDecimalPlaces=DEFAULT_DECIMAL_PLACES] - The minimum number of decimal places to display in the formatted number.\n * @param {boolean} [options.isShortFormDecimal=false] - Whether to use short form decimal notation.\n * @returns {string} The formatted number as a string.\n */\nexport function formatDisplayNumber({\n num,\n isShowSeparator = true,\n type = 'normal',\n isOperateNum = false,\n isShowTBMK = false,\n isShowApproximatelyEqualTo = true,\n showPositive,\n roundingMode = BN.ROUND_DOWN,\n significantDigits = SIGNIFICANT_DIGITS,\n minDecimalPlaces = DEFAULT_DECIMAL_PLACES,\n}: {\n num: BigNumberish | BN;\n isShowSeparator?: boolean;\n type?: 'price' | 'normal';\n isOperateNum?: boolean;\n isShowTBMK?: boolean;\n showPositive?: boolean;\n isShowApproximatelyEqualTo?: boolean;\n roundingMode?: BN.RoundingMode;\n significantDigits?: number;\n minDecimalPlaces?: number;\n}): string {\n let numBN = toBN(num);\n if (numBN.isNaN() || numBN.eq(Infinity)) {\n numBN = toBN(0);\n }\n let sign = '';\n if (numBN.isNegative()) {\n sign = '-';\n numBN = numBN.abs();\n } else if (showPositive && numBN.gt(0)) {\n sign = '+';\n }\n let numStr = numBN.toString(10);\n\n if (isOperateNum) {\n if (numBN.gte(1)) {\n numStr = numBN.toFixed(minDecimalPlaces, roundingMode);\n } else {\n numStr = numBN.toPrecision(minDecimalPlaces, roundingMode);\n }\n } else {\n // >=1000 use TBMK unit\n if (numBN.eq(0)) {\n numStr = numBN.toFixed(2, roundingMode);\n } else if (numBN.gte(10000)) {\n const numRes = numBN.integerValue(roundingMode);\n numStr = numRes.toString();\n if (isShowTBMK) {\n const numRes = getBigCurrencyNum(numBN, 'K', roundingMode, minDecimalPlaces);\n numStr = numRes.numStr;\n }\n } else if (numBN.gte(1000) && numBN.lt(10000)) {\n if (type === 'price') {\n numBN = numBN.precision(significantDigits, roundingMode);\n numStr = numBN.toPrecision(significantDigits, roundingMode);\n } else {\n const numRes = numBN.precision(significantDigits, roundingMode);\n numStr = numRes.toPrecision(significantDigits, roundingMode);\n if (isShowTBMK) {\n const numRes = getBigCurrencyNum(numBN, 'K', roundingMode, minDecimalPlaces);\n numStr = numRes.numStr;\n }\n }\n } else if (numBN.gte(1) && numBN.lt(1000)) {\n numBN = numBN.precision(significantDigits, roundingMode);\n if (minDecimalPlaces === 0) {\n numStr = numBN.toFixed(0, roundingMode);\n } else {\n numStr = numBN.toPrecision(significantDigits, roundingMode);\n }\n } else if (numBN.gte(0.0001) && numBN.lt(1)) {\n if (type === 'price') {\n if (numBN.lt(BN(minExclusiveNumToShowShortDecimal)) && numBN.gt(BN(0))) {\n numBN = numBN.precision(significantDigits, roundingMode);\n numStr = getShortFormDeciamal(numBN);\n } else {\n numBN = numBN.precision(significantDigits, roundingMode);\n numStr = numBN.toPrecision(significantDigits, roundingMode);\n }\n } else {\n numStr = numBN.toFixed(minDecimalPlaces, roundingMode);\n }\n } else {\n if (type === 'price') {\n numBN = numBN.precision(significantDigits - 1, roundingMode);\n const decimalPlaces = numBN.decimalPlaces() || 0;\n if (numBN.lt(BN(minExclusiveNumToShowShortDecimal)) && numBN.gt(BN(0))) {\n numStr = getShortFormDeciamal(numBN);\n } else {\n if (decimalPlaces > 8) {\n numStr = numBN.toFixed(8, roundingMode);\n } else {\n numStr = numBN.toPrecision(4, roundingMode);\n }\n }\n } else {\n // show `<0.0001` when 0< num < 0.0001\n numStr = numBN.toFixed(minDecimalPlaces, roundingMode);\n return `${isShowApproximatelyEqualTo ? '≈' : ''}${numStr}`;\n }\n }\n }\n\n if (isShowSeparator) {\n numStr = toCurrencyNumber(numStr);\n }\n\n return `${sign}${numStr}`;\n}\n\n// remove zero after point\nexport function removeTrailingZeros(value: string | number): string {\n value = value.toString();\n if (value.match(/\\./)) {\n value = value.replace(/\\.?0+$/, '');\n }\n return value;\n}\n\n/**\n * number in thousands\n */\nconst numberWithCommas = (x: number | string): string => {\n const parts = x.toString().split('.');\n if (parts.length > 0) {\n parts[0] = parts[0].replace(/\\B(?=(\\d{3})+(?!\\d))/g, ',');\n return parts.join('.');\n }\n return '';\n};\n\n/**\n * format number, keep 4 decimals by default\n * (optional) comma to separate in thousands\n * @export\n * @param {(number | string)} numBN\n * @param {number} [decimals=DEFAULT_DECIMAL_PLACES]\n * @param {boolean} [isShowSeparator=true]\n * @param {number} [roundingMode=BigNumber.ROUND_DOWN]\n * @param {boolean} [isRemoveTrailingZeros=false]\n * @returns\n */\nexport function formatNumber(\n num: BigNumberish | BN,\n decimals: number = DEFAULT_DECIMAL_PLACES,\n isShowSeparator = true,\n roundingMode: BN.RoundingMode = BN.ROUND_DOWN,\n isRemoveTrailingZeros = false,\n): string {\n let numBN = toBN(num);\n if (\n // num === 'NaN' ||\n // num === undefined ||\n // num.toString().trim() === '' ||\n // Math.abs(Number(num)) === Infinity ||\n // Number.isNaN(Number(num))\n numBN.isNaN() ||\n numBN.eq(Infinity)\n ) {\n numBN = toBN(0);\n }\n\n let res = numBN.toFixed(decimals, roundingMode);\n\n if (isShowSeparator) {\n res = numberWithCommas(res);\n }\n if (isRemoveTrailingZeros) {\n res = removeTrailingZeros(res);\n }\n\n return res;\n}\n\n/**\n * make sure the number in range, otherwise convert it\n * make sure input legal num\n * number should between 1e6 and 1e-6 [1e-6, 1e6)\n * @export\n * @param {(number | string)} num the number user input\n * @param {number} [decimals=6]\n * @param {number} [biggestNumber=1e6 - 1e-4]\n * @returns return number with String type\n */\nexport function inputNumChecker(\n num: number | string,\n decimals = 4,\n allowMinus = false,\n // integerMaxLength = 6\n): string {\n num = num.toString();\n // Allow user input 00000\n if (Number(num) === 0) {\n return num;\n }\n // replace illegal digital\n const regex = allowMinus ? /[^0-9.-]/g : /[^0-9.]/g;\n num = num.replace(regex, '');\n const parts = num.split('.');\n // user paste the number contains more then two dot[.]\n if (parts.length >= 3) {\n return '';\n }\n let integerPart = parts[0];\n // remove leading zero except 1 zero\n if (integerPart.length > 0) {\n while (integerPart.length > 1 && integerPart[0] === '0') {\n integerPart = integerPart?.substring(1);\n }\n } else if (num.indexOf('.') === 0) {\n integerPart = '0';\n }\n // // max integer length <=7\n // if (integerPart.length > integerMaxLength) {\n // return (integerPart = integerPart.substring(0, integerMaxLength));\n // }\n\n let decimalPart = parts[1] || '';\n // only 8 decimal places\n if (decimalPart && decimalPart.length > decimals) {\n decimalPart = decimalPart?.substring(0, decimals);\n }\n\n if (decimalPart && decimalPart.length !== 0) {\n num = `${integerPart}.${decimalPart}`;\n } else {\n // get parse num except single [.]\n num = integerPart + (parts.length === 2 && decimals !== 0 ? '.' : '');\n }\n return num;\n}\n\n/**\n * to Reciprocal Number: 1/x\n * @param bn\n * @returns\n */\nfunction toEtherReciprocalNumber(bn: BigNumber): BigNumber {\n if (bn.eq(0)) {\n return bn;\n }\n return wdiv(toWad(1), bn);\n}\n\nexport function formatEther(num: BigNumber | undefined, isInverse = false): string {\n let bn = num || ZERO;\n if (isInverse && !bn.eq(ZERO)) {\n bn = toEtherReciprocalNumber(bn);\n }\n return utils.formatEther(bn);\n}\n\n/**\n * bigNumber type sort for ant table\n *\n * @export\n * @param {BigNumber} a\n * @param {BigNumber} b\n * @returns {(0 | 1 | -1)}\n */\nexport function bigNumberSort(a: undefined | WrappedBigNumber, b: undefined | WrappedBigNumber): 0 | 1 | -1 {\n if (!a || !b || a.eq(b)) return 0;\n return a.gt(b) ? 1 : -1;\n}\n\nexport function getExponentialScale(val: number): number {\n const expoentialRaw = Math.log10(val);\n return Math.floor(expoentialRaw);\n}\n\n/**\n * get an array of evenly spread numbers between to\n * @param count\n * @param start\n * @param end\n * */\n\nexport function getEvenArray(count: number, start: number, end: number, rounding = false): number[] {\n const result = [];\n const interval = rounding ? Math.floor((end - start) / count) : (end - start) / count;\n for (let i = 0; i < count; i++) {\n result.push(start + i * interval);\n }\n result.push(end);\n return result;\n}\n\n/**\n *\n * @export\n * @param {number} min\n * @param {number} max\n * @param {boolean} rounding\n * @returns {number[]}\n */\nexport function adjustMinMax(min: number, max: number, tickCount = 5): number[] {\n const minExponentialScale = getExponentialScale(min);\n const maxExponentialScale = getExponentialScale(max);\n let minPoint = min;\n // the max is two scales above the min\n if (maxExponentialScale > minExponentialScale + 1) {\n minPoint = 0;\n }\n let maxPoint = max;\n const diff = max - minPoint;\n const tickGap = roundByOneScale(diff / tickCount);\n // maxPoint = minPoint + tickCount * tickGap;\n if (tickCount > 10 && tickCount % 2 !== 0) {\n maxPoint = maxPoint + tickGap;\n }\n return [minPoint, maxPoint];\n}\n\n/**\n * roundUp to closest log number for use in coinprice chart\n * e.g 3456 to 3500\n * @export\n * @param {number} val\n * @param {boolean} up\n * @returns {number}\n */\nexport function roundByOneScale(value: number, up = true): number {\n const exponentialScale = getExponentialScale(value);\n const mainNumbers = value / 10 ** getExponentialScale(value);\n const newMainNumbers = Math.floor(mainNumbers * 10);\n return (newMainNumbers + (up ? 1 : 0)) * 10 ** (exponentialScale - 1);\n}\nexport function upRoundingByOneScale(value: number): number {\n const exponentialScale = getExponentialScale(value);\n if (exponentialScale !== 0) {\n const mainNumbers = Math.floor(value / 10 ** getExponentialScale(value)) + 1;\n return (mainNumbers < 5 ? 5 : 10) * 10 ** exponentialScale;\n }\n return 10;\n}\n\nexport function batchTranformBigNumberToWrap(value: T): Record {\n const keys = _.keys(value);\n return _.reduce(\n keys,\n (acc, cur) => {\n _.set(acc, [cur], WrappedBigNumber.from(_.get(value, [cur])));\n return acc;\n },\n {} as Record,\n );\n}\n\n/**\n * to wad, support float\n * @param wad\n * @returns\n */\nexport function toWad(num: BigNumberish, decimals = 0): BigNumber {\n return parseUnits(num.toString()).div(10 ** decimals);\n}\n/**\n * get tick points for use in coinprice chart\n * @export\n * @param {number} min\n * @param {number} max\n * @param {boolean} rounding\n * @returns {number[]}\n */\nexport function getTickPoints(min: number, max: number, tickGap?: number): number[] {\n const minExponentialScale = getExponentialScale(min);\n const maxExponentialScale = getExponentialScale(max);\n tickGap = tickGap || 10 ** (maxExponentialScale - 1);\n\n const diff = max - min;\n const tickNumber = Math.ceil(diff / tickGap);\n if (tickNumber >= 10) {\n if (tickNumber % 2 === 0) {\n return getTickPoints(min, max, tickGap * 2);\n } else {\n return getTickPoints(min, max + tickGap, tickGap * 2);\n }\n }\n if (tickNumber < 5) {\n return getTickPoints(min, max, 10 ** (minExponentialScale - 1));\n }\n return getEvenArray(tickNumber, min, max, false);\n}\n\nexport function formatPercentageString({\n percentage,\n hundredfold = true,\n decimals = 2,\n roundingMode = BN.ROUND_DOWN,\n}: {\n percentage: number | string;\n hundredfold?: boolean;\n decimals?: number;\n roundingMode?: BN.RoundingMode;\n}): string {\n const percentageNumber = WrappedBigNumber.from(percentage).mul(hundredfold ? 100 : 1);\n return `${formatNumber(percentageNumber, decimals, false, roundingMode)}%`;\n}\nexport function reduceArrayByStep(array: T[], step: number): T[] {\n const reducedArray: T[] = [];\n for (let i = 0; i < array.length; i += step) {\n reducedArray.push(array[i]);\n }\n const result = _.isEqual(_.last(reducedArray), _.last(array)) ? reducedArray : [...reducedArray, _.last(array) as T];\n return result;\n}\n","import Cookies from 'js-cookie';\nimport localforage from 'localforage';\nimport _ from 'lodash';\n\nimport {\n GLOBAL_CONFIG,\n JWT_FOR_ODYSSEY,\n JWT_FOR_TGP,\n LOCAL_RPC_URL,\n PAIRS_PARTICIPATED,\n REFERRAL_CODE_FOR_ODYSSEY,\n SIGNATURE_FOR_ODYSSEY,\n} from '@/constants/storage';\nimport { IGlobalConfig, IGlobalConfigStorage, ISignature, ISignatureStorage } from '@/types/global';\nimport { IOdysseySignature, IOdysseySignatureStorage } from '@/types/odyssey';\n\nexport async function saveGlobalConfigToLocalForage(config: IGlobalConfig): Promise {\n const configInStorage = ((await localforage.getItem(GLOBAL_CONFIG)) || {}) as IGlobalConfigStorage;\n _.set(configInStorage, [config.chainId], config);\n localforage.setItem(GLOBAL_CONFIG, configInStorage);\n}\n\nexport async function saveSignatureToLocalForage(signature: ISignature): Promise {\n const signatureInStorage = ((await localforage.getItem(SIGNATURE_FOR_ODYSSEY)) || {}) as ISignatureStorage;\n _.set(signatureInStorage, [signature.address || ''], signature);\n localforage.setItem(SIGNATURE_FOR_ODYSSEY, signatureInStorage);\n}\n\nexport async function getSignatureToLocalForage(address: string): Promise {\n const signatureInStorage = ((await localforage.getItem(SIGNATURE_FOR_ODYSSEY)) || {}) as ISignatureStorage;\n return _.get(signatureInStorage, [address || '']);\n}\n\nexport async function saveOdysseySignatureToLocalForage(signature: IOdysseySignature): Promise {\n const signatureInStorage = ((await localforage.getItem(SIGNATURE_FOR_ODYSSEY)) || {}) as IOdysseySignatureStorage;\n _.set(signatureInStorage, [signature.address || ''], signature);\n localforage.setItem(SIGNATURE_FOR_ODYSSEY, signatureInStorage);\n}\n\nexport async function getOdysseySignatureToLocalForage(address: string): Promise {\n const signatureInStorage = ((await localforage.getItem(SIGNATURE_FOR_ODYSSEY)) || {}) as IOdysseySignatureStorage;\n return _.get(signatureInStorage, [address || '']);\n}\n\nexport function getOdysseyJWTToken(address: string, chainId: number | undefined): string | undefined {\n const cookieStr = Cookies.get(`${JWT_FOR_ODYSSEY}-${address}-${chainId}`);\n return cookieStr;\n}\n\nexport function saveOdysseyJWTToken(address: string, jwtToken: string, chainId: number): void {\n Cookies.set(`${JWT_FOR_ODYSSEY}-${address}-${chainId}`, jwtToken, { expires: 30 });\n}\n\nexport async function saveOdysseyReferralCodeToLocalForage(\n code: string,\n userAddr: string | undefined,\n chainId: number,\n): Promise {\n const storage = ((await localforage.getItem(REFERRAL_CODE_FOR_ODYSSEY)) || {}) as {\n [chainId: number]: { [userAddr: string]: string };\n };\n _.set(storage, [chainId, userAddr || ''], code);\n localforage.setItem(REFERRAL_CODE_FOR_ODYSSEY, storage);\n}\n\nexport async function getOdysseyReferralCodeToLocalForage(\n userAddr: string | undefined,\n chainId: number,\n): Promise {\n const storage = ((await localforage.getItem(REFERRAL_CODE_FOR_ODYSSEY)) || {}) as {\n [chainId: number]: { [userAddr: string]: string };\n };\n return _.get(storage, [chainId, userAddr || '']);\n}\n\nexport function getTGPJWTToken(address: string): string | undefined {\n const cookieStr = Cookies.get(`${JWT_FOR_TGP}-${address}`);\n return cookieStr;\n}\n\nexport function saveTGPJWTToken(address: string, jwtToken: string): void {\n Cookies.set(`${JWT_FOR_TGP}-${address}`, jwtToken, { expires: 30 });\n}\n\nexport async function saveParticipatedPairsToLocalForage(\n pairs: { instrumentAddr: string; expiry: number }[],\n userAddr: string,\n chainId: number,\n): Promise {\n const storage = ((await localforage.getItem(PAIRS_PARTICIPATED)) || {}) as {\n [chainId: number]: { [userAddr: string]: { instrumentAddr: string; expiry: number }[] };\n };\n\n _.set(storage, [chainId, userAddr], pairs);\n localforage.setItem(PAIRS_PARTICIPATED, storage);\n}\n\nexport async function getParticipatedPairsFromLocalForage(\n userAddr: string,\n chainId: number,\n): Promise<{ instrumentAddr: string; expiry: number }[]> {\n const storage = ((await localforage.getItem(PAIRS_PARTICIPATED)) || {}) as {\n [chainId: number]: { [userAddr: string]: { instrumentAddr: string; expiry: number }[] };\n };\n const userStorage = _.get(storage, [chainId, userAddr]);\n return Object.values(userStorage || {});\n}\n\nexport async function saveSingleParticipatedPairsToLocalForage(\n pair: { instrumentAddr: string; expiry: number },\n userAddr: string,\n chainId: number,\n): Promise {\n const storage = ((await localforage.getItem(PAIRS_PARTICIPATED)) || {}) as {\n [chainId: number]: { [userAddr: string]: { instrumentAddr: string; expiry: number }[] };\n };\n\n const pairs: { instrumentAddr: string; expiry: number }[] = _.get(storage, [chainId, userAddr], []);\n if (!pairs.find((p) => p.instrumentAddr === pair.instrumentAddr && p.expiry === pair.expiry)) pairs.push(pair);\n _.set(storage, [chainId, userAddr], pairs);\n localforage.setItem(PAIRS_PARTICIPATED, storage);\n}\n\nexport async function saveRpcToLocalForage(chainId: number, rpc: string): Promise {\n const rpcInStorage = ((await localforage.getItem(LOCAL_RPC_URL)) || {}) as { [chainId: number]: string };\n if (rpc) {\n _.set(rpcInStorage, [chainId || ''], rpc);\n localforage.setItem(LOCAL_RPC_URL, rpcInStorage);\n } else {\n _.unset(rpcInStorage, [chainId || '']);\n localforage.setItem(LOCAL_RPC_URL, rpcInStorage);\n }\n}\n\nexport async function getRpcFromLocalForage(\n chainId: number,\n): Promise<{ rpc: string; type: 'wss' | 'https' } | undefined> {\n const signatureInStorage = ((await localforage.getItem(LOCAL_RPC_URL)) || {}) as { [chainId: number]: string };\n const rpc: string = _.get(signatureInStorage, [chainId || '']);\n if (rpc && rpc?.length) {\n if (rpc.startsWith('wss')) {\n return {\n rpc,\n type: 'wss',\n };\n }\n\n return {\n rpc,\n type: 'https',\n };\n }\n}\n","import { CHAIN_ID, TokenInfo as Token } from '@derivation-tech/context';\nimport { MarketType } from '@synfutures/sdks-perp';\nimport { BigNumber, constants } from 'ethers';\n\nimport { DAPP_CHAIN_CONFIGS } from '@/constants/chain';\nimport { DEFAULT_DECIMALS } from '@/constants/global';\nimport { WrappedInstrument } from '@/entities/WrappedInstrument';\nimport { TokenInfo, TokenInfoMap } from '@/types/token';\n\nexport function getTokenInfo(token: Token, chainId: CHAIN_ID): TokenInfo {\n return {\n ...token,\n id: token.address.toLowerCase(),\n address: token.address.toLowerCase(),\n chainId,\n decimals: token.decimals || DEFAULT_DECIMALS,\n };\n}\n\nexport function isWrappedNativeToken(chainId: CHAIN_ID, address: string, wrappedNativeToken?: Token): boolean {\n if (!wrappedNativeToken) {\n const dappChainConfig = DAPP_CHAIN_CONFIGS[chainId];\n wrappedNativeToken = dappChainConfig?.wrappedNativeToken;\n }\n\n return address?.toLowerCase() === wrappedNativeToken?.address?.toLowerCase();\n}\nexport function isNativeWrapNativePair(tokens: TokenInfo[]): boolean {\n return (\n tokens.filter((t) => isNativeTokenAddr(t.address) || isWrappedNativeToken(t.chainId, t.address)).length ===\n tokens.length\n );\n}\n\nexport function isNativeTokenAddr(tokenAddr: string): boolean {\n if (!tokenAddr) return false;\n return tokenAddr.toLowerCase() === constants.AddressZero;\n}\n\nexport function isNativeTokenInfo(token: TokenInfo, isSpot?: boolean): boolean {\n if (isSpot) {\n return isNativeTokenAddr(token?.address);\n }\n return isNativeTokenAddr(token?.address) && !token.id.startsWith(`${MarketType.LINK}_`);\n}\n\n/**\n * get wrappedNativeToken if token is native token\n * or just return the token\n * @param nativeToken\n * @param chainId\n * @returns\n */\nexport function wrapNativeToken(nativeToken: TokenInfo, chainId: CHAIN_ID, isSpot?: boolean): TokenInfo {\n const chainConfig = DAPP_CHAIN_CONFIGS[chainId];\n if (chainConfig && isNativeTokenInfo(nativeToken, isSpot) && chainConfig.wrappedNativeToken) {\n return getTokenInfo(chainConfig.wrappedNativeToken, chainId);\n }\n return nativeToken;\n}\nexport function wrapNativeAddress(tokenAddr: string | undefined, chainId: CHAIN_ID | undefined): string | undefined {\n if (chainId && tokenAddr && isNativeTokenAddr(tokenAddr)) {\n const chainConfig = DAPP_CHAIN_CONFIGS[chainId];\n if (chainConfig && chainConfig.wrappedNativeToken) {\n return getTokenInfo(chainConfig.wrappedNativeToken, chainId)?.address;\n }\n return tokenAddr;\n }\n return tokenAddr;\n}\n\n/**\n * get nativeToken if token is wrapped native token\n * or just return the token\n * @param wrappedNativeToken\n * @param chainId\n * @returns\n */\nexport function unWrapNativeToken(wrappedNativeToken: TokenInfo, chainId: CHAIN_ID): TokenInfo | undefined {\n const chainConfig = DAPP_CHAIN_CONFIGS[chainId];\n if (chainConfig && isWrappedNativeToken(chainId, wrappedNativeToken.address)) {\n return chainConfig.nativeToken;\n }\n return wrappedNativeToken;\n}\n\nexport function fixBalanceNumberDecimalsTo18(num: BigNumber, tokenDecimals: number): BigNumber {\n return num.mul(10 ** (18 - tokenDecimals));\n}\n\nexport function adjustBalanceNumberToTokenDecimals(num: BigNumber, tokenDecimals: number): BigNumber {\n return num.div(10 ** (18 - tokenDecimals));\n}\n\nexport function mappingToken({\n token,\n chainId,\n marketType,\n unWrappedNativeToken = false,\n}: {\n token: Token;\n marketType?: MarketType;\n chainId: CHAIN_ID;\n unWrappedNativeToken?: boolean;\n}): TokenInfo {\n const dappChainConfig = DAPP_CHAIN_CONFIGS[chainId];\n if (dappChainConfig) {\n if (unWrappedNativeToken && isWrappedNativeToken(chainId, token.address)) {\n if (dappChainConfig.nativeToken) token = dappChainConfig.nativeToken;\n }\n }\n\n const mToken: TokenInfo = getTokenInfo(token, chainId);\n\n // transform chainlink token's id\n if (marketType && [MarketType.LINK, MarketType.EMG, MarketType.PYTH].includes(marketType)) {\n // if (marketType && [MarketType.CHAINLINK, MarketType.SYNFUTURES].includes(marketType)) {\n mToken.id = `${marketType}_${mToken.symbol}`;\n }\n return mToken;\n}\n\nexport function getSanitizedFuturesSymbol(futures: WrappedInstrument, chainId: CHAIN_ID | undefined): string {\n if (chainId) {\n if (isWrappedNativeToken(chainId, futures.quoteToken.address)) {\n return `${futures.baseToken.symbol}-${unWrapNativeToken(futures.quoteToken as TokenInfo, chainId)?.symbol}-${\n futures.market.info.type\n }`;\n }\n if (isWrappedNativeToken(chainId, futures.baseToken.address)) {\n return `${unWrapNativeToken(futures.baseToken as TokenInfo, chainId)?.symbol}-${futures.quoteToken.symbol}-${\n futures.market.info.type\n }`;\n }\n return futures.displaySymbol;\n }\n return futures.displaySymbol;\n}\n\nexport function tokenArrToMap(tokens: Token[], chainId: CHAIN_ID): TokenInfoMap {\n return tokens.reduce((acc, token) => {\n acc[token.address.toLowerCase()] = getTokenInfo(token, chainId);\n return acc;\n }, {} as TokenInfoMap);\n}\n","import '@/utils/log';\nimport { CHAIN_ID, Context } from '@derivation-tech/context';\nimport { ERC20, ERC20__factory, WrappedNative, WrappedNative__factory } from '@derivation-tech/contracts';\nimport { Provider } from '@ethersproject/providers';\nimport { Signer } from 'ethers';\n\nexport class ERC20Worker {\n private static instances: Map = new Map();\n chainId: number;\n chainContext: Context;\n ERC20ContractMap: Map = new Map(); // erc20 token address => ERC20Contract\n WrappedNativeContractMap: Map = new Map(); // wrapped token address => WrappedNative\n\n constructor(chainId: CHAIN_ID) {\n this.chainId = chainId;\n this.chainContext = new Context(chainId);\n }\n\n public static getInstance(chainId: CHAIN_ID): ERC20Worker {\n let instance = this.instances.get(chainId);\n if (!instance) {\n instance = new ERC20Worker(chainId);\n this.instances.set(chainId, instance);\n }\n return instance;\n }\n\n getERC20Contract = (tokenAddr: string, signerOrProvider: Signer | Provider): ERC20 => {\n let erc20Contract = this.ERC20ContractMap.get(tokenAddr);\n if (erc20Contract) {\n return erc20Contract;\n }\n erc20Contract = ERC20__factory.connect(tokenAddr, signerOrProvider);\n this.ERC20ContractMap.set(tokenAddr, erc20Contract);\n return erc20Contract;\n };\n\n getWrappedNativeContract = (tokenAddr: string, signerOrProvider: Signer | Provider): WrappedNative => {\n let wrappedNativeContract = this.WrappedNativeContractMap.get(tokenAddr);\n if (wrappedNativeContract) {\n return wrappedNativeContract;\n }\n wrappedNativeContract = WrappedNative__factory.connect(tokenAddr, signerOrProvider);\n this.WrappedNativeContractMap.set(tokenAddr, wrappedNativeContract);\n return wrappedNativeContract;\n };\n}\n","import './initWorker';\n\nimport { CHAIN_ID, TokenInfo as Token } from '@derivation-tech/context';\nimport { ERC20__factory } from '@derivation-tech/contracts';\nimport { BaseContract, BigNumber, ethers } from 'ethers';\n\nimport _ from 'lodash';\n\nimport { DEFAULT_EMPTY_ACCOUNT } from '@/constants/global';\nimport {\n BlockyResult,\n WorkerAllowanceResult,\n WorkerBalanceEventResult,\n WorkerEvent,\n WorkerEventNames,\n} from '@/types/worker';\nimport { pollingFunc } from '@/utils';\nimport { isNativeTokenAddr } from '@/utils/token';\n\n// import { Contract as MulticallContract, Provider as MulticallProvider } from 'ethers-multicall';\nimport { CHAIN_HTTP_RPC_URLS } from '@/constants/rpc';\nimport { getFallbackProvider } from '@/utils/chain';\nimport { JsonRpcProvider } from '@ethersproject/providers';\nimport { ChainContextWorker } from './ChainContextWorker';\nimport { ERC20Worker } from './ERC20Worker';\nimport { emitWorkerEvent } from './helper';\n\nexport type BalanceInBlock = {\n balance: BigNumber;\n block: number;\n};\n\nexport type AllowanceInBlock = {\n allowance: BigNumber;\n block: number;\n};\n\nclass ChainUserWorker {\n private static instances: Record = {};\n chainId: CHAIN_ID;\n chainContextWorker: ChainContextWorker;\n erc20Worker: ERC20Worker;\n nativeTokenBalanceInBlock?: BalanceInBlock;\n erc20TokenBalanceMap: Record; // tokenAddr -> balance\n erc20AllowanceMap: Record>>; // tokenAddr -> spender -> allowance\n\n listeningEvent: { [contractName: string]: { [listeningKey: string]: { [eventName: string]: boolean } } }; // contractName => listeningKey(user address/token address) => event name => listening\n\n isRequestBalance: {\n [userAddr: string]: {\n [tokenAddr: string]: {\n [block: number]: boolean;\n };\n };\n } = {};\n isRequestAllowance: {\n [userAddr: string]: {\n [tokenAddr: string]: {\n [block: number]: boolean;\n };\n };\n } = {};\n\n constructor(chainId: CHAIN_ID) {\n this.chainId = chainId;\n const provider = getFallbackProvider(chainId, CHAIN_HTTP_RPC_URLS?.[chainId]) as unknown as JsonRpcProvider;\n this.chainContextWorker = new ChainContextWorker(chainId, provider);\n this.erc20Worker = ERC20Worker.getInstance(chainId);\n this.erc20TokenBalanceMap = {};\n this.erc20AllowanceMap = {};\n this.listeningEvent = {};\n }\n\n public static async getInstance(chainId: CHAIN_ID): Promise {\n let instance = this.instances[`${chainId}`];\n if (!instance) {\n instance = new ChainUserWorker(chainId);\n this.instances[`${chainId}`] = instance;\n await instance.init();\n }\n return instance;\n }\n\n async init(): Promise {\n await this.chainContextWorker.readProviderFromLocalOrSetting();\n }\n\n get chainContext() {\n return this.chainContextWorker.chainContext;\n }\n\n get provider() {\n return this.chainContextWorker.provider;\n }\n\n get chainInfo() {\n return this.chainContext.info;\n }\n\n getERC20Contract = (tokenAddr: string) => {\n return this.erc20Worker.getERC20Contract(tokenAddr, this.provider);\n };\n\n getWrappedNativeContract = (tokenAddr: string) => {\n return this.erc20Worker.getWrappedNativeContract(tokenAddr, this.provider);\n };\n\n async fetchNativeTokenBalance(userAddr: string, block?: number): Promise {\n if (!block) {\n // block = await this.provider.getBlockNumber();\n }\n // const nativeToken = this.chainContext.nativeToken;\n // // if the balance is already requested, block this request\n // const isRequest = _.get(this.isRequestBalance, [this.userAddr, nativeToken.address, block || 0]);\n // if (!isRequest) {\n // _.set(this.isRequestBalance, [this.userAddr, nativeToken.address, block || 0], true);\n // } else {\n // return undefined;\n // }\n const walletBalance = await this.provider.getBalance(userAddr, block);\n\n // if (!block) block = this.provider.blockNumber;\n const nativeTokenBalance = walletBalance;\n const balanceInfo = {\n balance: nativeTokenBalance,\n block: block || 0,\n };\n // if the block height is lower than the current block height, we don't need to update the state\n if (this.nativeTokenBalanceInBlock && (balanceInfo.block || 0) < (this.nativeTokenBalanceInBlock?.block || 0)) {\n return this.nativeTokenBalanceInBlock;\n }\n\n // if balance changed, emit event\n if (!balanceInfo.balance.eq(this.nativeTokenBalanceInBlock?.balance || -1)) {\n emitWorkerEvent(WorkerEventNames.NativeBalanceEvent, {\n balanceInfo: {\n ...balanceInfo,\n // balance: balanceInfo.balance.toString(),\n },\n chainId: this.chainId,\n userAddr: userAddr,\n token: this.chainContext.nativeToken,\n block: block || 0,\n });\n }\n\n this.nativeTokenBalanceInBlock = balanceInfo;\n\n return balanceInfo;\n }\n\n fetchTokenBalance = async (token: Token, userAddr: string, block?: number): Promise => {\n if (!block) {\n block = await this.provider.getBlockNumber();\n }\n\n // if the balance is already requested, block this request\n const isRequest = _.get(this.isRequestBalance, [userAddr, token.address, block]);\n if (!isRequest) {\n _.set(this.isRequestBalance, [userAddr, token.address, block], true);\n } else {\n return undefined;\n }\n\n const erc20 = this.getERC20Contract(token.address);\n const erc20Balance = await erc20.balanceOf(userAddr, {\n blockTag: block,\n });\n\n // if the block height is lower than the current block height, we don't need to update the state\n if (this.erc20TokenBalanceMap && block < this.erc20TokenBalanceMap[token.address]?.block) {\n return this.erc20TokenBalanceMap[token.address];\n }\n\n const res = this.updateBalanceCache({ userAddr, token, balance: erc20Balance, block });\n return res;\n };\n\n watchERC20Balance = async (token: Token, userAddr: string) => {\n const chainId = this.chainId;\n if (isNativeTokenAddr(token.address)) {\n return;\n }\n const erc20Contract = this.getERC20Contract(token.address);\n\n (erc20Contract as BaseContract).on(\n {\n topics: [\n [\n // from me event\n erc20Contract.interface.getEventTopic('Transfer'),\n erc20Contract.interface.getEventTopic('Deposit'),\n erc20Contract.interface.getEventTopic('Withdrawal'),\n erc20Contract.interface.getEventTopic('Approval'),\n ],\n ethers.utils.hexZeroPad(userAddr, 32),\n ],\n },\n (event) => {\n const parsedLog = erc20Contract.interface.parseLog(event);\n console.log('erc20Contract event:', parsedLog.name, 'args:', parsedLog.args);\n\n this.fetchTokenBalance(token, userAddr, event.blockNumber);\n\n if ('Approval' === parsedLog.name) {\n const to = parsedLog.args.to;\n const amount = parsedLog.args.amount;\n emitWorkerEvent(WorkerEventNames.ApprovalEvent, {\n chainId,\n userAddr,\n block: event.blockNumber,\n token,\n allowanceInfo: {\n spender: to.toLowerCase(),\n allowance: amount,\n },\n });\n }\n },\n );\n };\n\n callERC20Allowance = async ({\n token,\n spender,\n userAddr,\n block,\n }: {\n token: Token;\n spender: string;\n userAddr: string;\n block?: number;\n }): Promise> => {\n if (!block) {\n block = await this.provider.getBlockNumber();\n }\n if (!token?.address) {\n return { data: undefined, block };\n }\n // if the pair is already requested, block this request\n const isRequest = _.get(this.isRequestAllowance, [userAddr, token.address.toLowerCase(), block]);\n if (!isRequest) {\n _.set(this.isRequestAllowance, [userAddr, token.address.toLowerCase(), block], true);\n } else {\n return { data: undefined, block };\n }\n const erc20Contract = this.getERC20Contract(token.address);\n\n const allowance = await erc20Contract.allowance(userAddr, spender);\n\n // if the block height is lower than the current block height, we don't need to update the state\n const cachedAllowanceInfo = _.get(this.erc20AllowanceMap, [token.address, spender]);\n if (cachedAllowanceInfo && block < cachedAllowanceInfo?.block) {\n return cachedAllowanceInfo;\n }\n\n this.updateAllowanceCache({ userAddr, token, spender, allowance, block });\n\n return {\n data: allowance,\n block,\n };\n };\n\n multicallBalance = async (\n tokens: Token[],\n userAddr: string,\n block?: number,\n ): Promise> => {\n const balanceMap = tokens;\n // const tokenArr = _.sortBy(Object.values(balanceMap), ['address']);\n const balancesRes = await this.chainContext.tokenAssistant.balanceOfTokenBatch(\n balanceMap.map((token) => token.address),\n [userAddr],\n {\n blockTag: block,\n },\n );\n\n const balanceInfos = balanceMap.map((token, i) => {\n return {\n token,\n balance: balancesRes.balances[0][i] as BigNumber,\n };\n });\n if (balancesRes?.blockInfo) {\n block = balancesRes.blockInfo?.height?.toNumber();\n }\n if (balanceInfos?.length) {\n balanceInfos.forEach((balanceInfo) => {\n this.updateBalanceCache({\n userAddr,\n token: balanceInfo.token,\n balance: balanceInfo.balance,\n block: block || 0,\n });\n });\n }\n\n return {\n block: block || 0,\n data: balanceInfos,\n };\n };\n\n // multicallBalance2 = async (\n // tokens: Token[],\n // userAddr: string,\n // block: number,\n // ): Promise> => {\n // const chainId = this.chainId;\n\n // const ethcallProvider = new MulticallProvider(this.provider, chainId);\n // const balanceMap = tokens;\n // const tokenArr = _.sortBy(Object.values(balanceMap), ['address']);\n // const balanceCalls = tokenArr.map((token) => {\n // if (isNativeTokenAddr(token?.address)) {\n // return ethcallProvider.getEthBalance(userAddr);\n // }\n // const erc20 = new MulticallContract(token.address, ERC20__factory.abi);\n // return erc20.balanceOf(userAddr);\n // });\n\n // const balanceArr = await ethcallProvider.all(balanceCalls);\n // const balanceInfos = tokenArr.map((token, i) => {\n // return {\n // token,\n // balance: balanceArr[i] as BigNumber,\n // };\n // });\n // return {\n // block: block,\n // data: balanceInfos,\n // };\n // };\n\n updateBalanceCache({\n userAddr,\n balance,\n token,\n block,\n }: {\n userAddr: string;\n balance: BigNumber;\n token: Token;\n block: number;\n }): { block: number; balance: BigNumber } | undefined {\n if (!balance || !token?.address) return;\n\n // erc20Balance = fixBalanceNumberDecimalsTo18(erc20Balance, token);\n const res = {\n block: block,\n balance: balance,\n };\n // if balance changed, emit event\n if (!res.balance.eq(this.erc20TokenBalanceMap[token.address]?.balance || -1)) {\n const eventName = WorkerEventNames.BalanceEvent;\n emitWorkerEvent(eventName, {\n balanceInfo: {\n ...res,\n // balance: res.balance.toString(),\n },\n chainId: this.chainId,\n userAddr: userAddr,\n token: token,\n block: block,\n });\n }\n _.set(this.erc20TokenBalanceMap, [token.address], res);\n\n return res;\n }\n\n multicallAllowance = async (\n tokens: Token[],\n spender: string,\n userAddr: string,\n block?: number,\n ): Promise | undefined> => {\n if (!tokens?.length || !userAddr) return;\n const callMapping = tokens.map((t) => {\n const contract = ERC20__factory.connect(t.address, this.provider);\n return {\n callData: contract.interface.encodeFunctionData('allowance', [userAddr, spender]),\n contract,\n token: t,\n };\n });\n\n const res = await this.chainContext.multiCall3.callStatic.aggregate3(\n callMapping.map((t) => {\n return {\n target: t.token.address,\n callData: t.callData,\n allowFailure: false,\n };\n }),\n );\n\n const allowanceInfos = callMapping.map((t, i) => {\n const contract = t.contract;\n const [allowance] = contract.interface.decodeFunctionResult('allowance', res[i].returnData) as [BigNumber];\n return {\n token: t.token,\n allowance,\n };\n });\n\n if (allowanceInfos?.length) {\n allowanceInfos.forEach((allowanceInfo) => {\n this.updateAllowanceCache({\n userAddr,\n token: allowanceInfo.token,\n spender,\n allowance: allowanceInfo.allowance,\n block: block || 0,\n });\n });\n }\n\n return {\n block: block || 0,\n data: allowanceInfos,\n };\n };\n\n updateAllowanceCache({\n userAddr,\n token,\n spender,\n allowance,\n block,\n }: {\n userAddr: string;\n token: Token;\n spender: string;\n allowance: BigNumber;\n block: number;\n }): void {\n if (!allowance || !token?.address || !spender) return;\n const cachedAllowanceInfo = _.get(this.erc20AllowanceMap, [token.address, spender]);\n\n // if allowance changed, emit event\n if (!cachedAllowanceInfo || !allowance.eq(cachedAllowanceInfo?.data || 0)) {\n emitWorkerEvent(WorkerEventNames.UpdateTokenAllowanceEvent, {\n chainId: this.chainId,\n userAddr,\n block: block,\n token,\n allowanceInfo: {\n spender: spender,\n allowance: allowance,\n },\n });\n }\n _.set(this.erc20AllowanceMap, [token.address, spender], {\n data: allowance,\n block,\n });\n }\n}\n\nexport class UserWorker {\n static instances: Map = new Map();\n\n [chainId: number]: ChainUserWorker;\n\n polling?: NodeJS.Timeout;\n\n public static async getInstance(chainId: number): Promise {\n let instance = this.instances.get(chainId);\n if (!instance) {\n instance = new UserWorker();\n this.instances.set(chainId, instance);\n }\n return instance;\n }\n getChainInstance(chainId: CHAIN_ID): ChainUserWorker {\n let chainInstance = this[chainId];\n if (!chainInstance) {\n chainInstance = new ChainUserWorker(chainId);\n this[chainId] = chainInstance;\n }\n return chainInstance;\n }\n\n clearPolling(): void {\n if (this.polling) {\n clearInterval(this.polling);\n }\n }\n pollingFetchNativeTokenBalance = async (chainId: number, userAddr: string): Promise => {\n this.clearPolling();\n const chainInstance = this.getChainInstance(chainId);\n this.polling = pollingFunc(\n async () => {\n // const blockNumber = await chainInstance.provider.getBlockNumber();\n chainInstance.fetchNativeTokenBalance(userAddr);\n // chainInstance.fetchNativeTokenBalance(blockNumber);\n },\n 5000,\n true,\n );\n };\n\n watchERC20Balance = async (chainId: number, userAddr: string, token: Token): Promise => {\n const chainInstance = this.getChainInstance(chainId);\n chainInstance.watchERC20Balance(token, userAddr);\n };\n\n multicallBalance = async ({\n chainId,\n tokens,\n userAddr,\n block,\n }: {\n chainId: number;\n tokens: Token[];\n userAddr: string;\n block?: number;\n }): Promise> => {\n const chainInstance = this.getChainInstance(chainId);\n if (!block) {\n // block = await chainInstance.provider.getBlockNumber();\n }\n const balanceInfos = await chainInstance.multicallBalance(tokens, userAddr, block);\n\n return balanceInfos;\n };\n\n // multicallBalance2 = async ({\n // chainId,\n // tokens,\n // userAddr,\n // block,\n // }: {\n // chainId: number;\n // tokens: Token[];\n // userAddr: string;\n // block?: number;\n // }): Promise> => {\n // const chainInstance = this.getChainInstance(chainId);\n // if (!block) {\n // block = await chainInstance.provider.getBlockNumber();\n // }\n // const balanceInfos = await chainInstance.multicallBalance2(tokens, userAddr, block);\n\n // return balanceInfos;\n // };\n\n multicallAllowance = async ({\n chainId,\n tokens,\n userAddr,\n spender,\n block,\n }: {\n chainId: number;\n tokens: Token[];\n userAddr: string;\n spender: string;\n block?: number;\n }): Promise<\n | BlockyResult<\n {\n token: Token;\n allowance: BigNumber;\n }[]\n >\n | undefined\n > => {\n const chainInstance = this.getChainInstance(chainId);\n if (!block) {\n block = await chainInstance.provider.getBlockNumber();\n }\n const allowances = await chainInstance.multicallAllowance(tokens, spender, userAddr, block);\n\n return allowances;\n };\n\n callERC20Allowance = async ({\n chainId,\n token,\n spender,\n userAddr,\n block,\n }: {\n chainId: number;\n token: Token;\n spender: string;\n userAddr: string;\n block?: number;\n }): Promise> => {\n const chainInstance = this.getChainInstance(chainId);\n if (!block) {\n block = await chainInstance.provider.getBlockNumber();\n }\n const allowanceInfo = await chainInstance.callERC20Allowance({\n token,\n spender,\n userAddr,\n block,\n });\n return allowanceInfo;\n };\n}\n\nonmessage = async (e) => {\n try {\n const event = e.data as WorkerEvent;\n if (event.eventName === WorkerEventNames.BalanceEvent) {\n const { chainId, userAddr, token } = event.data;\n if (userAddr === DEFAULT_EMPTY_ACCOUNT) return;\n const userWorker = await UserWorker.getInstance(chainId);\n if (token) {\n if (isNativeTokenAddr(token.address)) {\n // UserWorker.instances.forEach((userWorker) => {\n // userWorker.clearPolling();\n // });\n // userWorker.pollingFetchNativeTokenBalance(chainId);\n } else {\n userWorker.watchERC20Balance(chainId, userAddr, event.data.token);\n }\n }\n } else if (event.eventName === WorkerEventNames.MulticallTokensAllowance) {\n const { chainId, tokens, spender, userAddr, block } = event.data;\n if (userAddr === DEFAULT_EMPTY_ACCOUNT) return;\n const userWorker = await UserWorker.getInstance(chainId);\n if (tokens?.length) {\n userWorker.multicallAllowance({ chainId, tokens, userAddr, spender, block });\n }\n } else if (event.eventName === WorkerEventNames.MulticallBalance) {\n const { chainId, userAddr, tokens } = event.data;\n if (userAddr === DEFAULT_EMPTY_ACCOUNT) return;\n const userWorker = await UserWorker.getInstance(chainId);\n if (tokens?.length) {\n userWorker.multicallBalance({ chainId, userAddr, tokens });\n }\n }\n } catch (error) {\n console.log('🚀 ~ file: UserWorker.ts:462 ~ error:', error);\n }\n};\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\tid: moduleId,\n\t\tloaded: false,\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Flag the module as loaded\n\tmodule.loaded = true;\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n// expose the modules object (__webpack_modules__)\n__webpack_require__.m = __webpack_modules__;\n\n// the startup function\n__webpack_require__.x = function() {\n\t// Load entry module and return exports\n\t// This entry module depends on other loaded chunks and execution need to be delayed\n\tvar __webpack_exports__ = __webpack_require__.O(undefined, [289,24,284,861,717,886,563,159,975,682,913,241,729,592], function() { return __webpack_require__(84974); })\n\t__webpack_exports__ = __webpack_require__.O(__webpack_exports__);\n\treturn __webpack_exports__;\n};\n\n","__webpack_require__.amdO = {};","var deferred = [];\n__webpack_require__.O = function(result, chunkIds, fn, priority) {\n\tif(chunkIds) {\n\t\tpriority = priority || 0;\n\t\tfor(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];\n\t\tdeferred[i] = [chunkIds, fn, priority];\n\t\treturn;\n\t}\n\tvar notFulfilled = Infinity;\n\tfor (var i = 0; i < deferred.length; i++) {\n\t\tvar chunkIds = deferred[i][0];\n\t\tvar fn = deferred[i][1];\n\t\tvar priority = deferred[i][2];\n\t\tvar fulfilled = true;\n\t\tfor (var j = 0; j < chunkIds.length; j++) {\n\t\t\tif ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every(function(key) { return __webpack_require__.O[key](chunkIds[j]); })) {\n\t\t\t\tchunkIds.splice(j--, 1);\n\t\t\t} else {\n\t\t\t\tfulfilled = false;\n\t\t\t\tif(priority < notFulfilled) notFulfilled = priority;\n\t\t\t}\n\t\t}\n\t\tif(fulfilled) {\n\t\t\tdeferred.splice(i--, 1)\n\t\t\tvar r = fn();\n\t\t\tif (r !== undefined) result = r;\n\t\t}\n\t}\n\treturn result;\n};","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = function(module) {\n\tvar getter = module && module.__esModule ?\n\t\tfunction() { return module['default']; } :\n\t\tfunction() { return module; };\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","var getProto = Object.getPrototypeOf ? function(obj) { return Object.getPrototypeOf(obj); } : function(obj) { return obj.__proto__; };\nvar leafPrototypes;\n// create a fake namespace object\n// mode & 1: value is a module id, require it\n// mode & 2: merge all properties of value into the ns\n// mode & 4: return value when already ns object\n// mode & 16: return value when it's Promise-like\n// mode & 8|1: behave like require\n__webpack_require__.t = function(value, mode) {\n\tif(mode & 1) value = this(value);\n\tif(mode & 8) return value;\n\tif(typeof value === 'object' && value) {\n\t\tif((mode & 4) && value.__esModule) return value;\n\t\tif((mode & 16) && typeof value.then === 'function') return value;\n\t}\n\tvar ns = Object.create(null);\n\t__webpack_require__.r(ns);\n\tvar def = {};\n\tleafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];\n\tfor(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {\n\t\tObject.getOwnPropertyNames(current).forEach(function(key) { def[key] = function() { return value[key]; }; });\n\t}\n\tdef['default'] = function() { return value; };\n\t__webpack_require__.d(ns, def);\n\treturn ns;\n};","// define getter functions for harmony exports\n__webpack_require__.d = function(exports, definition) {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.f = {};\n// This file contains only the entry chunk.\n// The chunk loading function for additional chunks\n__webpack_require__.e = function(chunkId) {\n\treturn Promise.all(Object.keys(__webpack_require__.f).reduce(function(promises, key) {\n\t\t__webpack_require__.f[key](chunkId, promises);\n\t\treturn promises;\n\t}, []));\n};","// This function allow to reference async chunks and sibling chunks for the entrypoint\n__webpack_require__.u = function(chunkId) {\n\t// return url for filenames based on template\n\treturn \"static/js/\" + {\"24\":\"antd\",\"159\":\"vendor~efdee510\",\"241\":\"vendor~229eafb5\",\"284\":\"vendor~cdd60c62\",\"289\":\"custom\",\"563\":\"vendor~d2eb5610\",\"592\":\"common\",\"682\":\"vendor~37d53f5a\",\"717\":\"vendor~820c4f04\",\"729\":\"vendor~a5ce148e\",\"861\":\"vendor~db2560e8\",\"886\":\"vendor~7f854005\",\"913\":\"vendor~5a94f17d\",\"975\":\"vendor~9241dc7c\"}[chunkId] + \".\" + {\"24\":\"010bab0a\",\"159\":\"e36bb9cd\",\"241\":\"e9003480\",\"284\":\"1277de48\",\"289\":\"9dc2d734\",\"563\":\"457e2d97\",\"592\":\"711fad65\",\"682\":\"6e6f9f6c\",\"717\":\"16f25bd6\",\"729\":\"245f9105\",\"861\":\"903114f2\",\"886\":\"55fc9c15\",\"913\":\"1c2e413f\",\"975\":\"d7a29324\"}[chunkId] + \".js\";\n};","// This function allow to reference async chunks and sibling chunks for the entrypoint\n__webpack_require__.miniCssF = function(chunkId) {\n\t// return url for filenames based on template\n\treturn \"static/css/\" + \"custom\" + \".\" + \"ac13e4fb\" + \".css\";\n};","__webpack_require__.g = (function() {\n\tif (typeof globalThis === 'object') return globalThis;\n\ttry {\n\t\treturn this || new Function('return this')();\n\t} catch (e) {\n\t\tif (typeof window === 'object') return window;\n\t}\n})();","__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }","// define __esModule on exports\n__webpack_require__.r = function(exports) {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","__webpack_require__.nmd = function(module) {\n\tmodule.paths = [];\n\tif (!module.children) module.children = [];\n\treturn module;\n};","__webpack_require__.j = 889;","__webpack_require__.p = \"/\";","// no baseURI\n\n// object to store loaded chunks\n// \"1\" means \"already loaded\"\nvar installedChunks = {\n\t889: 1\n};\n\n// importScripts chunk loading\nvar installChunk = function(data) {\n\tvar chunkIds = data[0];\n\tvar moreModules = data[1];\n\tvar runtime = data[2];\n\tfor(var moduleId in moreModules) {\n\t\tif(__webpack_require__.o(moreModules, moduleId)) {\n\t\t\t__webpack_require__.m[moduleId] = moreModules[moduleId];\n\t\t}\n\t}\n\tif(runtime) runtime(__webpack_require__);\n\twhile(chunkIds.length)\n\t\tinstalledChunks[chunkIds.pop()] = 1;\n\tparentChunkLoadingFunction(data);\n};\n__webpack_require__.f.i = function(chunkId, promises) {\n\t// \"1\" is the signal for \"already loaded\"\n\tif(!installedChunks[chunkId]) {\n\t\tif(true) { // all chunks have JS\n\t\t\timportScripts(__webpack_require__.p + __webpack_require__.u(chunkId));\n\t\t}\n\t}\n};\n\nvar chunkLoadingGlobal = self[\"webpackChunk_synfutures_v3_app\"] = self[\"webpackChunk_synfutures_v3_app\"] || [];\nvar parentChunkLoadingFunction = chunkLoadingGlobal.push.bind(chunkLoadingGlobal);\nchunkLoadingGlobal.push = installChunk;\n\n// no HMR\n\n// no HMR manifest","__webpack_require__.nc = undefined;","var next = __webpack_require__.x;\n__webpack_require__.x = function() {\n\treturn Promise.all([289,24,284,861,717,886,563,159,975,682,913,241,729,592].map(__webpack_require__.e, __webpack_require__)).then(next);\n};","// run startup\nvar __webpack_exports__ = __webpack_require__.x();\n"],"names":["negativeNumberColor","num","toBN","gte","DisplayStrWithCountUp","_ref","iProps","defaultProps","_objectSpread","duration","useEasing","useGrouping","preserveValue","decimals","formattingFn","useCallback","value","formatDisplayNumber","type","_jsx","CountUp","end","toNumber","formatNumberTooltipWrap","_ref2","formattedNumStr","_ref2$colorShader","colorShader","_ref2$isBold","isBold","_ref2$isShowTBMK","isShowTBMK","toolTipProps","prefix","suffix","_ref2$showToolTip","showToolTip","countUpProps","showPositive","_ref2$colorSuffix","colorSuffix","isShowApproximatelyEqualTo","minDecimalPlaces","showZeroIfNegative","_ref2$isUseMockNumber","isUseMockNumber","_ref2$isShowSuffixInT","isShowSuffixInTooltip","numRes","displayStrWithCountUp","disPlayStr","isNaN","isZero","lt","suffixDom","className","children","showColorNumber","arguments","length","undefined","eq","_jsxs","style","color","displayNumStr","toString","startsWith","slice","Tooltip","title","concat","bNToS","formatNumberWithTooltip","_ref3","_ref3$colorShader","_ref3$isBold","_ref3$isShowTBMK","formatPriceNumberWithTooltip","_ref4","_ref4$colorShader","_ref4$isOperateNum","isOperateNum","_ref4$isShowTBMK","significantDigits","roundingMode","formatLiqPriceNumberWithTooltip","_ref5","_ref5$colorShader","options","_objectWithoutProperties","_excluded","price","abs","Infinity","formatPercentage","_ref8","percentage","_ref8$hundredfold","hundredfold","_ref8$colorShader","customTitle","_ref8$decimals","withThreshHold","_ref8$prefix","_ref8$suffix","_ref8$isColorShaderWh","isColorShaderWhiteIfZero","_ref8$isHiddenIfZero","isHiddenIfZero","_ref8$requirePlusSymb","requirePlusSymbol","percentageNumber","WrappedBigNumber","mul","displayString","formatNumber","percentageBN","threshold","Math","pow","notEq","gt","stringValue","colorShaderClassname","plusMinusSymbol","classNames","arr","CHAIN_ID","process","split","map","chainIdStr","Number","parseInt","_process$env$REACT_AP","_chainConfigs","_defineProperty","getChainConfigInfo","DAPP_CHAIN_CONFIGS","_DAPP_CHAIN_CONFIGS","getDappChainConfig","linea","blastSepolia","blast","arbitrum","base","DEFAULT_EMPTY_ACCOUNT","DEFAULT_DECIMALS","SEARCH_PAIR_SORTERS","SIGNIFICANT_DIGITS","_SEARCH_PAIR_SORTERS_","FAVORITE","EARN_FAVORITE","VOLUME_24H","CHANGE_24H","TVL","OI","APY","BOOSTED_LIQUIDITY","LOCAL_RPC_URL","getChainName","chainId","chainName","dappChainConfig","network","name","Object","values","config","blockExplorer","url","getProviderFromLocalOrSetting","_x3","_getProviderFromLocalOrSetting","apply","_asyncToGenerator","_regeneratorRuntime","mark","_callee2","localRpcUrl","_CHAIN_WSS_RPC_URLS$c2","wssRpcUrl","wrap","_context2","prev","next","getRpcFromLocalForage","sent","CHAIN_WSS_RPC_URLS","abrupt","provider","ReconnectingWebSocketProvider","getFallbackProvider","CHAIN_HTTP_RPC_URLS","rpc","StaticJsonRpcProvider","stop","urls","params","providers","index","priority","weight","stallTimeout","pollingFunc","func","interval","setInterval","bigNumberObjectCheck","obj","cloneObj","_","keys","forEach","key","val","bn","BigNumber","_hex","hex","_typeof","WrappedQuote","newVal","error","getShortFormDeciamal","numBN","tailSignificantDigits","numStr","countZeros","decimalPart","i","countNumTrailingZeros","_numStr$split","_numStr$split2","_slicedToArray","integerPart","tail","tailWithPaddingZero","repeat","decimalShortFormSymbolMap","number","utils","BN","radix","res","toCurrencyNumber","x","parts","replace","join","CURRENCY_UNITS","CURRENCY_UNIT_NUM","getBigCurrencyNum","unit","DEFAULT_DECIMAL_PLACES","findIndex","u","div","integerValue","precision","toFixed","toPrecision","_ref$isShowSeparator","isShowSeparator","_ref$type","_ref$isOperateNum","_ref$isShowTBMK","_ref$isShowApproximat","_ref$roundingMode","_ref$significantDigit","_ref$minDecimalPlaces","sign","isNegative","minExclusiveNumToShowShortDecimal","decimalPlaces","numberWithCommas","isRemoveTrailingZeros","match","inputNumChecker","allowMinus","regex","_integerPart","substring","indexOf","_decimalPart","formatEther","isInverse","ZERO","wdiv","toWad","toEtherReciprocalNumber","parseUnits","formatPercentageString","_ref2$hundredfold","_ref2$decimals","_ref2$roundingMode","_x21","_getRpcFromLocalForage","_callee12","signatureInStorage","_context12","localforage","t0","getTokenInfo","token","id","address","toLowerCase","isNativeTokenAddr","tokenAddr","constants","ERC20Worker","_this","_classCallCheck","chainContext","ERC20ContractMap","Map","WrappedNativeContractMap","getERC20Contract","signerOrProvider","erc20Contract","get","ERC20__factory","set","getWrappedNativeContract","wrappedNativeContract","WrappedNative__factory","this","Context","_createClass","instance","instances","ChainUserWorker","chainContextWorker","erc20Worker","nativeTokenBalanceInBlock","erc20TokenBalanceMap","erc20AllowanceMap","listeningEvent","isRequestBalance","isRequestAllowance","fetchTokenBalance","_callee","userAddr","block","_this$erc20TokenBalan","erc20","erc20Balance","_context","getBlockNumber","balanceOf","blockTag","updateBalanceCache","balance","_x","_x2","watchERC20Balance","on","topics","interface","getEventTopic","ethers","event","parsedLog","parseLog","blockNumber","to","args","amount","emitWorkerEvent","WorkerEventNames","allowanceInfo","spender","allowance","_x4","_x5","callERC20Allowance","_callee3","cachedAllowanceInfo","_context3","data","updateAllowanceCache","_x6","multicallBalance","_callee4","tokens","balanceMap","balancesRes","balanceInfos","_balancesRes$blockInf","_balancesRes$blockInf2","_context4","tokenAssistant","balanceOfTokenBatch","balances","blockInfo","height","balanceInfo","_x7","_x8","_x9","multicallAllowance","_ref6","_callee5","callMapping","allowanceInfos","_context5","t","contract","callData","encodeFunctionData","multiCall3","callStatic","aggregate3","target","allowFailure","_ref7","decodeFunctionResult","returnData","_x10","_x11","_x12","_x13","ChainContextWorker","getInstance","_init","_callee6","_context6","readProviderFromLocalOrSetting","info","_fetchNativeTokenBalance","_callee7","_this$nativeTokenBala","_this$nativeTokenBala2","walletBalance","_context7","getBalance","nativeToken","_x14","_x15","_ref9","_this$erc20TokenBalan2","eventName","_ref10","_getInstance","_callee8","_context8","init","_x16","UserWorker","_this2","polling","pollingFetchNativeTokenBalance","_ref11","_callee10","chainInstance","_context10","clearPolling","getChainInstance","_callee9","_context9","fetchNativeTokenBalance","_x17","_x18","_ref13","_callee11","_context11","_x19","_x20","_ref15","_ref14","_x22","_ref17","_callee13","_ref16","allowances","_context13","_x23","_ref19","_callee14","_ref18","_context14","_x24","clearInterval","_getInstance2","_callee15","_context15","_x25","onmessage","_ref20","_callee16","e","_event$data","_chainId2","_userAddr","userWorker","_event$data2","_chainId3","_userAddr2","_block","_userWorker","_event$data3","_chainId4","_userAddr3","_tokens","_userWorker2","_context16","_x26","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","exports","module","loaded","__webpack_modules__","call","m","__webpack_exports__","O","amdO","deferred","result","chunkIds","fn","notFulfilled","fulfilled","j","every","splice","r","n","getter","__esModule","d","a","leafPrototypes","getProto","getPrototypeOf","__proto__","mode","then","ns","create","def","current","getOwnPropertyNames","definition","o","defineProperty","enumerable","f","chunkId","Promise","all","reduce","promises","miniCssF","g","globalThis","Function","window","prop","prototype","hasOwnProperty","Symbol","toStringTag","nmd","paths","p","installedChunks","importScripts","chunkLoadingGlobal","self","parentChunkLoadingFunction","push","bind","moreModules","runtime","pop","nc"],"sourceRoot":""}