@aurora-is-near/intents-swap-widget 3.18.0 → 3.18.1
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/chains.d.ts +5 -0
- package/dist/chains.js +15 -0
- package/dist/chains.js.map +1 -0
- package/dist/components/WidgetContainer.js +20 -17
- package/dist/components/WidgetContainer.js.map +1 -1
- package/dist/{config-BJ5jppn5.js → config-DJObWR7Z.js} +622 -613
- package/dist/{config-BJ5jppn5.js.map → config-DJObWR7Z.js.map} +1 -1
- package/dist/config.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.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/icons/index.d.ts +2 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +87 -85
- package/dist/index.js.map +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/theme/ThemeProvider.js +1 -1
- package/dist/types/theme.d.ts +3 -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 +2 -26
- package/src/chains.ts +14 -0
- package/src/components/WidgetContainer.tsx +7 -3
- package/src/icons/index.tsx +5 -1
- package/src/index.ts +1 -0
- package/src/theme/ThemeProvider.tsx +32 -5
- package/src/types/theme.ts +3 -0
- package/src/widgets/WidgetDeposit/WidgetDeposit.test.tsx +1 -1
|
@@ -1,165 +1,165 @@
|
|
|
1
|
-
import { p as
|
|
2
|
-
import { jsx as o, jsxs as h, Fragment as
|
|
3
|
-
import
|
|
4
|
-
import { deepClone as
|
|
5
|
-
import { snapshot as
|
|
6
|
-
import { HelmetProvider as
|
|
7
|
-
import { memo as
|
|
8
|
-
import { useQuery as
|
|
9
|
-
import { Trans as
|
|
10
|
-
import { useTypedTranslation as $, initLocalisation as
|
|
1
|
+
import { p as ct } from "./index-xuotMAFm.js";
|
|
2
|
+
import { jsx as o, jsxs as h, Fragment as Kt } from "react/jsx-runtime";
|
|
3
|
+
import Ht from "i18next";
|
|
4
|
+
import { deepClone as ke } from "valtio/utils";
|
|
5
|
+
import { snapshot as Ee, useSnapshot as me, proxy as dt } from "valtio";
|
|
6
|
+
import { HelmetProvider as Gt, Helmet as jt } from "react-helmet-async";
|
|
7
|
+
import { memo as zt, useEffect as R, useMemo as L, useRef as X, useCallback as le, useState as te, useId as Yt, createContext as ut, useContext as Xt } from "react";
|
|
8
|
+
import { useQuery as Re, useInfiniteQuery as Zt, useQueryClient as Jt, QueryClient as en, QueryClientProvider as tn } from "@tanstack/react-query";
|
|
9
|
+
import { Trans as nn, I18nextProvider as sn } from "react-i18next";
|
|
10
|
+
import { useTypedTranslation as $, initLocalisation as rn } from "./localisation.js";
|
|
11
11
|
import { logger as E } from "./logger.js";
|
|
12
|
-
import { getTonTokenBalance as
|
|
13
|
-
import { getSolanaTokenBalance as
|
|
14
|
-
import { useWalletAddressForToken as
|
|
12
|
+
import { getTonTokenBalance as an } from "./utils/ton/getTonTokenBalance.js";
|
|
13
|
+
import { getSolanaTokenBalance as on } from "./utils/solana/getSolanaTokenBalance.js";
|
|
14
|
+
import { useWalletAddressForToken as mt } from "./hooks/useWalletAddressForToken.js";
|
|
15
15
|
import "@headlessui/react";
|
|
16
16
|
import "framer-motion";
|
|
17
17
|
import "lucide-react";
|
|
18
18
|
import "./features/ChainsDropdown/ChainItem.js";
|
|
19
19
|
import { cn as K } from "./utils/cn.js";
|
|
20
|
-
import { OneClickService as
|
|
21
|
-
import { CHAINS_LIST as
|
|
20
|
+
import { OneClickService as ln, QuoteRequest as W, GetExecutionStatusResponse as ee } from "@defuse-protocol/one-click-sdk-typescript";
|
|
21
|
+
import { CHAINS_LIST as ft, DEFAULT_CHAINS_ORDER as pt, CHAIN_POA_MAP as Tt, POA_EVM_CHAIN_ID as ht, CHAIN_BASE_TOKENS as cn, EVM_CHAIN_IDS_MAP as Ae, CHAIN_IDS_MAP as dn, EVM_CHAINS as un } from "./constants/chains.js";
|
|
22
22
|
import "use-debounce";
|
|
23
|
-
import { derive as
|
|
24
|
-
import { getIsNativeNearDeposit as
|
|
25
|
-
import { getIsDirectTokenOnNearDeposit as
|
|
23
|
+
import { derive as mn } from "derive-valtio";
|
|
24
|
+
import { getIsNativeNearDeposit as fn } from "./machine/computed/getIsNativeNearDeposit.js";
|
|
25
|
+
import { getIsDirectTokenOnNearDeposit as pn } from "./machine/computed/getIsDirectTokenOnNearDeposit.js";
|
|
26
26
|
import "ethers";
|
|
27
27
|
import { moveTo as F, machine as J } from "./machine/machine.js";
|
|
28
|
-
import
|
|
28
|
+
import Tn from "lodash.once";
|
|
29
29
|
import { guardStates as x } from "./machine/guards/index.js";
|
|
30
|
-
import { parse as
|
|
31
|
-
import { createLoader as
|
|
32
|
-
import { isAlchemySupportedChain as
|
|
30
|
+
import { parse as hn } from "./ext/alchemy/parse.js";
|
|
31
|
+
import { createLoader as gn } from "./ext/alchemy/load.js";
|
|
32
|
+
import { isAlchemySupportedChain as In } from "./ext/alchemy/types.js";
|
|
33
33
|
import { fireEvent as T } from "./machine/events/utils/fireEvent.js";
|
|
34
|
-
import { NATIVE_NEAR_DUMB_ASSET_ID as G, TOKENS_DATA as
|
|
35
|
-
import { isValidChain as
|
|
36
|
-
import { useWalletBalance as
|
|
34
|
+
import { NATIVE_NEAR_DUMB_ASSET_ID as G, TOKENS_DATA as Ce, WNEAR_ASSET_ID as Se } from "./constants/tokens.js";
|
|
35
|
+
import { isValidChain as wn } from "./utils/checkers/isValidChain.js";
|
|
36
|
+
import { useWalletBalance as De } from "./hooks/useWalletBalance.js";
|
|
37
37
|
import { getIntentsAccountId as ne } from "./utils/intents/getIntentsAccountId.js";
|
|
38
|
-
import { getIntentsBalances as
|
|
39
|
-
import { notReachable as
|
|
38
|
+
import { getIntentsBalances as kn } from "./utils/intents/getIntentsBalance.js";
|
|
39
|
+
import { notReachable as ve } from "./utils/notReachable.js";
|
|
40
40
|
import { getTokenBalanceKey as z } from "./utils/intents/getTokenBalanceKey.js";
|
|
41
|
-
import { isDryQuote as
|
|
42
|
-
import { snakeCase as
|
|
43
|
-
import
|
|
44
|
-
import { oneClickApi as
|
|
41
|
+
import { isDryQuote as xe } from "./machine/guards/checks/isDryQuote.js";
|
|
42
|
+
import { snakeCase as gt } from "change-case";
|
|
43
|
+
import An, { CanceledError as It, AxiosError as wt } from "axios";
|
|
44
|
+
import { oneClickApi as Ne, bridgeApi as kt } from "./network.js";
|
|
45
45
|
import { formatBigToHuman as Y } from "./utils/formatters/formatBigToHuman.js";
|
|
46
|
-
import { getDryQuoteAddress as
|
|
46
|
+
import { getDryQuoteAddress as Ge } from "./utils/getDryQuoteAddress.js";
|
|
47
47
|
import { isEvmChain as H } from "./utils/evm/isEvmChain.js";
|
|
48
|
-
import { checkNearAccountExists as
|
|
48
|
+
import { checkNearAccountExists as Sn } from "./utils/near/checkNearAccountExists.js";
|
|
49
49
|
import { isNotEmptyAmount as se } from "./utils/checkers/isNotEmptyAmount.js";
|
|
50
|
-
import { isValidBigint as
|
|
51
|
-
import { isNearAddress as
|
|
52
|
-
import { isBalanceSufficient as
|
|
53
|
-
import { isQuoteError as
|
|
54
|
-
import { isSolanaAddress as
|
|
55
|
-
import { isEvmAddress as
|
|
56
|
-
import { getMainTokenByChain as
|
|
57
|
-
import { getDefaultIntentsToken as
|
|
58
|
-
import { getTokenWithHighBalance as
|
|
59
|
-
import { isQuoteIdle as
|
|
60
|
-
import { isInputChanged as
|
|
61
|
-
import { isErrorChanged as
|
|
62
|
-
import { isOnlyErrorChanged as
|
|
63
|
-
import { isValidInitialState as
|
|
64
|
-
import { isWalletDisconnected as
|
|
65
|
-
import { isSendAddressForbidden as
|
|
66
|
-
import { isAmountChangedFromQuote as
|
|
67
|
-
import { reset as
|
|
68
|
-
import { tokenSelectRotate as
|
|
69
|
-
import { errorSet as
|
|
70
|
-
import { quoteSet as
|
|
71
|
-
import { addressSet as
|
|
72
|
-
import { tokenSetAmount as
|
|
73
|
-
import { quoteSetStatus as
|
|
74
|
-
import { depositTypeSet as
|
|
50
|
+
import { isValidBigint as At } from "./utils/checkers/isValidBigint.js";
|
|
51
|
+
import { isNearAddress as St } from "./utils/near/isNearAddress.js";
|
|
52
|
+
import { isBalanceSufficient as Oe } from "./machine/guards/checks/isBalanceSufficient.js";
|
|
53
|
+
import { isQuoteError as Fe, isTransferError as Le, isAsyncSendAddressValidationError as Nn } from "./machine/errors.js";
|
|
54
|
+
import { isSolanaAddress as Nt } from "./utils/solana/isSolanaAddress.js";
|
|
55
|
+
import { isEvmAddress as _t } from "./utils/evm/isEvmAddress.js";
|
|
56
|
+
import { getMainTokenByChain as _n } from "./utils/tokens/getMainTokenByChain.js";
|
|
57
|
+
import { getDefaultIntentsToken as yn } from "./utils/tokens/getDefaultIntentsToken.js";
|
|
58
|
+
import { getTokenWithHighBalance as bn } from "./utils/tokens/getTokenWithHighBalance.js";
|
|
59
|
+
import { isQuoteIdle as En } from "./machine/subscriptions/checkers/isQuoteIdle.js";
|
|
60
|
+
import { isInputChanged as Rn } from "./machine/subscriptions/checkers/isInputChanged.js";
|
|
61
|
+
import { isErrorChanged as Cn } from "./machine/subscriptions/checkers/isErrorChanged.js";
|
|
62
|
+
import { isOnlyErrorChanged as Dn } from "./machine/subscriptions/checkers/isOnlyErrorChanged.js";
|
|
63
|
+
import { isValidInitialState as vn } from "./machine/subscriptions/checkers/isValidInitialState.js";
|
|
64
|
+
import { isWalletDisconnected as xn } from "./machine/subscriptions/checkers/isWalletDisconnected.js";
|
|
65
|
+
import { isSendAddressForbidden as On } from "./machine/subscriptions/checkers/isSendAddressForbidden.js";
|
|
66
|
+
import { isAmountChangedFromQuote as Fn } from "./machine/subscriptions/checkers/isAmountChangedFromQuote.js";
|
|
67
|
+
import { reset as Ln } from "./machine/events/reset.js";
|
|
68
|
+
import { tokenSelectRotate as _e } from "./machine/events/tokenSelectRotate.js";
|
|
69
|
+
import { errorSet as Bn } from "./machine/events/errorSet.js";
|
|
70
|
+
import { quoteSet as qn } from "./machine/events/quoteSet.js";
|
|
71
|
+
import { addressSet as Un } from "./machine/events/addressSet.js";
|
|
72
|
+
import { tokenSetAmount as Pn } from "./machine/events/tokenSetAmount.js";
|
|
73
|
+
import { quoteSetStatus as Wn } from "./machine/events/quoteSetStatus.js";
|
|
74
|
+
import { depositTypeSet as Vn } from "./machine/events/depositTypeSet.js";
|
|
75
75
|
import { externalDepositTxSet as Mn } from "./machine/events/externalDepositTxSet.js";
|
|
76
|
-
import { setInputsValidating as
|
|
77
|
-
import { walletAddressSet as
|
|
78
|
-
import { tokenSetBalance as
|
|
79
|
-
import { transferSetStatus as
|
|
80
|
-
import { getUsdTradeDelta as
|
|
81
|
-
import { getIsDirectNonNearWithdrawal as
|
|
82
|
-
import { getIsDirectTokenOnNearTransfer as
|
|
83
|
-
import { getIsDirectNearTokenWithdrawal as
|
|
84
|
-
import { getIsSameAssetDiffChainWithdrawal as
|
|
76
|
+
import { setInputsValidating as Qn } from "./machine/events/setInputsValidating.js";
|
|
77
|
+
import { walletAddressSet as $n } from "./machine/events/walletAddressSet.js";
|
|
78
|
+
import { tokenSetBalance as Kn } from "./machine/events/tokenSetBalance.js";
|
|
79
|
+
import { transferSetStatus as Hn } from "./machine/events/transferSetStatus.js";
|
|
80
|
+
import { getUsdTradeDelta as Gn } from "./machine/computed/getUsdTradeDelta.js";
|
|
81
|
+
import { getIsDirectNonNearWithdrawal as jn } from "./machine/computed/getIsDirectNonNearWithdrawal.js";
|
|
82
|
+
import { getIsDirectTokenOnNearTransfer as zn } from "./machine/computed/getIsDirectTokenOnNearTransfer.js";
|
|
83
|
+
import { getIsDirectNearTokenWithdrawal as Yn } from "./machine/computed/getIsDirectNearTokenWithdrawal.js";
|
|
84
|
+
import { getIsSameAssetDiffChainWithdrawal as Xn } from "./machine/computed/getIsSameAssetDiffChainWithdrawal.js";
|
|
85
85
|
import "./components/Input.js";
|
|
86
86
|
import "viem";
|
|
87
87
|
import { Button as A } from "./components/Button.js";
|
|
88
|
-
import { TinyNumber as
|
|
88
|
+
import { TinyNumber as Be } from "./components/TinyNumber.js";
|
|
89
89
|
import { ErrorMessage as j } from "./components/ErrorMessage.js";
|
|
90
|
-
import { FT_DEPOSIT_GAS as
|
|
91
|
-
import { a as
|
|
90
|
+
import { FT_DEPOSIT_GAS as je, FT_TRANSFER_GAS as ze } from "./utils/near/config.js";
|
|
91
|
+
import { a as qe } from "./index-DEq3oXQF.js";
|
|
92
92
|
import { z as oe } from "zod";
|
|
93
|
-
import { decodeQueryResult as
|
|
94
|
-
import { nearRpcClient as
|
|
95
|
-
import { getNearNep141MinStorageBalance as
|
|
96
|
-
import { isErrorLikeObject as
|
|
97
|
-
import { isUserDeniedSigning as
|
|
98
|
-
import { INTENTS_CONTRACT as
|
|
99
|
-
import { isEvmBaseToken as
|
|
100
|
-
import { useMakeEvmTransfer as
|
|
101
|
-
import { useMakeSolanaTransfer as
|
|
102
|
-
import { createIntentSignerNEP413 as
|
|
103
|
-
import { generateRandomBytes as
|
|
104
|
-
import { IntentSignerSolana as
|
|
105
|
-
import { localStorageTyped as
|
|
106
|
-
import { queryContract as
|
|
107
|
-
import { utils as
|
|
108
|
-
import { getTransactionLink as
|
|
109
|
-
import { switchEthereumChain as
|
|
93
|
+
import { decodeQueryResult as Zn } from "./utils/near/decodeQueryResult.js";
|
|
94
|
+
import { nearRpcClient as Jn } from "./utils/near/rpc.js";
|
|
95
|
+
import { getNearNep141MinStorageBalance as es } from "./utils/near/getNearNep141MinStorageBalance.js";
|
|
96
|
+
import { isErrorLikeObject as ce } from "./utils/isErrorLikeObject.js";
|
|
97
|
+
import { isUserDeniedSigning as de } from "./utils/checkers/isUserDeniedSigning.js";
|
|
98
|
+
import { INTENTS_CONTRACT as ye } from "./constants/intents.js";
|
|
99
|
+
import { isEvmBaseToken as yt } from "./utils/evm/isEvmBaseToken.js";
|
|
100
|
+
import { useMakeEvmTransfer as ts } from "./hooks/useMakeEvmTransfer.js";
|
|
101
|
+
import { useMakeSolanaTransfer as ns } from "./hooks/useMakeSolanaTransfer.js";
|
|
102
|
+
import { createIntentSignerNEP413 as ss, IntentsSDK as rs, createNearWithdrawalRoute as as, createInternalTransferRoute as os, MinWithdrawalAmountError as is, FeeExceedsAmountError as ls } from "@defuse-protocol/intents-sdk";
|
|
103
|
+
import { generateRandomBytes as cs } from "./utils/near/getRandomBytes.js";
|
|
104
|
+
import { IntentSignerSolana as ds } from "./utils/intents/signers/solana.js";
|
|
105
|
+
import { localStorageTyped as Ye } from "./utils/localstorage.js";
|
|
106
|
+
import { queryContract as us } from "./utils/near/queryContract.js";
|
|
107
|
+
import { utils as Xe } from "@defuse-protocol/internal-utils";
|
|
108
|
+
import { getTransactionLink as ms } from "./utils/formatters/getTransactionLink.js";
|
|
109
|
+
import { switchEthereumChain as fs } from "./utils/evm/switchEthereumChain.js";
|
|
110
110
|
import "copy-text-to-clipboard";
|
|
111
|
-
import { SwapQuoteSkeleton as
|
|
112
|
-
import { Notes as
|
|
113
|
-
import { Accordion as
|
|
114
|
-
import { formatUsdAmount as
|
|
115
|
-
import { formatTinyNumber as
|
|
116
|
-
import
|
|
117
|
-
import { Skeleton as
|
|
118
|
-
import { getBalancePortion as
|
|
119
|
-
import { getUsdDisplayAmount as
|
|
120
|
-
import { TokenInputHeading as
|
|
121
|
-
import { noop as
|
|
122
|
-
import { Card as
|
|
123
|
-
import { Badge as
|
|
124
|
-
import { TokenIcon as
|
|
125
|
-
import { InputAmount as
|
|
126
|
-
import { TokenInputSkeleton as
|
|
127
|
-
import { getUsdDisplayBalance as
|
|
128
|
-
import { VList as
|
|
129
|
-
import { useFocusOnList as
|
|
130
|
-
import { TokensListPlaceholder as
|
|
131
|
-
import { MAX_LIST_VIEW_AREA_HEIGHT as
|
|
132
|
-
import { getGroupHeadersTotalIndexes as
|
|
133
|
-
import { getFirstGroupItemTotalIndex as
|
|
134
|
-
import { getListItemsTotalCount as
|
|
135
|
-
import { getTokenByTotalIndex as
|
|
136
|
-
import { getListTotalHeight as
|
|
137
|
-
import { getListState as
|
|
138
|
-
import { Hr as
|
|
139
|
-
import { createTokenSorter as
|
|
140
|
-
import { createFilterByIntents as
|
|
141
|
-
import { createFilterBySearch as
|
|
142
|
-
import { createFilterBySelectedChain as
|
|
111
|
+
import { SwapQuoteSkeleton as bt } from "./features/SwapQuote/SwapQuoteSkeleton.js";
|
|
112
|
+
import { Notes as he } from "./components/Notes.js";
|
|
113
|
+
import { Accordion as ps } from "./components/Accordion.js";
|
|
114
|
+
import { formatUsdAmount as Ze } from "./utils/formatters/formatUsdAmount.js";
|
|
115
|
+
import { formatTinyNumber as Ts } from "./utils/formatters/formatTinyNumber.js";
|
|
116
|
+
import hs from "clsx";
|
|
117
|
+
import { Skeleton as gs } from "./components/Skeleton.js";
|
|
118
|
+
import { getBalancePortion as Is } from "./features/TokenInput/utils/getBalancePortion.js";
|
|
119
|
+
import { getUsdDisplayAmount as ws } from "./features/TokenInput/utils/getUsdDisplayAmount.js";
|
|
120
|
+
import { TokenInputHeading as Et } from "./features/TokenInput/TokenInputHeading.js";
|
|
121
|
+
import { noop as ks } from "./utils/noop.js";
|
|
122
|
+
import { Card as fe } from "./components/Card.js";
|
|
123
|
+
import { Badge as Je } from "./components/Badge.js";
|
|
124
|
+
import { TokenIcon as Rt } from "./components/TokenIcon.js";
|
|
125
|
+
import { InputAmount as As } from "./components/InputAmount.js";
|
|
126
|
+
import { TokenInputSkeleton as Ss } from "./features/TokenInput/TokenInputSkeleton.js";
|
|
127
|
+
import { getUsdDisplayBalance as Ns } from "./utils/formatters/getUsdDisplayBalance.js";
|
|
128
|
+
import { VList as _s } from "virtua";
|
|
129
|
+
import { useFocusOnList as ys } from "./features/TokensList/hooks/useFocusOnList.js";
|
|
130
|
+
import { TokensListPlaceholder as be } from "./features/TokensList/TokensListPlaceholder.js";
|
|
131
|
+
import { MAX_LIST_VIEW_AREA_HEIGHT as bs, TOKEN_ITEM_HEIGHT as Es, LIST_CONTAINER_ID as Rs } from "./features/TokensList/constants.js";
|
|
132
|
+
import { getGroupHeadersTotalIndexes as Cs } from "./features/TokensList/utils/getGroupHeadersTotalIndexes.js";
|
|
133
|
+
import { getFirstGroupItemTotalIndex as Ds } from "./features/TokensList/utils/getFirstGroupItemTotalIndex.js";
|
|
134
|
+
import { getListItemsTotalCount as vs } from "./features/TokensList/utils/getListItemsTotalCount.js";
|
|
135
|
+
import { getTokenByTotalIndex as xs } from "./features/TokensList/utils/getTokenByTotalIndex.js";
|
|
136
|
+
import { getListTotalHeight as Os } from "./features/TokensList/utils/getListTotalHeight.js";
|
|
137
|
+
import { getListState as Fs } from "./features/TokensList/utils/getListState.js";
|
|
138
|
+
import { Hr as Ls } from "./components/Hr.js";
|
|
139
|
+
import { createTokenSorter as Bs } from "./utils/tokens/sort.js";
|
|
140
|
+
import { createFilterByIntents as et } from "./utils/tokens/filterByIntents.js";
|
|
141
|
+
import { createFilterBySearch as qs } from "./utils/tokens/filterBySearchString.js";
|
|
142
|
+
import { createFilterBySelectedChain as Us } from "./utils/tokens/filterBySelectedChain.js";
|
|
143
143
|
import "bs58";
|
|
144
144
|
import "viem/chains";
|
|
145
145
|
import "browser-or-node";
|
|
146
146
|
import "qrcode.react";
|
|
147
|
-
import { createColorPalette as
|
|
148
|
-
import { ArmingCountdownFill as
|
|
149
|
-
import { useTimer as
|
|
150
|
-
import { useHandleKeyDown as
|
|
151
|
-
import { CloseButton as
|
|
152
|
-
import { DEFAULT_RPCS as
|
|
153
|
-
import { useAddClassToPortal as
|
|
154
|
-
import { ErrorBoundary as
|
|
155
|
-
import { isEvmToken as
|
|
156
|
-
import { getEvmMainTokenBalance as
|
|
157
|
-
import { getNativeNearBalance as
|
|
158
|
-
import { getNearTokenBalance as
|
|
159
|
-
import { getEvmTokenBalance as
|
|
160
|
-
function
|
|
161
|
-
const { walletSupportedChains: s, tonCenterApiKey: n, alchemyApiKey: a } = b(), { walletAddress: c } =
|
|
162
|
-
return
|
|
147
|
+
import { createColorPalette as Ps } from "./theme/createColorPalette.js";
|
|
148
|
+
import { ArmingCountdownFill as Ws, BeenhereFill as Vs, EncryptedFill as Ms, AccountBalanceWalletFill as Qs, CheckCircleFill as $s, GppBadFill as Ks } from "@material-symbols-svg/react-rounded";
|
|
149
|
+
import { useTimer as Hs } from "use-timer";
|
|
150
|
+
import { useHandleKeyDown as Ct } from "./hooks/useHandleKeyDown.js";
|
|
151
|
+
import { CloseButton as Dt } from "./components/CloseButton.js";
|
|
152
|
+
import { DEFAULT_RPCS as Gs } from "./rpcs.js";
|
|
153
|
+
import { useAddClassToPortal as js } from "./hooks/useAddClassToPortal.js";
|
|
154
|
+
import { ErrorBoundary as zs } from "react-error-boundary";
|
|
155
|
+
import { isEvmToken as Ys } from "./utils/evm/isEvmToken.js";
|
|
156
|
+
import { getEvmMainTokenBalance as Xs } from "./utils/evm/getEvmMainTokenBalance.js";
|
|
157
|
+
import { getNativeNearBalance as Zs } from "./utils/near/getNativeNearBalance.js";
|
|
158
|
+
import { getNearTokenBalance as Js } from "./utils/near/getNearTokenBalance.js";
|
|
159
|
+
import { getEvmTokenBalance as er } from "./utils/evm/getEvmTokenBalance.js";
|
|
160
|
+
function tr({ rpcs: e, token: t, connectedWallets: r }) {
|
|
161
|
+
const { walletSupportedChains: s, tonCenterApiKey: n, alchemyApiKey: a } = b(), { walletAddress: c } = mt(r, t);
|
|
162
|
+
return Re({
|
|
163
163
|
retry: 2,
|
|
164
164
|
enabled: !!c && Object.keys(e).includes(t.blockchain),
|
|
165
165
|
queryKey: ["tokenBalance", t.assetId, r],
|
|
@@ -167,32 +167,32 @@ function er({ rpcs: e, token: t, connectedWallets: r }) {
|
|
|
167
167
|
if (!c)
|
|
168
168
|
return null;
|
|
169
169
|
if (t.blockchain === "near" && s.includes(t.blockchain))
|
|
170
|
-
return !e.near || e.near.length === 0 ? null : t.assetId === G ?
|
|
170
|
+
return !e.near || e.near.length === 0 ? null : t.assetId === G ? Zs(c, e.near) : Js(t, c, e.near);
|
|
171
171
|
if (!s.includes("eth") && H(t.blockchain))
|
|
172
172
|
return null;
|
|
173
|
-
if (H(t.blockchain) &&
|
|
173
|
+
if (H(t.blockchain) && yt(t)) {
|
|
174
174
|
const l = e[t.blockchain] ?? [];
|
|
175
|
-
return l.length > 0 ?
|
|
175
|
+
return l.length > 0 ? Xs(c, l[0]) : null;
|
|
176
176
|
}
|
|
177
|
-
if (
|
|
177
|
+
if (Ys(t) || H(t.blockchain)) {
|
|
178
178
|
const l = e[t.blockchain] ?? [];
|
|
179
|
-
return l.length > 0 ?
|
|
179
|
+
return l.length > 0 ? er(t, c, l[0]) : null;
|
|
180
180
|
}
|
|
181
|
-
return t.blockchain === "ton" ?
|
|
181
|
+
return t.blockchain === "ton" ? an(t, c, n) : t.blockchain === "sol" && s.includes(t.blockchain) ? on(t, c, a) : (E.warn(
|
|
182
182
|
`Failed to fetch token balance for ${t.symbol} on ${t.blockchain}`
|
|
183
183
|
), null);
|
|
184
184
|
}
|
|
185
185
|
});
|
|
186
186
|
}
|
|
187
|
-
const
|
|
187
|
+
const nr = ({
|
|
188
188
|
rpcs: e,
|
|
189
189
|
token: t,
|
|
190
190
|
onBalancesLoaded: r
|
|
191
191
|
}) => (R(() => {
|
|
192
192
|
t.isIntent || !Object.keys(e).includes(t.blockchain) || r({ [t.assetId]: "0" });
|
|
193
|
-
}, [t.assetId]), null),
|
|
193
|
+
}, [t.assetId]), null), vt = zt(
|
|
194
194
|
({ rpcs: e, token: t, connectedWallets: r, onBalancesLoaded: s }) => {
|
|
195
|
-
const { data: n } =
|
|
195
|
+
const { data: n } = tr({
|
|
196
196
|
rpcs: e,
|
|
197
197
|
token: t,
|
|
198
198
|
connectedWallets: r
|
|
@@ -203,13 +203,13 @@ const tr = ({
|
|
|
203
203
|
},
|
|
204
204
|
(e, t) => e.token.assetId === t.token.assetId && e.connectedWallets === t.connectedWallets
|
|
205
205
|
);
|
|
206
|
-
|
|
207
|
-
const
|
|
208
|
-
Zero:
|
|
209
|
-
}),
|
|
206
|
+
vt.displayName = "TokenBalanceLoader";
|
|
207
|
+
const tt = Object.assign(vt, {
|
|
208
|
+
Zero: nr
|
|
209
|
+
}), sr = (e) => {
|
|
210
210
|
const t = e.toLowerCase();
|
|
211
|
-
return
|
|
212
|
-
},
|
|
211
|
+
return Ce[t]?.icon ?? "";
|
|
212
|
+
}, rr = (e) => `${e?.charAt(0).toUpperCase()}${e?.slice(1)}`, ar = (e) => Ce[e]?.name ?? e, V = (e) => {
|
|
213
213
|
const {
|
|
214
214
|
showIntentTokens: t,
|
|
215
215
|
allowedTokensList: r,
|
|
@@ -218,24 +218,24 @@ const et = Object.assign(Dt, {
|
|
|
218
218
|
filterTokens: a,
|
|
219
219
|
fetchSourceTokens: c,
|
|
220
220
|
fetchTargetTokens: l
|
|
221
|
-
} = b(), { data: d, ...u } =
|
|
221
|
+
} = b(), { data: d, ...u } = Re({
|
|
222
222
|
queryKey: ["tokens", e].filter(Boolean),
|
|
223
|
-
queryFn: async () => e === "source" && c ? c() : e === "target" && l ? l() :
|
|
223
|
+
queryFn: async () => e === "source" && c ? c() : e === "target" && l ? l() : ln.getTokens()
|
|
224
224
|
}), i = L(() => {
|
|
225
225
|
if (!d)
|
|
226
226
|
return [];
|
|
227
227
|
const f = d.map((m) => {
|
|
228
228
|
const w = m.blockchain.toLowerCase();
|
|
229
|
-
return !
|
|
229
|
+
return !wn(w) || r && !r.includes(m.assetId) || e === "source" && s && !s.includes(m.assetId) || e === "target" && n && !n.includes(m.assetId) ? null : {
|
|
230
230
|
assetId: m.assetId,
|
|
231
231
|
symbol: m.symbol,
|
|
232
232
|
decimals: m.decimals,
|
|
233
233
|
price: m.price,
|
|
234
234
|
blockchain: w,
|
|
235
235
|
isIntent: !1,
|
|
236
|
-
icon: m.icon ??
|
|
237
|
-
name:
|
|
238
|
-
chainName:
|
|
236
|
+
icon: m.icon ?? sr(m.symbol),
|
|
237
|
+
name: ar(m.symbol),
|
|
238
|
+
chainName: ft[m.blockchain]?.label ?? rr(m.blockchain),
|
|
239
239
|
contractAddress: m.contractAddress
|
|
240
240
|
};
|
|
241
241
|
}).filter((m) => !!m).filter(a ?? (() => !0)), p = f.filter(
|
|
@@ -247,7 +247,7 @@ const et = Object.assign(Dt, {
|
|
|
247
247
|
chainName: "Near",
|
|
248
248
|
blockchain: "near",
|
|
249
249
|
assetId: G,
|
|
250
|
-
icon:
|
|
250
|
+
icon: Ce.near?.icon ?? "",
|
|
251
251
|
price: I?.price ?? 0,
|
|
252
252
|
contractAddress: I?.contractAddress,
|
|
253
253
|
isIntent: !1,
|
|
@@ -264,8 +264,8 @@ const et = Object.assign(Dt, {
|
|
|
264
264
|
...u,
|
|
265
265
|
tokens: i
|
|
266
266
|
};
|
|
267
|
-
},
|
|
268
|
-
const { tokens: e } =
|
|
267
|
+
}, or = () => {
|
|
268
|
+
const { tokens: e } = V(), { tokens: t } = V("source"), { tokens: r } = V("target");
|
|
269
269
|
return { tokens: L(() => {
|
|
270
270
|
const n = {};
|
|
271
271
|
return [
|
|
@@ -277,25 +277,25 @@ const et = Object.assign(Dt, {
|
|
|
277
277
|
n[c] = a;
|
|
278
278
|
}), Object.values(n);
|
|
279
279
|
}, [e, t, r]) };
|
|
280
|
-
},
|
|
280
|
+
}, ge = [
|
|
281
281
|
{ eth: ["ETH", "USDT", "USDC", "AURORA"] },
|
|
282
282
|
{ near: ["USDT", "USDC", "AURORA"] },
|
|
283
283
|
{ arb: ["ARB", "ETH", "USDT", "USDC"] },
|
|
284
284
|
{ btc: ["BTC"] }
|
|
285
|
-
],
|
|
286
|
-
const s =
|
|
285
|
+
], ir = (e) => [...e].sort((t, r) => {
|
|
286
|
+
const s = ge.findIndex(
|
|
287
287
|
(d) => Object.keys(d)[0] === t.blockchain
|
|
288
|
-
), n =
|
|
288
|
+
), n = ge.findIndex(
|
|
289
289
|
(d) => Object.keys(d)[0] === r.blockchain
|
|
290
290
|
);
|
|
291
291
|
if (s !== n)
|
|
292
292
|
return s === -1 ? 1 : n === -1 ? -1 : s - n;
|
|
293
|
-
const a =
|
|
293
|
+
const a = ge[s]?.[t.blockchain] ?? [], c = a.indexOf(t.symbol), l = a.indexOf(r.symbol);
|
|
294
294
|
return c === -1 && l === -1 ? 0 : c === -1 ? 1 : l === -1 ? -1 : c - l;
|
|
295
|
-
}),
|
|
296
|
-
const { tokens: r } =
|
|
297
|
-
return L(() =>
|
|
298
|
-
|
|
295
|
+
}), lr = ({ rpcs: e, connectedWallets: t }) => {
|
|
296
|
+
const { tokens: r } = or(), { walletSupportedChains: s } = b(), { setWalletBalance: n } = De(t);
|
|
297
|
+
return L(() => ir(r), [r]).map((c) => s.includes(c.blockchain) ? /* @__PURE__ */ o(
|
|
298
|
+
tt,
|
|
299
299
|
{
|
|
300
300
|
rpcs: e,
|
|
301
301
|
token: c,
|
|
@@ -304,7 +304,7 @@ const et = Object.assign(Dt, {
|
|
|
304
304
|
},
|
|
305
305
|
z(c)
|
|
306
306
|
) : /* @__PURE__ */ o(
|
|
307
|
-
|
|
307
|
+
tt.Zero,
|
|
308
308
|
{
|
|
309
309
|
rpcs: e,
|
|
310
310
|
token: c,
|
|
@@ -313,59 +313,59 @@ const et = Object.assign(Dt, {
|
|
|
313
313
|
z(c)
|
|
314
314
|
));
|
|
315
315
|
};
|
|
316
|
-
function
|
|
316
|
+
function cr(e, t) {
|
|
317
317
|
const r = Array.from(
|
|
318
|
-
/* @__PURE__ */ new Set([...t ?? [], ...
|
|
318
|
+
/* @__PURE__ */ new Set([...t ?? [], ...pt])
|
|
319
319
|
), s = new Map(r.map((n, a) => [n, a]));
|
|
320
320
|
return [...e].sort((n, a) => {
|
|
321
321
|
const c = s.has(n.id) ? s.get(n.id) : 1 / 0, l = s.has(a.id) ? s.get(a.id) : 1 / 0;
|
|
322
322
|
return c !== l ? c - l : n.id.localeCompare(a.id, void 0, { sensitivity: "base" });
|
|
323
323
|
});
|
|
324
324
|
}
|
|
325
|
-
const
|
|
325
|
+
const dr = (e) => {
|
|
326
326
|
const {
|
|
327
327
|
chainsOrder: t,
|
|
328
328
|
allowedChainsList: r,
|
|
329
329
|
allowedSourceChainsList: s,
|
|
330
330
|
allowedTargetChainsList: n
|
|
331
|
-
} = b(), { tokens: a } =
|
|
331
|
+
} = b(), { tokens: a } = V();
|
|
332
332
|
return L(() => {
|
|
333
333
|
const c = Array.from(
|
|
334
|
-
new Set(a.map((l) =>
|
|
334
|
+
new Set(a.map((l) => ft[l.blockchain]))
|
|
335
335
|
).filter((l) => !(r && !r.includes(l.id) || e === "source" && s && !s.includes(l.id) || e === "target" && n && !n.includes(l.id)));
|
|
336
|
-
return
|
|
336
|
+
return cr(c, t);
|
|
337
337
|
}, [a, t, r]);
|
|
338
|
-
},
|
|
338
|
+
}, nt = 3, xt = ({
|
|
339
339
|
connectedWallets: e,
|
|
340
340
|
alchemyApiKey: t,
|
|
341
341
|
...r
|
|
342
342
|
}) => {
|
|
343
|
-
const { ctx: s } = _(), { tokens: n } =
|
|
343
|
+
const { ctx: s } = _(), { tokens: n } = V(), { walletSupportedChains: a } = b(), { setWalletBalance: c } = De(e), l = r.isEnabled && !!Object.values(e).length && a.length > 0, d = Zt({
|
|
344
344
|
initialPageParam: null,
|
|
345
345
|
enabled: !!l && !!t,
|
|
346
346
|
queryKey: ["walletTokensBalance", e],
|
|
347
|
-
queryFn: async ({ pageParam: i }) =>
|
|
347
|
+
queryFn: async ({ pageParam: i }) => gn({ alchemyApiKey: t })({
|
|
348
348
|
pageParam: i ? `${i}` : null,
|
|
349
349
|
connectedWallets: e,
|
|
350
350
|
walletSupportedChains: a
|
|
351
351
|
}),
|
|
352
352
|
getNextPageParam: (i, f) => {
|
|
353
|
-
if (i.pageKey && !(f.length >=
|
|
353
|
+
if (i.pageKey && !(f.length >= nt))
|
|
354
354
|
return i.pageKey;
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
R(() => {
|
|
358
|
-
l && d.data && d.hasNextPage && d.data.pages.length <
|
|
358
|
+
l && d.data && d.hasNextPage && d.data.pages.length < nt && !d.isFetchingNextPage && d.fetchNextPage();
|
|
359
359
|
}, [l, d]);
|
|
360
360
|
const u = L(() => {
|
|
361
361
|
if (!d.data?.pages)
|
|
362
362
|
return {};
|
|
363
|
-
const i =
|
|
363
|
+
const i = hn(
|
|
364
364
|
n,
|
|
365
365
|
d.data.pages.flatMap((f) => f.data)
|
|
366
366
|
);
|
|
367
367
|
return n.forEach((f) => {
|
|
368
|
-
|
|
368
|
+
In(f.blockchain) && !(f.assetId in i) && (i[f.assetId] = "0");
|
|
369
369
|
}), i;
|
|
370
370
|
}, [d.data, n]);
|
|
371
371
|
return R(() => {
|
|
@@ -375,16 +375,16 @@ const cr = (e) => {
|
|
|
375
375
|
refetch: d.refetch,
|
|
376
376
|
balances: u
|
|
377
377
|
};
|
|
378
|
-
},
|
|
378
|
+
}, pe = () => {
|
|
379
379
|
const { intentsAccountType: e } = b(), {
|
|
380
380
|
ctx: { walletAddress: t }
|
|
381
|
-
} = _(), { tokens: r } =
|
|
381
|
+
} = _(), { tokens: r } = V(), s = r.filter((l) => l.isIntent).map((l) => l.assetId), n = ne({
|
|
382
382
|
walletAddress: t,
|
|
383
383
|
addressType: e
|
|
384
|
-
}), a =
|
|
384
|
+
}), a = Re({
|
|
385
385
|
enabled: !!t && !!n && r.length > 0,
|
|
386
386
|
queryKey: ["intentsBalances", n],
|
|
387
|
-
queryFn: async () => n ? await
|
|
387
|
+
queryFn: async () => n ? await kn(n, s) : {}
|
|
388
388
|
}), c = L(() => {
|
|
389
389
|
switch (a.status) {
|
|
390
390
|
case "error":
|
|
@@ -399,18 +399,18 @@ const cr = (e) => {
|
|
|
399
399
|
case "pending":
|
|
400
400
|
return {};
|
|
401
401
|
default:
|
|
402
|
-
return
|
|
402
|
+
return ve(a, { throwError: !1 }), {};
|
|
403
403
|
}
|
|
404
404
|
}, [a]) ?? {};
|
|
405
405
|
return {
|
|
406
406
|
...a,
|
|
407
407
|
intentBalances: c
|
|
408
408
|
};
|
|
409
|
-
},
|
|
409
|
+
}, ur = ({
|
|
410
410
|
isEnabled: e,
|
|
411
411
|
alchemyApiKey: t
|
|
412
412
|
}) => {
|
|
413
|
-
const { connectedWallets: r } = b(), { ctx: s } = _(), n =
|
|
413
|
+
const { connectedWallets: r } = b(), { ctx: s } = _(), n = Jt(), { refetch: a } = pe(), { refetch: c } = xt({
|
|
414
414
|
isEnabled: e,
|
|
415
415
|
connectedWallets: r,
|
|
416
416
|
alchemyApiKey: t ?? ""
|
|
@@ -421,14 +421,14 @@ const cr = (e) => {
|
|
|
421
421
|
setTimeout(d, 1e4);
|
|
422
422
|
}), await c()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
|
|
423
423
|
}, [s.state, e, t]);
|
|
424
|
-
},
|
|
425
|
-
const { connectedWallets: e } = b(), { intentBalances: t } =
|
|
424
|
+
}, Te = () => {
|
|
425
|
+
const { connectedWallets: e } = b(), { intentBalances: t } = pe(), { walletBalance: r } = De(e);
|
|
426
426
|
return { mergedBalance: L(
|
|
427
427
|
() => ({ ...r, ...t }),
|
|
428
428
|
[r, t]
|
|
429
429
|
) };
|
|
430
|
-
},
|
|
431
|
-
const { ctx: t } = _(), { mergedBalance: r } =
|
|
430
|
+
}, mr = ({ isEnabled: e }) => {
|
|
431
|
+
const { ctx: t } = _(), { mergedBalance: r } = Te();
|
|
432
432
|
R(() => {
|
|
433
433
|
if (!e)
|
|
434
434
|
return;
|
|
@@ -439,7 +439,7 @@ const cr = (e) => {
|
|
|
439
439
|
const s = z(t.sourceToken);
|
|
440
440
|
T("tokenSetBalance", r[s]);
|
|
441
441
|
}, [r, t.sourceToken]);
|
|
442
|
-
},
|
|
442
|
+
}, st = {
|
|
443
443
|
// cbBTC (eth)
|
|
444
444
|
"nep141:eth-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near": "nep141:nbtc.bridge.near",
|
|
445
445
|
// cbBTC (base)
|
|
@@ -454,10 +454,10 @@ const cr = (e) => {
|
|
|
454
454
|
"nep245:v2_1.omni.hot.tg:56_SZzgw3HSudhZcTwPWUTi2RJB19t": "nep141:wrap.near",
|
|
455
455
|
// BTC (near)
|
|
456
456
|
"nep141:btc.omft.near": "nep141:nbtc.bridge.near"
|
|
457
|
-
},
|
|
457
|
+
}, fr = ({
|
|
458
458
|
isEnabled: e
|
|
459
459
|
}) => {
|
|
460
|
-
const { ctx: t } = _(), { tokens: r } =
|
|
460
|
+
const { ctx: t } = _(), { tokens: r } = V();
|
|
461
461
|
R(() => {
|
|
462
462
|
if (!e)
|
|
463
463
|
return;
|
|
@@ -466,9 +466,9 @@ const cr = (e) => {
|
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
468
468
|
const { sourceToken: s } = t;
|
|
469
|
-
if (t.sourceToken.assetId in
|
|
469
|
+
if (t.sourceToken.assetId in st) {
|
|
470
470
|
const l = r.find(
|
|
471
|
-
(d) => d.isIntent && d.assetId ===
|
|
471
|
+
(d) => d.isIntent && d.assetId === st[s.assetId]
|
|
472
472
|
);
|
|
473
473
|
T("tokenSelect", {
|
|
474
474
|
variant: "target",
|
|
@@ -493,8 +493,8 @@ const cr = (e) => {
|
|
|
493
493
|
token: a ?? c
|
|
494
494
|
});
|
|
495
495
|
}, [r, t.sourceToken]);
|
|
496
|
-
},
|
|
497
|
-
const { connectedWallets: t } = b(), { ctx: r, state: s } = _(), { walletAddress: n } =
|
|
496
|
+
}, pr = ({ isEnabled: e }) => {
|
|
497
|
+
const { connectedWallets: t } = b(), { ctx: r, state: s } = _(), { walletAddress: n } = mt(
|
|
498
498
|
t,
|
|
499
499
|
r.sourceToken
|
|
500
500
|
);
|
|
@@ -503,10 +503,10 @@ const cr = (e) => {
|
|
|
503
503
|
return;
|
|
504
504
|
T("walletAddressSet", n), x(r, ["initial_dry", "initial_wallet"]) && (s === "initial_wallet" && !n ? F("initial_dry") : s === "initial_dry" && n && F("initial_wallet"));
|
|
505
505
|
}, [e, n, r, s]);
|
|
506
|
-
},
|
|
506
|
+
}, Tr = (e) => (["depositAddress"].forEach((t) => {
|
|
507
507
|
if (!(t in e))
|
|
508
508
|
return E.error(`Missing ${t} in quote response`), !1;
|
|
509
|
-
}), !0),
|
|
509
|
+
}), !0), hr = () => {
|
|
510
510
|
const { ctx: e } = _(), {
|
|
511
511
|
walletSupportedChains: t,
|
|
512
512
|
intentsAccountType: r,
|
|
@@ -514,17 +514,17 @@ const cr = (e) => {
|
|
|
514
514
|
appFees: n,
|
|
515
515
|
fetchQuote: a,
|
|
516
516
|
slippageTolerance: c
|
|
517
|
-
} = b(), l =
|
|
517
|
+
} = b(), l = xe(e), d = X(null), u = X(new AbortController()), i = L(() => async (p, I) => {
|
|
518
518
|
const { signal: m } = u.current;
|
|
519
519
|
return a ? a(p, {
|
|
520
520
|
...I,
|
|
521
521
|
signal: m
|
|
522
|
-
}) : (await
|
|
522
|
+
}) : (await Ne.post(
|
|
523
523
|
"https://1click.chaindefuser.com/v0/quote",
|
|
524
524
|
p,
|
|
525
525
|
{ signal: m }
|
|
526
526
|
)).data.quote;
|
|
527
|
-
}, [
|
|
527
|
+
}, [Ne]);
|
|
528
528
|
return {
|
|
529
529
|
make: async ({
|
|
530
530
|
message: p,
|
|
@@ -548,9 +548,9 @@ const cr = (e) => {
|
|
|
548
548
|
addressType: r,
|
|
549
549
|
walletAddress: l ? (
|
|
550
550
|
// address on the target chain should be a dry quote recipient
|
|
551
|
-
|
|
551
|
+
Ge(e.targetToken.blockchain)
|
|
552
552
|
) : e.walletAddress ?? ""
|
|
553
|
-
}), y = k && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), q = () => l ?
|
|
553
|
+
}), y = k && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), q = () => l ? Ge(
|
|
554
554
|
e.sourceToken.blockchain,
|
|
555
555
|
e.sourceToken.isIntent
|
|
556
556
|
) : y ? k : e.walletAddress ?? "";
|
|
@@ -571,14 +571,14 @@ const cr = (e) => {
|
|
|
571
571
|
// 1 hour
|
|
572
572
|
swapType: I === "exact_out" ? W.swapType.EXACT_OUTPUT : W.swapType.EXACT_INPUT,
|
|
573
573
|
// Target
|
|
574
|
-
destinationAsset: e.targetToken.assetId === G ?
|
|
574
|
+
destinationAsset: e.targetToken.assetId === G ? Se : e.targetToken.assetId,
|
|
575
575
|
// Source
|
|
576
|
-
originAsset: e.sourceToken.assetId === G ?
|
|
576
|
+
originAsset: e.sourceToken.assetId === G ? Se : e.sourceToken.assetId,
|
|
577
577
|
amount: I === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount,
|
|
578
578
|
// Experimental
|
|
579
579
|
quoteWaitingTimeMs: 0
|
|
580
580
|
};
|
|
581
|
-
p && (B.customRecipientMsg = p), s && (B.referral =
|
|
581
|
+
p && (B.customRecipientMsg = p), s && (B.referral = gt(s)), n && (B.appFees = [...n]);
|
|
582
582
|
try {
|
|
583
583
|
e.sourceToken.isIntent && e.targetToken.isIntent && (d.current = i(
|
|
584
584
|
{
|
|
@@ -604,11 +604,11 @@ const cr = (e) => {
|
|
|
604
604
|
m
|
|
605
605
|
), D = await d.current;
|
|
606
606
|
} catch (S) {
|
|
607
|
-
if (S instanceof
|
|
607
|
+
if (S instanceof It)
|
|
608
608
|
return;
|
|
609
609
|
E.error("Quote error: ", S);
|
|
610
610
|
let O = S instanceof Error ? S.message : "";
|
|
611
|
-
if (S instanceof
|
|
611
|
+
if (S instanceof wt) {
|
|
612
612
|
if (O = S.response?.data.message || O, O.includes("Amount is too low")) {
|
|
613
613
|
const re = O.match(/\d+/), ae = re ? re[0] : void 0;
|
|
614
614
|
throw new U({
|
|
@@ -636,7 +636,7 @@ const cr = (e) => {
|
|
|
636
636
|
...D,
|
|
637
637
|
deadline: void 0,
|
|
638
638
|
depositAddress: void 0
|
|
639
|
-
} : (
|
|
639
|
+
} : (Tr(D), {
|
|
640
640
|
dry: !1,
|
|
641
641
|
...D,
|
|
642
642
|
deadline: D.deadline,
|
|
@@ -647,11 +647,11 @@ const cr = (e) => {
|
|
|
647
647
|
u.current.abort("Abort quote manually"), u.current = new AbortController();
|
|
648
648
|
}
|
|
649
649
|
};
|
|
650
|
-
},
|
|
650
|
+
}, gr = () => {
|
|
651
651
|
const { ctx: e } = _(), { intentsAccountType: t } = b(), { isNativeNearDeposit: r } = Z(), s = ne({
|
|
652
652
|
addressType: t,
|
|
653
653
|
walletAddress: e.walletAddress ?? ""
|
|
654
|
-
}), n = X(null), a = X(new AbortController()), c = L(() => async (d) =>
|
|
654
|
+
}), n = X(null), a = X(new AbortController()), c = L(() => async (d) => kt.post(
|
|
655
655
|
"",
|
|
656
656
|
{
|
|
657
657
|
id: 1,
|
|
@@ -667,7 +667,7 @@ const cr = (e) => {
|
|
|
667
667
|
{
|
|
668
668
|
signal: a.current.signal
|
|
669
669
|
}
|
|
670
|
-
), [
|
|
670
|
+
), [Ne]);
|
|
671
671
|
return {
|
|
672
672
|
make: async () => {
|
|
673
673
|
if (!x(e, [
|
|
@@ -715,10 +715,10 @@ const cr = (e) => {
|
|
|
715
715
|
});
|
|
716
716
|
}
|
|
717
717
|
n.current && (a.current.abort("Abort previous quote (auto)"), a.current = new AbortController());
|
|
718
|
-
let u =
|
|
718
|
+
let u = Tt[e.targetToken.blockchain];
|
|
719
719
|
if (!u)
|
|
720
720
|
if (H(e.targetToken.blockchain))
|
|
721
|
-
u =
|
|
721
|
+
u = ht;
|
|
722
722
|
else
|
|
723
723
|
throw new U({
|
|
724
724
|
code: "QUOTE_INVALID_INITIAL",
|
|
@@ -748,9 +748,9 @@ const cr = (e) => {
|
|
|
748
748
|
dry: !1
|
|
749
749
|
};
|
|
750
750
|
} catch (i) {
|
|
751
|
-
if (i instanceof
|
|
751
|
+
if (i instanceof It)
|
|
752
752
|
return;
|
|
753
|
-
if (E.error(i), i instanceof
|
|
753
|
+
if (E.error(i), i instanceof wt) {
|
|
754
754
|
const f = i.response?.data.message || i.message;
|
|
755
755
|
throw new U({
|
|
756
756
|
code: "QUOTE_FAILED",
|
|
@@ -765,60 +765,60 @@ const cr = (e) => {
|
|
|
765
765
|
a.current.abort("Abort quote manually"), a.current = new AbortController();
|
|
766
766
|
}
|
|
767
767
|
};
|
|
768
|
-
},
|
|
768
|
+
}, rt = (e) => {
|
|
769
769
|
T("errorSet", e), T("quoteSet", void 0), T("quoteSetStatus", "idle"), T("transferSetStatus", { status: "idle" });
|
|
770
|
-
},
|
|
770
|
+
}, at = async (e) => {
|
|
771
771
|
if (!e.sendAddress)
|
|
772
772
|
return;
|
|
773
773
|
let t = !1;
|
|
774
774
|
try {
|
|
775
|
-
T("setInputsValidating", !0), t = await
|
|
775
|
+
T("setInputsValidating", !0), t = await Sn(e.sendAddress);
|
|
776
776
|
} catch {
|
|
777
|
-
|
|
777
|
+
rt({
|
|
778
778
|
code: "SEND_ADDRESS_IS_NOT_VERIFIED",
|
|
779
779
|
meta: { address: e.sendAddress, chain: "near" }
|
|
780
780
|
}), T("setInputsValidating", !1), F("initial_wallet");
|
|
781
781
|
return;
|
|
782
782
|
}
|
|
783
783
|
if (T("setInputsValidating", !1), !t) {
|
|
784
|
-
|
|
784
|
+
rt({
|
|
785
785
|
code: "SEND_ADDRESS_IS_NOT_FOUND",
|
|
786
786
|
meta: { address: e.sendAddress, chain: "near" }
|
|
787
787
|
}), F("initial_wallet");
|
|
788
788
|
return;
|
|
789
789
|
}
|
|
790
|
-
e.error ?
|
|
791
|
-
},
|
|
790
|
+
e.error ? Nn(e.error) && (T("errorSet", null), F("input_valid_external")) : F("input_valid_external");
|
|
791
|
+
}, Ot = (e) => {
|
|
792
792
|
const t = x(e, ["initial_dry"]), r = x(e, ["input_valid_dry"]);
|
|
793
793
|
if (!t && !r)
|
|
794
794
|
return;
|
|
795
795
|
let s;
|
|
796
|
-
return t && (e.sourceToken ? e.targetToken ? se(e.sourceTokenAmount) ? e.walletAddress && !
|
|
797
|
-
},
|
|
796
|
+
return t && (e.sourceToken ? e.targetToken ? se(e.sourceTokenAmount) ? e.walletAddress && !Oe(e) && (s = { code: "SOURCE_BALANCE_INSUFFICIENT" }) : s = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : s = { code: "TARGET_TOKEN_IS_EMPTY" } : s = { code: "SOURCE_TOKEN_IS_EMPTY" }), !r && s ? T("errorSet", s) : e.error && !Fe(e.error) && !Le(e.error) && T("errorSet", null), r && s?.code === "SOURCE_BALANCE_INSUFFICIENT" && T("errorSet", s), r;
|
|
797
|
+
}, Ft = (e) => {
|
|
798
798
|
const t = x(e, ["initial_wallet"]), r = x(e, ["input_valid_external"]);
|
|
799
799
|
if (!t && !r)
|
|
800
800
|
return;
|
|
801
801
|
const s = e.sourceTokenBalance;
|
|
802
802
|
let n;
|
|
803
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : se(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ?
|
|
803
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : se(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ? St(e.sendAddress) ? at(e) : n = {
|
|
804
804
|
code: "SEND_ADDRESS_IS_INVALID",
|
|
805
805
|
meta: { address: e.sendAddress, chain: "near" }
|
|
806
|
-
} : e.isDepositFromExternalWallet || (!s || !
|
|
807
|
-
},
|
|
806
|
+
} : e.isDepositFromExternalWallet || (!s || !At(s) ? n = { code: "INVALID_SOURCE_BALANCE" } : Oe(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SEND_ADDRESS_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), r && e.targetToken.blockchain === "near" && at(e), !r && n ? T("errorSet", n) : e.error && !Fe(e.error) && !Le(e.error) && T("errorSet", null), r;
|
|
807
|
+
}, Lt = (e) => {
|
|
808
808
|
const t = x(e, ["initial_wallet"]), r = x(e, ["input_valid_internal"]);
|
|
809
809
|
if (!t && !r)
|
|
810
810
|
return;
|
|
811
811
|
const s = e.sourceTokenBalance;
|
|
812
812
|
let n;
|
|
813
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? se(e.sourceTokenAmount) ? e.isDepositFromExternalWallet || (!s || !
|
|
814
|
-
},
|
|
815
|
-
const t =
|
|
813
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? se(e.sourceTokenAmount) ? e.isDepositFromExternalWallet || (!s || !At(s) ? n = { code: "INVALID_SOURCE_BALANCE" } : Oe(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_NOT_INTENT" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), !r && n ? T("errorSet", n) : e.error && !Fe(e.error) && !Le(e.error) && T("errorSet", null), r;
|
|
814
|
+
}, Bt = (e) => {
|
|
815
|
+
const t = xe(e), r = !t && e.targetToken?.isIntent === !0, s = !t && e.targetToken?.isIntent === !1;
|
|
816
816
|
if (t) {
|
|
817
|
-
const n =
|
|
817
|
+
const n = Ot(e);
|
|
818
818
|
return F(n ? "input_valid_dry" : "initial_dry");
|
|
819
819
|
}
|
|
820
|
-
s &&
|
|
821
|
-
},
|
|
820
|
+
s && Ft(e) ? F("input_valid_external") : r && Lt(e) ? F("input_valid_internal") : F("initial_wallet");
|
|
821
|
+
}, Ir = ({
|
|
822
822
|
isEnabled: e,
|
|
823
823
|
message: t,
|
|
824
824
|
type: r = "exact_in",
|
|
@@ -831,14 +831,14 @@ const cr = (e) => {
|
|
|
831
831
|
isDirectNearTokenWithdrawal: d,
|
|
832
832
|
isDirectTokenOnNearTransfer: u,
|
|
833
833
|
isSameAssetDiffChainWithdrawal: i
|
|
834
|
-
} = Z(), f =
|
|
834
|
+
} = Z(), f = xe(n), p = e && !n.areInputsValidating && (i || (l || a) && n.isDepositFromExternalWallet || !d && !c && !l && !u), { make: I, cancel: m } = hr(), { make: w, cancel: k } = gr(), y = X(null), q = () => {
|
|
835
835
|
m(), k();
|
|
836
836
|
};
|
|
837
837
|
R(() => {
|
|
838
838
|
const B = x(n, ["input_valid_dry"]), S = x(n, ["input_valid_external"]), O = x(n, ["input_valid_internal"]);
|
|
839
839
|
(f && !B || !f && n.targetToken?.isIntent && !O || !f && !n.targetToken?.isIntent && !S || n.areInputsValidating) && q();
|
|
840
840
|
}, [q, f, n]);
|
|
841
|
-
const D =
|
|
841
|
+
const D = le(
|
|
842
842
|
async (B) => {
|
|
843
843
|
try {
|
|
844
844
|
let S;
|
|
@@ -864,7 +864,7 @@ const cr = (e) => {
|
|
|
864
864
|
T("quoteSetStatus", "idle"), T("quoteSet", void 0), T("errorSet", null);
|
|
865
865
|
return;
|
|
866
866
|
}
|
|
867
|
-
T("quoteSetStatus", "error"), T("quoteSet", void 0), T("errorSet", S.data),
|
|
867
|
+
T("quoteSetStatus", "error"), T("quoteSet", void 0), T("errorSet", S.data), Bt(n);
|
|
868
868
|
return;
|
|
869
869
|
}
|
|
870
870
|
E.error("Unhandled error in useMakeQuoteEffect:", S), T("quoteSetStatus", "error"), T("quoteSet", void 0), T("errorSet", {
|
|
@@ -885,22 +885,22 @@ const cr = (e) => {
|
|
|
885
885
|
await D({ isRefetch: !0 });
|
|
886
886
|
}, s)), B;
|
|
887
887
|
}, [p, D, q, n.state]);
|
|
888
|
-
},
|
|
888
|
+
}, Ie = {
|
|
889
889
|
sol: "sol",
|
|
890
890
|
evm: "eth",
|
|
891
891
|
near: "near"
|
|
892
|
-
},
|
|
892
|
+
}, wr = ({
|
|
893
893
|
isEnabled: e,
|
|
894
894
|
skipIntents: t = !1,
|
|
895
895
|
target: r = "none"
|
|
896
896
|
}) => {
|
|
897
|
-
const { tokens: s } =
|
|
897
|
+
const { tokens: s } = V(), { ctx: n, state: a } = _(), { intentBalances: c } = pe(), { walletSupportedChains: l, chainsFilter: d, intentsAccountType: u } = b(), i = bn({
|
|
898
898
|
tokens: s,
|
|
899
899
|
walletSupportedChains: l,
|
|
900
900
|
balances: c,
|
|
901
901
|
across: "intents"
|
|
902
902
|
}), [f, p] = L(() => !n.walletAddress && !t ? [
|
|
903
|
-
{ token:
|
|
903
|
+
{ token: yn({ tokens: s }), status: "loaded" },
|
|
904
904
|
{ token: void 0, status: "loaded" }
|
|
905
905
|
] : d.source.intents !== "none" && !t ? i ? [
|
|
906
906
|
{ token: i, status: "loaded" },
|
|
@@ -909,7 +909,7 @@ const cr = (e) => {
|
|
|
909
909
|
{ token: void 0, status: "loading" },
|
|
910
910
|
{ token: void 0, status: "loading" }
|
|
911
911
|
] : [
|
|
912
|
-
{ token:
|
|
912
|
+
{ token: _n({
|
|
913
913
|
tokens: s,
|
|
914
914
|
walletSupportedChains: l
|
|
915
915
|
}), status: "loaded" },
|
|
@@ -938,7 +938,7 @@ const cr = (e) => {
|
|
|
938
938
|
"Intents account type is required to select same-asset target token"
|
|
939
939
|
);
|
|
940
940
|
w = s.find(
|
|
941
|
-
(k) => !k.isIntent && k.symbol === n.sourceToken?.symbol && k.blockchain ===
|
|
941
|
+
(k) => !k.isIntent && k.symbol === n.sourceToken?.symbol && k.blockchain === Ie[u]
|
|
942
942
|
);
|
|
943
943
|
} else
|
|
944
944
|
w = s.find(
|
|
@@ -952,7 +952,7 @@ const cr = (e) => {
|
|
|
952
952
|
}, [n, f, p, e]);
|
|
953
953
|
const I = (m, w) => {
|
|
954
954
|
const k = s.find(
|
|
955
|
-
(y) => !y.isIntent && y.blockchain ===
|
|
955
|
+
(y) => !y.isIntent && y.blockchain === Ie[m] && y.symbol.toLowerCase() === cn[Ie[m]]?.toLowerCase()
|
|
956
956
|
) ?? w;
|
|
957
957
|
T("tokenSelect", {
|
|
958
958
|
variant: "source",
|
|
@@ -969,38 +969,38 @@ const cr = (e) => {
|
|
|
969
969
|
f.token || (!t && i ? T("tokenSelect", {
|
|
970
970
|
variant: "source",
|
|
971
971
|
token: i
|
|
972
|
-
}) : l.length && u ? I(u, w) : n.walletAddress &&
|
|
972
|
+
}) : l.length && u ? I(u, w) : n.walletAddress && Nt(n.walletAddress) ? I("sol", w) : n.walletAddress && _t(n.walletAddress) ? I("evm", w) : n.walletAddress && St(n.walletAddress) ? I("near", w) : T("tokenSelect", {
|
|
973
973
|
variant: "source",
|
|
974
974
|
token: w
|
|
975
975
|
}));
|
|
976
976
|
}, 3e3);
|
|
977
977
|
return () => clearTimeout(k);
|
|
978
978
|
}, [s, f, t]), { source: n.sourceToken, target: n.targetToken };
|
|
979
|
-
},
|
|
979
|
+
}, kr = ({
|
|
980
980
|
isEnabled: e,
|
|
981
981
|
alchemyApiKey: t
|
|
982
982
|
}) => {
|
|
983
983
|
const { connectedWallets: r } = b();
|
|
984
|
-
|
|
984
|
+
xt({
|
|
985
985
|
isEnabled: e,
|
|
986
986
|
connectedWallets: r,
|
|
987
987
|
alchemyApiKey: t ?? ""
|
|
988
988
|
});
|
|
989
|
-
},
|
|
990
|
-
const { config: r } =
|
|
989
|
+
}, Ar = (e, t) => {
|
|
990
|
+
const { config: r } = Ee(Ve);
|
|
991
991
|
return e.targetToken && !e.sendAddress && !!e.walletAddress && !e.targetToken.isIntent && !t.find((s) => s?.key === "sendAddress") && r.walletSupportedChains.includes(e.targetToken.blockchain);
|
|
992
|
-
},
|
|
992
|
+
}, Sr = ({ debug: e }) => {
|
|
993
993
|
J.onContextChange((t, r) => {
|
|
994
994
|
const s = r;
|
|
995
|
-
if (e && E.debug("[WIDGET] Context changed", s), e && t.error &&
|
|
995
|
+
if (e && E.debug("[WIDGET] Context changed", s), e && t.error && Cn(s) && E.debug(`[WIDGET] Error set to ${t.error.code}`), Dn(s) || Fn(t, s, e))
|
|
996
996
|
return;
|
|
997
|
-
if (
|
|
997
|
+
if (xn(t, s)) {
|
|
998
998
|
T("reset", { clearWalletAddress: !0 }), F("initial_dry");
|
|
999
999
|
return;
|
|
1000
1000
|
}
|
|
1001
|
-
const { isChanged: n, isDry: a } =
|
|
1001
|
+
const { isChanged: n, isDry: a } = Rn(t, s);
|
|
1002
1002
|
if (n) {
|
|
1003
|
-
if (
|
|
1003
|
+
if (vn(t)) {
|
|
1004
1004
|
const c = a ? "initial_dry" : "initial_wallet";
|
|
1005
1005
|
F(c, {
|
|
1006
1006
|
onMoved: () => {
|
|
@@ -1010,21 +1010,21 @@ const cr = (e) => {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
});
|
|
1012
1012
|
}
|
|
1013
|
-
|
|
1013
|
+
En(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), On(t) && (t.sendAddress = void 0), Ar(t, s) && (t.sendAddress = t.walletAddress), Bt(t);
|
|
1014
1014
|
}
|
|
1015
1015
|
});
|
|
1016
|
-
},
|
|
1016
|
+
}, Nr = ({ debug: e }) => {
|
|
1017
1017
|
J.onTransition((t, r) => {
|
|
1018
1018
|
e && E.debug(`===> [WIDGET] State moved from ${t} to ${r}`);
|
|
1019
1019
|
});
|
|
1020
|
-
},
|
|
1021
|
-
const { variant: r, token: s } = t, { config: n } =
|
|
1020
|
+
}, _r = (e, t) => {
|
|
1021
|
+
const { variant: r, token: s } = t, { config: n } = Ee(Ve);
|
|
1022
1022
|
switch (r) {
|
|
1023
1023
|
case "source":
|
|
1024
1024
|
if (s && s.assetId === e.targetToken?.assetId && s.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching) {
|
|
1025
1025
|
if (!e.sourceToken)
|
|
1026
1026
|
return;
|
|
1027
|
-
|
|
1027
|
+
_e(e);
|
|
1028
1028
|
return;
|
|
1029
1029
|
}
|
|
1030
1030
|
if (s && !e.sourceToken && s.assetId === e.targetToken?.assetId && s.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching)
|
|
@@ -1035,26 +1035,26 @@ const cr = (e) => {
|
|
|
1035
1035
|
if (s && s.assetId === e.sourceToken?.assetId && s.isIntent === e.sourceToken.isIntent && n.enableAutoTokensSwitching) {
|
|
1036
1036
|
if (!e.targetToken)
|
|
1037
1037
|
return;
|
|
1038
|
-
|
|
1038
|
+
_e(e);
|
|
1039
1039
|
return;
|
|
1040
1040
|
}
|
|
1041
1041
|
e.targetToken = s;
|
|
1042
1042
|
break;
|
|
1043
1043
|
default:
|
|
1044
|
-
|
|
1044
|
+
ve(r, { throwError: !1 });
|
|
1045
1045
|
}
|
|
1046
1046
|
}, v = (e, t) => J.on(
|
|
1047
1047
|
e,
|
|
1048
1048
|
(r, s) => t(r, s, J)
|
|
1049
|
-
),
|
|
1050
|
-
v("quoteSetStatus",
|
|
1051
|
-
},
|
|
1049
|
+
), yr = () => {
|
|
1050
|
+
v("quoteSetStatus", Wn), v("walletAddressSet", $n), v("transferSetStatus", Hn), v("tokenSelectRotate", _e), v("tokenSetBalance", Kn), v("tokenSetAmount", Pn), v("depositTypeSet", Vn), v("setInputsValidating", Qn), v("externalDepositTxSet", Mn), v("tokenSelect", _r), v("addressSet", Un), v("errorSet", Bn), v("quoteSet", qn), v("reset", Ln), v("validateDryInputs", Ot), v("validateExternalInputs", Ft), v("validateInternalInputs", Lt);
|
|
1051
|
+
}, br = Tn(({ debug: e }) => {
|
|
1052
1052
|
e && E.debug(
|
|
1053
|
-
"[WIDGET] Debug mode is enabled (package version: 3.18.
|
|
1054
|
-
),
|
|
1055
|
-
}),
|
|
1053
|
+
"[WIDGET] Debug mode is enabled (package version: 3.18.1)"
|
|
1054
|
+
), yr(), Nr({ debug: e }), Sr({ debug: e });
|
|
1055
|
+
}), ul = ({ listenTo: e, debug: t = !1 }) => {
|
|
1056
1056
|
R(() => {
|
|
1057
|
-
|
|
1057
|
+
br({ debug: t });
|
|
1058
1058
|
}, [t]);
|
|
1059
1059
|
const r = e.find(
|
|
1060
1060
|
(a) => Array.isArray(a) && a[0] === "setBalancesUsingAlchemyExt"
|
|
@@ -1063,94 +1063,94 @@ const cr = (e) => {
|
|
|
1063
1063
|
), n = e.find(
|
|
1064
1064
|
(a) => Array.isArray(a) && a[0] === "makeQuote"
|
|
1065
1065
|
);
|
|
1066
|
-
|
|
1066
|
+
kr({
|
|
1067
1067
|
isEnabled: !!r,
|
|
1068
1068
|
alchemyApiKey: r?.[1].alchemyApiKey
|
|
1069
|
-
}),
|
|
1069
|
+
}), wr({
|
|
1070
1070
|
isEnabled: !!s,
|
|
1071
1071
|
skipIntents: s?.[1].skipIntents,
|
|
1072
1072
|
target: s?.[1].target
|
|
1073
|
-
}),
|
|
1073
|
+
}), Ir({
|
|
1074
1074
|
isEnabled: !!n,
|
|
1075
1075
|
message: n?.[1].message,
|
|
1076
1076
|
type: n?.[1].type,
|
|
1077
1077
|
refetchQuoteInterval: n?.[1].refetchQuoteInterval
|
|
1078
|
-
}),
|
|
1078
|
+
}), pr({
|
|
1079
1079
|
isEnabled: e.includes("checkWalletConnection")
|
|
1080
|
-
}), ur({
|
|
1081
|
-
isEnabled: e.includes("setSourceTokenBalance")
|
|
1082
1080
|
}), mr({
|
|
1081
|
+
isEnabled: e.includes("setSourceTokenBalance")
|
|
1082
|
+
}), fr({
|
|
1083
1083
|
isEnabled: e.includes("setSourceTokenIntentsTarget")
|
|
1084
|
-
}),
|
|
1084
|
+
}), ur({
|
|
1085
1085
|
isEnabled: e.includes("updateBalances"),
|
|
1086
1086
|
alchemyApiKey: r?.[1].alchemyApiKey
|
|
1087
1087
|
});
|
|
1088
|
-
},
|
|
1089
|
-
class
|
|
1088
|
+
}, Er = J.getStore();
|
|
1089
|
+
class M extends Error {
|
|
1090
1090
|
context;
|
|
1091
1091
|
_is_widget_error = !0;
|
|
1092
1092
|
constructor(t, r) {
|
|
1093
|
-
super(t), this.name = "WidgetError", this.cause = r?.cause, this.context =
|
|
1093
|
+
super(t), this.name = "WidgetError", this.cause = r?.cause, this.context = Ee(Er).context;
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
class
|
|
1096
|
+
class qt extends M {
|
|
1097
1097
|
data;
|
|
1098
1098
|
constructor(t) {
|
|
1099
1099
|
super(t.code), this.data = t, this.name = "MachineError";
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
class U extends
|
|
1102
|
+
class U extends qt {
|
|
1103
1103
|
constructor(t) {
|
|
1104
1104
|
super(t), this.name = "QuoteError";
|
|
1105
1105
|
}
|
|
1106
1106
|
}
|
|
1107
|
-
class g extends
|
|
1107
|
+
class g extends qt {
|
|
1108
1108
|
constructor(t) {
|
|
1109
1109
|
super(t), this.name = "TransferError";
|
|
1110
1110
|
}
|
|
1111
1111
|
}
|
|
1112
|
-
const
|
|
1113
|
-
usdTradeDelta: (e) =>
|
|
1114
|
-
isDirectNearTokenWithdrawal: (e) =>
|
|
1115
|
-
isDirectNonNearWithdrawal: (e) =>
|
|
1116
|
-
isDirectTokenOnNearDeposit: (e) =>
|
|
1117
|
-
isNativeNearDeposit: (e) =>
|
|
1118
|
-
isSameAssetDiffChainWithdrawal: (e) =>
|
|
1119
|
-
isDirectTokenOnNearTransfer: (e) =>
|
|
1120
|
-
}), Z = () =>
|
|
1121
|
-
const e =
|
|
1112
|
+
const ml = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e && !!e._is_widget_error, Q = J.getStore(), Rr = mn({
|
|
1113
|
+
usdTradeDelta: (e) => Gn(e(Q.context)),
|
|
1114
|
+
isDirectNearTokenWithdrawal: (e) => Yn(e(Q.context)),
|
|
1115
|
+
isDirectNonNearWithdrawal: (e) => jn(e(Q.context)),
|
|
1116
|
+
isDirectTokenOnNearDeposit: (e) => pn(e(Q.context)),
|
|
1117
|
+
isNativeNearDeposit: (e) => fn(e(Q.context)),
|
|
1118
|
+
isSameAssetDiffChainWithdrawal: (e) => Xn(e(Q.context)),
|
|
1119
|
+
isDirectTokenOnNearTransfer: (e) => zn(e(Q.context))
|
|
1120
|
+
}), Z = () => me(Rr), _ = () => {
|
|
1121
|
+
const e = me(Q);
|
|
1122
1122
|
return {
|
|
1123
1123
|
state: e.state,
|
|
1124
1124
|
ctx: e.context
|
|
1125
1125
|
};
|
|
1126
|
-
},
|
|
1127
|
-
const t =
|
|
1126
|
+
}, fl = (e) => {
|
|
1127
|
+
const t = me(Q);
|
|
1128
1128
|
if (!x(t.context, [e]))
|
|
1129
|
-
throw new
|
|
1129
|
+
throw new M(
|
|
1130
1130
|
`[WIDGET] Attempt to access snapshot for ${e} state while context does not match`
|
|
1131
1131
|
);
|
|
1132
1132
|
return t.context;
|
|
1133
|
-
},
|
|
1133
|
+
}, Cr = async ({
|
|
1134
1134
|
contractId: e,
|
|
1135
1135
|
accountId: t
|
|
1136
1136
|
}) => {
|
|
1137
1137
|
try {
|
|
1138
|
-
const r = { account_id: t }, s =
|
|
1138
|
+
const r = { account_id: t }, s = qe.from(JSON.stringify(r)).toString("base64"), n = await Jn.query({
|
|
1139
1139
|
request_type: "call_function",
|
|
1140
1140
|
method_name: "storage_balance_of",
|
|
1141
1141
|
account_id: e,
|
|
1142
1142
|
args_base64: s,
|
|
1143
1143
|
finality: "optimistic"
|
|
1144
|
-
}), a =
|
|
1144
|
+
}), a = Zn(
|
|
1145
1145
|
n,
|
|
1146
1146
|
oe.union([oe.null(), oe.object({ total: oe.string() })])
|
|
1147
1147
|
);
|
|
1148
1148
|
return BigInt(a?.total ?? "0");
|
|
1149
1149
|
} catch (r) {
|
|
1150
|
-
throw new
|
|
1150
|
+
throw new M("Error fetching balance", { cause: r });
|
|
1151
1151
|
}
|
|
1152
1152
|
};
|
|
1153
|
-
function
|
|
1153
|
+
function Dr(e) {
|
|
1154
1154
|
const { ctx: t } = _(), { isNativeNearDeposit: r } = Z(), s = t.sourceToken?.contractAddress, n = t.quote?.amountIn ?? t.sourceTokenAmount;
|
|
1155
1155
|
return {
|
|
1156
1156
|
make: async (c, l) => {
|
|
@@ -1175,7 +1175,7 @@ function Cr(e) {
|
|
|
1175
1175
|
meta: { message: "No amount to transfer." }
|
|
1176
1176
|
});
|
|
1177
1177
|
const d = e();
|
|
1178
|
-
if (t.sourceToken.assetId === G && t.targetToken?.assetId !==
|
|
1178
|
+
if (t.sourceToken.assetId === G && t.targetToken?.assetId !== Se) {
|
|
1179
1179
|
const i = await d.signAndSendTransactions({
|
|
1180
1180
|
transactions: [
|
|
1181
1181
|
{
|
|
@@ -1210,7 +1210,7 @@ function Cr(e) {
|
|
|
1210
1210
|
type: "FunctionCall",
|
|
1211
1211
|
params: {
|
|
1212
1212
|
methodName: "near_deposit",
|
|
1213
|
-
gas:
|
|
1213
|
+
gas: je,
|
|
1214
1214
|
deposit: n,
|
|
1215
1215
|
args: {}
|
|
1216
1216
|
}
|
|
@@ -1220,7 +1220,7 @@ function Cr(e) {
|
|
|
1220
1220
|
methodName: "ft_transfer_call",
|
|
1221
1221
|
deposit: "1",
|
|
1222
1222
|
// 1 yocto required by NEP-141
|
|
1223
|
-
gas:
|
|
1223
|
+
gas: ze,
|
|
1224
1224
|
args: {
|
|
1225
1225
|
amount: n,
|
|
1226
1226
|
receiver_id: c,
|
|
@@ -1246,7 +1246,7 @@ function Cr(e) {
|
|
|
1246
1246
|
code: "NO_DEPOSIT_RESULT"
|
|
1247
1247
|
});
|
|
1248
1248
|
} catch (i) {
|
|
1249
|
-
if (
|
|
1249
|
+
if (ce(i) && de(i))
|
|
1250
1250
|
return;
|
|
1251
1251
|
throw E.error("[TRANSFER ERROR]", i), new g({
|
|
1252
1252
|
code: "DIRECT_TRANSFER_ERROR"
|
|
@@ -1259,10 +1259,10 @@ function Cr(e) {
|
|
|
1259
1259
|
});
|
|
1260
1260
|
try {
|
|
1261
1261
|
const [i, f] = await Promise.all([
|
|
1262
|
-
|
|
1262
|
+
es({
|
|
1263
1263
|
contractId: s
|
|
1264
1264
|
}),
|
|
1265
|
-
|
|
1265
|
+
Cr({
|
|
1266
1266
|
contractId: s,
|
|
1267
1267
|
accountId: c
|
|
1268
1268
|
})
|
|
@@ -1272,7 +1272,7 @@ function Cr(e) {
|
|
|
1272
1272
|
params: {
|
|
1273
1273
|
methodName: "storage_deposit",
|
|
1274
1274
|
args: { account_id: c },
|
|
1275
|
-
gas:
|
|
1275
|
+
gas: je,
|
|
1276
1276
|
deposit: p.toString()
|
|
1277
1277
|
}
|
|
1278
1278
|
}), u.push({
|
|
@@ -1284,7 +1284,7 @@ function Cr(e) {
|
|
|
1284
1284
|
amount: n,
|
|
1285
1285
|
msg: l ?? ""
|
|
1286
1286
|
},
|
|
1287
|
-
gas:
|
|
1287
|
+
gas: ze,
|
|
1288
1288
|
deposit: "1"
|
|
1289
1289
|
}
|
|
1290
1290
|
});
|
|
@@ -1306,7 +1306,7 @@ function Cr(e) {
|
|
|
1306
1306
|
code: "NO_DEPOSIT_RESULT"
|
|
1307
1307
|
});
|
|
1308
1308
|
} catch (i) {
|
|
1309
|
-
if (
|
|
1309
|
+
if (ce(i) && de(i))
|
|
1310
1310
|
return;
|
|
1311
1311
|
throw E.error("[TRANSFER ERROR]", i), new g({
|
|
1312
1312
|
code: "DIRECT_TRANSFER_ERROR"
|
|
@@ -1315,21 +1315,21 @@ function Cr(e) {
|
|
|
1315
1315
|
}
|
|
1316
1316
|
};
|
|
1317
1317
|
}
|
|
1318
|
-
const
|
|
1318
|
+
const vr = ({
|
|
1319
1319
|
makeTransfer: e,
|
|
1320
1320
|
providers: t
|
|
1321
1321
|
}) => {
|
|
1322
|
-
const { ctx: r } = _(), { alchemyApiKey: s } = b(), { make: n } =
|
|
1322
|
+
const { ctx: r } = _(), { alchemyApiKey: s } = b(), { make: n } = ts({
|
|
1323
1323
|
provider: t?.evm
|
|
1324
|
-
}), { make: a } =
|
|
1324
|
+
}), { make: a } = ns({
|
|
1325
1325
|
provider: t?.sol,
|
|
1326
1326
|
alchemyApiKey: s
|
|
1327
1327
|
}), c = (d) => {
|
|
1328
1328
|
if (e)
|
|
1329
1329
|
return e;
|
|
1330
|
-
if (
|
|
1330
|
+
if (_t(d))
|
|
1331
1331
|
return n;
|
|
1332
|
-
if (
|
|
1332
|
+
if (Nt(d))
|
|
1333
1333
|
return a;
|
|
1334
1334
|
throw new g({
|
|
1335
1335
|
code: "TRANSFER_INVALID_INITIAL",
|
|
@@ -1363,8 +1363,8 @@ const Dr = ({
|
|
|
1363
1363
|
decimals: r.sourceToken.decimals,
|
|
1364
1364
|
address: r.quote.depositAddress,
|
|
1365
1365
|
chain: r.sourceToken.blockchain,
|
|
1366
|
-
evmChainId: H(r.sourceToken.blockchain) ?
|
|
1367
|
-
isNativeEvmTokenTransfer: !!r.sourceToken &&
|
|
1366
|
+
evmChainId: H(r.sourceToken.blockchain) ? Ae[r.sourceToken.blockchain] : null,
|
|
1367
|
+
isNativeEvmTokenTransfer: !!r.sourceToken && yt(r.sourceToken),
|
|
1368
1368
|
tokenAddress: r.sourceToken.assetId === G ? G : r.sourceToken.contractAddress,
|
|
1369
1369
|
sourceAssetId: r.sourceToken.assetId,
|
|
1370
1370
|
targetAssetId: r.targetToken.assetId
|
|
@@ -1386,10 +1386,10 @@ const Dr = ({
|
|
|
1386
1386
|
} catch (i) {
|
|
1387
1387
|
E.error("[TRANSFER ERROR]", i, { error: i });
|
|
1388
1388
|
let f = "Failed to make a transfer. Please try again.";
|
|
1389
|
-
const p =
|
|
1389
|
+
const p = ce(i) && de(i);
|
|
1390
1390
|
if (p)
|
|
1391
1391
|
return;
|
|
1392
|
-
throw
|
|
1392
|
+
throw An.isAxiosError(i) ? (f = i.response?.data?.detail ?? i.message ?? "Failed to make deposit. Please try again.", new g({
|
|
1393
1393
|
code: "QUOTE_ERROR",
|
|
1394
1394
|
meta: { message: f }
|
|
1395
1395
|
})) : f === "No quotes found" ? new g({
|
|
@@ -1404,7 +1404,7 @@ const Dr = ({
|
|
|
1404
1404
|
}
|
|
1405
1405
|
} };
|
|
1406
1406
|
};
|
|
1407
|
-
class
|
|
1407
|
+
class xr {
|
|
1408
1408
|
constructor(t, r) {
|
|
1409
1409
|
this.account = t, this.provider = r;
|
|
1410
1410
|
}
|
|
@@ -1414,7 +1414,7 @@ class vr {
|
|
|
1414
1414
|
deadline: t.deadline,
|
|
1415
1415
|
nonce: t.nonce,
|
|
1416
1416
|
intents: t.intents,
|
|
1417
|
-
signer_id: t.signer_id ??
|
|
1417
|
+
signer_id: t.signer_id ?? Xe.authHandleToIntentsUserId({
|
|
1418
1418
|
identifier: this.account.walletAddress,
|
|
1419
1419
|
method: "evm"
|
|
1420
1420
|
})
|
|
@@ -1425,42 +1425,42 @@ class vr {
|
|
|
1425
1425
|
params: [r, n[0]]
|
|
1426
1426
|
});
|
|
1427
1427
|
if (a == null)
|
|
1428
|
-
throw new
|
|
1428
|
+
throw new M("No signature is returned");
|
|
1429
1429
|
return {
|
|
1430
1430
|
payload: r,
|
|
1431
1431
|
standard: "erc191",
|
|
1432
|
-
signature:
|
|
1432
|
+
signature: Xe.transformERC191Signature(a)
|
|
1433
1433
|
};
|
|
1434
1434
|
}
|
|
1435
1435
|
}
|
|
1436
|
-
const
|
|
1436
|
+
const Or = ({
|
|
1437
1437
|
walletAddress: e,
|
|
1438
1438
|
getProvider: t
|
|
1439
|
-
}) =>
|
|
1439
|
+
}) => ss({
|
|
1440
1440
|
accountId: e,
|
|
1441
1441
|
signMessage: async (r) => {
|
|
1442
1442
|
const s = t();
|
|
1443
1443
|
if (!s.signMessage)
|
|
1444
|
-
throw new
|
|
1444
|
+
throw new M("Near wallet has no signMessage method exposed");
|
|
1445
1445
|
let n;
|
|
1446
1446
|
try {
|
|
1447
1447
|
n = await s.signMessage({
|
|
1448
1448
|
...r,
|
|
1449
|
-
nonce:
|
|
1449
|
+
nonce: qe.from(r.nonce)
|
|
1450
1450
|
});
|
|
1451
1451
|
} catch (a) {
|
|
1452
|
-
throw new
|
|
1452
|
+
throw new M("Near wallet failed to sign a message", {
|
|
1453
1453
|
cause: a
|
|
1454
1454
|
});
|
|
1455
1455
|
}
|
|
1456
1456
|
if (!n)
|
|
1457
|
-
throw new
|
|
1457
|
+
throw new M("Near wallet failed to sign a message");
|
|
1458
1458
|
return {
|
|
1459
1459
|
publicKey: n.publicKey,
|
|
1460
1460
|
signature: n.signature
|
|
1461
1461
|
};
|
|
1462
1462
|
}
|
|
1463
|
-
}),
|
|
1463
|
+
}), Fr = (e, t) => {
|
|
1464
1464
|
if (t) {
|
|
1465
1465
|
if (e.sendAddress)
|
|
1466
1466
|
return e.sendAddress;
|
|
@@ -1475,8 +1475,8 @@ const xr = ({
|
|
|
1475
1475
|
meta: { message: "Quote is required for intents non-direct transfer" }
|
|
1476
1476
|
});
|
|
1477
1477
|
return e.quote.depositAddress;
|
|
1478
|
-
},
|
|
1479
|
-
let r =
|
|
1478
|
+
}, Lr = async (e, t) => {
|
|
1479
|
+
let r = Ye.getItem("nearWalletsPk")[t];
|
|
1480
1480
|
if (!e.signMessage)
|
|
1481
1481
|
throw new g({
|
|
1482
1482
|
code: "DIRECT_TRANSFER_ERROR",
|
|
@@ -1487,14 +1487,14 @@ const xr = ({
|
|
|
1487
1487
|
const a = await e.signMessage({
|
|
1488
1488
|
message: "Authenticate",
|
|
1489
1489
|
recipient: "intents.near",
|
|
1490
|
-
nonce:
|
|
1490
|
+
nonce: qe.from(cs(32))
|
|
1491
1491
|
});
|
|
1492
1492
|
if (!a)
|
|
1493
1493
|
throw new g({
|
|
1494
1494
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1495
1495
|
meta: { message: "Signing message failed" }
|
|
1496
1496
|
});
|
|
1497
|
-
r = a.publicKey,
|
|
1497
|
+
r = a.publicKey, Ye.setItem("nearWalletsPk", {
|
|
1498
1498
|
[t]: a.publicKey
|
|
1499
1499
|
});
|
|
1500
1500
|
} catch {
|
|
@@ -1507,8 +1507,8 @@ const xr = ({
|
|
|
1507
1507
|
walletAddress: t,
|
|
1508
1508
|
addressType: "near"
|
|
1509
1509
|
});
|
|
1510
|
-
if (!await
|
|
1511
|
-
contractId:
|
|
1510
|
+
if (!await us({
|
|
1511
|
+
contractId: ye,
|
|
1512
1512
|
methodName: "has_public_key",
|
|
1513
1513
|
args: {
|
|
1514
1514
|
account_id: s,
|
|
@@ -1519,7 +1519,7 @@ const xr = ({
|
|
|
1519
1519
|
await e.signAndSendTransactions({
|
|
1520
1520
|
transactions: [
|
|
1521
1521
|
{
|
|
1522
|
-
receiverId:
|
|
1522
|
+
receiverId: ye,
|
|
1523
1523
|
signerId: t,
|
|
1524
1524
|
actions: [
|
|
1525
1525
|
{
|
|
@@ -1541,7 +1541,7 @@ const xr = ({
|
|
|
1541
1541
|
meta: { message: "Unable to add public key to intents account" }
|
|
1542
1542
|
});
|
|
1543
1543
|
}
|
|
1544
|
-
},
|
|
1544
|
+
}, Br = ({ providers: e }) => {
|
|
1545
1545
|
const { ctx: t } = _(), { appName: r, intentsAccountType: s } = b(), {
|
|
1546
1546
|
isNativeNearDeposit: n,
|
|
1547
1547
|
isDirectNearTokenWithdrawal: a,
|
|
@@ -1581,7 +1581,7 @@ const xr = ({
|
|
|
1581
1581
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1582
1582
|
meta: { message: "No EVM provider configured" }
|
|
1583
1583
|
});
|
|
1584
|
-
i = new
|
|
1584
|
+
i = new xr(
|
|
1585
1585
|
{ walletAddress: t.walletAddress },
|
|
1586
1586
|
e.evm
|
|
1587
1587
|
);
|
|
@@ -1592,7 +1592,7 @@ const xr = ({
|
|
|
1592
1592
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1593
1593
|
meta: { message: "No SOL provider configured" }
|
|
1594
1594
|
});
|
|
1595
|
-
i = new
|
|
1595
|
+
i = new ds(
|
|
1596
1596
|
{ walletAddress: t.walletAddress },
|
|
1597
1597
|
e.sol
|
|
1598
1598
|
);
|
|
@@ -1603,23 +1603,23 @@ const xr = ({
|
|
|
1603
1603
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1604
1604
|
meta: { message: "No NEAR provider configured" }
|
|
1605
1605
|
});
|
|
1606
|
-
await
|
|
1606
|
+
await Lr(e.near(), t.walletAddress), i = Or({
|
|
1607
1607
|
walletAddress: t.walletAddress,
|
|
1608
1608
|
getProvider: e.near
|
|
1609
1609
|
});
|
|
1610
1610
|
break;
|
|
1611
1611
|
}
|
|
1612
1612
|
default:
|
|
1613
|
-
|
|
1613
|
+
ve(s);
|
|
1614
1614
|
}
|
|
1615
|
-
const f = new
|
|
1615
|
+
const f = new rs({ referral: gt(r) });
|
|
1616
1616
|
f.setIntentSigner(i);
|
|
1617
1617
|
let p;
|
|
1618
|
-
n ? p = void 0 : a ? p =
|
|
1618
|
+
n ? p = void 0 : a ? p = as(d ?? void 0) : c ? p = void 0 : p = os();
|
|
1619
1619
|
const I = {
|
|
1620
1620
|
assetId: t.sourceToken.assetId,
|
|
1621
1621
|
amount: BigInt(t.sourceTokenAmount),
|
|
1622
|
-
destinationAddress:
|
|
1622
|
+
destinationAddress: Fr(
|
|
1623
1623
|
t,
|
|
1624
1624
|
a || c
|
|
1625
1625
|
),
|
|
@@ -1644,13 +1644,13 @@ const xr = ({
|
|
|
1644
1644
|
intent: k.hash,
|
|
1645
1645
|
// no hash means completion not trackable for this bridge
|
|
1646
1646
|
hash: y.hash ?? "",
|
|
1647
|
-
transactionLink: y.hash ?
|
|
1648
|
-
|
|
1647
|
+
transactionLink: y.hash ? ms(
|
|
1648
|
+
dn[t.targetToken.blockchain],
|
|
1649
1649
|
y.hash
|
|
1650
1650
|
) : ""
|
|
1651
1651
|
};
|
|
1652
1652
|
} catch (m) {
|
|
1653
|
-
if (E.error("[TRANSFER ERROR]", m), m instanceof
|
|
1653
|
+
if (E.error("[TRANSFER ERROR]", m), m instanceof is)
|
|
1654
1654
|
throw new g({
|
|
1655
1655
|
code: "MIN_WITHDRAWAL_AMOUNT_ERROR",
|
|
1656
1656
|
meta: {
|
|
@@ -1660,17 +1660,17 @@ const xr = ({
|
|
|
1660
1660
|
)
|
|
1661
1661
|
}
|
|
1662
1662
|
});
|
|
1663
|
-
if (m instanceof
|
|
1663
|
+
if (m instanceof ls)
|
|
1664
1664
|
throw new g({
|
|
1665
1665
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1666
1666
|
meta: { message: "Fee is above the maximum allowed" }
|
|
1667
1667
|
});
|
|
1668
|
-
if (
|
|
1668
|
+
if (ce(m)) {
|
|
1669
1669
|
if (m.message.includes("Fee is not estimated"))
|
|
1670
1670
|
throw new g({
|
|
1671
1671
|
code: "FEES_NOT_ESTIMATED"
|
|
1672
1672
|
});
|
|
1673
|
-
if (
|
|
1673
|
+
if (de(m))
|
|
1674
1674
|
return;
|
|
1675
1675
|
}
|
|
1676
1676
|
throw new g({
|
|
@@ -1678,7 +1678,7 @@ const xr = ({
|
|
|
1678
1678
|
});
|
|
1679
1679
|
}
|
|
1680
1680
|
} };
|
|
1681
|
-
},
|
|
1681
|
+
}, qr = ({
|
|
1682
1682
|
message: e,
|
|
1683
1683
|
providers: t,
|
|
1684
1684
|
makeTransfer: r
|
|
@@ -1687,10 +1687,10 @@ const xr = ({
|
|
|
1687
1687
|
isDirectTokenOnNearDeposit: n,
|
|
1688
1688
|
isDirectTokenOnNearTransfer: a,
|
|
1689
1689
|
isNativeNearDeposit: c
|
|
1690
|
-
} = Z(), { make: l } =
|
|
1690
|
+
} = Z(), { make: l } = Br({ providers: t }), { make: d } = vr({
|
|
1691
1691
|
makeTransfer: r,
|
|
1692
1692
|
providers: t
|
|
1693
|
-
}), { make: u } =
|
|
1693
|
+
}), { make: u } = Dr(
|
|
1694
1694
|
t?.near
|
|
1695
1695
|
);
|
|
1696
1696
|
return { make: async () => {
|
|
@@ -1713,7 +1713,7 @@ const xr = ({
|
|
|
1713
1713
|
});
|
|
1714
1714
|
else if ((c || n) && !s.isDepositFromExternalWallet)
|
|
1715
1715
|
f = await u(
|
|
1716
|
-
s.sendAddress ??
|
|
1716
|
+
s.sendAddress ?? ye,
|
|
1717
1717
|
e
|
|
1718
1718
|
);
|
|
1719
1719
|
else if (a) {
|
|
@@ -1737,32 +1737,32 @@ const xr = ({
|
|
|
1737
1737
|
}
|
|
1738
1738
|
return T("transferSetStatus", { status: "success" }), F("transfer_success"), f;
|
|
1739
1739
|
} };
|
|
1740
|
-
},
|
|
1740
|
+
}, Ur = async (e) => {
|
|
1741
1741
|
if (!e)
|
|
1742
1742
|
return;
|
|
1743
1743
|
const t = await e.request({
|
|
1744
1744
|
method: "eth_chainId"
|
|
1745
1745
|
});
|
|
1746
1746
|
return parseInt(t, 16);
|
|
1747
|
-
},
|
|
1748
|
-
const { ctx: t } = _(), [r, s] = te(!1), [n, a] = te(!1), c =
|
|
1747
|
+
}, Pr = ({ providers: e }) => {
|
|
1748
|
+
const { ctx: t } = _(), [r, s] = te(!1), [n, a] = te(!1), c = le(async () => {
|
|
1749
1749
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1750
1750
|
if (!t.sourceToken || !d)
|
|
1751
1751
|
return !1;
|
|
1752
|
-
const u = await
|
|
1752
|
+
const u = await Ur(d);
|
|
1753
1753
|
if (!H(t.sourceToken.blockchain))
|
|
1754
1754
|
return !1;
|
|
1755
|
-
const i =
|
|
1755
|
+
const i = Ae[t.sourceToken.blockchain];
|
|
1756
1756
|
return !i || !u ? !1 : u !== i;
|
|
1757
|
-
}, [t.sourceToken, e]), l =
|
|
1757
|
+
}, [t.sourceToken, e]), l = le(async () => {
|
|
1758
1758
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1759
1759
|
if (!t.sourceToken || !d || !H(t.sourceToken.blockchain))
|
|
1760
1760
|
return !1;
|
|
1761
|
-
const u =
|
|
1761
|
+
const u = Ae[t.sourceToken.blockchain];
|
|
1762
1762
|
if (!u)
|
|
1763
1763
|
return !1;
|
|
1764
1764
|
try {
|
|
1765
|
-
return s(!0), await
|
|
1765
|
+
return s(!0), await fs(u, d), !0;
|
|
1766
1766
|
} catch (i) {
|
|
1767
1767
|
return E.error("Failed to switch chain:", i), !1;
|
|
1768
1768
|
} finally {
|
|
@@ -1779,7 +1779,7 @@ const xr = ({
|
|
|
1779
1779
|
}, N = {
|
|
1780
1780
|
size: "lg",
|
|
1781
1781
|
variant: "primary"
|
|
1782
|
-
},
|
|
1782
|
+
}, Ue = (e) => {
|
|
1783
1783
|
const { t } = $();
|
|
1784
1784
|
if (e.error?.code === "TOKEN_IS_NOT_SUPPORTED")
|
|
1785
1785
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.invalidAddress", "Invalid address") });
|
|
@@ -1798,12 +1798,12 @@ const xr = ({
|
|
|
1798
1798
|
if (e.error?.code === "QUOTE_AMOUNT_IS_TOO_LOW" || e.error?.code === "MIN_WITHDRAWAL_AMOUNT_ERROR")
|
|
1799
1799
|
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1800
1800
|
/* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.amountTooLow.label", "Amount is too low") }),
|
|
1801
|
-
/* @__PURE__ */ o(j, { children: /* @__PURE__ */ h(
|
|
1801
|
+
/* @__PURE__ */ o(j, { children: /* @__PURE__ */ h(nn, { i18nKey: "submit.error.amountTooLow.message", children: [
|
|
1802
1802
|
"Amount you entered is very low. Please try increasing it",
|
|
1803
1803
|
" ",
|
|
1804
1804
|
/* @__PURE__ */ h("span", { className: "text-nowrap", children: [
|
|
1805
1805
|
"above ",
|
|
1806
|
-
/* @__PURE__ */ o(
|
|
1806
|
+
/* @__PURE__ */ o(Be, { value: e.error.meta.minAmount ?? "0" }),
|
|
1807
1807
|
" ",
|
|
1808
1808
|
e.sourceToken?.symbol ?? "",
|
|
1809
1809
|
"."
|
|
@@ -1848,19 +1848,19 @@ const xr = ({
|
|
|
1848
1848
|
] });
|
|
1849
1849
|
if (e.error?.code === "SOURCE_BALANCE_INSUFFICIENT")
|
|
1850
1850
|
return /* @__PURE__ */ o(A, { state: "error", ...N, children: t("submit.error.insufficientBalance", "Insufficient balance") });
|
|
1851
|
-
},
|
|
1851
|
+
}, Wr = ({ onClick: e }) => {
|
|
1852
1852
|
const { t } = $();
|
|
1853
1853
|
return /* @__PURE__ */ o(A, { state: "disabled", ...N, onClick: e, children: t("submit.error.connectWallet", "Connect wallet") });
|
|
1854
|
-
},
|
|
1854
|
+
}, Vr = () => {
|
|
1855
1855
|
const { ctx: e } = _();
|
|
1856
|
-
return
|
|
1856
|
+
return Ue(e) ?? null;
|
|
1857
1857
|
}, Mr = (e) => {
|
|
1858
1858
|
const { providers: t, makeTransfer: r, onSuccess: s } = e, { ctx: n } = _(), { t: a } = $(), {
|
|
1859
1859
|
isNativeNearDeposit: c,
|
|
1860
1860
|
isDirectNonNearWithdrawal: l,
|
|
1861
1861
|
isDirectTokenOnNearDeposit: d,
|
|
1862
1862
|
isDirectNearTokenWithdrawal: u
|
|
1863
|
-
} = Z(), { make: i } =
|
|
1863
|
+
} = Z(), { make: i } = qr({ providers: t, makeTransfer: r }), { isSwitchingChainRequired: f, switchChain: p, isSwitchingChain: I } = Pr({ providers: t }), m = Ue(n), w = async () => {
|
|
1864
1864
|
if (f && !await p())
|
|
1865
1865
|
return;
|
|
1866
1866
|
const k = await i();
|
|
@@ -1901,18 +1901,18 @@ const xr = ({
|
|
|
1901
1901
|
}
|
|
1902
1902
|
})() })
|
|
1903
1903
|
] }) : n.quoteStatus === "pending" ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: n.quote ? a("submit.pending.quote.refreshing", "Refreshing quote") : a("submit.pending.quote.finalizing", "Finalizing quote") }) : n.error ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : !n.quote && !l && !d && !u && !c ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : /* @__PURE__ */ o(A, { ...N, onClick: w, children: e.label });
|
|
1904
|
-
}, Vr = (e) => {
|
|
1905
|
-
const { t } = $(), { ctx: r } = _(), s = qe(r);
|
|
1906
|
-
return r.isDepositFromExternalWallet ? se(r.sourceTokenAmount) ? r.externalDepositTxReceived ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.processing", "Processing") }) : /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.waiting", "Waiting for transaction") }) : /* @__PURE__ */ o(A, { ...N, state: "disabled", children: t("submit.disabled.enterAmount", "Enter amount") }) : s || /* @__PURE__ */ o(Mr, { ...e });
|
|
1907
1904
|
}, Qr = (e) => {
|
|
1905
|
+
const { t } = $(), { ctx: r } = _(), s = Ue(r);
|
|
1906
|
+
return r.isDepositFromExternalWallet ? se(r.sourceTokenAmount) ? r.externalDepositTxReceived ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.processing", "Processing") }) : /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.waiting", "Waiting for transaction") }) : /* @__PURE__ */ o(A, { ...N, state: "disabled", children: t("submit.disabled.enterAmount", "Enter amount") }) : s || /* @__PURE__ */ o(Mr, { ...e });
|
|
1907
|
+
}, $r = (e) => {
|
|
1908
1908
|
const { ctx: t } = _(), r = b();
|
|
1909
|
-
return t.walletAddress ? /* @__PURE__ */ o(
|
|
1909
|
+
return t.walletAddress ? /* @__PURE__ */ o(Qr, { ...e }) : /* @__PURE__ */ o(Wr, { onClick: r.onWalletSignin });
|
|
1910
1910
|
};
|
|
1911
|
-
|
|
1912
|
-
const
|
|
1911
|
+
$r.Error = Vr;
|
|
1912
|
+
const Kr = ({ className: e }) => {
|
|
1913
1913
|
const { t } = $(), { slippageTolerance: r } = b(), { ctx: s } = _(), n = s.sourceToken && s.targetToken && s.sourceToken.price / s.targetToken.price;
|
|
1914
1914
|
return s.sourceToken ? /* @__PURE__ */ o(
|
|
1915
|
-
|
|
1915
|
+
ps,
|
|
1916
1916
|
{
|
|
1917
1917
|
expandedByDefault: !1,
|
|
1918
1918
|
expandedHeightPx: s.walletAddress ? 80 : 50,
|
|
@@ -1922,26 +1922,26 @@ const $r = ({ className: e }) => {
|
|
|
1922
1922
|
title: s.sourceToken && s.targetToken ? /* @__PURE__ */ h("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
1923
1923
|
`1 ${s.sourceToken.symbol} ≈ `,
|
|
1924
1924
|
" ",
|
|
1925
|
-
|
|
1925
|
+
Ts(n ?? 0),
|
|
1926
1926
|
" ",
|
|
1927
1927
|
`${s.targetToken.symbol}`,
|
|
1928
|
-
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${
|
|
1928
|
+
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${Ze(s.sourceToken.price)})` })
|
|
1929
1929
|
] }) : /* @__PURE__ */ h("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
1930
1930
|
`1 ${s.sourceToken.symbol} ≈ `,
|
|
1931
1931
|
" ",
|
|
1932
|
-
|
|
1932
|
+
Ze(s.sourceToken.price),
|
|
1933
1933
|
" USD"
|
|
1934
1934
|
] }),
|
|
1935
|
-
children: /* @__PURE__ */ h(
|
|
1935
|
+
children: /* @__PURE__ */ h(he, { children: [
|
|
1936
1936
|
/* @__PURE__ */ o(
|
|
1937
|
-
|
|
1937
|
+
he.Item,
|
|
1938
1938
|
{
|
|
1939
1939
|
label: t("quote.result.maxSlippage.label", "Max slippage"),
|
|
1940
1940
|
value: `${(r / 100).toFixed(2)}%`
|
|
1941
1941
|
}
|
|
1942
1942
|
),
|
|
1943
1943
|
!!s.walletAddress && /* @__PURE__ */ o(
|
|
1944
|
-
|
|
1944
|
+
he.Item,
|
|
1945
1945
|
{
|
|
1946
1946
|
isLoading: s.quoteStatus === "pending",
|
|
1947
1947
|
label: t("quote.result.processingTime.label", "Processing time"),
|
|
@@ -1950,28 +1950,28 @@ const $r = ({ className: e }) => {
|
|
|
1950
1950
|
)
|
|
1951
1951
|
] })
|
|
1952
1952
|
}
|
|
1953
|
-
) : /* @__PURE__ */ o(
|
|
1954
|
-
},
|
|
1955
|
-
Skeleton:
|
|
1956
|
-
}),
|
|
1953
|
+
) : /* @__PURE__ */ o(bt, {});
|
|
1954
|
+
}, pl = Object.assign(Kr, {
|
|
1955
|
+
Skeleton: bt
|
|
1956
|
+
}), Hr = ({
|
|
1957
1957
|
token: e,
|
|
1958
1958
|
balance: t,
|
|
1959
1959
|
isNotSufficient: r = !1,
|
|
1960
1960
|
onClick: s
|
|
1961
1961
|
}) => {
|
|
1962
1962
|
const n = b();
|
|
1963
|
-
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(
|
|
1963
|
+
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(gs, { width: 100 }) : /* @__PURE__ */ o(
|
|
1964
1964
|
"span",
|
|
1965
1965
|
{
|
|
1966
1966
|
onClick: t ? s : void 0,
|
|
1967
1967
|
style: t ? { borderBottomWidth: "2px", borderStyle: "dotted" } : void 0,
|
|
1968
|
-
className:
|
|
1968
|
+
className: hs("text-sw-label-sm", {
|
|
1969
1969
|
"text-sw-status-error": r,
|
|
1970
1970
|
"text-sw-gray-100": !r,
|
|
1971
1971
|
"cursor-pointer": !!t && !!s
|
|
1972
1972
|
}),
|
|
1973
1973
|
children: /* @__PURE__ */ o(
|
|
1974
|
-
|
|
1974
|
+
Be,
|
|
1975
1975
|
{
|
|
1976
1976
|
decimals: e.decimals,
|
|
1977
1977
|
value: t === void 0 ? "0" : `${t}`
|
|
@@ -1979,7 +1979,7 @@ const $r = ({ className: e }) => {
|
|
|
1979
1979
|
)
|
|
1980
1980
|
}
|
|
1981
1981
|
);
|
|
1982
|
-
},
|
|
1982
|
+
}, Pe = ({
|
|
1983
1983
|
token: e,
|
|
1984
1984
|
balance: t,
|
|
1985
1985
|
value: r = "",
|
|
@@ -1991,14 +1991,14 @@ const $r = ({ className: e }) => {
|
|
|
1991
1991
|
heading: d,
|
|
1992
1992
|
onMsg: u
|
|
1993
1993
|
}) => {
|
|
1994
|
-
const i =
|
|
1994
|
+
const i = Yt(), { ctx: f } = _(), { t: p } = $(), { hideTokenInputHeadings: I } = b(), m = ws(e, r, n), w = (k) => {
|
|
1995
1995
|
u({
|
|
1996
1996
|
type: "on_change_amount",
|
|
1997
|
-
amount:
|
|
1997
|
+
amount: Is(t, e.decimals, k)
|
|
1998
1998
|
});
|
|
1999
1999
|
};
|
|
2000
|
-
return /* @__PURE__ */ h(
|
|
2001
|
-
!I && /* @__PURE__ */ o(
|
|
2000
|
+
return /* @__PURE__ */ h(fe, { className: "flex flex-col", "aria-label": d, children: [
|
|
2001
|
+
!I && /* @__PURE__ */ o(Et, { children: d }),
|
|
2002
2002
|
/* @__PURE__ */ h(
|
|
2003
2003
|
"div",
|
|
2004
2004
|
{
|
|
@@ -2008,11 +2008,11 @@ const $r = ({ className: e }) => {
|
|
|
2008
2008
|
),
|
|
2009
2009
|
children: [
|
|
2010
2010
|
/* @__PURE__ */ o(
|
|
2011
|
-
|
|
2011
|
+
As,
|
|
2012
2012
|
{
|
|
2013
2013
|
value: r,
|
|
2014
2014
|
name: i,
|
|
2015
|
-
setValue:
|
|
2015
|
+
setValue: ks,
|
|
2016
2016
|
placeholder: "0",
|
|
2017
2017
|
state: a === "default" || a === "disabled" ? a : "error",
|
|
2018
2018
|
onChange: (k) => {
|
|
@@ -2034,7 +2034,7 @@ const $r = ({ className: e }) => {
|
|
|
2034
2034
|
),
|
|
2035
2035
|
children: [
|
|
2036
2036
|
/* @__PURE__ */ o(
|
|
2037
|
-
|
|
2037
|
+
Rt,
|
|
2038
2038
|
{
|
|
2039
2039
|
token: e,
|
|
2040
2040
|
chainShowIcon: !e.isIntent,
|
|
@@ -2066,7 +2066,7 @@ const $r = ({ className: e }) => {
|
|
|
2066
2066
|
] }),
|
|
2067
2067
|
/* @__PURE__ */ h("div", { className: "gap-sw-sm flex items-center", children: [
|
|
2068
2068
|
e && !!f.walletAddress && c && /* @__PURE__ */ o(
|
|
2069
|
-
|
|
2069
|
+
Hr,
|
|
2070
2070
|
{
|
|
2071
2071
|
token: e,
|
|
2072
2072
|
balance: t,
|
|
@@ -2074,9 +2074,9 @@ const $r = ({ className: e }) => {
|
|
|
2074
2074
|
onClick: () => w(1)
|
|
2075
2075
|
}
|
|
2076
2076
|
),
|
|
2077
|
-
!!t && c && l && /* @__PURE__ */ h(
|
|
2077
|
+
!!t && c && l && /* @__PURE__ */ h(Kt, { children: [
|
|
2078
2078
|
/* @__PURE__ */ o(
|
|
2079
|
-
|
|
2079
|
+
Je,
|
|
2080
2080
|
{
|
|
2081
2081
|
isClickable: a !== "disabled",
|
|
2082
2082
|
onClick: () => w(2),
|
|
@@ -2084,7 +2084,7 @@ const $r = ({ className: e }) => {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
),
|
|
2086
2086
|
/* @__PURE__ */ o(
|
|
2087
|
-
|
|
2087
|
+
Je,
|
|
2088
2088
|
{
|
|
2089
2089
|
isClickable: a !== "disabled",
|
|
2090
2090
|
onClick: () => w(1),
|
|
@@ -2096,16 +2096,16 @@ const $r = ({ className: e }) => {
|
|
|
2096
2096
|
] })
|
|
2097
2097
|
] })
|
|
2098
2098
|
] });
|
|
2099
|
-
},
|
|
2099
|
+
}, We = ({ onMsg: e, heading: t }) => {
|
|
2100
2100
|
const { hideTokenInputHeadings: r } = b();
|
|
2101
2101
|
return /* @__PURE__ */ h(
|
|
2102
|
-
|
|
2102
|
+
fe,
|
|
2103
2103
|
{
|
|
2104
2104
|
isClickable: !0,
|
|
2105
2105
|
className: "flex flex-col",
|
|
2106
2106
|
onClick: () => e({ type: "on_click_select_token" }),
|
|
2107
2107
|
children: [
|
|
2108
|
-
!r && /* @__PURE__ */ o(
|
|
2108
|
+
!r && /* @__PURE__ */ o(Et, { children: t }),
|
|
2109
2109
|
/* @__PURE__ */ h(
|
|
2110
2110
|
"div",
|
|
2111
2111
|
{
|
|
@@ -2138,8 +2138,8 @@ const $r = ({ className: e }) => {
|
|
|
2138
2138
|
]
|
|
2139
2139
|
}
|
|
2140
2140
|
);
|
|
2141
|
-
},
|
|
2142
|
-
const { mergedBalance: t } =
|
|
2141
|
+
}, Ut = (e) => {
|
|
2142
|
+
const { mergedBalance: t } = Te(), [r, s] = te(
|
|
2143
2143
|
e ? t[z(e)] : void 0
|
|
2144
2144
|
);
|
|
2145
2145
|
return R(() => {
|
|
@@ -2158,22 +2158,22 @@ const $r = ({ className: e }) => {
|
|
|
2158
2158
|
n && clearTimeout(n);
|
|
2159
2159
|
};
|
|
2160
2160
|
}, [e, t]), r;
|
|
2161
|
-
},
|
|
2162
|
-
const { tokens: r } =
|
|
2161
|
+
}, Pt = (e, t) => {
|
|
2162
|
+
const { tokens: r } = V(e), s = Array.from(
|
|
2163
2163
|
new Set(r.map((n) => n.assetId))
|
|
2164
2164
|
);
|
|
2165
2165
|
R(() => {
|
|
2166
2166
|
const n = s.length === 1 ? r[0] : null;
|
|
2167
2167
|
n && t({ type: "on_select_token", token: n });
|
|
2168
2168
|
}, [r]);
|
|
2169
|
-
},
|
|
2169
|
+
}, Gr = ({
|
|
2170
2170
|
onMsg: e,
|
|
2171
2171
|
isChanging: t = !0,
|
|
2172
2172
|
showBalance: r = !0,
|
|
2173
2173
|
heading: s
|
|
2174
2174
|
}) => {
|
|
2175
|
-
const { ctx: n } = _(), a =
|
|
2176
|
-
|
|
2175
|
+
const { ctx: n } = _(), a = Ut(n.sourceToken);
|
|
2176
|
+
Pt("source", e);
|
|
2177
2177
|
const c = L(() => {
|
|
2178
2178
|
if (!t && n.quoteStatus === "pending")
|
|
2179
2179
|
return "disabled";
|
|
@@ -2185,7 +2185,7 @@ const $r = ({ className: e }) => {
|
|
|
2185
2185
|
return "error-balance";
|
|
2186
2186
|
}, [t, n.error, n.quoteStatus]);
|
|
2187
2187
|
return n.sourceToken ? /* @__PURE__ */ o(
|
|
2188
|
-
|
|
2188
|
+
Pe,
|
|
2189
2189
|
{
|
|
2190
2190
|
heading: s,
|
|
2191
2191
|
token: n.sourceToken,
|
|
@@ -2196,17 +2196,17 @@ const $r = ({ className: e }) => {
|
|
|
2196
2196
|
value: Y(n.sourceTokenAmount, n.sourceToken?.decimals),
|
|
2197
2197
|
onMsg: e
|
|
2198
2198
|
}
|
|
2199
|
-
) : /* @__PURE__ */ o(
|
|
2200
|
-
},
|
|
2199
|
+
) : /* @__PURE__ */ o(We, { heading: s, onMsg: e });
|
|
2200
|
+
}, jr = ({
|
|
2201
2201
|
isChanging: e = !1,
|
|
2202
2202
|
onMsg: t,
|
|
2203
2203
|
heading: r
|
|
2204
2204
|
}) => {
|
|
2205
|
-
const { ctx: s } = _(), { usdTradeDelta: n } = Z(), a =
|
|
2206
|
-
|
|
2205
|
+
const { ctx: s } = _(), { usdTradeDelta: n } = Z(), a = Ut(s.targetToken);
|
|
2206
|
+
Pt("target", t);
|
|
2207
2207
|
const c = L(() => !e && s.quoteStatus === "pending" ? "disabled" : "default", [e, s.quoteStatus]);
|
|
2208
2208
|
return s.targetToken ? /* @__PURE__ */ o(
|
|
2209
|
-
|
|
2209
|
+
Pe,
|
|
2210
2210
|
{
|
|
2211
2211
|
heading: r,
|
|
2212
2212
|
token: s.targetToken,
|
|
@@ -2219,12 +2219,12 @@ const $r = ({ className: e }) => {
|
|
|
2219
2219
|
showBalance: !0,
|
|
2220
2220
|
onMsg: t
|
|
2221
2221
|
}
|
|
2222
|
-
) : /* @__PURE__ */ o(
|
|
2223
|
-
},
|
|
2224
|
-
Skeleton:
|
|
2225
|
-
Source:
|
|
2226
|
-
Target:
|
|
2227
|
-
}),
|
|
2222
|
+
) : /* @__PURE__ */ o(We, { heading: r, onMsg: t });
|
|
2223
|
+
}, zr = ({ token: e, heading: t, ...r }) => e ? /* @__PURE__ */ o(Pe, { ...r, token: e, heading: t }) : /* @__PURE__ */ o(We, { onMsg: r.onMsg, heading: t }), Tl = Object.assign(zr, {
|
|
2224
|
+
Skeleton: Ss,
|
|
2225
|
+
Source: Gr,
|
|
2226
|
+
Target: jr
|
|
2227
|
+
}), Wt = ({
|
|
2228
2228
|
token: e,
|
|
2229
2229
|
balance: t,
|
|
2230
2230
|
showBalance: r = !0,
|
|
@@ -2233,7 +2233,7 @@ const $r = ({ className: e }) => {
|
|
|
2233
2233
|
className: a,
|
|
2234
2234
|
onMsg: c
|
|
2235
2235
|
}) => {
|
|
2236
|
-
const { ctx: l } = _(), { walletSupportedChains: d, appName: u } = b(), i =
|
|
2236
|
+
const { ctx: l } = _(), { walletSupportedChains: d, appName: u } = b(), i = Ns(t, e), f = d.includes(e.blockchain) || e.isIntent, p = t !== "0" && t !== 0 && t !== void 0;
|
|
2237
2237
|
return /* @__PURE__ */ o("li", { className: "list-none group", children: /* @__PURE__ */ h(
|
|
2238
2238
|
"div",
|
|
2239
2239
|
{
|
|
@@ -2249,7 +2249,7 @@ const $r = ({ className: e }) => {
|
|
|
2249
2249
|
onClick: () => !s && c({ type: "on_select_token", token: e }),
|
|
2250
2250
|
children: [
|
|
2251
2251
|
/* @__PURE__ */ o(
|
|
2252
|
-
|
|
2252
|
+
Rt,
|
|
2253
2253
|
{
|
|
2254
2254
|
token: e,
|
|
2255
2255
|
chainShowIcon: !e.isIntent,
|
|
@@ -2273,7 +2273,7 @@ const $r = ({ className: e }) => {
|
|
|
2273
2273
|
] }),
|
|
2274
2274
|
f && !!l.walletAddress && r && /* @__PURE__ */ h("div", { className: "gap-sw-xs flex flex-col items-end", children: [
|
|
2275
2275
|
t === void 0 && !e.isIntent ? /* @__PURE__ */ o("span", { className: "h-[16px] w-[60px] animate-pulse rounded-full bg-sw-gray-700" }) : /* @__PURE__ */ o("span", { className: "h-[16px] text-sw-label-md text-sw-gray-50", children: p && /* @__PURE__ */ o(
|
|
2276
|
-
|
|
2276
|
+
Be,
|
|
2277
2277
|
{
|
|
2278
2278
|
decimals: e.decimals,
|
|
2279
2279
|
value: t === void 0 ? "0" : `${t}`
|
|
@@ -2284,7 +2284,7 @@ const $r = ({ className: e }) => {
|
|
|
2284
2284
|
]
|
|
2285
2285
|
}
|
|
2286
2286
|
) });
|
|
2287
|
-
},
|
|
2287
|
+
}, ot = [
|
|
2288
2288
|
"nep141:eth-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near",
|
|
2289
2289
|
// cbBTC (eth)
|
|
2290
2290
|
"nep141:base-0xcbb7c0000ab88b473b1f5afd9ef808440eed33bf.omft.near",
|
|
@@ -2297,30 +2297,30 @@ const $r = ({ className: e }) => {
|
|
|
2297
2297
|
// NEAR (bsc)
|
|
2298
2298
|
"nep141:eth-0xe0f63a424a4439cbe457d80e4f4b51ad25b2c56c.omft.near"
|
|
2299
2299
|
// SPX (eth)
|
|
2300
|
-
],
|
|
2301
|
-
const { tokens: e } =
|
|
2300
|
+
], Yr = () => {
|
|
2301
|
+
const { tokens: e } = V();
|
|
2302
2302
|
return {
|
|
2303
2303
|
uniqueIntentsTokens: L(() => {
|
|
2304
2304
|
const t = e.filter(
|
|
2305
|
-
(n) => n.isIntent && n.blockchain === "near" && !
|
|
2306
|
-
), r = t.map((n) => n.isIntent && n.symbol), s = e.filter((n) => n.isIntent && n.blockchain !== "near" && !r.includes(n.symbol) && !
|
|
2305
|
+
(n) => n.isIntent && n.blockchain === "near" && !ot.includes(n.assetId)
|
|
2306
|
+
), r = t.map((n) => n.isIntent && n.symbol), s = e.filter((n) => n.isIntent && n.blockchain !== "near" && !r.includes(n.symbol) && !ot.includes(n.assetId));
|
|
2307
2307
|
return [...t, ...s];
|
|
2308
2308
|
}, [e])
|
|
2309
2309
|
};
|
|
2310
|
-
},
|
|
2310
|
+
}, Xr = ({
|
|
2311
2311
|
variant: e,
|
|
2312
2312
|
search: t,
|
|
2313
2313
|
selectedChain: r,
|
|
2314
2314
|
chainsFilter: s,
|
|
2315
2315
|
walletSupportedChains: n
|
|
2316
2316
|
}) => {
|
|
2317
|
-
|
|
2318
|
-
const { tokens: a } =
|
|
2317
|
+
dr(e);
|
|
2318
|
+
const { tokens: a } = V(e), { mergedBalance: c } = Te(), { intentBalances: l } = pe(), { uniqueIntentsTokens: d } = Yr(), u = Bs(
|
|
2319
2319
|
c,
|
|
2320
2320
|
n,
|
|
2321
2321
|
t
|
|
2322
|
-
), i = a.filter(
|
|
2323
|
-
|
|
2322
|
+
), i = a.filter(qs({ search: t })).filter(
|
|
2323
|
+
Us({
|
|
2324
2324
|
selectedChain: r,
|
|
2325
2325
|
chainsFilter: s,
|
|
2326
2326
|
walletSupportedChains: n,
|
|
@@ -2330,10 +2330,10 @@ const $r = ({ className: e }) => {
|
|
|
2330
2330
|
);
|
|
2331
2331
|
return {
|
|
2332
2332
|
all: i.sort(u),
|
|
2333
|
-
intents: i.filter(
|
|
2334
|
-
wallet: i.filter(
|
|
2333
|
+
intents: i.filter(et({ isIntent: !0 })).sort(u),
|
|
2334
|
+
wallet: i.filter(et({ isIntent: !1 })).sort(u)
|
|
2335
2335
|
};
|
|
2336
|
-
},
|
|
2336
|
+
}, Zr = ({
|
|
2337
2337
|
variant: e,
|
|
2338
2338
|
search: t,
|
|
2339
2339
|
className: r,
|
|
@@ -2344,13 +2344,13 @@ const $r = ({ className: e }) => {
|
|
|
2344
2344
|
chainIsNotSupported: l,
|
|
2345
2345
|
onMsg: d
|
|
2346
2346
|
}) => {
|
|
2347
|
-
const { t: u } = $(), { ctx: i } = _(), { walletSupportedChains: f, appName: p } = b(), { mergedBalance: I } =
|
|
2347
|
+
const { t: u } = $(), { ctx: i } = _(), { walletSupportedChains: f, appName: p } = b(), { mergedBalance: I } = Te(), m = Xr({
|
|
2348
2348
|
variant: e,
|
|
2349
2349
|
search: t,
|
|
2350
2350
|
chainsFilter: a,
|
|
2351
2351
|
selectedChain: c,
|
|
2352
2352
|
walletSupportedChains: f
|
|
2353
|
-
}), w = i.walletAddress ? s : !1, k =
|
|
2353
|
+
}), w = i.walletAddress ? s : !1, k = Fs(m.all, t), y = X(null), [q, D] = te(-1), B = L(
|
|
2354
2354
|
() => [{ tokens: m.all }],
|
|
2355
2355
|
[m.all]
|
|
2356
2356
|
), S = L(() => [
|
|
@@ -2365,10 +2365,10 @@ const $r = ({ className: e }) => {
|
|
|
2365
2365
|
},
|
|
2366
2366
|
{ tokens: m.wallet }
|
|
2367
2367
|
] : []
|
|
2368
|
-
].filter(Boolean), [m.wallet, m.intents, l]), O = w ? S : B, re =
|
|
2368
|
+
].filter(Boolean), [m.wallet, m.intents, l]), O = w ? S : B, re = Os(O), ae = vs(O), Me = Cs(O), Mt = le(() => {
|
|
2369
2369
|
D(-1);
|
|
2370
2370
|
}, []);
|
|
2371
|
-
switch (
|
|
2371
|
+
switch (ys({
|
|
2372
2372
|
listRef: y.current,
|
|
2373
2373
|
initialFocusedIndex: w ? 1 : 0,
|
|
2374
2374
|
onFocus: (P) => D(P),
|
|
@@ -2376,7 +2376,7 @@ const $r = ({ className: e }) => {
|
|
|
2376
2376
|
}), k) {
|
|
2377
2377
|
case "EMPTY_SEARCH":
|
|
2378
2378
|
return /* @__PURE__ */ o(
|
|
2379
|
-
|
|
2379
|
+
be,
|
|
2380
2380
|
{
|
|
2381
2381
|
hasAction: !0,
|
|
2382
2382
|
actionType: "outlined",
|
|
@@ -2392,17 +2392,17 @@ const $r = ({ className: e }) => {
|
|
|
2392
2392
|
);
|
|
2393
2393
|
case "HAS_TOKENS":
|
|
2394
2394
|
return /* @__PURE__ */ o("div", { className: K("gap-sw-lg flex flex-col", r), children: /* @__PURE__ */ o(
|
|
2395
|
-
|
|
2395
|
+
_s,
|
|
2396
2396
|
{
|
|
2397
2397
|
ref: y,
|
|
2398
2398
|
tabIndex: 0,
|
|
2399
|
-
id:
|
|
2400
|
-
itemSize:
|
|
2399
|
+
id: Rs,
|
|
2400
|
+
itemSize: Es,
|
|
2401
2401
|
className: "hide-scrollbar",
|
|
2402
2402
|
style: {
|
|
2403
2403
|
minHeight: 200,
|
|
2404
2404
|
height: re,
|
|
2405
|
-
maxHeight:
|
|
2405
|
+
maxHeight: bs,
|
|
2406
2406
|
overflowAnchor: "none",
|
|
2407
2407
|
outline: "none"
|
|
2408
2408
|
},
|
|
@@ -2429,41 +2429,41 @@ const $r = ({ className: e }) => {
|
|
|
2429
2429
|
}
|
|
2430
2430
|
case "Enter": {
|
|
2431
2431
|
P.preventDefault();
|
|
2432
|
-
const C =
|
|
2432
|
+
const C = xs(O, q);
|
|
2433
2433
|
C && d({ type: "on_select_token", token: C });
|
|
2434
2434
|
break;
|
|
2435
2435
|
}
|
|
2436
2436
|
}
|
|
2437
2437
|
},
|
|
2438
2438
|
children: O.map(
|
|
2439
|
-
({ label: P, count: C, tokens:
|
|
2440
|
-
const
|
|
2439
|
+
({ label: P, count: C, tokens: Qe }, $e) => {
|
|
2440
|
+
const Qt = Ds(
|
|
2441
2441
|
O,
|
|
2442
|
-
|
|
2442
|
+
$e
|
|
2443
2443
|
);
|
|
2444
2444
|
return P !== void 0 ? P ? /* @__PURE__ */ h(
|
|
2445
2445
|
"header",
|
|
2446
2446
|
{
|
|
2447
2447
|
className: "pb-sw-lg pt-sw-sm flex flex-col",
|
|
2448
2448
|
children: [
|
|
2449
|
-
/* @__PURE__ */ o(
|
|
2449
|
+
/* @__PURE__ */ o(Ls, {}),
|
|
2450
2450
|
/* @__PURE__ */ o("span", { className: "text-sw-label-sm pt-sw-xl text-sw-gray-100", children: `${P} — ${C}` })
|
|
2451
2451
|
]
|
|
2452
2452
|
},
|
|
2453
2453
|
P
|
|
2454
|
-
) : /* @__PURE__ */ o("header", {},
|
|
2455
|
-
const
|
|
2454
|
+
) : /* @__PURE__ */ o("header", {}, $e) : Qe ? Qe.map((Ke, $t) => {
|
|
2455
|
+
const He = z(Ke);
|
|
2456
2456
|
return /* @__PURE__ */ o(
|
|
2457
|
-
|
|
2457
|
+
Wt,
|
|
2458
2458
|
{
|
|
2459
|
-
token:
|
|
2459
|
+
token: Ke,
|
|
2460
2460
|
showBalance: n,
|
|
2461
|
-
balance: I[
|
|
2462
|
-
isFocused: q ===
|
|
2461
|
+
balance: I[He],
|
|
2462
|
+
isFocused: q === Qt + $t,
|
|
2463
2463
|
isNotSelectable: l && !!i.walletAddress,
|
|
2464
2464
|
onMsg: d
|
|
2465
2465
|
},
|
|
2466
|
-
|
|
2466
|
+
He
|
|
2467
2467
|
);
|
|
2468
2468
|
}) : null;
|
|
2469
2469
|
}
|
|
@@ -2473,7 +2473,7 @@ const $r = ({ className: e }) => {
|
|
|
2473
2473
|
case "NO_TOKENS":
|
|
2474
2474
|
default:
|
|
2475
2475
|
return /* @__PURE__ */ o(
|
|
2476
|
-
|
|
2476
|
+
be,
|
|
2477
2477
|
{
|
|
2478
2478
|
className: "pt-sw-5xl pb-sw-5xl",
|
|
2479
2479
|
subHeading: u(
|
|
@@ -2487,10 +2487,10 @@ const $r = ({ className: e }) => {
|
|
|
2487
2487
|
}
|
|
2488
2488
|
);
|
|
2489
2489
|
}
|
|
2490
|
-
},
|
|
2491
|
-
Placeholder:
|
|
2492
|
-
Item:
|
|
2493
|
-
}),
|
|
2490
|
+
}, hl = Object.assign(Zr, {
|
|
2491
|
+
Placeholder: be,
|
|
2492
|
+
Item: Wt
|
|
2493
|
+
}), Jr = (e, t) => {
|
|
2494
2494
|
const r = t.assetId.substring(t.assetId.indexOf(":") + 1), s = (a) => {
|
|
2495
2495
|
const c = (u) => u.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, ""), l = c(t.amount), d = c(
|
|
2496
2496
|
a.amount.toLocaleString("en-US", {
|
|
@@ -2503,12 +2503,12 @@ const $r = ({ className: e }) => {
|
|
|
2503
2503
|
return (e.result.deposits || []).find(
|
|
2504
2504
|
(a) => a.chain === t.chainId && a.account_id === t.intentsAccountId && a.address === t.depositAddress && a.near_token_id === r && n(a) && s(a)
|
|
2505
2505
|
);
|
|
2506
|
-
},
|
|
2506
|
+
}, ea = {
|
|
2507
2507
|
CREDITED: ee.status.PROCESSING,
|
|
2508
2508
|
PENDING: ee.status.PROCESSING,
|
|
2509
2509
|
COMPLETED: ee.status.SUCCESS,
|
|
2510
2510
|
FAILED: ee.status.FAILED
|
|
2511
|
-
},
|
|
2511
|
+
}, gl = ({ depositAddress: e }) => {
|
|
2512
2512
|
const { ctx: t } = _(), { intentsAccountType: r } = b(), [s, n] = te(null), a = ne({
|
|
2513
2513
|
addressType: r,
|
|
2514
2514
|
walletAddress: t.walletAddress
|
|
@@ -2519,18 +2519,18 @@ const $r = ({ className: e }) => {
|
|
|
2519
2519
|
assetId: u
|
|
2520
2520
|
}) => {
|
|
2521
2521
|
if (!a)
|
|
2522
|
-
throw new
|
|
2523
|
-
let i =
|
|
2522
|
+
throw new M("Unknown intents account for POA deposit check");
|
|
2523
|
+
let i = Tt[l];
|
|
2524
2524
|
if (!i)
|
|
2525
2525
|
if (H(l))
|
|
2526
|
-
i =
|
|
2526
|
+
i = ht;
|
|
2527
2527
|
else
|
|
2528
|
-
throw new
|
|
2528
|
+
throw new M(
|
|
2529
2529
|
`Unknown chain for POA deposit check ${l}`
|
|
2530
2530
|
);
|
|
2531
2531
|
const f = s ?? (/* @__PURE__ */ new Date()).toUTCString();
|
|
2532
2532
|
s || n(f);
|
|
2533
|
-
const p = await
|
|
2533
|
+
const p = await kt.post("", {
|
|
2534
2534
|
id: 1,
|
|
2535
2535
|
jsonrpc: "2.0",
|
|
2536
2536
|
method: "recent_deposits",
|
|
@@ -2540,7 +2540,7 @@ const $r = ({ className: e }) => {
|
|
|
2540
2540
|
chain: i
|
|
2541
2541
|
}
|
|
2542
2542
|
]
|
|
2543
|
-
}), I =
|
|
2543
|
+
}), I = Jr(p.data, {
|
|
2544
2544
|
intentsAccountId: a,
|
|
2545
2545
|
initiatedAtDate: f,
|
|
2546
2546
|
depositAddress: e,
|
|
@@ -2549,7 +2549,7 @@ const $r = ({ className: e }) => {
|
|
|
2549
2549
|
amount: d
|
|
2550
2550
|
});
|
|
2551
2551
|
return I ? {
|
|
2552
|
-
status:
|
|
2552
|
+
status: ea[I.status],
|
|
2553
2553
|
swapDetails: {
|
|
2554
2554
|
intentHashes: [""],
|
|
2555
2555
|
destinationChainTxHashes: [{ hash: I.tx_hash ?? "" }]
|
|
@@ -2562,32 +2562,41 @@ const $r = ({ className: e }) => {
|
|
|
2562
2562
|
}
|
|
2563
2563
|
};
|
|
2564
2564
|
} };
|
|
2565
|
-
},
|
|
2565
|
+
}, ie = (e, t, r) => {
|
|
2566
2566
|
let s = document.body;
|
|
2567
|
-
r instanceof HTMLElement && (s = r),
|
|
2568
|
-
|
|
2567
|
+
r instanceof HTMLElement && (s = r), s.style.setProperty(`--c-sw-${e}`, t);
|
|
2568
|
+
}, ta = (e, t, r) => {
|
|
2569
|
+
Object.entries(e).forEach(([s, n]) => {
|
|
2570
|
+
ie(`${t}-${s}`, n, r);
|
|
2569
2571
|
});
|
|
2570
|
-
},
|
|
2571
|
-
const a =
|
|
2572
|
-
a &&
|
|
2573
|
-
},
|
|
2574
|
-
const {
|
|
2575
|
-
|
|
2576
|
-
|
|
2572
|
+
}, it = (e, t, r, s, n) => {
|
|
2573
|
+
const a = Ps(s, n, t);
|
|
2574
|
+
a && ta(a, e, r);
|
|
2575
|
+
}, na = (e, t) => {
|
|
2576
|
+
const {
|
|
2577
|
+
primaryColor: r,
|
|
2578
|
+
surfaceColor: s,
|
|
2579
|
+
successColor: n,
|
|
2580
|
+
warningColor: a,
|
|
2581
|
+
errorColor: c,
|
|
2582
|
+
colorScheme: l = "dark"
|
|
2583
|
+
} = t;
|
|
2584
|
+
r && it("accent", 500, e, r, l), s && it("gray", 950, e, s, l), n && ie("status-success", n, e), a && ie("status-warning", a, e), c && ie("status-error", c, e);
|
|
2585
|
+
}, sa = ut(void 0), ra = ({ children: e, theme: t }) => {
|
|
2577
2586
|
const { themeParentElementSelector: r } = b(), s = L(() => t, [t]);
|
|
2578
2587
|
return R(() => {
|
|
2579
2588
|
if (t) {
|
|
2580
2589
|
const n = r ? document.querySelector(r) : null;
|
|
2581
|
-
|
|
2590
|
+
na(n, t);
|
|
2582
2591
|
}
|
|
2583
|
-
}, [t]), /* @__PURE__ */ o(
|
|
2584
|
-
},
|
|
2592
|
+
}, [t]), /* @__PURE__ */ o(sa.Provider, { value: s, children: /* @__PURE__ */ o("div", { className: "sw", children: e }) });
|
|
2593
|
+
}, we = ({
|
|
2585
2594
|
text: e,
|
|
2586
2595
|
icon: t
|
|
2587
2596
|
}) => /* @__PURE__ */ h("li", { className: "flex items-center gap-sw-md", children: [
|
|
2588
2597
|
t && /* @__PURE__ */ o(t, { size: 20, className: "text-sw-gray-300" }),
|
|
2589
2598
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-50", children: e })
|
|
2590
|
-
] }),
|
|
2599
|
+
] }), lt = ({
|
|
2591
2600
|
label: e,
|
|
2592
2601
|
icon: t,
|
|
2593
2602
|
className: r
|
|
@@ -2603,10 +2612,10 @@ const $r = ({ className: e }) => {
|
|
|
2603
2612
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md", children: e })
|
|
2604
2613
|
]
|
|
2605
2614
|
}
|
|
2606
|
-
),
|
|
2615
|
+
), aa = ({ isSigned: e, isSigning: t, onMsg: r }) => {
|
|
2607
2616
|
const { t: s } = $(), n = () => r({ type: "on_close" });
|
|
2608
|
-
|
|
2609
|
-
const a =
|
|
2617
|
+
Ct("Escape", n);
|
|
2618
|
+
const a = Hs({
|
|
2610
2619
|
endTime: 0,
|
|
2611
2620
|
autostart: !1,
|
|
2612
2621
|
timerType: "DECREMENTAL",
|
|
@@ -2615,15 +2624,15 @@ const $r = ({ className: e }) => {
|
|
|
2615
2624
|
});
|
|
2616
2625
|
return R(() => {
|
|
2617
2626
|
e ? a.start() : a.reset();
|
|
2618
|
-
}, [e]), /* @__PURE__ */ h(
|
|
2627
|
+
}, [e]), /* @__PURE__ */ h(fe, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2619
2628
|
/* @__PURE__ */ o(
|
|
2620
|
-
|
|
2629
|
+
Dt,
|
|
2621
2630
|
{
|
|
2622
2631
|
onClick: n,
|
|
2623
2632
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2624
2633
|
}
|
|
2625
2634
|
),
|
|
2626
|
-
/* @__PURE__ */ o(
|
|
2635
|
+
/* @__PURE__ */ o(Ws, { size: 48, className: "text-sw-status-warning" }),
|
|
2627
2636
|
/* @__PURE__ */ h("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2628
2637
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: s(
|
|
2629
2638
|
"walletCompatibility.modal.title.initial",
|
|
@@ -2636,17 +2645,17 @@ const $r = ({ className: e }) => {
|
|
|
2636
2645
|
] }),
|
|
2637
2646
|
/* @__PURE__ */ h("ul", { className: "flex flex-col gap-sw-xl", children: [
|
|
2638
2647
|
/* @__PURE__ */ o(
|
|
2639
|
-
|
|
2648
|
+
we,
|
|
2640
2649
|
{
|
|
2641
2650
|
text: s(
|
|
2642
2651
|
"walletCompatibility.modal.feature.secureTransactions",
|
|
2643
2652
|
"Read-only signature – no gas required."
|
|
2644
2653
|
),
|
|
2645
|
-
icon:
|
|
2654
|
+
icon: Vs
|
|
2646
2655
|
}
|
|
2647
2656
|
),
|
|
2648
2657
|
/* @__PURE__ */ o(
|
|
2649
|
-
|
|
2658
|
+
we,
|
|
2650
2659
|
{
|
|
2651
2660
|
text: s(
|
|
2652
2661
|
"walletCompatibility.modal.feature.fullAccess",
|
|
@@ -2656,30 +2665,30 @@ const $r = ({ className: e }) => {
|
|
|
2656
2665
|
}
|
|
2657
2666
|
),
|
|
2658
2667
|
/* @__PURE__ */ o(
|
|
2659
|
-
|
|
2668
|
+
we,
|
|
2660
2669
|
{
|
|
2661
2670
|
text: s(
|
|
2662
2671
|
"walletCompatibility.modal.feature.fundProtection",
|
|
2663
2672
|
"Only checks whether your wallet is supported."
|
|
2664
2673
|
),
|
|
2665
|
-
icon:
|
|
2674
|
+
icon: Qs
|
|
2666
2675
|
}
|
|
2667
2676
|
)
|
|
2668
2677
|
] }),
|
|
2669
2678
|
e ? /* @__PURE__ */ h("div", { className: "flex flex-col gap-sw-xl mt-sw-lg w-full", children: [
|
|
2670
2679
|
/* @__PURE__ */ o(
|
|
2671
|
-
|
|
2680
|
+
lt,
|
|
2672
2681
|
{
|
|
2673
2682
|
label: s(
|
|
2674
2683
|
"walletCompatibility.modal.button.verified",
|
|
2675
2684
|
"Wallet verified"
|
|
2676
2685
|
),
|
|
2677
2686
|
className: "bg-sw-status-success text-sw-gray-950",
|
|
2678
|
-
icon:
|
|
2687
|
+
icon: $s
|
|
2679
2688
|
}
|
|
2680
2689
|
),
|
|
2681
2690
|
a.status === "RUNNING" && /* @__PURE__ */ o(
|
|
2682
|
-
|
|
2691
|
+
lt,
|
|
2683
2692
|
{
|
|
2684
2693
|
className: "text-sw-gray-400",
|
|
2685
2694
|
label: s("walletCompatibility.modal.button.closeTimer", {
|
|
@@ -2713,17 +2722,17 @@ const $r = ({ className: e }) => {
|
|
|
2713
2722
|
)
|
|
2714
2723
|
] })
|
|
2715
2724
|
] });
|
|
2716
|
-
},
|
|
2725
|
+
}, oa = ({ onMsg: e }) => {
|
|
2717
2726
|
const { t } = $(), r = () => e({ type: "on_close" });
|
|
2718
|
-
return
|
|
2727
|
+
return Ct("Escape", r), /* @__PURE__ */ h(fe, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2719
2728
|
/* @__PURE__ */ o(
|
|
2720
|
-
|
|
2729
|
+
Dt,
|
|
2721
2730
|
{
|
|
2722
2731
|
onClick: r,
|
|
2723
2732
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2724
2733
|
}
|
|
2725
2734
|
),
|
|
2726
|
-
/* @__PURE__ */ o(
|
|
2735
|
+
/* @__PURE__ */ o(Ks, { size: 48, className: "text-sw-status-error" }),
|
|
2727
2736
|
/* @__PURE__ */ h("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2728
2737
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: t(
|
|
2729
2738
|
"walletCompatibility.modal.title.error",
|
|
@@ -2759,58 +2768,58 @@ const $r = ({ className: e }) => {
|
|
|
2759
2768
|
)
|
|
2760
2769
|
] })
|
|
2761
2770
|
] });
|
|
2762
|
-
},
|
|
2763
|
-
Error:
|
|
2764
|
-
}),
|
|
2765
|
-
if (t instanceof
|
|
2771
|
+
}, Il = Object.assign(aa, {
|
|
2772
|
+
Error: oa
|
|
2773
|
+
}), ia = (e) => null, la = (e) => (t) => {
|
|
2774
|
+
if (t instanceof M)
|
|
2766
2775
|
throw t;
|
|
2767
|
-
const r = new
|
|
2776
|
+
const r = new M(
|
|
2768
2777
|
t instanceof Error ? t.message : "Unknown error",
|
|
2769
2778
|
{ cause: t }
|
|
2770
2779
|
);
|
|
2771
2780
|
throw r.context = e, r;
|
|
2772
|
-
},
|
|
2781
|
+
}, ca = ({ children: e }) => {
|
|
2773
2782
|
const { ctx: t } = _();
|
|
2774
2783
|
return /* @__PURE__ */ o(
|
|
2775
|
-
|
|
2784
|
+
zs,
|
|
2776
2785
|
{
|
|
2777
|
-
FallbackComponent:
|
|
2778
|
-
onError:
|
|
2786
|
+
FallbackComponent: ia,
|
|
2787
|
+
onError: la(t),
|
|
2779
2788
|
children: e
|
|
2780
2789
|
}
|
|
2781
2790
|
);
|
|
2782
|
-
},
|
|
2791
|
+
}, da = new en({
|
|
2783
2792
|
defaultOptions: {
|
|
2784
2793
|
queries: {
|
|
2785
2794
|
staleTime: 2e3 * 60,
|
|
2786
|
-
retry:
|
|
2795
|
+
retry: ct.env.NODE_ENV === "test" ? !1 : 3
|
|
2787
2796
|
}
|
|
2788
2797
|
}
|
|
2789
|
-
}),
|
|
2798
|
+
}), ua = ["fms", "abg", "stjack", "noear", "testnebula"], ue = {
|
|
2790
2799
|
appName: "Unknown",
|
|
2791
2800
|
slippageTolerance: 100,
|
|
2792
2801
|
// 1%
|
|
2793
2802
|
intentsAccountType: "evm",
|
|
2794
|
-
walletSupportedChains:
|
|
2803
|
+
walletSupportedChains: un,
|
|
2795
2804
|
connectedWallets: {},
|
|
2796
2805
|
enableAutoTokensSwitching: !0,
|
|
2797
2806
|
showIntentTokens: !0,
|
|
2798
|
-
chainsOrder:
|
|
2799
|
-
filterTokens: (e) => !
|
|
2807
|
+
chainsOrder: pt,
|
|
2808
|
+
filterTokens: (e) => !ua.includes(e.symbol.toLocaleLowerCase()),
|
|
2800
2809
|
chainsFilter: {
|
|
2801
2810
|
source: { external: "wallet-supported", intents: "none" },
|
|
2802
2811
|
target: { external: "all", intents: "none" }
|
|
2803
2812
|
}
|
|
2804
|
-
},
|
|
2805
|
-
config:
|
|
2806
|
-
}),
|
|
2807
|
-
config:
|
|
2813
|
+
}, Vt = ut({
|
|
2814
|
+
config: ue
|
|
2815
|
+
}), Ve = dt({
|
|
2816
|
+
config: ue
|
|
2808
2817
|
}), b = () => {
|
|
2809
|
-
const e =
|
|
2810
|
-
return
|
|
2811
|
-
},
|
|
2812
|
-
|
|
2813
|
-
},
|
|
2818
|
+
const e = Xt(Vt);
|
|
2819
|
+
return me(e).config;
|
|
2820
|
+
}, ma = (e) => {
|
|
2821
|
+
Ve.config = ke(e);
|
|
2822
|
+
}, wl = ({
|
|
2814
2823
|
children: e,
|
|
2815
2824
|
config: t,
|
|
2816
2825
|
balanceViaRpc: r = !0,
|
|
@@ -2820,108 +2829,108 @@ const $r = ({ className: e }) => {
|
|
|
2820
2829
|
theme: a
|
|
2821
2830
|
}) => {
|
|
2822
2831
|
const c = X(
|
|
2823
|
-
|
|
2824
|
-
config:
|
|
2825
|
-
...
|
|
2832
|
+
dt({
|
|
2833
|
+
config: ke({
|
|
2834
|
+
...ue,
|
|
2826
2835
|
...t
|
|
2827
2836
|
})
|
|
2828
2837
|
})
|
|
2829
2838
|
);
|
|
2830
2839
|
return R(() => {
|
|
2831
|
-
const l =
|
|
2832
|
-
...
|
|
2840
|
+
const l = ke({
|
|
2841
|
+
...ue,
|
|
2833
2842
|
...t
|
|
2834
2843
|
});
|
|
2835
|
-
Object.assign(c.current.config, l),
|
|
2836
|
-
}, [t]),
|
|
2837
|
-
/* @__PURE__ */ h(
|
|
2838
|
-
/* @__PURE__ */ h(
|
|
2844
|
+
Object.assign(c.current.config, l), ma(l);
|
|
2845
|
+
}, [t]), rn(s ?? {}), js("headlessui-portal-root", "sw"), /* @__PURE__ */ o(tn, { client: da, children: /* @__PURE__ */ o(sn, { i18n: Ht, children: /* @__PURE__ */ h(Vt.Provider, { value: c.current, children: [
|
|
2846
|
+
/* @__PURE__ */ h(Gt, { children: [
|
|
2847
|
+
/* @__PURE__ */ h(jt, { children: [
|
|
2839
2848
|
/* @__PURE__ */ o("link", { rel: "preconnect", href: "https://rsms.me/" }),
|
|
2840
2849
|
/* @__PURE__ */ o("link", { rel: "stylesheet", href: "https://rsms.me/inter/inter.css" })
|
|
2841
2850
|
] }),
|
|
2842
|
-
/* @__PURE__ */ o(
|
|
2851
|
+
/* @__PURE__ */ o(ra, { theme: a, children: ct.env.NODE_ENV === "test" ? e : /* @__PURE__ */ o(ca, { children: e }) })
|
|
2843
2852
|
] }),
|
|
2844
2853
|
r && /* @__PURE__ */ o(
|
|
2845
|
-
|
|
2854
|
+
lr,
|
|
2846
2855
|
{
|
|
2847
|
-
rpcs: n ??
|
|
2856
|
+
rpcs: n ?? Gs,
|
|
2848
2857
|
connectedWallets: t.connectedWallets ?? {}
|
|
2849
2858
|
}
|
|
2850
2859
|
)
|
|
2851
2860
|
] }) }) });
|
|
2852
2861
|
};
|
|
2853
2862
|
export {
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2863
|
+
Cr as $,
|
|
2864
|
+
gl as A,
|
|
2865
|
+
lr as B,
|
|
2866
|
+
sa as C,
|
|
2867
|
+
tr as D,
|
|
2868
|
+
tt as E,
|
|
2869
|
+
ur as F,
|
|
2870
|
+
mr as G,
|
|
2871
|
+
fr as H,
|
|
2872
|
+
pr as I,
|
|
2873
|
+
gr as J,
|
|
2874
|
+
Ot as K,
|
|
2875
|
+
Ft as L,
|
|
2876
|
+
qt as M,
|
|
2877
|
+
Lt as N,
|
|
2878
|
+
Bt as O,
|
|
2879
|
+
Ir as P,
|
|
2871
2880
|
U as Q,
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2888
|
-
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
2897
|
-
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2881
|
+
wr as R,
|
|
2882
|
+
$r as S,
|
|
2883
|
+
zr as T,
|
|
2884
|
+
kr as U,
|
|
2885
|
+
Ar as V,
|
|
2886
|
+
wl as W,
|
|
2887
|
+
Sr as X,
|
|
2888
|
+
Nr as Y,
|
|
2889
|
+
_r as Z,
|
|
2890
|
+
yr as _,
|
|
2891
|
+
fl as a,
|
|
2892
|
+
Dr as a0,
|
|
2893
|
+
xr as a1,
|
|
2894
|
+
Or as a2,
|
|
2895
|
+
Kr as a3,
|
|
2896
|
+
Hr as a4,
|
|
2897
|
+
Pe as a5,
|
|
2898
|
+
We as a6,
|
|
2899
|
+
Pt as a7,
|
|
2900
|
+
Gr as a8,
|
|
2901
|
+
jr as a9,
|
|
2902
|
+
Wt as aa,
|
|
2903
|
+
Yr as ab,
|
|
2904
|
+
Zr as ac,
|
|
2905
|
+
ra as ad,
|
|
2906
|
+
aa as ae,
|
|
2907
|
+
oa as af,
|
|
2908
|
+
ca as ag,
|
|
2909
|
+
Ve as ah,
|
|
2901
2910
|
_ as b,
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2911
|
+
ul as c,
|
|
2912
|
+
dr as d,
|
|
2913
|
+
or as e,
|
|
2914
|
+
pe as f,
|
|
2915
|
+
Br as g,
|
|
2916
|
+
hr as h,
|
|
2917
|
+
qr as i,
|
|
2918
|
+
vr as j,
|
|
2919
|
+
Te as k,
|
|
2920
|
+
Pr as l,
|
|
2921
|
+
Xr as m,
|
|
2922
|
+
V as n,
|
|
2923
|
+
pl as o,
|
|
2924
|
+
Tl as p,
|
|
2925
|
+
hl as q,
|
|
2926
|
+
br as r,
|
|
2927
|
+
Ut as s,
|
|
2928
|
+
xt as t,
|
|
2920
2929
|
Z as u,
|
|
2921
|
-
|
|
2930
|
+
M as v,
|
|
2922
2931
|
g as w,
|
|
2923
|
-
|
|
2932
|
+
ml as x,
|
|
2924
2933
|
b as y,
|
|
2925
|
-
|
|
2934
|
+
Il as z
|
|
2926
2935
|
};
|
|
2927
|
-
//# sourceMappingURL=config-
|
|
2936
|
+
//# sourceMappingURL=config-DJObWR7Z.js.map
|