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