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