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