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