@aurora-is-near/intents-swap-widget 3.14.0 → 3.14.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/{config-CeOg2QLU.js → config-r-k8Mo4x.js} +584 -569
- package/dist/config-r-k8Mo4x.js.map +1 -0
- package/dist/config.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +30 -37
- package/dist/features/ChainsDropdown/index.js.map +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +3 -2
- package/dist/hooks/useMakeIntentsTransfer.js.map +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/errors.d.ts +5 -0
- package/dist/machine/errors.js.map +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.d.ts +15 -0
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +1 -1
- package/src/features/ChainsDropdown/index.tsx +1 -5
- package/src/features/SubmitButton/index.tsx +4 -1
- package/src/features/TokensList/TokensList.tsx +1 -1
- package/src/hooks/useMakeIntentsTransfer.ts +22 -0
- package/src/machine/errors.ts +1 -0
- package/dist/config-CeOg2QLU.js.map +0 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { p as st } from "./index-xuotMAFm.js";
|
|
2
|
-
import { jsx as o, jsxs as
|
|
2
|
+
import { jsx as o, jsxs as h, Fragment as Lt } from "react/jsx-runtime";
|
|
3
3
|
import Bt from "i18next";
|
|
4
4
|
import { deepClone as pe } from "valtio/utils";
|
|
5
|
-
import { snapshot as
|
|
5
|
+
import { snapshot as Se, useSnapshot as oe, proxy as rt } from "valtio";
|
|
6
6
|
import { HelmetProvider as qt, Helmet as Ut } from "react-helmet-async";
|
|
7
|
-
import { memo as Pt, useEffect as
|
|
7
|
+
import { memo as Pt, useEffect as R, useMemo as v, useRef as Y, useCallback as Te, useState as re, useId as Wt, Fragment as Vt, createContext as at, useContext as Mt } from "react";
|
|
8
8
|
import { useQuery as _e, useInfiniteQuery as Qt, useQueryClient as $t, QueryClient as Kt, QueryClientProvider as Ht } from "@tanstack/react-query";
|
|
9
9
|
import { Trans as Gt, I18nextProvider as jt } from "react-i18next";
|
|
10
10
|
import { useTypedTranslation as M, initLocalisation as zt } from "./localisation.js";
|
|
@@ -17,7 +17,7 @@ import "framer-motion";
|
|
|
17
17
|
import "lucide-react";
|
|
18
18
|
import { cn as H } from "./utils/cn.js";
|
|
19
19
|
import { OneClickService as Xt, QuoteRequest as U, GetExecutionStatusResponse as ee } from "@defuse-protocol/one-click-sdk-typescript";
|
|
20
|
-
import { CHAINS_LIST as ye, DEFAULT_CHAIN_ICON as Jt, DEFAULT_CHAINS_ORDER as it, CHAIN_POA_MAP as ct, POA_EVM_CHAIN_ID as lt, CHAIN_BASE_TOKENS as en, EVM_CHAIN_IDS_MAP as
|
|
20
|
+
import { CHAINS_LIST as ye, DEFAULT_CHAIN_ICON as Jt, DEFAULT_CHAINS_ORDER as it, CHAIN_POA_MAP as ct, POA_EVM_CHAIN_ID as lt, CHAIN_BASE_TOKENS as en, EVM_CHAIN_IDS_MAP as he, CHAIN_IDS_MAP as tn, EVM_CHAINS as nn } from "./constants/chains.js";
|
|
21
21
|
import "use-debounce";
|
|
22
22
|
import { derive as sn } from "derive-valtio";
|
|
23
23
|
import { getIsNativeNearDeposit as rn } from "./machine/computed/getIsNativeNearDeposit.js";
|
|
@@ -35,38 +35,38 @@ import { isValidChain as un } from "./utils/checkers/isValidChain.js";
|
|
|
35
35
|
import { useWalletBalance as Ee } from "./hooks/useWalletBalance.js";
|
|
36
36
|
import { getIntentsAccountId as te } from "./utils/intents/getIntentsAccountId.js";
|
|
37
37
|
import { getIntentsBalances as mn } from "./utils/intents/getIntentsBalance.js";
|
|
38
|
-
import { notReachable as
|
|
38
|
+
import { notReachable as Re } from "./utils/notReachable.js";
|
|
39
39
|
import { getTokenBalanceKey as G } from "./utils/intents/getTokenBalanceKey.js";
|
|
40
|
-
import { isDryQuote as
|
|
40
|
+
import { isDryQuote as Ce } from "./machine/guards/checks/isDryQuote.js";
|
|
41
41
|
import { snakeCase as dt } from "change-case";
|
|
42
42
|
import fn, { CanceledError as ut, AxiosError as mt } from "axios";
|
|
43
43
|
import { oneClickApi as Ie, bridgeApi as ft } from "./network.js";
|
|
44
|
-
import { formatBigToHuman as
|
|
44
|
+
import { formatBigToHuman as j } from "./utils/formatters/formatBigToHuman.js";
|
|
45
45
|
import { getDryQuoteAddress as Pe } from "./utils/getDryQuoteAddress.js";
|
|
46
46
|
import { isEvmChain as Q } from "./utils/evm/isEvmChain.js";
|
|
47
47
|
import { checkNearAccountExists as pn } from "./utils/near/checkNearAccountExists.js";
|
|
48
48
|
import { isNotEmptyAmount as ne } from "./utils/checkers/isNotEmptyAmount.js";
|
|
49
49
|
import { isValidBigint as pt } from "./utils/checkers/isValidBigint.js";
|
|
50
|
-
import { isNearAddress as
|
|
50
|
+
import { isNearAddress as Tt } from "./utils/near/isNearAddress.js";
|
|
51
51
|
import { isBalanceSufficient as ve } from "./machine/guards/checks/isBalanceSufficient.js";
|
|
52
|
-
import { isQuoteError as De, isTransferError as xe, isAsyncSendAddressValidationError as
|
|
53
|
-
import { isSolanaAddress as
|
|
52
|
+
import { isQuoteError as De, isTransferError as xe, isAsyncSendAddressValidationError as Tn } from "./machine/errors.js";
|
|
53
|
+
import { isSolanaAddress as ht } from "./utils/solana/isSolanaAddress.js";
|
|
54
54
|
import { isEvmAddress as gt } from "./utils/evm/isEvmAddress.js";
|
|
55
|
-
import { getMainTokenByChain as
|
|
55
|
+
import { getMainTokenByChain as hn } from "./utils/tokens/getMainTokenByChain.js";
|
|
56
56
|
import { getDefaultIntentsToken as gn } from "./utils/tokens/getDefaultIntentsToken.js";
|
|
57
57
|
import { getTokenWithHighBalance as In } from "./utils/tokens/getTokenWithHighBalance.js";
|
|
58
58
|
import { isQuoteIdle as wn } from "./machine/subscriptions/checkers/isQuoteIdle.js";
|
|
59
59
|
import { isInputChanged as kn } from "./machine/subscriptions/checkers/isInputChanged.js";
|
|
60
60
|
import { isErrorChanged as An } from "./machine/subscriptions/checkers/isErrorChanged.js";
|
|
61
|
-
import { isOnlyErrorChanged as
|
|
62
|
-
import { isValidInitialState as
|
|
61
|
+
import { isOnlyErrorChanged as Nn } from "./machine/subscriptions/checkers/isOnlyErrorChanged.js";
|
|
62
|
+
import { isValidInitialState as Sn } from "./machine/subscriptions/checkers/isValidInitialState.js";
|
|
63
63
|
import { isWalletDisconnected as _n } from "./machine/subscriptions/checkers/isWalletDisconnected.js";
|
|
64
64
|
import { isSendAddressForbidden as yn } from "./machine/subscriptions/checkers/isSendAddressForbidden.js";
|
|
65
65
|
import { isAmountChangedFromQuote as bn } from "./machine/subscriptions/checkers/isAmountChangedFromQuote.js";
|
|
66
66
|
import { reset as En } from "./machine/events/reset.js";
|
|
67
67
|
import { tokenSelectRotate as we } from "./machine/events/tokenSelectRotate.js";
|
|
68
|
-
import { errorSet as
|
|
69
|
-
import { quoteSet as
|
|
68
|
+
import { errorSet as Rn } from "./machine/events/errorSet.js";
|
|
69
|
+
import { quoteSet as Cn } from "./machine/events/quoteSet.js";
|
|
70
70
|
import { addressSet as vn } from "./machine/events/addressSet.js";
|
|
71
71
|
import { tokenSetAmount as Dn } from "./machine/events/tokenSetAmount.js";
|
|
72
72
|
import { quoteSetStatus as xn } from "./machine/events/quoteSetStatus.js";
|
|
@@ -96,56 +96,56 @@ import { isEvmBaseToken as It } from "./utils/evm/isEvmBaseToken.js";
|
|
|
96
96
|
import { useMakeEvmTransfer as Gn } from "./hooks/useMakeEvmTransfer.js";
|
|
97
97
|
import { useMakeSolanaTransfer as jn } from "./hooks/useMakeSolanaTransfer.js";
|
|
98
98
|
import { isUserDeniedSigning as Ae } from "./utils/checkers/isUserDeniedSigning.js";
|
|
99
|
-
import { createIntentSignerNEP413 as zn, BridgeSDK as Yn, createNearWithdrawalRoute as Zn, createInternalTransferRoute as Xn } from "@defuse-protocol/bridge-sdk";
|
|
100
|
-
import { generateRandomBytes as
|
|
101
|
-
import { IntentSignerSolana as
|
|
99
|
+
import { createIntentSignerNEP413 as zn, BridgeSDK as Yn, createNearWithdrawalRoute as Zn, createInternalTransferRoute as Xn, MinWithdrawalAmountError as Jn, FeeExceedsAmountError as es } from "@defuse-protocol/bridge-sdk";
|
|
100
|
+
import { generateRandomBytes as ts } from "./utils/near/getRandomBytes.js";
|
|
101
|
+
import { IntentSignerSolana as ns } from "./utils/intents/signers/solana.js";
|
|
102
102
|
import { localStorageTyped as Me } from "./utils/localstorage.js";
|
|
103
|
-
import { queryContract as
|
|
103
|
+
import { queryContract as ss } from "./utils/near/queryContract.js";
|
|
104
104
|
import { utils as Qe } from "@defuse-protocol/internal-utils";
|
|
105
|
-
import { getTransactionLink as
|
|
106
|
-
import { switchEthereumChain as
|
|
105
|
+
import { getTransactionLink as rs } from "./utils/formatters/getTransactionLink.js";
|
|
106
|
+
import { switchEthereumChain as as } from "./utils/evm/switchEthereumChain.js";
|
|
107
107
|
import "copy-text-to-clipboard";
|
|
108
108
|
import { SwapQuoteSkeleton as wt } from "./features/SwapQuote/SwapQuoteSkeleton.js";
|
|
109
109
|
import { Notes as de } from "./components/Notes.js";
|
|
110
|
-
import { Accordion as
|
|
110
|
+
import { Accordion as os } from "./components/Accordion.js";
|
|
111
111
|
import { formatUsdAmount as $e } from "./utils/formatters/formatUsdAmount.js";
|
|
112
|
-
import { formatTinyNumber as
|
|
113
|
-
import
|
|
114
|
-
import { Skeleton as
|
|
115
|
-
import { getBalancePortion as
|
|
116
|
-
import { getUsdDisplayAmount as
|
|
112
|
+
import { formatTinyNumber as is } from "./utils/formatters/formatTinyNumber.js";
|
|
113
|
+
import cs from "clsx";
|
|
114
|
+
import { Skeleton as ls } from "./components/Skeleton.js";
|
|
115
|
+
import { getBalancePortion as ds } from "./features/TokenInput/utils/getBalancePortion.js";
|
|
116
|
+
import { getUsdDisplayAmount as us } from "./features/TokenInput/utils/getUsdDisplayAmount.js";
|
|
117
117
|
import { TokenInputHeading as kt } from "./features/TokenInput/TokenInputHeading.js";
|
|
118
|
-
import { noop as
|
|
118
|
+
import { noop as ms } from "./utils/noop.js";
|
|
119
119
|
import { Card as ie } from "./components/Card.js";
|
|
120
120
|
import { Badge as Ke } from "./components/Badge.js";
|
|
121
121
|
import { TokenIcon as At } from "./components/TokenIcon.js";
|
|
122
|
-
import { InputAmount as
|
|
123
|
-
import { TokenInputSkeleton as
|
|
124
|
-
import { getUsdDisplayBalance as
|
|
125
|
-
import { VList as
|
|
126
|
-
import { TokensListPlaceholder as
|
|
127
|
-
import { Hr as
|
|
128
|
-
import { createTokenSorter as
|
|
122
|
+
import { InputAmount as fs } from "./components/InputAmount.js";
|
|
123
|
+
import { TokenInputSkeleton as ps } from "./features/TokenInput/TokenInputSkeleton.js";
|
|
124
|
+
import { getUsdDisplayBalance as Ts } from "./utils/formatters/getUsdDisplayBalance.js";
|
|
125
|
+
import { VList as hs } from "virtua";
|
|
126
|
+
import { TokensListPlaceholder as Ne } from "./features/TokensList/TokensListPlaceholder.js";
|
|
127
|
+
import { Hr as gs } from "./components/Hr.js";
|
|
128
|
+
import { createTokenSorter as Is } from "./utils/tokens/sort.js";
|
|
129
129
|
import { createFilterByIntents as He } from "./utils/tokens/filterByIntents.js";
|
|
130
|
-
import { createFilterBySearch as
|
|
131
|
-
import { createFilterBySelectedChain as
|
|
130
|
+
import { createFilterBySearch as ws } from "./utils/tokens/filterBySearchString.js";
|
|
131
|
+
import { createFilterBySelectedChain as ks } from "./utils/tokens/filterBySelectedChain.js";
|
|
132
132
|
import "bs58";
|
|
133
133
|
import "viem/chains";
|
|
134
|
-
import { isBrowser as
|
|
134
|
+
import { isBrowser as Nt } from "browser-or-node";
|
|
135
135
|
import "qrcode.react";
|
|
136
|
-
import { createColorPalette as
|
|
137
|
-
import { ArmingCountdownFill as
|
|
138
|
-
import { useTimer as
|
|
139
|
-
import { CloseButton as
|
|
140
|
-
import { DEFAULT_RPCS as
|
|
141
|
-
import { useAddClassToPortal as
|
|
142
|
-
import { ErrorBoundary as
|
|
143
|
-
import { isEvmToken as
|
|
144
|
-
import { getEvmMainTokenBalance as
|
|
145
|
-
import { getNativeNearBalance as
|
|
146
|
-
import { getNearTokenBalance as
|
|
147
|
-
import { getEvmTokenBalance as
|
|
148
|
-
function
|
|
136
|
+
import { createColorPalette as As } from "./theme/createColorPalette.js";
|
|
137
|
+
import { ArmingCountdownFill as Ns, BeenhereFill as Ss, EncryptedFill as _s, AccountBalanceWalletFill as ys, CheckCircleFill as bs, GppBadFill as Es } from "@material-symbols-svg/react-rounded";
|
|
138
|
+
import { useTimer as Rs } from "use-timer";
|
|
139
|
+
import { CloseButton as St } from "./components/CloseButton.js";
|
|
140
|
+
import { DEFAULT_RPCS as Cs } from "./rpcs.js";
|
|
141
|
+
import { useAddClassToPortal as vs } from "./hooks/useAddClassToPortal.js";
|
|
142
|
+
import { ErrorBoundary as Ds } from "react-error-boundary";
|
|
143
|
+
import { isEvmToken as xs } from "./utils/evm/isEvmToken.js";
|
|
144
|
+
import { getEvmMainTokenBalance as Os } from "./utils/evm/getEvmMainTokenBalance.js";
|
|
145
|
+
import { getNativeNearBalance as Fs } from "./utils/near/getNativeNearBalance.js";
|
|
146
|
+
import { getNearTokenBalance as Ls } from "./utils/near/getNearTokenBalance.js";
|
|
147
|
+
import { getEvmTokenBalance as Bs } from "./utils/evm/getEvmTokenBalance.js";
|
|
148
|
+
function qs({ rpcs: e, token: t, connectedWallets: r }) {
|
|
149
149
|
const { walletSupportedChains: s, tonCenterApiKey: n, alchemyApiKey: a } = y(), { walletAddress: l } = ot(r, t);
|
|
150
150
|
return _e({
|
|
151
151
|
retry: 2,
|
|
@@ -155,16 +155,16 @@ function Ls({ rpcs: e, token: t, connectedWallets: r }) {
|
|
|
155
155
|
if (!l)
|
|
156
156
|
return null;
|
|
157
157
|
if (t.blockchain === "near" && s.includes(t.blockchain))
|
|
158
|
-
return !e.near || e.near.length === 0 ? null : t.assetId === $ ?
|
|
158
|
+
return !e.near || e.near.length === 0 ? null : t.assetId === $ ? Fs(l, e.near) : Ls(t, l, e.near);
|
|
159
159
|
if (!s.includes("eth") && Q(t.blockchain))
|
|
160
160
|
return null;
|
|
161
161
|
if (Q(t.blockchain) && It(t)) {
|
|
162
162
|
const c = e[t.blockchain] ?? [];
|
|
163
|
-
return c.length > 0 ?
|
|
163
|
+
return c.length > 0 ? Os(l, c[0]) : null;
|
|
164
164
|
}
|
|
165
|
-
if (
|
|
165
|
+
if (xs(t) || Q(t.blockchain)) {
|
|
166
166
|
const c = e[t.blockchain] ?? [];
|
|
167
|
-
return c.length > 0 ?
|
|
167
|
+
return c.length > 0 ? Bs(t, l, c[0]) : null;
|
|
168
168
|
}
|
|
169
169
|
return t.blockchain === "ton" ? Yt(t, l, n) : t.blockchain === "sol" && s.includes(t.blockchain) ? Zt(t, l, a) : (b.warn(
|
|
170
170
|
`Failed to fetch token balance for ${t.symbol} on ${t.blockchain}`
|
|
@@ -172,20 +172,20 @@ function Ls({ rpcs: e, token: t, connectedWallets: r }) {
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
}
|
|
175
|
-
const
|
|
175
|
+
const Us = ({
|
|
176
176
|
rpcs: e,
|
|
177
177
|
token: t,
|
|
178
178
|
onBalancesLoaded: r
|
|
179
|
-
}) => (
|
|
179
|
+
}) => (R(() => {
|
|
180
180
|
t.isIntent || !Object.keys(e).includes(t.blockchain) || r({ [t.assetId]: "0" });
|
|
181
181
|
}, [t.assetId]), null), _t = Pt(
|
|
182
182
|
({ rpcs: e, token: t, connectedWallets: r, onBalancesLoaded: s }) => {
|
|
183
|
-
const { data: n } =
|
|
183
|
+
const { data: n } = qs({
|
|
184
184
|
rpcs: e,
|
|
185
185
|
token: t,
|
|
186
186
|
connectedWallets: r
|
|
187
187
|
});
|
|
188
|
-
return
|
|
188
|
+
return R(() => {
|
|
189
189
|
!t.isIntent && n != null && s({ [t.assetId]: n });
|
|
190
190
|
}, [t, n, s]), null;
|
|
191
191
|
},
|
|
@@ -193,11 +193,11 @@ const Bs = ({
|
|
|
193
193
|
);
|
|
194
194
|
_t.displayName = "TokenBalanceLoader";
|
|
195
195
|
const Ge = Object.assign(_t, {
|
|
196
|
-
Zero:
|
|
197
|
-
}),
|
|
196
|
+
Zero: Us
|
|
197
|
+
}), Ps = (e) => {
|
|
198
198
|
const t = e.toLowerCase();
|
|
199
199
|
return be[t]?.icon ?? "";
|
|
200
|
-
}, je = (e) => ye[e].icon ?? Jt,
|
|
200
|
+
}, je = (e) => ye[e].icon ?? Jt, Ws = (e) => `${e?.charAt(0).toUpperCase()}${e?.slice(1)}`, Vs = (e) => be[e]?.name ?? e, P = (e) => {
|
|
201
201
|
const {
|
|
202
202
|
showIntentTokens: t,
|
|
203
203
|
allowedTokensList: r,
|
|
@@ -212,25 +212,25 @@ const Ge = Object.assign(_t, {
|
|
|
212
212
|
}), i = v(() => {
|
|
213
213
|
if (!d)
|
|
214
214
|
return [];
|
|
215
|
-
const
|
|
216
|
-
const w =
|
|
217
|
-
return !un(w) || r && !r.includes(
|
|
218
|
-
assetId:
|
|
219
|
-
symbol:
|
|
220
|
-
decimals:
|
|
221
|
-
price:
|
|
215
|
+
const f = d.map((m) => {
|
|
216
|
+
const w = m.blockchain.toLowerCase();
|
|
217
|
+
return !un(w) || r && !r.includes(m.assetId) || e === "source" && s && !s.includes(m.assetId) || e === "target" && n && !n.includes(m.assetId) ? null : {
|
|
218
|
+
assetId: m.assetId,
|
|
219
|
+
symbol: m.symbol,
|
|
220
|
+
decimals: m.decimals,
|
|
221
|
+
price: m.price,
|
|
222
222
|
blockchain: w,
|
|
223
223
|
isIntent: !1,
|
|
224
|
-
icon:
|
|
225
|
-
name:
|
|
224
|
+
icon: m.icon ?? Ps(m.symbol),
|
|
225
|
+
name: Vs(m.symbol),
|
|
226
226
|
chainIcon: je(w),
|
|
227
|
-
chainName: ye[
|
|
228
|
-
contractAddress:
|
|
227
|
+
chainName: ye[m.blockchain]?.label ?? Ws(m.blockchain),
|
|
228
|
+
contractAddress: m.contractAddress
|
|
229
229
|
};
|
|
230
|
-
}).filter((
|
|
231
|
-
(
|
|
232
|
-
),
|
|
233
|
-
return
|
|
230
|
+
}).filter((m) => !!m).filter(a ?? (() => !0)), T = f.filter(
|
|
231
|
+
(m) => m.symbol.toLowerCase() !== "wnear"
|
|
232
|
+
), I = f.find((m) => m.symbol.toLowerCase() === "wnear");
|
|
233
|
+
return I && T.push({
|
|
234
234
|
name: "NEAR",
|
|
235
235
|
symbol: "NEAR",
|
|
236
236
|
chainName: "Near",
|
|
@@ -238,23 +238,23 @@ const Ge = Object.assign(_t, {
|
|
|
238
238
|
assetId: $,
|
|
239
239
|
chainIcon: je("near"),
|
|
240
240
|
icon: be.near?.icon ?? "",
|
|
241
|
-
price:
|
|
242
|
-
contractAddress:
|
|
241
|
+
price: I?.price ?? 0,
|
|
242
|
+
contractAddress: I?.contractAddress,
|
|
243
243
|
isIntent: !1,
|
|
244
244
|
decimals: 24
|
|
245
245
|
}), t ? [
|
|
246
|
-
...
|
|
246
|
+
...T,
|
|
247
247
|
// add intents tokens to the full list
|
|
248
|
-
...
|
|
249
|
-
(
|
|
248
|
+
...f.map(
|
|
249
|
+
(m) => m.symbol.toLowerCase() === "wnear" ? { ...m, symbol: "NEAR", name: "NEAR", isIntent: !0 } : { ...m, isIntent: !0 }
|
|
250
250
|
)
|
|
251
|
-
] :
|
|
251
|
+
] : T;
|
|
252
252
|
}, [d, t, a]);
|
|
253
253
|
return {
|
|
254
254
|
...u,
|
|
255
255
|
tokens: i
|
|
256
256
|
};
|
|
257
|
-
},
|
|
257
|
+
}, Ms = () => {
|
|
258
258
|
const { tokens: e } = P(), { tokens: t } = P("source"), { tokens: r } = P("target");
|
|
259
259
|
return { tokens: v(() => {
|
|
260
260
|
const n = {};
|
|
@@ -272,7 +272,7 @@ const Ge = Object.assign(_t, {
|
|
|
272
272
|
{ near: ["USDT", "USDC", "AURORA"] },
|
|
273
273
|
{ arb: ["ARB", "ETH", "USDT", "USDC"] },
|
|
274
274
|
{ btc: ["BTC"] }
|
|
275
|
-
],
|
|
275
|
+
], Qs = (e) => [...e].sort((t, r) => {
|
|
276
276
|
const s = ue.findIndex(
|
|
277
277
|
(d) => Object.keys(d)[0] === t.blockchain
|
|
278
278
|
), n = ue.findIndex(
|
|
@@ -282,9 +282,9 @@ const Ge = Object.assign(_t, {
|
|
|
282
282
|
return s === -1 ? 1 : n === -1 ? -1 : s - n;
|
|
283
283
|
const a = ue[s]?.[t.blockchain] ?? [], l = a.indexOf(t.symbol), c = a.indexOf(r.symbol);
|
|
284
284
|
return l === -1 && c === -1 ? 0 : l === -1 ? 1 : c === -1 ? -1 : l - c;
|
|
285
|
-
}),
|
|
286
|
-
const { tokens: r } =
|
|
287
|
-
return v(() =>
|
|
285
|
+
}), $s = ({ rpcs: e, connectedWallets: t }) => {
|
|
286
|
+
const { tokens: r } = Ms(), { walletSupportedChains: s } = y(), { setWalletBalance: n } = Ee(t);
|
|
287
|
+
return v(() => Qs(r), [r]).map((l) => s.includes(l.blockchain) ? /* @__PURE__ */ o(
|
|
288
288
|
Ge,
|
|
289
289
|
{
|
|
290
290
|
rpcs: e,
|
|
@@ -303,7 +303,7 @@ const Ge = Object.assign(_t, {
|
|
|
303
303
|
G(l)
|
|
304
304
|
));
|
|
305
305
|
};
|
|
306
|
-
function
|
|
306
|
+
function Ks(e, t) {
|
|
307
307
|
const r = Array.from(
|
|
308
308
|
/* @__PURE__ */ new Set([...t ?? [], ...it])
|
|
309
309
|
), s = new Map(r.map((n, a) => [n, a]));
|
|
@@ -312,7 +312,7 @@ function Qs(e, t) {
|
|
|
312
312
|
return l !== c ? l - c : n.id.localeCompare(a.id, void 0, { sensitivity: "base" });
|
|
313
313
|
});
|
|
314
314
|
}
|
|
315
|
-
const
|
|
315
|
+
const Hs = (e) => {
|
|
316
316
|
const {
|
|
317
317
|
chainsOrder: t,
|
|
318
318
|
allowedChainsList: r,
|
|
@@ -323,7 +323,7 @@ const $s = (e) => {
|
|
|
323
323
|
const l = Array.from(
|
|
324
324
|
new Set(a.map((c) => ye[c.blockchain]))
|
|
325
325
|
).filter((c) => !(r && !r.includes(c.id) || e === "source" && s && !s.includes(c.id) || e === "target" && n && !n.includes(c.id)));
|
|
326
|
-
return
|
|
326
|
+
return Ks(l, t);
|
|
327
327
|
}, [a, t, r]);
|
|
328
328
|
}, ze = 3, yt = ({
|
|
329
329
|
connectedWallets: e,
|
|
@@ -339,12 +339,12 @@ const $s = (e) => {
|
|
|
339
339
|
connectedWallets: e,
|
|
340
340
|
walletSupportedChains: a
|
|
341
341
|
}),
|
|
342
|
-
getNextPageParam: (i,
|
|
343
|
-
if (i.pageKey && !(
|
|
342
|
+
getNextPageParam: (i, f) => {
|
|
343
|
+
if (i.pageKey && !(f.length >= ze))
|
|
344
344
|
return i.pageKey;
|
|
345
345
|
}
|
|
346
346
|
});
|
|
347
|
-
|
|
347
|
+
R(() => {
|
|
348
348
|
c && d.data && d.hasNextPage && d.data.pages.length < ze && !d.isFetchingNextPage && d.fetchNextPage();
|
|
349
349
|
}, [c, d]);
|
|
350
350
|
const u = v(() => {
|
|
@@ -352,13 +352,13 @@ const $s = (e) => {
|
|
|
352
352
|
return {};
|
|
353
353
|
const i = cn(
|
|
354
354
|
n,
|
|
355
|
-
d.data.pages.flatMap((
|
|
355
|
+
d.data.pages.flatMap((f) => f.data)
|
|
356
356
|
);
|
|
357
|
-
return n.forEach((
|
|
358
|
-
dn(
|
|
357
|
+
return n.forEach((f) => {
|
|
358
|
+
dn(f.blockchain) && !(f.assetId in i) && (i[f.assetId] = "0");
|
|
359
359
|
}), i;
|
|
360
360
|
}, [d.data, n]);
|
|
361
|
-
return
|
|
361
|
+
return R(() => {
|
|
362
362
|
D(s, ["initial_wallet"]) && (l(e, u), s.sourceToken && Object.keys(u).includes(s.sourceToken.assetId) && p("tokenSetBalance", u[s.sourceToken.assetId]));
|
|
363
363
|
}, [u]), {
|
|
364
364
|
status: d.status,
|
|
@@ -389,14 +389,14 @@ const $s = (e) => {
|
|
|
389
389
|
case "pending":
|
|
390
390
|
return {};
|
|
391
391
|
default:
|
|
392
|
-
return
|
|
392
|
+
return Re(a, { throwError: !1 }), {};
|
|
393
393
|
}
|
|
394
394
|
}, [a]) ?? {};
|
|
395
395
|
return {
|
|
396
396
|
...a,
|
|
397
397
|
intentBalances: l
|
|
398
398
|
};
|
|
399
|
-
},
|
|
399
|
+
}, Gs = ({
|
|
400
400
|
isEnabled: e,
|
|
401
401
|
alchemyApiKey: t
|
|
402
402
|
}) => {
|
|
@@ -405,7 +405,7 @@ const $s = (e) => {
|
|
|
405
405
|
connectedWallets: r,
|
|
406
406
|
alchemyApiKey: t ?? ""
|
|
407
407
|
});
|
|
408
|
-
|
|
408
|
+
R(() => {
|
|
409
409
|
const c = D(s, ["transfer_success"]);
|
|
410
410
|
!e || !c || (async () => (await a(), t && (await new Promise((d) => {
|
|
411
411
|
setTimeout(d, 1e4);
|
|
@@ -417,9 +417,9 @@ const $s = (e) => {
|
|
|
417
417
|
() => ({ ...r, ...t }),
|
|
418
418
|
[r, t]
|
|
419
419
|
) };
|
|
420
|
-
},
|
|
420
|
+
}, js = ({ isEnabled: e }) => {
|
|
421
421
|
const { ctx: t } = _(), { mergedBalance: r } = le();
|
|
422
|
-
|
|
422
|
+
R(() => {
|
|
423
423
|
if (!e)
|
|
424
424
|
return;
|
|
425
425
|
if (!t.sourceToken || !t.walletAddress) {
|
|
@@ -444,11 +444,11 @@ const $s = (e) => {
|
|
|
444
444
|
"nep245:v2_1.omni.hot.tg:56_SZzgw3HSudhZcTwPWUTi2RJB19t": "nep141:wrap.near",
|
|
445
445
|
// BTC (near)
|
|
446
446
|
"nep141:btc.omft.near": "nep141:nbtc.bridge.near"
|
|
447
|
-
},
|
|
447
|
+
}, zs = ({
|
|
448
448
|
isEnabled: e
|
|
449
449
|
}) => {
|
|
450
450
|
const { ctx: t } = _(), { tokens: r } = P();
|
|
451
|
-
|
|
451
|
+
R(() => {
|
|
452
452
|
if (!e)
|
|
453
453
|
return;
|
|
454
454
|
if (!t.sourceToken) {
|
|
@@ -483,20 +483,20 @@ const $s = (e) => {
|
|
|
483
483
|
token: a ?? l
|
|
484
484
|
});
|
|
485
485
|
}, [r, t.sourceToken]);
|
|
486
|
-
},
|
|
486
|
+
}, Ys = ({ isEnabled: e }) => {
|
|
487
487
|
const { connectedWallets: t } = y(), { ctx: r, state: s } = _(), { walletAddress: n } = ot(
|
|
488
488
|
t,
|
|
489
489
|
r.sourceToken
|
|
490
490
|
);
|
|
491
|
-
|
|
491
|
+
R(() => {
|
|
492
492
|
if (!e)
|
|
493
493
|
return;
|
|
494
494
|
p("walletAddressSet", n), D(r, ["initial_dry", "initial_wallet"]) && (s === "initial_wallet" && !n ? O("initial_dry") : s === "initial_dry" && n && O("initial_wallet"));
|
|
495
495
|
}, [e, n, r, s]);
|
|
496
|
-
},
|
|
496
|
+
}, Zs = (e) => (["depositAddress"].forEach((t) => {
|
|
497
497
|
if (!(t in e))
|
|
498
498
|
return b.error(`Missing ${t} in quote response`), !1;
|
|
499
|
-
}), !0),
|
|
499
|
+
}), !0), Xs = () => {
|
|
500
500
|
const { ctx: e } = _(), {
|
|
501
501
|
walletSupportedChains: t,
|
|
502
502
|
intentsAccountType: r,
|
|
@@ -504,22 +504,22 @@ const $s = (e) => {
|
|
|
504
504
|
appFees: n,
|
|
505
505
|
fetchQuote: a,
|
|
506
506
|
slippageTolerance: l
|
|
507
|
-
} = y(), c =
|
|
508
|
-
const { signal:
|
|
509
|
-
return a ? a(
|
|
510
|
-
...
|
|
511
|
-
signal:
|
|
507
|
+
} = y(), c = Ce(e), d = Y(null), u = Y(new AbortController()), i = v(() => async (T, I) => {
|
|
508
|
+
const { signal: m } = u.current;
|
|
509
|
+
return a ? a(T, {
|
|
510
|
+
...I,
|
|
511
|
+
signal: m
|
|
512
512
|
}) : (await Ie.post(
|
|
513
513
|
"https://1click.chaindefuser.com/v0/quote",
|
|
514
|
-
|
|
515
|
-
{ signal:
|
|
514
|
+
T,
|
|
515
|
+
{ signal: m }
|
|
516
516
|
)).data.quote;
|
|
517
517
|
}, [Ie]);
|
|
518
518
|
return {
|
|
519
519
|
make: async ({
|
|
520
|
-
message:
|
|
521
|
-
quoteType:
|
|
522
|
-
options:
|
|
520
|
+
message: T,
|
|
521
|
+
quoteType: I = "exact_in",
|
|
522
|
+
options: m = {}
|
|
523
523
|
} = {}) => {
|
|
524
524
|
if (!D(e, [
|
|
525
525
|
"input_valid_dry",
|
|
@@ -534,17 +534,17 @@ const $s = (e) => {
|
|
|
534
534
|
meta: { isDry: c, message: k }
|
|
535
535
|
});
|
|
536
536
|
}
|
|
537
|
-
const
|
|
537
|
+
const N = te({
|
|
538
538
|
addressType: r,
|
|
539
539
|
walletAddress: c ? (
|
|
540
540
|
// address on the target chain should be a dry quote recipient
|
|
541
541
|
Pe(e.targetToken.blockchain)
|
|
542
542
|
) : e.walletAddress ?? ""
|
|
543
|
-
}), E =
|
|
543
|
+
}), E = N && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), B = () => c ? Pe(
|
|
544
544
|
e.sourceToken.blockchain,
|
|
545
545
|
e.sourceToken.isIntent
|
|
546
|
-
) : E ?
|
|
547
|
-
if (!
|
|
546
|
+
) : E ? N : e.walletAddress ?? "";
|
|
547
|
+
if (!N) {
|
|
548
548
|
const k = "No corresponding intents account to run a quote";
|
|
549
549
|
throw b.error(`[WIDGET] ${k}`), new q({
|
|
550
550
|
code: "QUOTE_INVALID_INITIAL",
|
|
@@ -559,39 +559,39 @@ const $s = (e) => {
|
|
|
559
559
|
slippageTolerance: l,
|
|
560
560
|
deadline: new Date(Date.now() + 3600 * 1e3).toISOString(),
|
|
561
561
|
// 1 hour
|
|
562
|
-
swapType:
|
|
562
|
+
swapType: I === "exact_out" ? U.swapType.EXACT_OUTPUT : U.swapType.EXACT_INPUT,
|
|
563
563
|
// Target
|
|
564
564
|
destinationAsset: e.targetToken.assetId === $ ? ge : e.targetToken.assetId,
|
|
565
565
|
// Source
|
|
566
566
|
originAsset: e.sourceToken.assetId === $ ? ge : e.sourceToken.assetId,
|
|
567
|
-
amount:
|
|
567
|
+
amount: I === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount,
|
|
568
568
|
// Experimental
|
|
569
569
|
quoteWaitingTimeMs: 0
|
|
570
570
|
};
|
|
571
|
-
|
|
571
|
+
T && (L.customRecipientMsg = T), s && (L.referral = dt(s)), n && (L.appFees = [...n]);
|
|
572
572
|
try {
|
|
573
573
|
e.sourceToken.isIntent && e.targetToken.isIntent && (d.current = i(
|
|
574
574
|
{
|
|
575
575
|
...L,
|
|
576
|
-
recipient:
|
|
576
|
+
recipient: N,
|
|
577
577
|
recipientType: U.recipientType.INTENTS,
|
|
578
578
|
depositType: U.depositType.INTENTS,
|
|
579
579
|
// Refund
|
|
580
|
-
refundTo:
|
|
580
|
+
refundTo: N,
|
|
581
581
|
refundType: U.refundType.INTENTS
|
|
582
582
|
},
|
|
583
|
-
|
|
583
|
+
m
|
|
584
584
|
), F = await d.current), d.current = i(
|
|
585
585
|
{
|
|
586
586
|
...L,
|
|
587
|
-
recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress :
|
|
587
|
+
recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress : N,
|
|
588
588
|
recipientType: e.targetToken.isIntent ? U.recipientType.INTENTS : U.recipientType.DESTINATION_CHAIN,
|
|
589
589
|
depositType: e.sourceToken.isIntent ? U.depositType.INTENTS : U.depositType.ORIGIN_CHAIN,
|
|
590
590
|
// Refund
|
|
591
591
|
refundTo: B(),
|
|
592
592
|
refundType: E ? U.refundType.INTENTS : U.refundType.ORIGIN_CHAIN
|
|
593
593
|
},
|
|
594
|
-
|
|
594
|
+
m
|
|
595
595
|
), F = await d.current;
|
|
596
596
|
} catch (k) {
|
|
597
597
|
if (k instanceof ut)
|
|
@@ -604,7 +604,7 @@ const $s = (e) => {
|
|
|
604
604
|
throw new q({
|
|
605
605
|
code: "QUOTE_AMOUNT_IS_TOO_LOW",
|
|
606
606
|
meta: {
|
|
607
|
-
minAmount: (J &&
|
|
607
|
+
minAmount: (J && j(J, e.sourceToken.decimals)) ?? "0"
|
|
608
608
|
}
|
|
609
609
|
});
|
|
610
610
|
}
|
|
@@ -626,7 +626,7 @@ const $s = (e) => {
|
|
|
626
626
|
...F,
|
|
627
627
|
deadline: void 0,
|
|
628
628
|
depositAddress: void 0
|
|
629
|
-
} : (
|
|
629
|
+
} : (Zs(F), {
|
|
630
630
|
dry: !1,
|
|
631
631
|
...F,
|
|
632
632
|
deadline: F.deadline,
|
|
@@ -637,8 +637,8 @@ const $s = (e) => {
|
|
|
637
637
|
u.current.abort("Abort quote manually"), u.current = new AbortController();
|
|
638
638
|
}
|
|
639
639
|
};
|
|
640
|
-
},
|
|
641
|
-
const { ctx: e } = _(), { intentsAccountType: t } = y(), { isNativeNearDeposit: r } =
|
|
640
|
+
}, Js = () => {
|
|
641
|
+
const { ctx: e } = _(), { intentsAccountType: t } = y(), { isNativeNearDeposit: r } = z(), s = te({
|
|
642
642
|
addressType: t,
|
|
643
643
|
walletAddress: e.walletAddress ?? ""
|
|
644
644
|
}), n = Y(null), a = Y(new AbortController()), l = v(() => async (d) => ft.post(
|
|
@@ -723,12 +723,12 @@ const $s = (e) => {
|
|
|
723
723
|
amountIn: e.sourceTokenAmount,
|
|
724
724
|
amountOut: e.targetTokenAmount,
|
|
725
725
|
amountInUsd: `${parseFloat(
|
|
726
|
-
|
|
726
|
+
j(e.sourceTokenAmount, e.sourceToken.decimals)
|
|
727
727
|
) * e.sourceToken.price}`,
|
|
728
728
|
amountOutUsd: `${parseFloat(
|
|
729
|
-
|
|
729
|
+
j(e.targetTokenAmount, e.targetToken.decimals)
|
|
730
730
|
) * e.targetToken.price}`,
|
|
731
|
-
amountOutFormatted:
|
|
731
|
+
amountOutFormatted: j(
|
|
732
732
|
e.targetTokenAmount,
|
|
733
733
|
e.targetToken.decimals
|
|
734
734
|
),
|
|
@@ -741,11 +741,11 @@ const $s = (e) => {
|
|
|
741
741
|
if (i instanceof ut)
|
|
742
742
|
return;
|
|
743
743
|
if (b.error(i), i instanceof mt) {
|
|
744
|
-
const
|
|
744
|
+
const f = i.response?.data.message || i.message;
|
|
745
745
|
throw new q({
|
|
746
746
|
code: "QUOTE_FAILED",
|
|
747
747
|
meta: {
|
|
748
|
-
message:
|
|
748
|
+
message: f ?? "Failed to fetch quote. Please try again."
|
|
749
749
|
}
|
|
750
750
|
});
|
|
751
751
|
}
|
|
@@ -777,7 +777,7 @@ const $s = (e) => {
|
|
|
777
777
|
}), O("initial_wallet");
|
|
778
778
|
return;
|
|
779
779
|
}
|
|
780
|
-
e.error ?
|
|
780
|
+
e.error ? Tn(e.error) && (p("errorSet", null), O("input_valid_external")) : O("input_valid_external");
|
|
781
781
|
}, bt = (e) => {
|
|
782
782
|
const t = D(e, ["initial_dry"]), r = D(e, ["input_valid_dry"]);
|
|
783
783
|
if (!t && !r)
|
|
@@ -790,25 +790,25 @@ const $s = (e) => {
|
|
|
790
790
|
return;
|
|
791
791
|
const s = e.sourceTokenBalance;
|
|
792
792
|
let n;
|
|
793
|
-
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : ne(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ?
|
|
793
|
+
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? n = { code: "SOURCE_TOKEN_IS_INTENT" } : ne(e.sourceTokenAmount) ? e.sendAddress ? e.targetToken.blockchain === "near" ? Tt(e.sendAddress) ? Xe(e) : n = {
|
|
794
794
|
code: "SEND_ADDRESS_IS_INVALID",
|
|
795
795
|
meta: { address: e.sendAddress, chain: "near" }
|
|
796
796
|
} : e.isDepositFromExternalWallet || (!s || !pt(s) ? n = { code: "INVALID_SOURCE_BALANCE" } : ve(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SEND_ADDRESS_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), r && e.targetToken.blockchain === "near" && Xe(e), !r && n ? p("errorSet", n) : e.error && !De(e.error) && !xe(e.error) && p("errorSet", null), r;
|
|
797
|
-
},
|
|
797
|
+
}, Rt = (e) => {
|
|
798
798
|
const t = D(e, ["initial_wallet"]), r = D(e, ["input_valid_internal"]);
|
|
799
799
|
if (!t && !r)
|
|
800
800
|
return;
|
|
801
801
|
const s = e.sourceTokenBalance;
|
|
802
802
|
let n;
|
|
803
803
|
return t && (e.sourceToken ? e.targetToken ? e.targetToken.isIntent ? ne(e.sourceTokenAmount) ? e.isDepositFromExternalWallet || (!s || !pt(s) ? n = { code: "INVALID_SOURCE_BALANCE" } : ve(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_NOT_INTENT" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), !r && n ? p("errorSet", n) : e.error && !De(e.error) && !xe(e.error) && p("errorSet", null), r;
|
|
804
|
-
},
|
|
805
|
-
const t =
|
|
804
|
+
}, Ct = (e) => {
|
|
805
|
+
const t = Ce(e), r = !t && e.targetToken?.isIntent === !0, s = !t && e.targetToken?.isIntent === !1;
|
|
806
806
|
if (t) {
|
|
807
807
|
const n = bt(e);
|
|
808
808
|
return O(n ? "input_valid_dry" : "initial_dry");
|
|
809
809
|
}
|
|
810
|
-
s && Et(e) ? O("input_valid_external") : r &&
|
|
811
|
-
},
|
|
810
|
+
s && Et(e) ? O("input_valid_external") : r && Rt(e) ? O("input_valid_internal") : O("initial_wallet");
|
|
811
|
+
}, er = ({
|
|
812
812
|
isEnabled: e,
|
|
813
813
|
message: t,
|
|
814
814
|
type: r = "exact_in",
|
|
@@ -821,26 +821,26 @@ const $s = (e) => {
|
|
|
821
821
|
isDirectNearTokenWithdrawal: d,
|
|
822
822
|
isDirectTokenOnNearTransfer: u,
|
|
823
823
|
isSameAssetDiffChainWithdrawal: i
|
|
824
|
-
} =
|
|
825
|
-
|
|
824
|
+
} = z(), f = Ce(n), T = e && !n.areInputsValidating && (i || (c || a) && n.isDepositFromExternalWallet || !d && !l && !c && !u), { make: I, cancel: m } = Xs(), { make: w, cancel: N } = Js(), E = Y(null), B = () => {
|
|
825
|
+
m(), N();
|
|
826
826
|
};
|
|
827
|
-
|
|
827
|
+
R(() => {
|
|
828
828
|
const L = D(n, ["input_valid_dry"]), k = D(n, ["input_valid_external"]), x = D(n, ["input_valid_internal"]);
|
|
829
|
-
(
|
|
830
|
-
}, [B,
|
|
831
|
-
const F =
|
|
829
|
+
(f && !L || !f && n.targetToken?.isIntent && !x || !f && !n.targetToken?.isIntent && !k || n.areInputsValidating) && B();
|
|
830
|
+
}, [B, f, n]);
|
|
831
|
+
const F = Te(
|
|
832
832
|
async (L) => {
|
|
833
833
|
try {
|
|
834
834
|
let k;
|
|
835
835
|
if (n.sourceToken?.assetId === n.targetToken?.assetId || a && n.isDepositFromExternalWallet) {
|
|
836
|
-
if (
|
|
836
|
+
if (f)
|
|
837
837
|
return;
|
|
838
838
|
p("quoteSetStatus", "pending"), k = await w();
|
|
839
839
|
} else
|
|
840
|
-
p("quoteSetStatus", "pending"), k = await
|
|
840
|
+
p("quoteSetStatus", "pending"), k = await I({ message: t, quoteType: r, options: L });
|
|
841
841
|
if (!k)
|
|
842
842
|
return;
|
|
843
|
-
if (p("quoteSetStatus", "success"), p("quoteSet", k), !
|
|
843
|
+
if (p("quoteSetStatus", "success"), p("quoteSet", k), !f && n.error?.code !== "SOURCE_BALANCE_INSUFFICIENT" && p("errorSet", null), p("tokenSetAmount", {
|
|
844
844
|
variant: "target",
|
|
845
845
|
amount: k.amountOut
|
|
846
846
|
}), n.state === "input_valid_dry") {
|
|
@@ -854,7 +854,7 @@ const $s = (e) => {
|
|
|
854
854
|
p("quoteSetStatus", "idle"), p("quoteSet", void 0), p("errorSet", null);
|
|
855
855
|
return;
|
|
856
856
|
}
|
|
857
|
-
p("quoteSetStatus", "error"), p("quoteSet", void 0), p("errorSet", k.data),
|
|
857
|
+
p("quoteSetStatus", "error"), p("quoteSet", void 0), p("errorSet", k.data), Ct(n);
|
|
858
858
|
return;
|
|
859
859
|
}
|
|
860
860
|
b.error("Unhandled error in useMakeQuoteEffect:", k), p("quoteSetStatus", "error"), p("quoteSet", void 0), p("errorSet", {
|
|
@@ -863,23 +863,23 @@ const $s = (e) => {
|
|
|
863
863
|
});
|
|
864
864
|
}
|
|
865
865
|
},
|
|
866
|
-
[n,
|
|
866
|
+
[n, f, w, I, t, r, T]
|
|
867
867
|
);
|
|
868
|
-
|
|
869
|
-
!
|
|
870
|
-
}, [
|
|
868
|
+
R(() => {
|
|
869
|
+
!T || !(f ? n.state === "input_valid_dry" : n.state === "input_valid_external" && !n.targetToken?.isIntent || n.state === "input_valid_internal" && n.targetToken?.isIntent) || n.quoteStatus !== "error" && (a && !n.isDepositFromExternalWallet || F({ isRefetch: !1 }));
|
|
870
|
+
}, [T, F, B, n.sourceToken, n.targetToken]), R(() => {
|
|
871
871
|
const L = () => {
|
|
872
872
|
E.current && (clearInterval(E.current), E.current = null);
|
|
873
873
|
};
|
|
874
874
|
return n.state !== "quote_success_internal" && n.state !== "quote_success_external" || !s || (E.current = setInterval(async () => {
|
|
875
875
|
await F({ isRefetch: !0 });
|
|
876
876
|
}, s)), L;
|
|
877
|
-
}, [
|
|
877
|
+
}, [T, F, B, n.state]);
|
|
878
878
|
}, me = {
|
|
879
879
|
sol: "sol",
|
|
880
880
|
evm: "eth",
|
|
881
881
|
near: "near"
|
|
882
|
-
},
|
|
882
|
+
}, tr = ({
|
|
883
883
|
isEnabled: e,
|
|
884
884
|
skipIntents: t = !1,
|
|
885
885
|
target: r = "none"
|
|
@@ -889,7 +889,7 @@ const $s = (e) => {
|
|
|
889
889
|
walletSupportedChains: c,
|
|
890
890
|
balances: l,
|
|
891
891
|
across: "intents"
|
|
892
|
-
}), [
|
|
892
|
+
}), [f, T] = v(() => !n.walletAddress && !t ? [
|
|
893
893
|
{ token: gn({ tokens: s }), status: "loaded" },
|
|
894
894
|
{ token: void 0, status: "loaded" }
|
|
895
895
|
] : d.source.intents !== "none" && !t ? i ? [
|
|
@@ -899,7 +899,7 @@ const $s = (e) => {
|
|
|
899
899
|
{ token: void 0, status: "loading" },
|
|
900
900
|
{ token: void 0, status: "loading" }
|
|
901
901
|
] : [
|
|
902
|
-
{ token:
|
|
902
|
+
{ token: hn({
|
|
903
903
|
tokens: s,
|
|
904
904
|
walletSupportedChains: c
|
|
905
905
|
}), status: "loaded" },
|
|
@@ -913,60 +913,60 @@ const $s = (e) => {
|
|
|
913
913
|
c,
|
|
914
914
|
a
|
|
915
915
|
]);
|
|
916
|
-
|
|
916
|
+
R(() => {
|
|
917
917
|
if (!e)
|
|
918
918
|
return;
|
|
919
|
-
if (D(n, ["initial_dry", "initial_wallet"]) && (
|
|
919
|
+
if (D(n, ["initial_dry", "initial_wallet"]) && (f.status === "loaded" && !n.sourceToken && p("tokenSelect", {
|
|
920
920
|
variant: "source",
|
|
921
|
-
token:
|
|
922
|
-
}),
|
|
923
|
-
let w =
|
|
921
|
+
token: f.token
|
|
922
|
+
}), T.status === "loaded" && f.status === "loaded" && !n.targetToken)) {
|
|
923
|
+
let w = T.token;
|
|
924
924
|
if (r === "same-asset")
|
|
925
|
-
if (
|
|
925
|
+
if (f.token?.isIntent) {
|
|
926
926
|
if (!u)
|
|
927
927
|
throw new Error(
|
|
928
928
|
"Intents account type is required to select same-asset target token"
|
|
929
929
|
);
|
|
930
930
|
w = s.find(
|
|
931
|
-
(
|
|
931
|
+
(N) => !N.isIntent && N.symbol === n.sourceToken?.symbol && N.blockchain === me[u]
|
|
932
932
|
);
|
|
933
933
|
} else
|
|
934
934
|
w = s.find(
|
|
935
|
-
(
|
|
935
|
+
(N) => N.isIntent && N.symbol === n.sourceToken?.symbol
|
|
936
936
|
);
|
|
937
937
|
p("tokenSelect", {
|
|
938
938
|
variant: "target",
|
|
939
939
|
token: w
|
|
940
940
|
});
|
|
941
941
|
}
|
|
942
|
-
}, [n,
|
|
943
|
-
const
|
|
944
|
-
const
|
|
945
|
-
(E) => !E.isIntent && E.blockchain === me[
|
|
942
|
+
}, [n, f, T, e]);
|
|
943
|
+
const I = (m, w) => {
|
|
944
|
+
const N = s.find(
|
|
945
|
+
(E) => !E.isIntent && E.blockchain === me[m] && E.symbol.toLowerCase() === en[me[m]]?.toLowerCase()
|
|
946
946
|
) ?? w;
|
|
947
947
|
p("tokenSelect", {
|
|
948
948
|
variant: "source",
|
|
949
|
-
token:
|
|
949
|
+
token: N
|
|
950
950
|
});
|
|
951
951
|
};
|
|
952
|
-
return
|
|
953
|
-
const
|
|
954
|
-
if (!e || !
|
|
952
|
+
return R(() => {
|
|
953
|
+
const m = D(n, ["initial_dry", "initial_wallet"]);
|
|
954
|
+
if (!e || !m)
|
|
955
955
|
return;
|
|
956
956
|
const w = s.find(
|
|
957
957
|
(E) => E.isIntent && E.symbol === "AURORA" && E.blockchain === "near"
|
|
958
|
-
),
|
|
959
|
-
|
|
958
|
+
), N = setTimeout(() => {
|
|
959
|
+
f.token || (!t && i ? p("tokenSelect", {
|
|
960
960
|
variant: "source",
|
|
961
961
|
token: i
|
|
962
|
-
}) : c.length && u ?
|
|
962
|
+
}) : c.length && u ? I(u, w) : n.walletAddress && ht(n.walletAddress) ? I("sol", w) : n.walletAddress && gt(n.walletAddress) ? I("evm", w) : n.walletAddress && Tt(n.walletAddress) ? I("near", w) : p("tokenSelect", {
|
|
963
963
|
variant: "source",
|
|
964
964
|
token: w
|
|
965
965
|
}));
|
|
966
966
|
}, 3e3);
|
|
967
|
-
return () => clearTimeout(
|
|
968
|
-
}, [s,
|
|
969
|
-
},
|
|
967
|
+
return () => clearTimeout(N);
|
|
968
|
+
}, [s, f, t]), { source: n.sourceToken, target: n.targetToken };
|
|
969
|
+
}, nr = ({
|
|
970
970
|
isEnabled: e,
|
|
971
971
|
alchemyApiKey: t
|
|
972
972
|
}) => {
|
|
@@ -976,13 +976,13 @@ const $s = (e) => {
|
|
|
976
976
|
connectedWallets: r,
|
|
977
977
|
alchemyApiKey: t ?? ""
|
|
978
978
|
});
|
|
979
|
-
},
|
|
980
|
-
const { config: r } =
|
|
979
|
+
}, sr = (e, t) => {
|
|
980
|
+
const { config: r } = Se(Ue);
|
|
981
981
|
return e.targetToken && !e.sendAddress && !!e.walletAddress && !e.targetToken.isIntent && !t.find((s) => s?.key === "sendAddress") && r.walletSupportedChains.includes(e.targetToken.blockchain);
|
|
982
|
-
},
|
|
982
|
+
}, rr = ({ debug: e }) => {
|
|
983
983
|
Z.onContextChange((t, r) => {
|
|
984
984
|
const s = r;
|
|
985
|
-
if (e && b.debug("[WIDGET] Context changed", s), e && t.error && An(s) && b.debug(`[WIDGET] Error set to ${t.error.code}`),
|
|
985
|
+
if (e && b.debug("[WIDGET] Context changed", s), e && t.error && An(s) && b.debug(`[WIDGET] Error set to ${t.error.code}`), Nn(s) || bn(t, s, e))
|
|
986
986
|
return;
|
|
987
987
|
if (_n(t, s)) {
|
|
988
988
|
p("reset", { clearWalletAddress: !0 }), O("initial_dry");
|
|
@@ -990,7 +990,7 @@ const $s = (e) => {
|
|
|
990
990
|
}
|
|
991
991
|
const { isChanged: n, isDry: a } = kn(t, s);
|
|
992
992
|
if (n) {
|
|
993
|
-
if (
|
|
993
|
+
if (Sn(t)) {
|
|
994
994
|
const l = a ? "initial_dry" : "initial_wallet";
|
|
995
995
|
O(l, {
|
|
996
996
|
onMoved: () => {
|
|
@@ -1000,15 +1000,15 @@ const $s = (e) => {
|
|
|
1000
1000
|
}
|
|
1001
1001
|
});
|
|
1002
1002
|
}
|
|
1003
|
-
wn(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), yn(t) && (t.sendAddress = void 0),
|
|
1003
|
+
wn(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), yn(t) && (t.sendAddress = void 0), sr(t, s) && (t.sendAddress = t.walletAddress), Ct(t);
|
|
1004
1004
|
}
|
|
1005
1005
|
});
|
|
1006
|
-
},
|
|
1006
|
+
}, ar = ({ debug: e }) => {
|
|
1007
1007
|
Z.onTransition((t, r) => {
|
|
1008
1008
|
e && b.debug(`===> [WIDGET] State moved from ${t} to ${r}`);
|
|
1009
1009
|
});
|
|
1010
|
-
},
|
|
1011
|
-
const { variant: r, token: s } = t, { config: n } =
|
|
1010
|
+
}, or = (e, t) => {
|
|
1011
|
+
const { variant: r, token: s } = t, { config: n } = Se(Ue);
|
|
1012
1012
|
switch (r) {
|
|
1013
1013
|
case "source":
|
|
1014
1014
|
if (s && s.assetId === e.targetToken?.assetId && s.isIntent === e.targetToken.isIntent && n.enableAutoTokensSwitching) {
|
|
@@ -1031,20 +1031,20 @@ const $s = (e) => {
|
|
|
1031
1031
|
e.targetToken = s;
|
|
1032
1032
|
break;
|
|
1033
1033
|
default:
|
|
1034
|
-
|
|
1034
|
+
Re(r, { throwError: !1 });
|
|
1035
1035
|
}
|
|
1036
|
-
},
|
|
1036
|
+
}, C = (e, t) => Z.on(
|
|
1037
1037
|
e,
|
|
1038
1038
|
(r, s) => t(r, s, Z)
|
|
1039
|
-
),
|
|
1040
|
-
|
|
1041
|
-
},
|
|
1039
|
+
), ir = () => {
|
|
1040
|
+
C("quoteSetStatus", xn), C("walletAddressSet", Bn), C("transferSetStatus", Un), C("tokenSelectRotate", we), C("tokenSetBalance", qn), C("tokenSetAmount", Dn), C("depositTypeSet", On), C("setInputsValidating", Ln), C("externalDepositTxSet", Fn), C("tokenSelect", or), C("addressSet", vn), C("errorSet", Rn), C("quoteSet", Cn), C("reset", En), C("validateDryInputs", bt), C("validateExternalInputs", Et), C("validateInternalInputs", Rt);
|
|
1041
|
+
}, cr = on(({ debug: e }) => {
|
|
1042
1042
|
e && b.debug(
|
|
1043
|
-
"[WIDGET] Debug mode is enabled (package version: 3.14.
|
|
1044
|
-
),
|
|
1045
|
-
}),
|
|
1046
|
-
|
|
1047
|
-
|
|
1043
|
+
"[WIDGET] Debug mode is enabled (package version: 3.14.2)"
|
|
1044
|
+
), ir(), ar({ debug: e }), rr({ debug: e });
|
|
1045
|
+
}), Bi = ({ listenTo: e, debug: t = !1 }) => {
|
|
1046
|
+
R(() => {
|
|
1047
|
+
cr({ debug: t });
|
|
1048
1048
|
}, [t]);
|
|
1049
1049
|
const r = e.find(
|
|
1050
1050
|
(a) => Array.isArray(a) && a[0] === "setBalancesUsingAlchemyExt"
|
|
@@ -1053,34 +1053,34 @@ const $s = (e) => {
|
|
|
1053
1053
|
), n = e.find(
|
|
1054
1054
|
(a) => Array.isArray(a) && a[0] === "makeQuote"
|
|
1055
1055
|
);
|
|
1056
|
-
|
|
1056
|
+
nr({
|
|
1057
1057
|
isEnabled: !!r,
|
|
1058
1058
|
alchemyApiKey: r?.[1].alchemyApiKey
|
|
1059
|
-
}),
|
|
1059
|
+
}), tr({
|
|
1060
1060
|
isEnabled: !!s,
|
|
1061
1061
|
skipIntents: s?.[1].skipIntents,
|
|
1062
1062
|
target: s?.[1].target
|
|
1063
|
-
}),
|
|
1063
|
+
}), er({
|
|
1064
1064
|
isEnabled: !!n,
|
|
1065
1065
|
message: n?.[1].message,
|
|
1066
1066
|
type: n?.[1].type,
|
|
1067
1067
|
refetchQuoteInterval: n?.[1].refetchQuoteInterval
|
|
1068
|
-
}),
|
|
1068
|
+
}), Ys({
|
|
1069
1069
|
isEnabled: e.includes("checkWalletConnection")
|
|
1070
|
-
}),
|
|
1070
|
+
}), js({
|
|
1071
1071
|
isEnabled: e.includes("setSourceTokenBalance")
|
|
1072
|
-
}),
|
|
1072
|
+
}), zs({
|
|
1073
1073
|
isEnabled: e.includes("setSourceTokenIntentsTarget")
|
|
1074
|
-
}),
|
|
1074
|
+
}), Gs({
|
|
1075
1075
|
isEnabled: e.includes("updateBalances"),
|
|
1076
1076
|
alchemyApiKey: r?.[1].alchemyApiKey
|
|
1077
1077
|
});
|
|
1078
|
-
},
|
|
1078
|
+
}, lr = Z.getStore();
|
|
1079
1079
|
class W extends Error {
|
|
1080
1080
|
context;
|
|
1081
1081
|
_is_widget_error = !0;
|
|
1082
1082
|
constructor(t, r) {
|
|
1083
|
-
super(t), this.name = "WidgetError", this.cause = r?.cause, this.context =
|
|
1083
|
+
super(t), this.name = "WidgetError", this.cause = r?.cause, this.context = Se(lr).context;
|
|
1084
1084
|
}
|
|
1085
1085
|
}
|
|
1086
1086
|
class vt extends W {
|
|
@@ -1094,12 +1094,12 @@ class q extends vt {
|
|
|
1094
1094
|
super(t), this.name = "QuoteError";
|
|
1095
1095
|
}
|
|
1096
1096
|
}
|
|
1097
|
-
class
|
|
1097
|
+
class g extends vt {
|
|
1098
1098
|
constructor(t) {
|
|
1099
1099
|
super(t), this.name = "TransferError";
|
|
1100
1100
|
}
|
|
1101
1101
|
}
|
|
1102
|
-
const
|
|
1102
|
+
const qi = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e && !!e._is_widget_error, V = Z.getStore(), dr = sn({
|
|
1103
1103
|
usdTradeDelta: (e) => Pn(e(V.context)),
|
|
1104
1104
|
isDirectNearTokenWithdrawal: (e) => Mn(e(V.context)),
|
|
1105
1105
|
isDirectNonNearWithdrawal: (e) => Wn(e(V.context)),
|
|
@@ -1107,20 +1107,20 @@ const Li = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
|
|
|
1107
1107
|
isNativeNearDeposit: (e) => rn(e(V.context)),
|
|
1108
1108
|
isSameAssetDiffChainWithdrawal: (e) => Qn(e(V.context)),
|
|
1109
1109
|
isDirectTokenOnNearTransfer: (e) => Vn(e(V.context))
|
|
1110
|
-
}),
|
|
1110
|
+
}), z = () => oe(dr), _ = () => {
|
|
1111
1111
|
const e = oe(V);
|
|
1112
1112
|
return {
|
|
1113
1113
|
state: e.state,
|
|
1114
1114
|
ctx: e.context
|
|
1115
1115
|
};
|
|
1116
|
-
},
|
|
1116
|
+
}, Ui = (e) => {
|
|
1117
1117
|
const t = oe(V);
|
|
1118
1118
|
if (!D(t.context, [e]))
|
|
1119
1119
|
throw new W(
|
|
1120
1120
|
`[WIDGET] Attempt to access snapshot for ${e} state while context does not match`
|
|
1121
1121
|
);
|
|
1122
1122
|
return t.context;
|
|
1123
|
-
},
|
|
1123
|
+
}, ur = async ({
|
|
1124
1124
|
contractId: e,
|
|
1125
1125
|
accountId: t
|
|
1126
1126
|
}) => {
|
|
@@ -1140,27 +1140,27 @@ const Li = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
|
|
|
1140
1140
|
throw new W("Error fetching balance", { cause: r });
|
|
1141
1141
|
}
|
|
1142
1142
|
};
|
|
1143
|
-
function
|
|
1144
|
-
const { ctx: t } = _(), { isNativeNearDeposit: r } =
|
|
1143
|
+
function mr(e) {
|
|
1144
|
+
const { ctx: t } = _(), { isNativeNearDeposit: r } = z(), s = t.sourceToken?.contractAddress, n = t.quote?.amountIn ?? t.sourceTokenAmount;
|
|
1145
1145
|
return {
|
|
1146
1146
|
make: async (l, c) => {
|
|
1147
1147
|
if (!e)
|
|
1148
|
-
throw new
|
|
1148
|
+
throw new g({
|
|
1149
1149
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1150
1150
|
meta: { message: "No connected wallet to sign a transfer." }
|
|
1151
1151
|
});
|
|
1152
1152
|
if (!s && t.sourceToken?.assetId !== $)
|
|
1153
|
-
throw new
|
|
1153
|
+
throw new g({
|
|
1154
1154
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1155
1155
|
meta: { message: "No token selected to transfer." }
|
|
1156
1156
|
});
|
|
1157
1157
|
if (!l)
|
|
1158
|
-
throw new
|
|
1158
|
+
throw new g({
|
|
1159
1159
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1160
1160
|
meta: { message: "No recipient address to transfer." }
|
|
1161
1161
|
});
|
|
1162
1162
|
if (!n)
|
|
1163
|
-
throw new
|
|
1163
|
+
throw new g({
|
|
1164
1164
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1165
1165
|
meta: { message: "No amount to transfer." }
|
|
1166
1166
|
});
|
|
@@ -1232,36 +1232,36 @@ function dr(e) {
|
|
|
1232
1232
|
transactionLink: `https://nearblocks.io/txns/${i[0].transaction?.hash}`,
|
|
1233
1233
|
intent: void 0
|
|
1234
1234
|
};
|
|
1235
|
-
throw new
|
|
1235
|
+
throw new g({
|
|
1236
1236
|
code: "NO_DEPOSIT_RESULT"
|
|
1237
1237
|
});
|
|
1238
1238
|
} catch (i) {
|
|
1239
|
-
throw b.error("[TRANSFER ERROR]", i), new
|
|
1239
|
+
throw b.error("[TRANSFER ERROR]", i), new g({
|
|
1240
1240
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1241
1241
|
});
|
|
1242
1242
|
}
|
|
1243
1243
|
if (!s)
|
|
1244
|
-
throw new
|
|
1244
|
+
throw new g({
|
|
1245
1245
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1246
1246
|
meta: { message: "No token selected to transfer." }
|
|
1247
1247
|
});
|
|
1248
1248
|
try {
|
|
1249
|
-
const [i,
|
|
1249
|
+
const [i, f] = await Promise.all([
|
|
1250
1250
|
Hn({
|
|
1251
1251
|
contractId: s
|
|
1252
1252
|
}),
|
|
1253
|
-
|
|
1253
|
+
ur({
|
|
1254
1254
|
contractId: s,
|
|
1255
1255
|
accountId: l
|
|
1256
1256
|
})
|
|
1257
|
-
]),
|
|
1258
|
-
|
|
1257
|
+
]), T = i - f;
|
|
1258
|
+
T > 0n && u.push({
|
|
1259
1259
|
type: "FunctionCall",
|
|
1260
1260
|
params: {
|
|
1261
1261
|
methodName: "storage_deposit",
|
|
1262
1262
|
args: { account_id: l },
|
|
1263
1263
|
gas: We,
|
|
1264
|
-
deposit:
|
|
1264
|
+
deposit: T.toString()
|
|
1265
1265
|
}
|
|
1266
1266
|
}), u.push({
|
|
1267
1267
|
type: "FunctionCall",
|
|
@@ -1276,7 +1276,7 @@ function dr(e) {
|
|
|
1276
1276
|
deposit: "1"
|
|
1277
1277
|
}
|
|
1278
1278
|
});
|
|
1279
|
-
const
|
|
1279
|
+
const I = await d.signAndSendTransactions({
|
|
1280
1280
|
transactions: [
|
|
1281
1281
|
{
|
|
1282
1282
|
receiverId: s,
|
|
@@ -1284,24 +1284,24 @@ function dr(e) {
|
|
|
1284
1284
|
}
|
|
1285
1285
|
]
|
|
1286
1286
|
});
|
|
1287
|
-
if (
|
|
1287
|
+
if (I?.[0]?.transaction?.hash)
|
|
1288
1288
|
return {
|
|
1289
|
-
hash:
|
|
1290
|
-
transactionLink: `https://nearblocks.io/txns/${
|
|
1289
|
+
hash: I[0].transaction?.hash ?? "",
|
|
1290
|
+
transactionLink: `https://nearblocks.io/txns/${I[0].transaction?.hash}`,
|
|
1291
1291
|
intent: void 0
|
|
1292
1292
|
};
|
|
1293
|
-
throw new
|
|
1293
|
+
throw new g({
|
|
1294
1294
|
code: "NO_DEPOSIT_RESULT"
|
|
1295
1295
|
});
|
|
1296
1296
|
} catch (i) {
|
|
1297
|
-
throw b.error("[TRANSFER ERROR]", i), new
|
|
1297
|
+
throw b.error("[TRANSFER ERROR]", i), new g({
|
|
1298
1298
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1299
1299
|
});
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
1302
|
};
|
|
1303
1303
|
}
|
|
1304
|
-
const
|
|
1304
|
+
const fr = ({
|
|
1305
1305
|
makeTransfer: e,
|
|
1306
1306
|
providers: t
|
|
1307
1307
|
}) => {
|
|
@@ -1315,9 +1315,9 @@ const ur = ({
|
|
|
1315
1315
|
return e;
|
|
1316
1316
|
if (gt(d))
|
|
1317
1317
|
return n;
|
|
1318
|
-
if (
|
|
1318
|
+
if (ht(d))
|
|
1319
1319
|
return a;
|
|
1320
|
-
throw new
|
|
1320
|
+
throw new g({
|
|
1321
1321
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1322
1322
|
meta: { message: "No transfer function established." }
|
|
1323
1323
|
});
|
|
@@ -1325,21 +1325,21 @@ const ur = ({
|
|
|
1325
1325
|
return { make: async () => {
|
|
1326
1326
|
if (!r.sourceToken) {
|
|
1327
1327
|
const i = "No token selected to transfer.";
|
|
1328
|
-
throw new
|
|
1328
|
+
throw new g({
|
|
1329
1329
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1330
1330
|
meta: { message: i }
|
|
1331
1331
|
});
|
|
1332
1332
|
}
|
|
1333
1333
|
if (!r.quote) {
|
|
1334
1334
|
const i = "Quote is required for a transfer.";
|
|
1335
|
-
throw new
|
|
1335
|
+
throw new g({
|
|
1336
1336
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1337
1337
|
meta: { message: i }
|
|
1338
1338
|
});
|
|
1339
1339
|
}
|
|
1340
1340
|
if (!r.quote.depositAddress) {
|
|
1341
1341
|
const i = "Quote has no deposit address. Make sure not dry.";
|
|
1342
|
-
throw new
|
|
1342
|
+
throw new g({
|
|
1343
1343
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1344
1344
|
meta: { message: i }
|
|
1345
1345
|
});
|
|
@@ -1349,7 +1349,7 @@ const ur = ({
|
|
|
1349
1349
|
decimals: r.sourceToken.decimals,
|
|
1350
1350
|
address: r.quote.depositAddress,
|
|
1351
1351
|
chain: r.sourceToken.blockchain,
|
|
1352
|
-
evmChainId: Q(r.sourceToken.blockchain) ?
|
|
1352
|
+
evmChainId: Q(r.sourceToken.blockchain) ? he[r.sourceToken.blockchain] : null,
|
|
1353
1353
|
isNativeEvmTokenTransfer: !!r.sourceToken && It(r.sourceToken),
|
|
1354
1354
|
tokenAddress: r.sourceToken.assetId === $ ? $ : r.sourceToken.contractAddress,
|
|
1355
1355
|
sourceAssetId: r.sourceToken.assetId,
|
|
@@ -1360,7 +1360,7 @@ const ur = ({
|
|
|
1360
1360
|
if (!i) {
|
|
1361
1361
|
if (e)
|
|
1362
1362
|
return;
|
|
1363
|
-
throw b.error("[TRANSFER ERROR]", "No deposit result"), new
|
|
1363
|
+
throw b.error("[TRANSFER ERROR]", "No deposit result"), new g({
|
|
1364
1364
|
code: "NO_DEPOSIT_RESULT"
|
|
1365
1365
|
});
|
|
1366
1366
|
}
|
|
@@ -1371,26 +1371,26 @@ const ur = ({
|
|
|
1371
1371
|
};
|
|
1372
1372
|
} catch (i) {
|
|
1373
1373
|
b.error("[TRANSFER ERROR]", i, { error: i });
|
|
1374
|
-
let
|
|
1375
|
-
const
|
|
1376
|
-
if (
|
|
1374
|
+
let f = "Failed to make a transfer. Please try again.";
|
|
1375
|
+
const T = i instanceof Error && Ae(i.message);
|
|
1376
|
+
if (T)
|
|
1377
1377
|
return;
|
|
1378
|
-
throw fn.isAxiosError(i) ? (
|
|
1378
|
+
throw fn.isAxiosError(i) ? (f = i.response?.data?.detail ?? i.message ?? "Failed to make deposit. Please try again.", new g({
|
|
1379
1379
|
code: "QUOTE_ERROR",
|
|
1380
|
-
meta: { message:
|
|
1381
|
-
})) :
|
|
1380
|
+
meta: { message: f }
|
|
1381
|
+
})) : f === "No quotes found" ? new g({
|
|
1382
1382
|
code: "NO_QUOTE_FOUND"
|
|
1383
|
-
}) : i instanceof Error && !
|
|
1383
|
+
}) : i instanceof Error && !T ? new g({
|
|
1384
1384
|
code: "QUOTE_ERROR",
|
|
1385
1385
|
meta: { message: i.message }
|
|
1386
|
-
}) : new
|
|
1386
|
+
}) : new g({
|
|
1387
1387
|
code: "QUOTE_ERROR",
|
|
1388
1388
|
meta: { message: "Unknown quote transfer error" }
|
|
1389
1389
|
});
|
|
1390
1390
|
}
|
|
1391
1391
|
} };
|
|
1392
1392
|
};
|
|
1393
|
-
class
|
|
1393
|
+
class pr {
|
|
1394
1394
|
constructor(t, r) {
|
|
1395
1395
|
this.account = t, this.provider = r;
|
|
1396
1396
|
}
|
|
@@ -1419,7 +1419,7 @@ class mr {
|
|
|
1419
1419
|
};
|
|
1420
1420
|
}
|
|
1421
1421
|
}
|
|
1422
|
-
const
|
|
1422
|
+
const Tr = ({
|
|
1423
1423
|
walletAddress: e,
|
|
1424
1424
|
getProvider: t
|
|
1425
1425
|
}) => zn({
|
|
@@ -1446,25 +1446,25 @@ const fr = ({
|
|
|
1446
1446
|
signature: n.signature
|
|
1447
1447
|
};
|
|
1448
1448
|
}
|
|
1449
|
-
}),
|
|
1449
|
+
}), hr = (e, t) => {
|
|
1450
1450
|
if (t) {
|
|
1451
1451
|
if (e.sendAddress)
|
|
1452
1452
|
return e.sendAddress;
|
|
1453
|
-
throw new
|
|
1453
|
+
throw new g({
|
|
1454
1454
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1455
1455
|
meta: { message: "Send to address is required for a direct transfer" }
|
|
1456
1456
|
});
|
|
1457
1457
|
}
|
|
1458
1458
|
if (!e.quote || e.quote.dry)
|
|
1459
|
-
throw new
|
|
1459
|
+
throw new g({
|
|
1460
1460
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1461
1461
|
meta: { message: "Quote is required for intents non-direct transfer" }
|
|
1462
1462
|
});
|
|
1463
1463
|
return e.quote.depositAddress;
|
|
1464
|
-
},
|
|
1464
|
+
}, gr = async (e, t) => {
|
|
1465
1465
|
let r = Me.getItem("nearWalletsPk")[t];
|
|
1466
1466
|
if (!e.signMessage)
|
|
1467
|
-
throw new
|
|
1467
|
+
throw new g({
|
|
1468
1468
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1469
1469
|
meta: { message: "Your wallet doesn't support signing messages" }
|
|
1470
1470
|
});
|
|
@@ -1473,10 +1473,10 @@ const fr = ({
|
|
|
1473
1473
|
const a = await e.signMessage({
|
|
1474
1474
|
message: "Authenticate",
|
|
1475
1475
|
recipient: "intents.near",
|
|
1476
|
-
nonce: Fe.from(
|
|
1476
|
+
nonce: Fe.from(ts(32))
|
|
1477
1477
|
});
|
|
1478
1478
|
if (!a)
|
|
1479
|
-
throw new
|
|
1479
|
+
throw new g({
|
|
1480
1480
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1481
1481
|
meta: { message: "Signing message failed" }
|
|
1482
1482
|
});
|
|
@@ -1484,7 +1484,7 @@ const fr = ({
|
|
|
1484
1484
|
[t]: a.publicKey
|
|
1485
1485
|
});
|
|
1486
1486
|
} catch {
|
|
1487
|
-
throw new
|
|
1487
|
+
throw new g({
|
|
1488
1488
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1489
1489
|
meta: { message: "Your wallet doesn't support signing messages" }
|
|
1490
1490
|
});
|
|
@@ -1493,7 +1493,7 @@ const fr = ({
|
|
|
1493
1493
|
walletAddress: t,
|
|
1494
1494
|
addressType: "near"
|
|
1495
1495
|
});
|
|
1496
|
-
if (!await
|
|
1496
|
+
if (!await ss({
|
|
1497
1497
|
contractId: ke,
|
|
1498
1498
|
methodName: "has_public_key",
|
|
1499
1499
|
args: {
|
|
@@ -1522,33 +1522,33 @@ const fr = ({
|
|
|
1522
1522
|
]
|
|
1523
1523
|
});
|
|
1524
1524
|
} catch {
|
|
1525
|
-
throw new
|
|
1525
|
+
throw new g({
|
|
1526
1526
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1527
1527
|
meta: { message: "Unable to add public key to intents account" }
|
|
1528
1528
|
});
|
|
1529
1529
|
}
|
|
1530
|
-
},
|
|
1530
|
+
}, Ir = ({ providers: e }) => {
|
|
1531
1531
|
const { ctx: t } = _(), { appName: r, intentsAccountType: s } = y(), {
|
|
1532
1532
|
isNativeNearDeposit: n,
|
|
1533
1533
|
isDirectNearTokenWithdrawal: a,
|
|
1534
1534
|
isDirectNonNearWithdrawal: l
|
|
1535
|
-
} =
|
|
1535
|
+
} = z();
|
|
1536
1536
|
return { make: async ({
|
|
1537
1537
|
message: d,
|
|
1538
1538
|
onPending: u
|
|
1539
1539
|
}) => {
|
|
1540
1540
|
if (!t.walletAddress)
|
|
1541
|
-
throw new
|
|
1541
|
+
throw new g({
|
|
1542
1542
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1543
1543
|
meta: { message: "No connected wallet to sign a transfer." }
|
|
1544
1544
|
});
|
|
1545
1545
|
if (!t.sourceToken || !t.targetToken)
|
|
1546
|
-
throw new
|
|
1546
|
+
throw new g({
|
|
1547
1547
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1548
1548
|
meta: { message: "No token selected to transfer." }
|
|
1549
1549
|
});
|
|
1550
1550
|
if (!t.sourceToken.isIntent)
|
|
1551
|
-
throw new
|
|
1551
|
+
throw new g({
|
|
1552
1552
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1553
1553
|
meta: {
|
|
1554
1554
|
message: "For not intents source token use useMakeQuoteTransfer instead"
|
|
@@ -1556,90 +1556,105 @@ const fr = ({
|
|
|
1556
1556
|
});
|
|
1557
1557
|
let i;
|
|
1558
1558
|
if (!s)
|
|
1559
|
-
throw new
|
|
1559
|
+
throw new g({
|
|
1560
1560
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1561
1561
|
meta: { message: "Intents account type is not defined" }
|
|
1562
1562
|
});
|
|
1563
1563
|
switch (s) {
|
|
1564
1564
|
case "evm":
|
|
1565
1565
|
if (!e?.evm)
|
|
1566
|
-
throw new
|
|
1566
|
+
throw new g({
|
|
1567
1567
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1568
1568
|
meta: { message: "No EVM provider configured" }
|
|
1569
1569
|
});
|
|
1570
|
-
i = new
|
|
1570
|
+
i = new pr(
|
|
1571
1571
|
{ walletAddress: t.walletAddress },
|
|
1572
1572
|
e.evm
|
|
1573
1573
|
);
|
|
1574
1574
|
break;
|
|
1575
1575
|
case "sol":
|
|
1576
1576
|
if (!e?.sol)
|
|
1577
|
-
throw new
|
|
1577
|
+
throw new g({
|
|
1578
1578
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1579
1579
|
meta: { message: "No SOL provider configured" }
|
|
1580
1580
|
});
|
|
1581
|
-
i = new
|
|
1581
|
+
i = new ns(
|
|
1582
1582
|
{ walletAddress: t.walletAddress },
|
|
1583
1583
|
e.sol
|
|
1584
1584
|
);
|
|
1585
1585
|
break;
|
|
1586
1586
|
case "near": {
|
|
1587
1587
|
if (!e?.near)
|
|
1588
|
-
throw new
|
|
1588
|
+
throw new g({
|
|
1589
1589
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1590
1590
|
meta: { message: "No NEAR provider configured" }
|
|
1591
1591
|
});
|
|
1592
|
-
await
|
|
1592
|
+
await gr(e.near(), t.walletAddress), i = Tr({
|
|
1593
1593
|
walletAddress: t.walletAddress,
|
|
1594
1594
|
getProvider: e.near
|
|
1595
1595
|
});
|
|
1596
1596
|
break;
|
|
1597
1597
|
}
|
|
1598
1598
|
default:
|
|
1599
|
-
|
|
1599
|
+
Re(s);
|
|
1600
1600
|
}
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1603
|
-
let
|
|
1604
|
-
n ?
|
|
1605
|
-
const
|
|
1601
|
+
const f = new Yn({ referral: dt(r) });
|
|
1602
|
+
f.setIntentSigner(i);
|
|
1603
|
+
let T;
|
|
1604
|
+
n ? T = void 0 : a ? T = Zn(d ?? void 0) : l ? T = void 0 : T = Xn();
|
|
1605
|
+
const I = f.createWithdrawal({
|
|
1606
1606
|
withdrawalParams: {
|
|
1607
1607
|
assetId: t.sourceToken.assetId,
|
|
1608
1608
|
amount: BigInt(t.sourceTokenAmount),
|
|
1609
|
-
destinationAddress:
|
|
1609
|
+
destinationAddress: hr(
|
|
1610
1610
|
t,
|
|
1611
1611
|
a || l
|
|
1612
1612
|
),
|
|
1613
1613
|
destinationMemo: void 0,
|
|
1614
1614
|
feeInclusive: !1,
|
|
1615
|
-
routeConfig:
|
|
1615
|
+
routeConfig: T
|
|
1616
1616
|
}
|
|
1617
1617
|
});
|
|
1618
1618
|
try {
|
|
1619
|
-
await
|
|
1620
|
-
const
|
|
1619
|
+
await I.estimateFee(), u("WAITING_CONFIRMATION");
|
|
1620
|
+
const m = await I.signAndSendIntent();
|
|
1621
1621
|
u("PROCESSING");
|
|
1622
|
-
const w = await
|
|
1623
|
-
return await
|
|
1622
|
+
const w = await I.waitForIntentSettlement();
|
|
1623
|
+
return await I.waitForWithdrawalCompletion(), {
|
|
1624
1624
|
hash: w.hash,
|
|
1625
|
-
transactionLink:
|
|
1626
|
-
intent:
|
|
1625
|
+
transactionLink: rs(tn.near, w.hash),
|
|
1626
|
+
intent: m
|
|
1627
1627
|
};
|
|
1628
|
-
} catch (
|
|
1629
|
-
if (b.error("[TRANSFER ERROR]",
|
|
1630
|
-
|
|
1631
|
-
|
|
1628
|
+
} catch (m) {
|
|
1629
|
+
if (b.error("[TRANSFER ERROR]", m), m instanceof Jn)
|
|
1630
|
+
throw new g({
|
|
1631
|
+
code: "MIN_WITHDRAWAL_AMOUNT_ERROR",
|
|
1632
|
+
meta: {
|
|
1633
|
+
minAmount: j(
|
|
1634
|
+
m.minAmount.toString(),
|
|
1635
|
+
t.sourceToken.decimals
|
|
1636
|
+
)
|
|
1637
|
+
}
|
|
1638
|
+
});
|
|
1639
|
+
if (m instanceof es)
|
|
1640
|
+
throw new g({
|
|
1641
|
+
code: "TRANSFER_INVALID_INITIAL",
|
|
1642
|
+
meta: { message: "Fee is above the maximum allowed" }
|
|
1643
|
+
});
|
|
1644
|
+
if (m instanceof Error) {
|
|
1645
|
+
if (m.message.includes("Fee is not estimated"))
|
|
1646
|
+
throw new g({
|
|
1632
1647
|
code: "FEES_NOT_ESTIMATED"
|
|
1633
1648
|
});
|
|
1634
|
-
if (Ae(
|
|
1649
|
+
if (Ae(m.message) || Ae(`${m.cause}`))
|
|
1635
1650
|
return;
|
|
1636
1651
|
}
|
|
1637
|
-
throw new
|
|
1652
|
+
throw new g({
|
|
1638
1653
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1639
1654
|
});
|
|
1640
1655
|
}
|
|
1641
1656
|
} };
|
|
1642
|
-
},
|
|
1657
|
+
}, wr = ({
|
|
1643
1658
|
message: e,
|
|
1644
1659
|
providers: t,
|
|
1645
1660
|
makeTransfer: r
|
|
@@ -1648,121 +1663,121 @@ const fr = ({
|
|
|
1648
1663
|
isDirectTokenOnNearDeposit: n,
|
|
1649
1664
|
isDirectTokenOnNearTransfer: a,
|
|
1650
1665
|
isNativeNearDeposit: l
|
|
1651
|
-
} =
|
|
1666
|
+
} = z(), { make: c } = Ir({ providers: t }), { make: d } = fr({
|
|
1652
1667
|
makeTransfer: r,
|
|
1653
1668
|
providers: t
|
|
1654
|
-
}), { make: u } =
|
|
1669
|
+
}), { make: u } = mr(
|
|
1655
1670
|
t?.near
|
|
1656
1671
|
);
|
|
1657
1672
|
return { make: async () => {
|
|
1658
1673
|
if (!s.targetToken)
|
|
1659
1674
|
return;
|
|
1660
|
-
let
|
|
1675
|
+
let f;
|
|
1661
1676
|
try {
|
|
1662
1677
|
if (p("transferSetStatus", {
|
|
1663
1678
|
status: "pending",
|
|
1664
1679
|
reason: "WAITING_CONFIRMATION"
|
|
1665
1680
|
}), s.sourceToken?.isIntent)
|
|
1666
|
-
|
|
1681
|
+
f = await c({
|
|
1667
1682
|
message: e,
|
|
1668
|
-
onPending: (
|
|
1683
|
+
onPending: (T) => {
|
|
1669
1684
|
p("transferSetStatus", {
|
|
1670
1685
|
status: "pending",
|
|
1671
|
-
reason:
|
|
1686
|
+
reason: T
|
|
1672
1687
|
});
|
|
1673
1688
|
}
|
|
1674
1689
|
});
|
|
1675
1690
|
else if ((l || n) && !s.isDepositFromExternalWallet)
|
|
1676
|
-
|
|
1691
|
+
f = await u(
|
|
1677
1692
|
s.sendAddress ?? ke,
|
|
1678
1693
|
e
|
|
1679
1694
|
);
|
|
1680
1695
|
else if (a) {
|
|
1681
1696
|
if (!s.sendAddress)
|
|
1682
|
-
throw new
|
|
1697
|
+
throw new g({
|
|
1683
1698
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1684
1699
|
meta: { message: "No recipient address to transfer" }
|
|
1685
1700
|
});
|
|
1686
|
-
|
|
1701
|
+
f = await u(
|
|
1687
1702
|
s.sendAddress,
|
|
1688
1703
|
e
|
|
1689
1704
|
);
|
|
1690
1705
|
} else
|
|
1691
|
-
|
|
1692
|
-
} catch (
|
|
1693
|
-
|
|
1706
|
+
f = await d();
|
|
1707
|
+
} catch (T) {
|
|
1708
|
+
T instanceof g && (b.error(T.data), p("transferSetStatus", { status: "error" }), p("errorSet", T.data));
|
|
1694
1709
|
}
|
|
1695
|
-
if (!
|
|
1710
|
+
if (!f) {
|
|
1696
1711
|
p("transferSetStatus", { status: "idle" });
|
|
1697
1712
|
return;
|
|
1698
1713
|
}
|
|
1699
|
-
return p("transferSetStatus", { status: "success" }), O("transfer_success"),
|
|
1714
|
+
return p("transferSetStatus", { status: "success" }), O("transfer_success"), f;
|
|
1700
1715
|
} };
|
|
1701
|
-
},
|
|
1716
|
+
}, kr = async (e) => {
|
|
1702
1717
|
if (!e)
|
|
1703
1718
|
return;
|
|
1704
1719
|
const t = await e.request({
|
|
1705
1720
|
method: "eth_chainId"
|
|
1706
1721
|
});
|
|
1707
1722
|
return parseInt(t, 16);
|
|
1708
|
-
},
|
|
1709
|
-
const { ctx: t } = _(), [r, s] = re(!1), [n, a] = re(!1), l =
|
|
1723
|
+
}, Ar = ({ providers: e }) => {
|
|
1724
|
+
const { ctx: t } = _(), [r, s] = re(!1), [n, a] = re(!1), l = Te(async () => {
|
|
1710
1725
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1711
1726
|
if (!t.sourceToken || !d)
|
|
1712
1727
|
return !1;
|
|
1713
|
-
const u = await
|
|
1728
|
+
const u = await kr(d);
|
|
1714
1729
|
if (!Q(t.sourceToken.blockchain))
|
|
1715
1730
|
return !1;
|
|
1716
|
-
const i =
|
|
1731
|
+
const i = he[t.sourceToken.blockchain];
|
|
1717
1732
|
return !i || !u ? !1 : u !== i;
|
|
1718
|
-
}, [t.sourceToken, e]), c =
|
|
1733
|
+
}, [t.sourceToken, e]), c = Te(async () => {
|
|
1719
1734
|
const d = typeof e?.evm == "function" ? await e.evm() : e?.evm;
|
|
1720
1735
|
if (!t.sourceToken || !d || !Q(t.sourceToken.blockchain))
|
|
1721
1736
|
return !1;
|
|
1722
|
-
const u =
|
|
1737
|
+
const u = he[t.sourceToken.blockchain];
|
|
1723
1738
|
if (!u)
|
|
1724
1739
|
return !1;
|
|
1725
1740
|
try {
|
|
1726
|
-
return s(!0), await
|
|
1741
|
+
return s(!0), await as(u, d), !0;
|
|
1727
1742
|
} catch (i) {
|
|
1728
1743
|
return b.error("Failed to switch chain:", i), !1;
|
|
1729
1744
|
} finally {
|
|
1730
1745
|
s(!1);
|
|
1731
1746
|
}
|
|
1732
1747
|
}, [t.sourceToken, e]);
|
|
1733
|
-
return
|
|
1748
|
+
return R(() => {
|
|
1734
1749
|
l().then(a);
|
|
1735
1750
|
}, [l]), {
|
|
1736
1751
|
isSwitchingChainRequired: n,
|
|
1737
1752
|
switchChain: c,
|
|
1738
1753
|
isSwitchingChain: r
|
|
1739
1754
|
};
|
|
1740
|
-
},
|
|
1755
|
+
}, S = {
|
|
1741
1756
|
size: "lg",
|
|
1742
1757
|
variant: "primary"
|
|
1743
1758
|
}, Le = (e) => {
|
|
1744
1759
|
const { t } = M();
|
|
1745
1760
|
if (e.error?.code === "TOKEN_IS_NOT_SUPPORTED")
|
|
1746
|
-
return /* @__PURE__ */ o(A, { state: "error", ...
|
|
1761
|
+
return /* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.invalidAddress", "Invalid address") });
|
|
1747
1762
|
if (e.state === "initial_wallet" && e.error?.code === "SEND_ADDRESS_IS_EMPTY")
|
|
1748
|
-
return /* @__PURE__ */ o(A, { state: "disabled", ...
|
|
1763
|
+
return /* @__PURE__ */ o(A, { state: "disabled", ...S, children: t("submit.disabled.enterRecipientAddress", "Enter recipient address") });
|
|
1749
1764
|
if (e.state === "initial_wallet" && e.error?.code === "SEND_ADDRESS_IS_NOT_FOUND")
|
|
1750
|
-
return /* @__PURE__ */ o(A, { state: "error", ...
|
|
1765
|
+
return /* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.sendAddressNotFound", {
|
|
1751
1766
|
defaultValue: "Address not found on {{chain}}",
|
|
1752
1767
|
chain: e.error.meta.chain.toUpperCase()
|
|
1753
1768
|
}) });
|
|
1754
1769
|
if (e.state === "initial_wallet" && e.error?.code === "SEND_ADDRESS_IS_INVALID")
|
|
1755
|
-
return /* @__PURE__ */ o(A, { state: "error", ...
|
|
1770
|
+
return /* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.sendAddressInvalid", {
|
|
1756
1771
|
defaultValue: "Invalid {{chain}} address",
|
|
1757
1772
|
chain: e.error.meta.chain.toUpperCase()
|
|
1758
1773
|
}) });
|
|
1759
|
-
if (e.error?.code === "QUOTE_AMOUNT_IS_TOO_LOW")
|
|
1760
|
-
return /* @__PURE__ */
|
|
1761
|
-
/* @__PURE__ */ o(A, { state: "error", ...
|
|
1762
|
-
/* @__PURE__ */ o(K, { children: /* @__PURE__ */
|
|
1774
|
+
if (e.error?.code === "QUOTE_AMOUNT_IS_TOO_LOW" || e.error?.code === "MIN_WITHDRAWAL_AMOUNT_ERROR")
|
|
1775
|
+
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1776
|
+
/* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.amountTooLow.label", "Amount is too low") }),
|
|
1777
|
+
/* @__PURE__ */ o(K, { children: /* @__PURE__ */ h(Gt, { i18nKey: "submit.error.amountTooLow.message", children: [
|
|
1763
1778
|
"Amount you entered is very low. Please try increasing it",
|
|
1764
1779
|
" ",
|
|
1765
|
-
/* @__PURE__ */
|
|
1780
|
+
/* @__PURE__ */ h("span", { className: "text-nowrap", children: [
|
|
1766
1781
|
"above ",
|
|
1767
1782
|
/* @__PURE__ */ o(Oe, { value: e.error.meta.minAmount ?? "0" }),
|
|
1768
1783
|
" ",
|
|
@@ -1772,81 +1787,81 @@ const fr = ({
|
|
|
1772
1787
|
] }) })
|
|
1773
1788
|
] });
|
|
1774
1789
|
if (e.quoteStatus === "error")
|
|
1775
|
-
return /* @__PURE__ */
|
|
1776
|
-
/* @__PURE__ */ o(A, { state: "error", ...
|
|
1790
|
+
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1791
|
+
/* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.quoteFailed.label", "Quote failed") }),
|
|
1777
1792
|
/* @__PURE__ */ o(K, { children: t(
|
|
1778
1793
|
"submit.error.quoteFailed.message",
|
|
1779
1794
|
"We couldn’t finalize your quote. Please try again or adjust your values."
|
|
1780
1795
|
) })
|
|
1781
1796
|
] });
|
|
1782
1797
|
if (e.error?.code === "TRANSFER_INVALID_INITIAL")
|
|
1783
|
-
return /* @__PURE__ */
|
|
1784
|
-
/* @__PURE__ */ o(A, { state: "error", ...
|
|
1798
|
+
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1799
|
+
/* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.invalidTransferData.label", "Invalid transfer data") }),
|
|
1785
1800
|
e.error.meta?.message ? /* @__PURE__ */ o(K, { children: e.error.meta.message }) : null
|
|
1786
1801
|
] });
|
|
1787
1802
|
if (e.error?.code === "EXTERNAL_TRANSFER_FAILED")
|
|
1788
|
-
return /* @__PURE__ */ o(A, { state: "error", ...
|
|
1803
|
+
return /* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.externalTransferFailed.label", "Transfer failed") });
|
|
1789
1804
|
if (e.error?.code === "EXTERNAL_TRANSFER_INCOMPLETE")
|
|
1790
|
-
return /* @__PURE__ */
|
|
1791
|
-
/* @__PURE__ */ o(A, { state: "error", ...
|
|
1805
|
+
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1806
|
+
/* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.externalTransferFailed.label", "Transfer failed") }),
|
|
1792
1807
|
/* @__PURE__ */ o(K, { children: t(
|
|
1793
1808
|
"submit.error.externalTransferFailed.incompleteMessage",
|
|
1794
1809
|
"Incomplete transfer. Deposited amount will be refunded."
|
|
1795
1810
|
) })
|
|
1796
1811
|
] });
|
|
1797
1812
|
if (e.error?.code === "EXTERNAL_TRANSFER_REFUNDED")
|
|
1798
|
-
return /* @__PURE__ */
|
|
1799
|
-
/* @__PURE__ */ o(A, { state: "error", ...
|
|
1813
|
+
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1814
|
+
/* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.externalTransferFailed.label", "Transfer failed") }),
|
|
1800
1815
|
/* @__PURE__ */ o(K, { children: t(
|
|
1801
1816
|
"submit.error.externalTransferFailed.refundedMessage",
|
|
1802
1817
|
"Deposited amount will be refunded."
|
|
1803
1818
|
) })
|
|
1804
1819
|
] });
|
|
1805
1820
|
if (e.error?.code === "DIRECT_TRANSFER_ERROR")
|
|
1806
|
-
return /* @__PURE__ */
|
|
1807
|
-
/* @__PURE__ */ o(A, { state: "error", ...
|
|
1821
|
+
return /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1822
|
+
/* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.transferFailed.label", "Transfer failed") }),
|
|
1808
1823
|
e.error.meta?.message ? /* @__PURE__ */ o(K, { children: e.error.meta.message }) : null
|
|
1809
1824
|
] });
|
|
1810
1825
|
if (e.error?.code === "SOURCE_BALANCE_INSUFFICIENT")
|
|
1811
|
-
return /* @__PURE__ */ o(A, { state: "error", ...
|
|
1812
|
-
},
|
|
1826
|
+
return /* @__PURE__ */ o(A, { state: "error", ...S, children: t("submit.error.insufficientBalance", "Insufficient balance") });
|
|
1827
|
+
}, Nr = ({ onClick: e }) => {
|
|
1813
1828
|
const { t } = M();
|
|
1814
|
-
return /* @__PURE__ */ o(A, { state: "disabled", ...
|
|
1815
|
-
},
|
|
1829
|
+
return /* @__PURE__ */ o(A, { state: "disabled", ...S, onClick: e, children: t("submit.error.connectWallet", "Connect wallet") });
|
|
1830
|
+
}, Sr = () => {
|
|
1816
1831
|
const { ctx: e } = _();
|
|
1817
1832
|
return Le(e) ?? null;
|
|
1818
|
-
},
|
|
1833
|
+
}, _r = (e) => {
|
|
1819
1834
|
const { providers: t, makeTransfer: r, onSuccess: s } = e, { ctx: n } = _(), { t: a } = M(), {
|
|
1820
1835
|
isNativeNearDeposit: l,
|
|
1821
1836
|
isDirectNonNearWithdrawal: c,
|
|
1822
1837
|
isDirectTokenOnNearDeposit: d,
|
|
1823
1838
|
isDirectNearTokenWithdrawal: u
|
|
1824
|
-
} =
|
|
1825
|
-
if (
|
|
1839
|
+
} = z(), { make: i } = wr({ providers: t, makeTransfer: r }), { isSwitchingChainRequired: f, switchChain: T, isSwitchingChain: I } = Ar({ providers: t }), m = Le(n), w = async () => {
|
|
1840
|
+
if (f && !await T())
|
|
1826
1841
|
return;
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1842
|
+
const N = await i();
|
|
1843
|
+
N && s(N);
|
|
1829
1844
|
};
|
|
1830
1845
|
if (!n.targetToken)
|
|
1831
|
-
return /* @__PURE__ */ o(A, { ...
|
|
1846
|
+
return /* @__PURE__ */ o(A, { ...S, state: "disabled", children: a("submit.disabled.selectTokenToReceive", "Select token to receive") });
|
|
1832
1847
|
if (!ne(n.sourceTokenAmount))
|
|
1833
|
-
return /* @__PURE__ */ o(A, { ...
|
|
1848
|
+
return /* @__PURE__ */ o(A, { ...S, state: "disabled", children: a("submit.disabled.enterAmount", "Enter amount") });
|
|
1834
1849
|
if (n.areInputsValidating)
|
|
1835
|
-
return /* @__PURE__ */ o(A, { state: "loading", ...
|
|
1836
|
-
if (
|
|
1837
|
-
return /* @__PURE__ */ o(A, { state: "loading", ...
|
|
1838
|
-
if (!
|
|
1839
|
-
return
|
|
1850
|
+
return /* @__PURE__ */ o(A, { state: "loading", ...S, children: a("submit.pending.validating", "Validating...") });
|
|
1851
|
+
if (I)
|
|
1852
|
+
return /* @__PURE__ */ o(A, { state: "loading", ...S, children: a("submit.pending.switchingChain", "Switching network...") });
|
|
1853
|
+
if (!f && m)
|
|
1854
|
+
return m;
|
|
1840
1855
|
if (n.transferStatus.status === "pending")
|
|
1841
1856
|
switch (n.transferStatus.reason) {
|
|
1842
1857
|
case "WAITING_CONFIRMATION":
|
|
1843
|
-
return /* @__PURE__ */ o(A, { state: "loading", ...
|
|
1858
|
+
return /* @__PURE__ */ o(A, { state: "loading", ...S, children: a("submit.pending.transfer.confirmInWallet", "Confirm in wallet") });
|
|
1844
1859
|
case "PROCESSING":
|
|
1845
1860
|
default:
|
|
1846
|
-
return /* @__PURE__ */ o(A, { state: "loading", ...
|
|
1861
|
+
return /* @__PURE__ */ o(A, { state: "loading", ...S, children: a("submit.pending.transfer.finalizing", "Finalizing transfer") });
|
|
1847
1862
|
}
|
|
1848
|
-
return n.transferStatus.status === "error" ? /* @__PURE__ */
|
|
1849
|
-
/* @__PURE__ */ o(A, { ...
|
|
1863
|
+
return n.transferStatus.status === "error" ? /* @__PURE__ */ h("div", { className: "gap-sw-md flex flex-col", children: [
|
|
1864
|
+
/* @__PURE__ */ o(A, { ...S, children: e.label }),
|
|
1850
1865
|
/* @__PURE__ */ o(K, { children: (() => {
|
|
1851
1866
|
switch (n.error?.code) {
|
|
1852
1867
|
case "FEES_NOT_ESTIMATED":
|
|
@@ -1861,39 +1876,39 @@ const fr = ({
|
|
|
1861
1876
|
);
|
|
1862
1877
|
}
|
|
1863
1878
|
})() })
|
|
1864
|
-
] }) : n.quoteStatus === "pending" ? /* @__PURE__ */ o(A, { state: "loading", ...
|
|
1865
|
-
},
|
|
1879
|
+
] }) : n.quoteStatus === "pending" ? /* @__PURE__ */ o(A, { state: "loading", ...S, children: n.quote ? a("submit.pending.quote.refreshing", "Refreshing quote") : a("submit.pending.quote.finalizing", "Finalizing quote") }) : n.error ? /* @__PURE__ */ o(A, { state: "disabled", ...S, children: e.label }) : !n.quote && !c && !d && !u && !l ? /* @__PURE__ */ o(A, { state: "disabled", ...S, children: e.label }) : /* @__PURE__ */ o(A, { ...S, onClick: w, children: e.label });
|
|
1880
|
+
}, yr = (e) => {
|
|
1866
1881
|
const { t } = M(), { ctx: r } = _(), s = Le(r);
|
|
1867
|
-
return r.isDepositFromExternalWallet ? ne(r.sourceTokenAmount) ? r.externalDepositTxReceived ? /* @__PURE__ */ o(A, { state: "loading", ...
|
|
1868
|
-
},
|
|
1882
|
+
return r.isDepositFromExternalWallet ? ne(r.sourceTokenAmount) ? r.externalDepositTxReceived ? /* @__PURE__ */ o(A, { state: "loading", ...S, children: t("submit.pending.externalDeposit.processing", "Processing") }) : /* @__PURE__ */ o(A, { state: "loading", ...S, children: t("submit.pending.externalDeposit.waiting", "Waiting for transaction") }) : /* @__PURE__ */ o(A, { ...S, state: "disabled", children: t("submit.disabled.enterAmount", "Enter amount") }) : s || /* @__PURE__ */ o(_r, { ...e });
|
|
1883
|
+
}, br = (e) => {
|
|
1869
1884
|
const { ctx: t } = _(), r = y();
|
|
1870
|
-
return t.walletAddress ? /* @__PURE__ */ o(
|
|
1885
|
+
return t.walletAddress ? /* @__PURE__ */ o(yr, { ...e }) : /* @__PURE__ */ o(Nr, { onClick: r.onWalletSignin });
|
|
1871
1886
|
};
|
|
1872
|
-
|
|
1873
|
-
const
|
|
1887
|
+
br.Error = Sr;
|
|
1888
|
+
const Er = ({ className: e }) => {
|
|
1874
1889
|
const { t } = M(), { slippageTolerance: r } = y(), { ctx: s } = _(), n = s.sourceToken && s.targetToken && s.sourceToken.price / s.targetToken.price;
|
|
1875
1890
|
return s.sourceToken ? /* @__PURE__ */ o(
|
|
1876
|
-
|
|
1891
|
+
os,
|
|
1877
1892
|
{
|
|
1878
1893
|
expandedByDefault: !1,
|
|
1879
1894
|
expandedHeightPx: s.walletAddress ? 80 : 50,
|
|
1880
1895
|
isBadgeLoading: s.quoteStatus === "pending",
|
|
1881
1896
|
badge: s.quote ? `~ ${s.quote.timeEstimate} sec` : void 0,
|
|
1882
1897
|
className: e,
|
|
1883
|
-
title: s.sourceToken && s.targetToken ? /* @__PURE__ */
|
|
1898
|
+
title: s.sourceToken && s.targetToken ? /* @__PURE__ */ h("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
1884
1899
|
`1 ${s.sourceToken.symbol} ≈ `,
|
|
1885
1900
|
" ",
|
|
1886
|
-
|
|
1901
|
+
is(n ?? 0),
|
|
1887
1902
|
" ",
|
|
1888
1903
|
`${s.targetToken.symbol}`,
|
|
1889
1904
|
/* @__PURE__ */ o("span", { className: "text-sw-gray-50", children: ` (${$e(s.sourceToken.price)})` })
|
|
1890
|
-
] }) : /* @__PURE__ */
|
|
1905
|
+
] }) : /* @__PURE__ */ h("span", { style: { borderBottomWidth: "2px", borderStyle: "dotted" }, children: [
|
|
1891
1906
|
`1 ${s.sourceToken.symbol} ≈ `,
|
|
1892
1907
|
" ",
|
|
1893
1908
|
$e(s.sourceToken.price),
|
|
1894
1909
|
" USD"
|
|
1895
1910
|
] }),
|
|
1896
|
-
children: /* @__PURE__ */
|
|
1911
|
+
children: /* @__PURE__ */ h(de, { children: [
|
|
1897
1912
|
/* @__PURE__ */ o(
|
|
1898
1913
|
de.Item,
|
|
1899
1914
|
{
|
|
@@ -1912,21 +1927,21 @@ const yr = ({ className: e }) => {
|
|
|
1912
1927
|
] })
|
|
1913
1928
|
}
|
|
1914
1929
|
) : /* @__PURE__ */ o(wt, {});
|
|
1915
|
-
},
|
|
1930
|
+
}, Pi = Object.assign(Er, {
|
|
1916
1931
|
Skeleton: wt
|
|
1917
|
-
}),
|
|
1932
|
+
}), Rr = ({
|
|
1918
1933
|
token: e,
|
|
1919
1934
|
balance: t,
|
|
1920
1935
|
isNotSufficient: r = !1,
|
|
1921
1936
|
onClick: s
|
|
1922
1937
|
}) => {
|
|
1923
1938
|
const n = y();
|
|
1924
|
-
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(
|
|
1939
|
+
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(ls, { width: 100 }) : /* @__PURE__ */ o(
|
|
1925
1940
|
"span",
|
|
1926
1941
|
{
|
|
1927
1942
|
onClick: t ? s : void 0,
|
|
1928
1943
|
style: t ? { borderBottomWidth: "2px", borderStyle: "dotted" } : void 0,
|
|
1929
|
-
className:
|
|
1944
|
+
className: cs("text-sw-label-sm", {
|
|
1930
1945
|
"text-sw-status-error": r,
|
|
1931
1946
|
"text-sw-gray-100": !r,
|
|
1932
1947
|
"cursor-pointer": !!t && !!s
|
|
@@ -1952,36 +1967,36 @@ const yr = ({ className: e }) => {
|
|
|
1952
1967
|
heading: d,
|
|
1953
1968
|
onMsg: u
|
|
1954
1969
|
}) => {
|
|
1955
|
-
const i = Wt(), { ctx:
|
|
1970
|
+
const i = Wt(), { ctx: f } = _(), { t: T } = M(), { hideTokenInputHeadings: I } = y(), m = us(e, r, n), w = (N) => {
|
|
1956
1971
|
u({
|
|
1957
1972
|
type: "on_change_amount",
|
|
1958
|
-
amount:
|
|
1973
|
+
amount: ds(t, e.decimals, N)
|
|
1959
1974
|
});
|
|
1960
1975
|
};
|
|
1961
|
-
return /* @__PURE__ */
|
|
1962
|
-
!
|
|
1963
|
-
/* @__PURE__ */
|
|
1976
|
+
return /* @__PURE__ */ h(ie, { className: "flex flex-col", "aria-label": d, children: [
|
|
1977
|
+
!I && /* @__PURE__ */ o(kt, { children: d }),
|
|
1978
|
+
/* @__PURE__ */ h(
|
|
1964
1979
|
"div",
|
|
1965
1980
|
{
|
|
1966
1981
|
className: H(
|
|
1967
1982
|
"flex items-center justify-between",
|
|
1968
|
-
!
|
|
1983
|
+
!I && "mt-sw-2xl"
|
|
1969
1984
|
),
|
|
1970
1985
|
children: [
|
|
1971
1986
|
/* @__PURE__ */ o(
|
|
1972
|
-
|
|
1987
|
+
fs,
|
|
1973
1988
|
{
|
|
1974
1989
|
value: r,
|
|
1975
1990
|
name: i,
|
|
1976
|
-
setValue:
|
|
1991
|
+
setValue: ms,
|
|
1977
1992
|
placeholder: "0",
|
|
1978
1993
|
state: a === "default" || a === "disabled" ? a : "error",
|
|
1979
|
-
onChange: (
|
|
1980
|
-
u({ type: "on_change_amount", amount:
|
|
1994
|
+
onChange: (N) => {
|
|
1995
|
+
u({ type: "on_change_amount", amount: N.target.value });
|
|
1981
1996
|
}
|
|
1982
1997
|
}
|
|
1983
1998
|
),
|
|
1984
|
-
/* @__PURE__ */
|
|
1999
|
+
/* @__PURE__ */ h(
|
|
1985
2000
|
"button",
|
|
1986
2001
|
{
|
|
1987
2002
|
type: "button",
|
|
@@ -2009,9 +2024,9 @@ const yr = ({ className: e }) => {
|
|
|
2009
2024
|
]
|
|
2010
2025
|
}
|
|
2011
2026
|
),
|
|
2012
|
-
/* @__PURE__ */
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-100", children:
|
|
2027
|
+
/* @__PURE__ */ h("div", { className: "gap-sw-sm min-h-sw-2xl flex items-center justify-between mt-sw-lg", children: [
|
|
2028
|
+
/* @__PURE__ */ h("div", { className: "gap-sw-md flex items-center", children: [
|
|
2029
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-100", children: m }),
|
|
2015
2030
|
s ? /* @__PURE__ */ o(
|
|
2016
2031
|
"span",
|
|
2017
2032
|
{
|
|
@@ -2025,9 +2040,9 @@ const yr = ({ className: e }) => {
|
|
|
2025
2040
|
}
|
|
2026
2041
|
) : null
|
|
2027
2042
|
] }),
|
|
2028
|
-
/* @__PURE__ */
|
|
2029
|
-
e && !!
|
|
2030
|
-
|
|
2043
|
+
/* @__PURE__ */ h("div", { className: "gap-sw-sm flex items-center", children: [
|
|
2044
|
+
e && !!f.walletAddress && l && /* @__PURE__ */ o(
|
|
2045
|
+
Rr,
|
|
2031
2046
|
{
|
|
2032
2047
|
token: e,
|
|
2033
2048
|
balance: t,
|
|
@@ -2035,13 +2050,13 @@ const yr = ({ className: e }) => {
|
|
|
2035
2050
|
onClick: () => w(1)
|
|
2036
2051
|
}
|
|
2037
2052
|
),
|
|
2038
|
-
!!t && l && c && /* @__PURE__ */
|
|
2053
|
+
!!t && l && c && /* @__PURE__ */ h(Lt, { children: [
|
|
2039
2054
|
/* @__PURE__ */ o(
|
|
2040
2055
|
Ke,
|
|
2041
2056
|
{
|
|
2042
2057
|
isClickable: a !== "disabled",
|
|
2043
2058
|
onClick: () => w(2),
|
|
2044
|
-
children:
|
|
2059
|
+
children: T("tokens.input.half.label", "50%")
|
|
2045
2060
|
}
|
|
2046
2061
|
),
|
|
2047
2062
|
/* @__PURE__ */ o(
|
|
@@ -2049,17 +2064,17 @@ const yr = ({ className: e }) => {
|
|
|
2049
2064
|
{
|
|
2050
2065
|
isClickable: a !== "disabled",
|
|
2051
2066
|
onClick: () => w(1),
|
|
2052
|
-
children:
|
|
2067
|
+
children: T("tokens.input.max.label", "Max")
|
|
2053
2068
|
}
|
|
2054
2069
|
)
|
|
2055
2070
|
] }),
|
|
2056
|
-
!l && /* @__PURE__ */ o("div", { className: "rounded-full bg-sw-gray-700 py-sw-xs px-sw-sm flex items-center justify-center", children: /* @__PURE__ */ o("span", { className: "text-sw-gray-100 text-sw-label-sm", children:
|
|
2071
|
+
!l && /* @__PURE__ */ o("div", { className: "rounded-full bg-sw-gray-700 py-sw-xs px-sw-sm flex items-center justify-center", children: /* @__PURE__ */ o("span", { className: "text-sw-gray-100 text-sw-label-sm", children: T("tokens.input.externalBalance.label", "External balance") }) })
|
|
2057
2072
|
] })
|
|
2058
2073
|
] })
|
|
2059
2074
|
] });
|
|
2060
2075
|
}, qe = ({ onMsg: e, heading: t }) => {
|
|
2061
2076
|
const { hideTokenInputHeadings: r } = y();
|
|
2062
|
-
return /* @__PURE__ */
|
|
2077
|
+
return /* @__PURE__ */ h(
|
|
2063
2078
|
ie,
|
|
2064
2079
|
{
|
|
2065
2080
|
isClickable: !0,
|
|
@@ -2067,7 +2082,7 @@ const yr = ({ className: e }) => {
|
|
|
2067
2082
|
onClick: () => e({ type: "on_click_select_token" }),
|
|
2068
2083
|
children: [
|
|
2069
2084
|
!r && /* @__PURE__ */ o(kt, { children: t }),
|
|
2070
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ h(
|
|
2071
2086
|
"div",
|
|
2072
2087
|
{
|
|
2073
2088
|
className: H(
|
|
@@ -2103,7 +2118,7 @@ const yr = ({ className: e }) => {
|
|
|
2103
2118
|
const { mergedBalance: t } = le(), [r, s] = re(
|
|
2104
2119
|
e ? t[G(e)] : void 0
|
|
2105
2120
|
);
|
|
2106
|
-
return
|
|
2121
|
+
return R(() => {
|
|
2107
2122
|
let n;
|
|
2108
2123
|
if (e) {
|
|
2109
2124
|
const a = t[G(e)];
|
|
@@ -2123,11 +2138,11 @@ const yr = ({ className: e }) => {
|
|
|
2123
2138
|
const { tokens: r } = P(e), s = Array.from(
|
|
2124
2139
|
new Set(r.map((n) => n.assetId))
|
|
2125
2140
|
);
|
|
2126
|
-
|
|
2141
|
+
R(() => {
|
|
2127
2142
|
const n = s.length === 1 ? r[0] : null;
|
|
2128
2143
|
n && t({ type: "on_select_token", token: n });
|
|
2129
2144
|
}, [r]);
|
|
2130
|
-
},
|
|
2145
|
+
}, Cr = ({
|
|
2131
2146
|
onMsg: e,
|
|
2132
2147
|
isChanging: t = !0,
|
|
2133
2148
|
showBalance: r = !0,
|
|
@@ -2154,16 +2169,16 @@ const yr = ({ className: e }) => {
|
|
|
2154
2169
|
balance: a,
|
|
2155
2170
|
showBalance: r,
|
|
2156
2171
|
showQuickBalanceActions: !0,
|
|
2157
|
-
value:
|
|
2172
|
+
value: j(n.sourceTokenAmount, n.sourceToken?.decimals),
|
|
2158
2173
|
onMsg: e
|
|
2159
2174
|
}
|
|
2160
2175
|
) : /* @__PURE__ */ o(qe, { heading: s, onMsg: e });
|
|
2161
|
-
},
|
|
2176
|
+
}, vr = ({
|
|
2162
2177
|
isChanging: e = !1,
|
|
2163
2178
|
onMsg: t,
|
|
2164
2179
|
heading: r
|
|
2165
2180
|
}) => {
|
|
2166
|
-
const { ctx: s } = _(), { usdTradeDelta: n } =
|
|
2181
|
+
const { ctx: s } = _(), { usdTradeDelta: n } = z(), a = Dt(s.targetToken);
|
|
2167
2182
|
xt("target", t);
|
|
2168
2183
|
const l = v(() => !e && s.quoteStatus === "pending" ? "disabled" : "default", [e, s.quoteStatus]);
|
|
2169
2184
|
return s.targetToken ? /* @__PURE__ */ o(
|
|
@@ -2174,17 +2189,17 @@ const yr = ({ className: e }) => {
|
|
|
2174
2189
|
balance: a,
|
|
2175
2190
|
quoteUsdDelta: n?.percentage,
|
|
2176
2191
|
quoteUsdValue: s.quote && parseFloat(s.quote.amountOutUsd),
|
|
2177
|
-
value:
|
|
2192
|
+
value: j(s.targetTokenAmount, s.targetToken?.decimals),
|
|
2178
2193
|
state: l,
|
|
2179
2194
|
showQuickBalanceActions: !1,
|
|
2180
2195
|
showBalance: !0,
|
|
2181
2196
|
onMsg: t
|
|
2182
2197
|
}
|
|
2183
2198
|
) : /* @__PURE__ */ o(qe, { heading: r, onMsg: t });
|
|
2184
|
-
},
|
|
2185
|
-
Skeleton:
|
|
2186
|
-
Source:
|
|
2187
|
-
Target:
|
|
2199
|
+
}, Dr = ({ token: e, heading: t, ...r }) => e ? /* @__PURE__ */ o(Be, { ...r, token: e, heading: t }) : /* @__PURE__ */ o(qe, { onMsg: r.onMsg, heading: t }), Wi = Object.assign(Dr, {
|
|
2200
|
+
Skeleton: ps,
|
|
2201
|
+
Source: Cr,
|
|
2202
|
+
Target: vr
|
|
2188
2203
|
}), Je = 58, Ot = ({
|
|
2189
2204
|
token: e,
|
|
2190
2205
|
balance: t,
|
|
@@ -2193,8 +2208,8 @@ const yr = ({ className: e }) => {
|
|
|
2193
2208
|
className: n,
|
|
2194
2209
|
onMsg: a
|
|
2195
2210
|
}) => {
|
|
2196
|
-
const { ctx: l } = _(), { walletSupportedChains: c, appName: d } = y(), u =
|
|
2197
|
-
return /* @__PURE__ */ o("li", { className: "list-none group", children: /* @__PURE__ */
|
|
2211
|
+
const { ctx: l } = _(), { walletSupportedChains: c, appName: d } = y(), u = Ts(t, e), i = c.includes(e.blockchain) || e.isIntent, f = t !== "0" && t !== 0 && t !== void 0;
|
|
2212
|
+
return /* @__PURE__ */ o("li", { className: "list-none group", children: /* @__PURE__ */ h(
|
|
2198
2213
|
"div",
|
|
2199
2214
|
{
|
|
2200
2215
|
className: H(
|
|
@@ -2215,27 +2230,27 @@ const yr = ({ className: e }) => {
|
|
|
2215
2230
|
...e
|
|
2216
2231
|
}
|
|
2217
2232
|
),
|
|
2218
|
-
/* @__PURE__ */
|
|
2233
|
+
/* @__PURE__ */ h("div", { className: "gap-sw-xs mr-auto flex flex-col", children: [
|
|
2219
2234
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-50", children: e.name }),
|
|
2220
|
-
e.isIntent ? /* @__PURE__ */
|
|
2235
|
+
e.isIntent ? /* @__PURE__ */ h("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2221
2236
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2222
2237
|
" ",
|
|
2223
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${d} ${e.chainName.toLowerCase() !== "near" &&
|
|
2224
|
-
] }) : /* @__PURE__ */
|
|
2238
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${d} ${e.chainName.toLowerCase() !== "near" && f ? `(${e.chainName})` : ""}` })
|
|
2239
|
+
] }) : /* @__PURE__ */ h("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2225
2240
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2226
2241
|
" ",
|
|
2227
2242
|
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${e.chainName}` })
|
|
2228
2243
|
] })
|
|
2229
2244
|
] }),
|
|
2230
|
-
i && !!l.walletAddress && r && /* @__PURE__ */
|
|
2231
|
-
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:
|
|
2245
|
+
i && !!l.walletAddress && r && /* @__PURE__ */ h("div", { className: "gap-sw-xs flex flex-col items-end", children: [
|
|
2246
|
+
t === void 0 && !e.isIntent ? /* @__PURE__ */ o("span", { className: "h-[16px] w-[60px] animate-pulse rounded-full bg-sw-gray-700" }) : /* @__PURE__ */ o("span", { className: "h-[16px] text-sw-label-md text-sw-gray-50", children: f && /* @__PURE__ */ o(
|
|
2232
2247
|
Oe,
|
|
2233
2248
|
{
|
|
2234
2249
|
decimals: e.decimals,
|
|
2235
2250
|
value: t === void 0 ? "0" : `${t}`
|
|
2236
2251
|
}
|
|
2237
2252
|
) }),
|
|
2238
|
-
|
|
2253
|
+
f && /* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: u })
|
|
2239
2254
|
] })
|
|
2240
2255
|
]
|
|
2241
2256
|
}
|
|
@@ -2253,7 +2268,7 @@ const yr = ({ className: e }) => {
|
|
|
2253
2268
|
// NEAR (bsc)
|
|
2254
2269
|
"nep141:eth-0xe0f63a424a4439cbe457d80e4f4b51ad25b2c56c.omft.near"
|
|
2255
2270
|
// SPX (eth)
|
|
2256
|
-
],
|
|
2271
|
+
], xr = () => {
|
|
2257
2272
|
const { tokens: e } = P();
|
|
2258
2273
|
return {
|
|
2259
2274
|
uniqueIntentsTokens: v(() => {
|
|
@@ -2263,25 +2278,25 @@ const yr = ({ className: e }) => {
|
|
|
2263
2278
|
return [...t, ...s];
|
|
2264
2279
|
}, [e])
|
|
2265
2280
|
};
|
|
2266
|
-
},
|
|
2281
|
+
}, Or = ({
|
|
2267
2282
|
variant: e,
|
|
2268
2283
|
search: t,
|
|
2269
2284
|
selectedChain: r,
|
|
2270
2285
|
chainsFilter: s,
|
|
2271
2286
|
walletSupportedChains: n
|
|
2272
2287
|
}) => {
|
|
2273
|
-
|
|
2274
|
-
const { tokens: a } = P(e), { mergedBalance: l } = le(), { intentBalances: c } = ce(), { uniqueIntentsTokens: d } =
|
|
2288
|
+
Hs(e);
|
|
2289
|
+
const { tokens: a } = P(e), { mergedBalance: l } = le(), { intentBalances: c } = ce(), { uniqueIntentsTokens: d } = xr(), u = Is(
|
|
2275
2290
|
l,
|
|
2276
2291
|
n,
|
|
2277
2292
|
t
|
|
2278
|
-
), i = a.filter(
|
|
2279
|
-
|
|
2293
|
+
), i = a.filter(ws({ search: t })).filter(
|
|
2294
|
+
ks({
|
|
2280
2295
|
selectedChain: r,
|
|
2281
2296
|
chainsFilter: s,
|
|
2282
2297
|
walletSupportedChains: n,
|
|
2283
2298
|
intentBalances: c,
|
|
2284
|
-
uniqueIntentTokenIds: d.map((
|
|
2299
|
+
uniqueIntentTokenIds: d.map((f) => f.assetId)
|
|
2285
2300
|
})
|
|
2286
2301
|
);
|
|
2287
2302
|
return {
|
|
@@ -2289,7 +2304,7 @@ const yr = ({ className: e }) => {
|
|
|
2289
2304
|
intents: i.filter(He({ isIntent: !0 })).sort(u),
|
|
2290
2305
|
wallet: i.filter(He({ isIntent: !1 })).sort(u)
|
|
2291
2306
|
};
|
|
2292
|
-
},
|
|
2307
|
+
}, Fr = (e, t) => e.length === 0 && t ? "EMPTY_SEARCH" : e.length === 0 && !t ? "NO_TOKENS" : "HAS_TOKENS", Lr = ({
|
|
2293
2308
|
variant: e,
|
|
2294
2309
|
search: t,
|
|
2295
2310
|
className: r,
|
|
@@ -2300,32 +2315,32 @@ const yr = ({ className: e }) => {
|
|
|
2300
2315
|
chainIsNotSupported: c,
|
|
2301
2316
|
onMsg: d
|
|
2302
2317
|
}) => {
|
|
2303
|
-
const { t: u } = M(), { ctx: i } = _(), { walletSupportedChains:
|
|
2318
|
+
const { t: u } = M(), { ctx: i } = _(), { walletSupportedChains: f, appName: T } = y(), { mergedBalance: I } = le(), m = Or({
|
|
2304
2319
|
variant: e,
|
|
2305
2320
|
search: t,
|
|
2306
2321
|
chainsFilter: a,
|
|
2307
2322
|
selectedChain: l,
|
|
2308
|
-
walletSupportedChains:
|
|
2309
|
-
}), w = i.walletAddress ? s : !1,
|
|
2310
|
-
() => [{ label: null, tokens:
|
|
2311
|
-
[
|
|
2323
|
+
walletSupportedChains: f
|
|
2324
|
+
}), w = i.walletAddress ? s : !1, N = Fr(m.all, t), E = v(
|
|
2325
|
+
() => [{ label: null, tokens: m.all }],
|
|
2326
|
+
[m.all]
|
|
2312
2327
|
), B = v(
|
|
2313
2328
|
() => [
|
|
2314
|
-
{ label:
|
|
2329
|
+
{ label: T, tokens: m.intents },
|
|
2315
2330
|
{
|
|
2316
2331
|
label: c ? null : "Connected wallet",
|
|
2317
|
-
tokens:
|
|
2332
|
+
tokens: m.wallet
|
|
2318
2333
|
}
|
|
2319
2334
|
],
|
|
2320
|
-
[
|
|
2335
|
+
[m.wallet, m.intents, c]
|
|
2321
2336
|
), F = v(() => (w ? B : E).reduce(
|
|
2322
2337
|
(k, x) => k + x.tokens.length,
|
|
2323
2338
|
0
|
|
2324
2339
|
), [B, E, w]), L = "450px";
|
|
2325
|
-
switch (
|
|
2340
|
+
switch (N) {
|
|
2326
2341
|
case "EMPTY_SEARCH":
|
|
2327
2342
|
return /* @__PURE__ */ o(
|
|
2328
|
-
|
|
2343
|
+
Ne,
|
|
2329
2344
|
{
|
|
2330
2345
|
hasAction: !0,
|
|
2331
2346
|
actionType: "outlined",
|
|
@@ -2341,7 +2356,7 @@ const yr = ({ className: e }) => {
|
|
|
2341
2356
|
);
|
|
2342
2357
|
case "HAS_TOKENS":
|
|
2343
2358
|
return /* @__PURE__ */ o("div", { className: H("gap-sw-lg flex flex-col", r), children: /* @__PURE__ */ o(
|
|
2344
|
-
|
|
2359
|
+
hs,
|
|
2345
2360
|
{
|
|
2346
2361
|
className: "hide-scrollbar",
|
|
2347
2362
|
style: {
|
|
@@ -2350,9 +2365,9 @@ const yr = ({ className: e }) => {
|
|
|
2350
2365
|
height: F ? F * Je + (w ? B.length * 62 : 0) : Je * 2
|
|
2351
2366
|
},
|
|
2352
2367
|
children: (w ? B : E).map(
|
|
2353
|
-
({ label: k, tokens: x }) => /* @__PURE__ */
|
|
2354
|
-
x.length && k ? /* @__PURE__ */
|
|
2355
|
-
/* @__PURE__ */ o(
|
|
2368
|
+
({ label: k, tokens: x }) => /* @__PURE__ */ h(Vt, { children: [
|
|
2369
|
+
x.length && k ? /* @__PURE__ */ h("header", { className: "pb-sw-lg flex flex-col", children: [
|
|
2370
|
+
/* @__PURE__ */ o(gs, {}),
|
|
2356
2371
|
/* @__PURE__ */ o("span", { className: "text-sw-label-sm pt-sw-xl text-sw-gray-100", children: `${k} — ${x.length}` })
|
|
2357
2372
|
] }) : null,
|
|
2358
2373
|
x.map((X) => {
|
|
@@ -2362,7 +2377,7 @@ const yr = ({ className: e }) => {
|
|
|
2362
2377
|
{
|
|
2363
2378
|
token: X,
|
|
2364
2379
|
showBalance: n,
|
|
2365
|
-
balance:
|
|
2380
|
+
balance: I[J],
|
|
2366
2381
|
isNotSelectable: c && !!i.walletAddress,
|
|
2367
2382
|
onMsg: d
|
|
2368
2383
|
},
|
|
@@ -2377,7 +2392,7 @@ const yr = ({ className: e }) => {
|
|
|
2377
2392
|
case "NO_TOKENS":
|
|
2378
2393
|
default:
|
|
2379
2394
|
return /* @__PURE__ */ o(
|
|
2380
|
-
|
|
2395
|
+
Ne,
|
|
2381
2396
|
{
|
|
2382
2397
|
className: "pt-sw-5xl pb-sw-5xl",
|
|
2383
2398
|
subHeading: u(
|
|
@@ -2386,15 +2401,15 @@ const yr = ({ className: e }) => {
|
|
|
2386
2401
|
),
|
|
2387
2402
|
heading: u("tokens.list.noBalanceOnApp.label", {
|
|
2388
2403
|
defaultValue: "You have no balances on {{appName}}",
|
|
2389
|
-
appName:
|
|
2404
|
+
appName: T
|
|
2390
2405
|
})
|
|
2391
2406
|
}
|
|
2392
2407
|
);
|
|
2393
2408
|
}
|
|
2394
|
-
},
|
|
2395
|
-
Placeholder:
|
|
2409
|
+
}, Vi = Object.assign(Lr, {
|
|
2410
|
+
Placeholder: Ne,
|
|
2396
2411
|
Item: Ot
|
|
2397
|
-
}),
|
|
2412
|
+
}), Br = (e, t) => {
|
|
2398
2413
|
const r = t.assetId.substring(t.assetId.indexOf(":") + 1), s = (a) => {
|
|
2399
2414
|
const l = (u) => u.replace(/(\.\d*?[1-9])0+$/, "$1").replace(/\.0+$/, ""), c = l(t.amount), d = l(
|
|
2400
2415
|
a.amount.toLocaleString("en-US", {
|
|
@@ -2407,12 +2422,12 @@ const yr = ({ className: e }) => {
|
|
|
2407
2422
|
return (e.result.deposits || []).find(
|
|
2408
2423
|
(a) => a.chain === t.chainId && a.account_id === t.intentsAccountId && a.address === t.depositAddress && a.near_token_id === r && n(a) && s(a)
|
|
2409
2424
|
);
|
|
2410
|
-
},
|
|
2425
|
+
}, qr = {
|
|
2411
2426
|
CREDITED: ee.status.PROCESSING,
|
|
2412
2427
|
PENDING: ee.status.PROCESSING,
|
|
2413
2428
|
COMPLETED: ee.status.SUCCESS,
|
|
2414
2429
|
FAILED: ee.status.FAILED
|
|
2415
|
-
},
|
|
2430
|
+
}, Mi = ({ depositAddress: e }) => {
|
|
2416
2431
|
const { ctx: t } = _(), { intentsAccountType: r } = y(), [s, n] = re(null), a = te({
|
|
2417
2432
|
addressType: r,
|
|
2418
2433
|
walletAddress: t.walletAddress
|
|
@@ -2432,9 +2447,9 @@ const yr = ({ className: e }) => {
|
|
|
2432
2447
|
throw new W(
|
|
2433
2448
|
`Unknown chain for POA deposit check ${c}`
|
|
2434
2449
|
);
|
|
2435
|
-
const
|
|
2436
|
-
s || n(
|
|
2437
|
-
const
|
|
2450
|
+
const f = s ?? (/* @__PURE__ */ new Date()).toUTCString();
|
|
2451
|
+
s || n(f);
|
|
2452
|
+
const T = await ft.post("", {
|
|
2438
2453
|
id: 1,
|
|
2439
2454
|
jsonrpc: "2.0",
|
|
2440
2455
|
method: "recent_deposits",
|
|
@@ -2444,19 +2459,19 @@ const yr = ({ className: e }) => {
|
|
|
2444
2459
|
chain: i
|
|
2445
2460
|
}
|
|
2446
2461
|
]
|
|
2447
|
-
}),
|
|
2462
|
+
}), I = Br(T.data, {
|
|
2448
2463
|
intentsAccountId: a,
|
|
2449
|
-
initiatedAtDate:
|
|
2464
|
+
initiatedAtDate: f,
|
|
2450
2465
|
depositAddress: e,
|
|
2451
2466
|
chainId: i,
|
|
2452
2467
|
assetId: u,
|
|
2453
2468
|
amount: d
|
|
2454
2469
|
});
|
|
2455
|
-
return
|
|
2456
|
-
status:
|
|
2470
|
+
return I ? {
|
|
2471
|
+
status: qr[I.status],
|
|
2457
2472
|
swapDetails: {
|
|
2458
2473
|
intentHashes: [""],
|
|
2459
|
-
destinationChainTxHashes: [{ hash:
|
|
2474
|
+
destinationChainTxHashes: [{ hash: I.tx_hash ?? "" }]
|
|
2460
2475
|
}
|
|
2461
2476
|
} : {
|
|
2462
2477
|
status: ee.status.PENDING_DEPOSIT,
|
|
@@ -2466,38 +2481,38 @@ const yr = ({ className: e }) => {
|
|
|
2466
2481
|
}
|
|
2467
2482
|
};
|
|
2468
2483
|
} };
|
|
2469
|
-
},
|
|
2470
|
-
if (
|
|
2484
|
+
}, Ur = (e, t, r) => {
|
|
2485
|
+
if (Nt) {
|
|
2471
2486
|
let s = document.body;
|
|
2472
2487
|
r instanceof HTMLElement && (s = r), Object.entries(e).forEach(([n, a]) => {
|
|
2473
2488
|
s.style.setProperty(`--c-sw-${t}-${n}`, a);
|
|
2474
2489
|
});
|
|
2475
2490
|
}
|
|
2476
2491
|
}, tt = (e, t, r, s) => {
|
|
2477
|
-
const n = r ?
|
|
2478
|
-
n &&
|
|
2479
|
-
},
|
|
2492
|
+
const n = r ? As(r, s ?? "dark") : null;
|
|
2493
|
+
n && Ur(n, e, t);
|
|
2494
|
+
}, Pr = (e, t) => {
|
|
2480
2495
|
const { primaryColor: r, surfaceColor: s, colorScheme: n } = t;
|
|
2481
2496
|
tt("accent", e, r, n), tt("gray", e, s, n);
|
|
2482
|
-
},
|
|
2497
|
+
}, Wr = at(void 0), Vr = ({ children: e, theme: t }) => {
|
|
2483
2498
|
const { themeParentElementSelector: r } = y(), s = v(() => t, [t]);
|
|
2484
|
-
return
|
|
2485
|
-
if (t &&
|
|
2499
|
+
return R(() => {
|
|
2500
|
+
if (t && Nt) {
|
|
2486
2501
|
const n = r ? document.querySelector(r) : null;
|
|
2487
|
-
|
|
2502
|
+
Pr(n, t);
|
|
2488
2503
|
}
|
|
2489
|
-
}, [t]), /* @__PURE__ */ o(
|
|
2504
|
+
}, [t]), /* @__PURE__ */ o(Wr.Provider, { value: s, children: e });
|
|
2490
2505
|
}, fe = ({
|
|
2491
2506
|
text: e,
|
|
2492
2507
|
icon: t
|
|
2493
|
-
}) => /* @__PURE__ */
|
|
2508
|
+
}) => /* @__PURE__ */ h("li", { className: "flex items-center gap-sw-md", children: [
|
|
2494
2509
|
t && /* @__PURE__ */ o(t, { size: 20, className: "text-sw-gray-300" }),
|
|
2495
2510
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-50", children: e })
|
|
2496
2511
|
] }), nt = ({
|
|
2497
2512
|
label: e,
|
|
2498
2513
|
icon: t,
|
|
2499
2514
|
className: r
|
|
2500
|
-
}) => /* @__PURE__ */
|
|
2515
|
+
}) => /* @__PURE__ */ h(
|
|
2501
2516
|
"div",
|
|
2502
2517
|
{
|
|
2503
2518
|
className: H(
|
|
@@ -2509,8 +2524,8 @@ const yr = ({ className: e }) => {
|
|
|
2509
2524
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md", children: e })
|
|
2510
2525
|
]
|
|
2511
2526
|
}
|
|
2512
|
-
),
|
|
2513
|
-
const { t: s } = M(), n =
|
|
2527
|
+
), Mr = ({ isSigned: e, isSigning: t, onMsg: r }) => {
|
|
2528
|
+
const { t: s } = M(), n = Rs({
|
|
2514
2529
|
endTime: 0,
|
|
2515
2530
|
autostart: !1,
|
|
2516
2531
|
timerType: "DECREMENTAL",
|
|
@@ -2519,18 +2534,18 @@ const yr = ({ className: e }) => {
|
|
|
2519
2534
|
r({ type: "on_close" });
|
|
2520
2535
|
}
|
|
2521
2536
|
});
|
|
2522
|
-
return
|
|
2537
|
+
return R(() => {
|
|
2523
2538
|
e ? n.start() : n.reset();
|
|
2524
|
-
}, [e]), /* @__PURE__ */
|
|
2539
|
+
}, [e]), /* @__PURE__ */ h(ie, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2525
2540
|
/* @__PURE__ */ o(
|
|
2526
|
-
|
|
2541
|
+
St,
|
|
2527
2542
|
{
|
|
2528
2543
|
onClick: () => r({ type: "on_close" }),
|
|
2529
2544
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2530
2545
|
}
|
|
2531
2546
|
),
|
|
2532
|
-
/* @__PURE__ */ o(
|
|
2533
|
-
/* @__PURE__ */
|
|
2547
|
+
/* @__PURE__ */ o(Ns, { size: 48, className: "text-sw-status-warning" }),
|
|
2548
|
+
/* @__PURE__ */ h("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2534
2549
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: s(
|
|
2535
2550
|
"walletCompatibility.modal.title.initial",
|
|
2536
2551
|
"Verify your wallet to continue"
|
|
@@ -2540,7 +2555,7 @@ const yr = ({ className: e }) => {
|
|
|
2540
2555
|
"Please sign a message to verify your wallet. This confirms your wallet is compatible and lets us securely read your public key."
|
|
2541
2556
|
) })
|
|
2542
2557
|
] }),
|
|
2543
|
-
/* @__PURE__ */
|
|
2558
|
+
/* @__PURE__ */ h("ul", { className: "flex flex-col gap-sw-xl", children: [
|
|
2544
2559
|
/* @__PURE__ */ o(
|
|
2545
2560
|
fe,
|
|
2546
2561
|
{
|
|
@@ -2548,7 +2563,7 @@ const yr = ({ className: e }) => {
|
|
|
2548
2563
|
"walletCompatibility.modal.feature.secureTransactions",
|
|
2549
2564
|
"Read-only signature – no gas required."
|
|
2550
2565
|
),
|
|
2551
|
-
icon:
|
|
2566
|
+
icon: Ss
|
|
2552
2567
|
}
|
|
2553
2568
|
),
|
|
2554
2569
|
/* @__PURE__ */ o(
|
|
@@ -2558,7 +2573,7 @@ const yr = ({ className: e }) => {
|
|
|
2558
2573
|
"walletCompatibility.modal.feature.fullAccess",
|
|
2559
2574
|
"No access to your funds, no hidden permissions."
|
|
2560
2575
|
),
|
|
2561
|
-
icon:
|
|
2576
|
+
icon: _s
|
|
2562
2577
|
}
|
|
2563
2578
|
),
|
|
2564
2579
|
/* @__PURE__ */ o(
|
|
@@ -2568,11 +2583,11 @@ const yr = ({ className: e }) => {
|
|
|
2568
2583
|
"walletCompatibility.modal.feature.fundProtection",
|
|
2569
2584
|
"Only checks whether your wallet is supported."
|
|
2570
2585
|
),
|
|
2571
|
-
icon:
|
|
2586
|
+
icon: ys
|
|
2572
2587
|
}
|
|
2573
2588
|
)
|
|
2574
2589
|
] }),
|
|
2575
|
-
e ? /* @__PURE__ */
|
|
2590
|
+
e ? /* @__PURE__ */ h("div", { className: "flex flex-col gap-sw-xl mt-sw-lg w-full", children: [
|
|
2576
2591
|
/* @__PURE__ */ o(
|
|
2577
2592
|
nt,
|
|
2578
2593
|
{
|
|
@@ -2581,7 +2596,7 @@ const yr = ({ className: e }) => {
|
|
|
2581
2596
|
"Wallet verified"
|
|
2582
2597
|
),
|
|
2583
2598
|
className: "bg-sw-status-success text-sw-gray-950",
|
|
2584
|
-
icon:
|
|
2599
|
+
icon: bs
|
|
2585
2600
|
}
|
|
2586
2601
|
),
|
|
2587
2602
|
n.status === "RUNNING" && /* @__PURE__ */ o(
|
|
@@ -2594,7 +2609,7 @@ const yr = ({ className: e }) => {
|
|
|
2594
2609
|
})
|
|
2595
2610
|
}
|
|
2596
2611
|
)
|
|
2597
|
-
] }) : /* @__PURE__ */
|
|
2612
|
+
] }) : /* @__PURE__ */ h("div", { className: "flex flex-col gap-sw-xl mt-sw-lg", children: [
|
|
2598
2613
|
/* @__PURE__ */ o(
|
|
2599
2614
|
A,
|
|
2600
2615
|
{
|
|
@@ -2619,18 +2634,18 @@ const yr = ({ className: e }) => {
|
|
|
2619
2634
|
)
|
|
2620
2635
|
] })
|
|
2621
2636
|
] });
|
|
2622
|
-
},
|
|
2637
|
+
}, Qr = ({ onMsg: e }) => {
|
|
2623
2638
|
const { t } = M();
|
|
2624
|
-
return /* @__PURE__ */
|
|
2639
|
+
return /* @__PURE__ */ h(ie, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2625
2640
|
/* @__PURE__ */ o(
|
|
2626
|
-
|
|
2641
|
+
St,
|
|
2627
2642
|
{
|
|
2628
2643
|
onClick: () => e({ type: "on_close" }),
|
|
2629
2644
|
className: "absolute top-sw-2xl right-sw-2xl"
|
|
2630
2645
|
}
|
|
2631
2646
|
),
|
|
2632
|
-
/* @__PURE__ */ o(
|
|
2633
|
-
/* @__PURE__ */
|
|
2647
|
+
/* @__PURE__ */ o(Es, { size: 48, className: "text-sw-status-error" }),
|
|
2648
|
+
/* @__PURE__ */ h("header", { className: "flex flex-col gap-sw-lg", children: [
|
|
2634
2649
|
/* @__PURE__ */ o("h1", { className: "text-sw-label-lg text-sw-gray-50", children: t(
|
|
2635
2650
|
"walletCompatibility.modal.title.error",
|
|
2636
2651
|
"Unable to verify wallet"
|
|
@@ -2644,7 +2659,7 @@ const yr = ({ className: e }) => {
|
|
|
2644
2659
|
"If the issue continues, please try another wallet."
|
|
2645
2660
|
) })
|
|
2646
2661
|
] }),
|
|
2647
|
-
/* @__PURE__ */
|
|
2662
|
+
/* @__PURE__ */ h("div", { className: "flex flex-col gap-sw-xl mt-sw-lg", children: [
|
|
2648
2663
|
/* @__PURE__ */ o(
|
|
2649
2664
|
A,
|
|
2650
2665
|
{
|
|
@@ -2665,9 +2680,9 @@ const yr = ({ className: e }) => {
|
|
|
2665
2680
|
)
|
|
2666
2681
|
] })
|
|
2667
2682
|
] });
|
|
2668
|
-
},
|
|
2669
|
-
Error:
|
|
2670
|
-
}),
|
|
2683
|
+
}, Qi = Object.assign(Mr, {
|
|
2684
|
+
Error: Qr
|
|
2685
|
+
}), $r = (e) => null, Kr = (e) => (t) => {
|
|
2671
2686
|
if (t instanceof W)
|
|
2672
2687
|
throw t;
|
|
2673
2688
|
const r = new W(
|
|
@@ -2675,24 +2690,24 @@ const yr = ({ className: e }) => {
|
|
|
2675
2690
|
{ cause: t }
|
|
2676
2691
|
);
|
|
2677
2692
|
throw r.context = e, r;
|
|
2678
|
-
},
|
|
2693
|
+
}, Hr = ({ children: e }) => {
|
|
2679
2694
|
const { ctx: t } = _();
|
|
2680
2695
|
return /* @__PURE__ */ o(
|
|
2681
|
-
|
|
2696
|
+
Ds,
|
|
2682
2697
|
{
|
|
2683
|
-
FallbackComponent:
|
|
2684
|
-
onError:
|
|
2698
|
+
FallbackComponent: $r,
|
|
2699
|
+
onError: Kr(t),
|
|
2685
2700
|
children: e
|
|
2686
2701
|
}
|
|
2687
2702
|
);
|
|
2688
|
-
},
|
|
2703
|
+
}, Gr = new Kt({
|
|
2689
2704
|
defaultOptions: {
|
|
2690
2705
|
queries: {
|
|
2691
2706
|
staleTime: 2e3 * 60,
|
|
2692
2707
|
retry: st.env.NODE_ENV === "test" ? !1 : 3
|
|
2693
2708
|
}
|
|
2694
2709
|
}
|
|
2695
|
-
}),
|
|
2710
|
+
}), jr = ["fms", "abg", "stjack", "noear", "testnebula"], ae = {
|
|
2696
2711
|
appName: "Unknown",
|
|
2697
2712
|
appIcon: "https://wtmcxrwapthiogjpxwfr.supabase.co/storage/v1/object/public/swap-widget/unknown.svg",
|
|
2698
2713
|
slippageTolerance: 100,
|
|
@@ -2703,7 +2718,7 @@ const yr = ({ className: e }) => {
|
|
|
2703
2718
|
enableAutoTokensSwitching: !0,
|
|
2704
2719
|
showIntentTokens: !0,
|
|
2705
2720
|
chainsOrder: it,
|
|
2706
|
-
filterTokens: (e) => !
|
|
2721
|
+
filterTokens: (e) => !jr.includes(e.symbol.toLocaleLowerCase()),
|
|
2707
2722
|
chainsFilter: {
|
|
2708
2723
|
source: { external: "wallet-supported", intents: "none" },
|
|
2709
2724
|
target: { external: "all", intents: "none" }
|
|
@@ -2715,9 +2730,9 @@ const yr = ({ className: e }) => {
|
|
|
2715
2730
|
}), y = () => {
|
|
2716
2731
|
const e = Mt(Ft);
|
|
2717
2732
|
return oe(e).config;
|
|
2718
|
-
},
|
|
2733
|
+
}, zr = (e) => {
|
|
2719
2734
|
Ue.config = pe(e);
|
|
2720
|
-
},
|
|
2735
|
+
}, $i = ({
|
|
2721
2736
|
children: e,
|
|
2722
2737
|
config: t,
|
|
2723
2738
|
balanceViaRpc: r = !0,
|
|
@@ -2734,102 +2749,102 @@ const yr = ({ className: e }) => {
|
|
|
2734
2749
|
})
|
|
2735
2750
|
})
|
|
2736
2751
|
);
|
|
2737
|
-
return
|
|
2752
|
+
return R(() => {
|
|
2738
2753
|
const c = pe({
|
|
2739
2754
|
...ae,
|
|
2740
2755
|
...t
|
|
2741
2756
|
});
|
|
2742
|
-
Object.assign(l.current.config, c),
|
|
2743
|
-
}, [t]), zt(s ?? {}),
|
|
2744
|
-
/* @__PURE__ */
|
|
2745
|
-
/* @__PURE__ */
|
|
2757
|
+
Object.assign(l.current.config, c), zr(c);
|
|
2758
|
+
}, [t]), zt(s ?? {}), vs("headlessui-portal-root", "sw"), /* @__PURE__ */ o(Ht, { client: Gr, children: /* @__PURE__ */ o(jt, { i18n: Bt, children: /* @__PURE__ */ h(Ft.Provider, { value: l.current, children: [
|
|
2759
|
+
/* @__PURE__ */ h(qt, { children: [
|
|
2760
|
+
/* @__PURE__ */ h(Ut, { children: [
|
|
2746
2761
|
/* @__PURE__ */ o("link", { rel: "preconnect", href: "https://rsms.me/" }),
|
|
2747
2762
|
/* @__PURE__ */ o("link", { rel: "stylesheet", href: "https://rsms.me/inter/inter.css" })
|
|
2748
2763
|
] }),
|
|
2749
|
-
/* @__PURE__ */ o(
|
|
2764
|
+
/* @__PURE__ */ o(Vr, { theme: a, children: st.env.NODE_ENV === "test" ? e : /* @__PURE__ */ o(Hr, { children: e }) })
|
|
2750
2765
|
] }),
|
|
2751
2766
|
r && /* @__PURE__ */ o(
|
|
2752
|
-
|
|
2767
|
+
$s,
|
|
2753
2768
|
{
|
|
2754
|
-
rpcs: n ??
|
|
2769
|
+
rpcs: n ?? Cs,
|
|
2755
2770
|
connectedWallets: t.connectedWallets ?? {}
|
|
2756
2771
|
}
|
|
2757
2772
|
)
|
|
2758
2773
|
] }) }) });
|
|
2759
2774
|
};
|
|
2760
2775
|
export {
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2776
|
+
ur as $,
|
|
2777
|
+
Mi as A,
|
|
2778
|
+
$s as B,
|
|
2779
|
+
Wr as C,
|
|
2780
|
+
qs as D,
|
|
2766
2781
|
Ge as E,
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2782
|
+
Gs as F,
|
|
2783
|
+
js as G,
|
|
2784
|
+
zs as H,
|
|
2785
|
+
Ys as I,
|
|
2786
|
+
Js as J,
|
|
2772
2787
|
bt as K,
|
|
2773
2788
|
Et as L,
|
|
2774
2789
|
vt as M,
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2790
|
+
Rt as N,
|
|
2791
|
+
Ct as O,
|
|
2792
|
+
er as P,
|
|
2778
2793
|
q as Q,
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2793
|
-
|
|
2794
|
-
|
|
2794
|
+
tr as R,
|
|
2795
|
+
br as S,
|
|
2796
|
+
Dr as T,
|
|
2797
|
+
nr as U,
|
|
2798
|
+
sr as V,
|
|
2799
|
+
$i as W,
|
|
2800
|
+
rr as X,
|
|
2801
|
+
ar as Y,
|
|
2802
|
+
or as Z,
|
|
2803
|
+
ir as _,
|
|
2804
|
+
Ui as a,
|
|
2805
|
+
mr as a0,
|
|
2806
|
+
pr as a1,
|
|
2807
|
+
Tr as a2,
|
|
2808
|
+
Er as a3,
|
|
2809
|
+
Rr as a4,
|
|
2795
2810
|
Be as a5,
|
|
2796
2811
|
qe as a6,
|
|
2797
2812
|
xt as a7,
|
|
2798
|
-
|
|
2799
|
-
|
|
2813
|
+
Cr as a8,
|
|
2814
|
+
vr as a9,
|
|
2800
2815
|
Je as aa,
|
|
2801
2816
|
Ot as ab,
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2817
|
+
xr as ac,
|
|
2818
|
+
Lr as ad,
|
|
2819
|
+
Vr as ae,
|
|
2820
|
+
Mr as af,
|
|
2821
|
+
Qr as ag,
|
|
2822
|
+
Hr as ah,
|
|
2808
2823
|
Ue as ai,
|
|
2809
2824
|
_ as b,
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2825
|
+
Bi as c,
|
|
2826
|
+
Hs as d,
|
|
2827
|
+
Ms as e,
|
|
2813
2828
|
ce as f,
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2829
|
+
Ir as g,
|
|
2830
|
+
Xs as h,
|
|
2831
|
+
wr as i,
|
|
2832
|
+
fr as j,
|
|
2818
2833
|
le as k,
|
|
2819
|
-
|
|
2820
|
-
|
|
2834
|
+
Ar as l,
|
|
2835
|
+
Or as m,
|
|
2821
2836
|
P as n,
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2837
|
+
Pi as o,
|
|
2838
|
+
Wi as p,
|
|
2839
|
+
Vi as q,
|
|
2840
|
+
cr as r,
|
|
2826
2841
|
Dt as s,
|
|
2827
2842
|
yt as t,
|
|
2828
|
-
|
|
2843
|
+
z as u,
|
|
2829
2844
|
W as v,
|
|
2830
|
-
|
|
2831
|
-
|
|
2845
|
+
g as w,
|
|
2846
|
+
qi as x,
|
|
2832
2847
|
y,
|
|
2833
|
-
|
|
2848
|
+
Qi as z
|
|
2834
2849
|
};
|
|
2835
|
-
//# sourceMappingURL=config-
|
|
2850
|
+
//# sourceMappingURL=config-r-k8Mo4x.js.map
|