@aurora-is-near/intents-swap-widget 3.19.1 → 3.20.0
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-CpXS2LPZ.js → config-ZkO5GwI_.js} +794 -782
- package/dist/{config-CpXS2LPZ.js.map → config-ZkO5GwI_.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/ChainsSelector/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/SuccessScreen/useSummaryItemsCount.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.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- 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/tailwind.css +0 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/theme.css +6 -5
- package/dist/types/theme.d.ts +4 -0
- 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/tailwind.css +0 -1
- package/src/theme/ThemeProvider.tsx +47 -8
- package/src/theme.css +6 -5
- package/src/types/theme.ts +6 -0
|
@@ -1,88 +1,88 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { jsx as o, jsxs as T, Fragment as
|
|
3
|
-
import
|
|
4
|
-
import { deepClone as
|
|
5
|
-
import { snapshot as
|
|
6
|
-
import { HelmetProvider as
|
|
7
|
-
import { memo as
|
|
8
|
-
import { useQuery as
|
|
9
|
-
import { Trans as
|
|
10
|
-
import { useTypedTranslation as K, initLocalisation as
|
|
1
|
+
import { p as dt } from "./index-xuotMAFm.js";
|
|
2
|
+
import { jsx as o, jsxs as T, Fragment as Gt } from "react/jsx-runtime";
|
|
3
|
+
import jt from "i18next";
|
|
4
|
+
import { deepClone as Se } from "valtio/utils";
|
|
5
|
+
import { snapshot as Ce, useSnapshot as fe, proxy as ut } from "valtio";
|
|
6
|
+
import { HelmetProvider as zt, Helmet as Yt } from "react-helmet-async";
|
|
7
|
+
import { memo as Xt, useEffect as R, useMemo as L, useRef as Z, useCallback as ce, useState as ne, useId as Zt, createContext as mt, useContext as Jt } from "react";
|
|
8
|
+
import { useQuery as ve, useInfiniteQuery as en, useQueryClient as tn, QueryClient as nn, QueryClientProvider as rn } from "@tanstack/react-query";
|
|
9
|
+
import { Trans as sn, I18nextProvider as an } from "react-i18next";
|
|
10
|
+
import { useTypedTranslation as K, initLocalisation as on } from "./localisation.js";
|
|
11
11
|
import { logger as E } from "./logger.js";
|
|
12
|
-
import { getTonTokenBalance as
|
|
12
|
+
import { getTonTokenBalance as ln } from "./utils/ton/getTonTokenBalance.js";
|
|
13
13
|
import { getSolanaTokenBalance as cn } from "./utils/solana/getSolanaTokenBalance.js";
|
|
14
|
-
import { useWalletAddressForToken as
|
|
14
|
+
import { useWalletAddressForToken as ft } from "./hooks/useWalletAddressForToken.js";
|
|
15
15
|
import "@headlessui/react";
|
|
16
16
|
import "@material-symbols-svg/react-rounded/icons/chevron-left";
|
|
17
17
|
import "framer-motion";
|
|
18
18
|
import "./features/ChainsDropdown/ChainItem.js";
|
|
19
19
|
import { cn as H } from "./utils/cn.js";
|
|
20
|
-
import { OneClickService as
|
|
21
|
-
import { CHAINS_LIST as
|
|
20
|
+
import { OneClickService as dn, QuoteRequest as W, GetExecutionStatusResponse as te } from "@defuse-protocol/one-click-sdk-typescript";
|
|
21
|
+
import { CHAINS_LIST as pt, DEFAULT_CHAINS_ORDER as ht, CHAIN_POA_MAP as Tt, POA_EVM_CHAIN_ID as gt, CHAIN_BASE_TOKENS as un, EVM_CHAIN_IDS_MAP as Ne, CHAIN_IDS_MAP as mn, EVM_CHAINS as fn } from "./constants/chains.js";
|
|
22
22
|
import "use-debounce";
|
|
23
23
|
import "@material-symbols-svg/react-rounded/icons/wand-shine";
|
|
24
|
-
import { derive as
|
|
25
|
-
import { getIsNativeNearDeposit as
|
|
26
|
-
import { getIsDirectTokenOnNearDeposit as
|
|
24
|
+
import { derive as pn } from "derive-valtio";
|
|
25
|
+
import { getIsNativeNearDeposit as hn } from "./machine/computed/getIsNativeNearDeposit.js";
|
|
26
|
+
import { getIsDirectTokenOnNearDeposit as Tn } from "./machine/computed/getIsDirectTokenOnNearDeposit.js";
|
|
27
27
|
import "ethers";
|
|
28
28
|
import { moveTo as F, machine as ee } from "./machine/machine.js";
|
|
29
|
-
import
|
|
29
|
+
import gn from "lodash.once";
|
|
30
30
|
import { guardStates as O } from "./machine/guards/index.js";
|
|
31
|
-
import { parse as
|
|
32
|
-
import { createLoader as
|
|
33
|
-
import { isAlchemySupportedChain as
|
|
31
|
+
import { parse as In } from "./ext/alchemy/parse.js";
|
|
32
|
+
import { createLoader as wn } from "./ext/alchemy/load.js";
|
|
33
|
+
import { isAlchemySupportedChain as kn } from "./ext/alchemy/types.js";
|
|
34
34
|
import { fireEvent as h } from "./machine/events/utils/fireEvent.js";
|
|
35
|
-
import { NATIVE_NEAR_DUMB_ASSET_ID as j, TOKENS_DATA as
|
|
36
|
-
import { isValidChain as
|
|
37
|
-
import { useWalletBalance as
|
|
35
|
+
import { NATIVE_NEAR_DUMB_ASSET_ID as j, TOKENS_DATA as De, WNEAR_ASSET_ID as _e } from "./constants/tokens.js";
|
|
36
|
+
import { isValidChain as An } from "./utils/checkers/isValidChain.js";
|
|
37
|
+
import { useWalletBalance as xe } from "./hooks/useWalletBalance.js";
|
|
38
38
|
import { getIntentsAccountId as re } from "./utils/intents/getIntentsAccountId.js";
|
|
39
|
-
import { getIntentsBalances as
|
|
40
|
-
import { notReachable as
|
|
39
|
+
import { getIntentsBalances as Sn } from "./utils/intents/getIntentsBalance.js";
|
|
40
|
+
import { notReachable as Oe } from "./utils/notReachable.js";
|
|
41
41
|
import { getTokenBalanceKey as Y } from "./utils/intents/getTokenBalanceKey.js";
|
|
42
|
-
import { isDryQuote as
|
|
43
|
-
import { snakeCase as
|
|
44
|
-
import
|
|
45
|
-
import { oneClickApi as
|
|
42
|
+
import { isDryQuote as Fe } from "./machine/guards/checks/isDryQuote.js";
|
|
43
|
+
import { snakeCase as It } from "change-case";
|
|
44
|
+
import Nn, { CanceledError as wt, AxiosError as kt } from "axios";
|
|
45
|
+
import { oneClickApi as ye, bridgeApi as At } from "./network.js";
|
|
46
46
|
import { formatBigToHuman as X } from "./utils/formatters/formatBigToHuman.js";
|
|
47
|
-
import { getDryQuoteAddress as
|
|
47
|
+
import { getDryQuoteAddress as ze } from "./utils/getDryQuoteAddress.js";
|
|
48
48
|
import { isEvmChain as G } from "./utils/evm/isEvmChain.js";
|
|
49
|
-
import { checkNearAccountExists as
|
|
49
|
+
import { checkNearAccountExists as _n } from "./utils/near/checkNearAccountExists.js";
|
|
50
50
|
import { isNotEmptyAmount as se } from "./utils/checkers/isNotEmptyAmount.js";
|
|
51
|
-
import { isValidBigint as
|
|
52
|
-
import { isNearAddress as
|
|
53
|
-
import { isBalanceSufficient as
|
|
54
|
-
import { isQuoteError as
|
|
55
|
-
import { isSolanaAddress as
|
|
56
|
-
import { isEvmAddress as
|
|
57
|
-
import { getMainTokenByChain as
|
|
58
|
-
import { getDefaultIntentsToken as
|
|
59
|
-
import { getTokenWithHighBalance as
|
|
60
|
-
import { isQuoteIdle as
|
|
61
|
-
import { isInputChanged as
|
|
62
|
-
import { isErrorChanged as
|
|
63
|
-
import { isOnlyErrorChanged as
|
|
64
|
-
import { isValidInitialState as
|
|
65
|
-
import { isWalletDisconnected as
|
|
66
|
-
import { isSendAddressForbidden as
|
|
67
|
-
import { isAmountChangedFromQuote as
|
|
68
|
-
import { reset as
|
|
69
|
-
import { tokenSelectRotate as
|
|
70
|
-
import { errorSet as
|
|
71
|
-
import { quoteSet as
|
|
72
|
-
import { addressSet as
|
|
73
|
-
import { tokenSetAmount as
|
|
74
|
-
import { quoteSetStatus as
|
|
75
|
-
import { depositTypeSet as
|
|
76
|
-
import { externalDepositTxSet as
|
|
77
|
-
import { setInputsValidating as
|
|
78
|
-
import { walletAddressSet as
|
|
79
|
-
import { tokenSetBalance as
|
|
80
|
-
import { transferSetStatus as
|
|
81
|
-
import { getUsdTradeDelta as
|
|
82
|
-
import { getIsDirectNonNearWithdrawal as
|
|
83
|
-
import { getIsDirectTokenOnNearTransfer as
|
|
84
|
-
import { getIsDirectNearTokenWithdrawal as
|
|
85
|
-
import { getIsSameAssetDiffChainWithdrawal as
|
|
51
|
+
import { isValidBigint as St } from "./utils/checkers/isValidBigint.js";
|
|
52
|
+
import { isNearAddress as Nt } from "./utils/near/isNearAddress.js";
|
|
53
|
+
import { isBalanceSufficient as Le } from "./machine/guards/checks/isBalanceSufficient.js";
|
|
54
|
+
import { isQuoteError as Be, isTransferError as qe, isAsyncSendAddressValidationError as yn } from "./machine/errors.js";
|
|
55
|
+
import { isSolanaAddress as _t } from "./utils/solana/isSolanaAddress.js";
|
|
56
|
+
import { isEvmAddress as yt } from "./utils/evm/isEvmAddress.js";
|
|
57
|
+
import { getMainTokenByChain as bn } from "./utils/tokens/getMainTokenByChain.js";
|
|
58
|
+
import { getDefaultIntentsToken as En } from "./utils/tokens/getDefaultIntentsToken.js";
|
|
59
|
+
import { getTokenWithHighBalance as Rn } from "./utils/tokens/getTokenWithHighBalance.js";
|
|
60
|
+
import { isQuoteIdle as Cn } from "./machine/subscriptions/checkers/isQuoteIdle.js";
|
|
61
|
+
import { isInputChanged as vn } from "./machine/subscriptions/checkers/isInputChanged.js";
|
|
62
|
+
import { isErrorChanged as Dn } from "./machine/subscriptions/checkers/isErrorChanged.js";
|
|
63
|
+
import { isOnlyErrorChanged as xn } from "./machine/subscriptions/checkers/isOnlyErrorChanged.js";
|
|
64
|
+
import { isValidInitialState as On } from "./machine/subscriptions/checkers/isValidInitialState.js";
|
|
65
|
+
import { isWalletDisconnected as Fn } from "./machine/subscriptions/checkers/isWalletDisconnected.js";
|
|
66
|
+
import { isSendAddressForbidden as Ln } from "./machine/subscriptions/checkers/isSendAddressForbidden.js";
|
|
67
|
+
import { isAmountChangedFromQuote as Bn } from "./machine/subscriptions/checkers/isAmountChangedFromQuote.js";
|
|
68
|
+
import { reset as qn } from "./machine/events/reset.js";
|
|
69
|
+
import { tokenSelectRotate as be } from "./machine/events/tokenSelectRotate.js";
|
|
70
|
+
import { errorSet as Un } from "./machine/events/errorSet.js";
|
|
71
|
+
import { quoteSet as Pn } from "./machine/events/quoteSet.js";
|
|
72
|
+
import { addressSet as Wn } from "./machine/events/addressSet.js";
|
|
73
|
+
import { tokenSetAmount as Vn } from "./machine/events/tokenSetAmount.js";
|
|
74
|
+
import { quoteSetStatus as Mn } from "./machine/events/quoteSetStatus.js";
|
|
75
|
+
import { depositTypeSet as Qn } from "./machine/events/depositTypeSet.js";
|
|
76
|
+
import { externalDepositTxSet as $n } from "./machine/events/externalDepositTxSet.js";
|
|
77
|
+
import { setInputsValidating as Kn } from "./machine/events/setInputsValidating.js";
|
|
78
|
+
import { walletAddressSet as Hn } from "./machine/events/walletAddressSet.js";
|
|
79
|
+
import { tokenSetBalance as Gn } from "./machine/events/tokenSetBalance.js";
|
|
80
|
+
import { transferSetStatus as jn } from "./machine/events/transferSetStatus.js";
|
|
81
|
+
import { getUsdTradeDelta as zn } from "./machine/computed/getUsdTradeDelta.js";
|
|
82
|
+
import { getIsDirectNonNearWithdrawal as Yn } from "./machine/computed/getIsDirectNonNearWithdrawal.js";
|
|
83
|
+
import { getIsDirectTokenOnNearTransfer as Xn } from "./machine/computed/getIsDirectTokenOnNearTransfer.js";
|
|
84
|
+
import { getIsDirectNearTokenWithdrawal as Zn } from "./machine/computed/getIsDirectNearTokenWithdrawal.js";
|
|
85
|
+
import { getIsSameAssetDiffChainWithdrawal as Jn } from "./machine/computed/getIsSameAssetDiffChainWithdrawal.js";
|
|
86
86
|
import "./components/Input.js";
|
|
87
87
|
import "@material-symbols-svg/react-rounded/icons/close";
|
|
88
88
|
import "@material-symbols-svg/react-rounded/icons/emergency";
|
|
@@ -90,128 +90,128 @@ import "@material-symbols-svg/react-rounded/icons/error";
|
|
|
90
90
|
import "@material-symbols-svg/react-rounded/icons/verified";
|
|
91
91
|
import "viem";
|
|
92
92
|
import { Button as A } from "./components/Button.js";
|
|
93
|
-
import { TinyNumber as
|
|
93
|
+
import { TinyNumber as Ue } from "./components/TinyNumber.js";
|
|
94
94
|
import { ErrorMessage as z } from "./components/ErrorMessage.js";
|
|
95
|
-
import { FT_DEPOSIT_GAS as
|
|
96
|
-
import { a as
|
|
95
|
+
import { FT_DEPOSIT_GAS as Ye, FT_TRANSFER_GAS as Xe } from "./utils/near/config.js";
|
|
96
|
+
import { a as Pe } from "./index-DEq3oXQF.js";
|
|
97
97
|
import { z as oe } from "zod";
|
|
98
|
-
import { decodeQueryResult as
|
|
99
|
-
import { nearRpcClient as
|
|
100
|
-
import { getNearNep141MinStorageBalance as
|
|
101
|
-
import { isErrorLikeObject as
|
|
102
|
-
import { isUserDeniedSigning as
|
|
103
|
-
import { INTENTS_CONTRACT as
|
|
104
|
-
import { isEvmBaseToken as
|
|
105
|
-
import { useMakeEvmTransfer as
|
|
106
|
-
import { useMakeSolanaTransfer as
|
|
107
|
-
import { createIntentSignerNEP413 as
|
|
108
|
-
import { generateRandomBytes as
|
|
109
|
-
import { IntentSignerSolana as
|
|
110
|
-
import { localStorageTyped as
|
|
111
|
-
import { queryContract as
|
|
112
|
-
import { utils as
|
|
113
|
-
import { getTransactionLink as
|
|
114
|
-
import { switchEthereumChain as
|
|
98
|
+
import { decodeQueryResult as er } from "./utils/near/decodeQueryResult.js";
|
|
99
|
+
import { nearRpcClient as tr } from "./utils/near/rpc.js";
|
|
100
|
+
import { getNearNep141MinStorageBalance as nr } from "./utils/near/getNearNep141MinStorageBalance.js";
|
|
101
|
+
import { isErrorLikeObject as de } from "./utils/isErrorLikeObject.js";
|
|
102
|
+
import { isUserDeniedSigning as ue } from "./utils/checkers/isUserDeniedSigning.js";
|
|
103
|
+
import { INTENTS_CONTRACT as Ee } from "./constants/intents.js";
|
|
104
|
+
import { isEvmBaseToken as bt } from "./utils/evm/isEvmBaseToken.js";
|
|
105
|
+
import { useMakeEvmTransfer as rr } from "./hooks/useMakeEvmTransfer.js";
|
|
106
|
+
import { useMakeSolanaTransfer as sr } from "./hooks/useMakeSolanaTransfer.js";
|
|
107
|
+
import { createIntentSignerNEP413 as ar, IntentsSDK as or, createNearWithdrawalRoute as ir, createInternalTransferRoute as lr, MinWithdrawalAmountError as cr, FeeExceedsAmountError as dr } from "@defuse-protocol/intents-sdk";
|
|
108
|
+
import { generateRandomBytes as ur } from "./utils/near/getRandomBytes.js";
|
|
109
|
+
import { IntentSignerSolana as mr } from "./utils/intents/signers/solana.js";
|
|
110
|
+
import { localStorageTyped as Ze } from "./utils/localstorage.js";
|
|
111
|
+
import { queryContract as fr } from "./utils/near/queryContract.js";
|
|
112
|
+
import { utils as Je } from "@defuse-protocol/internal-utils";
|
|
113
|
+
import { getTransactionLink as pr } from "./utils/formatters/getTransactionLink.js";
|
|
114
|
+
import { switchEthereumChain as hr } from "./utils/evm/switchEthereumChain.js";
|
|
115
115
|
import "@material-symbols-svg/react-rounded/w700";
|
|
116
116
|
import "copy-text-to-clipboard";
|
|
117
117
|
import "@material-symbols-svg/react-rounded/icons/content-copy";
|
|
118
|
-
import { Notes as
|
|
118
|
+
import { Notes as ge } from "./components/Notes.js";
|
|
119
119
|
import "@material-symbols-svg/react-rounded/icons/progress-activity";
|
|
120
120
|
import "bs58";
|
|
121
121
|
import "viem/chains";
|
|
122
122
|
import "browser-or-node";
|
|
123
|
-
import { SwapQuoteSkeleton as
|
|
124
|
-
import { Accordion as
|
|
125
|
-
import { formatUsdAmount as
|
|
126
|
-
import { formatTinyNumber as
|
|
127
|
-
import
|
|
128
|
-
import { Skeleton as
|
|
129
|
-
import { getBalancePortion as
|
|
130
|
-
import { getUsdDisplayAmount as
|
|
131
|
-
import { TokenInputHeading as
|
|
132
|
-
import { noop as
|
|
133
|
-
import { Card as
|
|
134
|
-
import { Badge as
|
|
135
|
-
import { TokenIcon as
|
|
136
|
-
import { InputAmount as
|
|
137
|
-
import { TokenInputSkeleton as
|
|
138
|
-
import { getUsdDisplayBalance as
|
|
139
|
-
import { VList as
|
|
140
|
-
import { useFocusOnList as
|
|
141
|
-
import { TokensListPlaceholder as
|
|
142
|
-
import { MAX_LIST_VIEW_AREA_HEIGHT as
|
|
143
|
-
import { getGroupHeadersTotalIndexes as
|
|
144
|
-
import { getFirstGroupItemTotalIndex as
|
|
145
|
-
import { getListItemsTotalCount as
|
|
146
|
-
import { getTokenByTotalIndex as
|
|
147
|
-
import { getListTotalHeight as
|
|
148
|
-
import { getListState as
|
|
149
|
-
import { Hr as
|
|
150
|
-
import { createTokenSorter as
|
|
151
|
-
import { createFilterByIntents as
|
|
152
|
-
import { createFilterBySearch as
|
|
153
|
-
import { createFilterBySelectedChain as
|
|
123
|
+
import { SwapQuoteSkeleton as Et } from "./features/SwapQuote/SwapQuoteSkeleton.js";
|
|
124
|
+
import { Accordion as Tr } from "./components/Accordion.js";
|
|
125
|
+
import { formatUsdAmount as et } from "./utils/formatters/formatUsdAmount.js";
|
|
126
|
+
import { formatTinyNumber as gr } from "./utils/formatters/formatTinyNumber.js";
|
|
127
|
+
import Ir from "clsx";
|
|
128
|
+
import { Skeleton as wr } from "./components/Skeleton.js";
|
|
129
|
+
import { getBalancePortion as kr } from "./features/TokenInput/utils/getBalancePortion.js";
|
|
130
|
+
import { getUsdDisplayAmount as Ar } from "./features/TokenInput/utils/getUsdDisplayAmount.js";
|
|
131
|
+
import { TokenInputHeading as Rt } from "./features/TokenInput/TokenInputHeading.js";
|
|
132
|
+
import { noop as Sr } from "./utils/noop.js";
|
|
133
|
+
import { Card as pe } from "./components/Card.js";
|
|
134
|
+
import { Badge as tt } from "./components/Badge.js";
|
|
135
|
+
import { TokenIcon as Ct } from "./components/TokenIcon.js";
|
|
136
|
+
import { InputAmount as Nr } from "./components/InputAmount.js";
|
|
137
|
+
import { TokenInputSkeleton as _r } from "./features/TokenInput/TokenInputSkeleton.js";
|
|
138
|
+
import { getUsdDisplayBalance as yr } from "./utils/formatters/getUsdDisplayBalance.js";
|
|
139
|
+
import { VList as br } from "virtua";
|
|
140
|
+
import { useFocusOnList as Er } from "./features/TokensList/hooks/useFocusOnList.js";
|
|
141
|
+
import { TokensListPlaceholder as Re } from "./features/TokensList/TokensListPlaceholder.js";
|
|
142
|
+
import { MAX_LIST_VIEW_AREA_HEIGHT as Rr, TOKEN_ITEM_HEIGHT as Cr, LIST_CONTAINER_ID as vr } from "./features/TokensList/constants.js";
|
|
143
|
+
import { getGroupHeadersTotalIndexes as Dr } from "./features/TokensList/utils/getGroupHeadersTotalIndexes.js";
|
|
144
|
+
import { getFirstGroupItemTotalIndex as xr } from "./features/TokensList/utils/getFirstGroupItemTotalIndex.js";
|
|
145
|
+
import { getListItemsTotalCount as Or } from "./features/TokensList/utils/getListItemsTotalCount.js";
|
|
146
|
+
import { getTokenByTotalIndex as Fr } from "./features/TokensList/utils/getTokenByTotalIndex.js";
|
|
147
|
+
import { getListTotalHeight as Lr } from "./features/TokensList/utils/getListTotalHeight.js";
|
|
148
|
+
import { getListState as Br } from "./features/TokensList/utils/getListState.js";
|
|
149
|
+
import { Hr as qr } from "./components/Hr.js";
|
|
150
|
+
import { createTokenSorter as Ur } from "./utils/tokens/sort.js";
|
|
151
|
+
import { createFilterByIntents as nt } from "./utils/tokens/filterByIntents.js";
|
|
152
|
+
import { createFilterBySearch as Pr } from "./utils/tokens/filterBySearchString.js";
|
|
153
|
+
import { createFilterBySelectedChain as Wr } from "./utils/tokens/filterBySelectedChain.js";
|
|
154
154
|
import "@material-symbols-svg/react-rounded/icons/search";
|
|
155
155
|
import "./components/ChainShortcut.js";
|
|
156
156
|
import "@material-symbols-svg/react-rounded/icons/arrow-downward";
|
|
157
157
|
import "qrcode.react";
|
|
158
158
|
import "@material-symbols-svg/react-rounded/icons/cached";
|
|
159
|
-
import { CheckCircleFillW700 as
|
|
160
|
-
import { createColorPalette as
|
|
159
|
+
import { CheckCircleFillW700 as Vr } from "@material-symbols-svg/react-rounded/icons/check-circle";
|
|
160
|
+
import { createColorPalette as Mr } from "./theme/createColorPalette.js";
|
|
161
161
|
import "@material-symbols-svg/react-rounded/icons/qr-code";
|
|
162
162
|
import "@material-symbols-svg/react-rounded/icons/wallet";
|
|
163
|
-
import { AccountBalanceWalletFillW700 as
|
|
164
|
-
import { ArmingCountdownFillW700 as
|
|
165
|
-
import { BeenhereFillW700 as
|
|
166
|
-
import { EncryptedFillW700 as
|
|
167
|
-
import { GppBadFillW700 as
|
|
168
|
-
import { useTimer as
|
|
169
|
-
import { useHandleKeyDown as
|
|
170
|
-
import { CloseButton as
|
|
171
|
-
import { DEFAULT_RPCS as
|
|
172
|
-
import { useAddClassToPortal as
|
|
173
|
-
import { ErrorBoundary as
|
|
174
|
-
import { isEvmToken as
|
|
175
|
-
import { getEvmMainTokenBalance as
|
|
176
|
-
import { getNativeNearBalance as
|
|
177
|
-
import { getNearTokenBalance as
|
|
178
|
-
import { getEvmTokenBalance as
|
|
179
|
-
function
|
|
180
|
-
const { walletSupportedChains: r, tonCenterApiKey: n, alchemyApiKey: a } = y(), { walletAddress:
|
|
181
|
-
return
|
|
163
|
+
import { AccountBalanceWalletFillW700 as Qr } from "@material-symbols-svg/react-rounded/icons/account-balance-wallet";
|
|
164
|
+
import { ArmingCountdownFillW700 as $r } from "@material-symbols-svg/react-rounded/icons/arming-countdown";
|
|
165
|
+
import { BeenhereFillW700 as Kr } from "@material-symbols-svg/react-rounded/icons/beenhere";
|
|
166
|
+
import { EncryptedFillW700 as Hr } from "@material-symbols-svg/react-rounded/icons/encrypted";
|
|
167
|
+
import { GppBadFillW700 as Gr } from "@material-symbols-svg/react-rounded/icons/gpp-bad";
|
|
168
|
+
import { useTimer as jr } from "use-timer";
|
|
169
|
+
import { useHandleKeyDown as vt } from "./hooks/useHandleKeyDown.js";
|
|
170
|
+
import { CloseButton as Dt } from "./components/CloseButton.js";
|
|
171
|
+
import { DEFAULT_RPCS as zr } from "./rpcs.js";
|
|
172
|
+
import { useAddClassToPortal as Yr } from "./hooks/useAddClassToPortal.js";
|
|
173
|
+
import { ErrorBoundary as Xr } from "react-error-boundary";
|
|
174
|
+
import { isEvmToken as Zr } from "./utils/evm/isEvmToken.js";
|
|
175
|
+
import { getEvmMainTokenBalance as Jr } from "./utils/evm/getEvmMainTokenBalance.js";
|
|
176
|
+
import { getNativeNearBalance as es } from "./utils/near/getNativeNearBalance.js";
|
|
177
|
+
import { getNearTokenBalance as ts } from "./utils/near/getNearTokenBalance.js";
|
|
178
|
+
import { getEvmTokenBalance as ns } from "./utils/evm/getEvmTokenBalance.js";
|
|
179
|
+
function rs({ rpcs: e, token: t, connectedWallets: s }) {
|
|
180
|
+
const { walletSupportedChains: r, tonCenterApiKey: n, alchemyApiKey: a } = y(), { walletAddress: c } = ft(s, t);
|
|
181
|
+
return ve({
|
|
182
182
|
retry: 2,
|
|
183
|
-
enabled: !!
|
|
183
|
+
enabled: !!c && Object.keys(e).includes(t.blockchain),
|
|
184
184
|
queryKey: ["tokenBalance", t.assetId, s],
|
|
185
185
|
queryFn: async () => {
|
|
186
|
-
if (!
|
|
186
|
+
if (!c)
|
|
187
187
|
return null;
|
|
188
188
|
if (t.blockchain === "near" && r.includes(t.blockchain))
|
|
189
|
-
return !e.near || e.near.length === 0 ? null : t.assetId === j ?
|
|
189
|
+
return !e.near || e.near.length === 0 ? null : t.assetId === j ? es(c, e.near) : ts(t, c, e.near);
|
|
190
190
|
if (!r.includes("eth") && G(t.blockchain))
|
|
191
191
|
return null;
|
|
192
|
-
if (G(t.blockchain) &&
|
|
193
|
-
const
|
|
194
|
-
return
|
|
192
|
+
if (G(t.blockchain) && bt(t)) {
|
|
193
|
+
const l = e[t.blockchain] ?? [];
|
|
194
|
+
return l.length > 0 ? Jr(c, l[0]) : null;
|
|
195
195
|
}
|
|
196
|
-
if (
|
|
197
|
-
const
|
|
198
|
-
return
|
|
196
|
+
if (Zr(t) || G(t.blockchain)) {
|
|
197
|
+
const l = e[t.blockchain] ?? [];
|
|
198
|
+
return l.length > 0 ? ns(t, c, l[0]) : null;
|
|
199
199
|
}
|
|
200
|
-
return t.blockchain === "ton" ?
|
|
200
|
+
return t.blockchain === "ton" ? ln(t, c, n) : t.blockchain === "sol" && r.includes(t.blockchain) ? cn(t, c, a) : (E.warn(
|
|
201
201
|
`Failed to fetch token balance for ${t.symbol} on ${t.blockchain}`
|
|
202
202
|
), null);
|
|
203
203
|
}
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const ss = ({
|
|
207
207
|
rpcs: e,
|
|
208
208
|
token: t,
|
|
209
209
|
onBalancesLoaded: s
|
|
210
210
|
}) => (R(() => {
|
|
211
211
|
t.isIntent || !Object.keys(e).includes(t.blockchain) || s({ [t.assetId]: "0" });
|
|
212
|
-
}, [t.assetId]), null),
|
|
212
|
+
}, [t.assetId]), null), xt = Xt(
|
|
213
213
|
({ rpcs: e, token: t, connectedWallets: s, onBalancesLoaded: r }) => {
|
|
214
|
-
const { data: n } =
|
|
214
|
+
const { data: n } = rs({
|
|
215
215
|
rpcs: e,
|
|
216
216
|
token: t,
|
|
217
217
|
connectedWallets: s
|
|
@@ -222,51 +222,51 @@ const rs = ({
|
|
|
222
222
|
},
|
|
223
223
|
(e, t) => e.token.assetId === t.token.assetId && e.connectedWallets === t.connectedWallets
|
|
224
224
|
);
|
|
225
|
-
|
|
226
|
-
const
|
|
227
|
-
Zero:
|
|
228
|
-
}),
|
|
225
|
+
xt.displayName = "TokenBalanceLoader";
|
|
226
|
+
const rt = Object.assign(xt, {
|
|
227
|
+
Zero: ss
|
|
228
|
+
}), as = (e) => {
|
|
229
229
|
const t = e.toLowerCase();
|
|
230
|
-
return
|
|
231
|
-
},
|
|
230
|
+
return De[t]?.icon ?? "";
|
|
231
|
+
}, os = (e) => `${e?.charAt(0).toUpperCase()}${e?.slice(1)}`, is = (e) => De[e]?.name ?? e, V = (e) => {
|
|
232
232
|
const {
|
|
233
233
|
showIntentTokens: t,
|
|
234
234
|
allowedTokensList: s,
|
|
235
235
|
allowedSourceTokensList: r,
|
|
236
236
|
allowedTargetTokensList: n,
|
|
237
237
|
filterTokens: a,
|
|
238
|
-
fetchSourceTokens:
|
|
239
|
-
fetchTargetTokens:
|
|
240
|
-
} = y(), { data: d, ...
|
|
238
|
+
fetchSourceTokens: c,
|
|
239
|
+
fetchTargetTokens: l
|
|
240
|
+
} = y(), { data: d, ...u } = ve({
|
|
241
241
|
queryKey: ["tokens", e].filter(Boolean),
|
|
242
|
-
queryFn: async () => e === "source" &&
|
|
242
|
+
queryFn: async () => e === "source" && c ? c() : e === "target" && l ? l() : dn.getTokens()
|
|
243
243
|
}), i = L(() => {
|
|
244
244
|
if (!d)
|
|
245
245
|
return [];
|
|
246
|
-
const
|
|
246
|
+
const m = d.map((f) => {
|
|
247
247
|
const g = f.blockchain.toLowerCase();
|
|
248
|
-
return !
|
|
248
|
+
return !An(g) || s && !s.includes(f.assetId) || e === "source" && r && !r.includes(f.assetId) || e === "target" && n && !n.includes(f.assetId) ? null : {
|
|
249
249
|
assetId: f.assetId,
|
|
250
250
|
symbol: f.symbol,
|
|
251
251
|
decimals: f.decimals,
|
|
252
252
|
price: f.price,
|
|
253
253
|
blockchain: g,
|
|
254
254
|
isIntent: !1,
|
|
255
|
-
icon: f.icon ??
|
|
256
|
-
name:
|
|
257
|
-
chainName:
|
|
255
|
+
icon: f.icon ?? as(f.symbol),
|
|
256
|
+
name: is(f.symbol),
|
|
257
|
+
chainName: pt[f.blockchain]?.label ?? os(f.blockchain),
|
|
258
258
|
contractAddress: f.contractAddress
|
|
259
259
|
};
|
|
260
|
-
}).filter((f) => !!f).filter(a ?? (() => !0)), p =
|
|
260
|
+
}).filter((f) => !!f).filter(a ?? (() => !0)), p = m.filter(
|
|
261
261
|
(f) => f.symbol.toLowerCase() !== "wnear"
|
|
262
|
-
), w =
|
|
262
|
+
), w = m.find((f) => f.symbol.toLowerCase() === "wnear");
|
|
263
263
|
return w && p.push({
|
|
264
264
|
name: "NEAR",
|
|
265
265
|
symbol: "NEAR",
|
|
266
266
|
chainName: "Near",
|
|
267
267
|
blockchain: "near",
|
|
268
268
|
assetId: j,
|
|
269
|
-
icon:
|
|
269
|
+
icon: De.near?.icon ?? "",
|
|
270
270
|
price: w?.price ?? 0,
|
|
271
271
|
contractAddress: w?.contractAddress,
|
|
272
272
|
isIntent: !1,
|
|
@@ -274,16 +274,16 @@ const tt = Object.assign(Dt, {
|
|
|
274
274
|
}), t ? [
|
|
275
275
|
...p,
|
|
276
276
|
// add intents tokens to the full list
|
|
277
|
-
...
|
|
277
|
+
...m.map(
|
|
278
278
|
(f) => f.symbol.toLowerCase() === "wnear" ? { ...f, symbol: "NEAR", name: "NEAR", isIntent: !0 } : { ...f, isIntent: !0 }
|
|
279
279
|
)
|
|
280
280
|
] : p;
|
|
281
281
|
}, [d, t, a]);
|
|
282
282
|
return {
|
|
283
|
-
...
|
|
283
|
+
...u,
|
|
284
284
|
tokens: i
|
|
285
285
|
};
|
|
286
|
-
},
|
|
286
|
+
}, ls = () => {
|
|
287
287
|
const { tokens: e } = V(), { tokens: t } = V("source"), { tokens: s } = V("target");
|
|
288
288
|
return { tokens: L(() => {
|
|
289
289
|
const n = {};
|
|
@@ -292,56 +292,56 @@ const tt = Object.assign(Dt, {
|
|
|
292
292
|
...t || [],
|
|
293
293
|
...s || []
|
|
294
294
|
].forEach((a) => {
|
|
295
|
-
const
|
|
296
|
-
n[
|
|
295
|
+
const c = `${a.assetId}-${a.isIntent}`;
|
|
296
|
+
n[c] = a;
|
|
297
297
|
}), Object.values(n);
|
|
298
298
|
}, [e, t, s]) };
|
|
299
|
-
},
|
|
299
|
+
}, Ie = [
|
|
300
300
|
{ eth: ["ETH", "USDT", "USDC", "AURORA"] },
|
|
301
301
|
{ near: ["USDT", "USDC", "AURORA"] },
|
|
302
302
|
{ arb: ["ARB", "ETH", "USDT", "USDC"] },
|
|
303
303
|
{ btc: ["BTC"] }
|
|
304
304
|
], cs = (e) => [...e].sort((t, s) => {
|
|
305
|
-
const r =
|
|
305
|
+
const r = Ie.findIndex(
|
|
306
306
|
(d) => Object.keys(d)[0] === t.blockchain
|
|
307
|
-
), n =
|
|
307
|
+
), n = Ie.findIndex(
|
|
308
308
|
(d) => Object.keys(d)[0] === s.blockchain
|
|
309
309
|
);
|
|
310
310
|
if (r !== n)
|
|
311
311
|
return r === -1 ? 1 : n === -1 ? -1 : r - n;
|
|
312
|
-
const a =
|
|
313
|
-
return
|
|
314
|
-
}),
|
|
315
|
-
const { tokens: s } =
|
|
316
|
-
return L(() => cs(s), [s]).map((
|
|
317
|
-
|
|
312
|
+
const a = Ie[r]?.[t.blockchain] ?? [], c = a.indexOf(t.symbol), l = a.indexOf(s.symbol);
|
|
313
|
+
return c === -1 && l === -1 ? 0 : c === -1 ? 1 : l === -1 ? -1 : c - l;
|
|
314
|
+
}), ds = ({ rpcs: e, connectedWallets: t }) => {
|
|
315
|
+
const { tokens: s } = ls(), { walletSupportedChains: r } = y(), { setWalletBalance: n } = xe(t);
|
|
316
|
+
return L(() => cs(s), [s]).map((c) => r.includes(c.blockchain) ? /* @__PURE__ */ o(
|
|
317
|
+
rt,
|
|
318
318
|
{
|
|
319
319
|
rpcs: e,
|
|
320
|
-
token:
|
|
320
|
+
token: c,
|
|
321
321
|
connectedWallets: t,
|
|
322
|
-
onBalancesLoaded: (
|
|
322
|
+
onBalancesLoaded: (l) => n(t, l)
|
|
323
323
|
},
|
|
324
|
-
Y(
|
|
324
|
+
Y(c)
|
|
325
325
|
) : /* @__PURE__ */ o(
|
|
326
|
-
|
|
326
|
+
rt.Zero,
|
|
327
327
|
{
|
|
328
328
|
rpcs: e,
|
|
329
|
-
token:
|
|
330
|
-
onBalancesLoaded: (
|
|
329
|
+
token: c,
|
|
330
|
+
onBalancesLoaded: (l) => n(t, l)
|
|
331
331
|
},
|
|
332
|
-
Y(
|
|
332
|
+
Y(c)
|
|
333
333
|
));
|
|
334
334
|
};
|
|
335
|
-
function
|
|
335
|
+
function us(e, t) {
|
|
336
336
|
const s = Array.from(
|
|
337
|
-
/* @__PURE__ */ new Set([...t ?? [], ...
|
|
337
|
+
/* @__PURE__ */ new Set([...t ?? [], ...ht])
|
|
338
338
|
), r = new Map(s.map((n, a) => [n, a]));
|
|
339
339
|
return [...e].sort((n, a) => {
|
|
340
|
-
const
|
|
341
|
-
return
|
|
340
|
+
const c = r.has(n.id) ? r.get(n.id) : 1 / 0, l = r.has(a.id) ? r.get(a.id) : 1 / 0;
|
|
341
|
+
return c !== l ? c - l : n.id.localeCompare(a.id, void 0, { sensitivity: "base" });
|
|
342
342
|
});
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const ms = (e) => {
|
|
345
345
|
const {
|
|
346
346
|
chainsOrder: t,
|
|
347
347
|
allowedChainsList: s,
|
|
@@ -349,105 +349,105 @@ const us = (e) => {
|
|
|
349
349
|
allowedTargetChainsList: n
|
|
350
350
|
} = y(), { tokens: a } = V();
|
|
351
351
|
return L(() => {
|
|
352
|
-
const
|
|
353
|
-
new Set(a.map((
|
|
354
|
-
).filter((
|
|
355
|
-
return
|
|
352
|
+
const c = Array.from(
|
|
353
|
+
new Set(a.map((l) => pt[l.blockchain]))
|
|
354
|
+
).filter((l) => !(s && !s.includes(l.id) || e === "source" && r && !r.includes(l.id) || e === "target" && n && !n.includes(l.id)));
|
|
355
|
+
return us(c, t);
|
|
356
356
|
}, [a, t, s]);
|
|
357
|
-
},
|
|
357
|
+
}, st = 3, Ot = ({
|
|
358
358
|
connectedWallets: e,
|
|
359
359
|
alchemyApiKey: t,
|
|
360
360
|
...s
|
|
361
361
|
}) => {
|
|
362
|
-
const { ctx: r } = _(), { tokens: n } = V(), { walletSupportedChains: a } = y(), { setWalletBalance:
|
|
362
|
+
const { ctx: r } = _(), { tokens: n } = V(), { walletSupportedChains: a } = y(), { setWalletBalance: c } = xe(e), l = s.isEnabled && !!Object.values(e).length && a.length > 0, d = en({
|
|
363
363
|
initialPageParam: null,
|
|
364
|
-
enabled: !!
|
|
364
|
+
enabled: !!l && !!t,
|
|
365
365
|
queryKey: ["walletTokensBalance", e],
|
|
366
|
-
queryFn: async ({ pageParam: i }) =>
|
|
366
|
+
queryFn: async ({ pageParam: i }) => wn({ alchemyApiKey: t })({
|
|
367
367
|
pageParam: i ? `${i}` : null,
|
|
368
368
|
connectedWallets: e,
|
|
369
369
|
walletSupportedChains: a
|
|
370
370
|
}),
|
|
371
|
-
getNextPageParam: (i,
|
|
372
|
-
if (i.pageKey && !(
|
|
371
|
+
getNextPageParam: (i, m) => {
|
|
372
|
+
if (i.pageKey && !(m.length >= st))
|
|
373
373
|
return i.pageKey;
|
|
374
374
|
}
|
|
375
375
|
});
|
|
376
376
|
R(() => {
|
|
377
|
-
|
|
378
|
-
}, [
|
|
379
|
-
const
|
|
377
|
+
l && d.data && d.hasNextPage && d.data.pages.length < st && !d.isFetchingNextPage && d.fetchNextPage();
|
|
378
|
+
}, [l, d]);
|
|
379
|
+
const u = L(() => {
|
|
380
380
|
if (!d.data?.pages)
|
|
381
381
|
return {};
|
|
382
|
-
const i =
|
|
382
|
+
const i = In(
|
|
383
383
|
n,
|
|
384
|
-
d.data.pages.flatMap((
|
|
384
|
+
d.data.pages.flatMap((m) => m.data)
|
|
385
385
|
);
|
|
386
|
-
return n.forEach((
|
|
387
|
-
|
|
386
|
+
return n.forEach((m) => {
|
|
387
|
+
kn(m.blockchain) && !(m.assetId in i) && (i[m.assetId] = "0");
|
|
388
388
|
}), i;
|
|
389
389
|
}, [d.data, n]);
|
|
390
390
|
return R(() => {
|
|
391
|
-
O(r, ["initial_wallet"]) && (
|
|
392
|
-
}, [
|
|
391
|
+
O(r, ["initial_wallet"]) && (c(e, u), r.sourceToken && Object.keys(u).includes(r.sourceToken.assetId) && h("tokenSetBalance", u[r.sourceToken.assetId]));
|
|
392
|
+
}, [u]), {
|
|
393
393
|
status: d.status,
|
|
394
394
|
refetch: d.refetch,
|
|
395
|
-
balances:
|
|
395
|
+
balances: u
|
|
396
396
|
};
|
|
397
|
-
},
|
|
397
|
+
}, he = () => {
|
|
398
398
|
const { intentsAccountType: e } = y(), {
|
|
399
399
|
ctx: { walletAddress: t }
|
|
400
|
-
} = _(), { tokens: s } = V(), r = s.filter((
|
|
400
|
+
} = _(), { tokens: s } = V(), r = s.filter((l) => l.isIntent).map((l) => l.assetId), n = re({
|
|
401
401
|
walletAddress: t,
|
|
402
402
|
addressType: e
|
|
403
|
-
}), a =
|
|
403
|
+
}), a = ve({
|
|
404
404
|
enabled: !!t && !!n && s.length > 0,
|
|
405
405
|
queryKey: ["intentsBalances", n],
|
|
406
|
-
queryFn: async () => n ? await
|
|
407
|
-
}),
|
|
406
|
+
queryFn: async () => n ? await Sn(n, r) : {}
|
|
407
|
+
}), c = L(() => {
|
|
408
408
|
switch (a.status) {
|
|
409
409
|
case "error":
|
|
410
410
|
return E.error("Unable to load intents balances:", a.error), {};
|
|
411
411
|
case "success":
|
|
412
412
|
return Object.fromEntries(
|
|
413
|
-
Object.entries(a.data).map(([
|
|
414
|
-
`intent-${
|
|
413
|
+
Object.entries(a.data).map(([l, d]) => [
|
|
414
|
+
`intent-${l}`,
|
|
415
415
|
d
|
|
416
416
|
])
|
|
417
417
|
);
|
|
418
418
|
case "pending":
|
|
419
419
|
return {};
|
|
420
420
|
default:
|
|
421
|
-
return
|
|
421
|
+
return Oe(a, { throwError: !1 }), {};
|
|
422
422
|
}
|
|
423
423
|
}, [a]) ?? {};
|
|
424
424
|
return {
|
|
425
425
|
...a,
|
|
426
|
-
intentBalances:
|
|
426
|
+
intentBalances: c
|
|
427
427
|
};
|
|
428
|
-
},
|
|
428
|
+
}, fs = ({
|
|
429
429
|
isEnabled: e,
|
|
430
430
|
alchemyApiKey: t
|
|
431
431
|
}) => {
|
|
432
|
-
const { connectedWallets: s } = y(), { ctx: r } = _(), n =
|
|
432
|
+
const { connectedWallets: s } = y(), { ctx: r } = _(), n = tn(), { refetch: a } = he(), { refetch: c } = Ot({
|
|
433
433
|
isEnabled: e,
|
|
434
434
|
connectedWallets: s,
|
|
435
435
|
alchemyApiKey: t ?? ""
|
|
436
436
|
});
|
|
437
437
|
R(() => {
|
|
438
|
-
const
|
|
439
|
-
!e || !
|
|
438
|
+
const l = O(r, ["transfer_success"]);
|
|
439
|
+
!e || !l || (async () => (await a(), t && (await new Promise((d) => {
|
|
440
440
|
setTimeout(d, 1e4);
|
|
441
|
-
}), await
|
|
441
|
+
}), await c()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
|
|
442
442
|
}, [r.state, e, t]);
|
|
443
|
-
},
|
|
444
|
-
const { connectedWallets: e } = y(), { intentBalances: t } =
|
|
443
|
+
}, Te = () => {
|
|
444
|
+
const { connectedWallets: e } = y(), { intentBalances: t } = he(), { walletBalance: s } = xe(e);
|
|
445
445
|
return { mergedBalance: L(
|
|
446
446
|
() => ({ ...s, ...t }),
|
|
447
447
|
[s, t]
|
|
448
448
|
) };
|
|
449
|
-
},
|
|
450
|
-
const { ctx: t } = _(), { mergedBalance: s } =
|
|
449
|
+
}, ps = ({ isEnabled: e }) => {
|
|
450
|
+
const { ctx: t } = _(), { mergedBalance: s } = Te();
|
|
451
451
|
R(() => {
|
|
452
452
|
if (!e)
|
|
453
453
|
return;
|
|
@@ -458,7 +458,7 @@ const us = (e) => {
|
|
|
458
458
|
const r = Y(t.sourceToken);
|
|
459
459
|
h("tokenSetBalance", s[r]);
|
|
460
460
|
}, [s, t.sourceToken]);
|
|
461
|
-
},
|
|
461
|
+
}, at = {
|
|
462
462
|
// cbBTC (eth)
|
|
463
463
|
"nep141:eth-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near": "nep141:nbtc.bridge.near",
|
|
464
464
|
// cbBTC (base)
|
|
@@ -473,7 +473,7 @@ const us = (e) => {
|
|
|
473
473
|
"nep245:v2_1.omni.hot.tg:56_SZzgw3HSudhZcTwPWUTi2RJB19t": "nep141:wrap.near",
|
|
474
474
|
// BTC (near)
|
|
475
475
|
"nep141:btc.omft.near": "nep141:nbtc.bridge.near"
|
|
476
|
-
},
|
|
476
|
+
}, hs = ({
|
|
477
477
|
isEnabled: e
|
|
478
478
|
}) => {
|
|
479
479
|
const { ctx: t } = _(), { tokens: s } = V();
|
|
@@ -485,35 +485,35 @@ const us = (e) => {
|
|
|
485
485
|
return;
|
|
486
486
|
}
|
|
487
487
|
const { sourceToken: r } = t;
|
|
488
|
-
if (t.sourceToken.assetId in
|
|
489
|
-
const
|
|
490
|
-
(d) => d.isIntent && d.assetId ===
|
|
488
|
+
if (t.sourceToken.assetId in at) {
|
|
489
|
+
const l = s.find(
|
|
490
|
+
(d) => d.isIntent && d.assetId === at[r.assetId]
|
|
491
491
|
);
|
|
492
492
|
h("tokenSelect", {
|
|
493
493
|
variant: "target",
|
|
494
|
-
token:
|
|
494
|
+
token: l
|
|
495
495
|
});
|
|
496
496
|
return;
|
|
497
497
|
}
|
|
498
498
|
const n = s.find(
|
|
499
|
-
(
|
|
499
|
+
(l) => l.isIntent && l.symbol === r.symbol && l.blockchain === "near"
|
|
500
500
|
);
|
|
501
501
|
if (n) {
|
|
502
502
|
h("tokenSelect", { variant: "target", token: n });
|
|
503
503
|
return;
|
|
504
504
|
}
|
|
505
505
|
const a = s.find(
|
|
506
|
-
(
|
|
507
|
-
),
|
|
508
|
-
(
|
|
506
|
+
(l) => l.isIntent && l.assetId === r.assetId
|
|
507
|
+
), c = s.find(
|
|
508
|
+
(l) => l.isIntent && l.symbol === "USDC" && l.blockchain === "near"
|
|
509
509
|
);
|
|
510
510
|
h("tokenSelect", {
|
|
511
511
|
variant: "target",
|
|
512
|
-
token: a ??
|
|
512
|
+
token: a ?? c
|
|
513
513
|
});
|
|
514
514
|
}, [s, t.sourceToken]);
|
|
515
|
-
},
|
|
516
|
-
const { connectedWallets: t } = y(), { ctx: s, state: r } = _(), { walletAddress: n } =
|
|
515
|
+
}, Ts = ({ isEnabled: e }) => {
|
|
516
|
+
const { connectedWallets: t } = y(), { ctx: s, state: r } = _(), { walletAddress: n } = ft(
|
|
517
517
|
t,
|
|
518
518
|
s.sourceToken
|
|
519
519
|
);
|
|
@@ -522,28 +522,28 @@ const us = (e) => {
|
|
|
522
522
|
return;
|
|
523
523
|
h("walletAddressSet", n), O(s, ["initial_dry", "initial_wallet"]) && (r === "initial_wallet" && !n ? F("initial_dry") : r === "initial_dry" && n && F("initial_wallet"));
|
|
524
524
|
}, [e, n, s, r]);
|
|
525
|
-
},
|
|
525
|
+
}, gs = (e) => (["depositAddress"].forEach((t) => {
|
|
526
526
|
if (!(t in e))
|
|
527
527
|
return E.error(`Missing ${t} in quote response`), !1;
|
|
528
|
-
}), !0),
|
|
528
|
+
}), !0), Is = () => {
|
|
529
529
|
const { ctx: e } = _(), {
|
|
530
530
|
walletSupportedChains: t,
|
|
531
531
|
intentsAccountType: s,
|
|
532
532
|
appName: r,
|
|
533
533
|
appFees: n,
|
|
534
534
|
fetchQuote: a,
|
|
535
|
-
slippageTolerance:
|
|
536
|
-
} = y(),
|
|
537
|
-
const { signal: f } =
|
|
535
|
+
slippageTolerance: c
|
|
536
|
+
} = y(), l = Fe(e), d = Z(null), u = Z(new AbortController()), i = L(() => async (p, w) => {
|
|
537
|
+
const { signal: f } = u.current;
|
|
538
538
|
return a ? a(p, {
|
|
539
539
|
...w,
|
|
540
540
|
signal: f
|
|
541
|
-
}) : (await
|
|
541
|
+
}) : (await ye.post(
|
|
542
542
|
"https://1click.chaindefuser.com/v0/quote",
|
|
543
543
|
p,
|
|
544
544
|
{ signal: f }
|
|
545
545
|
)).data.quote;
|
|
546
|
-
}, [
|
|
546
|
+
}, [ye]);
|
|
547
547
|
return {
|
|
548
548
|
make: async ({
|
|
549
549
|
message: p,
|
|
@@ -560,16 +560,16 @@ const us = (e) => {
|
|
|
560
560
|
const S = `Unable to run quote in current state ${e.state}`;
|
|
561
561
|
throw E.error(`[WIDGET] ${S}`), new q({
|
|
562
562
|
code: "QUOTE_INVALID_INITIAL",
|
|
563
|
-
meta: { isDry:
|
|
563
|
+
meta: { isDry: l, message: S }
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
566
|
const k = re({
|
|
567
567
|
addressType: s,
|
|
568
|
-
walletAddress:
|
|
568
|
+
walletAddress: l ? (
|
|
569
569
|
// address on the target chain should be a dry quote recipient
|
|
570
|
-
|
|
570
|
+
ze(e.targetToken.blockchain)
|
|
571
571
|
) : e.walletAddress ?? ""
|
|
572
|
-
}), b = k && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), B = () =>
|
|
572
|
+
}), b = k && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), B = () => l ? ze(
|
|
573
573
|
e.sourceToken.blockchain,
|
|
574
574
|
e.sourceToken.isIntent
|
|
575
575
|
) : b ? k : e.walletAddress ?? "";
|
|
@@ -577,27 +577,27 @@ const us = (e) => {
|
|
|
577
577
|
const S = "No corresponding intents account to run a quote";
|
|
578
578
|
throw E.error(`[WIDGET] ${S}`), new q({
|
|
579
579
|
code: "QUOTE_INVALID_INITIAL",
|
|
580
|
-
meta: { isDry:
|
|
580
|
+
meta: { isDry: l, message: S }
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
|
-
d.current && (
|
|
583
|
+
d.current && (u.current.abort("Abort previous quote (auto)"), u.current = new AbortController());
|
|
584
584
|
let D;
|
|
585
585
|
const C = {
|
|
586
586
|
// Settings
|
|
587
|
-
dry:
|
|
588
|
-
slippageTolerance:
|
|
587
|
+
dry: l,
|
|
588
|
+
slippageTolerance: c,
|
|
589
589
|
deadline: new Date(Date.now() + 3600 * 1e3).toISOString(),
|
|
590
590
|
// 1 hour
|
|
591
591
|
swapType: w === "exact_out" ? W.swapType.EXACT_OUTPUT : W.swapType.EXACT_INPUT,
|
|
592
592
|
// Target
|
|
593
|
-
destinationAsset: e.targetToken.assetId === j ?
|
|
593
|
+
destinationAsset: e.targetToken.assetId === j ? _e : e.targetToken.assetId,
|
|
594
594
|
// Source
|
|
595
|
-
originAsset: e.sourceToken.assetId === j ?
|
|
595
|
+
originAsset: e.sourceToken.assetId === j ? _e : e.sourceToken.assetId,
|
|
596
596
|
amount: w === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount,
|
|
597
597
|
// Experimental
|
|
598
598
|
quoteWaitingTimeMs: 0
|
|
599
599
|
};
|
|
600
|
-
p && (C.customRecipientMsg = p), r && (C.referral =
|
|
600
|
+
p && (C.customRecipientMsg = p), r && (C.referral = It(r)), n && (C.appFees = [...n]);
|
|
601
601
|
try {
|
|
602
602
|
e.sourceToken.isIntent && e.targetToken.isIntent && (d.current = i(
|
|
603
603
|
{
|
|
@@ -623,11 +623,11 @@ const us = (e) => {
|
|
|
623
623
|
f
|
|
624
624
|
), D = await d.current;
|
|
625
625
|
} catch (S) {
|
|
626
|
-
if (S instanceof
|
|
626
|
+
if (S instanceof wt)
|
|
627
627
|
return;
|
|
628
628
|
E.error("Quote error: ", S);
|
|
629
629
|
let U = S instanceof Error ? S.message : "";
|
|
630
|
-
if (S instanceof
|
|
630
|
+
if (S instanceof kt) {
|
|
631
631
|
if (U = S.response?.data.message || U, U.includes("Amount is too low")) {
|
|
632
632
|
const Q = U.match(/\d+/), ae = Q ? Q[0] : void 0;
|
|
633
633
|
throw new q({
|
|
@@ -650,12 +650,12 @@ const us = (e) => {
|
|
|
650
650
|
}
|
|
651
651
|
});
|
|
652
652
|
}
|
|
653
|
-
return
|
|
653
|
+
return l ? {
|
|
654
654
|
dry: !0,
|
|
655
655
|
...D,
|
|
656
656
|
deadline: void 0,
|
|
657
657
|
depositAddress: void 0
|
|
658
|
-
} : (
|
|
658
|
+
} : (gs(D), {
|
|
659
659
|
dry: !1,
|
|
660
660
|
...D,
|
|
661
661
|
deadline: D.deadline,
|
|
@@ -663,14 +663,14 @@ const us = (e) => {
|
|
|
663
663
|
});
|
|
664
664
|
},
|
|
665
665
|
cancel: () => {
|
|
666
|
-
|
|
666
|
+
u.current.abort("Abort quote manually"), u.current = new AbortController();
|
|
667
667
|
}
|
|
668
668
|
};
|
|
669
|
-
},
|
|
669
|
+
}, ws = () => {
|
|
670
670
|
const { ctx: e } = _(), { intentsAccountType: t } = y(), { isNativeNearDeposit: s } = J(), r = re({
|
|
671
671
|
addressType: t,
|
|
672
672
|
walletAddress: e.walletAddress ?? ""
|
|
673
|
-
}), n = Z(null), a = Z(new AbortController()),
|
|
673
|
+
}), n = Z(null), a = Z(new AbortController()), c = L(() => async (d) => At.post(
|
|
674
674
|
"",
|
|
675
675
|
{
|
|
676
676
|
id: 1,
|
|
@@ -686,7 +686,7 @@ const us = (e) => {
|
|
|
686
686
|
{
|
|
687
687
|
signal: a.current.signal
|
|
688
688
|
}
|
|
689
|
-
), [
|
|
689
|
+
), [ye]);
|
|
690
690
|
return {
|
|
691
691
|
make: async () => {
|
|
692
692
|
if (!O(e, [
|
|
@@ -734,18 +734,18 @@ const us = (e) => {
|
|
|
734
734
|
});
|
|
735
735
|
}
|
|
736
736
|
n.current && (a.current.abort("Abort previous quote (auto)"), a.current = new AbortController());
|
|
737
|
-
let
|
|
738
|
-
if (!
|
|
737
|
+
let u = Tt[e.targetToken.blockchain];
|
|
738
|
+
if (!u)
|
|
739
739
|
if (G(e.targetToken.blockchain))
|
|
740
|
-
|
|
740
|
+
u = gt;
|
|
741
741
|
else
|
|
742
742
|
throw new q({
|
|
743
743
|
code: "QUOTE_INVALID_INITIAL",
|
|
744
744
|
meta: { isDry: !1, message: "Chain is not supported by POA" }
|
|
745
745
|
});
|
|
746
746
|
try {
|
|
747
|
-
return n.current =
|
|
748
|
-
chain:
|
|
747
|
+
return n.current = c({
|
|
748
|
+
chain: u,
|
|
749
749
|
accountId: r
|
|
750
750
|
}), {
|
|
751
751
|
depositAddress: (await n.current).data.result.address,
|
|
@@ -767,14 +767,14 @@ const us = (e) => {
|
|
|
767
767
|
dry: !1
|
|
768
768
|
};
|
|
769
769
|
} catch (i) {
|
|
770
|
-
if (i instanceof
|
|
770
|
+
if (i instanceof wt)
|
|
771
771
|
return;
|
|
772
|
-
if (E.error(i), i instanceof
|
|
773
|
-
const
|
|
772
|
+
if (E.error(i), i instanceof kt) {
|
|
773
|
+
const m = i.response?.data.message || i.message;
|
|
774
774
|
throw new q({
|
|
775
775
|
code: "QUOTE_FAILED",
|
|
776
776
|
meta: {
|
|
777
|
-
message:
|
|
777
|
+
message: m ?? "Failed to fetch quote. Please try again."
|
|
778
778
|
}
|
|
779
779
|
});
|
|
780
780
|
}
|
|
@@ -784,60 +784,60 @@ const us = (e) => {
|
|
|
784
784
|
a.current.abort("Abort quote manually"), a.current = new AbortController();
|
|
785
785
|
}
|
|
786
786
|
};
|
|
787
|
-
},
|
|
787
|
+
}, ot = (e) => {
|
|
788
788
|
h("errorSet", e), h("quoteSet", void 0), h("quoteSetStatus", "idle"), h("transferSetStatus", { status: "idle" });
|
|
789
|
-
},
|
|
789
|
+
}, it = async (e) => {
|
|
790
790
|
if (!e.sendAddress)
|
|
791
791
|
return;
|
|
792
792
|
let t = !1;
|
|
793
793
|
try {
|
|
794
|
-
h("setInputsValidating", !0), t = await
|
|
794
|
+
h("setInputsValidating", !0), t = await _n(e.sendAddress);
|
|
795
795
|
} catch {
|
|
796
|
-
|
|
796
|
+
ot({
|
|
797
797
|
code: "SEND_ADDRESS_IS_NOT_VERIFIED",
|
|
798
798
|
meta: { address: e.sendAddress, chain: "near" }
|
|
799
799
|
}), h("setInputsValidating", !1), F("initial_wallet");
|
|
800
800
|
return;
|
|
801
801
|
}
|
|
802
802
|
if (h("setInputsValidating", !1), !t) {
|
|
803
|
-
|
|
803
|
+
ot({
|
|
804
804
|
code: "SEND_ADDRESS_IS_NOT_FOUND",
|
|
805
805
|
meta: { address: e.sendAddress, chain: "near" }
|
|
806
806
|
}), F("initial_wallet");
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
|
-
e.error ?
|
|
810
|
-
},
|
|
809
|
+
e.error ? yn(e.error) && (h("errorSet", null), F("input_valid_external")) : F("input_valid_external");
|
|
810
|
+
}, Ft = (e) => {
|
|
811
811
|
const t = O(e, ["initial_dry"]), s = O(e, ["input_valid_dry"]);
|
|
812
812
|
if (!t && !s)
|
|
813
813
|
return;
|
|
814
814
|
let r;
|
|
815
|
-
return t && (e.sourceToken ? e.targetToken ? se(e.sourceTokenAmount) ? e.walletAddress && !
|
|
816
|
-
},
|
|
815
|
+
return t && (e.sourceToken ? e.targetToken ? se(e.sourceTokenAmount) ? e.walletAddress && !Le(e) && (r = { code: "SOURCE_BALANCE_INSUFFICIENT" }) : r = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : r = { code: "TARGET_TOKEN_IS_EMPTY" } : r = { code: "SOURCE_TOKEN_IS_EMPTY" }), !s && r ? h("errorSet", r) : e.error && !Be(e.error) && !qe(e.error) && h("errorSet", null), s && r?.code === "SOURCE_BALANCE_INSUFFICIENT" && h("errorSet", r), s;
|
|
816
|
+
}, Lt = (e) => {
|
|
817
817
|
const t = O(e, ["initial_wallet"]), s = O(e, ["input_valid_external"]);
|
|
818
818
|
if (!t && !s)
|
|
819
819
|
return;
|
|
820
820
|
const r = e.sourceTokenBalance;
|
|
821
821
|
let n;
|
|
822
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : se(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ?
|
|
822
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : se(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ? Nt(e.sendAddress) ? it(e) : n = {
|
|
823
823
|
code: "SEND_ADDRESS_IS_INVALID",
|
|
824
824
|
meta: { address: e.sendAddress, chain: "near" }
|
|
825
|
-
} : e.isDepositFromExternalWallet || (!r || !
|
|
826
|
-
},
|
|
825
|
+
} : e.isDepositFromExternalWallet || (!r || !St(r) ? n = { code: "INVALID_SOURCE_BALANCE" } : Le(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" }), s && e.targetToken.blockchain === "near" && it(e), !s && n ? h("errorSet", n) : e.error && !Be(e.error) && !qe(e.error) && h("errorSet", null), s;
|
|
826
|
+
}, Bt = (e) => {
|
|
827
827
|
const t = O(e, ["initial_wallet"]), s = O(e, ["input_valid_internal"]);
|
|
828
828
|
if (!t && !s)
|
|
829
829
|
return;
|
|
830
830
|
const r = e.sourceTokenBalance;
|
|
831
831
|
let n;
|
|
832
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? se(e.sourceTokenAmount) ? e.isDepositFromExternalWallet || (!r || !
|
|
833
|
-
},
|
|
834
|
-
const t =
|
|
832
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? se(e.sourceTokenAmount) ? e.isDepositFromExternalWallet || (!r || !St(r) ? n = { code: "INVALID_SOURCE_BALANCE" } : Le(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" }), !s && n ? h("errorSet", n) : e.error && !Be(e.error) && !qe(e.error) && h("errorSet", null), s;
|
|
833
|
+
}, qt = (e) => {
|
|
834
|
+
const t = Fe(e), s = !t && e.targetToken?.isIntent === !0, r = !t && e.targetToken?.isIntent === !1;
|
|
835
835
|
if (t) {
|
|
836
|
-
const n =
|
|
836
|
+
const n = Ft(e);
|
|
837
837
|
return F(n ? "input_valid_dry" : "initial_dry");
|
|
838
838
|
}
|
|
839
|
-
r &&
|
|
840
|
-
},
|
|
839
|
+
r && Lt(e) ? F("input_valid_external") : s && Bt(e) ? F("input_valid_internal") : F("initial_wallet");
|
|
840
|
+
}, ks = ({
|
|
841
841
|
isEnabled: e,
|
|
842
842
|
message: t,
|
|
843
843
|
type: s = "exact_in",
|
|
@@ -845,31 +845,31 @@ const us = (e) => {
|
|
|
845
845
|
}) => {
|
|
846
846
|
const { ctx: n } = _(), {
|
|
847
847
|
isNativeNearDeposit: a,
|
|
848
|
-
isDirectNonNearWithdrawal:
|
|
849
|
-
isDirectTokenOnNearDeposit:
|
|
848
|
+
isDirectNonNearWithdrawal: c,
|
|
849
|
+
isDirectTokenOnNearDeposit: l,
|
|
850
850
|
isDirectNearTokenWithdrawal: d,
|
|
851
|
-
isDirectTokenOnNearTransfer:
|
|
851
|
+
isDirectTokenOnNearTransfer: u,
|
|
852
852
|
isSameAssetDiffChainWithdrawal: i
|
|
853
|
-
} = J(),
|
|
853
|
+
} = J(), m = Fe(n), p = e && !n.areInputsValidating && (i || (l || a) && n.isDepositFromExternalWallet || !d && !c && !l && !u), { make: w, cancel: f } = Is(), { make: g, cancel: k } = ws(), b = Z(null), B = () => {
|
|
854
854
|
f(), k();
|
|
855
855
|
};
|
|
856
856
|
R(() => {
|
|
857
857
|
const C = O(n, ["input_valid_dry"]), S = O(n, ["input_valid_external"]), U = O(n, ["input_valid_internal"]);
|
|
858
|
-
(
|
|
859
|
-
}, [B,
|
|
858
|
+
(m && !C || !m && n.targetToken?.isIntent && !U || !m && !n.targetToken?.isIntent && !S || n.areInputsValidating) && B();
|
|
859
|
+
}, [B, m, n]);
|
|
860
860
|
const D = ce(
|
|
861
861
|
async (C) => {
|
|
862
862
|
try {
|
|
863
863
|
let S;
|
|
864
864
|
if (n.sourceToken?.assetId === n.targetToken?.assetId || a && n.isDepositFromExternalWallet) {
|
|
865
|
-
if (
|
|
865
|
+
if (m)
|
|
866
866
|
return;
|
|
867
867
|
h("quoteSetStatus", "pending"), S = await g();
|
|
868
868
|
} else
|
|
869
869
|
h("quoteSetStatus", "pending"), S = await w({ message: t, quoteType: s, options: C });
|
|
870
870
|
if (!S)
|
|
871
871
|
return;
|
|
872
|
-
if (h("quoteSetStatus", "success"), h("quoteSet", S), !
|
|
872
|
+
if (h("quoteSetStatus", "success"), h("quoteSet", S), !m && n.error?.code !== "SOURCE_BALANCE_INSUFFICIENT" && h("errorSet", null), h("tokenSetAmount", {
|
|
873
873
|
variant: "target",
|
|
874
874
|
amount: S.amountOut
|
|
875
875
|
}), n.state === "input_valid_dry") {
|
|
@@ -883,7 +883,7 @@ const us = (e) => {
|
|
|
883
883
|
h("quoteSetStatus", "idle"), h("quoteSet", void 0), h("errorSet", null);
|
|
884
884
|
return;
|
|
885
885
|
}
|
|
886
|
-
h("quoteSetStatus", "error"), h("quoteSet", void 0), h("errorSet", S.data),
|
|
886
|
+
h("quoteSetStatus", "error"), h("quoteSet", void 0), h("errorSet", S.data), qt(n);
|
|
887
887
|
return;
|
|
888
888
|
}
|
|
889
889
|
E.error("Unhandled error in useMakeQuoteEffect:", S), h("quoteSetStatus", "error"), h("quoteSet", void 0), h("errorSet", {
|
|
@@ -892,10 +892,10 @@ const us = (e) => {
|
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
894
|
},
|
|
895
|
-
[n,
|
|
895
|
+
[n, m, g, w, t, s, p]
|
|
896
896
|
);
|
|
897
897
|
R(() => {
|
|
898
|
-
!p || !(
|
|
898
|
+
!p || !(m ? 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 }));
|
|
899
899
|
}, [p, D, B, n.sourceToken, n.targetToken]), R(() => {
|
|
900
900
|
const C = () => {
|
|
901
901
|
b.current && (clearInterval(b.current), b.current = null);
|
|
@@ -904,22 +904,22 @@ const us = (e) => {
|
|
|
904
904
|
await D({ isRefetch: !0 });
|
|
905
905
|
}, r)), C;
|
|
906
906
|
}, [p, D, B, n.state]);
|
|
907
|
-
},
|
|
907
|
+
}, we = {
|
|
908
908
|
sol: "sol",
|
|
909
909
|
evm: "eth",
|
|
910
910
|
near: "near"
|
|
911
|
-
},
|
|
911
|
+
}, As = ({
|
|
912
912
|
isEnabled: e,
|
|
913
913
|
skipIntents: t = !1,
|
|
914
914
|
target: s = "none"
|
|
915
915
|
}) => {
|
|
916
|
-
const { tokens: r } = V(), { ctx: n, state: a } = _(), { intentBalances:
|
|
916
|
+
const { tokens: r } = V(), { ctx: n, state: a } = _(), { intentBalances: c } = he(), { walletSupportedChains: l, chainsFilter: d, intentsAccountType: u } = y(), i = Rn({
|
|
917
917
|
tokens: r,
|
|
918
|
-
walletSupportedChains:
|
|
919
|
-
balances:
|
|
918
|
+
walletSupportedChains: l,
|
|
919
|
+
balances: c,
|
|
920
920
|
across: "intents"
|
|
921
|
-
}), [
|
|
922
|
-
{ token:
|
|
921
|
+
}), [m, p] = L(() => !n.walletAddress && !t ? [
|
|
922
|
+
{ token: En({ tokens: r }), status: "loaded" },
|
|
923
923
|
{ token: void 0, status: "loaded" }
|
|
924
924
|
] : d.source.intents !== "none" && !t ? i ? [
|
|
925
925
|
{ token: i, status: "loaded" },
|
|
@@ -928,9 +928,9 @@ const us = (e) => {
|
|
|
928
928
|
{ token: void 0, status: "loading" },
|
|
929
929
|
{ token: void 0, status: "loading" }
|
|
930
930
|
] : [
|
|
931
|
-
{ token:
|
|
931
|
+
{ token: bn({
|
|
932
932
|
tokens: r,
|
|
933
|
-
walletSupportedChains:
|
|
933
|
+
walletSupportedChains: l
|
|
934
934
|
}), status: "loaded" },
|
|
935
935
|
{ token: void 0, status: "loaded" }
|
|
936
936
|
], [
|
|
@@ -939,25 +939,25 @@ const us = (e) => {
|
|
|
939
939
|
d,
|
|
940
940
|
n.walletAddress,
|
|
941
941
|
i,
|
|
942
|
-
|
|
942
|
+
l,
|
|
943
943
|
a
|
|
944
944
|
]);
|
|
945
945
|
R(() => {
|
|
946
946
|
if (!e)
|
|
947
947
|
return;
|
|
948
|
-
if (O(n, ["initial_dry", "initial_wallet"]) && (
|
|
948
|
+
if (O(n, ["initial_dry", "initial_wallet"]) && (m.status === "loaded" && !n.sourceToken && h("tokenSelect", {
|
|
949
949
|
variant: "source",
|
|
950
|
-
token:
|
|
951
|
-
}), p.status === "loaded" &&
|
|
950
|
+
token: m.token
|
|
951
|
+
}), p.status === "loaded" && m.status === "loaded" && !n.targetToken)) {
|
|
952
952
|
let g = p.token;
|
|
953
953
|
if (s === "same-asset")
|
|
954
|
-
if (
|
|
955
|
-
if (!
|
|
954
|
+
if (m.token?.isIntent) {
|
|
955
|
+
if (!u)
|
|
956
956
|
throw new Error(
|
|
957
957
|
"Intents account type is required to select same-asset target token"
|
|
958
958
|
);
|
|
959
959
|
g = r.find(
|
|
960
|
-
(k) => !k.isIntent && k.symbol === n.sourceToken?.symbol && k.blockchain ===
|
|
960
|
+
(k) => !k.isIntent && k.symbol === n.sourceToken?.symbol && k.blockchain === we[u]
|
|
961
961
|
);
|
|
962
962
|
} else
|
|
963
963
|
g = r.find(
|
|
@@ -968,10 +968,10 @@ const us = (e) => {
|
|
|
968
968
|
token: g
|
|
969
969
|
});
|
|
970
970
|
}
|
|
971
|
-
}, [n,
|
|
971
|
+
}, [n, m, p, e]);
|
|
972
972
|
const w = (f, g) => {
|
|
973
973
|
const k = r.find(
|
|
974
|
-
(b) => !b.isIntent && b.blockchain ===
|
|
974
|
+
(b) => !b.isIntent && b.blockchain === we[f] && b.symbol.toLowerCase() === un[we[f]]?.toLowerCase()
|
|
975
975
|
) ?? g;
|
|
976
976
|
h("tokenSelect", {
|
|
977
977
|
variant: "source",
|
|
@@ -985,65 +985,65 @@ const us = (e) => {
|
|
|
985
985
|
const g = r.find(
|
|
986
986
|
(b) => b.isIntent && b.symbol === "AURORA" && b.blockchain === "near"
|
|
987
987
|
), k = setTimeout(() => {
|
|
988
|
-
|
|
988
|
+
m.token || (!t && i ? h("tokenSelect", {
|
|
989
989
|
variant: "source",
|
|
990
990
|
token: i
|
|
991
|
-
}) :
|
|
991
|
+
}) : l.length && u ? w(u, g) : n.walletAddress && _t(n.walletAddress) ? w("sol", g) : n.walletAddress && yt(n.walletAddress) ? w("evm", g) : n.walletAddress && Nt(n.walletAddress) ? w("near", g) : h("tokenSelect", {
|
|
992
992
|
variant: "source",
|
|
993
993
|
token: g
|
|
994
994
|
}));
|
|
995
995
|
}, 3e3);
|
|
996
996
|
return () => clearTimeout(k);
|
|
997
|
-
}, [r,
|
|
998
|
-
},
|
|
997
|
+
}, [r, m, t]), { source: n.sourceToken, target: n.targetToken };
|
|
998
|
+
}, Ss = ({
|
|
999
999
|
isEnabled: e,
|
|
1000
1000
|
alchemyApiKey: t
|
|
1001
1001
|
}) => {
|
|
1002
1002
|
const { connectedWallets: s } = y();
|
|
1003
|
-
|
|
1003
|
+
Ot({
|
|
1004
1004
|
isEnabled: e,
|
|
1005
1005
|
connectedWallets: s,
|
|
1006
1006
|
alchemyApiKey: t ?? ""
|
|
1007
1007
|
});
|
|
1008
|
-
},
|
|
1009
|
-
const { config: s } =
|
|
1008
|
+
}, Ns = (e, t) => {
|
|
1009
|
+
const { config: s } = Ce(Qe);
|
|
1010
1010
|
return e.targetToken && !e.sendAddress && !!e.walletAddress && !e.targetToken.isIntent && !t.find((r) => r?.key === "sendAddress") && s.walletSupportedChains.includes(e.targetToken.blockchain);
|
|
1011
|
-
},
|
|
1011
|
+
}, _s = ({ debug: e }) => {
|
|
1012
1012
|
ee.onContextChange((t, s) => {
|
|
1013
1013
|
const r = s;
|
|
1014
|
-
if (e && E.debug("[WIDGET] Context changed", r), e && t.error &&
|
|
1014
|
+
if (e && E.debug("[WIDGET] Context changed", r), e && t.error && Dn(r) && E.debug(`[WIDGET] Error set to ${t.error.code}`), xn(r) || Bn(t, r, e))
|
|
1015
1015
|
return;
|
|
1016
|
-
if (
|
|
1016
|
+
if (Fn(t, r)) {
|
|
1017
1017
|
h("reset", { clearWalletAddress: !0 }), F("initial_dry");
|
|
1018
1018
|
return;
|
|
1019
1019
|
}
|
|
1020
|
-
const { isChanged: n, isDry: a } =
|
|
1020
|
+
const { isChanged: n, isDry: a } = vn(t, r);
|
|
1021
1021
|
if (n) {
|
|
1022
|
-
if (
|
|
1023
|
-
const
|
|
1024
|
-
F(
|
|
1022
|
+
if (On(t)) {
|
|
1023
|
+
const c = a ? "initial_dry" : "initial_wallet";
|
|
1024
|
+
F(c, {
|
|
1025
1025
|
onMoved: () => {
|
|
1026
1026
|
e && E.debug(
|
|
1027
|
-
`[WIDGET] Inputs changed. State moved to ${
|
|
1027
|
+
`[WIDGET] Inputs changed. State moved to ${c}`
|
|
1028
1028
|
);
|
|
1029
1029
|
}
|
|
1030
1030
|
});
|
|
1031
1031
|
}
|
|
1032
|
-
|
|
1032
|
+
Cn(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), Ln(t) && (t.sendAddress = void 0), Ns(t, r) && (t.sendAddress = t.walletAddress), qt(t);
|
|
1033
1033
|
}
|
|
1034
1034
|
});
|
|
1035
|
-
},
|
|
1035
|
+
}, ys = ({ debug: e }) => {
|
|
1036
1036
|
ee.onTransition((t, s) => {
|
|
1037
1037
|
e && E.debug(`===> [WIDGET] State moved from ${t} to ${s}`);
|
|
1038
1038
|
});
|
|
1039
|
-
},
|
|
1040
|
-
const { variant: s, token: r } = t, { config: n } =
|
|
1039
|
+
}, bs = (e, t) => {
|
|
1040
|
+
const { variant: s, token: r } = t, { config: n } = Ce(Qe);
|
|
1041
1041
|
switch (s) {
|
|
1042
1042
|
case "source":
|
|
1043
1043
|
if (r && r.assetId === e.targetToken?.assetId && r.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching) {
|
|
1044
1044
|
if (!e.sourceToken)
|
|
1045
1045
|
return;
|
|
1046
|
-
|
|
1046
|
+
be(e);
|
|
1047
1047
|
return;
|
|
1048
1048
|
}
|
|
1049
1049
|
if (r && !e.sourceToken && r.assetId === e.targetToken?.assetId && r.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching)
|
|
@@ -1054,26 +1054,26 @@ const us = (e) => {
|
|
|
1054
1054
|
if (r && r.assetId === e.sourceToken?.assetId && r.isIntent === e.sourceToken.isIntent && n.enableAutoTokensSwitching) {
|
|
1055
1055
|
if (!e.targetToken)
|
|
1056
1056
|
return;
|
|
1057
|
-
|
|
1057
|
+
be(e);
|
|
1058
1058
|
return;
|
|
1059
1059
|
}
|
|
1060
1060
|
e.targetToken = r;
|
|
1061
1061
|
break;
|
|
1062
1062
|
default:
|
|
1063
|
-
|
|
1063
|
+
Oe(s, { throwError: !1 });
|
|
1064
1064
|
}
|
|
1065
1065
|
}, x = (e, t) => ee.on(
|
|
1066
1066
|
e,
|
|
1067
1067
|
(s, r) => t(s, r, ee)
|
|
1068
|
-
),
|
|
1069
|
-
x("quoteSetStatus",
|
|
1070
|
-
},
|
|
1068
|
+
), Es = () => {
|
|
1069
|
+
x("quoteSetStatus", Mn), x("walletAddressSet", Hn), x("transferSetStatus", jn), x("tokenSelectRotate", be), x("tokenSetBalance", Gn), x("tokenSetAmount", Vn), x("depositTypeSet", Qn), x("setInputsValidating", Kn), x("externalDepositTxSet", $n), x("tokenSelect", bs), x("addressSet", Wn), x("errorSet", Un), x("quoteSet", Pn), x("reset", qn), x("validateDryInputs", Ft), x("validateExternalInputs", Lt), x("validateInternalInputs", Bt);
|
|
1070
|
+
}, Rs = gn(({ debug: e }) => {
|
|
1071
1071
|
e && E.debug(
|
|
1072
|
-
"[WIDGET] Debug mode is enabled (package version: 3.
|
|
1073
|
-
),
|
|
1074
|
-
}),
|
|
1072
|
+
"[WIDGET] Debug mode is enabled (package version: 3.20.0)"
|
|
1073
|
+
), Es(), ys({ debug: e }), _s({ debug: e });
|
|
1074
|
+
}), Ol = ({ listenTo: e, debug: t = !1 }) => {
|
|
1075
1075
|
R(() => {
|
|
1076
|
-
|
|
1076
|
+
Rs({ debug: t });
|
|
1077
1077
|
}, [t]);
|
|
1078
1078
|
const s = e.find(
|
|
1079
1079
|
(a) => Array.isArray(a) && a[0] === "setBalancesUsingAlchemyExt"
|
|
@@ -1082,85 +1082,85 @@ const us = (e) => {
|
|
|
1082
1082
|
), n = e.find(
|
|
1083
1083
|
(a) => Array.isArray(a) && a[0] === "makeQuote"
|
|
1084
1084
|
);
|
|
1085
|
-
|
|
1085
|
+
Ss({
|
|
1086
1086
|
isEnabled: !!s,
|
|
1087
1087
|
alchemyApiKey: s?.[1].alchemyApiKey
|
|
1088
|
-
}),
|
|
1088
|
+
}), As({
|
|
1089
1089
|
isEnabled: !!r,
|
|
1090
1090
|
skipIntents: r?.[1].skipIntents,
|
|
1091
1091
|
target: r?.[1].target
|
|
1092
|
-
}),
|
|
1092
|
+
}), ks({
|
|
1093
1093
|
isEnabled: !!n,
|
|
1094
1094
|
message: n?.[1].message,
|
|
1095
1095
|
type: n?.[1].type,
|
|
1096
1096
|
refetchQuoteInterval: n?.[1].refetchQuoteInterval
|
|
1097
|
-
}),
|
|
1097
|
+
}), Ts({
|
|
1098
1098
|
isEnabled: e.includes("checkWalletConnection")
|
|
1099
|
-
}), fs({
|
|
1100
|
-
isEnabled: e.includes("setSourceTokenBalance")
|
|
1101
1099
|
}), ps({
|
|
1100
|
+
isEnabled: e.includes("setSourceTokenBalance")
|
|
1101
|
+
}), hs({
|
|
1102
1102
|
isEnabled: e.includes("setSourceTokenIntentsTarget")
|
|
1103
|
-
}),
|
|
1103
|
+
}), fs({
|
|
1104
1104
|
isEnabled: e.includes("updateBalances"),
|
|
1105
1105
|
alchemyApiKey: s?.[1].alchemyApiKey
|
|
1106
1106
|
});
|
|
1107
|
-
},
|
|
1107
|
+
}, Cs = ee.getStore();
|
|
1108
1108
|
class M extends Error {
|
|
1109
1109
|
context;
|
|
1110
1110
|
_is_widget_error = !0;
|
|
1111
1111
|
constructor(t, s) {
|
|
1112
|
-
super(t), this.name = "WidgetError", this.cause = s?.cause, this.context =
|
|
1112
|
+
super(t), this.name = "WidgetError", this.cause = s?.cause, this.context = Ce(Cs).context;
|
|
1113
1113
|
}
|
|
1114
1114
|
}
|
|
1115
|
-
class
|
|
1115
|
+
class Ut extends M {
|
|
1116
1116
|
data;
|
|
1117
1117
|
constructor(t) {
|
|
1118
1118
|
super(t.code), this.data = t, this.name = "MachineError";
|
|
1119
1119
|
}
|
|
1120
1120
|
}
|
|
1121
|
-
class q extends
|
|
1121
|
+
class q extends Ut {
|
|
1122
1122
|
constructor(t) {
|
|
1123
1123
|
super(t), this.name = "QuoteError";
|
|
1124
1124
|
}
|
|
1125
1125
|
}
|
|
1126
|
-
class I extends
|
|
1126
|
+
class I extends Ut {
|
|
1127
1127
|
constructor(t) {
|
|
1128
1128
|
super(t), this.name = "TransferError";
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
|
1131
|
-
const
|
|
1132
|
-
usdTradeDelta: (e) =>
|
|
1133
|
-
isDirectNearTokenWithdrawal: (e) =>
|
|
1134
|
-
isDirectNonNearWithdrawal: (e) =>
|
|
1135
|
-
isDirectTokenOnNearDeposit: (e) =>
|
|
1136
|
-
isNativeNearDeposit: (e) =>
|
|
1137
|
-
isSameAssetDiffChainWithdrawal: (e) =>
|
|
1138
|
-
isDirectTokenOnNearTransfer: (e) =>
|
|
1139
|
-
}), J = () =>
|
|
1140
|
-
const e =
|
|
1131
|
+
const Fl = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e && !!e._is_widget_error, $ = ee.getStore(), vs = pn({
|
|
1132
|
+
usdTradeDelta: (e) => zn(e($.context)),
|
|
1133
|
+
isDirectNearTokenWithdrawal: (e) => Zn(e($.context)),
|
|
1134
|
+
isDirectNonNearWithdrawal: (e) => Yn(e($.context)),
|
|
1135
|
+
isDirectTokenOnNearDeposit: (e) => Tn(e($.context)),
|
|
1136
|
+
isNativeNearDeposit: (e) => hn(e($.context)),
|
|
1137
|
+
isSameAssetDiffChainWithdrawal: (e) => Jn(e($.context)),
|
|
1138
|
+
isDirectTokenOnNearTransfer: (e) => Xn(e($.context))
|
|
1139
|
+
}), J = () => fe(vs), _ = () => {
|
|
1140
|
+
const e = fe($);
|
|
1141
1141
|
return {
|
|
1142
1142
|
state: e.state,
|
|
1143
1143
|
ctx: e.context
|
|
1144
1144
|
};
|
|
1145
|
-
},
|
|
1146
|
-
const t =
|
|
1145
|
+
}, Ll = (e) => {
|
|
1146
|
+
const t = fe($);
|
|
1147
1147
|
if (!O(t.context, [e]))
|
|
1148
1148
|
throw new M(
|
|
1149
1149
|
`[WIDGET] Attempt to access snapshot for ${e} state while context does not match`
|
|
1150
1150
|
);
|
|
1151
1151
|
return t.context;
|
|
1152
|
-
},
|
|
1152
|
+
}, Ds = async ({
|
|
1153
1153
|
contractId: e,
|
|
1154
1154
|
accountId: t
|
|
1155
1155
|
}) => {
|
|
1156
1156
|
try {
|
|
1157
|
-
const s = { account_id: t }, r =
|
|
1157
|
+
const s = { account_id: t }, r = Pe.from(JSON.stringify(s)).toString("base64"), n = await tr.query({
|
|
1158
1158
|
request_type: "call_function",
|
|
1159
1159
|
method_name: "storage_balance_of",
|
|
1160
1160
|
account_id: e,
|
|
1161
1161
|
args_base64: r,
|
|
1162
1162
|
finality: "optimistic"
|
|
1163
|
-
}), a =
|
|
1163
|
+
}), a = er(
|
|
1164
1164
|
n,
|
|
1165
1165
|
oe.union([oe.null(), oe.object({ total: oe.string() })])
|
|
1166
1166
|
);
|
|
@@ -1169,10 +1169,10 @@ const xc = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
|
|
|
1169
1169
|
throw new M("Error fetching balance", { cause: s });
|
|
1170
1170
|
}
|
|
1171
1171
|
};
|
|
1172
|
-
function
|
|
1172
|
+
function xs(e) {
|
|
1173
1173
|
const { ctx: t } = _(), { isNativeNearDeposit: s } = J(), r = t.sourceToken?.contractAddress, n = t.quote?.amountIn ?? t.sourceTokenAmount;
|
|
1174
1174
|
return {
|
|
1175
|
-
make: async (
|
|
1175
|
+
make: async (c, l) => {
|
|
1176
1176
|
if (!e)
|
|
1177
1177
|
throw new I({
|
|
1178
1178
|
code: "TRANSFER_INVALID_INITIAL",
|
|
@@ -1183,7 +1183,7 @@ function Ds(e) {
|
|
|
1183
1183
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1184
1184
|
meta: { message: "No token selected to transfer." }
|
|
1185
1185
|
});
|
|
1186
|
-
if (!
|
|
1186
|
+
if (!c)
|
|
1187
1187
|
throw new I({
|
|
1188
1188
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1189
1189
|
meta: { message: "No recipient address to transfer." }
|
|
@@ -1194,12 +1194,12 @@ function Ds(e) {
|
|
|
1194
1194
|
meta: { message: "No amount to transfer." }
|
|
1195
1195
|
});
|
|
1196
1196
|
const d = e();
|
|
1197
|
-
if (t.sourceToken.assetId === j && t.targetToken?.assetId !==
|
|
1197
|
+
if (t.sourceToken.assetId === j && t.targetToken?.assetId !== _e) {
|
|
1198
1198
|
const i = await d.signAndSendTransactions({
|
|
1199
1199
|
transactions: [
|
|
1200
1200
|
{
|
|
1201
1201
|
signerId: t.walletAddress,
|
|
1202
|
-
receiverId:
|
|
1202
|
+
receiverId: c,
|
|
1203
1203
|
actions: [
|
|
1204
1204
|
{
|
|
1205
1205
|
type: "Transfer",
|
|
@@ -1222,28 +1222,28 @@ function Ds(e) {
|
|
|
1222
1222
|
intent: void 0
|
|
1223
1223
|
};
|
|
1224
1224
|
}
|
|
1225
|
-
const
|
|
1225
|
+
const u = [];
|
|
1226
1226
|
if (t.targetToken && s)
|
|
1227
1227
|
try {
|
|
1228
|
-
|
|
1228
|
+
u.push({
|
|
1229
1229
|
type: "FunctionCall",
|
|
1230
1230
|
params: {
|
|
1231
1231
|
methodName: "near_deposit",
|
|
1232
|
-
gas:
|
|
1232
|
+
gas: Ye,
|
|
1233
1233
|
deposit: n,
|
|
1234
1234
|
args: {}
|
|
1235
1235
|
}
|
|
1236
|
-
}),
|
|
1236
|
+
}), u.push({
|
|
1237
1237
|
type: "FunctionCall",
|
|
1238
1238
|
params: {
|
|
1239
1239
|
methodName: "ft_transfer_call",
|
|
1240
1240
|
deposit: "1",
|
|
1241
1241
|
// 1 yocto required by NEP-141
|
|
1242
|
-
gas:
|
|
1242
|
+
gas: Xe,
|
|
1243
1243
|
args: {
|
|
1244
1244
|
amount: n,
|
|
1245
|
-
receiver_id:
|
|
1246
|
-
msg:
|
|
1245
|
+
receiver_id: c,
|
|
1246
|
+
msg: l ?? ""
|
|
1247
1247
|
}
|
|
1248
1248
|
}
|
|
1249
1249
|
});
|
|
@@ -1251,7 +1251,7 @@ function Ds(e) {
|
|
|
1251
1251
|
transactions: [
|
|
1252
1252
|
{
|
|
1253
1253
|
receiverId: "wrap.near",
|
|
1254
|
-
actions:
|
|
1254
|
+
actions: u
|
|
1255
1255
|
}
|
|
1256
1256
|
]
|
|
1257
1257
|
});
|
|
@@ -1265,7 +1265,7 @@ function Ds(e) {
|
|
|
1265
1265
|
code: "NO_DEPOSIT_RESULT"
|
|
1266
1266
|
});
|
|
1267
1267
|
} catch (i) {
|
|
1268
|
-
if (
|
|
1268
|
+
if (de(i) && ue(i))
|
|
1269
1269
|
return;
|
|
1270
1270
|
throw E.error("[TRANSFER ERROR]", i), new I({
|
|
1271
1271
|
code: "DIRECT_TRANSFER_ERROR"
|
|
@@ -1277,33 +1277,33 @@ function Ds(e) {
|
|
|
1277
1277
|
meta: { message: "No token selected to transfer." }
|
|
1278
1278
|
});
|
|
1279
1279
|
try {
|
|
1280
|
-
const [i,
|
|
1281
|
-
|
|
1280
|
+
const [i, m] = await Promise.all([
|
|
1281
|
+
nr({
|
|
1282
1282
|
contractId: r
|
|
1283
1283
|
}),
|
|
1284
|
-
|
|
1284
|
+
Ds({
|
|
1285
1285
|
contractId: r,
|
|
1286
|
-
accountId:
|
|
1286
|
+
accountId: c
|
|
1287
1287
|
})
|
|
1288
|
-
]), p = i -
|
|
1289
|
-
p > 0n &&
|
|
1288
|
+
]), p = i - m;
|
|
1289
|
+
p > 0n && u.push({
|
|
1290
1290
|
type: "FunctionCall",
|
|
1291
1291
|
params: {
|
|
1292
1292
|
methodName: "storage_deposit",
|
|
1293
|
-
args: { account_id:
|
|
1294
|
-
gas:
|
|
1293
|
+
args: { account_id: c },
|
|
1294
|
+
gas: Ye,
|
|
1295
1295
|
deposit: p.toString()
|
|
1296
1296
|
}
|
|
1297
|
-
}),
|
|
1297
|
+
}), u.push({
|
|
1298
1298
|
type: "FunctionCall",
|
|
1299
1299
|
params: {
|
|
1300
1300
|
methodName: "ft_transfer_call",
|
|
1301
1301
|
args: {
|
|
1302
|
-
receiver_id:
|
|
1302
|
+
receiver_id: c,
|
|
1303
1303
|
amount: n,
|
|
1304
|
-
msg:
|
|
1304
|
+
msg: l ?? ""
|
|
1305
1305
|
},
|
|
1306
|
-
gas:
|
|
1306
|
+
gas: Xe,
|
|
1307
1307
|
deposit: "1"
|
|
1308
1308
|
}
|
|
1309
1309
|
});
|
|
@@ -1311,7 +1311,7 @@ function Ds(e) {
|
|
|
1311
1311
|
transactions: [
|
|
1312
1312
|
{
|
|
1313
1313
|
receiverId: r,
|
|
1314
|
-
actions:
|
|
1314
|
+
actions: u
|
|
1315
1315
|
}
|
|
1316
1316
|
]
|
|
1317
1317
|
});
|
|
@@ -1325,7 +1325,7 @@ function Ds(e) {
|
|
|
1325
1325
|
code: "NO_DEPOSIT_RESULT"
|
|
1326
1326
|
});
|
|
1327
1327
|
} catch (i) {
|
|
1328
|
-
if (
|
|
1328
|
+
if (de(i) && ue(i))
|
|
1329
1329
|
return;
|
|
1330
1330
|
throw E.error("[TRANSFER ERROR]", i), new I({
|
|
1331
1331
|
code: "DIRECT_TRANSFER_ERROR"
|
|
@@ -1334,21 +1334,21 @@ function Ds(e) {
|
|
|
1334
1334
|
}
|
|
1335
1335
|
};
|
|
1336
1336
|
}
|
|
1337
|
-
const
|
|
1337
|
+
const Os = ({
|
|
1338
1338
|
makeTransfer: e,
|
|
1339
1339
|
providers: t
|
|
1340
1340
|
}) => {
|
|
1341
|
-
const { ctx: s } = _(), { alchemyApiKey: r } = y(), { make: n } =
|
|
1341
|
+
const { ctx: s } = _(), { alchemyApiKey: r } = y(), { make: n } = rr({
|
|
1342
1342
|
provider: t?.evm
|
|
1343
|
-
}), { make: a } =
|
|
1343
|
+
}), { make: a } = sr({
|
|
1344
1344
|
provider: t?.sol,
|
|
1345
1345
|
alchemyApiKey: r
|
|
1346
|
-
}),
|
|
1346
|
+
}), c = (d) => {
|
|
1347
1347
|
if (e)
|
|
1348
1348
|
return e;
|
|
1349
|
-
if (
|
|
1349
|
+
if (yt(d))
|
|
1350
1350
|
return n;
|
|
1351
|
-
if (
|
|
1351
|
+
if (_t(d))
|
|
1352
1352
|
return a;
|
|
1353
1353
|
throw new I({
|
|
1354
1354
|
code: "TRANSFER_INVALID_INITIAL",
|
|
@@ -1382,14 +1382,14 @@ const xs = ({
|
|
|
1382
1382
|
decimals: s.sourceToken.decimals,
|
|
1383
1383
|
address: s.quote.depositAddress,
|
|
1384
1384
|
chain: s.sourceToken.blockchain,
|
|
1385
|
-
evmChainId: G(s.sourceToken.blockchain) ?
|
|
1386
|
-
isNativeEvmTokenTransfer: !!s.sourceToken &&
|
|
1385
|
+
evmChainId: G(s.sourceToken.blockchain) ? Ne[s.sourceToken.blockchain] : null,
|
|
1386
|
+
isNativeEvmTokenTransfer: !!s.sourceToken && bt(s.sourceToken),
|
|
1387
1387
|
tokenAddress: s.sourceToken.assetId === j ? j : s.sourceToken.contractAddress,
|
|
1388
1388
|
sourceAssetId: s.sourceToken.assetId,
|
|
1389
1389
|
targetAssetId: s.targetToken.assetId
|
|
1390
|
-
},
|
|
1390
|
+
}, u = c(d.address);
|
|
1391
1391
|
try {
|
|
1392
|
-
const i = await
|
|
1392
|
+
const i = await u(d);
|
|
1393
1393
|
if (!i) {
|
|
1394
1394
|
if (e)
|
|
1395
1395
|
return;
|
|
@@ -1404,14 +1404,14 @@ const xs = ({
|
|
|
1404
1404
|
};
|
|
1405
1405
|
} catch (i) {
|
|
1406
1406
|
E.error("[TRANSFER ERROR]", i, { error: i });
|
|
1407
|
-
let
|
|
1408
|
-
const p =
|
|
1407
|
+
let m = "Failed to make a transfer. Please try again.";
|
|
1408
|
+
const p = de(i) && ue(i);
|
|
1409
1409
|
if (p)
|
|
1410
1410
|
return;
|
|
1411
|
-
throw
|
|
1411
|
+
throw Nn.isAxiosError(i) ? (m = i.response?.data?.detail ?? i.message ?? "Failed to make deposit. Please try again.", new I({
|
|
1412
1412
|
code: "QUOTE_ERROR",
|
|
1413
|
-
meta: { message:
|
|
1414
|
-
})) :
|
|
1413
|
+
meta: { message: m }
|
|
1414
|
+
})) : m === "No quotes found" ? new I({
|
|
1415
1415
|
code: "NO_QUOTE_FOUND"
|
|
1416
1416
|
}) : i instanceof Error && !p ? new I({
|
|
1417
1417
|
code: "QUOTE_ERROR",
|
|
@@ -1423,7 +1423,7 @@ const xs = ({
|
|
|
1423
1423
|
}
|
|
1424
1424
|
} };
|
|
1425
1425
|
};
|
|
1426
|
-
class
|
|
1426
|
+
class Fs {
|
|
1427
1427
|
constructor(t, s) {
|
|
1428
1428
|
this.account = t, this.provider = s;
|
|
1429
1429
|
}
|
|
@@ -1433,7 +1433,7 @@ class Os {
|
|
|
1433
1433
|
deadline: t.deadline,
|
|
1434
1434
|
nonce: t.nonce,
|
|
1435
1435
|
intents: t.intents,
|
|
1436
|
-
signer_id: t.signer_id ??
|
|
1436
|
+
signer_id: t.signer_id ?? Je.authHandleToIntentsUserId({
|
|
1437
1437
|
identifier: this.account.walletAddress,
|
|
1438
1438
|
method: "evm"
|
|
1439
1439
|
})
|
|
@@ -1448,14 +1448,14 @@ class Os {
|
|
|
1448
1448
|
return {
|
|
1449
1449
|
payload: s,
|
|
1450
1450
|
standard: "erc191",
|
|
1451
|
-
signature:
|
|
1451
|
+
signature: Je.transformERC191Signature(a)
|
|
1452
1452
|
};
|
|
1453
1453
|
}
|
|
1454
1454
|
}
|
|
1455
|
-
const
|
|
1455
|
+
const Ls = ({
|
|
1456
1456
|
walletAddress: e,
|
|
1457
1457
|
getProvider: t
|
|
1458
|
-
}) =>
|
|
1458
|
+
}) => ar({
|
|
1459
1459
|
accountId: e,
|
|
1460
1460
|
signMessage: async (s) => {
|
|
1461
1461
|
const r = t();
|
|
@@ -1465,7 +1465,7 @@ const Fs = ({
|
|
|
1465
1465
|
try {
|
|
1466
1466
|
n = await r.signMessage({
|
|
1467
1467
|
...s,
|
|
1468
|
-
nonce:
|
|
1468
|
+
nonce: Pe.from(s.nonce)
|
|
1469
1469
|
});
|
|
1470
1470
|
} catch (a) {
|
|
1471
1471
|
throw new M("Near wallet failed to sign a message", {
|
|
@@ -1479,7 +1479,7 @@ const Fs = ({
|
|
|
1479
1479
|
signature: n.signature
|
|
1480
1480
|
};
|
|
1481
1481
|
}
|
|
1482
|
-
}),
|
|
1482
|
+
}), Bs = (e, t) => {
|
|
1483
1483
|
if (t) {
|
|
1484
1484
|
if (e.sendAddress)
|
|
1485
1485
|
return e.sendAddress;
|
|
@@ -1494,8 +1494,8 @@ const Fs = ({
|
|
|
1494
1494
|
meta: { message: "Quote is required for intents non-direct transfer" }
|
|
1495
1495
|
});
|
|
1496
1496
|
return e.quote.depositAddress;
|
|
1497
|
-
},
|
|
1498
|
-
let s =
|
|
1497
|
+
}, qs = async (e, t) => {
|
|
1498
|
+
let s = Ze.getItem("nearWalletsPk")[t];
|
|
1499
1499
|
if (!e.signMessage)
|
|
1500
1500
|
throw new I({
|
|
1501
1501
|
code: "DIRECT_TRANSFER_ERROR",
|
|
@@ -1506,14 +1506,14 @@ const Fs = ({
|
|
|
1506
1506
|
const a = await e.signMessage({
|
|
1507
1507
|
message: "Authenticate",
|
|
1508
1508
|
recipient: "intents.near",
|
|
1509
|
-
nonce:
|
|
1509
|
+
nonce: Pe.from(ur(32))
|
|
1510
1510
|
});
|
|
1511
1511
|
if (!a)
|
|
1512
1512
|
throw new I({
|
|
1513
1513
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1514
1514
|
meta: { message: "Signing message failed" }
|
|
1515
1515
|
});
|
|
1516
|
-
s = a.publicKey,
|
|
1516
|
+
s = a.publicKey, Ze.setItem("nearWalletsPk", {
|
|
1517
1517
|
[t]: a.publicKey
|
|
1518
1518
|
});
|
|
1519
1519
|
} catch {
|
|
@@ -1526,8 +1526,8 @@ const Fs = ({
|
|
|
1526
1526
|
walletAddress: t,
|
|
1527
1527
|
addressType: "near"
|
|
1528
1528
|
});
|
|
1529
|
-
if (!await
|
|
1530
|
-
contractId:
|
|
1529
|
+
if (!await fr({
|
|
1530
|
+
contractId: Ee,
|
|
1531
1531
|
methodName: "has_public_key",
|
|
1532
1532
|
args: {
|
|
1533
1533
|
account_id: r,
|
|
@@ -1538,7 +1538,7 @@ const Fs = ({
|
|
|
1538
1538
|
await e.signAndSendTransactions({
|
|
1539
1539
|
transactions: [
|
|
1540
1540
|
{
|
|
1541
|
-
receiverId:
|
|
1541
|
+
receiverId: Ee,
|
|
1542
1542
|
signerId: t,
|
|
1543
1543
|
actions: [
|
|
1544
1544
|
{
|
|
@@ -1560,15 +1560,15 @@ const Fs = ({
|
|
|
1560
1560
|
meta: { message: "Unable to add public key to intents account" }
|
|
1561
1561
|
});
|
|
1562
1562
|
}
|
|
1563
|
-
},
|
|
1563
|
+
}, Us = ({ providers: e }) => {
|
|
1564
1564
|
const { ctx: t } = _(), { appName: s, intentsAccountType: r } = y(), {
|
|
1565
1565
|
isNativeNearDeposit: n,
|
|
1566
1566
|
isDirectNearTokenWithdrawal: a,
|
|
1567
|
-
isDirectNonNearWithdrawal:
|
|
1567
|
+
isDirectNonNearWithdrawal: c
|
|
1568
1568
|
} = J();
|
|
1569
1569
|
return { make: async ({
|
|
1570
1570
|
message: d,
|
|
1571
|
-
onPending:
|
|
1571
|
+
onPending: u
|
|
1572
1572
|
}) => {
|
|
1573
1573
|
if (!t.walletAddress)
|
|
1574
1574
|
throw new I({
|
|
@@ -1600,7 +1600,7 @@ const Fs = ({
|
|
|
1600
1600
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1601
1601
|
meta: { message: "No EVM provider configured" }
|
|
1602
1602
|
});
|
|
1603
|
-
i = new
|
|
1603
|
+
i = new Fs(
|
|
1604
1604
|
{ walletAddress: t.walletAddress },
|
|
1605
1605
|
e.evm
|
|
1606
1606
|
);
|
|
@@ -1611,7 +1611,7 @@ const Fs = ({
|
|
|
1611
1611
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1612
1612
|
meta: { message: "No SOL provider configured" }
|
|
1613
1613
|
});
|
|
1614
|
-
i = new
|
|
1614
|
+
i = new mr(
|
|
1615
1615
|
{ walletAddress: t.walletAddress },
|
|
1616
1616
|
e.sol
|
|
1617
1617
|
);
|
|
@@ -1622,40 +1622,40 @@ const Fs = ({
|
|
|
1622
1622
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1623
1623
|
meta: { message: "No NEAR provider configured" }
|
|
1624
1624
|
});
|
|
1625
|
-
await
|
|
1625
|
+
await qs(e.near(), t.walletAddress), i = Ls({
|
|
1626
1626
|
walletAddress: t.walletAddress,
|
|
1627
1627
|
getProvider: e.near
|
|
1628
1628
|
});
|
|
1629
1629
|
break;
|
|
1630
1630
|
}
|
|
1631
1631
|
default:
|
|
1632
|
-
|
|
1632
|
+
Oe(r);
|
|
1633
1633
|
}
|
|
1634
|
-
const
|
|
1635
|
-
|
|
1634
|
+
const m = new or({ referral: It(s) });
|
|
1635
|
+
m.setIntentSigner(i);
|
|
1636
1636
|
let p;
|
|
1637
|
-
n ? p = void 0 : a ? p =
|
|
1637
|
+
n ? p = void 0 : a ? p = ir(d ?? void 0) : c ? p = void 0 : p = lr();
|
|
1638
1638
|
const w = {
|
|
1639
1639
|
assetId: t.sourceToken.assetId,
|
|
1640
1640
|
amount: BigInt(t.sourceTokenAmount),
|
|
1641
|
-
destinationAddress:
|
|
1641
|
+
destinationAddress: Bs(
|
|
1642
1642
|
t,
|
|
1643
|
-
a ||
|
|
1643
|
+
a || c
|
|
1644
1644
|
),
|
|
1645
1645
|
destinationMemo: void 0,
|
|
1646
1646
|
feeInclusive: !0,
|
|
1647
1647
|
routeConfig: p
|
|
1648
1648
|
};
|
|
1649
|
-
|
|
1649
|
+
u("WAITING_CONFIRMATION");
|
|
1650
1650
|
try {
|
|
1651
|
-
const f = await
|
|
1651
|
+
const f = await m.estimateWithdrawalFee({
|
|
1652
1652
|
withdrawalParams: w
|
|
1653
|
-
}), { intentHash: g } = await
|
|
1653
|
+
}), { intentHash: g } = await m.signAndSendWithdrawalIntent({
|
|
1654
1654
|
withdrawalParams: w,
|
|
1655
1655
|
feeEstimation: f
|
|
1656
1656
|
});
|
|
1657
|
-
|
|
1658
|
-
const k = await
|
|
1657
|
+
u("PROCESSING");
|
|
1658
|
+
const k = await m.waitForIntentSettlement({ intentHash: g }), b = await m.waitForWithdrawalCompletion({
|
|
1659
1659
|
withdrawalParams: w,
|
|
1660
1660
|
intentTx: k
|
|
1661
1661
|
});
|
|
@@ -1663,8 +1663,8 @@ const Fs = ({
|
|
|
1663
1663
|
intent: k.hash,
|
|
1664
1664
|
// no hash means completion not trackable for this bridge
|
|
1665
1665
|
hash: b.hash ?? "",
|
|
1666
|
-
transactionLink: b.hash ?
|
|
1667
|
-
|
|
1666
|
+
transactionLink: b.hash ? pr(
|
|
1667
|
+
mn[t.targetToken.blockchain],
|
|
1668
1668
|
b.hash
|
|
1669
1669
|
) : ""
|
|
1670
1670
|
};
|
|
@@ -1679,17 +1679,17 @@ const Fs = ({
|
|
|
1679
1679
|
)
|
|
1680
1680
|
}
|
|
1681
1681
|
});
|
|
1682
|
-
if (f instanceof
|
|
1682
|
+
if (f instanceof dr)
|
|
1683
1683
|
throw new I({
|
|
1684
1684
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1685
1685
|
meta: { message: "Fee is above the maximum allowed" }
|
|
1686
1686
|
});
|
|
1687
|
-
if (
|
|
1687
|
+
if (de(f)) {
|
|
1688
1688
|
if (f.message.includes("Fee is not estimated"))
|
|
1689
1689
|
throw new I({
|
|
1690
1690
|
code: "FEES_NOT_ESTIMATED"
|
|
1691
1691
|
});
|
|
1692
|
-
if (
|
|
1692
|
+
if (ue(f))
|
|
1693
1693
|
return;
|
|
1694
1694
|
}
|
|
1695
1695
|
throw new I({
|
|
@@ -1697,7 +1697,7 @@ const Fs = ({
|
|
|
1697
1697
|
});
|
|
1698
1698
|
}
|
|
1699
1699
|
} };
|
|
1700
|
-
},
|
|
1700
|
+
}, Ps = ({
|
|
1701
1701
|
message: e,
|
|
1702
1702
|
providers: t,
|
|
1703
1703
|
makeTransfer: s
|
|
@@ -1705,23 +1705,23 @@ const Fs = ({
|
|
|
1705
1705
|
const { ctx: r } = _(), {
|
|
1706
1706
|
isDirectTokenOnNearDeposit: n,
|
|
1707
1707
|
isDirectTokenOnNearTransfer: a,
|
|
1708
|
-
isNativeNearDeposit:
|
|
1709
|
-
} = J(), { make:
|
|
1708
|
+
isNativeNearDeposit: c
|
|
1709
|
+
} = J(), { make: l } = Us({ providers: t }), { make: d } = Os({
|
|
1710
1710
|
makeTransfer: s,
|
|
1711
1711
|
providers: t
|
|
1712
|
-
}), { make:
|
|
1712
|
+
}), { make: u } = xs(
|
|
1713
1713
|
t?.near
|
|
1714
1714
|
);
|
|
1715
1715
|
return { make: async () => {
|
|
1716
1716
|
if (!r.targetToken)
|
|
1717
1717
|
return;
|
|
1718
|
-
let
|
|
1718
|
+
let m;
|
|
1719
1719
|
try {
|
|
1720
1720
|
if (h("transferSetStatus", {
|
|
1721
1721
|
status: "pending",
|
|
1722
1722
|
reason: "WAITING_CONFIRMATION"
|
|
1723
1723
|
}), r.sourceToken?.isIntent)
|
|
1724
|
-
|
|
1724
|
+
m = await l({
|
|
1725
1725
|
message: e,
|
|
1726
1726
|
onPending: (p) => {
|
|
1727
1727
|
h("transferSetStatus", {
|
|
@@ -1730,9 +1730,9 @@ const Fs = ({
|
|
|
1730
1730
|
});
|
|
1731
1731
|
}
|
|
1732
1732
|
});
|
|
1733
|
-
else if ((
|
|
1734
|
-
|
|
1735
|
-
r.sendAddress ??
|
|
1733
|
+
else if ((c || n) && !r.isDepositFromExternalWallet)
|
|
1734
|
+
m = await u(
|
|
1735
|
+
r.sendAddress ?? Ee,
|
|
1736
1736
|
e
|
|
1737
1737
|
);
|
|
1738
1738
|
else if (a) {
|
|
@@ -1741,47 +1741,47 @@ const Fs = ({
|
|
|
1741
1741
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1742
1742
|
meta: { message: "No recipient address to transfer" }
|
|
1743
1743
|
});
|
|
1744
|
-
|
|
1744
|
+
m = await u(
|
|
1745
1745
|
r.sendAddress,
|
|
1746
1746
|
e
|
|
1747
1747
|
);
|
|
1748
1748
|
} else
|
|
1749
|
-
|
|
1749
|
+
m = await d();
|
|
1750
1750
|
} catch (p) {
|
|
1751
1751
|
p instanceof I && (E.error(p.data), h("transferSetStatus", { status: "error" }), h("errorSet", p.data));
|
|
1752
1752
|
}
|
|
1753
|
-
if (!
|
|
1753
|
+
if (!m) {
|
|
1754
1754
|
h("transferSetStatus", { status: "idle" });
|
|
1755
1755
|
return;
|
|
1756
1756
|
}
|
|
1757
|
-
return h("transferSetStatus", { status: "success" }), F("transfer_success"),
|
|
1757
|
+
return h("transferSetStatus", { status: "success" }), F("transfer_success"), m;
|
|
1758
1758
|
} };
|
|
1759
|
-
},
|
|
1759
|
+
}, Ws = async (e) => {
|
|
1760
1760
|
if (!e)
|
|
1761
1761
|
return;
|
|
1762
1762
|
const t = await e.request({
|
|
1763
1763
|
method: "eth_chainId"
|
|
1764
1764
|
});
|
|
1765
1765
|
return parseInt(t, 16);
|
|
1766
|
-
},
|
|
1767
|
-
const { ctx: t } = _(), [s, r] = ne(!1), [n, a] = ne(!1),
|
|
1766
|
+
}, Vs = ({ providers: e }) => {
|
|
1767
|
+
const { ctx: t } = _(), [s, r] = ne(!1), [n, a] = ne(!1), c = ce(async () => {
|
|
1768
1768
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1769
1769
|
if (!t.sourceToken || !d)
|
|
1770
1770
|
return !1;
|
|
1771
|
-
const
|
|
1771
|
+
const u = await Ws(d);
|
|
1772
1772
|
if (!G(t.sourceToken.blockchain))
|
|
1773
1773
|
return !1;
|
|
1774
|
-
const i =
|
|
1775
|
-
return !i || !
|
|
1776
|
-
}, [t.sourceToken, e]),
|
|
1774
|
+
const i = Ne[t.sourceToken.blockchain];
|
|
1775
|
+
return !i || !u ? !1 : u !== i;
|
|
1776
|
+
}, [t.sourceToken, e]), l = ce(async () => {
|
|
1777
1777
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1778
1778
|
if (!t.sourceToken || !d || !G(t.sourceToken.blockchain))
|
|
1779
1779
|
return !1;
|
|
1780
|
-
const
|
|
1781
|
-
if (!
|
|
1780
|
+
const u = Ne[t.sourceToken.blockchain];
|
|
1781
|
+
if (!u)
|
|
1782
1782
|
return !1;
|
|
1783
1783
|
try {
|
|
1784
|
-
return r(!0), await
|
|
1784
|
+
return r(!0), await hr(u, d), !0;
|
|
1785
1785
|
} catch (i) {
|
|
1786
1786
|
return E.error("Failed to switch chain:", i), !1;
|
|
1787
1787
|
} finally {
|
|
@@ -1789,16 +1789,16 @@ const Fs = ({
|
|
|
1789
1789
|
}
|
|
1790
1790
|
}, [t.sourceToken, e]);
|
|
1791
1791
|
return R(() => {
|
|
1792
|
-
|
|
1793
|
-
}, [
|
|
1792
|
+
c().then(a);
|
|
1793
|
+
}, [c]), {
|
|
1794
1794
|
isSwitchingChainRequired: n,
|
|
1795
|
-
switchChain:
|
|
1795
|
+
switchChain: l,
|
|
1796
1796
|
isSwitchingChain: s
|
|
1797
1797
|
};
|
|
1798
1798
|
}, N = {
|
|
1799
1799
|
size: "lg",
|
|
1800
1800
|
variant: "primary"
|
|
1801
|
-
},
|
|
1801
|
+
}, We = (e) => {
|
|
1802
1802
|
const { t } = K();
|
|
1803
1803
|
if (e.error?.code === "TOKEN_IS_NOT_SUPPORTED")
|
|
1804
1804
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.invalidAddress", "Invalid address") });
|
|
@@ -1817,12 +1817,12 @@ const Fs = ({
|
|
|
1817
1817
|
if (e.error?.code === "QUOTE_AMOUNT_IS_TOO_LOW" || e.error?.code === "MIN_WITHDRAWAL_AMOUNT_ERROR")
|
|
1818
1818
|
return /* @__PURE__ */ T("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1819
1819
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.amountTooLow.label", "Amount is too low") }),
|
|
1820
|
-
/* @__PURE__ */ o(z, { children: /* @__PURE__ */ T(
|
|
1820
|
+
/* @__PURE__ */ o(z, { children: /* @__PURE__ */ T(sn, { i18nKey: "submit.error.amountTooLow.message", children: [
|
|
1821
1821
|
"Amount you entered is very low. Please try increasing it",
|
|
1822
1822
|
" ",
|
|
1823
1823
|
/* @__PURE__ */ T("span", { className: "text-nowrap", children: [
|
|
1824
1824
|
"above ",
|
|
1825
|
-
/* @__PURE__ */ o(
|
|
1825
|
+
/* @__PURE__ */ o(Ue, { value: e.error.meta.minAmount ?? "0" }),
|
|
1826
1826
|
" ",
|
|
1827
1827
|
e.sourceToken?.symbol ?? "",
|
|
1828
1828
|
"."
|
|
@@ -1867,20 +1867,20 @@ const Fs = ({
|
|
|
1867
1867
|
] });
|
|
1868
1868
|
if (e.error?.code === "SOURCE_BALANCE_INSUFFICIENT")
|
|
1869
1869
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.insufficientBalance", "Insufficient balance") });
|
|
1870
|
-
},
|
|
1870
|
+
}, Ms = ({ onClick: e }) => {
|
|
1871
1871
|
const { t } = K();
|
|
1872
1872
|
return /* @__PURE__ */ o(A, { state: "disabled", ...N, onClick: e, children: t("submit.error.connectWallet", "Connect wallet") });
|
|
1873
|
-
},
|
|
1873
|
+
}, Qs = () => {
|
|
1874
1874
|
const { ctx: e } = _();
|
|
1875
|
-
return
|
|
1876
|
-
},
|
|
1875
|
+
return We(e) ?? null;
|
|
1876
|
+
}, $s = (e) => {
|
|
1877
1877
|
const { providers: t, makeTransfer: s, onSuccess: r } = e, { ctx: n } = _(), { t: a } = K(), {
|
|
1878
|
-
isNativeNearDeposit:
|
|
1879
|
-
isDirectNonNearWithdrawal:
|
|
1878
|
+
isNativeNearDeposit: c,
|
|
1879
|
+
isDirectNonNearWithdrawal: l,
|
|
1880
1880
|
isDirectTokenOnNearDeposit: d,
|
|
1881
|
-
isDirectNearTokenWithdrawal:
|
|
1882
|
-
} = J(), { make: i } =
|
|
1883
|
-
if (
|
|
1881
|
+
isDirectNearTokenWithdrawal: u
|
|
1882
|
+
} = J(), { make: i } = Ps({ providers: t, makeTransfer: s }), { isSwitchingChainRequired: m, switchChain: p, isSwitchingChain: w } = Vs({ providers: t }), f = We(n), g = async () => {
|
|
1883
|
+
if (m && !await p())
|
|
1884
1884
|
return;
|
|
1885
1885
|
const k = await i();
|
|
1886
1886
|
k && r(k);
|
|
@@ -1893,7 +1893,7 @@ const Fs = ({
|
|
|
1893
1893
|
return /* @__PURE__ */ o(A, { state: "loading", ...N, children: a("submit.pending.validating", "Validating...") });
|
|
1894
1894
|
if (w)
|
|
1895
1895
|
return /* @__PURE__ */ o(A, { state: "loading", ...N, children: a("submit.pending.switchingChain", "Switching network...") });
|
|
1896
|
-
if (!
|
|
1896
|
+
if (!m && f)
|
|
1897
1897
|
return f;
|
|
1898
1898
|
if (n.transferStatus.status === "pending")
|
|
1899
1899
|
switch (n.transferStatus.reason) {
|
|
@@ -1919,16 +1919,16 @@ const Fs = ({
|
|
|
1919
1919
|
);
|
|
1920
1920
|
}
|
|
1921
1921
|
})() })
|
|
1922
|
-
] }) : 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 && !
|
|
1923
|
-
}, $s = (e) => {
|
|
1924
|
-
const { t } = K(), { ctx: s } = _(), r = Ue(s);
|
|
1925
|
-
return s.isDepositFromExternalWallet ? se(s.sourceTokenAmount) ? s.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") }) : r || /* @__PURE__ */ o(Qs, { ...e });
|
|
1922
|
+
] }) : 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: g, children: e.label });
|
|
1926
1923
|
}, Ks = (e) => {
|
|
1924
|
+
const { t } = K(), { ctx: s } = _(), r = We(s);
|
|
1925
|
+
return s.isDepositFromExternalWallet ? se(s.sourceTokenAmount) ? s.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") }) : r || /* @__PURE__ */ o($s, { ...e });
|
|
1926
|
+
}, Hs = (e) => {
|
|
1927
1927
|
const { ctx: t } = _(), s = y();
|
|
1928
|
-
return t.walletAddress ? /* @__PURE__ */ o(
|
|
1928
|
+
return t.walletAddress ? /* @__PURE__ */ o(Ks, { ...e }) : /* @__PURE__ */ o(Ms, { onClick: s.onWalletSignin });
|
|
1929
1929
|
};
|
|
1930
|
-
|
|
1931
|
-
const
|
|
1930
|
+
Hs.Error = Qs;
|
|
1931
|
+
const lt = [
|
|
1932
1932
|
"nep141:eth-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near",
|
|
1933
1933
|
// cbBTC (eth)
|
|
1934
1934
|
"nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near",
|
|
@@ -1941,17 +1941,17 @@ const ot = [
|
|
|
1941
1941
|
// NEAR (bsc)
|
|
1942
1942
|
"nep141:eth-0xe0f63a424a4439cbe457d80e4f4b51ad25b2c56c.omft.near"
|
|
1943
1943
|
// SPX (eth)
|
|
1944
|
-
],
|
|
1944
|
+
], Gs = () => {
|
|
1945
1945
|
const { tokens: e } = V();
|
|
1946
1946
|
return {
|
|
1947
1947
|
uniqueIntentsTokens: L(() => {
|
|
1948
1948
|
const t = e.filter(
|
|
1949
|
-
(n) => n.isIntent && n.blockchain === "near" && !
|
|
1950
|
-
), s = t.map((n) => n.isIntent && n.symbol), r = e.filter((n) => n.isIntent && n.blockchain !== "near" && !s.includes(n.symbol) && !
|
|
1949
|
+
(n) => n.isIntent && n.blockchain === "near" && !lt.includes(n.assetId)
|
|
1950
|
+
), s = t.map((n) => n.isIntent && n.symbol), r = e.filter((n) => n.isIntent && n.blockchain !== "near" && !s.includes(n.symbol) && !lt.includes(n.assetId));
|
|
1951
1951
|
return [...t, ...r];
|
|
1952
1952
|
}, [e])
|
|
1953
1953
|
};
|
|
1954
|
-
},
|
|
1954
|
+
}, js = ({
|
|
1955
1955
|
variant: e,
|
|
1956
1956
|
search: t,
|
|
1957
1957
|
selectedChain: s,
|
|
@@ -1959,67 +1959,67 @@ const ot = [
|
|
|
1959
1959
|
walletSupportedChains: n,
|
|
1960
1960
|
priorityAssets: a
|
|
1961
1961
|
}) => {
|
|
1962
|
-
|
|
1963
|
-
const { tokens:
|
|
1964
|
-
|
|
1962
|
+
ms(e);
|
|
1963
|
+
const { tokens: c } = V(e), { mergedBalance: l } = Te(), { intentBalances: d } = he(), { uniqueIntentsTokens: u } = Gs(), i = Ur(
|
|
1964
|
+
l,
|
|
1965
1965
|
n,
|
|
1966
1966
|
t,
|
|
1967
1967
|
a
|
|
1968
|
-
),
|
|
1969
|
-
|
|
1968
|
+
), m = c.filter(Pr({ search: t })).filter(
|
|
1969
|
+
Wr({
|
|
1970
1970
|
selectedChain: s,
|
|
1971
1971
|
chainsFilter: r,
|
|
1972
1972
|
walletSupportedChains: n,
|
|
1973
1973
|
intentBalances: d,
|
|
1974
|
-
uniqueIntentTokenIds:
|
|
1974
|
+
uniqueIntentTokenIds: u.map((p) => p.assetId)
|
|
1975
1975
|
})
|
|
1976
1976
|
);
|
|
1977
1977
|
return {
|
|
1978
|
-
all:
|
|
1979
|
-
intents:
|
|
1980
|
-
wallet:
|
|
1978
|
+
all: m.sort(i),
|
|
1979
|
+
intents: m.filter(nt({ isIntent: !0 })).sort(i),
|
|
1980
|
+
wallet: m.filter(nt({ isIntent: !1 })).sort(i)
|
|
1981
1981
|
};
|
|
1982
|
-
},
|
|
1982
|
+
}, zs = (e, t) => {
|
|
1983
1983
|
const s = t.assetId.substring(t.assetId.indexOf(":") + 1), r = (a) => {
|
|
1984
|
-
const
|
|
1984
|
+
const c = (u) => u.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, ""), l = c(t.amount), d = c(
|
|
1985
1985
|
a.amount.toLocaleString("en-US", {
|
|
1986
1986
|
useGrouping: !1,
|
|
1987
1987
|
maximumFractionDigits: 20
|
|
1988
1988
|
})
|
|
1989
1989
|
);
|
|
1990
|
-
return
|
|
1990
|
+
return l.startsWith(d) || d.startsWith(l);
|
|
1991
1991
|
}, n = (a) => new Date(a.created_at) >= new Date(t.initiatedAtDate);
|
|
1992
1992
|
return (e.result.deposits || []).find(
|
|
1993
1993
|
(a) => a.chain === t.chainId && a.account_id === t.intentsAccountId && a.address === t.depositAddress && a.near_token_id === s && n(a) && r(a)
|
|
1994
1994
|
);
|
|
1995
|
-
},
|
|
1995
|
+
}, Ys = {
|
|
1996
1996
|
CREDITED: te.status.PROCESSING,
|
|
1997
1997
|
PENDING: te.status.PROCESSING,
|
|
1998
1998
|
COMPLETED: te.status.SUCCESS,
|
|
1999
1999
|
FAILED: te.status.FAILED
|
|
2000
|
-
},
|
|
2000
|
+
}, Bl = ({ depositAddress: e }) => {
|
|
2001
2001
|
const { ctx: t } = _(), { intentsAccountType: s } = y(), [r, n] = ne(null), a = re({
|
|
2002
2002
|
addressType: s,
|
|
2003
2003
|
walletAddress: t.walletAddress
|
|
2004
2004
|
});
|
|
2005
2005
|
return { pollDepositStatus: async ({
|
|
2006
|
-
blockchain:
|
|
2006
|
+
blockchain: l,
|
|
2007
2007
|
amount: d,
|
|
2008
|
-
assetId:
|
|
2008
|
+
assetId: u
|
|
2009
2009
|
}) => {
|
|
2010
2010
|
if (!a)
|
|
2011
2011
|
throw new M("Unknown intents account for POA deposit check");
|
|
2012
|
-
let i =
|
|
2012
|
+
let i = Tt[l];
|
|
2013
2013
|
if (!i)
|
|
2014
|
-
if (G(
|
|
2015
|
-
i =
|
|
2014
|
+
if (G(l))
|
|
2015
|
+
i = gt;
|
|
2016
2016
|
else
|
|
2017
2017
|
throw new M(
|
|
2018
|
-
`Unknown chain for POA deposit check ${
|
|
2018
|
+
`Unknown chain for POA deposit check ${l}`
|
|
2019
2019
|
);
|
|
2020
|
-
const
|
|
2021
|
-
r || n(
|
|
2022
|
-
const p = await
|
|
2020
|
+
const m = r ?? (/* @__PURE__ */ new Date()).toUTCString();
|
|
2021
|
+
r || n(m);
|
|
2022
|
+
const p = await At.post("", {
|
|
2023
2023
|
id: 1,
|
|
2024
2024
|
jsonrpc: "2.0",
|
|
2025
2025
|
method: "recent_deposits",
|
|
@@ -2029,16 +2029,16 @@ const ot = [
|
|
|
2029
2029
|
chain: i
|
|
2030
2030
|
}
|
|
2031
2031
|
]
|
|
2032
|
-
}), w =
|
|
2032
|
+
}), w = zs(p.data, {
|
|
2033
2033
|
intentsAccountId: a,
|
|
2034
|
-
initiatedAtDate:
|
|
2034
|
+
initiatedAtDate: m,
|
|
2035
2035
|
depositAddress: e,
|
|
2036
2036
|
chainId: i,
|
|
2037
|
-
assetId:
|
|
2037
|
+
assetId: u,
|
|
2038
2038
|
amount: d
|
|
2039
2039
|
});
|
|
2040
2040
|
return w ? {
|
|
2041
|
-
status:
|
|
2041
|
+
status: Ys[w.status],
|
|
2042
2042
|
swapDetails: {
|
|
2043
2043
|
intentHashes: [""],
|
|
2044
2044
|
destinationChainTxHashes: [{ hash: w.tx_hash ?? "" }]
|
|
@@ -2051,10 +2051,10 @@ const ot = [
|
|
|
2051
2051
|
}
|
|
2052
2052
|
};
|
|
2053
2053
|
} };
|
|
2054
|
-
},
|
|
2054
|
+
}, Xs = ({ className: e }) => {
|
|
2055
2055
|
const { t } = K(), { slippageTolerance: s } = y(), { ctx: r } = _(), n = r.sourceToken && r.targetToken && r.sourceToken.price / r.targetToken.price;
|
|
2056
2056
|
return r.sourceToken ? /* @__PURE__ */ o(
|
|
2057
|
-
|
|
2057
|
+
Tr,
|
|
2058
2058
|
{
|
|
2059
2059
|
expandedByDefault: !1,
|
|
2060
2060
|
expandedHeightPx: r.walletAddress ? 80 : 50,
|
|
@@ -2064,26 +2064,26 @@ const ot = [
|
|
|
2064
2064
|
title: r.sourceToken && r.targetToken ? /* @__PURE__ */ T("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
2065
2065
|
`1 ${r.sourceToken.symbol} ≈ `,
|
|
2066
2066
|
" ",
|
|
2067
|
-
|
|
2067
|
+
gr(n ?? 0),
|
|
2068
2068
|
" ",
|
|
2069
2069
|
`${r.targetToken.symbol}`,
|
|
2070
|
-
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${
|
|
2070
|
+
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${et(r.sourceToken.price)})` })
|
|
2071
2071
|
] }) : /* @__PURE__ */ T("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
2072
2072
|
`1 ${r.sourceToken.symbol} ≈ `,
|
|
2073
2073
|
" ",
|
|
2074
|
-
|
|
2074
|
+
et(r.sourceToken.price),
|
|
2075
2075
|
" USD"
|
|
2076
2076
|
] }),
|
|
2077
|
-
children: /* @__PURE__ */ T(
|
|
2077
|
+
children: /* @__PURE__ */ T(ge, { children: [
|
|
2078
2078
|
/* @__PURE__ */ o(
|
|
2079
|
-
|
|
2079
|
+
ge.Item,
|
|
2080
2080
|
{
|
|
2081
2081
|
label: t("quote.result.maxSlippage.label", "Max slippage"),
|
|
2082
2082
|
value: `${(s / 100).toFixed(2)}%`
|
|
2083
2083
|
}
|
|
2084
2084
|
),
|
|
2085
2085
|
!!r.walletAddress && /* @__PURE__ */ o(
|
|
2086
|
-
|
|
2086
|
+
ge.Item,
|
|
2087
2087
|
{
|
|
2088
2088
|
isLoading: r.quoteStatus === "pending",
|
|
2089
2089
|
label: t("quote.result.processingTime.label", "Processing time"),
|
|
@@ -2092,28 +2092,28 @@ const ot = [
|
|
|
2092
2092
|
)
|
|
2093
2093
|
] })
|
|
2094
2094
|
}
|
|
2095
|
-
) : /* @__PURE__ */ o(
|
|
2096
|
-
},
|
|
2097
|
-
Skeleton:
|
|
2098
|
-
}),
|
|
2095
|
+
) : /* @__PURE__ */ o(Et, {});
|
|
2096
|
+
}, ql = Object.assign(Xs, {
|
|
2097
|
+
Skeleton: Et
|
|
2098
|
+
}), Zs = ({
|
|
2099
2099
|
token: e,
|
|
2100
2100
|
balance: t,
|
|
2101
2101
|
isNotSufficient: s = !1,
|
|
2102
2102
|
onClick: r
|
|
2103
2103
|
}) => {
|
|
2104
2104
|
const n = y();
|
|
2105
|
-
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(
|
|
2105
|
+
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(wr, { width: 100 }) : /* @__PURE__ */ o(
|
|
2106
2106
|
"span",
|
|
2107
2107
|
{
|
|
2108
2108
|
onClick: t ? r : void 0,
|
|
2109
2109
|
style: t ? { borderBottomWidth: "2px", borderStyle: "dotted" } : void 0,
|
|
2110
|
-
className:
|
|
2110
|
+
className: Ir("text-sw-label-sm", {
|
|
2111
2111
|
"text-sw-status-error": s,
|
|
2112
2112
|
"text-sw-gray-100": !s,
|
|
2113
2113
|
"cursor-pointer": !!t && !!r
|
|
2114
2114
|
}),
|
|
2115
2115
|
children: /* @__PURE__ */ o(
|
|
2116
|
-
|
|
2116
|
+
Ue,
|
|
2117
2117
|
{
|
|
2118
2118
|
decimals: e.decimals,
|
|
2119
2119
|
value: t === void 0 ? "0" : `${t}`
|
|
@@ -2121,26 +2121,26 @@ const ot = [
|
|
|
2121
2121
|
)
|
|
2122
2122
|
}
|
|
2123
2123
|
);
|
|
2124
|
-
},
|
|
2124
|
+
}, Ve = ({
|
|
2125
2125
|
token: e,
|
|
2126
2126
|
balance: t,
|
|
2127
2127
|
value: s = "",
|
|
2128
2128
|
quoteUsdDelta: r,
|
|
2129
2129
|
quoteUsdValue: n,
|
|
2130
2130
|
state: a = "default",
|
|
2131
|
-
showBalance:
|
|
2132
|
-
showQuickBalanceActions:
|
|
2131
|
+
showBalance: c = !0,
|
|
2132
|
+
showQuickBalanceActions: l = !0,
|
|
2133
2133
|
heading: d,
|
|
2134
|
-
onMsg:
|
|
2134
|
+
onMsg: u
|
|
2135
2135
|
}) => {
|
|
2136
|
-
const i =
|
|
2137
|
-
|
|
2136
|
+
const i = Zt(), { ctx: m } = _(), { t: p } = K(), { hideTokenInputHeadings: w } = y(), f = Ar(e, s, n), g = (k) => {
|
|
2137
|
+
u({
|
|
2138
2138
|
type: "on_change_amount",
|
|
2139
|
-
amount:
|
|
2139
|
+
amount: kr(t, e.decimals, k)
|
|
2140
2140
|
});
|
|
2141
2141
|
};
|
|
2142
|
-
return /* @__PURE__ */ T(
|
|
2143
|
-
!w && /* @__PURE__ */ o(
|
|
2142
|
+
return /* @__PURE__ */ T(pe, { className: "flex flex-col", "aria-label": d, children: [
|
|
2143
|
+
!w && /* @__PURE__ */ o(Rt, { children: d }),
|
|
2144
2144
|
/* @__PURE__ */ T(
|
|
2145
2145
|
"div",
|
|
2146
2146
|
{
|
|
@@ -2150,15 +2150,15 @@ const ot = [
|
|
|
2150
2150
|
),
|
|
2151
2151
|
children: [
|
|
2152
2152
|
/* @__PURE__ */ o(
|
|
2153
|
-
|
|
2153
|
+
Nr,
|
|
2154
2154
|
{
|
|
2155
2155
|
value: s,
|
|
2156
2156
|
name: i,
|
|
2157
|
-
setValue:
|
|
2157
|
+
setValue: Sr,
|
|
2158
2158
|
placeholder: "0",
|
|
2159
2159
|
state: a === "default" || a === "disabled" ? a : "error",
|
|
2160
2160
|
onChange: (k) => {
|
|
2161
|
-
|
|
2161
|
+
u({ type: "on_change_amount", amount: k.target.value });
|
|
2162
2162
|
}
|
|
2163
2163
|
}
|
|
2164
2164
|
),
|
|
@@ -2166,7 +2166,7 @@ const ot = [
|
|
|
2166
2166
|
"button",
|
|
2167
2167
|
{
|
|
2168
2168
|
type: "button",
|
|
2169
|
-
onClick: a === "disabled" ? void 0 : () =>
|
|
2169
|
+
onClick: a === "disabled" ? void 0 : () => u({ type: "on_click_select_token" }),
|
|
2170
2170
|
className: H(
|
|
2171
2171
|
"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",
|
|
2172
2172
|
{
|
|
@@ -2176,7 +2176,7 @@ const ot = [
|
|
|
2176
2176
|
),
|
|
2177
2177
|
children: [
|
|
2178
2178
|
/* @__PURE__ */ o(
|
|
2179
|
-
|
|
2179
|
+
Ct,
|
|
2180
2180
|
{
|
|
2181
2181
|
token: e,
|
|
2182
2182
|
chainShowIcon: !e.isIntent,
|
|
@@ -2207,8 +2207,8 @@ const ot = [
|
|
|
2207
2207
|
) : null
|
|
2208
2208
|
] }),
|
|
2209
2209
|
/* @__PURE__ */ T("div", { className: "gap-sw-sm flex items-center", children: [
|
|
2210
|
-
e && !!
|
|
2211
|
-
|
|
2210
|
+
e && !!m.walletAddress && c && /* @__PURE__ */ o(
|
|
2211
|
+
Zs,
|
|
2212
2212
|
{
|
|
2213
2213
|
token: e,
|
|
2214
2214
|
balance: t,
|
|
@@ -2216,9 +2216,9 @@ const ot = [
|
|
|
2216
2216
|
onClick: () => g(1)
|
|
2217
2217
|
}
|
|
2218
2218
|
),
|
|
2219
|
-
!!t &&
|
|
2219
|
+
!!t && c && l && /* @__PURE__ */ T(Gt, { children: [
|
|
2220
2220
|
/* @__PURE__ */ o(
|
|
2221
|
-
|
|
2221
|
+
tt,
|
|
2222
2222
|
{
|
|
2223
2223
|
isClickable: a !== "disabled",
|
|
2224
2224
|
onClick: () => g(2),
|
|
@@ -2226,7 +2226,7 @@ const ot = [
|
|
|
2226
2226
|
}
|
|
2227
2227
|
),
|
|
2228
2228
|
/* @__PURE__ */ o(
|
|
2229
|
-
|
|
2229
|
+
tt,
|
|
2230
2230
|
{
|
|
2231
2231
|
isClickable: a !== "disabled",
|
|
2232
2232
|
onClick: () => g(1),
|
|
@@ -2234,20 +2234,20 @@ const ot = [
|
|
|
2234
2234
|
}
|
|
2235
2235
|
)
|
|
2236
2236
|
] }),
|
|
2237
|
-
!
|
|
2237
|
+
!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") }) })
|
|
2238
2238
|
] })
|
|
2239
2239
|
] })
|
|
2240
2240
|
] });
|
|
2241
|
-
},
|
|
2241
|
+
}, Me = ({ onMsg: e, heading: t }) => {
|
|
2242
2242
|
const { hideTokenInputHeadings: s } = y();
|
|
2243
2243
|
return /* @__PURE__ */ T(
|
|
2244
|
-
|
|
2244
|
+
pe,
|
|
2245
2245
|
{
|
|
2246
2246
|
isClickable: !0,
|
|
2247
2247
|
className: "flex flex-col",
|
|
2248
2248
|
onClick: () => e({ type: "on_click_select_token" }),
|
|
2249
2249
|
children: [
|
|
2250
|
-
!s && /* @__PURE__ */ o(
|
|
2250
|
+
!s && /* @__PURE__ */ o(Rt, { children: t }),
|
|
2251
2251
|
/* @__PURE__ */ T(
|
|
2252
2252
|
"div",
|
|
2253
2253
|
{
|
|
@@ -2280,8 +2280,8 @@ const ot = [
|
|
|
2280
2280
|
]
|
|
2281
2281
|
}
|
|
2282
2282
|
);
|
|
2283
|
-
},
|
|
2284
|
-
const { mergedBalance: t } =
|
|
2283
|
+
}, Pt = (e) => {
|
|
2284
|
+
const { mergedBalance: t } = Te(), [s, r] = ne(
|
|
2285
2285
|
e ? t[Y(e)] : void 0
|
|
2286
2286
|
);
|
|
2287
2287
|
return R(() => {
|
|
@@ -2300,7 +2300,7 @@ const ot = [
|
|
|
2300
2300
|
n && clearTimeout(n);
|
|
2301
2301
|
};
|
|
2302
2302
|
}, [e, t]), s;
|
|
2303
|
-
},
|
|
2303
|
+
}, Wt = (e, t) => {
|
|
2304
2304
|
const { tokens: s } = V(e), r = Array.from(
|
|
2305
2305
|
new Set(s.map((n) => n.assetId))
|
|
2306
2306
|
);
|
|
@@ -2308,15 +2308,15 @@ const ot = [
|
|
|
2308
2308
|
const n = r.length === 1 ? s[0] : null;
|
|
2309
2309
|
n && t({ type: "on_select_token", token: n });
|
|
2310
2310
|
}, [s]);
|
|
2311
|
-
},
|
|
2311
|
+
}, Js = ({
|
|
2312
2312
|
onMsg: e,
|
|
2313
2313
|
isChanging: t = !0,
|
|
2314
2314
|
showBalance: s = !0,
|
|
2315
2315
|
heading: r
|
|
2316
2316
|
}) => {
|
|
2317
|
-
const { ctx: n } = _(), a =
|
|
2318
|
-
|
|
2319
|
-
const
|
|
2317
|
+
const { ctx: n } = _(), a = Pt(n.sourceToken);
|
|
2318
|
+
Wt("source", e);
|
|
2319
|
+
const c = L(() => {
|
|
2320
2320
|
if (!t && n.quoteStatus === "pending")
|
|
2321
2321
|
return "disabled";
|
|
2322
2322
|
if (!n.error)
|
|
@@ -2327,28 +2327,28 @@ const ot = [
|
|
|
2327
2327
|
return "error-balance";
|
|
2328
2328
|
}, [t, n.error, n.quoteStatus]);
|
|
2329
2329
|
return n.sourceToken ? /* @__PURE__ */ o(
|
|
2330
|
-
|
|
2330
|
+
Ve,
|
|
2331
2331
|
{
|
|
2332
2332
|
heading: r,
|
|
2333
2333
|
token: n.sourceToken,
|
|
2334
|
-
state:
|
|
2334
|
+
state: c,
|
|
2335
2335
|
balance: a,
|
|
2336
2336
|
showBalance: s,
|
|
2337
2337
|
showQuickBalanceActions: !0,
|
|
2338
2338
|
value: X(n.sourceTokenAmount, n.sourceToken?.decimals),
|
|
2339
2339
|
onMsg: e
|
|
2340
2340
|
}
|
|
2341
|
-
) : /* @__PURE__ */ o(
|
|
2342
|
-
},
|
|
2341
|
+
) : /* @__PURE__ */ o(Me, { heading: r, onMsg: e });
|
|
2342
|
+
}, ea = ({
|
|
2343
2343
|
isChanging: e = !1,
|
|
2344
2344
|
onMsg: t,
|
|
2345
2345
|
heading: s
|
|
2346
2346
|
}) => {
|
|
2347
|
-
const { ctx: r } = _(), { usdTradeDelta: n } = J(), a =
|
|
2348
|
-
|
|
2349
|
-
const
|
|
2347
|
+
const { ctx: r } = _(), { usdTradeDelta: n } = J(), a = Pt(r.targetToken);
|
|
2348
|
+
Wt("target", t);
|
|
2349
|
+
const c = L(() => !e && r.quoteStatus === "pending" ? "disabled" : "default", [e, r.quoteStatus]);
|
|
2350
2350
|
return r.targetToken ? /* @__PURE__ */ o(
|
|
2351
|
-
|
|
2351
|
+
Ve,
|
|
2352
2352
|
{
|
|
2353
2353
|
heading: s,
|
|
2354
2354
|
token: r.targetToken,
|
|
@@ -2356,26 +2356,26 @@ const ot = [
|
|
|
2356
2356
|
quoteUsdDelta: n?.percentage,
|
|
2357
2357
|
quoteUsdValue: r.quote && parseFloat(r.quote.amountOutUsd),
|
|
2358
2358
|
value: X(r.targetTokenAmount, r.targetToken?.decimals),
|
|
2359
|
-
state:
|
|
2359
|
+
state: c,
|
|
2360
2360
|
showQuickBalanceActions: !1,
|
|
2361
2361
|
showBalance: !0,
|
|
2362
2362
|
onMsg: t
|
|
2363
2363
|
}
|
|
2364
|
-
) : /* @__PURE__ */ o(
|
|
2365
|
-
},
|
|
2366
|
-
Skeleton:
|
|
2367
|
-
Source:
|
|
2368
|
-
Target:
|
|
2369
|
-
}),
|
|
2364
|
+
) : /* @__PURE__ */ o(Me, { heading: s, onMsg: t });
|
|
2365
|
+
}, ta = ({ token: e, heading: t, ...s }) => e ? /* @__PURE__ */ o(Ve, { ...s, token: e, heading: t }) : /* @__PURE__ */ o(Me, { onMsg: s.onMsg, heading: t }), Ul = Object.assign(ta, {
|
|
2366
|
+
Skeleton: _r,
|
|
2367
|
+
Source: Js,
|
|
2368
|
+
Target: ea
|
|
2369
|
+
}), Vt = ({
|
|
2370
2370
|
token: e,
|
|
2371
2371
|
balance: t,
|
|
2372
2372
|
showBalance: s = !0,
|
|
2373
2373
|
isNotSelectable: r,
|
|
2374
2374
|
isFocused: n,
|
|
2375
2375
|
className: a,
|
|
2376
|
-
onMsg:
|
|
2376
|
+
onMsg: c
|
|
2377
2377
|
}) => {
|
|
2378
|
-
const { ctx:
|
|
2378
|
+
const { ctx: l } = _(), { walletSupportedChains: d, appName: u } = y(), i = yr(t, e), m = d.includes(e.blockchain) || e.isIntent, p = t !== "0" && t !== 0 && t !== void 0;
|
|
2379
2379
|
return /* @__PURE__ */ o("li", { className: "list-none group", children: /* @__PURE__ */ T(
|
|
2380
2380
|
"div",
|
|
2381
2381
|
{
|
|
@@ -2388,10 +2388,10 @@ const ot = [
|
|
|
2388
2388
|
},
|
|
2389
2389
|
a
|
|
2390
2390
|
),
|
|
2391
|
-
onClick: () => !r &&
|
|
2391
|
+
onClick: () => !r && c({ type: "on_select_token", token: e }),
|
|
2392
2392
|
children: [
|
|
2393
2393
|
/* @__PURE__ */ o(
|
|
2394
|
-
|
|
2394
|
+
Ct,
|
|
2395
2395
|
{
|
|
2396
2396
|
token: e,
|
|
2397
2397
|
chainShowIcon: !e.isIntent,
|
|
@@ -2406,16 +2406,16 @@ const ot = [
|
|
|
2406
2406
|
e.isIntent ? /* @__PURE__ */ T("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2407
2407
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2408
2408
|
" ",
|
|
2409
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${
|
|
2409
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${u} ${e.chainName.toLowerCase() !== "near" && p ? `(${e.chainName})` : ""}` })
|
|
2410
2410
|
] }) : /* @__PURE__ */ T("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2411
2411
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2412
2412
|
" ",
|
|
2413
2413
|
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${e.chainName}` })
|
|
2414
2414
|
] })
|
|
2415
2415
|
] }),
|
|
2416
|
-
|
|
2416
|
+
m && !!l.walletAddress && s && /* @__PURE__ */ T("div", { className: "gap-sw-xs flex flex-col items-end", children: [
|
|
2417
2417
|
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(
|
|
2418
|
-
|
|
2418
|
+
Ue,
|
|
2419
2419
|
{
|
|
2420
2420
|
decimals: e.decimals,
|
|
2421
2421
|
value: t === void 0 ? "0" : `${t}`
|
|
@@ -2426,25 +2426,25 @@ const ot = [
|
|
|
2426
2426
|
]
|
|
2427
2427
|
}
|
|
2428
2428
|
) });
|
|
2429
|
-
},
|
|
2429
|
+
}, na = ({
|
|
2430
2430
|
variant: e,
|
|
2431
2431
|
search: t,
|
|
2432
2432
|
className: s,
|
|
2433
2433
|
groupTokens: r,
|
|
2434
2434
|
showBalances: n,
|
|
2435
2435
|
chainsFilter: a,
|
|
2436
|
-
selectedChain:
|
|
2437
|
-
chainIsNotSupported:
|
|
2436
|
+
selectedChain: c,
|
|
2437
|
+
chainIsNotSupported: l,
|
|
2438
2438
|
onMsg: d
|
|
2439
2439
|
}) => {
|
|
2440
|
-
const { t:
|
|
2440
|
+
const { t: u } = K(), { ctx: i } = _(), { walletSupportedChains: m, appName: p, priorityAssets: w = [] } = y(), { mergedBalance: f } = Te(), g = js({
|
|
2441
2441
|
variant: e,
|
|
2442
2442
|
search: t,
|
|
2443
2443
|
chainsFilter: a,
|
|
2444
|
-
selectedChain:
|
|
2445
|
-
walletSupportedChains:
|
|
2444
|
+
selectedChain: c,
|
|
2445
|
+
walletSupportedChains: m,
|
|
2446
2446
|
priorityAssets: w
|
|
2447
|
-
}), k = i.walletAddress ? r : !1, b =
|
|
2447
|
+
}), k = i.walletAddress ? r : !1, b = Br(g.all, t), B = Z(null), [D, C] = ne(-1), S = L(
|
|
2448
2448
|
() => [{ tokens: g.all }],
|
|
2449
2449
|
[g.all]
|
|
2450
2450
|
), U = L(() => [
|
|
@@ -2454,29 +2454,29 @@ const ot = [
|
|
|
2454
2454
|
] : [],
|
|
2455
2455
|
...g.wallet.length > 0 ? [
|
|
2456
2456
|
{
|
|
2457
|
-
label:
|
|
2457
|
+
label: l ? null : "Connected wallet",
|
|
2458
2458
|
count: g.wallet.length
|
|
2459
2459
|
},
|
|
2460
2460
|
{ tokens: g.wallet }
|
|
2461
2461
|
] : []
|
|
2462
|
-
].filter(Boolean), [g.wallet, g.intents,
|
|
2462
|
+
].filter(Boolean), [g.wallet, g.intents, l]), Q = k ? U : S, ae = Lr(Q), Qt = Or(Q), $e = Dr(Q), $t = ce(() => {
|
|
2463
2463
|
C(-1);
|
|
2464
2464
|
}, []);
|
|
2465
|
-
switch (
|
|
2465
|
+
switch (Er({
|
|
2466
2466
|
listRef: B.current,
|
|
2467
2467
|
initialFocusedIndex: k ? 1 : 0,
|
|
2468
2468
|
onFocus: (P) => C(P),
|
|
2469
|
-
onBlur:
|
|
2469
|
+
onBlur: $t
|
|
2470
2470
|
}), b) {
|
|
2471
2471
|
case "EMPTY_SEARCH":
|
|
2472
2472
|
return /* @__PURE__ */ o(
|
|
2473
|
-
|
|
2473
|
+
Re,
|
|
2474
2474
|
{
|
|
2475
2475
|
hasAction: !0,
|
|
2476
2476
|
actionType: "outlined",
|
|
2477
|
-
actionLabel:
|
|
2478
|
-
heading:
|
|
2479
|
-
subHeading:
|
|
2477
|
+
actionLabel: u("tokens.list.searchReset.label", "Clear search"),
|
|
2478
|
+
heading: u("tokens.list.searchEmpty.label", "No results"),
|
|
2479
|
+
subHeading: u(
|
|
2480
2480
|
"tokens.list.searchEmpty.subLabel",
|
|
2481
2481
|
"Try another search or check if a specific network is selected."
|
|
2482
2482
|
),
|
|
@@ -2486,17 +2486,17 @@ const ot = [
|
|
|
2486
2486
|
);
|
|
2487
2487
|
case "HAS_TOKENS":
|
|
2488
2488
|
return /* @__PURE__ */ o("div", { className: H("gap-sw-lg flex flex-col", s), children: /* @__PURE__ */ o(
|
|
2489
|
-
|
|
2489
|
+
br,
|
|
2490
2490
|
{
|
|
2491
2491
|
ref: B,
|
|
2492
2492
|
tabIndex: 0,
|
|
2493
|
-
id:
|
|
2494
|
-
itemSize:
|
|
2493
|
+
id: vr,
|
|
2494
|
+
itemSize: Cr,
|
|
2495
2495
|
className: "hide-scrollbar",
|
|
2496
2496
|
style: {
|
|
2497
2497
|
minHeight: 200,
|
|
2498
2498
|
height: ae,
|
|
2499
|
-
maxHeight:
|
|
2499
|
+
maxHeight: Rr,
|
|
2500
2500
|
overflowAnchor: "none",
|
|
2501
2501
|
outline: "none"
|
|
2502
2502
|
},
|
|
@@ -2506,7 +2506,7 @@ const ot = [
|
|
|
2506
2506
|
case "ArrowUp": {
|
|
2507
2507
|
P.preventDefault();
|
|
2508
2508
|
let v = Math.max(D - 1, 0);
|
|
2509
|
-
k &&
|
|
2509
|
+
k && $e.includes(v) && (v = v === 0 ? 1 : v - 1), C(v), B.current?.scrollToIndex(v, {
|
|
2510
2510
|
align: "center",
|
|
2511
2511
|
smooth: !0
|
|
2512
2512
|
});
|
|
@@ -2514,8 +2514,8 @@ const ot = [
|
|
|
2514
2514
|
}
|
|
2515
2515
|
case "ArrowDown": {
|
|
2516
2516
|
P.preventDefault();
|
|
2517
|
-
let v = Math.min(D + 1,
|
|
2518
|
-
k &&
|
|
2517
|
+
let v = Math.min(D + 1, Qt - 1);
|
|
2518
|
+
k && $e.includes(v) && (v = v === 0 ? 1 : v + 1), C(v), B.current?.scrollToIndex(v, {
|
|
2519
2519
|
align: "center",
|
|
2520
2520
|
smooth: !0
|
|
2521
2521
|
});
|
|
@@ -2523,41 +2523,41 @@ const ot = [
|
|
|
2523
2523
|
}
|
|
2524
2524
|
case "Enter": {
|
|
2525
2525
|
P.preventDefault();
|
|
2526
|
-
const v =
|
|
2526
|
+
const v = Fr(Q, D);
|
|
2527
2527
|
v && d({ type: "on_select_token", token: v });
|
|
2528
2528
|
break;
|
|
2529
2529
|
}
|
|
2530
2530
|
}
|
|
2531
2531
|
},
|
|
2532
2532
|
children: Q.map(
|
|
2533
|
-
({ label: P, count: v, tokens:
|
|
2534
|
-
const
|
|
2533
|
+
({ label: P, count: v, tokens: Ke }, He) => {
|
|
2534
|
+
const Kt = xr(
|
|
2535
2535
|
Q,
|
|
2536
|
-
|
|
2536
|
+
He
|
|
2537
2537
|
);
|
|
2538
2538
|
return P !== void 0 ? P ? /* @__PURE__ */ T(
|
|
2539
2539
|
"header",
|
|
2540
2540
|
{
|
|
2541
2541
|
className: "pb-sw-lg pt-sw-sm flex flex-col",
|
|
2542
2542
|
children: [
|
|
2543
|
-
/* @__PURE__ */ o(
|
|
2543
|
+
/* @__PURE__ */ o(qr, {}),
|
|
2544
2544
|
/* @__PURE__ */ o("span", { className: "text-sw-label-sm pt-sw-xl text-sw-gray-100", children: `${P} — ${v}` })
|
|
2545
2545
|
]
|
|
2546
2546
|
},
|
|
2547
2547
|
P
|
|
2548
|
-
) : /* @__PURE__ */ o("header", {},
|
|
2549
|
-
const
|
|
2548
|
+
) : /* @__PURE__ */ o("header", {}, He) : Ke ? Ke.map((Ge, Ht) => {
|
|
2549
|
+
const je = Y(Ge);
|
|
2550
2550
|
return /* @__PURE__ */ o(
|
|
2551
|
-
|
|
2551
|
+
Vt,
|
|
2552
2552
|
{
|
|
2553
|
-
token:
|
|
2553
|
+
token: Ge,
|
|
2554
2554
|
showBalance: n,
|
|
2555
|
-
balance: f[
|
|
2556
|
-
isFocused: D ===
|
|
2557
|
-
isNotSelectable:
|
|
2555
|
+
balance: f[je],
|
|
2556
|
+
isFocused: D === Kt + Ht,
|
|
2557
|
+
isNotSelectable: l && !!i.walletAddress,
|
|
2558
2558
|
onMsg: d
|
|
2559
2559
|
},
|
|
2560
|
-
|
|
2560
|
+
je
|
|
2561
2561
|
);
|
|
2562
2562
|
}) : null;
|
|
2563
2563
|
}
|
|
@@ -2567,52 +2567,64 @@ const ot = [
|
|
|
2567
2567
|
case "NO_TOKENS":
|
|
2568
2568
|
default:
|
|
2569
2569
|
return /* @__PURE__ */ o(
|
|
2570
|
-
|
|
2570
|
+
Re,
|
|
2571
2571
|
{
|
|
2572
2572
|
className: "pt-sw-5xl pb-sw-5xl",
|
|
2573
|
-
subHeading:
|
|
2573
|
+
subHeading: u(
|
|
2574
2574
|
"tokens.list.noBalanceOnApp.subLabel",
|
|
2575
2575
|
"Deposit funds to get started"
|
|
2576
2576
|
),
|
|
2577
|
-
heading:
|
|
2577
|
+
heading: u("tokens.list.noBalanceOnApp.label", {
|
|
2578
2578
|
defaultValue: "You have no balances on {{appName}}",
|
|
2579
2579
|
appName: p
|
|
2580
2580
|
})
|
|
2581
2581
|
}
|
|
2582
2582
|
);
|
|
2583
2583
|
}
|
|
2584
|
-
},
|
|
2585
|
-
Placeholder:
|
|
2586
|
-
Item:
|
|
2584
|
+
}, Pl = Object.assign(na, {
|
|
2585
|
+
Placeholder: Re,
|
|
2586
|
+
Item: Vt
|
|
2587
2587
|
}), ie = (e, t, s) => {
|
|
2588
2588
|
let r = document.body;
|
|
2589
|
-
s instanceof HTMLElement && (r = s), r.style.setProperty(
|
|
2590
|
-
},
|
|
2589
|
+
s instanceof HTMLElement && (r = s), r.style.setProperty(e, t);
|
|
2590
|
+
}, le = (e, t, s) => {
|
|
2591
|
+
ie(`--c-sw-${e}`, t, s);
|
|
2592
|
+
}, ra = (e, t, s) => {
|
|
2591
2593
|
Object.entries(e).forEach(([r, n]) => {
|
|
2592
|
-
|
|
2594
|
+
le(`${t}-${r}`, n, s);
|
|
2593
2595
|
});
|
|
2594
|
-
},
|
|
2595
|
-
const a =
|
|
2596
|
-
a &&
|
|
2597
|
-
},
|
|
2596
|
+
}, ke = (e, t, s, r, n) => {
|
|
2597
|
+
const a = Mr(r, n, t);
|
|
2598
|
+
a && ra(a, e, s);
|
|
2599
|
+
}, sa = (e, t) => {
|
|
2600
|
+
const s = {
|
|
2601
|
+
none: { sm: 0, md: 0, lg: 0 },
|
|
2602
|
+
sm: { sm: 4, md: 6, lg: 10 },
|
|
2603
|
+
md: { sm: 6, md: 10, lg: 16 },
|
|
2604
|
+
lg: { sm: 8, md: 24, lg: 24 }
|
|
2605
|
+
};
|
|
2606
|
+
ie("--r-sw-sm", `${s[e].sm}px`, t), ie("--r-sw-md", `${s[e].md}px`, t), ie("--r-sw-lg", `${s[e].lg}px`, t);
|
|
2607
|
+
}, aa = (e, t) => {
|
|
2598
2608
|
const {
|
|
2599
2609
|
primaryColor: s,
|
|
2600
2610
|
surfaceColor: r,
|
|
2601
2611
|
successColor: n,
|
|
2602
2612
|
warningColor: a,
|
|
2603
|
-
errorColor:
|
|
2604
|
-
colorScheme:
|
|
2613
|
+
errorColor: c,
|
|
2614
|
+
colorScheme: l = "dark",
|
|
2615
|
+
borderRadius: d = "md",
|
|
2616
|
+
stylePreset: u = "clean"
|
|
2605
2617
|
} = t;
|
|
2606
|
-
s &&
|
|
2607
|
-
},
|
|
2618
|
+
s && (ke("accent", 500, e, s, l), u === "bold" && ke("gray", 50, e, s, l)), r && u === "clean" && ke("gray", 950, e, r, l), n && le("status-success", n, e), a && le("status-warning", a, e), c && le("status-error", c, e), d && sa(d, e);
|
|
2619
|
+
}, oa = mt(void 0), ia = ({ children: e, theme: t }) => {
|
|
2608
2620
|
const { themeParentElementSelector: s } = y(), r = L(() => t, [t]);
|
|
2609
2621
|
return R(() => {
|
|
2610
2622
|
if (t) {
|
|
2611
2623
|
const n = s ? document.querySelector(s) : null;
|
|
2612
|
-
|
|
2624
|
+
aa(n, t);
|
|
2613
2625
|
}
|
|
2614
|
-
}, [t]), /* @__PURE__ */ o(
|
|
2615
|
-
},
|
|
2626
|
+
}, [t]), /* @__PURE__ */ o(oa.Provider, { value: r, children: /* @__PURE__ */ o("div", { className: "sw", children: e }) });
|
|
2627
|
+
}, Ae = ({
|
|
2616
2628
|
text: e,
|
|
2617
2629
|
icon: t
|
|
2618
2630
|
}) => /* @__PURE__ */ T("li", { className: "flex items-center gap-sw-md", children: [
|
|
@@ -2634,10 +2646,10 @@ const ot = [
|
|
|
2634
2646
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md", children: e })
|
|
2635
2647
|
]
|
|
2636
2648
|
}
|
|
2637
|
-
),
|
|
2649
|
+
), la = ({ isSigned: e, isSigning: t, onMsg: s }) => {
|
|
2638
2650
|
const { t: r } = K(), n = () => s({ type: "on_close" });
|
|
2639
|
-
|
|
2640
|
-
const a =
|
|
2651
|
+
vt("Escape", n);
|
|
2652
|
+
const a = jr({
|
|
2641
2653
|
endTime: 0,
|
|
2642
2654
|
autostart: !1,
|
|
2643
2655
|
timerType: "DECREMENTAL",
|
|
@@ -2646,15 +2658,15 @@ const ot = [
|
|
|
2646
2658
|
});
|
|
2647
2659
|
return R(() => {
|
|
2648
2660
|
e ? a.start() : a.reset();
|
|
2649
|
-
}, [e]), /* @__PURE__ */ T(
|
|
2661
|
+
}, [e]), /* @__PURE__ */ T(pe, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2650
2662
|
/* @__PURE__ */ o(
|
|
2651
|
-
|
|
2663
|
+
Dt,
|
|
2652
2664
|
{
|
|
2653
2665
|
onClick: n,
|
|
2654
2666
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2655
2667
|
}
|
|
2656
2668
|
),
|
|
2657
|
-
/* @__PURE__ */ o(
|
|
2669
|
+
/* @__PURE__ */ o($r, { size: 48, className: "text-sw-status-warning" }),
|
|
2658
2670
|
/* @__PURE__ */ T("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2659
2671
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: r(
|
|
2660
2672
|
"walletCompatibility.modal.title.initial",
|
|
@@ -2667,33 +2679,33 @@ const ot = [
|
|
|
2667
2679
|
] }),
|
|
2668
2680
|
/* @__PURE__ */ T("ul", { className: "flex flex-col gap-sw-xl", children: [
|
|
2669
2681
|
/* @__PURE__ */ o(
|
|
2670
|
-
|
|
2682
|
+
Ae,
|
|
2671
2683
|
{
|
|
2672
2684
|
text: r(
|
|
2673
2685
|
"walletCompatibility.modal.feature.secureTransactions",
|
|
2674
2686
|
"Read-only signature – no gas required."
|
|
2675
2687
|
),
|
|
2676
|
-
icon:
|
|
2688
|
+
icon: Kr
|
|
2677
2689
|
}
|
|
2678
2690
|
),
|
|
2679
2691
|
/* @__PURE__ */ o(
|
|
2680
|
-
|
|
2692
|
+
Ae,
|
|
2681
2693
|
{
|
|
2682
2694
|
text: r(
|
|
2683
2695
|
"walletCompatibility.modal.feature.fullAccess",
|
|
2684
2696
|
"No access to your funds, no hidden permissions."
|
|
2685
2697
|
),
|
|
2686
|
-
icon:
|
|
2698
|
+
icon: Hr
|
|
2687
2699
|
}
|
|
2688
2700
|
),
|
|
2689
2701
|
/* @__PURE__ */ o(
|
|
2690
|
-
|
|
2702
|
+
Ae,
|
|
2691
2703
|
{
|
|
2692
2704
|
text: r(
|
|
2693
2705
|
"walletCompatibility.modal.feature.fundProtection",
|
|
2694
2706
|
"Only checks whether your wallet is supported."
|
|
2695
2707
|
),
|
|
2696
|
-
icon:
|
|
2708
|
+
icon: Qr
|
|
2697
2709
|
}
|
|
2698
2710
|
)
|
|
2699
2711
|
] }),
|
|
@@ -2706,7 +2718,7 @@ const ot = [
|
|
|
2706
2718
|
"Wallet verified"
|
|
2707
2719
|
),
|
|
2708
2720
|
className: "bg-sw-status-success text-sw-gray-950",
|
|
2709
|
-
icon:
|
|
2721
|
+
icon: Vr
|
|
2710
2722
|
}
|
|
2711
2723
|
),
|
|
2712
2724
|
a.status === "RUNNING" && /* @__PURE__ */ o(
|
|
@@ -2744,17 +2756,17 @@ const ot = [
|
|
|
2744
2756
|
)
|
|
2745
2757
|
] })
|
|
2746
2758
|
] });
|
|
2747
|
-
},
|
|
2759
|
+
}, ca = ({ onMsg: e }) => {
|
|
2748
2760
|
const { t } = K(), s = () => e({ type: "on_close" });
|
|
2749
|
-
return
|
|
2761
|
+
return vt("Escape", s), /* @__PURE__ */ T(pe, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2750
2762
|
/* @__PURE__ */ o(
|
|
2751
|
-
|
|
2763
|
+
Dt,
|
|
2752
2764
|
{
|
|
2753
2765
|
onClick: s,
|
|
2754
2766
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2755
2767
|
}
|
|
2756
2768
|
),
|
|
2757
|
-
/* @__PURE__ */ o(
|
|
2769
|
+
/* @__PURE__ */ o(Gr, { size: 48, className: "text-sw-status-error" }),
|
|
2758
2770
|
/* @__PURE__ */ T("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2759
2771
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: t(
|
|
2760
2772
|
"walletCompatibility.modal.title.error",
|
|
@@ -2790,9 +2802,9 @@ const ot = [
|
|
|
2790
2802
|
)
|
|
2791
2803
|
] })
|
|
2792
2804
|
] });
|
|
2793
|
-
},
|
|
2794
|
-
Error:
|
|
2795
|
-
}),
|
|
2805
|
+
}, Wl = Object.assign(la, {
|
|
2806
|
+
Error: ca
|
|
2807
|
+
}), da = (e) => null, ua = (e) => (t) => {
|
|
2796
2808
|
if (t instanceof M)
|
|
2797
2809
|
throw t;
|
|
2798
2810
|
const s = new M(
|
|
@@ -2800,34 +2812,34 @@ const ot = [
|
|
|
2800
2812
|
{ cause: t }
|
|
2801
2813
|
);
|
|
2802
2814
|
throw s.context = e, s;
|
|
2803
|
-
},
|
|
2815
|
+
}, ma = ({ children: e }) => {
|
|
2804
2816
|
const { ctx: t } = _();
|
|
2805
2817
|
return /* @__PURE__ */ o(
|
|
2806
|
-
|
|
2818
|
+
Xr,
|
|
2807
2819
|
{
|
|
2808
|
-
FallbackComponent:
|
|
2809
|
-
onError:
|
|
2820
|
+
FallbackComponent: da,
|
|
2821
|
+
onError: ua(t),
|
|
2810
2822
|
children: e
|
|
2811
2823
|
}
|
|
2812
2824
|
);
|
|
2813
|
-
},
|
|
2825
|
+
}, fa = new nn({
|
|
2814
2826
|
defaultOptions: {
|
|
2815
2827
|
queries: {
|
|
2816
2828
|
staleTime: 2e3 * 60,
|
|
2817
|
-
retry:
|
|
2829
|
+
retry: dt.env.NODE_ENV === "test" ? !1 : 3
|
|
2818
2830
|
}
|
|
2819
2831
|
}
|
|
2820
|
-
}),
|
|
2832
|
+
}), pa = ["fms", "abg", "stjack", "noear", "testnebula"], me = {
|
|
2821
2833
|
appName: "Unknown",
|
|
2822
2834
|
slippageTolerance: 100,
|
|
2823
2835
|
// 1%
|
|
2824
2836
|
intentsAccountType: "evm",
|
|
2825
|
-
walletSupportedChains:
|
|
2837
|
+
walletSupportedChains: fn,
|
|
2826
2838
|
connectedWallets: {},
|
|
2827
2839
|
enableAutoTokensSwitching: !0,
|
|
2828
2840
|
showIntentTokens: !0,
|
|
2829
|
-
chainsOrder:
|
|
2830
|
-
filterTokens: (e) => !
|
|
2841
|
+
chainsOrder: ht,
|
|
2842
|
+
filterTokens: (e) => !pa.includes(e.symbol.toLocaleLowerCase()),
|
|
2831
2843
|
chainsFilter: {
|
|
2832
2844
|
source: { external: "wallet-supported", intents: "none" },
|
|
2833
2845
|
target: { external: "all", intents: "none" }
|
|
@@ -2844,16 +2856,16 @@ const ot = [
|
|
|
2844
2856
|
return ["eth", "btc", "sol", "near"];
|
|
2845
2857
|
}
|
|
2846
2858
|
}
|
|
2847
|
-
},
|
|
2848
|
-
config:
|
|
2849
|
-
}),
|
|
2850
|
-
config:
|
|
2859
|
+
}, Mt = mt({
|
|
2860
|
+
config: me
|
|
2861
|
+
}), Qe = ut({
|
|
2862
|
+
config: me
|
|
2851
2863
|
}), y = () => {
|
|
2852
|
-
const e =
|
|
2853
|
-
return
|
|
2854
|
-
},
|
|
2855
|
-
|
|
2856
|
-
},
|
|
2864
|
+
const e = Jt(Mt);
|
|
2865
|
+
return fe(e).config;
|
|
2866
|
+
}, ha = (e) => {
|
|
2867
|
+
Qe.config = Se(e);
|
|
2868
|
+
}, Vl = ({
|
|
2857
2869
|
children: e,
|
|
2858
2870
|
config: t,
|
|
2859
2871
|
balanceViaRpc: s = !0,
|
|
@@ -2862,109 +2874,109 @@ const ot = [
|
|
|
2862
2874
|
rpcs: n,
|
|
2863
2875
|
theme: a
|
|
2864
2876
|
}) => {
|
|
2865
|
-
const
|
|
2866
|
-
|
|
2867
|
-
config:
|
|
2868
|
-
...
|
|
2877
|
+
const c = Z(
|
|
2878
|
+
ut({
|
|
2879
|
+
config: Se({
|
|
2880
|
+
...me,
|
|
2869
2881
|
...t
|
|
2870
2882
|
})
|
|
2871
2883
|
})
|
|
2872
2884
|
);
|
|
2873
2885
|
return R(() => {
|
|
2874
|
-
const
|
|
2875
|
-
...
|
|
2886
|
+
const l = Se({
|
|
2887
|
+
...me,
|
|
2876
2888
|
...t
|
|
2877
2889
|
});
|
|
2878
|
-
Object.assign(
|
|
2879
|
-
}, [t]),
|
|
2880
|
-
/* @__PURE__ */ T(
|
|
2881
|
-
/* @__PURE__ */ T(
|
|
2890
|
+
Object.assign(c.current.config, l), ha(l);
|
|
2891
|
+
}, [t]), on(r ?? {}), Yr("headlessui-portal-root", "sw"), /* @__PURE__ */ o(rn, { client: fa, children: /* @__PURE__ */ o(an, { i18n: jt, children: /* @__PURE__ */ T(Mt.Provider, { value: c.current, children: [
|
|
2892
|
+
/* @__PURE__ */ T(zt, { children: [
|
|
2893
|
+
/* @__PURE__ */ T(Yt, { children: [
|
|
2882
2894
|
/* @__PURE__ */ o("link", { rel: "preconnect", href: "https://rsms.me/" }),
|
|
2883
2895
|
/* @__PURE__ */ o("link", { rel: "stylesheet", href: "https://rsms.me/inter/inter.css" })
|
|
2884
2896
|
] }),
|
|
2885
|
-
/* @__PURE__ */ o(
|
|
2897
|
+
/* @__PURE__ */ o(ia, { theme: a, children: dt.env.NODE_ENV === "test" ? e : /* @__PURE__ */ o(ma, { children: e }) })
|
|
2886
2898
|
] }),
|
|
2887
2899
|
s && /* @__PURE__ */ o(
|
|
2888
|
-
|
|
2900
|
+
ds,
|
|
2889
2901
|
{
|
|
2890
|
-
rpcs: n ??
|
|
2902
|
+
rpcs: n ?? zr,
|
|
2891
2903
|
connectedWallets: t.connectedWallets ?? {}
|
|
2892
2904
|
}
|
|
2893
2905
|
)
|
|
2894
2906
|
] }) }) });
|
|
2895
2907
|
};
|
|
2896
2908
|
export {
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2909
|
+
Ds as $,
|
|
2910
|
+
Bl as A,
|
|
2911
|
+
ds as B,
|
|
2912
|
+
oa as C,
|
|
2913
|
+
rs as D,
|
|
2914
|
+
rt as E,
|
|
2915
|
+
fs as F,
|
|
2916
|
+
ps as G,
|
|
2917
|
+
hs as H,
|
|
2918
|
+
Ts as I,
|
|
2919
|
+
ws as J,
|
|
2920
|
+
Ft as K,
|
|
2921
|
+
Lt as L,
|
|
2922
|
+
Ut as M,
|
|
2923
|
+
Bt as N,
|
|
2924
|
+
qt as O,
|
|
2925
|
+
ks as P,
|
|
2914
2926
|
q as Q,
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
|
|
2929
|
-
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2927
|
+
As as R,
|
|
2928
|
+
Hs as S,
|
|
2929
|
+
ta as T,
|
|
2930
|
+
Ss as U,
|
|
2931
|
+
Ns as V,
|
|
2932
|
+
Vl as W,
|
|
2933
|
+
_s as X,
|
|
2934
|
+
ys as Y,
|
|
2935
|
+
bs as Z,
|
|
2936
|
+
Es as _,
|
|
2937
|
+
Ll as a,
|
|
2938
|
+
xs as a0,
|
|
2939
|
+
Fs as a1,
|
|
2940
|
+
Ls as a2,
|
|
2941
|
+
Gs as a3,
|
|
2942
|
+
Xs as a4,
|
|
2943
|
+
Zs as a5,
|
|
2944
|
+
Ve as a6,
|
|
2945
|
+
Me as a7,
|
|
2946
|
+
Wt as a8,
|
|
2947
|
+
Js as a9,
|
|
2948
|
+
ea as aa,
|
|
2949
|
+
Vt as ab,
|
|
2950
|
+
na as ac,
|
|
2951
|
+
ia as ad,
|
|
2952
|
+
la as ae,
|
|
2953
|
+
ca as af,
|
|
2954
|
+
ma as ag,
|
|
2955
|
+
Qe as ah,
|
|
2944
2956
|
_ as b,
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
|
|
2957
|
+
Ol as c,
|
|
2958
|
+
ms as d,
|
|
2959
|
+
ls as e,
|
|
2960
|
+
he as f,
|
|
2961
|
+
Us as g,
|
|
2962
|
+
Is as h,
|
|
2963
|
+
Ps as i,
|
|
2964
|
+
Os as j,
|
|
2965
|
+
Te as k,
|
|
2966
|
+
Vs as l,
|
|
2967
|
+
js as m,
|
|
2956
2968
|
V as n,
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2969
|
+
ql as o,
|
|
2970
|
+
Ul as p,
|
|
2971
|
+
Pl as q,
|
|
2972
|
+
Rs as r,
|
|
2973
|
+
Pt as s,
|
|
2974
|
+
Ot as t,
|
|
2963
2975
|
J as u,
|
|
2964
2976
|
M as v,
|
|
2965
2977
|
I as w,
|
|
2966
|
-
|
|
2978
|
+
Fl as x,
|
|
2967
2979
|
y,
|
|
2968
|
-
|
|
2980
|
+
Wl as z
|
|
2969
2981
|
};
|
|
2970
|
-
//# sourceMappingURL=config-
|
|
2982
|
+
//# sourceMappingURL=config-ZkO5GwI_.js.map
|