@aurora-is-near/intents-swap-widget 3.24.1 → 3.25.0
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-DMLDiA0V.js → config-6S9JcYY_.js} +319 -318
- package/dist/config-6S9JcYY_.js.map +1 -0
- package/dist/config.d.ts +10 -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 +1 -1
- package/dist/features/ChainsSelector/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/index.js +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/types/config.d.ts +2 -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/Widget/WidgetContent.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +81 -77
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +101 -90
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +97 -90
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +1 -1
- package/src/machine/effects/useSelectedTokensEffect.ts +8 -2
- package/src/types/config.ts +2 -1
- package/src/widgets/WidgetDeposit/WidgetDepositContent.tsx +19 -9
- package/src/widgets/WidgetSwap/WidgetSwapContent.tsx +24 -19
- package/src/widgets/WidgetWithdraw/WidgetWithdrawContent.tsx +22 -7
- package/dist/config-DMLDiA0V.js.map +0 -1
|
@@ -4,11 +4,11 @@ import jt from "i18next";
|
|
|
4
4
|
import { deepClone as Se } from "valtio/utils";
|
|
5
5
|
import { snapshot as Re, useSnapshot as fe, proxy as ut } from "valtio";
|
|
6
6
|
import { HelmetProvider as zt, Helmet as Yt } from "react-helmet-async";
|
|
7
|
-
import { memo as Xt, useEffect as
|
|
7
|
+
import { memo as Xt, useEffect as R, useMemo as B, useRef as Z, useCallback as le, useState as re, useId as Zt, createContext as mt, useContext as Jt } from "react";
|
|
8
8
|
import { useQuery as ve, useInfiniteQuery as en, useQueryClient as tn, QueryClient as nn, QueryClientProvider as rn } from "@tanstack/react-query";
|
|
9
9
|
import { Trans as sn, I18nextProvider as an } from "react-i18next";
|
|
10
10
|
import { useTypedTranslation as K, initLocalisation as on } from "./localisation.js";
|
|
11
|
-
import { logger as
|
|
11
|
+
import { logger as C } from "./logger.js";
|
|
12
12
|
import { getTonTokenBalance as cn } from "./utils/ton/getTonTokenBalance.js";
|
|
13
13
|
import { getSolanaTokenBalance as ln } from "./utils/solana/getSolanaTokenBalance.js";
|
|
14
14
|
import { useWalletAddressForToken as ft } from "./hooks/useWalletAddressForToken.js";
|
|
@@ -25,9 +25,9 @@ import { derive as pn } from "derive-valtio";
|
|
|
25
25
|
import { getIsNativeNearDeposit as hn } from "./machine/computed/getIsNativeNearDeposit.js";
|
|
26
26
|
import { getIsDirectTokenOnNearDeposit as Tn } from "./machine/computed/getIsDirectTokenOnNearDeposit.js";
|
|
27
27
|
import "ethers";
|
|
28
|
-
import { moveTo as
|
|
28
|
+
import { moveTo as L, machine as ee } from "./machine/machine.js";
|
|
29
29
|
import gn from "lodash.once";
|
|
30
|
-
import { guardStates as
|
|
30
|
+
import { guardStates as F } from "./machine/guards/index.js";
|
|
31
31
|
import { parse as In } from "./ext/alchemy/parse.js";
|
|
32
32
|
import { createLoader as wn } from "./ext/alchemy/load.js";
|
|
33
33
|
import { isAlchemySupportedChain as kn } from "./ext/alchemy/types.js";
|
|
@@ -177,7 +177,7 @@ import { getNativeNearBalance as es } from "./utils/near/getNativeNearBalance.js
|
|
|
177
177
|
import { getNearTokenBalance as ts } from "./utils/near/getNearTokenBalance.js";
|
|
178
178
|
import { getEvmTokenBalance as ns } from "./utils/evm/getEvmTokenBalance.js";
|
|
179
179
|
function rs({ rpcs: e, token: t, connectedWallets: s }) {
|
|
180
|
-
const { walletSupportedChains: r, tonCenterApiKey: n, alchemyApiKey: a } =
|
|
180
|
+
const { walletSupportedChains: r, tonCenterApiKey: n, alchemyApiKey: a } = b(), { walletAddress: l } = ft(s, t);
|
|
181
181
|
return ve({
|
|
182
182
|
retry: 2,
|
|
183
183
|
enabled: !!l && Object.keys(e).includes(t.blockchain),
|
|
@@ -197,7 +197,7 @@ function rs({ rpcs: e, token: t, connectedWallets: s }) {
|
|
|
197
197
|
const c = e[t.blockchain] ?? [];
|
|
198
198
|
return c.length > 0 ? ns(t, l, c[0]) : null;
|
|
199
199
|
}
|
|
200
|
-
return t.blockchain === "ton" ? cn(t, l, n) : t.blockchain === "sol" && r.includes(t.blockchain) ? ln(t, l, a) : (
|
|
200
|
+
return t.blockchain === "ton" ? cn(t, l, n) : t.blockchain === "sol" && r.includes(t.blockchain) ? ln(t, l, a) : (C.warn(
|
|
201
201
|
`Failed to fetch token balance for ${t.symbol} on ${t.blockchain}`
|
|
202
202
|
), null);
|
|
203
203
|
}
|
|
@@ -207,7 +207,7 @@ const ss = ({
|
|
|
207
207
|
rpcs: e,
|
|
208
208
|
token: t,
|
|
209
209
|
onBalancesLoaded: s
|
|
210
|
-
}) => (
|
|
210
|
+
}) => (R(() => {
|
|
211
211
|
t.isIntent || !Object.keys(e).includes(t.blockchain) || s({ [t.assetId]: "0" });
|
|
212
212
|
}, [t.assetId]), null), xt = Xt(
|
|
213
213
|
({ rpcs: e, token: t, connectedWallets: s, onBalancesLoaded: r }) => {
|
|
@@ -216,7 +216,7 @@ const ss = ({
|
|
|
216
216
|
token: t,
|
|
217
217
|
connectedWallets: s
|
|
218
218
|
});
|
|
219
|
-
return
|
|
219
|
+
return R(() => {
|
|
220
220
|
!t.isIntent && n != null && r({ [t.assetId]: n });
|
|
221
221
|
}, [t, n, r]), null;
|
|
222
222
|
},
|
|
@@ -237,30 +237,30 @@ const rt = Object.assign(xt, {
|
|
|
237
237
|
filterTokens: a,
|
|
238
238
|
fetchSourceTokens: l,
|
|
239
239
|
fetchTargetTokens: c
|
|
240
|
-
} =
|
|
240
|
+
} = b(), { data: d, ...u } = ve({
|
|
241
241
|
queryKey: ["tokens", e].filter(Boolean),
|
|
242
242
|
queryFn: async () => e === "source" && l ? l() : e === "target" && c ? c() : dn.getTokens()
|
|
243
|
-
}), i =
|
|
243
|
+
}), i = B(() => {
|
|
244
244
|
if (!d)
|
|
245
245
|
return [];
|
|
246
|
-
const m = d.map((
|
|
247
|
-
const
|
|
248
|
-
return !An(
|
|
249
|
-
assetId:
|
|
250
|
-
symbol:
|
|
251
|
-
decimals:
|
|
252
|
-
price:
|
|
253
|
-
blockchain:
|
|
246
|
+
const m = d.map((p) => {
|
|
247
|
+
const k = p.blockchain.toLowerCase();
|
|
248
|
+
return !An(k) || s && !s.includes(p.assetId) || e === "source" && r && !r.includes(p.assetId) || e === "target" && n && !n.includes(p.assetId) ? null : {
|
|
249
|
+
assetId: p.assetId,
|
|
250
|
+
symbol: p.symbol,
|
|
251
|
+
decimals: p.decimals,
|
|
252
|
+
price: p.price,
|
|
253
|
+
blockchain: k,
|
|
254
254
|
isIntent: !1,
|
|
255
|
-
icon:
|
|
256
|
-
name: is(
|
|
257
|
-
chainName: pt[
|
|
258
|
-
contractAddress:
|
|
255
|
+
icon: p.icon ?? as(p.symbol),
|
|
256
|
+
name: is(p.symbol),
|
|
257
|
+
chainName: pt[p.blockchain]?.label ?? os(p.blockchain),
|
|
258
|
+
contractAddress: p.contractAddress
|
|
259
259
|
};
|
|
260
|
-
}).filter((
|
|
261
|
-
(
|
|
262
|
-
), w = m.find((
|
|
263
|
-
return w &&
|
|
260
|
+
}).filter((p) => !!p).filter(a ?? (() => !0)), f = m.filter(
|
|
261
|
+
(p) => p.symbol.toLowerCase() !== "wnear"
|
|
262
|
+
), w = m.find((p) => p.symbol.toLowerCase() === "wnear");
|
|
263
|
+
return w && f.push({
|
|
264
264
|
name: "NEAR",
|
|
265
265
|
symbol: "NEAR",
|
|
266
266
|
chainName: "Near",
|
|
@@ -272,12 +272,12 @@ const rt = Object.assign(xt, {
|
|
|
272
272
|
isIntent: !1,
|
|
273
273
|
decimals: 24
|
|
274
274
|
}), t ? [
|
|
275
|
-
...
|
|
275
|
+
...f,
|
|
276
276
|
// add intents tokens to the full list
|
|
277
277
|
...m.map(
|
|
278
|
-
(
|
|
278
|
+
(p) => p.symbol.toLowerCase() === "wnear" ? { ...p, symbol: "NEAR", name: "NEAR", isIntent: !0 } : { ...p, isIntent: !0 }
|
|
279
279
|
)
|
|
280
|
-
] :
|
|
280
|
+
] : f;
|
|
281
281
|
}, [d, t, a]);
|
|
282
282
|
return {
|
|
283
283
|
...u,
|
|
@@ -285,7 +285,7 @@ const rt = Object.assign(xt, {
|
|
|
285
285
|
};
|
|
286
286
|
}, cs = () => {
|
|
287
287
|
const { tokens: e } = V(), { tokens: t } = V("source"), { tokens: s } = V("target");
|
|
288
|
-
return { tokens:
|
|
288
|
+
return { tokens: B(() => {
|
|
289
289
|
const n = {};
|
|
290
290
|
return [
|
|
291
291
|
...e,
|
|
@@ -312,8 +312,8 @@ const rt = Object.assign(xt, {
|
|
|
312
312
|
const a = Ie[r]?.[t.blockchain] ?? [], l = a.indexOf(t.symbol), c = a.indexOf(s.symbol);
|
|
313
313
|
return l === -1 && c === -1 ? 0 : l === -1 ? 1 : c === -1 ? -1 : l - c;
|
|
314
314
|
}), ds = ({ rpcs: e, connectedWallets: t }) => {
|
|
315
|
-
const { tokens: s } = cs(), { walletSupportedChains: r } =
|
|
316
|
-
return
|
|
315
|
+
const { tokens: s } = cs(), { walletSupportedChains: r } = b(), { setWalletBalance: n } = xe(t);
|
|
316
|
+
return B(() => ls(s), [s]).map((l) => r.includes(l.blockchain) ? /* @__PURE__ */ o(
|
|
317
317
|
rt,
|
|
318
318
|
{
|
|
319
319
|
rpcs: e,
|
|
@@ -347,8 +347,8 @@ const ms = (e) => {
|
|
|
347
347
|
allowedChainsList: s,
|
|
348
348
|
allowedSourceChainsList: r,
|
|
349
349
|
allowedTargetChainsList: n
|
|
350
|
-
} =
|
|
351
|
-
return
|
|
350
|
+
} = b(), { tokens: a } = V();
|
|
351
|
+
return B(() => {
|
|
352
352
|
const l = Array.from(
|
|
353
353
|
new Set(a.map((c) => pt[c.blockchain]))
|
|
354
354
|
).filter((c) => !(s && !s.includes(c.id) || e === "source" && r && !r.includes(c.id) || e === "target" && n && !n.includes(c.id)));
|
|
@@ -359,7 +359,7 @@ const ms = (e) => {
|
|
|
359
359
|
alchemyApiKey: t,
|
|
360
360
|
...s
|
|
361
361
|
}) => {
|
|
362
|
-
const { ctx: r } = _(), { tokens: n } = V(), { walletSupportedChains: a } =
|
|
362
|
+
const { ctx: r } = _(), { tokens: n } = V(), { walletSupportedChains: a } = b(), { setWalletBalance: l } = xe(e), c = s.isEnabled && !!Object.values(e).length && a.length > 0, d = en({
|
|
363
363
|
initialPageParam: null,
|
|
364
364
|
enabled: !!c && !!t,
|
|
365
365
|
queryKey: ["walletTokensBalance", e],
|
|
@@ -373,10 +373,10 @@ const ms = (e) => {
|
|
|
373
373
|
return i.pageKey;
|
|
374
374
|
}
|
|
375
375
|
});
|
|
376
|
-
|
|
376
|
+
R(() => {
|
|
377
377
|
c && d.data && d.hasNextPage && d.data.pages.length < st && !d.isFetchingNextPage && d.fetchNextPage();
|
|
378
378
|
}, [c, d]);
|
|
379
|
-
const u =
|
|
379
|
+
const u = B(() => {
|
|
380
380
|
if (!d.data?.pages)
|
|
381
381
|
return {};
|
|
382
382
|
const i = In(
|
|
@@ -387,15 +387,15 @@ const ms = (e) => {
|
|
|
387
387
|
kn(m.blockchain) && !(m.assetId in i) && (i[m.assetId] = "0");
|
|
388
388
|
}), i;
|
|
389
389
|
}, [d.data, n]);
|
|
390
|
-
return
|
|
391
|
-
|
|
390
|
+
return R(() => {
|
|
391
|
+
F(r, ["initial_wallet"]) && (l(e, u), r.sourceToken && Object.keys(u).includes(r.sourceToken.assetId) && h("tokenSetBalance", u[r.sourceToken.assetId]));
|
|
392
392
|
}, [u]), {
|
|
393
393
|
status: d.status,
|
|
394
394
|
refetch: d.refetch,
|
|
395
395
|
balances: u
|
|
396
396
|
};
|
|
397
397
|
}, he = () => {
|
|
398
|
-
const { intentsAccountType: e } =
|
|
398
|
+
const { intentsAccountType: e } = b(), {
|
|
399
399
|
ctx: { walletAddress: t }
|
|
400
400
|
} = _(), { tokens: s } = V(), r = s.filter((c) => c.isIntent).map((c) => c.assetId), n = se({
|
|
401
401
|
walletAddress: t,
|
|
@@ -404,10 +404,10 @@ const ms = (e) => {
|
|
|
404
404
|
enabled: !!t && !!n && s.length > 0,
|
|
405
405
|
queryKey: ["intentsBalances", n],
|
|
406
406
|
queryFn: async () => n ? await Sn(n, r) : {}
|
|
407
|
-
}), l =
|
|
407
|
+
}), l = B(() => {
|
|
408
408
|
switch (a.status) {
|
|
409
409
|
case "error":
|
|
410
|
-
return
|
|
410
|
+
return C.error("Unable to load intents balances:", a.error), {};
|
|
411
411
|
case "success":
|
|
412
412
|
return Object.fromEntries(
|
|
413
413
|
Object.entries(a.data).map(([c, d]) => [
|
|
@@ -429,26 +429,26 @@ const ms = (e) => {
|
|
|
429
429
|
isEnabled: e,
|
|
430
430
|
alchemyApiKey: t
|
|
431
431
|
}) => {
|
|
432
|
-
const { connectedWallets: s } =
|
|
432
|
+
const { connectedWallets: s } = b(), { ctx: r } = _(), n = tn(), { refetch: a } = he(), { refetch: l } = Ot({
|
|
433
433
|
isEnabled: e,
|
|
434
434
|
connectedWallets: s,
|
|
435
435
|
alchemyApiKey: t ?? ""
|
|
436
436
|
});
|
|
437
|
-
|
|
438
|
-
const c =
|
|
437
|
+
R(() => {
|
|
438
|
+
const c = F(r, ["transfer_success"]);
|
|
439
439
|
!e || !c || (async () => (await a(), t && (await new Promise((d) => {
|
|
440
440
|
setTimeout(d, 1e4);
|
|
441
441
|
}), await l()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
|
|
442
442
|
}, [r.state, e, t]);
|
|
443
443
|
}, Te = () => {
|
|
444
|
-
const { connectedWallets: e } =
|
|
445
|
-
return { mergedBalance:
|
|
444
|
+
const { connectedWallets: e } = b(), { intentBalances: t } = he(), { walletBalance: s } = xe(e);
|
|
445
|
+
return { mergedBalance: B(
|
|
446
446
|
() => ({ ...s, ...t }),
|
|
447
447
|
[s, t]
|
|
448
448
|
) };
|
|
449
449
|
}, ps = ({ isEnabled: e }) => {
|
|
450
450
|
const { ctx: t } = _(), { mergedBalance: s } = Te();
|
|
451
|
-
|
|
451
|
+
R(() => {
|
|
452
452
|
if (!e)
|
|
453
453
|
return;
|
|
454
454
|
if (!t.sourceToken || !t.walletAddress) {
|
|
@@ -477,7 +477,7 @@ const ms = (e) => {
|
|
|
477
477
|
isEnabled: e
|
|
478
478
|
}) => {
|
|
479
479
|
const { ctx: t } = _(), { tokens: s } = V();
|
|
480
|
-
|
|
480
|
+
R(() => {
|
|
481
481
|
if (!e)
|
|
482
482
|
return;
|
|
483
483
|
if (!t.sourceToken) {
|
|
@@ -513,18 +513,18 @@ const ms = (e) => {
|
|
|
513
513
|
});
|
|
514
514
|
}, [s, t.sourceToken]);
|
|
515
515
|
}, Ts = ({ isEnabled: e }) => {
|
|
516
|
-
const { connectedWallets: t } =
|
|
516
|
+
const { connectedWallets: t } = b(), { ctx: s, state: r } = _(), { walletAddress: n } = ft(
|
|
517
517
|
t,
|
|
518
518
|
s.sourceToken
|
|
519
519
|
);
|
|
520
|
-
|
|
520
|
+
R(() => {
|
|
521
521
|
if (!e)
|
|
522
522
|
return;
|
|
523
|
-
h("walletAddressSet", n),
|
|
523
|
+
h("walletAddressSet", n), F(s, ["initial_dry", "initial_wallet"]) && (r === "initial_wallet" && !n ? L("initial_dry") : r === "initial_dry" && n && L("initial_wallet"));
|
|
524
524
|
}, [e, n, s, r]);
|
|
525
525
|
}, gs = (e) => (["depositAddress"].forEach((t) => {
|
|
526
526
|
if (!(t in e))
|
|
527
|
-
return
|
|
527
|
+
return C.error(`Missing ${t} in quote response`), !1;
|
|
528
528
|
}), !0), Is = () => {
|
|
529
529
|
const { ctx: e } = _(), {
|
|
530
530
|
walletSupportedChains: t,
|
|
@@ -533,24 +533,24 @@ const ms = (e) => {
|
|
|
533
533
|
appFees: n,
|
|
534
534
|
fetchQuote: a,
|
|
535
535
|
slippageTolerance: l
|
|
536
|
-
} =
|
|
537
|
-
const { signal:
|
|
538
|
-
return a ? a(
|
|
536
|
+
} = b(), c = Fe(e), d = Z(null), u = Z(new AbortController()), i = B(() => async (f, w) => {
|
|
537
|
+
const { signal: p } = u.current;
|
|
538
|
+
return a ? a(f, {
|
|
539
539
|
...w,
|
|
540
|
-
signal:
|
|
540
|
+
signal: p
|
|
541
541
|
}) : (await ye.post(
|
|
542
542
|
"https://1click.chaindefuser.com/v0/quote",
|
|
543
|
-
|
|
544
|
-
{ signal:
|
|
543
|
+
f,
|
|
544
|
+
{ signal: p }
|
|
545
545
|
)).data.quote;
|
|
546
546
|
}, [ye]);
|
|
547
547
|
return {
|
|
548
548
|
make: async ({
|
|
549
|
-
message:
|
|
549
|
+
message: f,
|
|
550
550
|
quoteType: w = "exact_in",
|
|
551
|
-
options:
|
|
551
|
+
options: p = {}
|
|
552
552
|
} = {}) => {
|
|
553
|
-
if (!
|
|
553
|
+
if (!F(e, [
|
|
554
554
|
"input_valid_dry",
|
|
555
555
|
"input_valid_external",
|
|
556
556
|
"input_valid_internal",
|
|
@@ -558,31 +558,31 @@ const ms = (e) => {
|
|
|
558
558
|
"quote_success_external"
|
|
559
559
|
])) {
|
|
560
560
|
const S = `Unable to run quote in current state ${e.state}`;
|
|
561
|
-
throw
|
|
561
|
+
throw C.error(`[WIDGET] ${S}`), new q({
|
|
562
562
|
code: "QUOTE_INVALID_INITIAL",
|
|
563
563
|
meta: { isDry: c, message: S }
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
|
-
const
|
|
566
|
+
const I = se({
|
|
567
567
|
addressType: s,
|
|
568
568
|
walletAddress: c ? (
|
|
569
569
|
// address on the target chain should be a dry quote recipient
|
|
570
570
|
ze(e.targetToken.blockchain)
|
|
571
571
|
) : e.walletAddress ?? ""
|
|
572
|
-
}),
|
|
572
|
+
}), y = I && (e.sourceToken.isIntent || !t.includes(e.sourceToken.blockchain)), E = () => c ? ze(
|
|
573
573
|
e.sourceToken.blockchain,
|
|
574
574
|
e.sourceToken.isIntent
|
|
575
|
-
) :
|
|
576
|
-
if (!
|
|
575
|
+
) : y ? I : e.walletAddress ?? "";
|
|
576
|
+
if (!I) {
|
|
577
577
|
const S = "No corresponding intents account to run a quote";
|
|
578
|
-
throw
|
|
578
|
+
throw C.error(`[WIDGET] ${S}`), new q({
|
|
579
579
|
code: "QUOTE_INVALID_INITIAL",
|
|
580
580
|
meta: { isDry: c, message: S }
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
d.current && (u.current.abort("Abort previous quote (auto)"), u.current = new AbortController());
|
|
584
|
-
let
|
|
585
|
-
const
|
|
584
|
+
let x;
|
|
585
|
+
const v = {
|
|
586
586
|
// Settings
|
|
587
587
|
dry: c,
|
|
588
588
|
slippageTolerance: l,
|
|
@@ -597,35 +597,35 @@ const ms = (e) => {
|
|
|
597
597
|
// Experimental
|
|
598
598
|
quoteWaitingTimeMs: 0
|
|
599
599
|
};
|
|
600
|
-
|
|
600
|
+
f && (v.customRecipientMsg = f), r && (v.referral = It(r)), n && (v.appFees = [...n]);
|
|
601
601
|
try {
|
|
602
602
|
e.sourceToken.isIntent && e.targetToken.isIntent && (d.current = i(
|
|
603
603
|
{
|
|
604
|
-
...
|
|
605
|
-
recipient:
|
|
604
|
+
...v,
|
|
605
|
+
recipient: I,
|
|
606
606
|
recipientType: W.recipientType.INTENTS,
|
|
607
607
|
depositType: W.depositType.INTENTS,
|
|
608
608
|
// Refund
|
|
609
|
-
refundTo:
|
|
609
|
+
refundTo: I,
|
|
610
610
|
refundType: W.refundType.INTENTS
|
|
611
611
|
},
|
|
612
|
-
|
|
613
|
-
),
|
|
612
|
+
p
|
|
613
|
+
), x = await d.current), d.current = i(
|
|
614
614
|
{
|
|
615
|
-
...
|
|
616
|
-
recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress :
|
|
615
|
+
...v,
|
|
616
|
+
recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress : I,
|
|
617
617
|
recipientType: e.targetToken.isIntent ? W.recipientType.INTENTS : W.recipientType.DESTINATION_CHAIN,
|
|
618
618
|
depositType: e.sourceToken.isIntent ? W.depositType.INTENTS : W.depositType.ORIGIN_CHAIN,
|
|
619
619
|
// Refund
|
|
620
|
-
refundTo:
|
|
621
|
-
refundType:
|
|
620
|
+
refundTo: E(),
|
|
621
|
+
refundType: y ? W.refundType.INTENTS : W.refundType.ORIGIN_CHAIN
|
|
622
622
|
},
|
|
623
|
-
|
|
624
|
-
),
|
|
623
|
+
p
|
|
624
|
+
), x = await d.current;
|
|
625
625
|
} catch (S) {
|
|
626
626
|
if (S instanceof wt)
|
|
627
627
|
return;
|
|
628
|
-
|
|
628
|
+
C.error("Quote error: ", S);
|
|
629
629
|
let U = S instanceof Error ? S.message : "";
|
|
630
630
|
if (S instanceof kt) {
|
|
631
631
|
if (U = S.response?.data.message || U, U.includes("Amount is too low")) {
|
|
@@ -652,14 +652,14 @@ const ms = (e) => {
|
|
|
652
652
|
}
|
|
653
653
|
return c ? {
|
|
654
654
|
dry: !0,
|
|
655
|
-
...
|
|
655
|
+
...x,
|
|
656
656
|
deadline: void 0,
|
|
657
657
|
depositAddress: void 0
|
|
658
|
-
} : (gs(
|
|
658
|
+
} : (gs(x), {
|
|
659
659
|
dry: !1,
|
|
660
|
-
...
|
|
661
|
-
deadline:
|
|
662
|
-
depositAddress:
|
|
660
|
+
...x,
|
|
661
|
+
deadline: x.deadline,
|
|
662
|
+
depositAddress: x.depositAddress
|
|
663
663
|
});
|
|
664
664
|
},
|
|
665
665
|
cancel: () => {
|
|
@@ -667,10 +667,10 @@ const ms = (e) => {
|
|
|
667
667
|
}
|
|
668
668
|
};
|
|
669
669
|
}, ws = () => {
|
|
670
|
-
const { ctx: e } = _(), { intentsAccountType: t } =
|
|
670
|
+
const { ctx: e } = _(), { intentsAccountType: t } = b(), { isNativeNearDeposit: s } = J(), r = se({
|
|
671
671
|
addressType: t,
|
|
672
672
|
walletAddress: e.walletAddress ?? ""
|
|
673
|
-
}), n = Z(null), a = Z(new AbortController()), l =
|
|
673
|
+
}), n = Z(null), a = Z(new AbortController()), l = B(() => async (d) => At.post(
|
|
674
674
|
"",
|
|
675
675
|
{
|
|
676
676
|
id: 1,
|
|
@@ -689,7 +689,7 @@ const ms = (e) => {
|
|
|
689
689
|
), [ye]);
|
|
690
690
|
return {
|
|
691
691
|
make: async () => {
|
|
692
|
-
if (!
|
|
692
|
+
if (!F(e, [
|
|
693
693
|
"input_valid_dry",
|
|
694
694
|
"input_valid_external",
|
|
695
695
|
"input_valid_internal",
|
|
@@ -697,7 +697,7 @@ const ms = (e) => {
|
|
|
697
697
|
"quote_success_external"
|
|
698
698
|
])) {
|
|
699
699
|
const i = `Unable to run quote in current state ${e.state}`;
|
|
700
|
-
throw
|
|
700
|
+
throw C.error(`[WIDGET] ${i}`), new q({
|
|
701
701
|
code: "QUOTE_INVALID_INITIAL",
|
|
702
702
|
meta: { isDry: !1, message: i }
|
|
703
703
|
});
|
|
@@ -728,7 +728,7 @@ const ms = (e) => {
|
|
|
728
728
|
});
|
|
729
729
|
if (!r) {
|
|
730
730
|
const i = "No corresponding intents account to run a quote";
|
|
731
|
-
throw
|
|
731
|
+
throw C.error(`[WIDGET] ${i}`), new q({
|
|
732
732
|
code: "QUOTE_INVALID_INITIAL",
|
|
733
733
|
meta: { isDry: !1, message: i }
|
|
734
734
|
});
|
|
@@ -769,7 +769,7 @@ const ms = (e) => {
|
|
|
769
769
|
} catch (i) {
|
|
770
770
|
if (i instanceof wt)
|
|
771
771
|
return;
|
|
772
|
-
if (
|
|
772
|
+
if (C.error(i), i instanceof kt) {
|
|
773
773
|
const m = i.response?.data.message || i.message;
|
|
774
774
|
throw new q({
|
|
775
775
|
code: "QUOTE_FAILED",
|
|
@@ -796,25 +796,25 @@ const ms = (e) => {
|
|
|
796
796
|
ot({
|
|
797
797
|
code: "SEND_ADDRESS_IS_NOT_VERIFIED",
|
|
798
798
|
meta: { address: e.sendAddress, chain: "near" }
|
|
799
|
-
}), h("setInputsValidating", !1),
|
|
799
|
+
}), h("setInputsValidating", !1), L("initial_wallet");
|
|
800
800
|
return;
|
|
801
801
|
}
|
|
802
802
|
if (h("setInputsValidating", !1), !t) {
|
|
803
803
|
ot({
|
|
804
804
|
code: "SEND_ADDRESS_IS_NOT_FOUND",
|
|
805
805
|
meta: { address: e.sendAddress, chain: "near" }
|
|
806
|
-
}),
|
|
806
|
+
}), L("initial_wallet");
|
|
807
807
|
return;
|
|
808
808
|
}
|
|
809
|
-
e.error ? yn(e.error) && (h("errorSet", null),
|
|
809
|
+
e.error ? yn(e.error) && (h("errorSet", null), L("input_valid_external")) : L("input_valid_external");
|
|
810
810
|
}, Ft = (e) => {
|
|
811
|
-
const t =
|
|
811
|
+
const t = F(e, ["initial_dry"]), s = F(e, ["input_valid_dry"]);
|
|
812
812
|
if (!t && !s)
|
|
813
813
|
return;
|
|
814
814
|
let r;
|
|
815
815
|
return t && (e.sourceToken ? e.targetToken ? ae(e.sourceTokenAmount) ? e.walletAddress && !Le(e) && (r = { code: "SOURCE_BALANCE_INSUFFICIENT" }) : r = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : r = { code: "TARGET_TOKEN_IS_EMPTY" } : r = { code: "SOURCE_TOKEN_IS_EMPTY" }), !s && r ? h("errorSet", r) : e.error && !Be(e.error) && !qe(e.error) && h("errorSet", null), s && r?.code === "SOURCE_BALANCE_INSUFFICIENT" && h("errorSet", r), s;
|
|
816
816
|
}, Lt = (e) => {
|
|
817
|
-
const t =
|
|
817
|
+
const t = F(e, ["initial_wallet"]), s = F(e, ["input_valid_external"]);
|
|
818
818
|
if (!t && !s)
|
|
819
819
|
return;
|
|
820
820
|
const r = e.sourceTokenBalance;
|
|
@@ -824,7 +824,7 @@ const ms = (e) => {
|
|
|
824
824
|
meta: { address: e.sendAddress, chain: "near" }
|
|
825
825
|
} : e.isDepositFromExternalWallet || (!r || !St(r) ? n = { code: "INVALID_SOURCE_BALANCE" } : Le(e) || (n = { code: "SOURCE_BALANCE_INSUFFICIENT" })) : n = { code: "SEND_ADDRESS_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_AMOUNT_IS_EMPTY" } : n = { code: "TARGET_TOKEN_IS_EMPTY" } : n = { code: "SOURCE_TOKEN_IS_EMPTY" }), s && e.targetToken.blockchain === "near" && it(e), !s && n ? h("errorSet", n) : e.error && !Be(e.error) && !qe(e.error) && h("errorSet", null), s;
|
|
826
826
|
}, Bt = (e) => {
|
|
827
|
-
const t =
|
|
827
|
+
const t = F(e, ["initial_wallet"]), s = F(e, ["input_valid_internal"]);
|
|
828
828
|
if (!t && !s)
|
|
829
829
|
return;
|
|
830
830
|
const r = e.sourceTokenBalance;
|
|
@@ -834,9 +834,9 @@ const ms = (e) => {
|
|
|
834
834
|
const t = Fe(e), s = !t && e.targetToken?.isIntent === !0, r = !t && e.targetToken?.isIntent === !1;
|
|
835
835
|
if (t) {
|
|
836
836
|
const n = Ft(e);
|
|
837
|
-
return
|
|
837
|
+
return L(n ? "input_valid_dry" : "initial_dry");
|
|
838
838
|
}
|
|
839
|
-
r && Lt(e) ?
|
|
839
|
+
r && Lt(e) ? L("input_valid_external") : s && Bt(e) ? L("input_valid_internal") : L("initial_wallet");
|
|
840
840
|
}, ks = ({
|
|
841
841
|
isEnabled: e,
|
|
842
842
|
message: t,
|
|
@@ -850,33 +850,33 @@ const ms = (e) => {
|
|
|
850
850
|
isDirectNearTokenWithdrawal: d,
|
|
851
851
|
isDirectTokenOnNearTransfer: u,
|
|
852
852
|
isSameAssetDiffChainWithdrawal: i
|
|
853
|
-
} = J(), m = Fe(n),
|
|
854
|
-
|
|
853
|
+
} = J(), m = Fe(n), f = e && !n.areInputsValidating && (i || (c || a) && n.isDepositFromExternalWallet || !d && !l && !c && !u), { make: w, cancel: p } = Is(), { make: k, cancel: I } = ws(), y = Z(null), E = () => {
|
|
854
|
+
p(), I();
|
|
855
855
|
};
|
|
856
|
-
|
|
857
|
-
const
|
|
858
|
-
(m && !
|
|
859
|
-
}, [
|
|
860
|
-
const
|
|
861
|
-
async (
|
|
856
|
+
R(() => {
|
|
857
|
+
const v = F(n, ["input_valid_dry"]), S = F(n, ["input_valid_external"]), U = F(n, ["input_valid_internal"]);
|
|
858
|
+
(m && !v || !m && n.targetToken?.isIntent && !U || !m && !n.targetToken?.isIntent && !S || n.areInputsValidating) && E();
|
|
859
|
+
}, [E, m, n]);
|
|
860
|
+
const x = le(
|
|
861
|
+
async (v) => {
|
|
862
862
|
try {
|
|
863
863
|
let S;
|
|
864
864
|
if (n.sourceToken?.assetId === n.targetToken?.assetId || a && n.isDepositFromExternalWallet) {
|
|
865
865
|
if (m)
|
|
866
866
|
return;
|
|
867
|
-
h("quoteSetStatus", "pending"), S = await
|
|
867
|
+
h("quoteSetStatus", "pending"), S = await k();
|
|
868
868
|
} else
|
|
869
|
-
h("quoteSetStatus", "pending"), S = await w({ message: t, quoteType: s, options:
|
|
869
|
+
h("quoteSetStatus", "pending"), S = await w({ message: t, quoteType: s, options: v });
|
|
870
870
|
if (!S)
|
|
871
871
|
return;
|
|
872
872
|
if (h("quoteSetStatus", "success"), h("quoteSet", S), !m && n.error?.code !== "SOURCE_BALANCE_INSUFFICIENT" && h("errorSet", null), h("tokenSetAmount", {
|
|
873
873
|
variant: "target",
|
|
874
874
|
amount: S.amountOut
|
|
875
875
|
}), n.state === "input_valid_dry") {
|
|
876
|
-
|
|
876
|
+
L("quote_success_dry");
|
|
877
877
|
return;
|
|
878
878
|
}
|
|
879
|
-
n.targetToken?.isIntent ?
|
|
879
|
+
n.targetToken?.isIntent ? L("quote_success_internal") : L("quote_success_external");
|
|
880
880
|
} catch (S) {
|
|
881
881
|
if (S instanceof q) {
|
|
882
882
|
if (S.data.code === "QUOTE_INVALID_INITIAL") {
|
|
@@ -886,24 +886,24 @@ const ms = (e) => {
|
|
|
886
886
|
h("quoteSetStatus", "error"), h("quoteSet", void 0), h("errorSet", S.data), qt(n);
|
|
887
887
|
return;
|
|
888
888
|
}
|
|
889
|
-
|
|
889
|
+
C.error("Unhandled error in useMakeQuoteEffect:", S), h("quoteSetStatus", "error"), h("quoteSet", void 0), h("errorSet", {
|
|
890
890
|
code: "QUOTE_FAILED",
|
|
891
891
|
meta: { message: "Unknown error" }
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
894
|
},
|
|
895
|
-
[n, m,
|
|
895
|
+
[n, m, k, w, t, s, f]
|
|
896
896
|
);
|
|
897
|
-
|
|
898
|
-
!
|
|
899
|
-
}, [
|
|
900
|
-
const
|
|
901
|
-
|
|
897
|
+
R(() => {
|
|
898
|
+
!f || !(m ? 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 || x({ isRefetch: !1 }));
|
|
899
|
+
}, [f, x, E, n.sourceToken, n.targetToken]), R(() => {
|
|
900
|
+
const v = () => {
|
|
901
|
+
y.current && (clearInterval(y.current), y.current = null);
|
|
902
902
|
};
|
|
903
|
-
return n.state !== "quote_success_internal" && n.state !== "quote_success_external" || !r || (
|
|
904
|
-
await
|
|
905
|
-
}, r)),
|
|
906
|
-
}, [
|
|
903
|
+
return n.state !== "quote_success_internal" && n.state !== "quote_success_external" || !r || (y.current = setInterval(async () => {
|
|
904
|
+
await x({ isRefetch: !0 });
|
|
905
|
+
}, r)), v;
|
|
906
|
+
}, [f, x, E, n.state]);
|
|
907
907
|
}, we = {
|
|
908
908
|
sol: "sol",
|
|
909
909
|
evm: "eth",
|
|
@@ -916,17 +916,18 @@ const ms = (e) => {
|
|
|
916
916
|
const { tokens: r } = V(), { ctx: n, state: a } = _(), { intentBalances: l } = he(), {
|
|
917
917
|
walletSupportedChains: c,
|
|
918
918
|
enableAccountAbstraction: d,
|
|
919
|
-
|
|
920
|
-
|
|
919
|
+
chainsFilter: u,
|
|
920
|
+
intentsAccountType: i
|
|
921
|
+
} = b(), m = Cn({
|
|
921
922
|
tokens: r,
|
|
922
923
|
walletSupportedChains: c,
|
|
923
924
|
balances: l,
|
|
924
925
|
across: "intents"
|
|
925
|
-
}), [
|
|
926
|
+
}), [f, w] = B(() => !n.walletAddress && !t ? [
|
|
926
927
|
{ token: En({ tokens: r }), status: "loaded" },
|
|
927
928
|
{ token: void 0, status: "loaded" }
|
|
928
|
-
] : d && !t ?
|
|
929
|
-
{ token:
|
|
929
|
+
] : (u ? u.source.intents !== "none" : d) && !t ? m ? [
|
|
930
|
+
{ token: m, status: "loaded" },
|
|
930
931
|
{ token: void 0, status: "loaded" }
|
|
931
932
|
] : [
|
|
932
933
|
{ token: void 0, status: "loading" },
|
|
@@ -940,70 +941,70 @@ const ms = (e) => {
|
|
|
940
941
|
], [
|
|
941
942
|
r,
|
|
942
943
|
t,
|
|
943
|
-
|
|
944
|
+
u,
|
|
944
945
|
n.walletAddress,
|
|
945
|
-
|
|
946
|
+
m,
|
|
946
947
|
c,
|
|
947
948
|
a
|
|
948
949
|
]);
|
|
949
|
-
|
|
950
|
+
R(() => {
|
|
950
951
|
if (!e)
|
|
951
952
|
return;
|
|
952
|
-
if (
|
|
953
|
+
if (F(n, ["initial_dry", "initial_wallet"]) && (f.status === "loaded" && !n.sourceToken && h("tokenSelect", {
|
|
953
954
|
variant: "source",
|
|
954
|
-
token:
|
|
955
|
-
}),
|
|
956
|
-
let
|
|
955
|
+
token: f.token
|
|
956
|
+
}), w.status === "loaded" && f.status === "loaded" && !n.targetToken)) {
|
|
957
|
+
let I = w.token;
|
|
957
958
|
if (s === "same-asset")
|
|
958
|
-
if (
|
|
959
|
-
if (!
|
|
959
|
+
if (f.token?.isIntent) {
|
|
960
|
+
if (!i)
|
|
960
961
|
throw new Error(
|
|
961
962
|
"Intents account type is required to select same-asset target token"
|
|
962
963
|
);
|
|
963
|
-
|
|
964
|
-
(
|
|
964
|
+
I = r.find(
|
|
965
|
+
(y) => !y.isIntent && y.symbol === n.sourceToken?.symbol && y.blockchain === we[i]
|
|
965
966
|
);
|
|
966
967
|
} else
|
|
967
|
-
|
|
968
|
-
(
|
|
968
|
+
I = r.find(
|
|
969
|
+
(y) => y.isIntent && y.symbol === n.sourceToken?.symbol
|
|
969
970
|
);
|
|
970
971
|
h("tokenSelect", {
|
|
971
972
|
variant: "target",
|
|
972
|
-
token:
|
|
973
|
+
token: I
|
|
973
974
|
});
|
|
974
975
|
}
|
|
975
|
-
}, [n,
|
|
976
|
-
const
|
|
977
|
-
const
|
|
978
|
-
(
|
|
979
|
-
) ??
|
|
976
|
+
}, [n, f, w, e]);
|
|
977
|
+
const p = (k, I) => {
|
|
978
|
+
const y = r.find(
|
|
979
|
+
(E) => !E.isIntent && E.blockchain === we[k] && E.symbol.toLowerCase() === un[we[k]]?.toLowerCase()
|
|
980
|
+
) ?? I;
|
|
980
981
|
h("tokenSelect", {
|
|
981
982
|
variant: "source",
|
|
982
|
-
token:
|
|
983
|
+
token: y
|
|
983
984
|
});
|
|
984
985
|
};
|
|
985
|
-
return
|
|
986
|
-
const
|
|
987
|
-
if (!e || !
|
|
986
|
+
return R(() => {
|
|
987
|
+
const k = F(n, ["initial_dry", "initial_wallet"]);
|
|
988
|
+
if (!e || !k)
|
|
988
989
|
return;
|
|
989
|
-
const
|
|
990
|
-
(
|
|
991
|
-
),
|
|
992
|
-
|
|
990
|
+
const I = r.find(
|
|
991
|
+
(E) => E.isIntent && E.symbol === "AURORA" && E.blockchain === "near"
|
|
992
|
+
), y = setTimeout(() => {
|
|
993
|
+
f.token || (!t && m ? h("tokenSelect", {
|
|
993
994
|
variant: "source",
|
|
994
|
-
token:
|
|
995
|
-
}) : c.length &&
|
|
995
|
+
token: m
|
|
996
|
+
}) : c.length && i ? p(i, I) : n.walletAddress && _t(n.walletAddress) ? p("sol", I) : n.walletAddress && yt(n.walletAddress) ? p("evm", I) : n.walletAddress && Nt(n.walletAddress) ? p("near", I) : h("tokenSelect", {
|
|
996
997
|
variant: "source",
|
|
997
|
-
token:
|
|
998
|
+
token: I
|
|
998
999
|
}));
|
|
999
1000
|
}, 3e3);
|
|
1000
|
-
return () => clearTimeout(
|
|
1001
|
-
}, [r,
|
|
1001
|
+
return () => clearTimeout(y);
|
|
1002
|
+
}, [r, f, t]), { source: n.sourceToken, target: n.targetToken };
|
|
1002
1003
|
}, Ss = ({
|
|
1003
1004
|
isEnabled: e,
|
|
1004
1005
|
alchemyApiKey: t
|
|
1005
1006
|
}) => {
|
|
1006
|
-
const { connectedWallets: s } =
|
|
1007
|
+
const { connectedWallets: s } = b();
|
|
1007
1008
|
Ot({
|
|
1008
1009
|
isEnabled: e,
|
|
1009
1010
|
connectedWallets: s,
|
|
@@ -1015,19 +1016,19 @@ const ms = (e) => {
|
|
|
1015
1016
|
}, _s = ({ debug: e }) => {
|
|
1016
1017
|
ee.onContextChange((t, s) => {
|
|
1017
1018
|
const r = s;
|
|
1018
|
-
if (e &&
|
|
1019
|
+
if (e && C.debug("[WIDGET] Context changed", r), e && t.error && Dn(r) && C.debug(`[WIDGET] Error set to ${t.error.code}`), xn(r) || Bn(t, r, e))
|
|
1019
1020
|
return;
|
|
1020
1021
|
if (Fn(t, r)) {
|
|
1021
|
-
h("reset", { clearWalletAddress: !0 }),
|
|
1022
|
+
h("reset", { clearWalletAddress: !0 }), L("initial_dry");
|
|
1022
1023
|
return;
|
|
1023
1024
|
}
|
|
1024
1025
|
const { isChanged: n, isDry: a } = vn(t, r);
|
|
1025
1026
|
if (n) {
|
|
1026
1027
|
if (On(t)) {
|
|
1027
1028
|
const l = a ? "initial_dry" : "initial_wallet";
|
|
1028
|
-
|
|
1029
|
+
L(l, {
|
|
1029
1030
|
onMoved: () => {
|
|
1030
|
-
e &&
|
|
1031
|
+
e && C.debug(
|
|
1031
1032
|
`[WIDGET] Inputs changed. State moved to ${l}`
|
|
1032
1033
|
);
|
|
1033
1034
|
}
|
|
@@ -1038,7 +1039,7 @@ const ms = (e) => {
|
|
|
1038
1039
|
});
|
|
1039
1040
|
}, ys = ({ debug: e }) => {
|
|
1040
1041
|
ee.onTransition((t, s) => {
|
|
1041
|
-
e &&
|
|
1042
|
+
e && C.debug(`===> [WIDGET] State moved from ${t} to ${s}`);
|
|
1042
1043
|
});
|
|
1043
1044
|
}, bs = (e, t) => {
|
|
1044
1045
|
const { variant: s, token: r } = t, { config: n } = Re(Qe);
|
|
@@ -1066,17 +1067,17 @@ const ms = (e) => {
|
|
|
1066
1067
|
default:
|
|
1067
1068
|
Oe(s, { throwError: !1 });
|
|
1068
1069
|
}
|
|
1069
|
-
},
|
|
1070
|
+
}, O = (e, t) => ee.on(
|
|
1070
1071
|
e,
|
|
1071
1072
|
(s, r) => t(s, r, ee)
|
|
1072
1073
|
), Es = () => {
|
|
1073
|
-
|
|
1074
|
+
O("quoteSetStatus", Mn), O("walletAddressSet", Hn), O("transferSetStatus", jn), O("tokenSelectRotate", be), O("tokenSetBalance", Gn), O("tokenSetAmount", Vn), O("depositTypeSet", Qn), O("setInputsValidating", Kn), O("externalDepositTxSet", $n), O("tokenSelect", bs), O("addressSet", Wn), O("errorSet", Un), O("quoteSet", Pn), O("reset", qn), O("validateDryInputs", Ft), O("validateExternalInputs", Lt), O("validateInternalInputs", Bt);
|
|
1074
1075
|
}, Cs = gn(({ debug: e }) => {
|
|
1075
|
-
e &&
|
|
1076
|
-
"[WIDGET] Debug mode is enabled (package version: 3.
|
|
1076
|
+
e && C.debug(
|
|
1077
|
+
"[WIDGET] Debug mode is enabled (package version: 3.25.0)"
|
|
1077
1078
|
), Es(), ys({ debug: e }), _s({ debug: e });
|
|
1078
1079
|
}), Oc = ({ listenTo: e, debug: t = !1 }) => {
|
|
1079
|
-
|
|
1080
|
+
R(() => {
|
|
1080
1081
|
Cs({ debug: t });
|
|
1081
1082
|
}, [t]);
|
|
1082
1083
|
const s = e.find(
|
|
@@ -1127,7 +1128,7 @@ class q extends Ut {
|
|
|
1127
1128
|
super(t), this.name = "QuoteError";
|
|
1128
1129
|
}
|
|
1129
1130
|
}
|
|
1130
|
-
class
|
|
1131
|
+
class g extends Ut {
|
|
1131
1132
|
constructor(t) {
|
|
1132
1133
|
super(t), this.name = "TransferError";
|
|
1133
1134
|
}
|
|
@@ -1148,7 +1149,7 @@ const Fc = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
|
|
|
1148
1149
|
};
|
|
1149
1150
|
}, Lc = (e) => {
|
|
1150
1151
|
const t = fe($);
|
|
1151
|
-
if (!
|
|
1152
|
+
if (!F(t.context, [e]))
|
|
1152
1153
|
throw new M(
|
|
1153
1154
|
`[WIDGET] Attempt to access snapshot for ${e} state while context does not match`
|
|
1154
1155
|
);
|
|
@@ -1178,22 +1179,22 @@ function xs(e) {
|
|
|
1178
1179
|
return {
|
|
1179
1180
|
make: async (l, c) => {
|
|
1180
1181
|
if (!e)
|
|
1181
|
-
throw new
|
|
1182
|
+
throw new g({
|
|
1182
1183
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1183
1184
|
meta: { message: "No connected wallet to sign a transfer." }
|
|
1184
1185
|
});
|
|
1185
1186
|
if (!r && t.sourceToken?.assetId !== j)
|
|
1186
|
-
throw new
|
|
1187
|
+
throw new g({
|
|
1187
1188
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1188
1189
|
meta: { message: "No token selected to transfer." }
|
|
1189
1190
|
});
|
|
1190
1191
|
if (!l)
|
|
1191
|
-
throw new
|
|
1192
|
+
throw new g({
|
|
1192
1193
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1193
1194
|
meta: { message: "No recipient address to transfer." }
|
|
1194
1195
|
});
|
|
1195
1196
|
if (!n)
|
|
1196
|
-
throw new
|
|
1197
|
+
throw new g({
|
|
1197
1198
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1198
1199
|
meta: { message: "No amount to transfer." }
|
|
1199
1200
|
});
|
|
@@ -1265,18 +1266,18 @@ function xs(e) {
|
|
|
1265
1266
|
transactionLink: `https://nearblocks.io/txns/${i[0].transaction?.hash}`,
|
|
1266
1267
|
intent: void 0
|
|
1267
1268
|
};
|
|
1268
|
-
throw new
|
|
1269
|
+
throw new g({
|
|
1269
1270
|
code: "NO_DEPOSIT_RESULT"
|
|
1270
1271
|
});
|
|
1271
1272
|
} catch (i) {
|
|
1272
1273
|
if (de(i) && ue(i))
|
|
1273
1274
|
return;
|
|
1274
|
-
throw
|
|
1275
|
+
throw C.error("[TRANSFER ERROR]", i), new g({
|
|
1275
1276
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1276
1277
|
});
|
|
1277
1278
|
}
|
|
1278
1279
|
if (!r)
|
|
1279
|
-
throw new
|
|
1280
|
+
throw new g({
|
|
1280
1281
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1281
1282
|
meta: { message: "No token selected to transfer." }
|
|
1282
1283
|
});
|
|
@@ -1289,14 +1290,14 @@ function xs(e) {
|
|
|
1289
1290
|
contractId: r,
|
|
1290
1291
|
accountId: l
|
|
1291
1292
|
})
|
|
1292
|
-
]),
|
|
1293
|
-
|
|
1293
|
+
]), f = i - m;
|
|
1294
|
+
f > 0n && u.push({
|
|
1294
1295
|
type: "FunctionCall",
|
|
1295
1296
|
params: {
|
|
1296
1297
|
methodName: "storage_deposit",
|
|
1297
1298
|
args: { account_id: l },
|
|
1298
1299
|
gas: Ye,
|
|
1299
|
-
deposit:
|
|
1300
|
+
deposit: f.toString()
|
|
1300
1301
|
}
|
|
1301
1302
|
}), u.push({
|
|
1302
1303
|
type: "FunctionCall",
|
|
@@ -1325,13 +1326,13 @@ function xs(e) {
|
|
|
1325
1326
|
transactionLink: `https://nearblocks.io/txns/${w[0].transaction?.hash}`,
|
|
1326
1327
|
intent: void 0
|
|
1327
1328
|
};
|
|
1328
|
-
throw new
|
|
1329
|
+
throw new g({
|
|
1329
1330
|
code: "NO_DEPOSIT_RESULT"
|
|
1330
1331
|
});
|
|
1331
1332
|
} catch (i) {
|
|
1332
1333
|
if (de(i) && ue(i))
|
|
1333
1334
|
return;
|
|
1334
|
-
throw
|
|
1335
|
+
throw C.error("[TRANSFER ERROR]", i), new g({
|
|
1335
1336
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1336
1337
|
});
|
|
1337
1338
|
}
|
|
@@ -1342,7 +1343,7 @@ const Os = ({
|
|
|
1342
1343
|
makeTransfer: e,
|
|
1343
1344
|
providers: t
|
|
1344
1345
|
}) => {
|
|
1345
|
-
const { ctx: s } = _(), { alchemyApiKey: r } =
|
|
1346
|
+
const { ctx: s } = _(), { alchemyApiKey: r } = b(), { make: n } = rr({
|
|
1346
1347
|
provider: t?.evm
|
|
1347
1348
|
}), { make: a } = sr({
|
|
1348
1349
|
provider: t?.sol,
|
|
@@ -1354,7 +1355,7 @@ const Os = ({
|
|
|
1354
1355
|
return n;
|
|
1355
1356
|
if (_t(d))
|
|
1356
1357
|
return a;
|
|
1357
|
-
throw new
|
|
1358
|
+
throw new g({
|
|
1358
1359
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1359
1360
|
meta: { message: "No transfer function established." }
|
|
1360
1361
|
});
|
|
@@ -1362,21 +1363,21 @@ const Os = ({
|
|
|
1362
1363
|
return { make: async () => {
|
|
1363
1364
|
if (!s.sourceToken) {
|
|
1364
1365
|
const i = "No token selected to transfer.";
|
|
1365
|
-
throw new
|
|
1366
|
+
throw new g({
|
|
1366
1367
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1367
1368
|
meta: { message: i }
|
|
1368
1369
|
});
|
|
1369
1370
|
}
|
|
1370
1371
|
if (!s.quote) {
|
|
1371
1372
|
const i = "Quote is required for a transfer.";
|
|
1372
|
-
throw new
|
|
1373
|
+
throw new g({
|
|
1373
1374
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1374
1375
|
meta: { message: i }
|
|
1375
1376
|
});
|
|
1376
1377
|
}
|
|
1377
1378
|
if (!s.quote.depositAddress) {
|
|
1378
1379
|
const i = "Quote has no deposit address. Make sure not dry.";
|
|
1379
|
-
throw new
|
|
1380
|
+
throw new g({
|
|
1380
1381
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1381
1382
|
meta: { message: i }
|
|
1382
1383
|
});
|
|
@@ -1397,7 +1398,7 @@ const Os = ({
|
|
|
1397
1398
|
if (!i) {
|
|
1398
1399
|
if (e)
|
|
1399
1400
|
return;
|
|
1400
|
-
throw
|
|
1401
|
+
throw C.error("[TRANSFER ERROR]", "No deposit result"), new g({
|
|
1401
1402
|
code: "NO_DEPOSIT_RESULT"
|
|
1402
1403
|
});
|
|
1403
1404
|
}
|
|
@@ -1407,20 +1408,20 @@ const Os = ({
|
|
|
1407
1408
|
intent: void 0
|
|
1408
1409
|
};
|
|
1409
1410
|
} catch (i) {
|
|
1410
|
-
|
|
1411
|
+
C.error("[TRANSFER ERROR]", i, { error: i });
|
|
1411
1412
|
let m = "Failed to make a transfer. Please try again.";
|
|
1412
|
-
const
|
|
1413
|
-
if (
|
|
1413
|
+
const f = de(i) && ue(i);
|
|
1414
|
+
if (f)
|
|
1414
1415
|
return;
|
|
1415
|
-
throw Nn.isAxiosError(i) ? (m = i.response?.data?.detail ?? i.message ?? "Failed to make deposit. Please try again.", new
|
|
1416
|
+
throw Nn.isAxiosError(i) ? (m = i.response?.data?.detail ?? i.message ?? "Failed to make deposit. Please try again.", new g({
|
|
1416
1417
|
code: "QUOTE_ERROR",
|
|
1417
1418
|
meta: { message: m }
|
|
1418
|
-
})) : m === "No quotes found" ? new
|
|
1419
|
+
})) : m === "No quotes found" ? new g({
|
|
1419
1420
|
code: "NO_QUOTE_FOUND"
|
|
1420
|
-
}) : i instanceof Error && !
|
|
1421
|
+
}) : i instanceof Error && !f ? new g({
|
|
1421
1422
|
code: "QUOTE_ERROR",
|
|
1422
1423
|
meta: { message: i.message }
|
|
1423
|
-
}) : new
|
|
1424
|
+
}) : new g({
|
|
1424
1425
|
code: "QUOTE_ERROR",
|
|
1425
1426
|
meta: { message: "Unknown quote transfer error" }
|
|
1426
1427
|
});
|
|
@@ -1487,13 +1488,13 @@ const Ls = ({
|
|
|
1487
1488
|
if (t) {
|
|
1488
1489
|
if (e.sendAddress)
|
|
1489
1490
|
return e.sendAddress;
|
|
1490
|
-
throw new
|
|
1491
|
+
throw new g({
|
|
1491
1492
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1492
1493
|
meta: { message: "Send to address is required for a direct transfer" }
|
|
1493
1494
|
});
|
|
1494
1495
|
}
|
|
1495
1496
|
if (!e.quote || e.quote.dry)
|
|
1496
|
-
throw new
|
|
1497
|
+
throw new g({
|
|
1497
1498
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1498
1499
|
meta: { message: "Quote is required for intents non-direct transfer" }
|
|
1499
1500
|
});
|
|
@@ -1501,7 +1502,7 @@ const Ls = ({
|
|
|
1501
1502
|
}, qs = async (e, t) => {
|
|
1502
1503
|
let s = Ze.getItem("nearWalletsPk")[t];
|
|
1503
1504
|
if (!e.signMessage)
|
|
1504
|
-
throw new
|
|
1505
|
+
throw new g({
|
|
1505
1506
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1506
1507
|
meta: { message: "Your wallet doesn't support signing messages" }
|
|
1507
1508
|
});
|
|
@@ -1513,7 +1514,7 @@ const Ls = ({
|
|
|
1513
1514
|
nonce: Pe.from(ur(32))
|
|
1514
1515
|
});
|
|
1515
1516
|
if (!a)
|
|
1516
|
-
throw new
|
|
1517
|
+
throw new g({
|
|
1517
1518
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1518
1519
|
meta: { message: "Signing message failed" }
|
|
1519
1520
|
});
|
|
@@ -1521,7 +1522,7 @@ const Ls = ({
|
|
|
1521
1522
|
[t]: a.publicKey
|
|
1522
1523
|
});
|
|
1523
1524
|
} catch {
|
|
1524
|
-
throw new
|
|
1525
|
+
throw new g({
|
|
1525
1526
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1526
1527
|
meta: { message: "Your wallet doesn't support signing messages" }
|
|
1527
1528
|
});
|
|
@@ -1559,13 +1560,13 @@ const Ls = ({
|
|
|
1559
1560
|
]
|
|
1560
1561
|
});
|
|
1561
1562
|
} catch {
|
|
1562
|
-
throw new
|
|
1563
|
+
throw new g({
|
|
1563
1564
|
code: "DIRECT_TRANSFER_ERROR",
|
|
1564
1565
|
meta: { message: "Unable to add public key to intents account" }
|
|
1565
1566
|
});
|
|
1566
1567
|
}
|
|
1567
1568
|
}, Us = ({ providers: e }) => {
|
|
1568
|
-
const { ctx: t } = _(), { appName: s, intentsAccountType: r } =
|
|
1569
|
+
const { ctx: t } = _(), { appName: s, intentsAccountType: r } = b(), {
|
|
1569
1570
|
isNativeNearDeposit: n,
|
|
1570
1571
|
isDirectNearTokenWithdrawal: a,
|
|
1571
1572
|
isDirectNonNearWithdrawal: l
|
|
@@ -1575,17 +1576,17 @@ const Ls = ({
|
|
|
1575
1576
|
onPending: u
|
|
1576
1577
|
}) => {
|
|
1577
1578
|
if (!t.walletAddress)
|
|
1578
|
-
throw new
|
|
1579
|
+
throw new g({
|
|
1579
1580
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1580
1581
|
meta: { message: "No connected wallet to sign a transfer." }
|
|
1581
1582
|
});
|
|
1582
1583
|
if (!t.sourceToken || !t.targetToken)
|
|
1583
|
-
throw new
|
|
1584
|
+
throw new g({
|
|
1584
1585
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1585
1586
|
meta: { message: "No token selected to transfer." }
|
|
1586
1587
|
});
|
|
1587
1588
|
if (!t.sourceToken.isIntent)
|
|
1588
|
-
throw new
|
|
1589
|
+
throw new g({
|
|
1589
1590
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1590
1591
|
meta: {
|
|
1591
1592
|
message: "For not intents source token use useMakeQuoteTransfer instead"
|
|
@@ -1593,14 +1594,14 @@ const Ls = ({
|
|
|
1593
1594
|
});
|
|
1594
1595
|
let i;
|
|
1595
1596
|
if (!r)
|
|
1596
|
-
throw new
|
|
1597
|
+
throw new g({
|
|
1597
1598
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1598
1599
|
meta: { message: "Intents account type is not defined" }
|
|
1599
1600
|
});
|
|
1600
1601
|
switch (r) {
|
|
1601
1602
|
case "evm":
|
|
1602
1603
|
if (!e?.evm)
|
|
1603
|
-
throw new
|
|
1604
|
+
throw new g({
|
|
1604
1605
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1605
1606
|
meta: { message: "No EVM provider configured" }
|
|
1606
1607
|
});
|
|
@@ -1611,7 +1612,7 @@ const Ls = ({
|
|
|
1611
1612
|
break;
|
|
1612
1613
|
case "sol":
|
|
1613
1614
|
if (!e?.sol)
|
|
1614
|
-
throw new
|
|
1615
|
+
throw new g({
|
|
1615
1616
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1616
1617
|
meta: { message: "No SOL provider configured" }
|
|
1617
1618
|
});
|
|
@@ -1622,7 +1623,7 @@ const Ls = ({
|
|
|
1622
1623
|
break;
|
|
1623
1624
|
case "near": {
|
|
1624
1625
|
if (!e?.near)
|
|
1625
|
-
throw new
|
|
1626
|
+
throw new g({
|
|
1626
1627
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1627
1628
|
meta: { message: "No NEAR provider configured" }
|
|
1628
1629
|
});
|
|
@@ -1637,8 +1638,8 @@ const Ls = ({
|
|
|
1637
1638
|
}
|
|
1638
1639
|
const m = new or({ referral: It(s) });
|
|
1639
1640
|
m.setIntentSigner(i);
|
|
1640
|
-
let
|
|
1641
|
-
n ?
|
|
1641
|
+
let f;
|
|
1642
|
+
n ? f = void 0 : a ? f = ir(d ?? void 0) : l ? f = void 0 : f = cr();
|
|
1642
1643
|
const w = {
|
|
1643
1644
|
assetId: t.sourceToken.assetId,
|
|
1644
1645
|
amount: BigInt(t.sourceTokenAmount),
|
|
@@ -1648,55 +1649,55 @@ const Ls = ({
|
|
|
1648
1649
|
),
|
|
1649
1650
|
destinationMemo: void 0,
|
|
1650
1651
|
feeInclusive: !0,
|
|
1651
|
-
routeConfig:
|
|
1652
|
+
routeConfig: f
|
|
1652
1653
|
};
|
|
1653
1654
|
u("WAITING_CONFIRMATION");
|
|
1654
1655
|
try {
|
|
1655
|
-
const
|
|
1656
|
+
const p = await m.estimateWithdrawalFee({
|
|
1656
1657
|
withdrawalParams: w
|
|
1657
|
-
}), { intentHash:
|
|
1658
|
+
}), { intentHash: k } = await m.signAndSendWithdrawalIntent({
|
|
1658
1659
|
withdrawalParams: w,
|
|
1659
|
-
feeEstimation:
|
|
1660
|
+
feeEstimation: p
|
|
1660
1661
|
});
|
|
1661
1662
|
u("PROCESSING");
|
|
1662
|
-
const
|
|
1663
|
+
const I = await m.waitForIntentSettlement({ intentHash: k }), y = await m.waitForWithdrawalCompletion({
|
|
1663
1664
|
withdrawalParams: w,
|
|
1664
|
-
intentTx:
|
|
1665
|
+
intentTx: I
|
|
1665
1666
|
});
|
|
1666
1667
|
return {
|
|
1667
|
-
intent:
|
|
1668
|
+
intent: I.hash,
|
|
1668
1669
|
// no hash means completion not trackable for this bridge
|
|
1669
|
-
hash:
|
|
1670
|
-
transactionLink:
|
|
1670
|
+
hash: y.hash ?? "",
|
|
1671
|
+
transactionLink: y.hash ? pr(
|
|
1671
1672
|
mn[t.targetToken.blockchain],
|
|
1672
|
-
|
|
1673
|
+
y.hash
|
|
1673
1674
|
) : ""
|
|
1674
1675
|
};
|
|
1675
|
-
} catch (
|
|
1676
|
-
if (
|
|
1677
|
-
throw new
|
|
1676
|
+
} catch (p) {
|
|
1677
|
+
if (C.error("[TRANSFER ERROR]", p), p instanceof lr)
|
|
1678
|
+
throw new g({
|
|
1678
1679
|
code: "MIN_WITHDRAWAL_AMOUNT_ERROR",
|
|
1679
1680
|
meta: {
|
|
1680
1681
|
minAmount: X(
|
|
1681
|
-
|
|
1682
|
+
p.minAmount.toString(),
|
|
1682
1683
|
t.sourceToken.decimals
|
|
1683
1684
|
)
|
|
1684
1685
|
}
|
|
1685
1686
|
});
|
|
1686
|
-
if (
|
|
1687
|
-
throw new
|
|
1687
|
+
if (p instanceof dr)
|
|
1688
|
+
throw new g({
|
|
1688
1689
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1689
1690
|
meta: { message: "Fee is above the maximum allowed" }
|
|
1690
1691
|
});
|
|
1691
|
-
if (de(
|
|
1692
|
-
if (
|
|
1693
|
-
throw new
|
|
1692
|
+
if (de(p)) {
|
|
1693
|
+
if (p.message.includes("Fee is not estimated"))
|
|
1694
|
+
throw new g({
|
|
1694
1695
|
code: "FEES_NOT_ESTIMATED"
|
|
1695
1696
|
});
|
|
1696
|
-
if (ue(
|
|
1697
|
+
if (ue(p))
|
|
1697
1698
|
return;
|
|
1698
1699
|
}
|
|
1699
|
-
throw new
|
|
1700
|
+
throw new g({
|
|
1700
1701
|
code: "DIRECT_TRANSFER_ERROR"
|
|
1701
1702
|
});
|
|
1702
1703
|
}
|
|
@@ -1727,10 +1728,10 @@ const Ls = ({
|
|
|
1727
1728
|
}), r.sourceToken?.isIntent)
|
|
1728
1729
|
m = await c({
|
|
1729
1730
|
message: e,
|
|
1730
|
-
onPending: (
|
|
1731
|
+
onPending: (f) => {
|
|
1731
1732
|
h("transferSetStatus", {
|
|
1732
1733
|
status: "pending",
|
|
1733
|
-
reason:
|
|
1734
|
+
reason: f
|
|
1734
1735
|
});
|
|
1735
1736
|
}
|
|
1736
1737
|
});
|
|
@@ -1741,7 +1742,7 @@ const Ls = ({
|
|
|
1741
1742
|
);
|
|
1742
1743
|
else if (a) {
|
|
1743
1744
|
if (!r.sendAddress)
|
|
1744
|
-
throw new
|
|
1745
|
+
throw new g({
|
|
1745
1746
|
code: "TRANSFER_INVALID_INITIAL",
|
|
1746
1747
|
meta: { message: "No recipient address to transfer" }
|
|
1747
1748
|
});
|
|
@@ -1751,14 +1752,14 @@ const Ls = ({
|
|
|
1751
1752
|
);
|
|
1752
1753
|
} else
|
|
1753
1754
|
m = await d();
|
|
1754
|
-
} catch (
|
|
1755
|
-
|
|
1755
|
+
} catch (f) {
|
|
1756
|
+
f instanceof g && (C.error(f.data), h("transferSetStatus", { status: "error" }), h("errorSet", f.data));
|
|
1756
1757
|
}
|
|
1757
1758
|
if (!m) {
|
|
1758
1759
|
h("transferSetStatus", { status: "idle" });
|
|
1759
1760
|
return;
|
|
1760
1761
|
}
|
|
1761
|
-
return h("transferSetStatus", { status: "success" }),
|
|
1762
|
+
return h("transferSetStatus", { status: "success" }), L("transfer_success"), m;
|
|
1762
1763
|
} };
|
|
1763
1764
|
}, Ws = async (e) => {
|
|
1764
1765
|
if (!e)
|
|
@@ -1787,12 +1788,12 @@ const Ls = ({
|
|
|
1787
1788
|
try {
|
|
1788
1789
|
return r(!0), await hr(u, d), !0;
|
|
1789
1790
|
} catch (i) {
|
|
1790
|
-
return
|
|
1791
|
+
return C.error("Failed to switch chain:", i), !1;
|
|
1791
1792
|
} finally {
|
|
1792
1793
|
r(!1);
|
|
1793
1794
|
}
|
|
1794
1795
|
}, [t.sourceToken, e]);
|
|
1795
|
-
return
|
|
1796
|
+
return R(() => {
|
|
1796
1797
|
l().then(a);
|
|
1797
1798
|
}, [l]), {
|
|
1798
1799
|
isSwitchingChainRequired: n,
|
|
@@ -1883,11 +1884,11 @@ const Ls = ({
|
|
|
1883
1884
|
isDirectNonNearWithdrawal: c,
|
|
1884
1885
|
isDirectTokenOnNearDeposit: d,
|
|
1885
1886
|
isDirectNearTokenWithdrawal: u
|
|
1886
|
-
} = J(), { make: i } = Ps({ providers: t, makeTransfer: s }), { isSwitchingChainRequired: m, switchChain:
|
|
1887
|
-
if (m && !await
|
|
1887
|
+
} = J(), { make: i } = Ps({ providers: t, makeTransfer: s }), { isSwitchingChainRequired: m, switchChain: f, isSwitchingChain: w } = Vs({ providers: t }), p = We(n), k = async () => {
|
|
1888
|
+
if (m && !await f())
|
|
1888
1889
|
return;
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1890
|
+
const I = await i();
|
|
1891
|
+
I && r(I);
|
|
1891
1892
|
};
|
|
1892
1893
|
if (!n.targetToken)
|
|
1893
1894
|
return /* @__PURE__ */ o(A, { ...N, state: "disabled", children: a("submit.disabled.selectTokenToReceive", "Select token to receive") });
|
|
@@ -1897,8 +1898,8 @@ const Ls = ({
|
|
|
1897
1898
|
return /* @__PURE__ */ o(A, { state: "loading", ...N, children: a("submit.pending.validating", "Validating...") });
|
|
1898
1899
|
if (w)
|
|
1899
1900
|
return /* @__PURE__ */ o(A, { state: "loading", ...N, children: a("submit.pending.switchingChain", "Switching network...") });
|
|
1900
|
-
if (!m &&
|
|
1901
|
-
return
|
|
1901
|
+
if (!m && p)
|
|
1902
|
+
return p;
|
|
1902
1903
|
if (n.transferStatus.status === "pending")
|
|
1903
1904
|
switch (n.transferStatus.reason) {
|
|
1904
1905
|
case "WAITING_CONFIRMATION":
|
|
@@ -1923,12 +1924,12 @@ const Ls = ({
|
|
|
1923
1924
|
);
|
|
1924
1925
|
}
|
|
1925
1926
|
})() })
|
|
1926
|
-
] }) : n.quoteStatus === "pending" ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: n.quote ? a("submit.pending.quote.refreshing", "Refreshing quote") : a("submit.pending.quote.finalizing", "Finalizing quote") }) : n.error ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : !n.quote && !c && !d && !u && !l ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : /* @__PURE__ */ o(A, { ...N, onClick:
|
|
1927
|
+
] }) : n.quoteStatus === "pending" ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: n.quote ? a("submit.pending.quote.refreshing", "Refreshing quote") : a("submit.pending.quote.finalizing", "Finalizing quote") }) : n.error ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : !n.quote && !c && !d && !u && !l ? /* @__PURE__ */ o(A, { state: "disabled", ...N, children: e.label }) : /* @__PURE__ */ o(A, { ...N, onClick: k, children: e.label });
|
|
1927
1928
|
}, Ks = (e) => {
|
|
1928
1929
|
const { t } = K(), { ctx: s } = _(), r = We(s);
|
|
1929
1930
|
return s.isDepositFromExternalWallet ? ae(s.sourceTokenAmount) ? s.externalDepositTxReceived ? /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.processing", "Processing") }) : /* @__PURE__ */ o(A, { state: "loading", ...N, children: t("submit.pending.externalDeposit.waiting", "Waiting for transaction") }) : /* @__PURE__ */ o(A, { ...N, state: "disabled", children: t("submit.disabled.enterAmount", "Enter amount") }) : r || /* @__PURE__ */ o($s, { ...e });
|
|
1930
1931
|
}, Hs = (e) => {
|
|
1931
|
-
const { ctx: t } = _(), s =
|
|
1932
|
+
const { ctx: t } = _(), s = b();
|
|
1932
1933
|
return t.walletAddress ? /* @__PURE__ */ o(Ks, { ...e }) : /* @__PURE__ */ o(Ms, { onClick: s.onWalletSignin });
|
|
1933
1934
|
};
|
|
1934
1935
|
Hs.Error = Qs;
|
|
@@ -1948,7 +1949,7 @@ const ct = [
|
|
|
1948
1949
|
], Gs = () => {
|
|
1949
1950
|
const { tokens: e } = V();
|
|
1950
1951
|
return {
|
|
1951
|
-
uniqueIntentsTokens:
|
|
1952
|
+
uniqueIntentsTokens: B(() => {
|
|
1952
1953
|
const t = e.filter(
|
|
1953
1954
|
(n) => n.isIntent && n.blockchain === "near" && !ct.includes(n.assetId)
|
|
1954
1955
|
), s = t.map((n) => n.isIntent && n.symbol), r = e.filter((n) => n.isIntent && n.blockchain !== "near" && !s.includes(n.symbol) && !ct.includes(n.assetId));
|
|
@@ -1975,7 +1976,7 @@ const ct = [
|
|
|
1975
1976
|
chainsFilter: r,
|
|
1976
1977
|
walletSupportedChains: n,
|
|
1977
1978
|
intentBalances: d,
|
|
1978
|
-
uniqueIntentTokenIds: u.map((
|
|
1979
|
+
uniqueIntentTokenIds: u.map((f) => f.assetId)
|
|
1979
1980
|
})
|
|
1980
1981
|
);
|
|
1981
1982
|
return {
|
|
@@ -2002,7 +2003,7 @@ const ct = [
|
|
|
2002
2003
|
COMPLETED: te.status.SUCCESS,
|
|
2003
2004
|
FAILED: te.status.FAILED
|
|
2004
2005
|
}, Bc = ({ depositAddress: e }) => {
|
|
2005
|
-
const { ctx: t } = _(), { intentsAccountType: s } =
|
|
2006
|
+
const { ctx: t } = _(), { intentsAccountType: s } = b(), [r, n] = re(null), a = se({
|
|
2006
2007
|
addressType: s,
|
|
2007
2008
|
walletAddress: t.walletAddress
|
|
2008
2009
|
});
|
|
@@ -2023,7 +2024,7 @@ const ct = [
|
|
|
2023
2024
|
);
|
|
2024
2025
|
const m = r ?? (/* @__PURE__ */ new Date()).toUTCString();
|
|
2025
2026
|
r || n(m);
|
|
2026
|
-
const
|
|
2027
|
+
const f = await At.post("", {
|
|
2027
2028
|
id: 1,
|
|
2028
2029
|
jsonrpc: "2.0",
|
|
2029
2030
|
method: "recent_deposits",
|
|
@@ -2033,7 +2034,7 @@ const ct = [
|
|
|
2033
2034
|
chain: i
|
|
2034
2035
|
}
|
|
2035
2036
|
]
|
|
2036
|
-
}), w = zs(
|
|
2037
|
+
}), w = zs(f.data, {
|
|
2037
2038
|
intentsAccountId: a,
|
|
2038
2039
|
initiatedAtDate: m,
|
|
2039
2040
|
depositAddress: e,
|
|
@@ -2056,7 +2057,7 @@ const ct = [
|
|
|
2056
2057
|
};
|
|
2057
2058
|
} };
|
|
2058
2059
|
}, Xs = ({ className: e }) => {
|
|
2059
|
-
const { t } = K(), { slippageTolerance: s } =
|
|
2060
|
+
const { t } = K(), { slippageTolerance: s } = b(), { ctx: r } = _(), n = r.sourceToken && r.targetToken && r.sourceToken.price / r.targetToken.price;
|
|
2060
2061
|
return r.sourceToken ? /* @__PURE__ */ o(
|
|
2061
2062
|
Tr,
|
|
2062
2063
|
{
|
|
@@ -2105,7 +2106,7 @@ const ct = [
|
|
|
2105
2106
|
isNotSufficient: s = !1,
|
|
2106
2107
|
onClick: r
|
|
2107
2108
|
}) => {
|
|
2108
|
-
const n =
|
|
2109
|
+
const n = b();
|
|
2109
2110
|
return !e.isIntent && !n.walletSupportedChains.includes(e.blockchain) ? /* @__PURE__ */ o("span", {}) : t === void 0 ? /* @__PURE__ */ o(wr, { width: 100 }) : /* @__PURE__ */ o(
|
|
2110
2111
|
"span",
|
|
2111
2112
|
{
|
|
@@ -2137,10 +2138,10 @@ const ct = [
|
|
|
2137
2138
|
heading: d,
|
|
2138
2139
|
onMsg: u
|
|
2139
2140
|
}) => {
|
|
2140
|
-
const i = Zt(), { ctx: m } = _(), { t:
|
|
2141
|
+
const i = Zt(), { ctx: m } = _(), { t: f } = K(), { hideTokenInputHeadings: w } = b(), p = Ar(e, s, n), k = (I) => {
|
|
2141
2142
|
u({
|
|
2142
2143
|
type: "on_change_amount",
|
|
2143
|
-
amount: kr(t, e.decimals,
|
|
2144
|
+
amount: kr(t, e.decimals, I)
|
|
2144
2145
|
});
|
|
2145
2146
|
};
|
|
2146
2147
|
return /* @__PURE__ */ T(pe, { className: "flex flex-col", "aria-label": d, children: [
|
|
@@ -2161,8 +2162,8 @@ const ct = [
|
|
|
2161
2162
|
setValue: Sr,
|
|
2162
2163
|
placeholder: "0",
|
|
2163
2164
|
state: a === "default" || a === "disabled" ? a : "error",
|
|
2164
|
-
onChange: (
|
|
2165
|
-
u({ type: "on_change_amount", amount:
|
|
2165
|
+
onChange: (I) => {
|
|
2166
|
+
u({ type: "on_change_amount", amount: I.target.value });
|
|
2166
2167
|
}
|
|
2167
2168
|
}
|
|
2168
2169
|
),
|
|
@@ -2196,7 +2197,7 @@ const ct = [
|
|
|
2196
2197
|
),
|
|
2197
2198
|
/* @__PURE__ */ T("div", { className: "gap-sw-sm min-h-sw-2xl flex items-center justify-between mt-sw-lg", children: [
|
|
2198
2199
|
/* @__PURE__ */ T("div", { className: "gap-sw-md flex items-center", children: [
|
|
2199
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-100", children:
|
|
2200
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-100", children: p }),
|
|
2200
2201
|
r ? /* @__PURE__ */ o(
|
|
2201
2202
|
"span",
|
|
2202
2203
|
{
|
|
@@ -2217,7 +2218,7 @@ const ct = [
|
|
|
2217
2218
|
token: e,
|
|
2218
2219
|
balance: t,
|
|
2219
2220
|
isNotSufficient: a === "error-balance",
|
|
2220
|
-
onClick: () =>
|
|
2221
|
+
onClick: () => k(1)
|
|
2221
2222
|
}
|
|
2222
2223
|
),
|
|
2223
2224
|
!!t && l && c && /* @__PURE__ */ T(Gt, { children: [
|
|
@@ -2225,25 +2226,25 @@ const ct = [
|
|
|
2225
2226
|
tt,
|
|
2226
2227
|
{
|
|
2227
2228
|
isClickable: a !== "disabled",
|
|
2228
|
-
onClick: () =>
|
|
2229
|
-
children:
|
|
2229
|
+
onClick: () => k(2),
|
|
2230
|
+
children: f("tokens.input.half.label", "50%")
|
|
2230
2231
|
}
|
|
2231
2232
|
),
|
|
2232
2233
|
/* @__PURE__ */ o(
|
|
2233
2234
|
tt,
|
|
2234
2235
|
{
|
|
2235
2236
|
isClickable: a !== "disabled",
|
|
2236
|
-
onClick: () =>
|
|
2237
|
-
children:
|
|
2237
|
+
onClick: () => k(1),
|
|
2238
|
+
children: f("tokens.input.max.label", "Max")
|
|
2238
2239
|
}
|
|
2239
2240
|
)
|
|
2240
2241
|
] }),
|
|
2241
|
-
!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:
|
|
2242
|
+
!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: f("tokens.input.externalBalance.label", "External balance") }) })
|
|
2242
2243
|
] })
|
|
2243
2244
|
] })
|
|
2244
2245
|
] });
|
|
2245
2246
|
}, Me = ({ onMsg: e, heading: t }) => {
|
|
2246
|
-
const { hideTokenInputHeadings: s } =
|
|
2247
|
+
const { hideTokenInputHeadings: s } = b();
|
|
2247
2248
|
return /* @__PURE__ */ T(
|
|
2248
2249
|
pe,
|
|
2249
2250
|
{
|
|
@@ -2288,7 +2289,7 @@ const ct = [
|
|
|
2288
2289
|
const { mergedBalance: t } = Te(), [s, r] = re(
|
|
2289
2290
|
e ? t[Y(e)] : void 0
|
|
2290
2291
|
);
|
|
2291
|
-
return
|
|
2292
|
+
return R(() => {
|
|
2292
2293
|
let n;
|
|
2293
2294
|
if (e) {
|
|
2294
2295
|
const a = t[Y(e)];
|
|
@@ -2308,7 +2309,7 @@ const ct = [
|
|
|
2308
2309
|
const { tokens: s } = V(e), r = Array.from(
|
|
2309
2310
|
new Set(s.map((n) => n.assetId))
|
|
2310
2311
|
);
|
|
2311
|
-
|
|
2312
|
+
R(() => {
|
|
2312
2313
|
const n = r.length === 1 ? s[0] : null;
|
|
2313
2314
|
n && t({ type: "on_select_token", token: n });
|
|
2314
2315
|
}, [s]);
|
|
@@ -2320,7 +2321,7 @@ const ct = [
|
|
|
2320
2321
|
}) => {
|
|
2321
2322
|
const { ctx: n } = _(), a = Pt(n.sourceToken);
|
|
2322
2323
|
Wt("source", e);
|
|
2323
|
-
const l =
|
|
2324
|
+
const l = B(() => {
|
|
2324
2325
|
if (!t && n.quoteStatus === "pending")
|
|
2325
2326
|
return "disabled";
|
|
2326
2327
|
if (!n.error)
|
|
@@ -2350,7 +2351,7 @@ const ct = [
|
|
|
2350
2351
|
}) => {
|
|
2351
2352
|
const { ctx: r } = _(), { usdTradeDelta: n } = J(), a = Pt(r.targetToken);
|
|
2352
2353
|
Wt("target", t);
|
|
2353
|
-
const l =
|
|
2354
|
+
const l = B(() => !e && r.quoteStatus === "pending" ? "disabled" : "default", [e, r.quoteStatus]);
|
|
2354
2355
|
return r.targetToken ? /* @__PURE__ */ o(
|
|
2355
2356
|
Ve,
|
|
2356
2357
|
{
|
|
@@ -2379,7 +2380,7 @@ const ct = [
|
|
|
2379
2380
|
className: a,
|
|
2380
2381
|
onMsg: l
|
|
2381
2382
|
}) => {
|
|
2382
|
-
const { ctx: c } = _(), { walletSupportedChains: d, appName: u } =
|
|
2383
|
+
const { ctx: c } = _(), { walletSupportedChains: d, appName: u } = b(), i = yr(t, e), m = d.includes(e.blockchain) || e.isIntent, f = t !== "0" && t !== 0 && t !== void 0;
|
|
2383
2384
|
return /* @__PURE__ */ o("li", { className: "list-none group", children: /* @__PURE__ */ T(
|
|
2384
2385
|
"div",
|
|
2385
2386
|
{
|
|
@@ -2410,7 +2411,7 @@ const ct = [
|
|
|
2410
2411
|
e.isIntent ? /* @__PURE__ */ T("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2411
2412
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2412
2413
|
" ",
|
|
2413
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${u} ${e.chainName.toLowerCase() !== "near" &&
|
|
2414
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: `on ${u} ${e.chainName.toLowerCase() !== "near" && f ? `(${e.chainName})` : ""}` })
|
|
2414
2415
|
] }) : /* @__PURE__ */ T("div", { className: "flex items-center gap-sw-xs", children: [
|
|
2415
2416
|
/* @__PURE__ */ o("span", { className: "text-sw-label-md text-sw-gray-300", children: e.symbol }),
|
|
2416
2417
|
" ",
|
|
@@ -2418,14 +2419,14 @@ const ct = [
|
|
|
2418
2419
|
] })
|
|
2419
2420
|
] }),
|
|
2420
2421
|
m && !!c.walletAddress && s && /* @__PURE__ */ T("div", { className: "gap-sw-xs flex flex-col items-end", children: [
|
|
2421
|
-
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:
|
|
2422
|
+
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(
|
|
2422
2423
|
Ue,
|
|
2423
2424
|
{
|
|
2424
2425
|
decimals: e.decimals,
|
|
2425
2426
|
value: t === void 0 ? "0" : `${t}`
|
|
2426
2427
|
}
|
|
2427
2428
|
) }),
|
|
2428
|
-
|
|
2429
|
+
f && /* @__PURE__ */ o("span", { className: "text-sw-label-sm text-sw-gray-300", children: i })
|
|
2429
2430
|
] })
|
|
2430
2431
|
]
|
|
2431
2432
|
}
|
|
@@ -2441,37 +2442,37 @@ const ct = [
|
|
|
2441
2442
|
chainIsNotSupported: c,
|
|
2442
2443
|
onMsg: d
|
|
2443
2444
|
}) => {
|
|
2444
|
-
const { t: u } = K(), { ctx: i } = _(), { walletSupportedChains: m, appName:
|
|
2445
|
+
const { t: u } = K(), { ctx: i } = _(), { walletSupportedChains: m, appName: f, priorityAssets: w = [] } = b(), { mergedBalance: p } = Te(), k = js({
|
|
2445
2446
|
variant: e,
|
|
2446
2447
|
search: t,
|
|
2447
2448
|
chainsFilter: a,
|
|
2448
2449
|
selectedChain: l,
|
|
2449
2450
|
walletSupportedChains: m,
|
|
2450
2451
|
priorityAssets: w
|
|
2451
|
-
}),
|
|
2452
|
-
() => [{ tokens:
|
|
2453
|
-
[
|
|
2454
|
-
), U =
|
|
2455
|
-
...
|
|
2456
|
-
{ label:
|
|
2457
|
-
{ tokens:
|
|
2452
|
+
}), I = i.walletAddress ? r : !1, y = Br(k.all, t), E = Z(null), [x, v] = re(-1), S = B(
|
|
2453
|
+
() => [{ tokens: k.all }],
|
|
2454
|
+
[k.all]
|
|
2455
|
+
), U = B(() => [
|
|
2456
|
+
...k.intents.length > 0 ? [
|
|
2457
|
+
{ label: f, count: k.intents.length },
|
|
2458
|
+
{ tokens: k.intents }
|
|
2458
2459
|
] : [],
|
|
2459
|
-
...
|
|
2460
|
+
...k.wallet.length > 0 ? [
|
|
2460
2461
|
{
|
|
2461
2462
|
label: c ? null : "Connected wallet",
|
|
2462
|
-
count:
|
|
2463
|
+
count: k.wallet.length
|
|
2463
2464
|
},
|
|
2464
|
-
{ tokens:
|
|
2465
|
+
{ tokens: k.wallet }
|
|
2465
2466
|
] : []
|
|
2466
|
-
].filter(Boolean), [
|
|
2467
|
-
|
|
2467
|
+
].filter(Boolean), [k.wallet, k.intents, c]), Q = I ? U : S, oe = Lr(Q), Qt = Or(Q), $e = Dr(Q), $t = le(() => {
|
|
2468
|
+
v(-1);
|
|
2468
2469
|
}, []);
|
|
2469
2470
|
switch (Er({
|
|
2470
|
-
listRef:
|
|
2471
|
-
initialFocusedIndex:
|
|
2472
|
-
onFocus: (P) =>
|
|
2471
|
+
listRef: E.current,
|
|
2472
|
+
initialFocusedIndex: I ? 1 : 0,
|
|
2473
|
+
onFocus: (P) => v(P),
|
|
2473
2474
|
onBlur: $t
|
|
2474
|
-
}),
|
|
2475
|
+
}), y) {
|
|
2475
2476
|
case "EMPTY_SEARCH":
|
|
2476
2477
|
return /* @__PURE__ */ o(
|
|
2477
2478
|
Ce,
|
|
@@ -2492,7 +2493,7 @@ const ct = [
|
|
|
2492
2493
|
return /* @__PURE__ */ o("div", { className: H("gap-sw-lg flex flex-col", s), children: /* @__PURE__ */ o(
|
|
2493
2494
|
br,
|
|
2494
2495
|
{
|
|
2495
|
-
ref:
|
|
2496
|
+
ref: E,
|
|
2496
2497
|
tabIndex: 0,
|
|
2497
2498
|
id: vr,
|
|
2498
2499
|
itemSize: Rr,
|
|
@@ -2505,12 +2506,12 @@ const ct = [
|
|
|
2505
2506
|
outline: "none"
|
|
2506
2507
|
},
|
|
2507
2508
|
onKeyDown: (P) => {
|
|
2508
|
-
if (
|
|
2509
|
+
if (E.current)
|
|
2509
2510
|
switch (P.code) {
|
|
2510
2511
|
case "ArrowUp": {
|
|
2511
2512
|
P.preventDefault();
|
|
2512
|
-
let
|
|
2513
|
-
|
|
2513
|
+
let D = Math.max(x - 1, 0);
|
|
2514
|
+
I && $e.includes(D) && (D = D === 0 ? 1 : D - 1), v(D), E.current?.scrollToIndex(D, {
|
|
2514
2515
|
align: "center",
|
|
2515
2516
|
smooth: !0
|
|
2516
2517
|
});
|
|
@@ -2518,8 +2519,8 @@ const ct = [
|
|
|
2518
2519
|
}
|
|
2519
2520
|
case "ArrowDown": {
|
|
2520
2521
|
P.preventDefault();
|
|
2521
|
-
let
|
|
2522
|
-
|
|
2522
|
+
let D = Math.min(x + 1, Qt - 1);
|
|
2523
|
+
I && $e.includes(D) && (D = D === 0 ? 1 : D + 1), v(D), E.current?.scrollToIndex(D, {
|
|
2523
2524
|
align: "center",
|
|
2524
2525
|
smooth: !0
|
|
2525
2526
|
});
|
|
@@ -2527,14 +2528,14 @@ const ct = [
|
|
|
2527
2528
|
}
|
|
2528
2529
|
case "Enter": {
|
|
2529
2530
|
P.preventDefault();
|
|
2530
|
-
const
|
|
2531
|
-
|
|
2531
|
+
const D = Fr(Q, x);
|
|
2532
|
+
D && d({ type: "on_select_token", token: D });
|
|
2532
2533
|
break;
|
|
2533
2534
|
}
|
|
2534
2535
|
}
|
|
2535
2536
|
},
|
|
2536
2537
|
children: Q.map(
|
|
2537
|
-
({ label: P, count:
|
|
2538
|
+
({ label: P, count: D, tokens: Ke }, He) => {
|
|
2538
2539
|
const Kt = xr(
|
|
2539
2540
|
Q,
|
|
2540
2541
|
He
|
|
@@ -2545,7 +2546,7 @@ const ct = [
|
|
|
2545
2546
|
className: "pb-sw-lg pt-sw-sm flex flex-col",
|
|
2546
2547
|
children: [
|
|
2547
2548
|
/* @__PURE__ */ o(qr, {}),
|
|
2548
|
-
/* @__PURE__ */ o("span", { className: "text-sw-label-sm pt-sw-xl text-sw-gray-100", children: `${P} — ${
|
|
2549
|
+
/* @__PURE__ */ o("span", { className: "text-sw-label-sm pt-sw-xl text-sw-gray-100", children: `${P} — ${D}` })
|
|
2549
2550
|
]
|
|
2550
2551
|
},
|
|
2551
2552
|
P
|
|
@@ -2556,8 +2557,8 @@ const ct = [
|
|
|
2556
2557
|
{
|
|
2557
2558
|
token: Ge,
|
|
2558
2559
|
showBalance: n,
|
|
2559
|
-
balance:
|
|
2560
|
-
isFocused:
|
|
2560
|
+
balance: p[je],
|
|
2561
|
+
isFocused: x === Kt + Ht,
|
|
2561
2562
|
isNotSelectable: c && !!i.walletAddress,
|
|
2562
2563
|
onMsg: d
|
|
2563
2564
|
},
|
|
@@ -2580,7 +2581,7 @@ const ct = [
|
|
|
2580
2581
|
),
|
|
2581
2582
|
heading: u("tokens.list.noBalanceOnApp.label", {
|
|
2582
2583
|
defaultValue: "You have no balances on {{appName}}",
|
|
2583
|
-
appName:
|
|
2584
|
+
appName: f
|
|
2584
2585
|
})
|
|
2585
2586
|
}
|
|
2586
2587
|
);
|
|
@@ -2622,8 +2623,8 @@ const ct = [
|
|
|
2622
2623
|
} = t;
|
|
2623
2624
|
s && (ke("accent", 500, e, s, d), i === "bold" && ke("gray", 50, e, s, d)), r && i === "clean" && ke("gray", 950, e, r, d), n && ne("container", n, e), a && ne("status-success", a, e), l && ne("status-warning", l, e), c && ne("status-error", c, e), u && sa(u, e);
|
|
2624
2625
|
}, oa = mt(void 0), ia = ({ children: e, theme: t }) => {
|
|
2625
|
-
const { themeParentElementSelector: s } =
|
|
2626
|
-
return
|
|
2626
|
+
const { themeParentElementSelector: s } = b(), r = B(() => t, [t]);
|
|
2627
|
+
return R(() => {
|
|
2627
2628
|
if (t) {
|
|
2628
2629
|
const n = s ? document.querySelector(s) : null;
|
|
2629
2630
|
aa(n, t);
|
|
@@ -2661,7 +2662,7 @@ const ct = [
|
|
|
2661
2662
|
initialTime: 7,
|
|
2662
2663
|
onTimeOver: n
|
|
2663
2664
|
});
|
|
2664
|
-
return
|
|
2665
|
+
return R(() => {
|
|
2665
2666
|
e ? a.start() : a.reset();
|
|
2666
2667
|
}, [e]), /* @__PURE__ */ T(pe, { className: "relative w-full gap-sw-2xl flex flex-col", children: [
|
|
2667
2668
|
/* @__PURE__ */ o(
|
|
@@ -2861,7 +2862,7 @@ const ct = [
|
|
|
2861
2862
|
config: me
|
|
2862
2863
|
}), Qe = ut({
|
|
2863
2864
|
config: me
|
|
2864
|
-
}),
|
|
2865
|
+
}), b = () => {
|
|
2865
2866
|
const e = Jt(Mt);
|
|
2866
2867
|
return fe(e).config;
|
|
2867
2868
|
}, ha = (e) => {
|
|
@@ -2883,7 +2884,7 @@ const ct = [
|
|
|
2883
2884
|
})
|
|
2884
2885
|
})
|
|
2885
2886
|
);
|
|
2886
|
-
return
|
|
2887
|
+
return R(() => {
|
|
2887
2888
|
const c = Se({
|
|
2888
2889
|
...me,
|
|
2889
2890
|
...t
|
|
@@ -2975,9 +2976,9 @@ export {
|
|
|
2975
2976
|
Ot as t,
|
|
2976
2977
|
J as u,
|
|
2977
2978
|
M as v,
|
|
2978
|
-
|
|
2979
|
+
g as w,
|
|
2979
2980
|
Fc as x,
|
|
2980
|
-
y,
|
|
2981
|
+
b as y,
|
|
2981
2982
|
Wc as z
|
|
2982
2983
|
};
|
|
2983
|
-
//# sourceMappingURL=config-
|
|
2984
|
+
//# sourceMappingURL=config-6S9JcYY_.js.map
|