@aurora-is-near/intents-swap-widget 3.14.0-redesign.9 → 3.14.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-CG-NCoEP.js → config-CeOg2QLU.js} +2 -2
- package/dist/{config-CG-NCoEP.js.map → config-CeOg2QLU.js.map} +1 -1
- 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/DepositMethodSwitcher.js +12 -10
- package/dist/features/DepositMethodSwitcher.js.map +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/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/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/localstorage.d.ts +2 -2
- package/dist/utils/localstorage.js +1 -0
- package/dist/utils/localstorage.js.map +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 +3 -3
- package/src/features/DepositMethodSwitcher.tsx +2 -0
- package/src/tests/mock-localstorage.ts +32 -0
- package/src/utils/localstorage.ts +2 -2
- package/src/widgets/WidgetDeposit/WidgetDeposit.test.tsx +6 -0
|
@@ -2,7 +2,7 @@ import "react";
|
|
|
2
2
|
import "../../utils/solana/isSolanaAddress.js";
|
|
3
3
|
import "../../utils/evm/isEvmAddress.js";
|
|
4
4
|
import "../../utils/near/isNearAddress.js";
|
|
5
|
-
import { R as l } from "../../config-
|
|
5
|
+
import { R as l } from "../../config-CeOg2QLU.js";
|
|
6
6
|
import "../../utils/tokens/getMainTokenByChain.js";
|
|
7
7
|
import "../../utils/tokens/getDefaultIntentsToken.js";
|
|
8
8
|
import "../../utils/tokens/getTokenWithHighBalance.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../../hooks/useWalletAddressForToken.js";
|
|
3
|
-
import { I as f } from "../../config-
|
|
3
|
+
import { I as f } from "../../config-CeOg2QLU.js";
|
|
4
4
|
import "../guards/index.js";
|
|
5
5
|
import "../machine.js";
|
|
6
6
|
import "../events/utils/fireEvent.js";
|
|
@@ -3,7 +3,7 @@ import "./tokenSelectRotate.js";
|
|
|
3
3
|
import "./errorSet.js";
|
|
4
4
|
import "./quoteSet.js";
|
|
5
5
|
import "./addressSet.js";
|
|
6
|
-
import { _ as b } from "../../config-
|
|
6
|
+
import { _ as b } from "../../config-CeOg2QLU.js";
|
|
7
7
|
import "./tokenSetAmount.js";
|
|
8
8
|
import "./quoteSetStatus.js";
|
|
9
9
|
import "./depositTypeSet.js";
|
|
@@ -3,7 +3,7 @@ import "../../utils/near/checkNearAccountExists.js";
|
|
|
3
3
|
import "../../utils/checkers/isNotEmptyAmount.js";
|
|
4
4
|
import "../../utils/checkers/isValidBigint.js";
|
|
5
5
|
import "../../utils/near/isNearAddress.js";
|
|
6
|
-
import { K as I, L as d, N as u } from "../../config-
|
|
6
|
+
import { K as I, L as d, N as u } from "../../config-CeOg2QLU.js";
|
|
7
7
|
import "../guards/index.js";
|
|
8
8
|
import "../machine.js";
|
|
9
9
|
import "../guards/checks/isBalanceSufficient.js";
|
package/dist/machine/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as o, u as t, a as r, c as a, b as f } from "../config-
|
|
1
|
+
import { r as o, u as t, a as r, c as a, b as f } from "../config-CeOg2QLU.js";
|
|
2
2
|
import { guardStates as S } from "./guards/index.js";
|
|
3
3
|
import { machine as n, moveTo as u } from "./machine.js";
|
|
4
4
|
import { fireEvent as i } from "./events/utils/fireEvent.js";
|
package/dist/machine/snap.js
CHANGED
|
@@ -2,7 +2,7 @@ import "valtio";
|
|
|
2
2
|
import "derive-valtio";
|
|
3
3
|
import "./computed/getIsNativeNearDeposit.js";
|
|
4
4
|
import "./computed/getIsDirectTokenOnNearDeposit.js";
|
|
5
|
-
import { u as h, a as b, b as d } from "../config-
|
|
5
|
+
import { u as h, a as b, b as d } from "../config-CeOg2QLU.js";
|
|
6
6
|
import "./machine.js";
|
|
7
7
|
import "./guards/index.js";
|
|
8
8
|
import "./computed/getUsdTradeDelta.js";
|
|
@@ -5,7 +5,7 @@ import "./checkers/isOnlyErrorChanged.js";
|
|
|
5
5
|
import "./checkers/isValidInitialState.js";
|
|
6
6
|
import "./checkers/isWalletDisconnected.js";
|
|
7
7
|
import "./checkers/isSendAddressForbidden.js";
|
|
8
|
-
import { X as g, Y as u } from "../../config-
|
|
8
|
+
import { X as g, Y as u } from "../../config-CeOg2QLU.js";
|
|
9
9
|
import "./checkers/isAmountChangedFromQuote.js";
|
|
10
10
|
import "ethers";
|
|
11
11
|
import "../machine.js";
|
|
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
|
|
|
2
2
|
import "browser-or-node";
|
|
3
3
|
import "react";
|
|
4
4
|
import "./createColorPalette.js";
|
|
5
|
-
import { C as p, ae as a } from "../config-
|
|
5
|
+
import { C as p, ae as a } from "../config-CeOg2QLU.js";
|
|
6
6
|
export {
|
|
7
7
|
p as ThemeContext,
|
|
8
8
|
a as ThemeProvider
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
type LocalStorage = {
|
|
1
|
+
export type LocalStorage = {
|
|
2
2
|
verifiedWallets: string[];
|
|
3
3
|
verifiedNearAccounts: string[];
|
|
4
4
|
nearWalletsPk: Record<string, string>;
|
|
5
5
|
};
|
|
6
|
+
export declare const defaultValues: LocalStorage;
|
|
6
7
|
export declare const localStorageTyped: {
|
|
7
8
|
getItem: <T extends keyof LocalStorage>(key: T) => LocalStorage[T];
|
|
8
9
|
setItem: <T extends keyof LocalStorage>(key: T, value: LocalStorage[T]) => void;
|
|
9
10
|
removeItem: (key: keyof LocalStorage) => void;
|
|
10
11
|
};
|
|
11
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"localstorage.js","sources":["../../src/utils/localstorage.ts"],"sourcesContent":["import { logger } from '@/logger';\n\
|
|
1
|
+
{"version":3,"file":"localstorage.js","sources":["../../src/utils/localstorage.ts"],"sourcesContent":["import { logger } from '@/logger';\n\nexport type LocalStorage = {\n verifiedWallets: string[];\n verifiedNearAccounts: string[];\n nearWalletsPk: Record<string, string>;\n};\n\nexport const defaultValues: LocalStorage = {\n verifiedWallets: [],\n verifiedNearAccounts: [],\n nearWalletsPk: {},\n};\n\nconst isBrowser = typeof window !== 'undefined' && !!window.localStorage;\n\nconst KEY_PREFIX = 'sw';\nconst getStorageKey = (key: string) => `${KEY_PREFIX}.${key}`;\n\nconst getItem = <T extends keyof LocalStorage>(key: T): LocalStorage[T] => {\n if (!isBrowser) {\n if (process.env.NODE_ENV === 'development') {\n logger.debug(\n `[WIDGET] Attempted to read ${getStorageKey(key)} from localstorage on server; returning default`,\n );\n }\n\n return defaultValues[key];\n }\n\n try {\n const storedValueLegacy = window.localStorage.getItem(key);\n let storedValue = window.localStorage.getItem(getStorageKey(key));\n\n // Migrate legacy key to new namespaced key\n if (storedValueLegacy && !storedValue) {\n storedValue = storedValueLegacy;\n window.localStorage.setItem(getStorageKey(key), storedValueLegacy);\n window.localStorage.removeItem(key);\n }\n\n return (\n // @ts-expect-error It's ok to pass null to JSON.parse\n (JSON.parse(storedValue) as LocalStorage[T]) ?? defaultValues[key]\n );\n } catch (error) {\n logger.warn(\n `[WIDGET] Failed to parse ${getStorageKey(key)} from localStorage:`,\n error,\n );\n\n return defaultValues[key];\n }\n};\n\nconst setItem = <T extends keyof LocalStorage>(\n key: T,\n value: LocalStorage[T],\n) => {\n if (!isBrowser) {\n if (process.env.NODE_ENV === 'development') {\n logger.debug(\n `[WIDGET] Attempted to set ${getStorageKey(key)} on server; skipping`,\n );\n }\n\n return;\n }\n\n try {\n const serialized =\n typeof value === 'string' ||\n typeof value === 'number' ||\n typeof value === 'boolean'\n ? String(value)\n : JSON.stringify(value);\n\n window.localStorage.setItem(getStorageKey(key), serialized);\n } catch (error) {\n logger.warn(\n `[WIDGET] Failed to set ${getStorageKey(key)} in localStorage:`,\n error,\n );\n }\n};\n\nconst removeItem = (key: keyof LocalStorage) => {\n if (!isBrowser) {\n if (process.env.NODE_ENV === 'development') {\n logger.debug(\n `[WIDGET] Attempted to remove ${getStorageKey(key)} from localstorage on server; skipping`,\n );\n }\n\n return;\n }\n\n try {\n window.localStorage.removeItem(getStorageKey(key));\n } catch (error) {\n logger.warn(\n `[WIDGET] Failed to remove ${getStorageKey(key)} from localStorage:`,\n error,\n );\n }\n};\n\nexport const localStorageTyped = {\n getItem,\n setItem,\n removeItem,\n};\n"],"names":["defaultValues","isBrowser","KEY_PREFIX","getStorageKey","key","getItem","process","logger","storedValueLegacy","storedValue","error","setItem","value","serialized","removeItem","localStorageTyped"],"mappings":";;AAQO,MAAMA,IAA8B;AAAA,EACzC,iBAAiB,CAAA;AAAA,EACjB,sBAAsB,CAAA;AAAA,EACtB,eAAe,CAAA;AACjB,GAEMC,IAAY,OAAO,SAAW,OAAe,CAAC,CAAC,OAAO,cAEtDC,IAAa,MACbC,IAAgB,CAACC,MAAgB,GAAGF,CAAU,IAAIE,CAAG,IAErDC,IAAU,CAA+BD,MAA4B;AACzE,MAAI,CAACH;AACH,WAAIK,EAAQ,IAAI,aAAa,iBAC3BC,EAAO;AAAA,MACL,8BAA8BJ,EAAcC,CAAG,CAAC;AAAA,IAAA,GAI7CJ,EAAcI,CAAG;AAG1B,MAAI;AACF,UAAMI,IAAoB,OAAO,aAAa,QAAQJ,CAAG;AACzD,QAAIK,IAAc,OAAO,aAAa,QAAQN,EAAcC,CAAG,CAAC;AAGhE,WAAII,KAAqB,CAACC,MACxBA,IAAcD,GACd,OAAO,aAAa,QAAQL,EAAcC,CAAG,GAAGI,CAAiB,GACjE,OAAO,aAAa,WAAWJ,CAAG;AAAA,IAKjC,KAAK,MAAMK,CAAW,KAAyBT,EAAcI,CAAG;AAAA,EAErE,SAASM,GAAO;AACd,WAAAH,EAAO;AAAA,MACL,4BAA4BJ,EAAcC,CAAG,CAAC;AAAA,MAC9CM;AAAA,IAAA,GAGKV,EAAcI,CAAG;AAAA,EAC1B;AACF,GAEMO,IAAU,CACdP,GACAQ,MACG;AACH,MAAI,CAACX,GAAW;AACd,IAAIK,EAAQ,IAAI,aAAa,iBAC3BC,EAAO;AAAA,MACL,6BAA6BJ,EAAcC,CAAG,CAAC;AAAA,IAAA;AAInD;AAAA,EACF;AAEA,MAAI;AACF,UAAMS,IACJ,OAAOD,KAAU,YACjB,OAAOA,KAAU,YACjB,OAAOA,KAAU,YACb,OAAOA,CAAK,IACZ,KAAK,UAAUA,CAAK;AAE1B,WAAO,aAAa,QAAQT,EAAcC,CAAG,GAAGS,CAAU;AAAA,EAC5D,SAASH,GAAO;AACd,IAAAH,EAAO;AAAA,MACL,0BAA0BJ,EAAcC,CAAG,CAAC;AAAA,MAC5CM;AAAA,IAAA;AAAA,EAEJ;AACF,GAEMI,IAAa,CAACV,MAA4B;AAC9C,MAAI,CAACH,GAAW;AACd,IAAIK,EAAQ,IAAI,aAAa,iBAC3BC,EAAO;AAAA,MACL,gCAAgCJ,EAAcC,CAAG,CAAC;AAAA,IAAA;AAItD;AAAA,EACF;AAEA,MAAI;AACF,WAAO,aAAa,WAAWD,EAAcC,CAAG,CAAC;AAAA,EACnD,SAASM,GAAO;AACd,IAAAH,EAAO;AAAA,MACL,6BAA6BJ,EAAcC,CAAG,CAAC;AAAA,MAC/CM;AAAA,IAAA;AAAA,EAEJ;AACF,GAEaK,IAAoB;AAAA,EAC/B,SAAAV;AAAA,EACA,SAAAM;AAAA,EACA,YAAAG;AACF;"}
|
|
@@ -3,7 +3,7 @@ import { useState as y, useEffect as l, useCallback as B } from "react";
|
|
|
3
3
|
import { useTokenModal as R } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { useTypedTranslation as A } from "../../localisation.js";
|
|
5
5
|
import { WidgetDepositSkeleton as b } from "./WidgetDepositSkeleton.js";
|
|
6
|
-
import { b as F, u as q, y as N, n as j, c as O, p as Q, o as U, S as K } from "../../config-
|
|
6
|
+
import { b as F, u as q, y as N, n as j, c as O, p as Q, o as U, S as K } from "../../config-CeOg2QLU.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "framer-motion";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import a from "clsx";
|
|
3
3
|
import { SkeletonBox as s } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as i } from "../../config-
|
|
4
|
+
import { y as i } from "../../config-CeOg2QLU.js";
|
|
5
5
|
const p = () => {
|
|
6
6
|
const { hideTokenInputHeadings: l } = i();
|
|
7
7
|
return /* @__PURE__ */ o("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
|
|
@@ -3,7 +3,7 @@ import { useState as b, useEffect as y } from "react";
|
|
|
3
3
|
import { useTokenModal as R } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { WidgetSwapSkeleton as S } from "./WidgetSwapSkeleton.js";
|
|
5
5
|
import { useTypedTranslation as D } from "../../localisation.js";
|
|
6
|
-
import { b as N, u as O, y as Q, n as j, c as q, p as w, o as F, S as U } from "../../config-
|
|
6
|
+
import { b as N, u as O, y as Q, n as j, c as q, p as w, o as F, S as U } from "../../config-CeOg2QLU.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "framer-motion";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import { SkeletonBox as s } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as i } from "../../config-
|
|
4
|
+
import { y as i } from "../../config-CeOg2QLU.js";
|
|
5
5
|
const m = () => {
|
|
6
6
|
const { hideTokenInputHeadings: e } = i();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: "w-full gap-sw-lg relative flex flex-col", children: [
|
|
@@ -3,7 +3,7 @@ import { useState as w, useEffect as b } from "react";
|
|
|
3
3
|
import { useTokenModal as B } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { WidgetWithdrawSkeleton as y } from "./WidgetWithdrawSkeleton.js";
|
|
5
5
|
import { useTypedTranslation as D } from "../../localisation.js";
|
|
6
|
-
import { b as N, u as O, y as Q, n as j, c as q, p as S, o as F, S as U } from "../../config-
|
|
6
|
+
import { b as N, u as O, y as Q, n as j, c as q, p as S, o as F, S as U } from "../../config-CeOg2QLU.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "framer-motion";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import { SkeletonBox as l } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as x } from "../../config-
|
|
4
|
+
import { y as x } from "../../config-CeOg2QLU.js";
|
|
5
5
|
const p = () => {
|
|
6
6
|
const { hideTokenInputHeadings: s } = x();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aurora-is-near/intents-swap-widget",
|
|
3
|
-
"version": "3.14.0
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Provides components and hooks to build your own Intents swap widget",
|
|
5
5
|
"author": "Maksim Vashchuk",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@defuse-protocol/one-click-sdk-typescript": "^0.1.5",
|
|
61
61
|
"@headlessui/react": "^2.2.4",
|
|
62
62
|
"@hot-labs/near-connect": "^0.6.8",
|
|
63
|
-
"@material-symbols-svg/react": "^0.1.
|
|
64
|
-
"@material-symbols-svg/react-rounded": "^0.1.
|
|
63
|
+
"@material-symbols-svg/react": "^0.1.19",
|
|
64
|
+
"@material-symbols-svg/react-rounded": "^0.1.19",
|
|
65
65
|
"@radix-ui/react-icons": "^1.3.2",
|
|
66
66
|
"@tanstack/react-query": "^5.85.5",
|
|
67
67
|
"@ton/core": "^0.62.0",
|
|
@@ -27,6 +27,7 @@ export const DepositMethodSwitcher = ({ children, className }: Props) => {
|
|
|
27
27
|
<Button
|
|
28
28
|
size="md"
|
|
29
29
|
icon={Icons.Wallet2}
|
|
30
|
+
state={ctx.isDepositFromExternalWallet ? 'default' : 'active'}
|
|
30
31
|
variant={ctx.isDepositFromExternalWallet ? 'outlined' : 'primary'}
|
|
31
32
|
onClick={() => onToggle(false)}>
|
|
32
33
|
My wallet
|
|
@@ -34,6 +35,7 @@ export const DepositMethodSwitcher = ({ children, className }: Props) => {
|
|
|
34
35
|
<Button
|
|
35
36
|
size="md"
|
|
36
37
|
icon={Icons.QrCode}
|
|
38
|
+
state={ctx.isDepositFromExternalWallet ? 'active' : 'default'}
|
|
37
39
|
variant={ctx.isDepositFromExternalWallet ? 'primary' : 'outlined'}
|
|
38
40
|
onClick={() => onToggle(true)}>
|
|
39
41
|
QR / Address
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
type LocalStorageKeys =
|
|
2
|
+
| 'sw.verifiedWallets'
|
|
3
|
+
| 'sw.verifiedNearAccounts'
|
|
4
|
+
| 'sw.nearWalletsPk';
|
|
5
|
+
|
|
6
|
+
const defaultStoreValues: Record<LocalStorageKeys, string> = {
|
|
7
|
+
'sw.verifiedWallets': JSON.stringify([]),
|
|
8
|
+
'sw.verifiedNearAccounts': JSON.stringify([]),
|
|
9
|
+
'sw.nearWalletsPk': JSON.stringify({}),
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const mockedLocalStorage = (() => {
|
|
13
|
+
let store: Record<LocalStorageKeys, string> = defaultStoreValues;
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
getItem: (key: LocalStorageKeys) => store[key] || null,
|
|
17
|
+
setItem: (key: LocalStorageKeys, value: string) => {
|
|
18
|
+
store[key] = value;
|
|
19
|
+
},
|
|
20
|
+
removeItem: (key: LocalStorageKeys) => {
|
|
21
|
+
delete store[key];
|
|
22
|
+
},
|
|
23
|
+
clear: () => {
|
|
24
|
+
store = defaultStoreValues;
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
})();
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(globalThis, 'localStorage', {
|
|
30
|
+
value: mockedLocalStorage,
|
|
31
|
+
writable: true,
|
|
32
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { logger } from '@/logger';
|
|
2
2
|
|
|
3
|
-
type LocalStorage = {
|
|
3
|
+
export type LocalStorage = {
|
|
4
4
|
verifiedWallets: string[];
|
|
5
5
|
verifiedNearAccounts: string[];
|
|
6
6
|
nearWalletsPk: Record<string, string>;
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
-
const defaultValues: LocalStorage = {
|
|
9
|
+
export const defaultValues: LocalStorage = {
|
|
10
10
|
verifiedWallets: [],
|
|
11
11
|
verifiedNearAccounts: [],
|
|
12
12
|
nearWalletsPk: {},
|
|
@@ -11,6 +11,7 @@ import { mockAlchemyResponse } from '../../tests/mock-alchemy-response';
|
|
|
11
11
|
import { mockGetIntentsBalances } from '../../tests/mock-get-intents-balances';
|
|
12
12
|
import { mockConnectedWalletAddress } from '../../tests/mock-connected-wallet-address';
|
|
13
13
|
import { mockOneClickQuote } from '../../tests/mock-one-click-quote';
|
|
14
|
+
import { mockedLocalStorage } from '../../tests/mock-localstorage';
|
|
14
15
|
import { mockOneClickSDK } from '../../tests/mock-one-click-sdk';
|
|
15
16
|
|
|
16
17
|
import { setup } from '../../tests/setup';
|
|
@@ -81,6 +82,11 @@ const targetToken = {
|
|
|
81
82
|
|
|
82
83
|
describe('Deposit', () => {
|
|
83
84
|
beforeEach(() => {
|
|
85
|
+
mockedLocalStorage.setItem(
|
|
86
|
+
'sw.verifiedWallets',
|
|
87
|
+
JSON.stringify([mockConnectedWalletAddress('evm')]),
|
|
88
|
+
);
|
|
89
|
+
|
|
84
90
|
mockGetIntentsBalances.mockResolvedValue({
|
|
85
91
|
'nep141:eth.bridge.near': 0,
|
|
86
92
|
'nep141:eth.omft.near': 0,
|