@aurora-is-near/intents-swap-widget 3.17.1 → 3.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{config-CQ4V08as.js → config-VpsP2eLV.js} +959 -880
- package/dist/config-VpsP2eLV.js.map +1 -0
- package/dist/config.js +2 -2
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +2 -2
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.d.ts +2 -2
- package/dist/features/TokensList/TokenItem.js +1 -2
- package/dist/features/TokensList/TokensList.js +10 -2
- package/dist/features/TokensList/TokensList.js.map +1 -1
- package/dist/features/TokensList/constants.d.ts +4 -0
- package/dist/features/TokensList/constants.js +8 -0
- package/dist/features/TokensList/constants.js.map +1 -0
- package/dist/features/TokensList/hooks/index.d.ts +1 -0
- package/dist/features/TokensList/hooks/index.js +5 -0
- package/dist/features/TokensList/hooks/index.js.map +1 -0
- package/dist/features/TokensList/hooks/useFocusOnList.d.ts +9 -0
- package/dist/features/TokensList/hooks/useFocusOnList.js +33 -0
- package/dist/features/TokensList/hooks/useFocusOnList.js.map +1 -0
- package/dist/features/TokensList/index.d.ts +2 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensList/types.d.ts +14 -0
- package/dist/features/TokensList/types.js +2 -0
- package/dist/features/TokensList/types.js.map +1 -0
- package/dist/features/TokensList/utils/getFirstGroupItemTotalIndex.d.ts +9 -0
- package/dist/features/TokensList/utils/getFirstGroupItemTotalIndex.js +8 -0
- package/dist/features/TokensList/utils/getFirstGroupItemTotalIndex.js.map +1 -0
- package/dist/features/TokensList/utils/getGroupHeadersTotalIndexes.d.ts +8 -0
- package/dist/features/TokensList/utils/getGroupHeadersTotalIndexes.js +5 -0
- package/dist/features/TokensList/utils/getGroupHeadersTotalIndexes.js.map +1 -0
- package/dist/features/TokensList/utils/getListItemsTotalCount.d.ts +8 -0
- package/dist/features/TokensList/utils/getListItemsTotalCount.js +8 -0
- package/dist/features/TokensList/utils/getListItemsTotalCount.js.map +1 -0
- package/dist/features/TokensList/utils/getListState.d.ts +9 -0
- package/dist/features/TokensList/utils/getListState.js +5 -0
- package/dist/features/TokensList/utils/getListState.js.map +1 -0
- package/dist/features/TokensList/utils/getListTotalHeight.d.ts +8 -0
- package/dist/features/TokensList/utils/getListTotalHeight.js +12 -0
- package/dist/features/TokensList/utils/getListTotalHeight.js.map +1 -0
- package/dist/features/TokensList/utils/getTokenByTotalIndex.d.ts +9 -0
- package/dist/features/TokensList/utils/getTokenByTotalIndex.js +7 -0
- package/dist/features/TokensList/utils/getTokenByTotalIndex.js.map +1 -0
- package/dist/features/TokensList/utils/index.d.ts +6 -0
- package/dist/features/TokensList/utils/index.js +15 -0
- package/dist/features/TokensList/utils/index.js.map +1 -0
- package/dist/features/TokensModal.js +2 -2
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +2 -2
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +4 -3
- package/dist/hooks/useMakeIntentsTransfer.js.map +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +4 -2
- package/dist/hooks/useMakeNEARFtTransferCall.js.map +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +3 -2
- package/dist/hooks/useMakeQuoteTransfer.js.map +1 -1
- package/dist/hooks/useMakeSolanaTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/{index-Ce9bzNHX.js → index-JGjxyZXI.js} +70 -70
- package/dist/index-JGjxyZXI.js.map +1 -0
- package/dist/index.browser.esm-COWShN0a.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/utils/checkers/isUserDeniedSigning.d.ts +2 -1
- package/dist/utils/checkers/isUserDeniedSigning.js +6 -4
- package/dist/utils/checkers/isUserDeniedSigning.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +26 -24
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/intents/signers/near.d.ts +1 -1
- package/dist/utils/intents/signers/near.js +2 -2
- package/dist/utils/intents/signers/privy.d.ts +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/intents/signers/solana.d.ts +1 -1
- package/dist/utils/intents/signers/solana.js.map +1 -1
- package/dist/utils/isErrorLikeObject.d.ts +4 -0
- package/dist/utils/isErrorLikeObject.js +5 -0
- package/dist/utils/isErrorLikeObject.js.map +1 -0
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +2 -2
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +2 -2
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +2 -2
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +2 -2
- package/src/features/TokensList/TokenItem.tsx +7 -3
- package/src/features/TokensList/TokensList.tsx +151 -57
- package/src/features/TokensList/constants.ts +4 -0
- package/src/features/TokensList/hooks/index.ts +1 -0
- package/src/features/TokensList/hooks/useFocusOnList.ts +56 -0
- package/src/features/TokensList/types.ts +28 -0
- package/src/features/TokensList/utils/getFirstGroupItemTotalIndex.ts +28 -0
- package/src/features/TokensList/utils/getGroupHeadersTotalIndexes.ts +21 -0
- package/src/features/TokensList/utils/getListItemsTotalCount.ts +14 -0
- package/src/features/TokensList/utils/getListState.ts +16 -0
- package/src/features/TokensList/utils/getListTotalHeight.ts +25 -0
- package/src/features/TokensList/utils/getTokenByTotalIndex.ts +19 -0
- package/src/features/TokensList/utils/index.ts +6 -0
- package/src/hooks/useMakeIntentsTransfer.ts +40 -29
- package/src/hooks/useMakeNEARFtTransferCall.ts +10 -0
- package/src/hooks/useMakeQuoteTransfer.ts +2 -1
- package/src/utils/checkers/isUserDeniedSigning.ts +11 -3
- package/src/utils/index.ts +1 -0
- package/src/utils/intents/signers/near.ts +1 -1
- package/src/utils/intents/signers/privy.ts +1 -1
- package/src/utils/intents/signers/solana.ts +1 -1
- package/src/utils/isErrorLikeObject.ts +11 -0
- package/dist/config-CQ4V08as.js.map +0 -1
- package/dist/index-Ce9bzNHX.js.map +0 -1
|
@@ -1,156 +1,165 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { jsx as o, jsxs as h, Fragment as
|
|
3
|
-
import
|
|
4
|
-
import { deepClone as
|
|
5
|
-
import { snapshot as
|
|
6
|
-
import { HelmetProvider as
|
|
7
|
-
import { memo as
|
|
8
|
-
import { useQuery as
|
|
9
|
-
import { Trans as
|
|
10
|
-
import { useTypedTranslation as
|
|
11
|
-
import { logger as
|
|
12
|
-
import { getTonTokenBalance as
|
|
13
|
-
import { getSolanaTokenBalance as
|
|
14
|
-
import { useWalletAddressForToken as
|
|
1
|
+
import { p as lt } from "./index-xuotMAFm.js";
|
|
2
|
+
import { jsx as o, jsxs as h, Fragment as $t } from "react/jsx-runtime";
|
|
3
|
+
import Kt from "i18next";
|
|
4
|
+
import { deepClone as we } from "valtio/utils";
|
|
5
|
+
import { snapshot as be, useSnapshot as ue, proxy as ct } from "valtio";
|
|
6
|
+
import { HelmetProvider as Ht, Helmet as Gt } from "react-helmet-async";
|
|
7
|
+
import { memo as jt, useEffect as R, useMemo as L, useRef as X, useCallback as ie, useState as te, useId as zt, createContext as dt, useContext as Yt } from "react";
|
|
8
|
+
import { useQuery as Ee, useInfiniteQuery as Xt, useQueryClient as Zt, QueryClient as Jt, QueryClientProvider as en } from "@tanstack/react-query";
|
|
9
|
+
import { Trans as tn, I18nextProvider as nn } from "react-i18next";
|
|
10
|
+
import { useTypedTranslation as $, initLocalisation as sn } from "./localisation.js";
|
|
11
|
+
import { logger as E } from "./logger.js";
|
|
12
|
+
import { getTonTokenBalance as rn } from "./utils/ton/getTonTokenBalance.js";
|
|
13
|
+
import { getSolanaTokenBalance as an } from "./utils/solana/getSolanaTokenBalance.js";
|
|
14
|
+
import { useWalletAddressForToken as ut } from "./hooks/useWalletAddressForToken.js";
|
|
15
15
|
import "@headlessui/react";
|
|
16
16
|
import "framer-motion";
|
|
17
17
|
import "lucide-react";
|
|
18
18
|
import "./features/ChainsDropdown/ChainItem.js";
|
|
19
|
-
import { cn as
|
|
20
|
-
import { OneClickService as
|
|
21
|
-
import { CHAINS_LIST as
|
|
19
|
+
import { cn as K } from "./utils/cn.js";
|
|
20
|
+
import { OneClickService as on, QuoteRequest as W, GetExecutionStatusResponse as ee } from "@defuse-protocol/one-click-sdk-typescript";
|
|
21
|
+
import { CHAINS_LIST as mt, DEFAULT_CHAINS_ORDER as ft, CHAIN_POA_MAP as pt, POA_EVM_CHAIN_ID as Tt, CHAIN_BASE_TOKENS as ln, EVM_CHAIN_IDS_MAP as ke, CHAIN_IDS_MAP as cn, EVM_CHAINS as dn } from "./constants/chains.js";
|
|
22
22
|
import "use-debounce";
|
|
23
|
-
import { derive as
|
|
24
|
-
import { getIsNativeNearDeposit as
|
|
25
|
-
import { getIsDirectTokenOnNearDeposit as
|
|
23
|
+
import { derive as un } from "derive-valtio";
|
|
24
|
+
import { getIsNativeNearDeposit as mn } from "./machine/computed/getIsNativeNearDeposit.js";
|
|
25
|
+
import { getIsDirectTokenOnNearDeposit as fn } from "./machine/computed/getIsDirectTokenOnNearDeposit.js";
|
|
26
26
|
import "ethers";
|
|
27
|
-
import { moveTo as
|
|
28
|
-
import
|
|
29
|
-
import { guardStates as
|
|
30
|
-
import { parse as
|
|
31
|
-
import { createLoader as
|
|
32
|
-
import { isAlchemySupportedChain as
|
|
33
|
-
import { fireEvent as
|
|
34
|
-
import { NATIVE_NEAR_DUMB_ASSET_ID as
|
|
35
|
-
import { isValidChain as
|
|
36
|
-
import { useWalletBalance as
|
|
37
|
-
import { getIntentsAccountId as
|
|
38
|
-
import { getIntentsBalances as
|
|
39
|
-
import { notReachable as
|
|
40
|
-
import { getTokenBalanceKey as
|
|
41
|
-
import { isDryQuote as
|
|
42
|
-
import { snakeCase as
|
|
43
|
-
import
|
|
44
|
-
import { oneClickApi as
|
|
45
|
-
import { formatBigToHuman as
|
|
46
|
-
import { getDryQuoteAddress as
|
|
47
|
-
import { isEvmChain as
|
|
48
|
-
import { checkNearAccountExists as
|
|
49
|
-
import { isNotEmptyAmount as
|
|
50
|
-
import { isValidBigint as
|
|
51
|
-
import { isNearAddress as
|
|
52
|
-
import { isBalanceSufficient as
|
|
53
|
-
import { isQuoteError as
|
|
54
|
-
import { isSolanaAddress as
|
|
55
|
-
import { isEvmAddress as
|
|
56
|
-
import { getMainTokenByChain as
|
|
57
|
-
import { getDefaultIntentsToken as
|
|
58
|
-
import { getTokenWithHighBalance as
|
|
59
|
-
import { isQuoteIdle as
|
|
60
|
-
import { isInputChanged as
|
|
61
|
-
import { isErrorChanged as
|
|
62
|
-
import { isOnlyErrorChanged as
|
|
63
|
-
import { isValidInitialState as
|
|
64
|
-
import { isWalletDisconnected as
|
|
65
|
-
import { isSendAddressForbidden as
|
|
66
|
-
import { isAmountChangedFromQuote as
|
|
67
|
-
import { reset as
|
|
68
|
-
import { tokenSelectRotate as
|
|
69
|
-
import { errorSet as
|
|
70
|
-
import { quoteSet as
|
|
71
|
-
import { addressSet as
|
|
72
|
-
import { tokenSetAmount as
|
|
73
|
-
import { quoteSetStatus as
|
|
74
|
-
import { depositTypeSet as
|
|
75
|
-
import { externalDepositTxSet as
|
|
76
|
-
import { setInputsValidating as
|
|
77
|
-
import { walletAddressSet as
|
|
78
|
-
import { tokenSetBalance as
|
|
79
|
-
import { transferSetStatus as
|
|
80
|
-
import { getUsdTradeDelta as
|
|
81
|
-
import { getIsDirectNonNearWithdrawal as
|
|
82
|
-
import { getIsDirectTokenOnNearTransfer as
|
|
83
|
-
import { getIsDirectNearTokenWithdrawal as
|
|
84
|
-
import { getIsSameAssetDiffChainWithdrawal as
|
|
27
|
+
import { moveTo as F, machine as J } from "./machine/machine.js";
|
|
28
|
+
import pn from "lodash.once";
|
|
29
|
+
import { guardStates as x } from "./machine/guards/index.js";
|
|
30
|
+
import { parse as Tn } from "./ext/alchemy/parse.js";
|
|
31
|
+
import { createLoader as hn } from "./ext/alchemy/load.js";
|
|
32
|
+
import { isAlchemySupportedChain as gn } from "./ext/alchemy/types.js";
|
|
33
|
+
import { fireEvent as T } from "./machine/events/utils/fireEvent.js";
|
|
34
|
+
import { NATIVE_NEAR_DUMB_ASSET_ID as G, TOKENS_DATA as Re, WNEAR_ASSET_ID as Ae } from "./constants/tokens.js";
|
|
35
|
+
import { isValidChain as In } from "./utils/checkers/isValidChain.js";
|
|
36
|
+
import { useWalletBalance as Ce } from "./hooks/useWalletBalance.js";
|
|
37
|
+
import { getIntentsAccountId as ne } from "./utils/intents/getIntentsAccountId.js";
|
|
38
|
+
import { getIntentsBalances as wn } from "./utils/intents/getIntentsBalance.js";
|
|
39
|
+
import { notReachable as De } from "./utils/notReachable.js";
|
|
40
|
+
import { getTokenBalanceKey as z } from "./utils/intents/getTokenBalanceKey.js";
|
|
41
|
+
import { isDryQuote as ve } from "./machine/guards/checks/isDryQuote.js";
|
|
42
|
+
import { snakeCase as ht } from "change-case";
|
|
43
|
+
import kn, { CanceledError as gt, AxiosError as It } from "axios";
|
|
44
|
+
import { oneClickApi as Se, bridgeApi as wt } from "./network.js";
|
|
45
|
+
import { formatBigToHuman as Y } from "./utils/formatters/formatBigToHuman.js";
|
|
46
|
+
import { getDryQuoteAddress as He } from "./utils/getDryQuoteAddress.js";
|
|
47
|
+
import { isEvmChain as H } from "./utils/evm/isEvmChain.js";
|
|
48
|
+
import { checkNearAccountExists as An } from "./utils/near/checkNearAccountExists.js";
|
|
49
|
+
import { isNotEmptyAmount as se } from "./utils/checkers/isNotEmptyAmount.js";
|
|
50
|
+
import { isValidBigint as kt } from "./utils/checkers/isValidBigint.js";
|
|
51
|
+
import { isNearAddress as At } from "./utils/near/isNearAddress.js";
|
|
52
|
+
import { isBalanceSufficient as xe } from "./machine/guards/checks/isBalanceSufficient.js";
|
|
53
|
+
import { isQuoteError as Oe, isTransferError as Fe, isAsyncSendAddressValidationError as Sn } from "./machine/errors.js";
|
|
54
|
+
import { isSolanaAddress as St } from "./utils/solana/isSolanaAddress.js";
|
|
55
|
+
import { isEvmAddress as Nt } from "./utils/evm/isEvmAddress.js";
|
|
56
|
+
import { getMainTokenByChain as Nn } from "./utils/tokens/getMainTokenByChain.js";
|
|
57
|
+
import { getDefaultIntentsToken as _n } from "./utils/tokens/getDefaultIntentsToken.js";
|
|
58
|
+
import { getTokenWithHighBalance as yn } from "./utils/tokens/getTokenWithHighBalance.js";
|
|
59
|
+
import { isQuoteIdle as bn } from "./machine/subscriptions/checkers/isQuoteIdle.js";
|
|
60
|
+
import { isInputChanged as En } from "./machine/subscriptions/checkers/isInputChanged.js";
|
|
61
|
+
import { isErrorChanged as Rn } from "./machine/subscriptions/checkers/isErrorChanged.js";
|
|
62
|
+
import { isOnlyErrorChanged as Cn } from "./machine/subscriptions/checkers/isOnlyErrorChanged.js";
|
|
63
|
+
import { isValidInitialState as Dn } from "./machine/subscriptions/checkers/isValidInitialState.js";
|
|
64
|
+
import { isWalletDisconnected as vn } from "./machine/subscriptions/checkers/isWalletDisconnected.js";
|
|
65
|
+
import { isSendAddressForbidden as xn } from "./machine/subscriptions/checkers/isSendAddressForbidden.js";
|
|
66
|
+
import { isAmountChangedFromQuote as On } from "./machine/subscriptions/checkers/isAmountChangedFromQuote.js";
|
|
67
|
+
import { reset as Fn } from "./machine/events/reset.js";
|
|
68
|
+
import { tokenSelectRotate as Ne } from "./machine/events/tokenSelectRotate.js";
|
|
69
|
+
import { errorSet as Ln } from "./machine/events/errorSet.js";
|
|
70
|
+
import { quoteSet as Bn } from "./machine/events/quoteSet.js";
|
|
71
|
+
import { addressSet as qn } from "./machine/events/addressSet.js";
|
|
72
|
+
import { tokenSetAmount as Un } from "./machine/events/tokenSetAmount.js";
|
|
73
|
+
import { quoteSetStatus as Pn } from "./machine/events/quoteSetStatus.js";
|
|
74
|
+
import { depositTypeSet as Wn } from "./machine/events/depositTypeSet.js";
|
|
75
|
+
import { externalDepositTxSet as Mn } from "./machine/events/externalDepositTxSet.js";
|
|
76
|
+
import { setInputsValidating as Vn } from "./machine/events/setInputsValidating.js";
|
|
77
|
+
import { walletAddressSet as Qn } from "./machine/events/walletAddressSet.js";
|
|
78
|
+
import { tokenSetBalance as $n } from "./machine/events/tokenSetBalance.js";
|
|
79
|
+
import { transferSetStatus as Kn } from "./machine/events/transferSetStatus.js";
|
|
80
|
+
import { getUsdTradeDelta as Hn } from "./machine/computed/getUsdTradeDelta.js";
|
|
81
|
+
import { getIsDirectNonNearWithdrawal as Gn } from "./machine/computed/getIsDirectNonNearWithdrawal.js";
|
|
82
|
+
import { getIsDirectTokenOnNearTransfer as jn } from "./machine/computed/getIsDirectTokenOnNearTransfer.js";
|
|
83
|
+
import { getIsDirectNearTokenWithdrawal as zn } from "./machine/computed/getIsDirectNearTokenWithdrawal.js";
|
|
84
|
+
import { getIsSameAssetDiffChainWithdrawal as Yn } from "./machine/computed/getIsSameAssetDiffChainWithdrawal.js";
|
|
85
85
|
import "./components/Input.js";
|
|
86
86
|
import "viem";
|
|
87
87
|
import { Button as A } from "./components/Button.js";
|
|
88
|
-
import { TinyNumber as
|
|
89
|
-
import { ErrorMessage as
|
|
90
|
-
import { FT_DEPOSIT_GAS as
|
|
91
|
-
import { a as
|
|
92
|
-
import { z as
|
|
93
|
-
import { decodeQueryResult as
|
|
94
|
-
import { nearRpcClient as
|
|
95
|
-
import { getNearNep141MinStorageBalance as
|
|
96
|
-
import {
|
|
97
|
-
import {
|
|
98
|
-
import {
|
|
99
|
-
import {
|
|
100
|
-
import {
|
|
101
|
-
import {
|
|
102
|
-
import {
|
|
103
|
-
import {
|
|
104
|
-
import {
|
|
105
|
-
import {
|
|
106
|
-
import {
|
|
107
|
-
import {
|
|
108
|
-
import {
|
|
88
|
+
import { TinyNumber as Le } from "./components/TinyNumber.js";
|
|
89
|
+
import { ErrorMessage as j } from "./components/ErrorMessage.js";
|
|
90
|
+
import { FT_DEPOSIT_GAS as Ge, FT_TRANSFER_GAS as je } from "./utils/near/config.js";
|
|
91
|
+
import { a as Be } from "./index-DEq3oXQF.js";
|
|
92
|
+
import { z as oe } from "zod";
|
|
93
|
+
import { decodeQueryResult as Xn } from "./utils/near/decodeQueryResult.js";
|
|
94
|
+
import { nearRpcClient as Zn } from "./utils/near/rpc.js";
|
|
95
|
+
import { getNearNep141MinStorageBalance as Jn } from "./utils/near/getNearNep141MinStorageBalance.js";
|
|
96
|
+
import { isErrorLikeObject as le } from "./utils/isErrorLikeObject.js";
|
|
97
|
+
import { isUserDeniedSigning as ce } from "./utils/checkers/isUserDeniedSigning.js";
|
|
98
|
+
import { INTENTS_CONTRACT as _e } from "./constants/intents.js";
|
|
99
|
+
import { isEvmBaseToken as _t } from "./utils/evm/isEvmBaseToken.js";
|
|
100
|
+
import { useMakeEvmTransfer as es } from "./hooks/useMakeEvmTransfer.js";
|
|
101
|
+
import { useMakeSolanaTransfer as ts } from "./hooks/useMakeSolanaTransfer.js";
|
|
102
|
+
import { createIntentSignerNEP413 as ns, IntentsSDK as ss, createNearWithdrawalRoute as rs, createInternalTransferRoute as as, MinWithdrawalAmountError as os, FeeExceedsAmountError as is } from "@defuse-protocol/intents-sdk";
|
|
103
|
+
import { generateRandomBytes as ls } from "./utils/near/getRandomBytes.js";
|
|
104
|
+
import { IntentSignerSolana as cs } from "./utils/intents/signers/solana.js";
|
|
105
|
+
import { localStorageTyped as ze } from "./utils/localstorage.js";
|
|
106
|
+
import { queryContract as ds } from "./utils/near/queryContract.js";
|
|
107
|
+
import { utils as Ye } from "@defuse-protocol/internal-utils";
|
|
108
|
+
import { getTransactionLink as us } from "./utils/formatters/getTransactionLink.js";
|
|
109
|
+
import { switchEthereumChain as ms } from "./utils/evm/switchEthereumChain.js";
|
|
109
110
|
import "copy-text-to-clipboard";
|
|
110
|
-
import { SwapQuoteSkeleton as
|
|
111
|
-
import { Notes as
|
|
112
|
-
import { Accordion as
|
|
113
|
-
import { formatUsdAmount as
|
|
114
|
-
import { formatTinyNumber as
|
|
115
|
-
import
|
|
116
|
-
import { Skeleton as
|
|
117
|
-
import { getBalancePortion as
|
|
118
|
-
import { getUsdDisplayAmount as
|
|
119
|
-
import { TokenInputHeading as
|
|
120
|
-
import { noop as
|
|
121
|
-
import { Card as
|
|
122
|
-
import { Badge as
|
|
123
|
-
import { TokenIcon as
|
|
124
|
-
import { InputAmount as
|
|
125
|
-
import { TokenInputSkeleton as
|
|
126
|
-
import { getUsdDisplayBalance as
|
|
127
|
-
import { VList as
|
|
128
|
-
import {
|
|
129
|
-
import {
|
|
130
|
-
import {
|
|
131
|
-
import {
|
|
132
|
-
import {
|
|
133
|
-
import {
|
|
111
|
+
import { SwapQuoteSkeleton as yt } from "./features/SwapQuote/SwapQuoteSkeleton.js";
|
|
112
|
+
import { Notes as Te } from "./components/Notes.js";
|
|
113
|
+
import { Accordion as fs } from "./components/Accordion.js";
|
|
114
|
+
import { formatUsdAmount as Xe } from "./utils/formatters/formatUsdAmount.js";
|
|
115
|
+
import { formatTinyNumber as ps } from "./utils/formatters/formatTinyNumber.js";
|
|
116
|
+
import Ts from "clsx";
|
|
117
|
+
import { Skeleton as hs } from "./components/Skeleton.js";
|
|
118
|
+
import { getBalancePortion as gs } from "./features/TokenInput/utils/getBalancePortion.js";
|
|
119
|
+
import { getUsdDisplayAmount as Is } from "./features/TokenInput/utils/getUsdDisplayAmount.js";
|
|
120
|
+
import { TokenInputHeading as bt } from "./features/TokenInput/TokenInputHeading.js";
|
|
121
|
+
import { noop as ws } from "./utils/noop.js";
|
|
122
|
+
import { Card as me } from "./components/Card.js";
|
|
123
|
+
import { Badge as Ze } from "./components/Badge.js";
|
|
124
|
+
import { TokenIcon as Et } from "./components/TokenIcon.js";
|
|
125
|
+
import { InputAmount as ks } from "./components/InputAmount.js";
|
|
126
|
+
import { TokenInputSkeleton as As } from "./features/TokenInput/TokenInputSkeleton.js";
|
|
127
|
+
import { getUsdDisplayBalance as Ss } from "./utils/formatters/getUsdDisplayBalance.js";
|
|
128
|
+
import { VList as Ns } from "virtua";
|
|
129
|
+
import { useFocusOnList as _s } from "./features/TokensList/hooks/useFocusOnList.js";
|
|
130
|
+
import { TokensListPlaceholder as ye } from "./features/TokensList/TokensListPlaceholder.js";
|
|
131
|
+
import { MAX_LIST_VIEW_AREA_HEIGHT as ys, TOKEN_ITEM_HEIGHT as bs, LIST_CONTAINER_ID as Es } from "./features/TokensList/constants.js";
|
|
132
|
+
import { getGroupHeadersTotalIndexes as Rs } from "./features/TokensList/utils/getGroupHeadersTotalIndexes.js";
|
|
133
|
+
import { getFirstGroupItemTotalIndex as Cs } from "./features/TokensList/utils/getFirstGroupItemTotalIndex.js";
|
|
134
|
+
import { getListItemsTotalCount as Ds } from "./features/TokensList/utils/getListItemsTotalCount.js";
|
|
135
|
+
import { getTokenByTotalIndex as vs } from "./features/TokensList/utils/getTokenByTotalIndex.js";
|
|
136
|
+
import { getListTotalHeight as xs } from "./features/TokensList/utils/getListTotalHeight.js";
|
|
137
|
+
import { getListState as Os } from "./features/TokensList/utils/getListState.js";
|
|
138
|
+
import { Hr as Fs } from "./components/Hr.js";
|
|
139
|
+
import { createTokenSorter as Ls } from "./utils/tokens/sort.js";
|
|
140
|
+
import { createFilterByIntents as Je } from "./utils/tokens/filterByIntents.js";
|
|
141
|
+
import { createFilterBySearch as Bs } from "./utils/tokens/filterBySearchString.js";
|
|
142
|
+
import { createFilterBySelectedChain as qs } from "./utils/tokens/filterBySelectedChain.js";
|
|
134
143
|
import "bs58";
|
|
135
144
|
import "viem/chains";
|
|
136
145
|
import "browser-or-node";
|
|
137
146
|
import "qrcode.react";
|
|
138
|
-
import { createColorPalette as
|
|
139
|
-
import { ArmingCountdownFill as
|
|
140
|
-
import { useTimer as
|
|
141
|
-
import { useHandleKeyDown as
|
|
142
|
-
import { CloseButton as
|
|
143
|
-
import { DEFAULT_RPCS as
|
|
144
|
-
import { useAddClassToPortal as
|
|
145
|
-
import { ErrorBoundary as
|
|
146
|
-
import { isEvmToken as
|
|
147
|
-
import { getEvmMainTokenBalance as
|
|
148
|
-
import { getNativeNearBalance as
|
|
149
|
-
import { getNearTokenBalance as
|
|
150
|
-
import { getEvmTokenBalance as
|
|
151
|
-
function
|
|
152
|
-
const { walletSupportedChains: s, tonCenterApiKey: n, alchemyApiKey: a } =
|
|
153
|
-
return
|
|
147
|
+
import { createColorPalette as Us } from "./theme/createColorPalette.js";
|
|
148
|
+
import { ArmingCountdownFill as Ps, BeenhereFill as Ws, EncryptedFill as Ms, AccountBalanceWalletFill as Vs, CheckCircleFill as Qs, GppBadFill as $s } from "@material-symbols-svg/react-rounded";
|
|
149
|
+
import { useTimer as Ks } from "use-timer";
|
|
150
|
+
import { useHandleKeyDown as Rt } from "./hooks/useHandleKeyDown.js";
|
|
151
|
+
import { CloseButton as Ct } from "./components/CloseButton.js";
|
|
152
|
+
import { DEFAULT_RPCS as Hs } from "./rpcs.js";
|
|
153
|
+
import { useAddClassToPortal as Gs } from "./hooks/useAddClassToPortal.js";
|
|
154
|
+
import { ErrorBoundary as js } from "react-error-boundary";
|
|
155
|
+
import { isEvmToken as zs } from "./utils/evm/isEvmToken.js";
|
|
156
|
+
import { getEvmMainTokenBalance as Ys } from "./utils/evm/getEvmMainTokenBalance.js";
|
|
157
|
+
import { getNativeNearBalance as Xs } from "./utils/near/getNativeNearBalance.js";
|
|
158
|
+
import { getNearTokenBalance as Zs } from "./utils/near/getNearTokenBalance.js";
|
|
159
|
+
import { getEvmTokenBalance as Js } from "./utils/evm/getEvmTokenBalance.js";
|
|
160
|
+
function er({ rpcs: e, token: t, connectedWallets: r }) {
|
|
161
|
+
const { walletSupportedChains: s, tonCenterApiKey: n, alchemyApiKey: a } = b(), { walletAddress: c } = ut(r, t);
|
|
162
|
+
return Ee({
|
|
154
163
|
retry: 2,
|
|
155
164
|
enabled: !!c && Object.keys(e).includes(t.blockchain),
|
|
156
165
|
queryKey: ["tokenBalance", t.assetId, r],
|
|
@@ -158,32 +167,32 @@ function Ls({ rpcs: e, token: t, connectedWallets: r }) {
|
|
|
158
167
|
if (!c)
|
|
159
168
|
return null;
|
|
160
169
|
if (t.blockchain === "near" && s.includes(t.blockchain))
|
|
161
|
-
return !e.near || e.near.length === 0 ? null : t.assetId ===
|
|
162
|
-
if (!s.includes("eth") &&
|
|
170
|
+
return !e.near || e.near.length === 0 ? null : t.assetId === G ? Xs(c, e.near) : Zs(t, c, e.near);
|
|
171
|
+
if (!s.includes("eth") && H(t.blockchain))
|
|
163
172
|
return null;
|
|
164
|
-
if (
|
|
173
|
+
if (H(t.blockchain) && _t(t)) {
|
|
165
174
|
const l = e[t.blockchain] ?? [];
|
|
166
|
-
return l.length > 0 ?
|
|
175
|
+
return l.length > 0 ? Ys(c, l[0]) : null;
|
|
167
176
|
}
|
|
168
|
-
if (
|
|
177
|
+
if (zs(t) || H(t.blockchain)) {
|
|
169
178
|
const l = e[t.blockchain] ?? [];
|
|
170
|
-
return l.length > 0 ?
|
|
179
|
+
return l.length > 0 ? Js(t, c, l[0]) : null;
|
|
171
180
|
}
|
|
172
|
-
return t.blockchain === "ton" ?
|
|
181
|
+
return t.blockchain === "ton" ? rn(t, c, n) : t.blockchain === "sol" && s.includes(t.blockchain) ? an(t, c, a) : (E.warn(
|
|
173
182
|
`Failed to fetch token balance for ${t.symbol} on ${t.blockchain}`
|
|
174
183
|
), null);
|
|
175
184
|
}
|
|
176
185
|
});
|
|
177
186
|
}
|
|
178
|
-
const
|
|
187
|
+
const tr = ({
|
|
179
188
|
rpcs: e,
|
|
180
189
|
token: t,
|
|
181
190
|
onBalancesLoaded: r
|
|
182
191
|
}) => (R(() => {
|
|
183
192
|
t.isIntent || !Object.keys(e).includes(t.blockchain) || r({ [t.assetId]: "0" });
|
|
184
|
-
}, [t.assetId]), null),
|
|
193
|
+
}, [t.assetId]), null), Dt = jt(
|
|
185
194
|
({ rpcs: e, token: t, connectedWallets: r, onBalancesLoaded: s }) => {
|
|
186
|
-
const { data: n } =
|
|
195
|
+
const { data: n } = er({
|
|
187
196
|
rpcs: e,
|
|
188
197
|
token: t,
|
|
189
198
|
connectedWallets: r
|
|
@@ -194,13 +203,13 @@ const Bs = ({
|
|
|
194
203
|
},
|
|
195
204
|
(e, t) => e.token.assetId === t.token.assetId && e.connectedWallets === t.connectedWallets
|
|
196
205
|
);
|
|
197
|
-
|
|
198
|
-
const
|
|
199
|
-
Zero:
|
|
200
|
-
}),
|
|
206
|
+
Dt.displayName = "TokenBalanceLoader";
|
|
207
|
+
const et = Object.assign(Dt, {
|
|
208
|
+
Zero: tr
|
|
209
|
+
}), nr = (e) => {
|
|
201
210
|
const t = e.toLowerCase();
|
|
202
|
-
return
|
|
203
|
-
},
|
|
211
|
+
return Re[t]?.icon ?? "";
|
|
212
|
+
}, sr = (e) => `${e?.charAt(0).toUpperCase()}${e?.slice(1)}`, rr = (e) => Re[e]?.name ?? e, M = (e) => {
|
|
204
213
|
const {
|
|
205
214
|
showIntentTokens: t,
|
|
206
215
|
allowedTokensList: r,
|
|
@@ -209,55 +218,55 @@ const He = Object.assign(Nt, {
|
|
|
209
218
|
filterTokens: a,
|
|
210
219
|
fetchSourceTokens: c,
|
|
211
220
|
fetchTargetTokens: l
|
|
212
|
-
} =
|
|
221
|
+
} = b(), { data: d, ...u } = Ee({
|
|
213
222
|
queryKey: ["tokens", e].filter(Boolean),
|
|
214
|
-
queryFn: async () => e === "source" && c ? c() : e === "target" && l ? l() :
|
|
215
|
-
}), i =
|
|
223
|
+
queryFn: async () => e === "source" && c ? c() : e === "target" && l ? l() : on.getTokens()
|
|
224
|
+
}), i = L(() => {
|
|
216
225
|
if (!d)
|
|
217
226
|
return [];
|
|
218
227
|
const f = d.map((m) => {
|
|
219
228
|
const w = m.blockchain.toLowerCase();
|
|
220
|
-
return !
|
|
229
|
+
return !In(w) || r && !r.includes(m.assetId) || e === "source" && s && !s.includes(m.assetId) || e === "target" && n && !n.includes(m.assetId) ? null : {
|
|
221
230
|
assetId: m.assetId,
|
|
222
231
|
symbol: m.symbol,
|
|
223
232
|
decimals: m.decimals,
|
|
224
233
|
price: m.price,
|
|
225
234
|
blockchain: w,
|
|
226
235
|
isIntent: !1,
|
|
227
|
-
icon: m.icon ??
|
|
228
|
-
name:
|
|
229
|
-
chainName:
|
|
236
|
+
icon: m.icon ?? nr(m.symbol),
|
|
237
|
+
name: rr(m.symbol),
|
|
238
|
+
chainName: mt[m.blockchain]?.label ?? sr(m.blockchain),
|
|
230
239
|
contractAddress: m.contractAddress
|
|
231
240
|
};
|
|
232
|
-
}).filter((m) => !!m).filter(a ?? (() => !0)),
|
|
241
|
+
}).filter((m) => !!m).filter(a ?? (() => !0)), p = f.filter(
|
|
233
242
|
(m) => m.symbol.toLowerCase() !== "wnear"
|
|
234
243
|
), I = f.find((m) => m.symbol.toLowerCase() === "wnear");
|
|
235
|
-
return I &&
|
|
244
|
+
return I && p.push({
|
|
236
245
|
name: "NEAR",
|
|
237
246
|
symbol: "NEAR",
|
|
238
247
|
chainName: "Near",
|
|
239
248
|
blockchain: "near",
|
|
240
|
-
assetId:
|
|
241
|
-
icon:
|
|
249
|
+
assetId: G,
|
|
250
|
+
icon: Re.near?.icon ?? "",
|
|
242
251
|
price: I?.price ?? 0,
|
|
243
252
|
contractAddress: I?.contractAddress,
|
|
244
253
|
isIntent: !1,
|
|
245
254
|
decimals: 24
|
|
246
255
|
}), t ? [
|
|
247
|
-
...
|
|
256
|
+
...p,
|
|
248
257
|
// add intents tokens to the full list
|
|
249
258
|
...f.map(
|
|
250
259
|
(m) => m.symbol.toLowerCase() === "wnear" ? { ...m, symbol: "NEAR", name: "NEAR", isIntent: !0 } : { ...m, isIntent: !0 }
|
|
251
260
|
)
|
|
252
|
-
] :
|
|
261
|
+
] : p;
|
|
253
262
|
}, [d, t, a]);
|
|
254
263
|
return {
|
|
255
264
|
...u,
|
|
256
265
|
tokens: i
|
|
257
266
|
};
|
|
258
|
-
},
|
|
259
|
-
const { tokens: e } =
|
|
260
|
-
return { tokens:
|
|
267
|
+
}, ar = () => {
|
|
268
|
+
const { tokens: e } = M(), { tokens: t } = M("source"), { tokens: r } = M("target");
|
|
269
|
+
return { tokens: L(() => {
|
|
261
270
|
const n = {};
|
|
262
271
|
return [
|
|
263
272
|
...e,
|
|
@@ -268,118 +277,118 @@ const He = Object.assign(Nt, {
|
|
|
268
277
|
n[c] = a;
|
|
269
278
|
}), Object.values(n);
|
|
270
279
|
}, [e, t, r]) };
|
|
271
|
-
},
|
|
280
|
+
}, he = [
|
|
272
281
|
{ eth: ["ETH", "USDT", "USDC", "AURORA"] },
|
|
273
282
|
{ near: ["USDT", "USDC", "AURORA"] },
|
|
274
283
|
{ arb: ["ARB", "ETH", "USDT", "USDC"] },
|
|
275
284
|
{ btc: ["BTC"] }
|
|
276
|
-
],
|
|
277
|
-
const s =
|
|
285
|
+
], or = (e) => [...e].sort((t, r) => {
|
|
286
|
+
const s = he.findIndex(
|
|
278
287
|
(d) => Object.keys(d)[0] === t.blockchain
|
|
279
|
-
), n =
|
|
288
|
+
), n = he.findIndex(
|
|
280
289
|
(d) => Object.keys(d)[0] === r.blockchain
|
|
281
290
|
);
|
|
282
291
|
if (s !== n)
|
|
283
292
|
return s === -1 ? 1 : n === -1 ? -1 : s - n;
|
|
284
|
-
const a =
|
|
293
|
+
const a = he[s]?.[t.blockchain] ?? [], c = a.indexOf(t.symbol), l = a.indexOf(r.symbol);
|
|
285
294
|
return c === -1 && l === -1 ? 0 : c === -1 ? 1 : l === -1 ? -1 : c - l;
|
|
286
|
-
}),
|
|
287
|
-
const { tokens: r } =
|
|
288
|
-
return
|
|
289
|
-
|
|
295
|
+
}), ir = ({ rpcs: e, connectedWallets: t }) => {
|
|
296
|
+
const { tokens: r } = ar(), { walletSupportedChains: s } = b(), { setWalletBalance: n } = Ce(t);
|
|
297
|
+
return L(() => or(r), [r]).map((c) => s.includes(c.blockchain) ? /* @__PURE__ */ o(
|
|
298
|
+
et,
|
|
290
299
|
{
|
|
291
300
|
rpcs: e,
|
|
292
301
|
token: c,
|
|
293
302
|
connectedWallets: t,
|
|
294
303
|
onBalancesLoaded: (l) => n(t, l)
|
|
295
304
|
},
|
|
296
|
-
|
|
305
|
+
z(c)
|
|
297
306
|
) : /* @__PURE__ */ o(
|
|
298
|
-
|
|
307
|
+
et.Zero,
|
|
299
308
|
{
|
|
300
309
|
rpcs: e,
|
|
301
310
|
token: c,
|
|
302
311
|
onBalancesLoaded: (l) => n(t, l)
|
|
303
312
|
},
|
|
304
|
-
|
|
313
|
+
z(c)
|
|
305
314
|
));
|
|
306
315
|
};
|
|
307
|
-
function
|
|
316
|
+
function lr(e, t) {
|
|
308
317
|
const r = Array.from(
|
|
309
|
-
/* @__PURE__ */ new Set([...t ?? [], ...
|
|
318
|
+
/* @__PURE__ */ new Set([...t ?? [], ...ft])
|
|
310
319
|
), s = new Map(r.map((n, a) => [n, a]));
|
|
311
320
|
return [...e].sort((n, a) => {
|
|
312
321
|
const c = s.has(n.id) ? s.get(n.id) : 1 / 0, l = s.has(a.id) ? s.get(a.id) : 1 / 0;
|
|
313
322
|
return c !== l ? c - l : n.id.localeCompare(a.id, void 0, { sensitivity: "base" });
|
|
314
323
|
});
|
|
315
324
|
}
|
|
316
|
-
const
|
|
325
|
+
const cr = (e) => {
|
|
317
326
|
const {
|
|
318
327
|
chainsOrder: t,
|
|
319
328
|
allowedChainsList: r,
|
|
320
329
|
allowedSourceChainsList: s,
|
|
321
330
|
allowedTargetChainsList: n
|
|
322
|
-
} =
|
|
323
|
-
return
|
|
331
|
+
} = b(), { tokens: a } = M();
|
|
332
|
+
return L(() => {
|
|
324
333
|
const c = Array.from(
|
|
325
|
-
new Set(a.map((l) =>
|
|
334
|
+
new Set(a.map((l) => mt[l.blockchain]))
|
|
326
335
|
).filter((l) => !(r && !r.includes(l.id) || e === "source" && s && !s.includes(l.id) || e === "target" && n && !n.includes(l.id)));
|
|
327
|
-
return
|
|
336
|
+
return lr(c, t);
|
|
328
337
|
}, [a, t, r]);
|
|
329
|
-
},
|
|
338
|
+
}, tt = 3, vt = ({
|
|
330
339
|
connectedWallets: e,
|
|
331
340
|
alchemyApiKey: t,
|
|
332
341
|
...r
|
|
333
342
|
}) => {
|
|
334
|
-
const { ctx: s } = _(), { tokens: n } =
|
|
343
|
+
const { ctx: s } = _(), { tokens: n } = M(), { walletSupportedChains: a } = b(), { setWalletBalance: c } = Ce(e), l = r.isEnabled && !!Object.values(e).length && a.length > 0, d = Xt({
|
|
335
344
|
initialPageParam: null,
|
|
336
345
|
enabled: !!l && !!t,
|
|
337
346
|
queryKey: ["walletTokensBalance", e],
|
|
338
|
-
queryFn: async ({ pageParam: i }) =>
|
|
347
|
+
queryFn: async ({ pageParam: i }) => hn({ alchemyApiKey: t })({
|
|
339
348
|
pageParam: i ? `${i}` : null,
|
|
340
349
|
connectedWallets: e,
|
|
341
350
|
walletSupportedChains: a
|
|
342
351
|
}),
|
|
343
352
|
getNextPageParam: (i, f) => {
|
|
344
|
-
if (i.pageKey && !(f.length >=
|
|
353
|
+
if (i.pageKey && !(f.length >= tt))
|
|
345
354
|
return i.pageKey;
|
|
346
355
|
}
|
|
347
356
|
});
|
|
348
357
|
R(() => {
|
|
349
|
-
l && d.data && d.hasNextPage && d.data.pages.length <
|
|
358
|
+
l && d.data && d.hasNextPage && d.data.pages.length < tt && !d.isFetchingNextPage && d.fetchNextPage();
|
|
350
359
|
}, [l, d]);
|
|
351
|
-
const u =
|
|
360
|
+
const u = L(() => {
|
|
352
361
|
if (!d.data?.pages)
|
|
353
362
|
return {};
|
|
354
|
-
const i =
|
|
363
|
+
const i = Tn(
|
|
355
364
|
n,
|
|
356
365
|
d.data.pages.flatMap((f) => f.data)
|
|
357
366
|
);
|
|
358
367
|
return n.forEach((f) => {
|
|
359
|
-
|
|
368
|
+
gn(f.blockchain) && !(f.assetId in i) && (i[f.assetId] = "0");
|
|
360
369
|
}), i;
|
|
361
370
|
}, [d.data, n]);
|
|
362
371
|
return R(() => {
|
|
363
|
-
|
|
372
|
+
x(s, ["initial_wallet"]) && (c(e, u), s.sourceToken && Object.keys(u).includes(s.sourceToken.assetId) && T("tokenSetBalance", u[s.sourceToken.assetId]));
|
|
364
373
|
}, [u]), {
|
|
365
374
|
status: d.status,
|
|
366
375
|
refetch: d.refetch,
|
|
367
376
|
balances: u
|
|
368
377
|
};
|
|
369
|
-
},
|
|
370
|
-
const { intentsAccountType: e } =
|
|
378
|
+
}, fe = () => {
|
|
379
|
+
const { intentsAccountType: e } = b(), {
|
|
371
380
|
ctx: { walletAddress: t }
|
|
372
|
-
} = _(), { tokens: r } =
|
|
381
|
+
} = _(), { tokens: r } = M(), s = r.filter((l) => l.isIntent).map((l) => l.assetId), n = ne({
|
|
373
382
|
walletAddress: t,
|
|
374
383
|
addressType: e
|
|
375
|
-
}), a =
|
|
384
|
+
}), a = Ee({
|
|
376
385
|
enabled: !!t && !!n && r.length > 0,
|
|
377
386
|
queryKey: ["intentsBalances", n],
|
|
378
|
-
queryFn: async () => n ? await
|
|
379
|
-
}), c =
|
|
387
|
+
queryFn: async () => n ? await wn(n, s) : {}
|
|
388
|
+
}), c = L(() => {
|
|
380
389
|
switch (a.status) {
|
|
381
390
|
case "error":
|
|
382
|
-
return
|
|
391
|
+
return E.error("Unable to load intents balances:", a.error), {};
|
|
383
392
|
case "success":
|
|
384
393
|
return Object.fromEntries(
|
|
385
394
|
Object.entries(a.data).map(([l, d]) => [
|
|
@@ -390,47 +399,47 @@ const $s = (e) => {
|
|
|
390
399
|
case "pending":
|
|
391
400
|
return {};
|
|
392
401
|
default:
|
|
393
|
-
return
|
|
402
|
+
return De(a, { throwError: !1 }), {};
|
|
394
403
|
}
|
|
395
404
|
}, [a]) ?? {};
|
|
396
405
|
return {
|
|
397
406
|
...a,
|
|
398
407
|
intentBalances: c
|
|
399
408
|
};
|
|
400
|
-
},
|
|
409
|
+
}, dr = ({
|
|
401
410
|
isEnabled: e,
|
|
402
411
|
alchemyApiKey: t
|
|
403
412
|
}) => {
|
|
404
|
-
const { connectedWallets: r } =
|
|
413
|
+
const { connectedWallets: r } = b(), { ctx: s } = _(), n = Zt(), { refetch: a } = fe(), { refetch: c } = vt({
|
|
405
414
|
isEnabled: e,
|
|
406
415
|
connectedWallets: r,
|
|
407
416
|
alchemyApiKey: t ?? ""
|
|
408
417
|
});
|
|
409
418
|
R(() => {
|
|
410
|
-
const l =
|
|
419
|
+
const l = x(s, ["transfer_success"]);
|
|
411
420
|
!e || !l || (async () => (await a(), t && (await new Promise((d) => {
|
|
412
421
|
setTimeout(d, 1e4);
|
|
413
422
|
}), await c()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
|
|
414
423
|
}, [s.state, e, t]);
|
|
415
|
-
},
|
|
416
|
-
const { connectedWallets: e } =
|
|
417
|
-
return { mergedBalance:
|
|
424
|
+
}, pe = () => {
|
|
425
|
+
const { connectedWallets: e } = b(), { intentBalances: t } = fe(), { walletBalance: r } = Ce(e);
|
|
426
|
+
return { mergedBalance: L(
|
|
418
427
|
() => ({ ...r, ...t }),
|
|
419
428
|
[r, t]
|
|
420
429
|
) };
|
|
421
|
-
},
|
|
422
|
-
const { ctx: t } = _(), { mergedBalance: r } =
|
|
430
|
+
}, ur = ({ isEnabled: e }) => {
|
|
431
|
+
const { ctx: t } = _(), { mergedBalance: r } = pe();
|
|
423
432
|
R(() => {
|
|
424
433
|
if (!e)
|
|
425
434
|
return;
|
|
426
435
|
if (!t.sourceToken || !t.walletAddress) {
|
|
427
|
-
|
|
436
|
+
T("tokenSetBalance", void 0);
|
|
428
437
|
return;
|
|
429
438
|
}
|
|
430
|
-
const s =
|
|
431
|
-
|
|
439
|
+
const s = z(t.sourceToken);
|
|
440
|
+
T("tokenSetBalance", r[s]);
|
|
432
441
|
}, [r, t.sourceToken]);
|
|
433
|
-
},
|
|
442
|
+
}, nt = {
|
|
434
443
|
// cbBTC (eth)
|
|
435
444
|
"nep141:eth-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near": "nep141:nbtc.bridge.near",
|
|
436
445
|
// cbBTC (base)
|
|
@@ -445,23 +454,23 @@ const $s = (e) => {
|
|
|
445
454
|
"nep245:v2_1.omni.hot.tg:56_SZzgw3HSudhZcTwPWUTi2RJB19t": "nep141:wrap.near",
|
|
446
455
|
// BTC (near)
|
|
447
456
|
"nep141:btc.omft.near": "nep141:nbtc.bridge.near"
|
|
448
|
-
},
|
|
457
|
+
}, mr = ({
|
|
449
458
|
isEnabled: e
|
|
450
459
|
}) => {
|
|
451
|
-
const { ctx: t } = _(), { tokens: r } =
|
|
460
|
+
const { ctx: t } = _(), { tokens: r } = M();
|
|
452
461
|
R(() => {
|
|
453
462
|
if (!e)
|
|
454
463
|
return;
|
|
455
464
|
if (!t.sourceToken) {
|
|
456
|
-
|
|
465
|
+
T("tokenSelect", { variant: "target", token: void 0 });
|
|
457
466
|
return;
|
|
458
467
|
}
|
|
459
468
|
const { sourceToken: s } = t;
|
|
460
|
-
if (t.sourceToken.assetId in
|
|
469
|
+
if (t.sourceToken.assetId in nt) {
|
|
461
470
|
const l = r.find(
|
|
462
|
-
(d) => d.isIntent && d.assetId ===
|
|
471
|
+
(d) => d.isIntent && d.assetId === nt[s.assetId]
|
|
463
472
|
);
|
|
464
|
-
|
|
473
|
+
T("tokenSelect", {
|
|
465
474
|
variant: "target",
|
|
466
475
|
token: l
|
|
467
476
|
});
|
|
@@ -471,7 +480,7 @@ const $s = (e) => {
|
|
|
471
480
|
(l) => l.isIntent && l.symbol === s.symbol && l.blockchain === "near"
|
|
472
481
|
);
|
|
473
482
|
if (n) {
|
|
474
|
-
|
|
483
|
+
T("tokenSelect", { variant: "target", token: n });
|
|
475
484
|
return;
|
|
476
485
|
}
|
|
477
486
|
const a = r.find(
|
|
@@ -479,25 +488,25 @@ const $s = (e) => {
|
|
|
479
488
|
), c = r.find(
|
|
480
489
|
(l) => l.isIntent && l.symbol === "USDC" && l.blockchain === "near"
|
|
481
490
|
);
|
|
482
|
-
|
|
491
|
+
T("tokenSelect", {
|
|
483
492
|
variant: "target",
|
|
484
493
|
token: a ?? c
|
|
485
494
|
});
|
|
486
495
|
}, [r, t.sourceToken]);
|
|
487
|
-
},
|
|
488
|
-
const { connectedWallets: t } =
|
|
496
|
+
}, fr = ({ isEnabled: e }) => {
|
|
497
|
+
const { connectedWallets: t } = b(), { ctx: r, state: s } = _(), { walletAddress: n } = ut(
|
|
489
498
|
t,
|
|
490
499
|
r.sourceToken
|
|
491
500
|
);
|
|
492
501
|
R(() => {
|
|
493
502
|
if (!e)
|
|
494
503
|
return;
|
|
495
|
-
|
|
504
|
+
T("walletAddressSet", n), x(r, ["initial_dry", "initial_wallet"]) && (s === "initial_wallet" && !n ? F("initial_dry") : s === "initial_dry" && n && F("initial_wallet"));
|
|
496
505
|
}, [e, n, r, s]);
|
|
497
|
-
},
|
|
506
|
+
}, pr = (e) => (["depositAddress"].forEach((t) => {
|
|
498
507
|
if (!(t in e))
|
|
499
|
-
return
|
|
500
|
-
}), !0),
|
|
508
|
+
return E.error(`Missing ${t} in quote response`), !1;
|
|
509
|
+
}), !0), Tr = () => {
|
|
501
510
|
const { ctx: e } = _(), {
|
|
502
511
|
walletSupportedChains: t,
|
|
503
512
|
intentsAccountType: r,
|
|
@@ -505,144 +514,144 @@ const $s = (e) => {
|
|
|
505
514
|
appFees: n,
|
|
506
515
|
fetchQuote: a,
|
|
507
516
|
slippageTolerance: c
|
|
508
|
-
} =
|
|
517
|
+
} = b(), l = ve(e), d = X(null), u = X(new AbortController()), i = L(() => async (p, I) => {
|
|
509
518
|
const { signal: m } = u.current;
|
|
510
|
-
return a ? a(
|
|
519
|
+
return a ? a(p, {
|
|
511
520
|
...I,
|
|
512
521
|
signal: m
|
|
513
|
-
}) : (await
|
|
522
|
+
}) : (await Se.post(
|
|
514
523
|
"https://1click.chaindefuser.com/v0/quote",
|
|
515
|
-
|
|
524
|
+
p,
|
|
516
525
|
{ signal: m }
|
|
517
526
|
)).data.quote;
|
|
518
|
-
}, [
|
|
527
|
+
}, [Se]);
|
|
519
528
|
return {
|
|
520
529
|
make: async ({
|
|
521
|
-
message:
|
|
530
|
+
message: p,
|
|
522
531
|
quoteType: I = "exact_in",
|
|
523
532
|
options: m = {}
|
|
524
533
|
} = {}) => {
|
|
525
|
-
if (!
|
|
534
|
+
if (!x(e, [
|
|
526
535
|
"input_valid_dry",
|
|
527
536
|
"input_valid_external",
|
|
528
537
|
"input_valid_internal",
|
|
529
538
|
"quote_success_internal",
|
|
530
539
|
"quote_success_external"
|
|
531
540
|
])) {
|
|
532
|
-
const
|
|
533
|
-
throw
|
|
541
|
+
const S = `Unable to run quote in current state ${e.state}`;
|
|
542
|
+
throw E.error(`[WIDGET] ${S}`), new U({
|
|
534
543
|
code: "QUOTE_INVALID_INITIAL",
|
|
535
|
-
meta: { isDry: l, message:
|
|
544
|
+
meta: { isDry: l, message: S }
|
|
536
545
|
});
|
|
537
546
|
}
|
|
538
|
-
const
|
|
547
|
+
const k = ne({
|
|
539
548
|
addressType: r,
|
|
540
549
|
walletAddress: l ? (
|
|
541
550
|
// address on the target chain should be a dry quote recipient
|
|
542
|
-
|
|
551
|
+
He(e.targetToken.blockchain)
|
|
543
552
|
) : e.walletAddress ?? ""
|
|
544
|
-
}),
|
|
553
|
+
}), y = k && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), q = () => l ? He(
|
|
545
554
|
e.sourceToken.blockchain,
|
|
546
555
|
e.sourceToken.isIntent
|
|
547
|
-
) :
|
|
548
|
-
if (!
|
|
549
|
-
const
|
|
550
|
-
throw
|
|
556
|
+
) : y ? k : e.walletAddress ?? "";
|
|
557
|
+
if (!k) {
|
|
558
|
+
const S = "No corresponding intents account to run a quote";
|
|
559
|
+
throw E.error(`[WIDGET] ${S}`), new U({
|
|
551
560
|
code: "QUOTE_INVALID_INITIAL",
|
|
552
|
-
meta: { isDry: l, message:
|
|
561
|
+
meta: { isDry: l, message: S }
|
|
553
562
|
});
|
|
554
563
|
}
|
|
555
564
|
d.current && (u.current.abort("Abort previous quote (auto)"), u.current = new AbortController());
|
|
556
|
-
let
|
|
557
|
-
const
|
|
565
|
+
let D;
|
|
566
|
+
const B = {
|
|
558
567
|
// Settings
|
|
559
568
|
dry: l,
|
|
560
569
|
slippageTolerance: c,
|
|
561
570
|
deadline: new Date(Date.now() + 3600 * 1e3).toISOString(),
|
|
562
571
|
// 1 hour
|
|
563
|
-
swapType: I === "exact_out" ?
|
|
572
|
+
swapType: I === "exact_out" ? W.swapType.EXACT_OUTPUT : W.swapType.EXACT_INPUT,
|
|
564
573
|
// Target
|
|
565
|
-
destinationAsset: e.targetToken.assetId ===
|
|
574
|
+
destinationAsset: e.targetToken.assetId === G ? Ae : e.targetToken.assetId,
|
|
566
575
|
// Source
|
|
567
|
-
originAsset: e.sourceToken.assetId ===
|
|
576
|
+
originAsset: e.sourceToken.assetId === G ? Ae : e.sourceToken.assetId,
|
|
568
577
|
amount: I === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount,
|
|
569
578
|
// Experimental
|
|
570
579
|
quoteWaitingTimeMs: 0
|
|
571
580
|
};
|
|
572
|
-
|
|
581
|
+
p && (B.customRecipientMsg = p), s && (B.referral = ht(s)), n && (B.appFees = [...n]);
|
|
573
582
|
try {
|
|
574
583
|
e.sourceToken.isIntent && e.targetToken.isIntent && (d.current = i(
|
|
575
584
|
{
|
|
576
|
-
...
|
|
577
|
-
recipient:
|
|
578
|
-
recipientType:
|
|
579
|
-
depositType:
|
|
585
|
+
...B,
|
|
586
|
+
recipient: k,
|
|
587
|
+
recipientType: W.recipientType.INTENTS,
|
|
588
|
+
depositType: W.depositType.INTENTS,
|
|
580
589
|
// Refund
|
|
581
|
-
refundTo:
|
|
582
|
-
refundType:
|
|
590
|
+
refundTo: k,
|
|
591
|
+
refundType: W.refundType.INTENTS
|
|
583
592
|
},
|
|
584
593
|
m
|
|
585
|
-
),
|
|
594
|
+
), D = await d.current), d.current = i(
|
|
586
595
|
{
|
|
587
|
-
...
|
|
588
|
-
recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress :
|
|
589
|
-
recipientType: e.targetToken.isIntent ?
|
|
590
|
-
depositType: e.sourceToken.isIntent ?
|
|
596
|
+
...B,
|
|
597
|
+
recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress : k,
|
|
598
|
+
recipientType: e.targetToken.isIntent ? W.recipientType.INTENTS : W.recipientType.DESTINATION_CHAIN,
|
|
599
|
+
depositType: e.sourceToken.isIntent ? W.depositType.INTENTS : W.depositType.ORIGIN_CHAIN,
|
|
591
600
|
// Refund
|
|
592
|
-
refundTo:
|
|
593
|
-
refundType:
|
|
601
|
+
refundTo: q(),
|
|
602
|
+
refundType: y ? W.refundType.INTENTS : W.refundType.ORIGIN_CHAIN
|
|
594
603
|
},
|
|
595
604
|
m
|
|
596
|
-
),
|
|
597
|
-
} catch (
|
|
598
|
-
if (
|
|
605
|
+
), D = await d.current;
|
|
606
|
+
} catch (S) {
|
|
607
|
+
if (S instanceof gt)
|
|
599
608
|
return;
|
|
600
|
-
|
|
601
|
-
let
|
|
602
|
-
if (
|
|
603
|
-
if (
|
|
604
|
-
const
|
|
605
|
-
throw new
|
|
609
|
+
E.error("Quote error: ", S);
|
|
610
|
+
let O = S instanceof Error ? S.message : "";
|
|
611
|
+
if (S instanceof It) {
|
|
612
|
+
if (O = S.response?.data.message || O, O.includes("Amount is too low")) {
|
|
613
|
+
const re = O.match(/\d+/), ae = re ? re[0] : void 0;
|
|
614
|
+
throw new U({
|
|
606
615
|
code: "QUOTE_AMOUNT_IS_TOO_LOW",
|
|
607
616
|
meta: {
|
|
608
|
-
minAmount: (
|
|
617
|
+
minAmount: (ae && Y(ae, e.sourceToken.decimals)) ?? "0"
|
|
609
618
|
}
|
|
610
619
|
});
|
|
611
620
|
}
|
|
612
|
-
throw
|
|
621
|
+
throw O.includes("recipient is not valid") ? new U({
|
|
613
622
|
code: "TOKEN_IS_NOT_SUPPORTED"
|
|
614
|
-
}) :
|
|
623
|
+
}) : O.includes("Failed to get a deposit address") ? new U({
|
|
615
624
|
code: "QUOTE_NO_ONE_TIME_ADDRESS"
|
|
616
|
-
}) :
|
|
625
|
+
}) : S;
|
|
617
626
|
}
|
|
618
|
-
throw new
|
|
627
|
+
throw new U({
|
|
619
628
|
code: "QUOTE_FAILED",
|
|
620
629
|
meta: {
|
|
621
|
-
message:
|
|
630
|
+
message: O || "Failed to fetch quote. Please try again."
|
|
622
631
|
}
|
|
623
632
|
});
|
|
624
633
|
}
|
|
625
634
|
return l ? {
|
|
626
635
|
dry: !0,
|
|
627
|
-
...
|
|
636
|
+
...D,
|
|
628
637
|
deadline: void 0,
|
|
629
638
|
depositAddress: void 0
|
|
630
|
-
} : (
|
|
639
|
+
} : (pr(D), {
|
|
631
640
|
dry: !1,
|
|
632
|
-
...
|
|
633
|
-
deadline:
|
|
634
|
-
depositAddress:
|
|
641
|
+
...D,
|
|
642
|
+
deadline: D.deadline,
|
|
643
|
+
depositAddress: D.depositAddress
|
|
635
644
|
});
|
|
636
645
|
},
|
|
637
646
|
cancel: () => {
|
|
638
647
|
u.current.abort("Abort quote manually"), u.current = new AbortController();
|
|
639
648
|
}
|
|
640
649
|
};
|
|
641
|
-
},
|
|
642
|
-
const { ctx: e } = _(), { intentsAccountType: t } =
|
|
650
|
+
}, hr = () => {
|
|
651
|
+
const { ctx: e } = _(), { intentsAccountType: t } = b(), { isNativeNearDeposit: r } = Z(), s = ne({
|
|
643
652
|
addressType: t,
|
|
644
653
|
walletAddress: e.walletAddress ?? ""
|
|
645
|
-
}), n =
|
|
654
|
+
}), n = X(null), a = X(new AbortController()), c = L(() => async (d) => wt.post(
|
|
646
655
|
"",
|
|
647
656
|
{
|
|
648
657
|
id: 1,
|
|
@@ -658,10 +667,10 @@ const $s = (e) => {
|
|
|
658
667
|
{
|
|
659
668
|
signal: a.current.signal
|
|
660
669
|
}
|
|
661
|
-
), [
|
|
670
|
+
), [Se]);
|
|
662
671
|
return {
|
|
663
672
|
make: async () => {
|
|
664
|
-
if (!
|
|
673
|
+
if (!x(e, [
|
|
665
674
|
"input_valid_dry",
|
|
666
675
|
"input_valid_external",
|
|
667
676
|
"input_valid_internal",
|
|
@@ -669,13 +678,13 @@ const $s = (e) => {
|
|
|
669
678
|
"quote_success_external"
|
|
670
679
|
])) {
|
|
671
680
|
const i = `Unable to run quote in current state ${e.state}`;
|
|
672
|
-
throw
|
|
681
|
+
throw E.error(`[WIDGET] ${i}`), new U({
|
|
673
682
|
code: "QUOTE_INVALID_INITIAL",
|
|
674
683
|
meta: { isDry: !1, message: i }
|
|
675
684
|
});
|
|
676
685
|
}
|
|
677
686
|
if (r && !e.isDepositFromExternalWallet || !r && e.sourceToken.assetId !== e.targetToken.assetId)
|
|
678
|
-
throw new
|
|
687
|
+
throw new U({
|
|
679
688
|
code: "QUOTE_INVALID_INITIAL",
|
|
680
689
|
meta: {
|
|
681
690
|
isDry: !1,
|
|
@@ -683,7 +692,7 @@ const $s = (e) => {
|
|
|
683
692
|
}
|
|
684
693
|
});
|
|
685
694
|
if (e.sourceToken.isIntent)
|
|
686
|
-
throw new
|
|
695
|
+
throw new U({
|
|
687
696
|
code: "QUOTE_INVALID_INITIAL",
|
|
688
697
|
meta: {
|
|
689
698
|
isDry: !1,
|
|
@@ -691,7 +700,7 @@ const $s = (e) => {
|
|
|
691
700
|
}
|
|
692
701
|
});
|
|
693
702
|
if (!e.isDepositFromExternalWallet && e.sourceToken.blockchain === "near")
|
|
694
|
-
throw new
|
|
703
|
+
throw new U({
|
|
695
704
|
code: "QUOTE_INVALID_INITIAL",
|
|
696
705
|
meta: {
|
|
697
706
|
isDry: !1,
|
|
@@ -700,18 +709,18 @@ const $s = (e) => {
|
|
|
700
709
|
});
|
|
701
710
|
if (!s) {
|
|
702
711
|
const i = "No corresponding intents account to run a quote";
|
|
703
|
-
throw
|
|
712
|
+
throw E.error(`[WIDGET] ${i}`), new U({
|
|
704
713
|
code: "QUOTE_INVALID_INITIAL",
|
|
705
714
|
meta: { isDry: !1, message: i }
|
|
706
715
|
});
|
|
707
716
|
}
|
|
708
717
|
n.current && (a.current.abort("Abort previous quote (auto)"), a.current = new AbortController());
|
|
709
|
-
let u =
|
|
718
|
+
let u = pt[e.targetToken.blockchain];
|
|
710
719
|
if (!u)
|
|
711
|
-
if (
|
|
712
|
-
u =
|
|
720
|
+
if (H(e.targetToken.blockchain))
|
|
721
|
+
u = Tt;
|
|
713
722
|
else
|
|
714
|
-
throw new
|
|
723
|
+
throw new U({
|
|
715
724
|
code: "QUOTE_INVALID_INITIAL",
|
|
716
725
|
meta: { isDry: !1, message: "Chain is not supported by POA" }
|
|
717
726
|
});
|
|
@@ -724,12 +733,12 @@ const $s = (e) => {
|
|
|
724
733
|
amountIn: e.sourceTokenAmount,
|
|
725
734
|
amountOut: e.targetTokenAmount,
|
|
726
735
|
amountInUsd: `${parseFloat(
|
|
727
|
-
|
|
736
|
+
Y(e.sourceTokenAmount, e.sourceToken.decimals)
|
|
728
737
|
) * e.sourceToken.price}`,
|
|
729
738
|
amountOutUsd: `${parseFloat(
|
|
730
|
-
|
|
739
|
+
Y(e.targetTokenAmount, e.targetToken.decimals)
|
|
731
740
|
) * e.targetToken.price}`,
|
|
732
|
-
amountOutFormatted:
|
|
741
|
+
amountOutFormatted: Y(
|
|
733
742
|
e.targetTokenAmount,
|
|
734
743
|
e.targetToken.decimals
|
|
735
744
|
),
|
|
@@ -739,11 +748,11 @@ const $s = (e) => {
|
|
|
739
748
|
dry: !1
|
|
740
749
|
};
|
|
741
750
|
} catch (i) {
|
|
742
|
-
if (i instanceof
|
|
751
|
+
if (i instanceof gt)
|
|
743
752
|
return;
|
|
744
|
-
if (
|
|
753
|
+
if (E.error(i), i instanceof It) {
|
|
745
754
|
const f = i.response?.data.message || i.message;
|
|
746
|
-
throw new
|
|
755
|
+
throw new U({
|
|
747
756
|
code: "QUOTE_FAILED",
|
|
748
757
|
meta: {
|
|
749
758
|
message: f ?? "Failed to fetch quote. Please try again."
|
|
@@ -756,60 +765,60 @@ const $s = (e) => {
|
|
|
756
765
|
a.current.abort("Abort quote manually"), a.current = new AbortController();
|
|
757
766
|
}
|
|
758
767
|
};
|
|
759
|
-
},
|
|
760
|
-
|
|
761
|
-
},
|
|
768
|
+
}, st = (e) => {
|
|
769
|
+
T("errorSet", e), T("quoteSet", void 0), T("quoteSetStatus", "idle"), T("transferSetStatus", { status: "idle" });
|
|
770
|
+
}, rt = async (e) => {
|
|
762
771
|
if (!e.sendAddress)
|
|
763
772
|
return;
|
|
764
773
|
let t = !1;
|
|
765
774
|
try {
|
|
766
|
-
|
|
775
|
+
T("setInputsValidating", !0), t = await An(e.sendAddress);
|
|
767
776
|
} catch {
|
|
768
|
-
|
|
777
|
+
st({
|
|
769
778
|
code: "SEND_ADDRESS_IS_NOT_VERIFIED",
|
|
770
779
|
meta: { address: e.sendAddress, chain: "near" }
|
|
771
|
-
}),
|
|
780
|
+
}), T("setInputsValidating", !1), F("initial_wallet");
|
|
772
781
|
return;
|
|
773
782
|
}
|
|
774
|
-
if (
|
|
775
|
-
|
|
783
|
+
if (T("setInputsValidating", !1), !t) {
|
|
784
|
+
st({
|
|
776
785
|
code: "SEND_ADDRESS_IS_NOT_FOUND",
|
|
777
786
|
meta: { address: e.sendAddress, chain: "near" }
|
|
778
|
-
}),
|
|
787
|
+
}), F("initial_wallet");
|
|
779
788
|
return;
|
|
780
789
|
}
|
|
781
|
-
e.error ?
|
|
782
|
-
},
|
|
783
|
-
const t =
|
|
790
|
+
e.error ? Sn(e.error) && (T("errorSet", null), F("input_valid_external")) : F("input_valid_external");
|
|
791
|
+
}, xt = (e) => {
|
|
792
|
+
const t = x(e, ["initial_dry"]), r = x(e, ["input_valid_dry"]);
|
|
784
793
|
if (!t && !r)
|
|
785
794
|
return;
|
|
786
795
|
let s;
|
|
787
|
-
return t && (e.sourceToken ? e.targetToken ?
|
|
788
|
-
},
|
|
789
|
-
const t =
|
|
796
|
+
return t && (e.sourceToken ? e.targetToken ? se(e.sourceTokenAmount) ? e.walletAddress && !xe(e) && (s = { code: "SOURCE_BALANCE_INSUFFICIENT" }) : s = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : s = { code: "TARGET_TOKEN_IS_EMPTY" } : s = { code: "SOURCE_TOKEN_IS_EMPTY" }), !r && s ? T("errorSet", s) : e.error && !Oe(e.error) && !Fe(e.error) && T("errorSet", null), r && s?.code === "SOURCE_BALANCE_INSUFFICIENT" && T("errorSet", s), r;
|
|
797
|
+
}, Ot = (e) => {
|
|
798
|
+
const t = x(e, ["initial_wallet"]), r = x(e, ["input_valid_external"]);
|
|
790
799
|
if (!t && !r)
|
|
791
800
|
return;
|
|
792
801
|
const s = e.sourceTokenBalance;
|
|
793
802
|
let n;
|
|
794
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } :
|
|
803
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : se(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ? At(e.sendAddress) ? rt(e) : n = {
|
|
795
804
|
code: "SEND_ADDRESS_IS_INVALID",
|
|
796
805
|
meta: { address: e.sendAddress, chain: "near" }
|
|
797
|
-
} : e.isDepositFromExternalWallet || (!s || !
|
|
798
|
-
},
|
|
799
|
-
const t =
|
|
806
|
+
} : e.isDepositFromExternalWallet || (!s || !kt(s) ? n = { code: "INVALID_SOURCE_BALANCE" } : xe(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SEND_ADDRESS_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), r && e.targetToken.blockchain === "near" && rt(e), !r && n ? T("errorSet", n) : e.error && !Oe(e.error) && !Fe(e.error) && T("errorSet", null), r;
|
|
807
|
+
}, Ft = (e) => {
|
|
808
|
+
const t = x(e, ["initial_wallet"]), r = x(e, ["input_valid_internal"]);
|
|
800
809
|
if (!t && !r)
|
|
801
810
|
return;
|
|
802
811
|
const s = e.sourceTokenBalance;
|
|
803
812
|
let n;
|
|
804
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ?
|
|
805
|
-
},
|
|
806
|
-
const t =
|
|
813
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? se(e.sourceTokenAmount) ? e.isDepositFromExternalWallet || (!s || !kt(s) ? n = { code: "INVALID_SOURCE_BALANCE" } : xe(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_NOT_INTENT" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), !r && n ? T("errorSet", n) : e.error && !Oe(e.error) && !Fe(e.error) && T("errorSet", null), r;
|
|
814
|
+
}, Lt = (e) => {
|
|
815
|
+
const t = ve(e), r = !t && e.targetToken?.isIntent === !0, s = !t && e.targetToken?.isIntent === !1;
|
|
807
816
|
if (t) {
|
|
808
|
-
const n =
|
|
809
|
-
return
|
|
817
|
+
const n = xt(e);
|
|
818
|
+
return F(n ? "input_valid_dry" : "initial_dry");
|
|
810
819
|
}
|
|
811
|
-
s &&
|
|
812
|
-
},
|
|
820
|
+
s && Ot(e) ? F("input_valid_external") : r && Ft(e) ? F("input_valid_internal") : F("initial_wallet");
|
|
821
|
+
}, gr = ({
|
|
813
822
|
isEnabled: e,
|
|
814
823
|
message: t,
|
|
815
824
|
type: r = "exact_in",
|
|
@@ -822,76 +831,76 @@ const $s = (e) => {
|
|
|
822
831
|
isDirectNearTokenWithdrawal: d,
|
|
823
832
|
isDirectTokenOnNearTransfer: u,
|
|
824
833
|
isSameAssetDiffChainWithdrawal: i
|
|
825
|
-
} =
|
|
826
|
-
m(),
|
|
834
|
+
} = Z(), f = ve(n), p = e && !n.areInputsValidating && (i || (l || a) && n.isDepositFromExternalWallet || !d && !c && !l && !u), { make: I, cancel: m } = Tr(), { make: w, cancel: k } = hr(), y = X(null), q = () => {
|
|
835
|
+
m(), k();
|
|
827
836
|
};
|
|
828
837
|
R(() => {
|
|
829
|
-
const
|
|
830
|
-
(f && !
|
|
831
|
-
}, [
|
|
832
|
-
const
|
|
833
|
-
async (
|
|
838
|
+
const B = x(n, ["input_valid_dry"]), S = x(n, ["input_valid_external"]), O = x(n, ["input_valid_internal"]);
|
|
839
|
+
(f && !B || !f && n.targetToken?.isIntent && !O || !f && !n.targetToken?.isIntent && !S || n.areInputsValidating) && q();
|
|
840
|
+
}, [q, f, n]);
|
|
841
|
+
const D = ie(
|
|
842
|
+
async (B) => {
|
|
834
843
|
try {
|
|
835
|
-
let
|
|
844
|
+
let S;
|
|
836
845
|
if (n.sourceToken?.assetId === n.targetToken?.assetId || a && n.isDepositFromExternalWallet) {
|
|
837
846
|
if (f)
|
|
838
847
|
return;
|
|
839
|
-
|
|
848
|
+
T("quoteSetStatus", "pending"), S = await w();
|
|
840
849
|
} else
|
|
841
|
-
|
|
842
|
-
if (!
|
|
850
|
+
T("quoteSetStatus", "pending"), S = await I({ message: t, quoteType: r, options: B });
|
|
851
|
+
if (!S)
|
|
843
852
|
return;
|
|
844
|
-
if (
|
|
853
|
+
if (T("quoteSetStatus", "success"), T("quoteSet", S), !f && n.error?.code !== "SOURCE_BALANCE_INSUFFICIENT" && T("errorSet", null), T("tokenSetAmount", {
|
|
845
854
|
variant: "target",
|
|
846
|
-
amount:
|
|
855
|
+
amount: S.amountOut
|
|
847
856
|
}), n.state === "input_valid_dry") {
|
|
848
|
-
|
|
857
|
+
F("quote_success_dry");
|
|
849
858
|
return;
|
|
850
859
|
}
|
|
851
|
-
n.targetToken?.isIntent ?
|
|
852
|
-
} catch (
|
|
853
|
-
if (
|
|
854
|
-
if (
|
|
855
|
-
|
|
860
|
+
n.targetToken?.isIntent ? F("quote_success_internal") : F("quote_success_external");
|
|
861
|
+
} catch (S) {
|
|
862
|
+
if (S instanceof U) {
|
|
863
|
+
if (S.data.code === "QUOTE_INVALID_INITIAL") {
|
|
864
|
+
T("quoteSetStatus", "idle"), T("quoteSet", void 0), T("errorSet", null);
|
|
856
865
|
return;
|
|
857
866
|
}
|
|
858
|
-
|
|
867
|
+
T("quoteSetStatus", "error"), T("quoteSet", void 0), T("errorSet", S.data), Lt(n);
|
|
859
868
|
return;
|
|
860
869
|
}
|
|
861
|
-
|
|
870
|
+
E.error("Unhandled error in useMakeQuoteEffect:", S), T("quoteSetStatus", "error"), T("quoteSet", void 0), T("errorSet", {
|
|
862
871
|
code: "QUOTE_FAILED",
|
|
863
872
|
meta: { message: "Unknown error" }
|
|
864
873
|
});
|
|
865
874
|
}
|
|
866
875
|
},
|
|
867
|
-
[n, f, w, I, t, r,
|
|
876
|
+
[n, f, w, I, t, r, p]
|
|
868
877
|
);
|
|
869
878
|
R(() => {
|
|
870
|
-
!
|
|
871
|
-
}, [
|
|
872
|
-
const
|
|
873
|
-
|
|
879
|
+
!p || !(f ? n.state === "input_valid_dry" : n.state === "input_valid_external" && !n.targetToken?.isIntent || n.state === "input_valid_internal" && n.targetToken?.isIntent) || n.quoteStatus !== "error" && (a && !n.isDepositFromExternalWallet || D({ isRefetch: !1 }));
|
|
880
|
+
}, [p, D, q, n.sourceToken, n.targetToken]), R(() => {
|
|
881
|
+
const B = () => {
|
|
882
|
+
y.current && (clearInterval(y.current), y.current = null);
|
|
874
883
|
};
|
|
875
|
-
return n.state !== "quote_success_internal" && n.state !== "quote_success_external" || !s || (
|
|
876
|
-
await
|
|
877
|
-
}, s)),
|
|
878
|
-
}, [
|
|
879
|
-
},
|
|
884
|
+
return n.state !== "quote_success_internal" && n.state !== "quote_success_external" || !s || (y.current = setInterval(async () => {
|
|
885
|
+
await D({ isRefetch: !0 });
|
|
886
|
+
}, s)), B;
|
|
887
|
+
}, [p, D, q, n.state]);
|
|
888
|
+
}, ge = {
|
|
880
889
|
sol: "sol",
|
|
881
890
|
evm: "eth",
|
|
882
891
|
near: "near"
|
|
883
|
-
},
|
|
892
|
+
}, Ir = ({
|
|
884
893
|
isEnabled: e,
|
|
885
894
|
skipIntents: t = !1,
|
|
886
895
|
target: r = "none"
|
|
887
896
|
}) => {
|
|
888
|
-
const { tokens: s } =
|
|
897
|
+
const { tokens: s } = M(), { ctx: n, state: a } = _(), { intentBalances: c } = fe(), { walletSupportedChains: l, chainsFilter: d, intentsAccountType: u } = b(), i = yn({
|
|
889
898
|
tokens: s,
|
|
890
899
|
walletSupportedChains: l,
|
|
891
900
|
balances: c,
|
|
892
901
|
across: "intents"
|
|
893
|
-
}), [f,
|
|
894
|
-
{ token:
|
|
902
|
+
}), [f, p] = L(() => !n.walletAddress && !t ? [
|
|
903
|
+
{ token: _n({ tokens: s }), status: "loaded" },
|
|
895
904
|
{ token: void 0, status: "loaded" }
|
|
896
905
|
] : d.source.intents !== "none" && !t ? i ? [
|
|
897
906
|
{ token: i, status: "loaded" },
|
|
@@ -900,7 +909,7 @@ const $s = (e) => {
|
|
|
900
909
|
{ token: void 0, status: "loading" },
|
|
901
910
|
{ token: void 0, status: "loading" }
|
|
902
911
|
] : [
|
|
903
|
-
{ token:
|
|
912
|
+
{ token: Nn({
|
|
904
913
|
tokens: s,
|
|
905
914
|
walletSupportedChains: l
|
|
906
915
|
}), status: "loaded" },
|
|
@@ -917,11 +926,11 @@ const $s = (e) => {
|
|
|
917
926
|
R(() => {
|
|
918
927
|
if (!e)
|
|
919
928
|
return;
|
|
920
|
-
if (
|
|
929
|
+
if (x(n, ["initial_dry", "initial_wallet"]) && (f.status === "loaded" && !n.sourceToken && T("tokenSelect", {
|
|
921
930
|
variant: "source",
|
|
922
931
|
token: f.token
|
|
923
|
-
}),
|
|
924
|
-
let w =
|
|
932
|
+
}), p.status === "loaded" && f.status === "loaded" && !n.targetToken)) {
|
|
933
|
+
let w = p.token;
|
|
925
934
|
if (r === "same-asset")
|
|
926
935
|
if (f.token?.isIntent) {
|
|
927
936
|
if (!u)
|
|
@@ -929,93 +938,93 @@ const $s = (e) => {
|
|
|
929
938
|
"Intents account type is required to select same-asset target token"
|
|
930
939
|
);
|
|
931
940
|
w = s.find(
|
|
932
|
-
(
|
|
941
|
+
(k) => !k.isIntent && k.symbol === n.sourceToken?.symbol && k.blockchain === ge[u]
|
|
933
942
|
);
|
|
934
943
|
} else
|
|
935
944
|
w = s.find(
|
|
936
|
-
(
|
|
945
|
+
(k) => k.isIntent && k.symbol === n.sourceToken?.symbol
|
|
937
946
|
);
|
|
938
|
-
|
|
947
|
+
T("tokenSelect", {
|
|
939
948
|
variant: "target",
|
|
940
949
|
token: w
|
|
941
950
|
});
|
|
942
951
|
}
|
|
943
|
-
}, [n, f,
|
|
952
|
+
}, [n, f, p, e]);
|
|
944
953
|
const I = (m, w) => {
|
|
945
|
-
const
|
|
946
|
-
(
|
|
954
|
+
const k = s.find(
|
|
955
|
+
(y) => !y.isIntent && y.blockchain === ge[m] && y.symbol.toLowerCase() === ln[ge[m]]?.toLowerCase()
|
|
947
956
|
) ?? w;
|
|
948
|
-
|
|
957
|
+
T("tokenSelect", {
|
|
949
958
|
variant: "source",
|
|
950
|
-
token:
|
|
959
|
+
token: k
|
|
951
960
|
});
|
|
952
961
|
};
|
|
953
962
|
return R(() => {
|
|
954
|
-
const m =
|
|
963
|
+
const m = x(n, ["initial_dry", "initial_wallet"]);
|
|
955
964
|
if (!e || !m)
|
|
956
965
|
return;
|
|
957
966
|
const w = s.find(
|
|
958
|
-
(
|
|
959
|
-
),
|
|
960
|
-
f.token || (!t && i ?
|
|
967
|
+
(y) => y.isIntent && y.symbol === "AURORA" && y.blockchain === "near"
|
|
968
|
+
), k = setTimeout(() => {
|
|
969
|
+
f.token || (!t && i ? T("tokenSelect", {
|
|
961
970
|
variant: "source",
|
|
962
971
|
token: i
|
|
963
|
-
}) : l.length && u ? I(u, w) : n.walletAddress &&
|
|
972
|
+
}) : l.length && u ? I(u, w) : n.walletAddress && St(n.walletAddress) ? I("sol", w) : n.walletAddress && Nt(n.walletAddress) ? I("evm", w) : n.walletAddress && At(n.walletAddress) ? I("near", w) : T("tokenSelect", {
|
|
964
973
|
variant: "source",
|
|
965
974
|
token: w
|
|
966
975
|
}));
|
|
967
976
|
}, 3e3);
|
|
968
|
-
return () => clearTimeout(
|
|
977
|
+
return () => clearTimeout(k);
|
|
969
978
|
}, [s, f, t]), { source: n.sourceToken, target: n.targetToken };
|
|
970
|
-
},
|
|
979
|
+
}, wr = ({
|
|
971
980
|
isEnabled: e,
|
|
972
981
|
alchemyApiKey: t
|
|
973
982
|
}) => {
|
|
974
|
-
const { connectedWallets: r } =
|
|
975
|
-
|
|
983
|
+
const { connectedWallets: r } = b();
|
|
984
|
+
vt({
|
|
976
985
|
isEnabled: e,
|
|
977
986
|
connectedWallets: r,
|
|
978
987
|
alchemyApiKey: t ?? ""
|
|
979
988
|
});
|
|
980
|
-
},
|
|
981
|
-
const { config: r } =
|
|
989
|
+
}, kr = (e, t) => {
|
|
990
|
+
const { config: r } = be(We);
|
|
982
991
|
return e.targetToken && !e.sendAddress && !!e.walletAddress && !e.targetToken.isIntent && !t.find((s) => s?.key === "sendAddress") && r.walletSupportedChains.includes(e.targetToken.blockchain);
|
|
983
|
-
},
|
|
984
|
-
|
|
992
|
+
}, Ar = ({ debug: e }) => {
|
|
993
|
+
J.onContextChange((t, r) => {
|
|
985
994
|
const s = r;
|
|
986
|
-
if (e &&
|
|
995
|
+
if (e && E.debug("[WIDGET] Context changed", s), e && t.error && Rn(s) && E.debug(`[WIDGET] Error set to ${t.error.code}`), Cn(s) || On(t, s, e))
|
|
987
996
|
return;
|
|
988
|
-
if (
|
|
989
|
-
|
|
997
|
+
if (vn(t, s)) {
|
|
998
|
+
T("reset", { clearWalletAddress: !0 }), F("initial_dry");
|
|
990
999
|
return;
|
|
991
1000
|
}
|
|
992
|
-
const { isChanged: n, isDry: a } =
|
|
1001
|
+
const { isChanged: n, isDry: a } = En(t, s);
|
|
993
1002
|
if (n) {
|
|
994
|
-
if (
|
|
1003
|
+
if (Dn(t)) {
|
|
995
1004
|
const c = a ? "initial_dry" : "initial_wallet";
|
|
996
|
-
|
|
1005
|
+
F(c, {
|
|
997
1006
|
onMoved: () => {
|
|
998
|
-
e &&
|
|
1007
|
+
e && E.debug(
|
|
999
1008
|
`[WIDGET] Inputs changed. State moved to ${c}`
|
|
1000
1009
|
);
|
|
1001
1010
|
}
|
|
1002
1011
|
});
|
|
1003
1012
|
}
|
|
1004
|
-
|
|
1013
|
+
bn(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), xn(t) && (t.sendAddress = void 0), kr(t, s) && (t.sendAddress = t.walletAddress), Lt(t);
|
|
1005
1014
|
}
|
|
1006
1015
|
});
|
|
1007
|
-
},
|
|
1008
|
-
|
|
1009
|
-
e &&
|
|
1016
|
+
}, Sr = ({ debug: e }) => {
|
|
1017
|
+
J.onTransition((t, r) => {
|
|
1018
|
+
e && E.debug(`===> [WIDGET] State moved from ${t} to ${r}`);
|
|
1010
1019
|
});
|
|
1011
|
-
},
|
|
1012
|
-
const { variant: r, token: s } = t, { config: n } =
|
|
1020
|
+
}, Nr = (e, t) => {
|
|
1021
|
+
const { variant: r, token: s } = t, { config: n } = be(We);
|
|
1013
1022
|
switch (r) {
|
|
1014
1023
|
case "source":
|
|
1015
1024
|
if (s && s.assetId === e.targetToken?.assetId && s.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching) {
|
|
1016
1025
|
if (!e.sourceToken)
|
|
1017
1026
|
return;
|
|
1018
|
-
|
|
1027
|
+
Ne(e);
|
|
1019
1028
|
return;
|
|
1020
1029
|
}
|
|
1021
1030
|
if (s && !e.sourceToken && s.assetId === e.targetToken?.assetId && s.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching)
|
|
@@ -1026,26 +1035,26 @@ const $s = (e) => {
|
|
|
1026
1035
|
if (s && s.assetId === e.sourceToken?.assetId && s.isIntent === e.sourceToken.isIntent && n.enableAutoTokensSwitching) {
|
|
1027
1036
|
if (!e.targetToken)
|
|
1028
1037
|
return;
|
|
1029
|
-
|
|
1038
|
+
Ne(e);
|
|
1030
1039
|
return;
|
|
1031
1040
|
}
|
|
1032
1041
|
e.targetToken = s;
|
|
1033
1042
|
break;
|
|
1034
1043
|
default:
|
|
1035
|
-
|
|
1044
|
+
De(r, { throwError: !1 });
|
|
1036
1045
|
}
|
|
1037
|
-
},
|
|
1046
|
+
}, v = (e, t) => J.on(
|
|
1038
1047
|
e,
|
|
1039
|
-
(r, s) => t(r, s,
|
|
1040
|
-
),
|
|
1041
|
-
|
|
1042
|
-
},
|
|
1043
|
-
e &&
|
|
1044
|
-
"[WIDGET] Debug mode is enabled (package version: 3.17.
|
|
1045
|
-
),
|
|
1046
|
-
}),
|
|
1048
|
+
(r, s) => t(r, s, J)
|
|
1049
|
+
), _r = () => {
|
|
1050
|
+
v("quoteSetStatus", Pn), v("walletAddressSet", Qn), v("transferSetStatus", Kn), v("tokenSelectRotate", Ne), v("tokenSetBalance", $n), v("tokenSetAmount", Un), v("depositTypeSet", Wn), v("setInputsValidating", Vn), v("externalDepositTxSet", Mn), v("tokenSelect", Nr), v("addressSet", qn), v("errorSet", Ln), v("quoteSet", Bn), v("reset", Fn), v("validateDryInputs", xt), v("validateExternalInputs", Ot), v("validateInternalInputs", Ft);
|
|
1051
|
+
}, yr = pn(({ debug: e }) => {
|
|
1052
|
+
e && E.debug(
|
|
1053
|
+
"[WIDGET] Debug mode is enabled (package version: 3.17.3)"
|
|
1054
|
+
), _r(), Sr({ debug: e }), Ar({ debug: e });
|
|
1055
|
+
}), dl = ({ listenTo: e, debug: t = !1 }) => {
|
|
1047
1056
|
R(() => {
|
|
1048
|
-
|
|
1057
|
+
yr({ debug: t });
|
|
1049
1058
|
}, [t]);
|
|
1050
1059
|
const r = e.find(
|
|
1051
1060
|
(a) => Array.isArray(a) && a[0] === "setBalancesUsingAlchemyExt"
|
|
@@ -1054,95 +1063,95 @@ const $s = (e) => {
|
|
|
1054
1063
|
), n = e.find(
|
|
1055
1064
|
(a) => Array.isArray(a) && a[0] === "makeQuote"
|
|
1056
1065
|
);
|
|
1057
|
-
|
|
1066
|
+
wr({
|
|
1058
1067
|
isEnabled: !!r,
|
|
1059
1068
|
alchemyApiKey: r?.[1].alchemyApiKey
|
|
1060
|
-
}),
|
|
1069
|
+
}), Ir({
|
|
1061
1070
|
isEnabled: !!s,
|
|
1062
1071
|
skipIntents: s?.[1].skipIntents,
|
|
1063
1072
|
target: s?.[1].target
|
|
1064
|
-
}),
|
|
1073
|
+
}), gr({
|
|
1065
1074
|
isEnabled: !!n,
|
|
1066
1075
|
message: n?.[1].message,
|
|
1067
1076
|
type: n?.[1].type,
|
|
1068
1077
|
refetchQuoteInterval: n?.[1].refetchQuoteInterval
|
|
1069
|
-
}),
|
|
1078
|
+
}), fr({
|
|
1070
1079
|
isEnabled: e.includes("checkWalletConnection")
|
|
1071
|
-
}),
|
|
1080
|
+
}), ur({
|
|
1072
1081
|
isEnabled: e.includes("setSourceTokenBalance")
|
|
1073
|
-
}),
|
|
1082
|
+
}), mr({
|
|
1074
1083
|
isEnabled: e.includes("setSourceTokenIntentsTarget")
|
|
1075
|
-
}),
|
|
1084
|
+
}), dr({
|
|
1076
1085
|
isEnabled: e.includes("updateBalances"),
|
|
1077
1086
|
alchemyApiKey: r?.[1].alchemyApiKey
|
|
1078
1087
|
});
|
|
1079
|
-
},
|
|
1080
|
-
class
|
|
1088
|
+
}, br = J.getStore();
|
|
1089
|
+
class V extends Error {
|
|
1081
1090
|
context;
|
|
1082
1091
|
_is_widget_error = !0;
|
|
1083
1092
|
constructor(t, r) {
|
|
1084
|
-
super(t), this.name = "WidgetError", this.cause = r?.cause, this.context =
|
|
1093
|
+
super(t), this.name = "WidgetError", this.cause = r?.cause, this.context = be(br).context;
|
|
1085
1094
|
}
|
|
1086
1095
|
}
|
|
1087
|
-
class
|
|
1096
|
+
class Bt extends V {
|
|
1088
1097
|
data;
|
|
1089
1098
|
constructor(t) {
|
|
1090
1099
|
super(t.code), this.data = t, this.name = "MachineError";
|
|
1091
1100
|
}
|
|
1092
1101
|
}
|
|
1093
|
-
class
|
|
1102
|
+
class U extends Bt {
|
|
1094
1103
|
constructor(t) {
|
|
1095
1104
|
super(t), this.name = "QuoteError";
|
|
1096
1105
|
}
|
|
1097
1106
|
}
|
|
1098
|
-
class g extends
|
|
1107
|
+
class g extends Bt {
|
|
1099
1108
|
constructor(t) {
|
|
1100
1109
|
super(t), this.name = "TransferError";
|
|
1101
1110
|
}
|
|
1102
1111
|
}
|
|
1103
|
-
const
|
|
1104
|
-
usdTradeDelta: (e) =>
|
|
1105
|
-
isDirectNearTokenWithdrawal: (e) =>
|
|
1106
|
-
isDirectNonNearWithdrawal: (e) =>
|
|
1107
|
-
isDirectTokenOnNearDeposit: (e) =>
|
|
1108
|
-
isNativeNearDeposit: (e) =>
|
|
1109
|
-
isSameAssetDiffChainWithdrawal: (e) =>
|
|
1110
|
-
isDirectTokenOnNearTransfer: (e) =>
|
|
1111
|
-
}),
|
|
1112
|
-
const e =
|
|
1112
|
+
const ul = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e && !!e._is_widget_error, Q = J.getStore(), Er = un({
|
|
1113
|
+
usdTradeDelta: (e) => Hn(e(Q.context)),
|
|
1114
|
+
isDirectNearTokenWithdrawal: (e) => zn(e(Q.context)),
|
|
1115
|
+
isDirectNonNearWithdrawal: (e) => Gn(e(Q.context)),
|
|
1116
|
+
isDirectTokenOnNearDeposit: (e) => fn(e(Q.context)),
|
|
1117
|
+
isNativeNearDeposit: (e) => mn(e(Q.context)),
|
|
1118
|
+
isSameAssetDiffChainWithdrawal: (e) => Yn(e(Q.context)),
|
|
1119
|
+
isDirectTokenOnNearTransfer: (e) => jn(e(Q.context))
|
|
1120
|
+
}), Z = () => ue(Er), _ = () => {
|
|
1121
|
+
const e = ue(Q);
|
|
1113
1122
|
return {
|
|
1114
1123
|
state: e.state,
|
|
1115
1124
|
ctx: e.context
|
|
1116
1125
|
};
|
|
1117
|
-
},
|
|
1118
|
-
const t =
|
|
1119
|
-
if (!
|
|
1120
|
-
throw new
|
|
1126
|
+
}, ml = (e) => {
|
|
1127
|
+
const t = ue(Q);
|
|
1128
|
+
if (!x(t.context, [e]))
|
|
1129
|
+
throw new V(
|
|
1121
1130
|
`[WIDGET] Attempt to access snapshot for ${e} state while context does not match`
|
|
1122
1131
|
);
|
|
1123
1132
|
return t.context;
|
|
1124
|
-
},
|
|
1133
|
+
}, Rr = async ({
|
|
1125
1134
|
contractId: e,
|
|
1126
1135
|
accountId: t
|
|
1127
1136
|
}) => {
|
|
1128
1137
|
try {
|
|
1129
|
-
const r = { account_id: t }, s =
|
|
1138
|
+
const r = { account_id: t }, s = Be.from(JSON.stringify(r)).toString("base64"), n = await Zn.query({
|
|
1130
1139
|
request_type: "call_function",
|
|
1131
1140
|
method_name: "storage_balance_of",
|
|
1132
1141
|
account_id: e,
|
|
1133
1142
|
args_base64: s,
|
|
1134
1143
|
finality: "optimistic"
|
|
1135
|
-
}), a =
|
|
1144
|
+
}), a = Xn(
|
|
1136
1145
|
n,
|
|
1137
|
-
|
|
1146
|
+
oe.union([oe.null(), oe.object({ total: oe.string() })])
|
|
1138
1147
|
);
|
|
1139
1148
|
return BigInt(a?.total ?? "0");
|
|
1140
1149
|
} catch (r) {
|
|
1141
|
-
throw new
|
|
1150
|
+
throw new V("Error fetching balance", { cause: r });
|
|
1142
1151
|
}
|
|
1143
1152
|
};
|
|
1144
|
-
function
|
|
1145
|
-
const { ctx: t } = _(), { isNativeNearDeposit: r } =
|
|
1153
|
+
function Cr(e) {
|
|
1154
|
+
const { ctx: t } = _(), { isNativeNearDeposit: r } = Z(), s = t.sourceToken?.contractAddress, n = t.quote?.amountIn ?? t.sourceTokenAmount;
|
|
1146
1155
|
return {
|
|
1147
1156
|
make: async (c, l) => {
|
|
1148
1157
|
if (!e)
|
|
@@ -1150,7 +1159,7 @@ function dr(e) {
|
|
|
1150
1159
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1151
1160
|
meta: { message: "No connected wallet to sign a transfer." }
|
|
1152
1161
|
});
|
|
1153
|
-
if (!s && t.sourceToken?.assetId !==
|
|
1162
|
+
if (!s && t.sourceToken?.assetId !== G)
|
|
1154
1163
|
throw new g({
|
|
1155
1164
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1156
1165
|
meta: { message: "No token selected to transfer." }
|
|
@@ -1166,7 +1175,7 @@ function dr(e) {
|
|
|
1166
1175
|
meta: { message: "No amount to transfer." }
|
|
1167
1176
|
});
|
|
1168
1177
|
const d = e();
|
|
1169
|
-
if (t.sourceToken.assetId ===
|
|
1178
|
+
if (t.sourceToken.assetId === G && t.targetToken?.assetId !== Ae) {
|
|
1170
1179
|
const i = await d.signAndSendTransactions({
|
|
1171
1180
|
transactions: [
|
|
1172
1181
|
{
|
|
@@ -1201,7 +1210,7 @@ function dr(e) {
|
|
|
1201
1210
|
type: "FunctionCall",
|
|
1202
1211
|
params: {
|
|
1203
1212
|
methodName: "near_deposit",
|
|
1204
|
-
gas:
|
|
1213
|
+
gas: Ge,
|
|
1205
1214
|
deposit: n,
|
|
1206
1215
|
args: {}
|
|
1207
1216
|
}
|
|
@@ -1211,7 +1220,7 @@ function dr(e) {
|
|
|
1211
1220
|
methodName: "ft_transfer_call",
|
|
1212
1221
|
deposit: "1",
|
|
1213
1222
|
// 1 yocto required by NEP-141
|
|
1214
|
-
gas:
|
|
1223
|
+
gas: je,
|
|
1215
1224
|
args: {
|
|
1216
1225
|
amount: n,
|
|
1217
1226
|
receiver_id: c,
|
|
@@ -1237,7 +1246,9 @@ function dr(e) {
|
|
|
1237
1246
|
code: "NO_DEPOSIT_RESULT"
|
|
1238
1247
|
});
|
|
1239
1248
|
} catch (i) {
|
|
1240
|
-
|
|
1249
|
+
if (le(i) && ce(i))
|
|
1250
|
+
return;
|
|
1251
|
+
throw E.error("[TRANSFER ERROR]", i), new g({
|
|
1241
1252
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1242
1253
|
});
|
|
1243
1254
|
}
|
|
@@ -1248,21 +1259,21 @@ function dr(e) {
|
|
|
1248
1259
|
});
|
|
1249
1260
|
try {
|
|
1250
1261
|
const [i, f] = await Promise.all([
|
|
1251
|
-
|
|
1262
|
+
Jn({
|
|
1252
1263
|
contractId: s
|
|
1253
1264
|
}),
|
|
1254
|
-
|
|
1265
|
+
Rr({
|
|
1255
1266
|
contractId: s,
|
|
1256
1267
|
accountId: c
|
|
1257
1268
|
})
|
|
1258
|
-
]),
|
|
1259
|
-
|
|
1269
|
+
]), p = i - f;
|
|
1270
|
+
p > 0n && u.push({
|
|
1260
1271
|
type: "FunctionCall",
|
|
1261
1272
|
params: {
|
|
1262
1273
|
methodName: "storage_deposit",
|
|
1263
1274
|
args: { account_id: c },
|
|
1264
|
-
gas:
|
|
1265
|
-
deposit:
|
|
1275
|
+
gas: Ge,
|
|
1276
|
+
deposit: p.toString()
|
|
1266
1277
|
}
|
|
1267
1278
|
}), u.push({
|
|
1268
1279
|
type: "FunctionCall",
|
|
@@ -1273,7 +1284,7 @@ function dr(e) {
|
|
|
1273
1284
|
amount: n,
|
|
1274
1285
|
msg: l ?? ""
|
|
1275
1286
|
},
|
|
1276
|
-
gas:
|
|
1287
|
+
gas: je,
|
|
1277
1288
|
deposit: "1"
|
|
1278
1289
|
}
|
|
1279
1290
|
});
|
|
@@ -1295,28 +1306,30 @@ function dr(e) {
|
|
|
1295
1306
|
code: "NO_DEPOSIT_RESULT"
|
|
1296
1307
|
});
|
|
1297
1308
|
} catch (i) {
|
|
1298
|
-
|
|
1309
|
+
if (le(i) && ce(i))
|
|
1310
|
+
return;
|
|
1311
|
+
throw E.error("[TRANSFER ERROR]", i), new g({
|
|
1299
1312
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1300
1313
|
});
|
|
1301
1314
|
}
|
|
1302
1315
|
}
|
|
1303
1316
|
};
|
|
1304
1317
|
}
|
|
1305
|
-
const
|
|
1318
|
+
const Dr = ({
|
|
1306
1319
|
makeTransfer: e,
|
|
1307
1320
|
providers: t
|
|
1308
1321
|
}) => {
|
|
1309
|
-
const { ctx: r } = _(), { alchemyApiKey: s } =
|
|
1322
|
+
const { ctx: r } = _(), { alchemyApiKey: s } = b(), { make: n } = es({
|
|
1310
1323
|
provider: t?.evm
|
|
1311
|
-
}), { make: a } =
|
|
1324
|
+
}), { make: a } = ts({
|
|
1312
1325
|
provider: t?.sol,
|
|
1313
1326
|
alchemyApiKey: s
|
|
1314
1327
|
}), c = (d) => {
|
|
1315
1328
|
if (e)
|
|
1316
1329
|
return e;
|
|
1317
|
-
if (
|
|
1330
|
+
if (Nt(d))
|
|
1318
1331
|
return n;
|
|
1319
|
-
if (
|
|
1332
|
+
if (St(d))
|
|
1320
1333
|
return a;
|
|
1321
1334
|
throw new g({
|
|
1322
1335
|
code: "TRANSFER_INVALID_INITIAL",
|
|
@@ -1350,9 +1363,9 @@ const ur = ({
|
|
|
1350
1363
|
decimals: r.sourceToken.decimals,
|
|
1351
1364
|
address: r.quote.depositAddress,
|
|
1352
1365
|
chain: r.sourceToken.blockchain,
|
|
1353
|
-
evmChainId:
|
|
1354
|
-
isNativeEvmTokenTransfer: !!r.sourceToken &&
|
|
1355
|
-
tokenAddress: r.sourceToken.assetId ===
|
|
1366
|
+
evmChainId: H(r.sourceToken.blockchain) ? ke[r.sourceToken.blockchain] : null,
|
|
1367
|
+
isNativeEvmTokenTransfer: !!r.sourceToken && _t(r.sourceToken),
|
|
1368
|
+
tokenAddress: r.sourceToken.assetId === G ? G : r.sourceToken.contractAddress,
|
|
1356
1369
|
sourceAssetId: r.sourceToken.assetId,
|
|
1357
1370
|
targetAssetId: r.targetToken.assetId
|
|
1358
1371
|
}, u = c(d.address);
|
|
@@ -1361,7 +1374,7 @@ const ur = ({
|
|
|
1361
1374
|
if (!i) {
|
|
1362
1375
|
if (e)
|
|
1363
1376
|
return;
|
|
1364
|
-
throw
|
|
1377
|
+
throw E.error("[TRANSFER ERROR]", "No deposit result"), new g({
|
|
1365
1378
|
code: "NO_DEPOSIT_RESULT"
|
|
1366
1379
|
});
|
|
1367
1380
|
}
|
|
@@ -1371,17 +1384,17 @@ const ur = ({
|
|
|
1371
1384
|
intent: void 0
|
|
1372
1385
|
};
|
|
1373
1386
|
} catch (i) {
|
|
1374
|
-
|
|
1387
|
+
E.error("[TRANSFER ERROR]", i, { error: i });
|
|
1375
1388
|
let f = "Failed to make a transfer. Please try again.";
|
|
1376
|
-
const
|
|
1377
|
-
if (
|
|
1389
|
+
const p = le(i) && ce(i);
|
|
1390
|
+
if (p)
|
|
1378
1391
|
return;
|
|
1379
|
-
throw
|
|
1392
|
+
throw kn.isAxiosError(i) ? (f = i.response?.data?.detail ?? i.message ?? "Failed to make deposit. Please try again.", new g({
|
|
1380
1393
|
code: "QUOTE_ERROR",
|
|
1381
1394
|
meta: { message: f }
|
|
1382
1395
|
})) : f === "No quotes found" ? new g({
|
|
1383
1396
|
code: "NO_QUOTE_FOUND"
|
|
1384
|
-
}) : i instanceof Error && !
|
|
1397
|
+
}) : i instanceof Error && !p ? new g({
|
|
1385
1398
|
code: "QUOTE_ERROR",
|
|
1386
1399
|
meta: { message: i.message }
|
|
1387
1400
|
}) : new g({
|
|
@@ -1391,7 +1404,7 @@ const ur = ({
|
|
|
1391
1404
|
}
|
|
1392
1405
|
} };
|
|
1393
1406
|
};
|
|
1394
|
-
class
|
|
1407
|
+
class vr {
|
|
1395
1408
|
constructor(t, r) {
|
|
1396
1409
|
this.account = t, this.provider = r;
|
|
1397
1410
|
}
|
|
@@ -1401,7 +1414,7 @@ class mr {
|
|
|
1401
1414
|
deadline: t.deadline,
|
|
1402
1415
|
nonce: t.nonce,
|
|
1403
1416
|
intents: t.intents,
|
|
1404
|
-
signer_id: t.signer_id ??
|
|
1417
|
+
signer_id: t.signer_id ?? Ye.authHandleToIntentsUserId({
|
|
1405
1418
|
identifier: this.account.walletAddress,
|
|
1406
1419
|
method: "evm"
|
|
1407
1420
|
})
|
|
@@ -1412,42 +1425,42 @@ class mr {
|
|
|
1412
1425
|
params: [r, n[0]]
|
|
1413
1426
|
});
|
|
1414
1427
|
if (a == null)
|
|
1415
|
-
throw new
|
|
1428
|
+
throw new V("No signature is returned");
|
|
1416
1429
|
return {
|
|
1417
1430
|
payload: r,
|
|
1418
1431
|
standard: "erc191",
|
|
1419
|
-
signature:
|
|
1432
|
+
signature: Ye.transformERC191Signature(a)
|
|
1420
1433
|
};
|
|
1421
1434
|
}
|
|
1422
1435
|
}
|
|
1423
|
-
const
|
|
1436
|
+
const xr = ({
|
|
1424
1437
|
walletAddress: e,
|
|
1425
1438
|
getProvider: t
|
|
1426
|
-
}) =>
|
|
1439
|
+
}) => ns({
|
|
1427
1440
|
accountId: e,
|
|
1428
1441
|
signMessage: async (r) => {
|
|
1429
1442
|
const s = t();
|
|
1430
1443
|
if (!s.signMessage)
|
|
1431
|
-
throw new
|
|
1444
|
+
throw new V("Near wallet has no signMessage method exposed");
|
|
1432
1445
|
let n;
|
|
1433
1446
|
try {
|
|
1434
1447
|
n = await s.signMessage({
|
|
1435
1448
|
...r,
|
|
1436
|
-
nonce:
|
|
1449
|
+
nonce: Be.from(r.nonce)
|
|
1437
1450
|
});
|
|
1438
1451
|
} catch (a) {
|
|
1439
|
-
throw new
|
|
1452
|
+
throw new V("Near wallet failed to sign a message", {
|
|
1440
1453
|
cause: a
|
|
1441
1454
|
});
|
|
1442
1455
|
}
|
|
1443
1456
|
if (!n)
|
|
1444
|
-
throw new
|
|
1457
|
+
throw new V("Near wallet failed to sign a message");
|
|
1445
1458
|
return {
|
|
1446
1459
|
publicKey: n.publicKey,
|
|
1447
1460
|
signature: n.signature
|
|
1448
1461
|
};
|
|
1449
1462
|
}
|
|
1450
|
-
}),
|
|
1463
|
+
}), Or = (e, t) => {
|
|
1451
1464
|
if (t) {
|
|
1452
1465
|
if (e.sendAddress)
|
|
1453
1466
|
return e.sendAddress;
|
|
@@ -1462,8 +1475,8 @@ const fr = ({
|
|
|
1462
1475
|
meta: { message: "Quote is required for intents non-direct transfer" }
|
|
1463
1476
|
});
|
|
1464
1477
|
return e.quote.depositAddress;
|
|
1465
|
-
},
|
|
1466
|
-
let r =
|
|
1478
|
+
}, Fr = async (e, t) => {
|
|
1479
|
+
let r = ze.getItem("nearWalletsPk")[t];
|
|
1467
1480
|
if (!e.signMessage)
|
|
1468
1481
|
throw new g({
|
|
1469
1482
|
code: "DIRECT_TRANSFER_ERROR",
|
|
@@ -1474,14 +1487,14 @@ const fr = ({
|
|
|
1474
1487
|
const a = await e.signMessage({
|
|
1475
1488
|
message: "Authenticate",
|
|
1476
1489
|
recipient: "intents.near",
|
|
1477
|
-
nonce:
|
|
1490
|
+
nonce: Be.from(ls(32))
|
|
1478
1491
|
});
|
|
1479
1492
|
if (!a)
|
|
1480
1493
|
throw new g({
|
|
1481
1494
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1482
1495
|
meta: { message: "Signing message failed" }
|
|
1483
1496
|
});
|
|
1484
|
-
r = a.publicKey,
|
|
1497
|
+
r = a.publicKey, ze.setItem("nearWalletsPk", {
|
|
1485
1498
|
[t]: a.publicKey
|
|
1486
1499
|
});
|
|
1487
1500
|
} catch {
|
|
@@ -1490,12 +1503,12 @@ const fr = ({
|
|
|
1490
1503
|
meta: { message: "Your wallet doesn't support signing messages" }
|
|
1491
1504
|
});
|
|
1492
1505
|
}
|
|
1493
|
-
const s =
|
|
1506
|
+
const s = ne({
|
|
1494
1507
|
walletAddress: t,
|
|
1495
1508
|
addressType: "near"
|
|
1496
1509
|
});
|
|
1497
|
-
if (!await
|
|
1498
|
-
contractId:
|
|
1510
|
+
if (!await ds({
|
|
1511
|
+
contractId: _e,
|
|
1499
1512
|
methodName: "has_public_key",
|
|
1500
1513
|
args: {
|
|
1501
1514
|
account_id: s,
|
|
@@ -1506,7 +1519,7 @@ const fr = ({
|
|
|
1506
1519
|
await e.signAndSendTransactions({
|
|
1507
1520
|
transactions: [
|
|
1508
1521
|
{
|
|
1509
|
-
receiverId:
|
|
1522
|
+
receiverId: _e,
|
|
1510
1523
|
signerId: t,
|
|
1511
1524
|
actions: [
|
|
1512
1525
|
{
|
|
@@ -1528,12 +1541,12 @@ const fr = ({
|
|
|
1528
1541
|
meta: { message: "Unable to add public key to intents account" }
|
|
1529
1542
|
});
|
|
1530
1543
|
}
|
|
1531
|
-
},
|
|
1532
|
-
const { ctx: t } = _(), { appName: r, intentsAccountType: s } =
|
|
1544
|
+
}, Lr = ({ providers: e }) => {
|
|
1545
|
+
const { ctx: t } = _(), { appName: r, intentsAccountType: s } = b(), {
|
|
1533
1546
|
isNativeNearDeposit: n,
|
|
1534
1547
|
isDirectNearTokenWithdrawal: a,
|
|
1535
1548
|
isDirectNonNearWithdrawal: c
|
|
1536
|
-
} =
|
|
1549
|
+
} = Z();
|
|
1537
1550
|
return { make: async ({
|
|
1538
1551
|
message: d,
|
|
1539
1552
|
onPending: u
|
|
@@ -1568,7 +1581,7 @@ const fr = ({
|
|
|
1568
1581
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1569
1582
|
meta: { message: "No EVM provider configured" }
|
|
1570
1583
|
});
|
|
1571
|
-
i = new
|
|
1584
|
+
i = new vr(
|
|
1572
1585
|
{ walletAddress: t.walletAddress },
|
|
1573
1586
|
e.evm
|
|
1574
1587
|
);
|
|
@@ -1579,7 +1592,7 @@ const fr = ({
|
|
|
1579
1592
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1580
1593
|
meta: { message: "No SOL provider configured" }
|
|
1581
1594
|
});
|
|
1582
|
-
i = new
|
|
1595
|
+
i = new cs(
|
|
1583
1596
|
{ walletAddress: t.walletAddress },
|
|
1584
1597
|
e.sol
|
|
1585
1598
|
);
|
|
@@ -1590,64 +1603,74 @@ const fr = ({
|
|
|
1590
1603
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1591
1604
|
meta: { message: "No NEAR provider configured" }
|
|
1592
1605
|
});
|
|
1593
|
-
await
|
|
1606
|
+
await Fr(e.near(), t.walletAddress), i = xr({
|
|
1594
1607
|
walletAddress: t.walletAddress,
|
|
1595
1608
|
getProvider: e.near
|
|
1596
1609
|
});
|
|
1597
1610
|
break;
|
|
1598
1611
|
}
|
|
1599
1612
|
default:
|
|
1600
|
-
|
|
1613
|
+
De(s);
|
|
1601
1614
|
}
|
|
1602
|
-
const f = new
|
|
1615
|
+
const f = new ss({ referral: ht(r) });
|
|
1603
1616
|
f.setIntentSigner(i);
|
|
1604
|
-
let
|
|
1605
|
-
n ?
|
|
1606
|
-
const I =
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
});
|
|
1617
|
+
let p;
|
|
1618
|
+
n ? p = void 0 : a ? p = rs(d ?? void 0) : c ? p = void 0 : p = as();
|
|
1619
|
+
const I = {
|
|
1620
|
+
assetId: t.sourceToken.assetId,
|
|
1621
|
+
amount: BigInt(t.sourceTokenAmount),
|
|
1622
|
+
destinationAddress: Or(
|
|
1623
|
+
t,
|
|
1624
|
+
a || c
|
|
1625
|
+
),
|
|
1626
|
+
destinationMemo: void 0,
|
|
1627
|
+
feeInclusive: !1,
|
|
1628
|
+
routeConfig: p
|
|
1629
|
+
};
|
|
1630
|
+
u("WAITING_CONFIRMATION");
|
|
1619
1631
|
try {
|
|
1620
|
-
await
|
|
1621
|
-
|
|
1632
|
+
const m = await f.estimateWithdrawalFee({
|
|
1633
|
+
withdrawalParams: I
|
|
1634
|
+
}), { intentHash: w } = await f.signAndSendWithdrawalIntent({
|
|
1635
|
+
withdrawalParams: I,
|
|
1636
|
+
feeEstimation: m
|
|
1637
|
+
});
|
|
1622
1638
|
u("PROCESSING");
|
|
1623
|
-
const
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1639
|
+
const k = await f.waitForIntentSettlement({ intentHash: w }), y = await f.waitForWithdrawalCompletion({
|
|
1640
|
+
withdrawalParams: I,
|
|
1641
|
+
intentTx: k
|
|
1642
|
+
});
|
|
1643
|
+
return {
|
|
1644
|
+
intent: k.hash,
|
|
1645
|
+
// no hash means completion not trackable for this bridge
|
|
1646
|
+
hash: y.hash ?? "",
|
|
1647
|
+
transactionLink: y.hash ? us(
|
|
1648
|
+
cn[t.targetToken.blockchain],
|
|
1649
|
+
y.hash
|
|
1650
|
+
) : ""
|
|
1628
1651
|
};
|
|
1629
1652
|
} catch (m) {
|
|
1630
|
-
if (
|
|
1653
|
+
if (E.error("[TRANSFER ERROR]", m), m instanceof os)
|
|
1631
1654
|
throw new g({
|
|
1632
1655
|
code: "MIN_WITHDRAWAL_AMOUNT_ERROR",
|
|
1633
1656
|
meta: {
|
|
1634
|
-
minAmount:
|
|
1657
|
+
minAmount: Y(
|
|
1635
1658
|
m.minAmount.toString(),
|
|
1636
1659
|
t.sourceToken.decimals
|
|
1637
1660
|
)
|
|
1638
1661
|
}
|
|
1639
1662
|
});
|
|
1640
|
-
if (m instanceof
|
|
1663
|
+
if (m instanceof is)
|
|
1641
1664
|
throw new g({
|
|
1642
1665
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1643
1666
|
meta: { message: "Fee is above the maximum allowed" }
|
|
1644
1667
|
});
|
|
1645
|
-
if (m
|
|
1668
|
+
if (le(m)) {
|
|
1646
1669
|
if (m.message.includes("Fee is not estimated"))
|
|
1647
1670
|
throw new g({
|
|
1648
1671
|
code: "FEES_NOT_ESTIMATED"
|
|
1649
1672
|
});
|
|
1650
|
-
if (
|
|
1673
|
+
if (ce(m))
|
|
1651
1674
|
return;
|
|
1652
1675
|
}
|
|
1653
1676
|
throw new g({
|
|
@@ -1655,7 +1678,7 @@ const fr = ({
|
|
|
1655
1678
|
});
|
|
1656
1679
|
}
|
|
1657
1680
|
} };
|
|
1658
|
-
},
|
|
1681
|
+
}, Br = ({
|
|
1659
1682
|
message: e,
|
|
1660
1683
|
providers: t,
|
|
1661
1684
|
makeTransfer: r
|
|
@@ -1664,10 +1687,10 @@ const fr = ({
|
|
|
1664
1687
|
isDirectTokenOnNearDeposit: n,
|
|
1665
1688
|
isDirectTokenOnNearTransfer: a,
|
|
1666
1689
|
isNativeNearDeposit: c
|
|
1667
|
-
} =
|
|
1690
|
+
} = Z(), { make: l } = Lr({ providers: t }), { make: d } = Dr({
|
|
1668
1691
|
makeTransfer: r,
|
|
1669
1692
|
providers: t
|
|
1670
|
-
}), { make: u } =
|
|
1693
|
+
}), { make: u } = Cr(
|
|
1671
1694
|
t?.near
|
|
1672
1695
|
);
|
|
1673
1696
|
return { make: async () => {
|
|
@@ -1675,22 +1698,22 @@ const fr = ({
|
|
|
1675
1698
|
return;
|
|
1676
1699
|
let f;
|
|
1677
1700
|
try {
|
|
1678
|
-
if (
|
|
1701
|
+
if (T("transferSetStatus", {
|
|
1679
1702
|
status: "pending",
|
|
1680
1703
|
reason: "WAITING_CONFIRMATION"
|
|
1681
1704
|
}), s.sourceToken?.isIntent)
|
|
1682
1705
|
f = await l({
|
|
1683
1706
|
message: e,
|
|
1684
|
-
onPending: (
|
|
1685
|
-
|
|
1707
|
+
onPending: (p) => {
|
|
1708
|
+
T("transferSetStatus", {
|
|
1686
1709
|
status: "pending",
|
|
1687
|
-
reason:
|
|
1710
|
+
reason: p
|
|
1688
1711
|
});
|
|
1689
1712
|
}
|
|
1690
1713
|
});
|
|
1691
1714
|
else if ((c || n) && !s.isDepositFromExternalWallet)
|
|
1692
1715
|
f = await u(
|
|
1693
|
-
s.sendAddress ??
|
|
1716
|
+
s.sendAddress ?? _e,
|
|
1694
1717
|
e
|
|
1695
1718
|
);
|
|
1696
1719
|
else if (a) {
|
|
@@ -1705,43 +1728,43 @@ const fr = ({
|
|
|
1705
1728
|
);
|
|
1706
1729
|
} else
|
|
1707
1730
|
f = await d();
|
|
1708
|
-
} catch (
|
|
1709
|
-
|
|
1731
|
+
} catch (p) {
|
|
1732
|
+
p instanceof g && (E.error(p.data), T("transferSetStatus", { status: "error" }), T("errorSet", p.data));
|
|
1710
1733
|
}
|
|
1711
1734
|
if (!f) {
|
|
1712
|
-
|
|
1735
|
+
T("transferSetStatus", { status: "idle" });
|
|
1713
1736
|
return;
|
|
1714
1737
|
}
|
|
1715
|
-
return
|
|
1738
|
+
return T("transferSetStatus", { status: "success" }), F("transfer_success"), f;
|
|
1716
1739
|
} };
|
|
1717
|
-
},
|
|
1740
|
+
}, qr = async (e) => {
|
|
1718
1741
|
if (!e)
|
|
1719
1742
|
return;
|
|
1720
1743
|
const t = await e.request({
|
|
1721
1744
|
method: "eth_chainId"
|
|
1722
1745
|
});
|
|
1723
1746
|
return parseInt(t, 16);
|
|
1724
|
-
},
|
|
1725
|
-
const { ctx: t } = _(), [r, s] =
|
|
1747
|
+
}, Ur = ({ providers: e }) => {
|
|
1748
|
+
const { ctx: t } = _(), [r, s] = te(!1), [n, a] = te(!1), c = ie(async () => {
|
|
1726
1749
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1727
1750
|
if (!t.sourceToken || !d)
|
|
1728
1751
|
return !1;
|
|
1729
|
-
const u = await
|
|
1730
|
-
if (!
|
|
1752
|
+
const u = await qr(d);
|
|
1753
|
+
if (!H(t.sourceToken.blockchain))
|
|
1731
1754
|
return !1;
|
|
1732
|
-
const i =
|
|
1755
|
+
const i = ke[t.sourceToken.blockchain];
|
|
1733
1756
|
return !i || !u ? !1 : u !== i;
|
|
1734
|
-
}, [t.sourceToken, e]), l =
|
|
1757
|
+
}, [t.sourceToken, e]), l = ie(async () => {
|
|
1735
1758
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1736
|
-
if (!t.sourceToken || !d || !
|
|
1759
|
+
if (!t.sourceToken || !d || !H(t.sourceToken.blockchain))
|
|
1737
1760
|
return !1;
|
|
1738
|
-
const u =
|
|
1761
|
+
const u = ke[t.sourceToken.blockchain];
|
|
1739
1762
|
if (!u)
|
|
1740
1763
|
return !1;
|
|
1741
1764
|
try {
|
|
1742
|
-
return s(!0), await
|
|
1765
|
+
return s(!0), await ms(u, d), !0;
|
|
1743
1766
|
} catch (i) {
|
|
1744
|
-
return
|
|
1767
|
+
return E.error("Failed to switch chain:", i), !1;
|
|
1745
1768
|
} finally {
|
|
1746
1769
|
s(!1);
|
|
1747
1770
|
}
|
|
@@ -1756,8 +1779,8 @@ const fr = ({
|
|
|
1756
1779
|
}, N = {
|
|
1757
1780
|
size: "lg",
|
|
1758
1781
|
variant: "primary"
|
|
1759
|
-
},
|
|
1760
|
-
const { t } =
|
|
1782
|
+
}, qe = (e) => {
|
|
1783
|
+
const { t } = $();
|
|
1761
1784
|
if (e.error?.code === "TOKEN_IS_NOT_SUPPORTED")
|
|
1762
1785
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.invalidAddress", "Invalid address") });
|
|
1763
1786
|
if (e.state === "initial_wallet" && e.error?.code === "SEND_ADDRESS_IS_EMPTY")
|
|
@@ -1775,12 +1798,12 @@ const fr = ({
|
|
|
1775
1798
|
if (e.error?.code === "QUOTE_AMOUNT_IS_TOO_LOW" || e.error?.code === "MIN_WITHDRAWAL_AMOUNT_ERROR")
|
|
1776
1799
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1777
1800
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.amountTooLow.label", "Amount is too low") }),
|
|
1778
|
-
/* @__PURE__ */ o(
|
|
1801
|
+
/* @__PURE__ */ o(j, { children: /* @__PURE__ */ h(tn, { i18nKey: "submit.error.amountTooLow.message", children: [
|
|
1779
1802
|
"Amount you entered is very low. Please try increasing it",
|
|
1780
1803
|
" ",
|
|
1781
1804
|
/* @__PURE__ */ h("span", { className: "text-nowrap", children: [
|
|
1782
1805
|
"above ",
|
|
1783
|
-
/* @__PURE__ */ o(
|
|
1806
|
+
/* @__PURE__ */ o(Le, { value: e.error.meta.minAmount ?? "0" }),
|
|
1784
1807
|
" ",
|
|
1785
1808
|
e.sourceToken?.symbol ?? "",
|
|
1786
1809
|
"."
|
|
@@ -1790,7 +1813,7 @@ const fr = ({
|
|
|
1790
1813
|
if (e.quoteStatus === "error")
|
|
1791
1814
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1792
1815
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.quoteFailed.label", "Quote failed") }),
|
|
1793
|
-
/* @__PURE__ */ o(
|
|
1816
|
+
/* @__PURE__ */ o(j, { children: t(
|
|
1794
1817
|
"submit.error.quoteFailed.message",
|
|
1795
1818
|
"We couldn’t finalize your quote. Please try again or adjust your values."
|
|
1796
1819
|
) })
|
|
@@ -1798,14 +1821,14 @@ const fr = ({
|
|
|
1798
1821
|
if (e.error?.code === "TRANSFER_INVALID_INITIAL")
|
|
1799
1822
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1800
1823
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.invalidTransferData.label", "Invalid transfer data") }),
|
|
1801
|
-
e.error.meta?.message ? /* @__PURE__ */ o(
|
|
1824
|
+
e.error.meta?.message ? /* @__PURE__ */ o(j, { children: e.error.meta.message }) : null
|
|
1802
1825
|
] });
|
|
1803
1826
|
if (e.error?.code === "EXTERNAL_TRANSFER_FAILED")
|
|
1804
1827
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.externalTransferFailed.label", "Transfer failed") });
|
|
1805
1828
|
if (e.error?.code === "EXTERNAL_TRANSFER_INCOMPLETE")
|
|
1806
1829
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1807
1830
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.externalTransferFailed.label", "Transfer failed") }),
|
|
1808
|
-
/* @__PURE__ */ o(
|
|
1831
|
+
/* @__PURE__ */ o(j, { children: t(
|
|
1809
1832
|
"submit.error.externalTransferFailed.incompleteMessage",
|
|
1810
1833
|
"Incomplete transfer. Deposited amount will be refunded."
|
|
1811
1834
|
) })
|
|
@@ -1813,7 +1836,7 @@ const fr = ({
|
|
|
1813
1836
|
if (e.error?.code === "EXTERNAL_TRANSFER_REFUNDED")
|
|
1814
1837
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1815
1838
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.externalTransferFailed.label", "Transfer failed") }),
|
|
1816
|
-
/* @__PURE__ */ o(
|
|
1839
|
+
/* @__PURE__ */ o(j, { children: t(
|
|
1817
1840
|
"submit.error.externalTransferFailed.refundedMessage",
|
|
1818
1841
|
"Deposited amount will be refunded."
|
|
1819
1842
|
) })
|
|
@@ -1821,31 +1844,31 @@ const fr = ({
|
|
|
1821
1844
|
if (e.error?.code === "DIRECT_TRANSFER_ERROR")
|
|
1822
1845
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1823
1846
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.transferFailed.label", "Transfer failed") }),
|
|
1824
|
-
e.error.meta?.message ? /* @__PURE__ */ o(
|
|
1847
|
+
e.error.meta?.message ? /* @__PURE__ */ o(j, { children: e.error.meta.message }) : null
|
|
1825
1848
|
] });
|
|
1826
1849
|
if (e.error?.code === "SOURCE_BALANCE_INSUFFICIENT")
|
|
1827
1850
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.insufficientBalance", "Insufficient balance") });
|
|
1828
|
-
},
|
|
1829
|
-
const { t } =
|
|
1851
|
+
}, Pr = ({ onClick: e }) => {
|
|
1852
|
+
const { t } = $();
|
|
1830
1853
|
return /* @__PURE__ */ o(A, { state: "disabled", ...N, onClick: e, children: t("submit.error.connectWallet", "Connect wallet") });
|
|
1831
|
-
},
|
|
1854
|
+
}, Wr = () => {
|
|
1832
1855
|
const { ctx: e } = _();
|
|
1833
|
-
return
|
|
1834
|
-
},
|
|
1835
|
-
const { providers: t, makeTransfer: r, onSuccess: s } = e, { ctx: n } = _(), { t: a } =
|
|
1856
|
+
return qe(e) ?? null;
|
|
1857
|
+
}, Mr = (e) => {
|
|
1858
|
+
const { providers: t, makeTransfer: r, onSuccess: s } = e, { ctx: n } = _(), { t: a } = $(), {
|
|
1836
1859
|
isNativeNearDeposit: c,
|
|
1837
1860
|
isDirectNonNearWithdrawal: l,
|
|
1838
1861
|
isDirectTokenOnNearDeposit: d,
|
|
1839
1862
|
isDirectNearTokenWithdrawal: u
|
|
1840
|
-
} =
|
|
1841
|
-
if (f && !await
|
|
1863
|
+
} = Z(), { make: i } = Br({ providers: t, makeTransfer: r }), { isSwitchingChainRequired: f, switchChain: p, isSwitchingChain: I } = Ur({ providers: t }), m = qe(n), w = async () => {
|
|
1864
|
+
if (f && !await p())
|
|
1842
1865
|
return;
|
|
1843
|
-
const
|
|
1844
|
-
|
|
1866
|
+
const k = await i();
|
|
1867
|
+
k && s(k);
|
|
1845
1868
|
};
|
|
1846
1869
|
if (!n.targetToken)
|
|
1847
1870
|
return /* @__PURE__ */ o(A, { ...N, state: "disabled", children: a("submit.disabled.selectTokenToReceive", "Select token to receive") });
|
|
1848
|
-
if (!
|
|
1871
|
+
if (!se(n.sourceTokenAmount))
|
|
1849
1872
|
return /* @__PURE__ */ o(A, { ...N, state: "disabled", children: a("submit.disabled.enterAmount", "Enter amount") });
|
|
1850
1873
|
if (n.areInputsValidating)
|
|
1851
1874
|
return /* @__PURE__ */ o(A, { state: "loading", ...N, children: a("submit.pending.validating", "Validating...") });
|
|
@@ -1863,7 +1886,7 @@ const fr = ({
|
|
|
1863
1886
|
}
|
|
1864
1887
|
return n.transferStatus.status === "error" ? /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1865
1888
|
/* @__PURE__ */ o(A, { ...N, children: e.label }),
|
|
1866
|
-
/* @__PURE__ */ o(
|
|
1889
|
+
/* @__PURE__ */ o(j, { children: (() => {
|
|
1867
1890
|
switch (n.error?.code) {
|
|
1868
1891
|
case "FEES_NOT_ESTIMATED":
|
|
1869
1892
|
return a(
|
|
@@ -1878,18 +1901,18 @@ const fr = ({
|
|
|
1878
1901
|
}
|
|
1879
1902
|
})() })
|
|
1880
1903
|
] }) : n.quoteStatus === "pending" ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: n.quote ? a("submit.pending.quote.refreshing", "Refreshing quote") : a("submit.pending.quote.finalizing", "Finalizing quote") }) : n.error ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : !n.quote && !l && !d && !u && !c ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : /* @__PURE__ */ o(A, { ...N, onClick: w, children: e.label });
|
|
1881
|
-
},
|
|
1882
|
-
const { t } =
|
|
1883
|
-
return r.isDepositFromExternalWallet ?
|
|
1884
|
-
},
|
|
1885
|
-
const { ctx: t } = _(), r =
|
|
1886
|
-
return t.walletAddress ? /* @__PURE__ */ o(
|
|
1904
|
+
}, Vr = (e) => {
|
|
1905
|
+
const { t } = $(), { ctx: r } = _(), s = qe(r);
|
|
1906
|
+
return r.isDepositFromExternalWallet ? se(r.sourceTokenAmount) ? r.externalDepositTxReceived ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.processing", "Processing") }) : /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.waiting", "Waiting for transaction") }) : /* @__PURE__ */ o(A, { ...N, state: "disabled", children: t("submit.disabled.enterAmount", "Enter amount") }) : s || /* @__PURE__ */ o(Mr, { ...e });
|
|
1907
|
+
}, Qr = (e) => {
|
|
1908
|
+
const { ctx: t } = _(), r = b();
|
|
1909
|
+
return t.walletAddress ? /* @__PURE__ */ o(Vr, { ...e }) : /* @__PURE__ */ o(Pr, { onClick: r.onWalletSignin });
|
|
1887
1910
|
};
|
|
1888
|
-
|
|
1889
|
-
const
|
|
1890
|
-
const { t } =
|
|
1911
|
+
Qr.Error = Wr;
|
|
1912
|
+
const $r = ({ className: e }) => {
|
|
1913
|
+
const { t } = $(), { slippageTolerance: r } = b(), { ctx: s } = _(), n = s.sourceToken && s.targetToken && s.sourceToken.price / s.targetToken.price;
|
|
1891
1914
|
return s.sourceToken ? /* @__PURE__ */ o(
|
|
1892
|
-
|
|
1915
|
+
fs,
|
|
1893
1916
|
{
|
|
1894
1917
|
expandedByDefault: !1,
|
|
1895
1918
|
expandedHeightPx: s.walletAddress ? 80 : 50,
|
|
@@ -1899,26 +1922,26 @@ const yr = ({ className: e }) => {
|
|
|
1899
1922
|
title: s.sourceToken && s.targetToken ? /* @__PURE__ */ h("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
1900
1923
|
`1 ${s.sourceToken.symbol} ≈ `,
|
|
1901
1924
|
" ",
|
|
1902
|
-
|
|
1925
|
+
ps(n ?? 0),
|
|
1903
1926
|
" ",
|
|
1904
1927
|
`${s.targetToken.symbol}`,
|
|
1905
|
-
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${
|
|
1928
|
+
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${Xe(s.sourceToken.price)})` })
|
|
1906
1929
|
] }) : /* @__PURE__ */ h("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
1907
1930
|
`1 ${s.sourceToken.symbol} ≈ `,
|
|
1908
1931
|
" ",
|
|
1909
|
-
|
|
1932
|
+
Xe(s.sourceToken.price),
|
|
1910
1933
|
" USD"
|
|
1911
1934
|
] }),
|
|
1912
|
-
children: /* @__PURE__ */ h(
|
|
1935
|
+
children: /* @__PURE__ */ h(Te, { children: [
|
|
1913
1936
|
/* @__PURE__ */ o(
|
|
1914
|
-
|
|
1937
|
+
Te.Item,
|
|
1915
1938
|
{
|
|
1916
1939
|
label: t("quote.result.maxSlippage.label", "Max slippage"),
|
|
1917
1940
|
value: `${(r / 100).toFixed(2)}%`
|
|
1918
1941
|
}
|
|
1919
1942
|
),
|
|
1920
1943
|
!!s.walletAddress && /* @__PURE__ */ o(
|
|
1921
|
-
|
|
1944
|
+
Te.Item,
|
|
1922
1945
|
{
|
|
1923
1946
|
isLoading: s.quoteStatus === "pending",
|
|
1924
1947
|
label: t("quote.result.processingTime.label", "Processing time"),
|
|
@@ -1927,28 +1950,28 @@ const yr = ({ className: e }) => {
|
|
|
1927
1950
|
)
|
|
1928
1951
|
] })
|
|
1929
1952
|
}
|
|
1930
|
-
) : /* @__PURE__ */ o(
|
|
1931
|
-
},
|
|
1932
|
-
Skeleton:
|
|
1933
|
-
}),
|
|
1953
|
+
) : /* @__PURE__ */ o(yt, {});
|
|
1954
|
+
}, fl = Object.assign($r, {
|
|
1955
|
+
Skeleton: yt
|
|
1956
|
+
}), Kr = ({
|
|
1934
1957
|
token: e,
|
|
1935
1958
|
balance: t,
|
|
1936
1959
|
isNotSufficient: r = !1,
|
|
1937
1960
|
onClick: s
|
|
1938
1961
|
}) => {
|
|
1939
|
-
const n =
|
|
1940
|
-
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(
|
|
1962
|
+
const n = b();
|
|
1963
|
+
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(hs, { width: 100 }) : /* @__PURE__ */ o(
|
|
1941
1964
|
"span",
|
|
1942
1965
|
{
|
|
1943
1966
|
onClick: t ? s : void 0,
|
|
1944
1967
|
style: t ? { borderBottomWidth: "2px", borderStyle: "dotted" } : void 0,
|
|
1945
|
-
className:
|
|
1968
|
+
className: Ts("text-sw-label-sm", {
|
|
1946
1969
|
"text-sw-status-error": r,
|
|
1947
1970
|
"text-sw-gray-100": !r,
|
|
1948
1971
|
"cursor-pointer": !!t && !!s
|
|
1949
1972
|
}),
|
|
1950
1973
|
children: /* @__PURE__ */ o(
|
|
1951
|
-
|
|
1974
|
+
Le,
|
|
1952
1975
|
{
|
|
1953
1976
|
decimals: e.decimals,
|
|
1954
1977
|
value: t === void 0 ? "0" : `${t}`
|
|
@@ -1956,7 +1979,7 @@ const yr = ({ className: e }) => {
|
|
|
1956
1979
|
)
|
|
1957
1980
|
}
|
|
1958
1981
|
);
|
|
1959
|
-
},
|
|
1982
|
+
}, Ue = ({
|
|
1960
1983
|
token: e,
|
|
1961
1984
|
balance: t,
|
|
1962
1985
|
value: r = "",
|
|
@@ -1968,32 +1991,32 @@ const yr = ({ className: e }) => {
|
|
|
1968
1991
|
heading: d,
|
|
1969
1992
|
onMsg: u
|
|
1970
1993
|
}) => {
|
|
1971
|
-
const i =
|
|
1994
|
+
const i = zt(), { ctx: f } = _(), { t: p } = $(), { hideTokenInputHeadings: I } = b(), m = Is(e, r, n), w = (k) => {
|
|
1972
1995
|
u({
|
|
1973
1996
|
type: "on_change_amount",
|
|
1974
|
-
amount:
|
|
1997
|
+
amount: gs(t, e.decimals, k)
|
|
1975
1998
|
});
|
|
1976
1999
|
};
|
|
1977
|
-
return /* @__PURE__ */ h(
|
|
1978
|
-
!I && /* @__PURE__ */ o(
|
|
2000
|
+
return /* @__PURE__ */ h(me, { className: "flex flex-col", "aria-label": d, children: [
|
|
2001
|
+
!I && /* @__PURE__ */ o(bt, { children: d }),
|
|
1979
2002
|
/* @__PURE__ */ h(
|
|
1980
2003
|
"div",
|
|
1981
2004
|
{
|
|
1982
|
-
className:
|
|
2005
|
+
className: K(
|
|
1983
2006
|
"flex items-center justify-between",
|
|
1984
2007
|
!I && "mt-sw-2xl"
|
|
1985
2008
|
),
|
|
1986
2009
|
children: [
|
|
1987
2010
|
/* @__PURE__ */ o(
|
|
1988
|
-
|
|
2011
|
+
ks,
|
|
1989
2012
|
{
|
|
1990
2013
|
value: r,
|
|
1991
2014
|
name: i,
|
|
1992
|
-
setValue:
|
|
2015
|
+
setValue: ws,
|
|
1993
2016
|
placeholder: "0",
|
|
1994
2017
|
state: a === "default" || a === "disabled" ? a : "error",
|
|
1995
|
-
onChange: (
|
|
1996
|
-
u({ type: "on_change_amount", amount:
|
|
2018
|
+
onChange: (k) => {
|
|
2019
|
+
u({ type: "on_change_amount", amount: k.target.value });
|
|
1997
2020
|
}
|
|
1998
2021
|
}
|
|
1999
2022
|
),
|
|
@@ -2002,7 +2025,7 @@ const yr = ({ className: e }) => {
|
|
|
2002
2025
|
{
|
|
2003
2026
|
type: "button",
|
|
2004
2027
|
onClick: a === "disabled" ? void 0 : () => u({ type: "on_click_select_token" }),
|
|
2005
|
-
className:
|
|
2028
|
+
className: K(
|
|
2006
2029
|
"gap-sw-md pl-sw-sm pr-sw-md flex h-[36px] min-w-[80px] shrink-0 items-center rounded-sw-md transition-colors bg-sw-gray-800 hover:bg-sw-gray-700 group",
|
|
2007
2030
|
{
|
|
2008
2031
|
"cursor-pointer": a !== "disabled",
|
|
@@ -2011,7 +2034,7 @@ const yr = ({ className: e }) => {
|
|
|
2011
2034
|
),
|
|
2012
2035
|
children: [
|
|
2013
2036
|
/* @__PURE__ */ o(
|
|
2014
|
-
|
|
2037
|
+
Et,
|
|
2015
2038
|
{
|
|
2016
2039
|
token: e,
|
|
2017
2040
|
chainShowIcon: !e.isIntent,
|
|
@@ -2031,7 +2054,7 @@ const yr = ({ className: e }) => {
|
|
|
2031
2054
|
s ? /* @__PURE__ */ o(
|
|
2032
2055
|
"span",
|
|
2033
2056
|
{
|
|
2034
|
-
className:
|
|
2057
|
+
className: K("text-sw-label-sm text-nowrap", {
|
|
2035
2058
|
"text-sw-gray-400": s >= -2 && s <= 2,
|
|
2036
2059
|
"text-sw-status-success": s > 2,
|
|
2037
2060
|
"text-sw-status-error": s <= -5,
|
|
@@ -2043,7 +2066,7 @@ const yr = ({ className: e }) => {
|
|
|
2043
2066
|
] }),
|
|
2044
2067
|
/* @__PURE__ */ h("div", { className: "gap-sw-sm flex items-center", children: [
|
|
2045
2068
|
e && !!f.walletAddress && c && /* @__PURE__ */ o(
|
|
2046
|
-
|
|
2069
|
+
Kr,
|
|
2047
2070
|
{
|
|
2048
2071
|
token: e,
|
|
2049
2072
|
balance: t,
|
|
@@ -2051,42 +2074,42 @@ const yr = ({ className: e }) => {
|
|
|
2051
2074
|
onClick: () => w(1)
|
|
2052
2075
|
}
|
|
2053
2076
|
),
|
|
2054
|
-
!!t && c && l && /* @__PURE__ */ h(
|
|
2077
|
+
!!t && c && l && /* @__PURE__ */ h($t, { children: [
|
|
2055
2078
|
/* @__PURE__ */ o(
|
|
2056
|
-
|
|
2079
|
+
Ze,
|
|
2057
2080
|
{
|
|
2058
2081
|
isClickable: a !== "disabled",
|
|
2059
2082
|
onClick: () => w(2),
|
|
2060
|
-
children:
|
|
2083
|
+
children: p("tokens.input.half.label", "50%")
|
|
2061
2084
|
}
|
|
2062
2085
|
),
|
|
2063
2086
|
/* @__PURE__ */ o(
|
|
2064
|
-
|
|
2087
|
+
Ze,
|
|
2065
2088
|
{
|
|
2066
2089
|
isClickable: a !== "disabled",
|
|
2067
2090
|
onClick: () => w(1),
|
|
2068
|
-
children:
|
|
2091
|
+
children: p("tokens.input.max.label", "Max")
|
|
2069
2092
|
}
|
|
2070
2093
|
)
|
|
2071
2094
|
] }),
|
|
2072
|
-
!c && /* @__PURE__ */ o("div", { className: "rounded-full bg-sw-gray-700 py-sw-xs px-sw-sm flex items-center justify-center", children: /* @__PURE__ */ o("span", { className: "text-sw-gray-100 text-sw-label-sm", children:
|
|
2095
|
+
!c && /* @__PURE__ */ o("div", { className: "rounded-full bg-sw-gray-700 py-sw-xs px-sw-sm flex items-center justify-center", children: /* @__PURE__ */ o("span", { className: "text-sw-gray-100 text-sw-label-sm", children: p("tokens.input.externalBalance.label", "External balance") }) })
|
|
2073
2096
|
] })
|
|
2074
2097
|
] })
|
|
2075
2098
|
] });
|
|
2076
|
-
},
|
|
2077
|
-
const { hideTokenInputHeadings: r } =
|
|
2099
|
+
}, Pe = ({ onMsg: e, heading: t }) => {
|
|
2100
|
+
const { hideTokenInputHeadings: r } = b();
|
|
2078
2101
|
return /* @__PURE__ */ h(
|
|
2079
|
-
|
|
2102
|
+
me,
|
|
2080
2103
|
{
|
|
2081
2104
|
isClickable: !0,
|
|
2082
2105
|
className: "flex flex-col",
|
|
2083
2106
|
onClick: () => e({ type: "on_click_select_token" }),
|
|
2084
2107
|
children: [
|
|
2085
|
-
!r && /* @__PURE__ */ o(
|
|
2108
|
+
!r && /* @__PURE__ */ o(bt, { children: t }),
|
|
2086
2109
|
/* @__PURE__ */ h(
|
|
2087
2110
|
"div",
|
|
2088
2111
|
{
|
|
2089
|
-
className:
|
|
2112
|
+
className: K(
|
|
2090
2113
|
"flex items-center justify-between",
|
|
2091
2114
|
!r && "mt-sw-2xl"
|
|
2092
2115
|
),
|
|
@@ -2115,19 +2138,19 @@ const yr = ({ className: e }) => {
|
|
|
2115
2138
|
]
|
|
2116
2139
|
}
|
|
2117
2140
|
);
|
|
2118
|
-
},
|
|
2119
|
-
const { mergedBalance: t } =
|
|
2120
|
-
e ? t[
|
|
2141
|
+
}, qt = (e) => {
|
|
2142
|
+
const { mergedBalance: t } = pe(), [r, s] = te(
|
|
2143
|
+
e ? t[z(e)] : void 0
|
|
2121
2144
|
);
|
|
2122
2145
|
return R(() => {
|
|
2123
2146
|
let n;
|
|
2124
2147
|
if (e) {
|
|
2125
|
-
const a = t[
|
|
2148
|
+
const a = t[z(e)];
|
|
2126
2149
|
a ? n = setTimeout(() => {
|
|
2127
2150
|
s(a);
|
|
2128
2151
|
}, 0) : n = setTimeout(() => {
|
|
2129
2152
|
s(
|
|
2130
|
-
e ? t[
|
|
2153
|
+
e ? t[z(e)] ?? 0 : 0
|
|
2131
2154
|
);
|
|
2132
2155
|
}, 2e3);
|
|
2133
2156
|
}
|
|
@@ -2135,23 +2158,23 @@ const yr = ({ className: e }) => {
|
|
|
2135
2158
|
n && clearTimeout(n);
|
|
2136
2159
|
};
|
|
2137
2160
|
}, [e, t]), r;
|
|
2138
|
-
},
|
|
2139
|
-
const { tokens: r } =
|
|
2161
|
+
}, Ut = (e, t) => {
|
|
2162
|
+
const { tokens: r } = M(e), s = Array.from(
|
|
2140
2163
|
new Set(r.map((n) => n.assetId))
|
|
2141
2164
|
);
|
|
2142
2165
|
R(() => {
|
|
2143
2166
|
const n = s.length === 1 ? r[0] : null;
|
|
2144
2167
|
n && t({ type: "on_select_token", token: n });
|
|
2145
2168
|
}, [r]);
|
|
2146
|
-
},
|
|
2169
|
+
}, Hr = ({
|
|
2147
2170
|
onMsg: e,
|
|
2148
2171
|
isChanging: t = !0,
|
|
2149
2172
|
showBalance: r = !0,
|
|
2150
2173
|
heading: s
|
|
2151
2174
|
}) => {
|
|
2152
|
-
const { ctx: n } = _(), a =
|
|
2153
|
-
|
|
2154
|
-
const c =
|
|
2175
|
+
const { ctx: n } = _(), a = qt(n.sourceToken);
|
|
2176
|
+
Ut("source", e);
|
|
2177
|
+
const c = L(() => {
|
|
2155
2178
|
if (!t && n.quoteStatus === "pending")
|
|
2156
2179
|
return "disabled";
|
|
2157
2180
|
if (!n.error)
|
|
@@ -2162,7 +2185,7 @@ const yr = ({ className: e }) => {
|
|
|
2162
2185
|
return "error-balance";
|
|
2163
2186
|
}, [t, n.error, n.quoteStatus]);
|
|
2164
2187
|
return n.sourceToken ? /* @__PURE__ */ o(
|
|
2165
|
-
|
|
2188
|
+
Ue,
|
|
2166
2189
|
{
|
|
2167
2190
|
heading: s,
|
|
2168
2191
|
token: n.sourceToken,
|
|
@@ -2170,65 +2193,70 @@ const yr = ({ className: e }) => {
|
|
|
2170
2193
|
balance: a,
|
|
2171
2194
|
showBalance: r,
|
|
2172
2195
|
showQuickBalanceActions: !0,
|
|
2173
|
-
value:
|
|
2196
|
+
value: Y(n.sourceTokenAmount, n.sourceToken?.decimals),
|
|
2174
2197
|
onMsg: e
|
|
2175
2198
|
}
|
|
2176
|
-
) : /* @__PURE__ */ o(
|
|
2177
|
-
},
|
|
2199
|
+
) : /* @__PURE__ */ o(Pe, { heading: s, onMsg: e });
|
|
2200
|
+
}, Gr = ({
|
|
2178
2201
|
isChanging: e = !1,
|
|
2179
2202
|
onMsg: t,
|
|
2180
2203
|
heading: r
|
|
2181
2204
|
}) => {
|
|
2182
|
-
const { ctx: s } = _(), { usdTradeDelta: n } =
|
|
2183
|
-
|
|
2184
|
-
const c =
|
|
2205
|
+
const { ctx: s } = _(), { usdTradeDelta: n } = Z(), a = qt(s.targetToken);
|
|
2206
|
+
Ut("target", t);
|
|
2207
|
+
const c = L(() => !e && s.quoteStatus === "pending" ? "disabled" : "default", [e, s.quoteStatus]);
|
|
2185
2208
|
return s.targetToken ? /* @__PURE__ */ o(
|
|
2186
|
-
|
|
2209
|
+
Ue,
|
|
2187
2210
|
{
|
|
2188
2211
|
heading: r,
|
|
2189
2212
|
token: s.targetToken,
|
|
2190
2213
|
balance: a,
|
|
2191
2214
|
quoteUsdDelta: n?.percentage,
|
|
2192
2215
|
quoteUsdValue: s.quote && parseFloat(s.quote.amountOutUsd),
|
|
2193
|
-
value:
|
|
2216
|
+
value: Y(s.targetTokenAmount, s.targetToken?.decimals),
|
|
2194
2217
|
state: c,
|
|
2195
2218
|
showQuickBalanceActions: !1,
|
|
2196
2219
|
showBalance: !0,
|
|
2197
2220
|
onMsg: t
|
|
2198
2221
|
}
|
|
2199
|
-
) : /* @__PURE__ */ o(
|
|
2200
|
-
},
|
|
2201
|
-
Skeleton:
|
|
2202
|
-
Source:
|
|
2203
|
-
Target:
|
|
2204
|
-
}),
|
|
2222
|
+
) : /* @__PURE__ */ o(Pe, { heading: r, onMsg: t });
|
|
2223
|
+
}, jr = ({ token: e, heading: t, ...r }) => e ? /* @__PURE__ */ o(Ue, { ...r, token: e, heading: t }) : /* @__PURE__ */ o(Pe, { onMsg: r.onMsg, heading: t }), pl = Object.assign(jr, {
|
|
2224
|
+
Skeleton: As,
|
|
2225
|
+
Source: Hr,
|
|
2226
|
+
Target: Gr
|
|
2227
|
+
}), Pt = ({
|
|
2205
2228
|
token: e,
|
|
2206
2229
|
balance: t,
|
|
2207
2230
|
showBalance: r = !0,
|
|
2208
2231
|
isNotSelectable: s,
|
|
2209
|
-
|
|
2210
|
-
|
|
2232
|
+
isFocused: n,
|
|
2233
|
+
className: a,
|
|
2234
|
+
onMsg: c
|
|
2211
2235
|
}) => {
|
|
2212
|
-
const { ctx:
|
|
2236
|
+
const { ctx: l } = _(), { walletSupportedChains: d, appName: u } = b(), i = Ss(t, e), f = d.includes(e.blockchain) || e.isIntent, p = t !== "0" && t !== 0 && t !== void 0;
|
|
2213
2237
|
return /* @__PURE__ */ o("li", { className: "list-none group", children: /* @__PURE__ */ h(
|
|
2214
2238
|
"div",
|
|
2215
2239
|
{
|
|
2216
|
-
className:
|
|
2240
|
+
className: K(
|
|
2217
2241
|
"gap-sw-lg p-sw-lg flex justify-between rounded-sw-md transition-colors",
|
|
2218
2242
|
{
|
|
2219
2243
|
"cursor-not-allowed": s,
|
|
2220
|
-
"cursor-pointer hover:bg-sw-gray-800": !s
|
|
2244
|
+
"cursor-pointer hover:bg-sw-gray-800": !s,
|
|
2245
|
+
"bg-sw-gray-800": n && !s
|
|
2221
2246
|
},
|
|
2222
|
-
|
|
2247
|
+
a
|
|
2223
2248
|
),
|
|
2224
|
-
onClick: () => !s &&
|
|
2249
|
+
onClick: () => !s && c({ type: "on_select_token", token: e }),
|
|
2225
2250
|
children: [
|
|
2226
2251
|
/* @__PURE__ */ o(
|
|
2227
|
-
|
|
2252
|
+
Et,
|
|
2228
2253
|
{
|
|
2229
2254
|
token: e,
|
|
2230
2255
|
chainShowIcon: !e.isIntent,
|
|
2231
|
-
className: "
|
|
2256
|
+
className: K("group-hover:border-sw-gray-800 transition-colors", {
|
|
2257
|
+
"border-sw-gray-800": n,
|
|
2258
|
+
"border-sw-gray-900": !n
|
|
2259
|
+
})
|
|
2232
2260
|
}
|
|
2233
2261
|
),
|
|
2234
2262
|
/* @__PURE__ */ h("div", { className: "gap-sw-xs mr-auto flex flex-col", children: [
|
|
@@ -2236,27 +2264,27 @@ const yr = ({ className: e }) => {
|
|
|
2236
2264
|
e.isIntent ? /* @__PURE__ */ h("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2237
2265
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2238
2266
|
" ",
|
|
2239
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${
|
|
2267
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${u} ${e.chainName.toLowerCase() !== "near" && p ? `(${e.chainName})` : ""}` })
|
|
2240
2268
|
] }) : /* @__PURE__ */ h("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2241
2269
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2242
2270
|
" ",
|
|
2243
2271
|
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${e.chainName}` })
|
|
2244
2272
|
] })
|
|
2245
2273
|
] }),
|
|
2246
|
-
|
|
2247
|
-
t === void 0 && !e.isIntent ? /* @__PURE__ */ o("span", { className: "h-[16px] w-[60px] animate-pulse rounded-full bg-sw-gray-700" }) : /* @__PURE__ */ o("span", { className: "h-[16px] text-sw-label-md text-sw-gray-50", children:
|
|
2248
|
-
|
|
2274
|
+
f && !!l.walletAddress && r && /* @__PURE__ */ h("div", { className: "gap-sw-xs flex flex-col items-end", children: [
|
|
2275
|
+
t === void 0 && !e.isIntent ? /* @__PURE__ */ o("span", { className: "h-[16px] w-[60px] animate-pulse rounded-full bg-sw-gray-700" }) : /* @__PURE__ */ o("span", { className: "h-[16px] text-sw-label-md text-sw-gray-50", children: p && /* @__PURE__ */ o(
|
|
2276
|
+
Le,
|
|
2249
2277
|
{
|
|
2250
2278
|
decimals: e.decimals,
|
|
2251
2279
|
value: t === void 0 ? "0" : `${t}`
|
|
2252
2280
|
}
|
|
2253
2281
|
) }),
|
|
2254
|
-
|
|
2282
|
+
p && /* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: i })
|
|
2255
2283
|
] })
|
|
2256
2284
|
]
|
|
2257
2285
|
}
|
|
2258
2286
|
) });
|
|
2259
|
-
},
|
|
2287
|
+
}, at = [
|
|
2260
2288
|
"nep141:eth-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near",
|
|
2261
2289
|
// cbBTC (eth)
|
|
2262
2290
|
"nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near",
|
|
@@ -2269,30 +2297,30 @@ const yr = ({ className: e }) => {
|
|
|
2269
2297
|
// NEAR (bsc)
|
|
2270
2298
|
"nep141:eth-0xe0f63a424a4439cbe457d80e4f4b51ad25b2c56c.omft.near"
|
|
2271
2299
|
// SPX (eth)
|
|
2272
|
-
],
|
|
2273
|
-
const { tokens: e } =
|
|
2300
|
+
], zr = () => {
|
|
2301
|
+
const { tokens: e } = M();
|
|
2274
2302
|
return {
|
|
2275
|
-
uniqueIntentsTokens:
|
|
2303
|
+
uniqueIntentsTokens: L(() => {
|
|
2276
2304
|
const t = e.filter(
|
|
2277
|
-
(n) => n.isIntent && n.blockchain === "near" && !
|
|
2278
|
-
), r = t.map((n) => n.isIntent && n.symbol), s = e.filter((n) => n.isIntent && n.blockchain !== "near" && !r.includes(n.symbol) && !
|
|
2305
|
+
(n) => n.isIntent && n.blockchain === "near" && !at.includes(n.assetId)
|
|
2306
|
+
), r = t.map((n) => n.isIntent && n.symbol), s = e.filter((n) => n.isIntent && n.blockchain !== "near" && !r.includes(n.symbol) && !at.includes(n.assetId));
|
|
2279
2307
|
return [...t, ...s];
|
|
2280
2308
|
}, [e])
|
|
2281
2309
|
};
|
|
2282
|
-
},
|
|
2310
|
+
}, Yr = ({
|
|
2283
2311
|
variant: e,
|
|
2284
2312
|
search: t,
|
|
2285
2313
|
selectedChain: r,
|
|
2286
2314
|
chainsFilter: s,
|
|
2287
2315
|
walletSupportedChains: n
|
|
2288
2316
|
}) => {
|
|
2289
|
-
|
|
2290
|
-
const { tokens: a } =
|
|
2317
|
+
cr(e);
|
|
2318
|
+
const { tokens: a } = M(e), { mergedBalance: c } = pe(), { intentBalances: l } = fe(), { uniqueIntentsTokens: d } = zr(), u = Ls(
|
|
2291
2319
|
c,
|
|
2292
2320
|
n,
|
|
2293
2321
|
t
|
|
2294
|
-
), i = a.filter(
|
|
2295
|
-
|
|
2322
|
+
), i = a.filter(Bs({ search: t })).filter(
|
|
2323
|
+
qs({
|
|
2296
2324
|
selectedChain: r,
|
|
2297
2325
|
chainsFilter: s,
|
|
2298
2326
|
walletSupportedChains: n,
|
|
@@ -2302,10 +2330,10 @@ const yr = ({ className: e }) => {
|
|
|
2302
2330
|
);
|
|
2303
2331
|
return {
|
|
2304
2332
|
all: i.sort(u),
|
|
2305
|
-
intents: i.filter(
|
|
2306
|
-
wallet: i.filter(
|
|
2333
|
+
intents: i.filter(Je({ isIntent: !0 })).sort(u),
|
|
2334
|
+
wallet: i.filter(Je({ isIntent: !1 })).sort(u)
|
|
2307
2335
|
};
|
|
2308
|
-
},
|
|
2336
|
+
}, Xr = ({
|
|
2309
2337
|
variant: e,
|
|
2310
2338
|
search: t,
|
|
2311
2339
|
className: r,
|
|
@@ -2316,32 +2344,39 @@ const yr = ({ className: e }) => {
|
|
|
2316
2344
|
chainIsNotSupported: l,
|
|
2317
2345
|
onMsg: d
|
|
2318
2346
|
}) => {
|
|
2319
|
-
const { t: u } =
|
|
2347
|
+
const { t: u } = $(), { ctx: i } = _(), { walletSupportedChains: f, appName: p } = b(), { mergedBalance: I } = pe(), m = Yr({
|
|
2320
2348
|
variant: e,
|
|
2321
2349
|
search: t,
|
|
2322
2350
|
chainsFilter: a,
|
|
2323
2351
|
selectedChain: c,
|
|
2324
2352
|
walletSupportedChains: f
|
|
2325
|
-
}), w = i.walletAddress ? s : !1,
|
|
2326
|
-
() => [{
|
|
2353
|
+
}), w = i.walletAddress ? s : !1, k = Os(m.all, t), y = X(null), [q, D] = te(-1), B = L(
|
|
2354
|
+
() => [{ tokens: m.all }],
|
|
2327
2355
|
[m.all]
|
|
2328
|
-
),
|
|
2329
|
-
|
|
2330
|
-
{ label:
|
|
2356
|
+
), S = L(() => [
|
|
2357
|
+
...m.intents.length > 0 ? [
|
|
2358
|
+
{ label: p, count: m.intents.length },
|
|
2359
|
+
{ tokens: m.intents }
|
|
2360
|
+
] : [],
|
|
2361
|
+
...m.wallet.length > 0 ? [
|
|
2331
2362
|
{
|
|
2332
2363
|
label: l ? null : "Connected wallet",
|
|
2333
|
-
|
|
2334
|
-
}
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
),
|
|
2338
|
-
(
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2364
|
+
count: m.wallet.length
|
|
2365
|
+
},
|
|
2366
|
+
{ tokens: m.wallet }
|
|
2367
|
+
] : []
|
|
2368
|
+
].filter(Boolean), [m.wallet, m.intents, l]), O = w ? S : B, re = xs(O), ae = Ds(O), Me = Rs(O), Mt = ie(() => {
|
|
2369
|
+
D(-1);
|
|
2370
|
+
}, []);
|
|
2371
|
+
switch (_s({
|
|
2372
|
+
listRef: y.current,
|
|
2373
|
+
initialFocusedIndex: w ? 1 : 0,
|
|
2374
|
+
onFocus: (P) => D(P),
|
|
2375
|
+
onBlur: Mt
|
|
2376
|
+
}), k) {
|
|
2342
2377
|
case "EMPTY_SEARCH":
|
|
2343
2378
|
return /* @__PURE__ */ o(
|
|
2344
|
-
|
|
2379
|
+
ye,
|
|
2345
2380
|
{
|
|
2346
2381
|
hasAction: !0,
|
|
2347
2382
|
actionType: "outlined",
|
|
@@ -2356,44 +2391,89 @@ const yr = ({ className: e }) => {
|
|
|
2356
2391
|
}
|
|
2357
2392
|
);
|
|
2358
2393
|
case "HAS_TOKENS":
|
|
2359
|
-
return /* @__PURE__ */ o("div", { className:
|
|
2360
|
-
|
|
2394
|
+
return /* @__PURE__ */ o("div", { className: K("gap-sw-lg flex flex-col", r), children: /* @__PURE__ */ o(
|
|
2395
|
+
Ns,
|
|
2361
2396
|
{
|
|
2397
|
+
ref: y,
|
|
2398
|
+
tabIndex: 0,
|
|
2399
|
+
id: Es,
|
|
2400
|
+
itemSize: bs,
|
|
2362
2401
|
className: "hide-scrollbar",
|
|
2363
2402
|
style: {
|
|
2364
|
-
maxHeight: L,
|
|
2365
2403
|
minHeight: 200,
|
|
2366
|
-
height:
|
|
2404
|
+
height: re,
|
|
2405
|
+
maxHeight: ys,
|
|
2406
|
+
overflowAnchor: "none",
|
|
2407
|
+
outline: "none"
|
|
2408
|
+
},
|
|
2409
|
+
onKeyDown: (P) => {
|
|
2410
|
+
if (y.current)
|
|
2411
|
+
switch (P.code) {
|
|
2412
|
+
case "ArrowUp": {
|
|
2413
|
+
P.preventDefault();
|
|
2414
|
+
let C = Math.max(q - 1, 0);
|
|
2415
|
+
w && Me.includes(C) && (C = C === 0 ? 1 : C - 1), D(C), y.current?.scrollToIndex(C, {
|
|
2416
|
+
align: "center",
|
|
2417
|
+
smooth: !0
|
|
2418
|
+
});
|
|
2419
|
+
break;
|
|
2420
|
+
}
|
|
2421
|
+
case "ArrowDown": {
|
|
2422
|
+
P.preventDefault();
|
|
2423
|
+
let C = Math.min(q + 1, ae - 1);
|
|
2424
|
+
w && Me.includes(C) && (C = C === 0 ? 1 : C + 1), D(C), y.current?.scrollToIndex(C, {
|
|
2425
|
+
align: "center",
|
|
2426
|
+
smooth: !0
|
|
2427
|
+
});
|
|
2428
|
+
break;
|
|
2429
|
+
}
|
|
2430
|
+
case "Enter": {
|
|
2431
|
+
P.preventDefault();
|
|
2432
|
+
const C = vs(O, q);
|
|
2433
|
+
C && d({ type: "on_select_token", token: C });
|
|
2434
|
+
break;
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2367
2437
|
},
|
|
2368
|
-
children:
|
|
2369
|
-
({ label:
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2438
|
+
children: O.map(
|
|
2439
|
+
({ label: P, count: C, tokens: Ve }, Qe) => {
|
|
2440
|
+
const Vt = Cs(
|
|
2441
|
+
O,
|
|
2442
|
+
Qe
|
|
2443
|
+
);
|
|
2444
|
+
return P !== void 0 ? P ? /* @__PURE__ */ h(
|
|
2445
|
+
"header",
|
|
2446
|
+
{
|
|
2447
|
+
className: "pb-sw-lg pt-sw-sm flex flex-col",
|
|
2448
|
+
children: [
|
|
2449
|
+
/* @__PURE__ */ o(Fs, {}),
|
|
2450
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm pt-sw-xl text-sw-gray-100", children: `${P} — ${C}` })
|
|
2451
|
+
]
|
|
2452
|
+
},
|
|
2453
|
+
P
|
|
2454
|
+
) : /* @__PURE__ */ o("header", {}, Qe) : Ve ? Ve.map(($e, Qt) => {
|
|
2455
|
+
const Ke = z($e);
|
|
2376
2456
|
return /* @__PURE__ */ o(
|
|
2377
|
-
|
|
2457
|
+
Pt,
|
|
2378
2458
|
{
|
|
2379
|
-
token:
|
|
2459
|
+
token: $e,
|
|
2380
2460
|
showBalance: n,
|
|
2381
|
-
balance: I[
|
|
2461
|
+
balance: I[Ke],
|
|
2462
|
+
isFocused: q === Vt + Qt,
|
|
2382
2463
|
isNotSelectable: l && !!i.walletAddress,
|
|
2383
2464
|
onMsg: d
|
|
2384
2465
|
},
|
|
2385
|
-
|
|
2466
|
+
Ke
|
|
2386
2467
|
);
|
|
2387
|
-
})
|
|
2388
|
-
|
|
2389
|
-
] }, k ?? "ungrouped-tokens")
|
|
2468
|
+
}) : null;
|
|
2469
|
+
}
|
|
2390
2470
|
)
|
|
2391
2471
|
}
|
|
2392
2472
|
) });
|
|
2393
2473
|
case "NO_TOKENS":
|
|
2394
2474
|
default:
|
|
2395
2475
|
return /* @__PURE__ */ o(
|
|
2396
|
-
|
|
2476
|
+
ye,
|
|
2397
2477
|
{
|
|
2398
2478
|
className: "pt-sw-5xl pb-sw-5xl",
|
|
2399
2479
|
subHeading: u(
|
|
@@ -2402,15 +2482,15 @@ const yr = ({ className: e }) => {
|
|
|
2402
2482
|
),
|
|
2403
2483
|
heading: u("tokens.list.noBalanceOnApp.label", {
|
|
2404
2484
|
defaultValue: "You have no balances on {{appName}}",
|
|
2405
|
-
appName:
|
|
2485
|
+
appName: p
|
|
2406
2486
|
})
|
|
2407
2487
|
}
|
|
2408
2488
|
);
|
|
2409
2489
|
}
|
|
2410
|
-
},
|
|
2411
|
-
Placeholder:
|
|
2412
|
-
Item:
|
|
2413
|
-
}),
|
|
2490
|
+
}, Tl = Object.assign(Xr, {
|
|
2491
|
+
Placeholder: ye,
|
|
2492
|
+
Item: Pt
|
|
2493
|
+
}), Zr = (e, t) => {
|
|
2414
2494
|
const r = t.assetId.substring(t.assetId.indexOf(":") + 1), s = (a) => {
|
|
2415
2495
|
const c = (u) => u.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, ""), l = c(t.amount), d = c(
|
|
2416
2496
|
a.amount.toLocaleString("en-US", {
|
|
@@ -2423,13 +2503,13 @@ const yr = ({ className: e }) => {
|
|
|
2423
2503
|
return (e.result.deposits || []).find(
|
|
2424
2504
|
(a) => a.chain === t.chainId && a.account_id === t.intentsAccountId && a.address === t.depositAddress && a.near_token_id === r && n(a) && s(a)
|
|
2425
2505
|
);
|
|
2426
|
-
},
|
|
2506
|
+
}, Jr = {
|
|
2427
2507
|
CREDITED: ee.status.PROCESSING,
|
|
2428
2508
|
PENDING: ee.status.PROCESSING,
|
|
2429
2509
|
COMPLETED: ee.status.SUCCESS,
|
|
2430
2510
|
FAILED: ee.status.FAILED
|
|
2431
|
-
},
|
|
2432
|
-
const { ctx: t } = _(), { intentsAccountType: r } =
|
|
2511
|
+
}, hl = ({ depositAddress: e }) => {
|
|
2512
|
+
const { ctx: t } = _(), { intentsAccountType: r } = b(), [s, n] = te(null), a = ne({
|
|
2433
2513
|
addressType: r,
|
|
2434
2514
|
walletAddress: t.walletAddress
|
|
2435
2515
|
});
|
|
@@ -2439,18 +2519,18 @@ const yr = ({ className: e }) => {
|
|
|
2439
2519
|
assetId: u
|
|
2440
2520
|
}) => {
|
|
2441
2521
|
if (!a)
|
|
2442
|
-
throw new
|
|
2443
|
-
let i =
|
|
2522
|
+
throw new V("Unknown intents account for POA deposit check");
|
|
2523
|
+
let i = pt[l];
|
|
2444
2524
|
if (!i)
|
|
2445
|
-
if (
|
|
2446
|
-
i =
|
|
2525
|
+
if (H(l))
|
|
2526
|
+
i = Tt;
|
|
2447
2527
|
else
|
|
2448
|
-
throw new
|
|
2528
|
+
throw new V(
|
|
2449
2529
|
`Unknown chain for POA deposit check ${l}`
|
|
2450
2530
|
);
|
|
2451
2531
|
const f = s ?? (/* @__PURE__ */ new Date()).toUTCString();
|
|
2452
2532
|
s || n(f);
|
|
2453
|
-
const
|
|
2533
|
+
const p = await wt.post("", {
|
|
2454
2534
|
id: 1,
|
|
2455
2535
|
jsonrpc: "2.0",
|
|
2456
2536
|
method: "recent_deposits",
|
|
@@ -2460,7 +2540,7 @@ const yr = ({ className: e }) => {
|
|
|
2460
2540
|
chain: i
|
|
2461
2541
|
}
|
|
2462
2542
|
]
|
|
2463
|
-
}), I =
|
|
2543
|
+
}), I = Zr(p.data, {
|
|
2464
2544
|
intentsAccountId: a,
|
|
2465
2545
|
initiatedAtDate: f,
|
|
2466
2546
|
depositAddress: e,
|
|
@@ -2469,7 +2549,7 @@ const yr = ({ className: e }) => {
|
|
|
2469
2549
|
amount: d
|
|
2470
2550
|
});
|
|
2471
2551
|
return I ? {
|
|
2472
|
-
status:
|
|
2552
|
+
status: Jr[I.status],
|
|
2473
2553
|
swapDetails: {
|
|
2474
2554
|
intentHashes: [""],
|
|
2475
2555
|
destinationChainTxHashes: [{ hash: I.tx_hash ?? "" }]
|
|
@@ -2482,39 +2562,39 @@ const yr = ({ className: e }) => {
|
|
|
2482
2562
|
}
|
|
2483
2563
|
};
|
|
2484
2564
|
} };
|
|
2485
|
-
},
|
|
2565
|
+
}, ea = (e, t, r) => {
|
|
2486
2566
|
let s = document.body;
|
|
2487
2567
|
r instanceof HTMLElement && (s = r), Object.entries(e).forEach(([n, a]) => {
|
|
2488
2568
|
s.style.setProperty(`--c-sw-${t}-${n}`, a);
|
|
2489
2569
|
});
|
|
2490
|
-
},
|
|
2491
|
-
const a =
|
|
2492
|
-
a &&
|
|
2493
|
-
},
|
|
2570
|
+
}, ot = (e, t, r, s, n) => {
|
|
2571
|
+
const a = Us(s, n, t);
|
|
2572
|
+
a && ea(a, e, r);
|
|
2573
|
+
}, ta = (e, t) => {
|
|
2494
2574
|
const { primaryColor: r, surfaceColor: s, colorScheme: n = "dark" } = t;
|
|
2495
|
-
r &&
|
|
2496
|
-
},
|
|
2497
|
-
const { themeParentElementSelector: r } =
|
|
2575
|
+
r && ot("accent", 500, e, r, n), s && ot("gray", 950, e, s, n);
|
|
2576
|
+
}, na = dt(void 0), sa = ({ children: e, theme: t }) => {
|
|
2577
|
+
const { themeParentElementSelector: r } = b(), s = L(() => t, [t]);
|
|
2498
2578
|
return R(() => {
|
|
2499
2579
|
if (t) {
|
|
2500
2580
|
const n = r ? document.querySelector(r) : null;
|
|
2501
|
-
|
|
2581
|
+
ta(n, t);
|
|
2502
2582
|
}
|
|
2503
|
-
}, [t]), /* @__PURE__ */ o(
|
|
2504
|
-
},
|
|
2583
|
+
}, [t]), /* @__PURE__ */ o(na.Provider, { value: s, children: /* @__PURE__ */ o("div", { className: "sw", children: e }) });
|
|
2584
|
+
}, Ie = ({
|
|
2505
2585
|
text: e,
|
|
2506
2586
|
icon: t
|
|
2507
2587
|
}) => /* @__PURE__ */ h("li", { className: "flex items-center gap-sw-md", children: [
|
|
2508
2588
|
t && /* @__PURE__ */ o(t, { size: 20, className: "text-sw-gray-300" }),
|
|
2509
2589
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-50", children: e })
|
|
2510
|
-
] }),
|
|
2590
|
+
] }), it = ({
|
|
2511
2591
|
label: e,
|
|
2512
2592
|
icon: t,
|
|
2513
2593
|
className: r
|
|
2514
2594
|
}) => /* @__PURE__ */ h(
|
|
2515
2595
|
"div",
|
|
2516
2596
|
{
|
|
2517
|
-
className:
|
|
2597
|
+
className: K(
|
|
2518
2598
|
"rounded-sw-lg flex align-center justify-center gap-sw-md w-full py-sw-2xl",
|
|
2519
2599
|
r
|
|
2520
2600
|
),
|
|
@@ -2523,10 +2603,10 @@ const yr = ({ className: e }) => {
|
|
|
2523
2603
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md", children: e })
|
|
2524
2604
|
]
|
|
2525
2605
|
}
|
|
2526
|
-
),
|
|
2527
|
-
const { t: s } =
|
|
2528
|
-
|
|
2529
|
-
const a =
|
|
2606
|
+
), ra = ({ isSigned: e, isSigning: t, onMsg: r }) => {
|
|
2607
|
+
const { t: s } = $(), n = () => r({ type: "on_close" });
|
|
2608
|
+
Rt("Escape", n);
|
|
2609
|
+
const a = Ks({
|
|
2530
2610
|
endTime: 0,
|
|
2531
2611
|
autostart: !1,
|
|
2532
2612
|
timerType: "DECREMENTAL",
|
|
@@ -2535,15 +2615,15 @@ const yr = ({ className: e }) => {
|
|
|
2535
2615
|
});
|
|
2536
2616
|
return R(() => {
|
|
2537
2617
|
e ? a.start() : a.reset();
|
|
2538
|
-
}, [e]), /* @__PURE__ */ h(
|
|
2618
|
+
}, [e]), /* @__PURE__ */ h(me, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2539
2619
|
/* @__PURE__ */ o(
|
|
2540
|
-
|
|
2620
|
+
Ct,
|
|
2541
2621
|
{
|
|
2542
2622
|
onClick: n,
|
|
2543
2623
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2544
2624
|
}
|
|
2545
2625
|
),
|
|
2546
|
-
/* @__PURE__ */ o(
|
|
2626
|
+
/* @__PURE__ */ o(Ps, { size: 48, className: "text-sw-status-warning" }),
|
|
2547
2627
|
/* @__PURE__ */ h("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2548
2628
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: s(
|
|
2549
2629
|
"walletCompatibility.modal.title.initial",
|
|
@@ -2556,50 +2636,50 @@ const yr = ({ className: e }) => {
|
|
|
2556
2636
|
] }),
|
|
2557
2637
|
/* @__PURE__ */ h("ul", { className: "flex flex-col gap-sw-xl", children: [
|
|
2558
2638
|
/* @__PURE__ */ o(
|
|
2559
|
-
|
|
2639
|
+
Ie,
|
|
2560
2640
|
{
|
|
2561
2641
|
text: s(
|
|
2562
2642
|
"walletCompatibility.modal.feature.secureTransactions",
|
|
2563
2643
|
"Read-only signature – no gas required."
|
|
2564
2644
|
),
|
|
2565
|
-
icon:
|
|
2645
|
+
icon: Ws
|
|
2566
2646
|
}
|
|
2567
2647
|
),
|
|
2568
2648
|
/* @__PURE__ */ o(
|
|
2569
|
-
|
|
2649
|
+
Ie,
|
|
2570
2650
|
{
|
|
2571
2651
|
text: s(
|
|
2572
2652
|
"walletCompatibility.modal.feature.fullAccess",
|
|
2573
2653
|
"No access to your funds, no hidden permissions."
|
|
2574
2654
|
),
|
|
2575
|
-
icon:
|
|
2655
|
+
icon: Ms
|
|
2576
2656
|
}
|
|
2577
2657
|
),
|
|
2578
2658
|
/* @__PURE__ */ o(
|
|
2579
|
-
|
|
2659
|
+
Ie,
|
|
2580
2660
|
{
|
|
2581
2661
|
text: s(
|
|
2582
2662
|
"walletCompatibility.modal.feature.fundProtection",
|
|
2583
2663
|
"Only checks whether your wallet is supported."
|
|
2584
2664
|
),
|
|
2585
|
-
icon:
|
|
2665
|
+
icon: Vs
|
|
2586
2666
|
}
|
|
2587
2667
|
)
|
|
2588
2668
|
] }),
|
|
2589
2669
|
e ? /* @__PURE__ */ h("div", { className: "flex flex-col gap-sw-xl mt-sw-lg w-full", children: [
|
|
2590
2670
|
/* @__PURE__ */ o(
|
|
2591
|
-
|
|
2671
|
+
it,
|
|
2592
2672
|
{
|
|
2593
2673
|
label: s(
|
|
2594
2674
|
"walletCompatibility.modal.button.verified",
|
|
2595
2675
|
"Wallet verified"
|
|
2596
2676
|
),
|
|
2597
2677
|
className: "bg-sw-status-success text-sw-gray-950",
|
|
2598
|
-
icon:
|
|
2678
|
+
icon: Qs
|
|
2599
2679
|
}
|
|
2600
2680
|
),
|
|
2601
2681
|
a.status === "RUNNING" && /* @__PURE__ */ o(
|
|
2602
|
-
|
|
2682
|
+
it,
|
|
2603
2683
|
{
|
|
2604
2684
|
className: "text-sw-gray-400",
|
|
2605
2685
|
label: s("walletCompatibility.modal.button.closeTimer", {
|
|
@@ -2633,17 +2713,17 @@ const yr = ({ className: e }) => {
|
|
|
2633
2713
|
)
|
|
2634
2714
|
] })
|
|
2635
2715
|
] });
|
|
2636
|
-
},
|
|
2637
|
-
const { t } =
|
|
2638
|
-
return
|
|
2716
|
+
}, aa = ({ onMsg: e }) => {
|
|
2717
|
+
const { t } = $(), r = () => e({ type: "on_close" });
|
|
2718
|
+
return Rt("Escape", r), /* @__PURE__ */ h(me, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2639
2719
|
/* @__PURE__ */ o(
|
|
2640
|
-
|
|
2720
|
+
Ct,
|
|
2641
2721
|
{
|
|
2642
2722
|
onClick: r,
|
|
2643
2723
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2644
2724
|
}
|
|
2645
2725
|
),
|
|
2646
|
-
/* @__PURE__ */ o(
|
|
2726
|
+
/* @__PURE__ */ o($s, { size: 48, className: "text-sw-status-error" }),
|
|
2647
2727
|
/* @__PURE__ */ h("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2648
2728
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: t(
|
|
2649
2729
|
"walletCompatibility.modal.title.error",
|
|
@@ -2679,58 +2759,58 @@ const yr = ({ className: e }) => {
|
|
|
2679
2759
|
)
|
|
2680
2760
|
] })
|
|
2681
2761
|
] });
|
|
2682
|
-
},
|
|
2683
|
-
Error:
|
|
2684
|
-
}),
|
|
2685
|
-
if (t instanceof
|
|
2762
|
+
}, gl = Object.assign(ra, {
|
|
2763
|
+
Error: aa
|
|
2764
|
+
}), oa = (e) => null, ia = (e) => (t) => {
|
|
2765
|
+
if (t instanceof V)
|
|
2686
2766
|
throw t;
|
|
2687
|
-
const r = new
|
|
2767
|
+
const r = new V(
|
|
2688
2768
|
t instanceof Error ? t.message : "Unknown error",
|
|
2689
2769
|
{ cause: t }
|
|
2690
2770
|
);
|
|
2691
2771
|
throw r.context = e, r;
|
|
2692
|
-
},
|
|
2772
|
+
}, la = ({ children: e }) => {
|
|
2693
2773
|
const { ctx: t } = _();
|
|
2694
2774
|
return /* @__PURE__ */ o(
|
|
2695
|
-
|
|
2775
|
+
js,
|
|
2696
2776
|
{
|
|
2697
|
-
FallbackComponent:
|
|
2698
|
-
onError:
|
|
2777
|
+
FallbackComponent: oa,
|
|
2778
|
+
onError: ia(t),
|
|
2699
2779
|
children: e
|
|
2700
2780
|
}
|
|
2701
2781
|
);
|
|
2702
|
-
},
|
|
2782
|
+
}, ca = new Jt({
|
|
2703
2783
|
defaultOptions: {
|
|
2704
2784
|
queries: {
|
|
2705
2785
|
staleTime: 2e3 * 60,
|
|
2706
|
-
retry:
|
|
2786
|
+
retry: lt.env.NODE_ENV === "test" ? !1 : 3
|
|
2707
2787
|
}
|
|
2708
2788
|
}
|
|
2709
|
-
}),
|
|
2789
|
+
}), da = ["fms", "abg", "stjack", "noear", "testnebula"], de = {
|
|
2710
2790
|
appName: "Unknown",
|
|
2711
2791
|
slippageTolerance: 100,
|
|
2712
2792
|
// 1%
|
|
2713
2793
|
intentsAccountType: "evm",
|
|
2714
|
-
walletSupportedChains:
|
|
2794
|
+
walletSupportedChains: dn,
|
|
2715
2795
|
connectedWallets: {},
|
|
2716
2796
|
enableAutoTokensSwitching: !0,
|
|
2717
2797
|
showIntentTokens: !0,
|
|
2718
|
-
chainsOrder:
|
|
2719
|
-
filterTokens: (e) => !
|
|
2798
|
+
chainsOrder: ft,
|
|
2799
|
+
filterTokens: (e) => !da.includes(e.symbol.toLocaleLowerCase()),
|
|
2720
2800
|
chainsFilter: {
|
|
2721
2801
|
source: { external: "wallet-supported", intents: "none" },
|
|
2722
2802
|
target: { external: "all", intents: "none" }
|
|
2723
2803
|
}
|
|
2724
|
-
},
|
|
2725
|
-
config:
|
|
2726
|
-
}),
|
|
2727
|
-
config:
|
|
2728
|
-
}),
|
|
2729
|
-
const e =
|
|
2730
|
-
return
|
|
2731
|
-
},
|
|
2732
|
-
|
|
2733
|
-
},
|
|
2804
|
+
}, Wt = dt({
|
|
2805
|
+
config: de
|
|
2806
|
+
}), We = ct({
|
|
2807
|
+
config: de
|
|
2808
|
+
}), b = () => {
|
|
2809
|
+
const e = Yt(Wt);
|
|
2810
|
+
return ue(e).config;
|
|
2811
|
+
}, ua = (e) => {
|
|
2812
|
+
We.config = we(e);
|
|
2813
|
+
}, Il = ({
|
|
2734
2814
|
children: e,
|
|
2735
2815
|
config: t,
|
|
2736
2816
|
balanceViaRpc: r = !0,
|
|
@@ -2739,110 +2819,109 @@ const yr = ({ className: e }) => {
|
|
|
2739
2819
|
rpcs: n,
|
|
2740
2820
|
theme: a
|
|
2741
2821
|
}) => {
|
|
2742
|
-
const c =
|
|
2743
|
-
|
|
2744
|
-
config:
|
|
2745
|
-
...
|
|
2822
|
+
const c = X(
|
|
2823
|
+
ct({
|
|
2824
|
+
config: we({
|
|
2825
|
+
...de,
|
|
2746
2826
|
...t
|
|
2747
2827
|
})
|
|
2748
2828
|
})
|
|
2749
2829
|
);
|
|
2750
2830
|
return R(() => {
|
|
2751
|
-
const l =
|
|
2752
|
-
...
|
|
2831
|
+
const l = we({
|
|
2832
|
+
...de,
|
|
2753
2833
|
...t
|
|
2754
2834
|
});
|
|
2755
|
-
Object.assign(c.current.config, l),
|
|
2756
|
-
}, [t]),
|
|
2757
|
-
/* @__PURE__ */ h(
|
|
2758
|
-
/* @__PURE__ */ h(
|
|
2835
|
+
Object.assign(c.current.config, l), ua(l);
|
|
2836
|
+
}, [t]), sn(s ?? {}), Gs("headlessui-portal-root", "sw"), /* @__PURE__ */ o(en, { client: ca, children: /* @__PURE__ */ o(nn, { i18n: Kt, children: /* @__PURE__ */ h(Wt.Provider, { value: c.current, children: [
|
|
2837
|
+
/* @__PURE__ */ h(Ht, { children: [
|
|
2838
|
+
/* @__PURE__ */ h(Gt, { children: [
|
|
2759
2839
|
/* @__PURE__ */ o("link", { rel: "preconnect", href: "https://rsms.me/" }),
|
|
2760
2840
|
/* @__PURE__ */ o("link", { rel: "stylesheet", href: "https://rsms.me/inter/inter.css" })
|
|
2761
2841
|
] }),
|
|
2762
|
-
/* @__PURE__ */ o(
|
|
2842
|
+
/* @__PURE__ */ o(sa, { theme: a, children: lt.env.NODE_ENV === "test" ? e : /* @__PURE__ */ o(la, { children: e }) })
|
|
2763
2843
|
] }),
|
|
2764
2844
|
r && /* @__PURE__ */ o(
|
|
2765
|
-
|
|
2845
|
+
ir,
|
|
2766
2846
|
{
|
|
2767
|
-
rpcs: n ??
|
|
2847
|
+
rpcs: n ?? Hs,
|
|
2768
2848
|
connectedWallets: t.connectedWallets ?? {}
|
|
2769
2849
|
}
|
|
2770
2850
|
)
|
|
2771
2851
|
] }) }) });
|
|
2772
2852
|
};
|
|
2773
2853
|
export {
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2819
|
-
|
|
2820
|
-
|
|
2821
|
-
qe as ai,
|
|
2854
|
+
Rr as $,
|
|
2855
|
+
hl as A,
|
|
2856
|
+
ir as B,
|
|
2857
|
+
na as C,
|
|
2858
|
+
er as D,
|
|
2859
|
+
et as E,
|
|
2860
|
+
dr as F,
|
|
2861
|
+
ur as G,
|
|
2862
|
+
mr as H,
|
|
2863
|
+
fr as I,
|
|
2864
|
+
hr as J,
|
|
2865
|
+
xt as K,
|
|
2866
|
+
Ot as L,
|
|
2867
|
+
Bt as M,
|
|
2868
|
+
Ft as N,
|
|
2869
|
+
Lt as O,
|
|
2870
|
+
gr as P,
|
|
2871
|
+
U as Q,
|
|
2872
|
+
Ir as R,
|
|
2873
|
+
Qr as S,
|
|
2874
|
+
jr as T,
|
|
2875
|
+
wr as U,
|
|
2876
|
+
kr as V,
|
|
2877
|
+
Il as W,
|
|
2878
|
+
Ar as X,
|
|
2879
|
+
Sr as Y,
|
|
2880
|
+
Nr as Z,
|
|
2881
|
+
_r as _,
|
|
2882
|
+
ml as a,
|
|
2883
|
+
Cr as a0,
|
|
2884
|
+
vr as a1,
|
|
2885
|
+
xr as a2,
|
|
2886
|
+
$r as a3,
|
|
2887
|
+
Kr as a4,
|
|
2888
|
+
Ue as a5,
|
|
2889
|
+
Pe as a6,
|
|
2890
|
+
Ut as a7,
|
|
2891
|
+
Hr as a8,
|
|
2892
|
+
Gr as a9,
|
|
2893
|
+
Pt as aa,
|
|
2894
|
+
zr as ab,
|
|
2895
|
+
Xr as ac,
|
|
2896
|
+
sa as ad,
|
|
2897
|
+
ra as ae,
|
|
2898
|
+
aa as af,
|
|
2899
|
+
la as ag,
|
|
2900
|
+
We as ah,
|
|
2822
2901
|
_ as b,
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2902
|
+
dl as c,
|
|
2903
|
+
cr as d,
|
|
2904
|
+
ar as e,
|
|
2905
|
+
fe as f,
|
|
2906
|
+
Lr as g,
|
|
2907
|
+
Tr as h,
|
|
2908
|
+
Br as i,
|
|
2909
|
+
Dr as j,
|
|
2910
|
+
pe as k,
|
|
2911
|
+
Ur as l,
|
|
2912
|
+
Yr as m,
|
|
2913
|
+
M as n,
|
|
2914
|
+
fl as o,
|
|
2915
|
+
pl as p,
|
|
2916
|
+
Tl as q,
|
|
2917
|
+
yr as r,
|
|
2918
|
+
qt as s,
|
|
2919
|
+
vt as t,
|
|
2920
|
+
Z as u,
|
|
2921
|
+
V as v,
|
|
2843
2922
|
g as w,
|
|
2844
|
-
|
|
2845
|
-
y,
|
|
2846
|
-
|
|
2923
|
+
ul as x,
|
|
2924
|
+
b as y,
|
|
2925
|
+
gl as z
|
|
2847
2926
|
};
|
|
2848
|
-
//# sourceMappingURL=config-
|
|
2927
|
+
//# sourceMappingURL=config-VpsP2eLV.js.map
|