@aurora-is-near/intents-swap-widget 3.14.0-redesign.2 → 3.14.0-redesign.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{config-Bmc4hOIl.js → config-1EcDCy24.js} +603 -584
- package/dist/config-1EcDCy24.js.map +1 -0
- package/dist/config.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +18 -18
- package/dist/features/ExternalDeposit.js.map +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/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/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/computed/getIsDirectNearTokenWithdrawal.js +1 -1
- package/dist/machine/computed/getIsDirectNearTokenWithdrawal.js.map +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearDeposit.js +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearDeposit.js.map +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearTransfer.js +1 -1
- package/dist/machine/computed/getIsDirectTokenOnNearTransfer.js.map +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/types/localisation.d.ts +1 -1
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/localstorage.js +41 -28
- 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 +2 -2
- package/src/features/ExternalDeposit.tsx +2 -1
- package/src/features/SubmitButton/index.tsx +40 -0
- package/src/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.ts +2 -1
- package/src/machine/computed/getIsDirectNearTokenWithdrawal.ts +2 -1
- package/src/machine/computed/getIsDirectTokenOnNearDeposit.ts +2 -1
- package/src/machine/computed/getIsDirectTokenOnNearTransfer.ts +2 -1
- package/src/types/localisation.ts +3 -0
- package/src/utils/localstorage.ts +35 -10
- package/dist/config-Bmc4hOIl.js.map +0 -1
|
@@ -14,11 +14,14 @@ const defaultValues: LocalStorage = {
|
|
|
14
14
|
|
|
15
15
|
const isBrowser = typeof window !== 'undefined' && !!window.localStorage;
|
|
16
16
|
|
|
17
|
+
const KEY_PREFIX = 'sw';
|
|
18
|
+
const getStorageKey = (key: string) => `${KEY_PREFIX}.${key}`;
|
|
19
|
+
|
|
17
20
|
const getItem = <T extends keyof LocalStorage>(key: T): LocalStorage[T] => {
|
|
18
21
|
if (!isBrowser) {
|
|
19
22
|
if (process.env.NODE_ENV === 'development') {
|
|
20
23
|
logger.debug(
|
|
21
|
-
`[WIDGET] Attempted to read ${key} on server; returning default`,
|
|
24
|
+
`[WIDGET] Attempted to read ${getStorageKey(key)} from localstorage on server; returning default`,
|
|
22
25
|
);
|
|
23
26
|
}
|
|
24
27
|
|
|
@@ -26,13 +29,25 @@ const getItem = <T extends keyof LocalStorage>(key: T): LocalStorage[T] => {
|
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
try {
|
|
32
|
+
const storedValueLegacy = window.localStorage.getItem(key);
|
|
33
|
+
let storedValue = window.localStorage.getItem(getStorageKey(key));
|
|
34
|
+
|
|
35
|
+
// Migrate legacy key to new namespaced key
|
|
36
|
+
if (storedValueLegacy && !storedValue) {
|
|
37
|
+
storedValue = storedValueLegacy;
|
|
38
|
+
window.localStorage.setItem(getStorageKey(key), storedValueLegacy);
|
|
39
|
+
window.localStorage.removeItem(key);
|
|
40
|
+
}
|
|
41
|
+
|
|
29
42
|
return (
|
|
30
43
|
// @ts-expect-error It's ok to pass null to JSON.parse
|
|
31
|
-
(JSON.parse(
|
|
32
|
-
defaultValues[key]
|
|
44
|
+
(JSON.parse(storedValue) as LocalStorage[T]) ?? defaultValues[key]
|
|
33
45
|
);
|
|
34
46
|
} catch (error) {
|
|
35
|
-
logger.warn(
|
|
47
|
+
logger.warn(
|
|
48
|
+
`[WIDGET] Failed to parse ${getStorageKey(key)} from localStorage:`,
|
|
49
|
+
error,
|
|
50
|
+
);
|
|
36
51
|
|
|
37
52
|
return defaultValues[key];
|
|
38
53
|
}
|
|
@@ -44,7 +59,9 @@ const setItem = <T extends keyof LocalStorage>(
|
|
|
44
59
|
) => {
|
|
45
60
|
if (!isBrowser) {
|
|
46
61
|
if (process.env.NODE_ENV === 'development') {
|
|
47
|
-
logger.debug(
|
|
62
|
+
logger.debug(
|
|
63
|
+
`[WIDGET] Attempted to set ${getStorageKey(key)} on server; skipping`,
|
|
64
|
+
);
|
|
48
65
|
}
|
|
49
66
|
|
|
50
67
|
return;
|
|
@@ -58,25 +75,33 @@ const setItem = <T extends keyof LocalStorage>(
|
|
|
58
75
|
? String(value)
|
|
59
76
|
: JSON.stringify(value);
|
|
60
77
|
|
|
61
|
-
window.localStorage.setItem(key, serialized);
|
|
78
|
+
window.localStorage.setItem(getStorageKey(key), serialized);
|
|
62
79
|
} catch (error) {
|
|
63
|
-
logger.warn(
|
|
80
|
+
logger.warn(
|
|
81
|
+
`[WIDGET] Failed to set ${getStorageKey(key)} in localStorage:`,
|
|
82
|
+
error,
|
|
83
|
+
);
|
|
64
84
|
}
|
|
65
85
|
};
|
|
66
86
|
|
|
67
87
|
const removeItem = (key: keyof LocalStorage) => {
|
|
68
88
|
if (!isBrowser) {
|
|
69
89
|
if (process.env.NODE_ENV === 'development') {
|
|
70
|
-
logger.debug(
|
|
90
|
+
logger.debug(
|
|
91
|
+
`[WIDGET] Attempted to remove ${getStorageKey(key)} from localstorage on server; skipping`,
|
|
92
|
+
);
|
|
71
93
|
}
|
|
72
94
|
|
|
73
95
|
return;
|
|
74
96
|
}
|
|
75
97
|
|
|
76
98
|
try {
|
|
77
|
-
window.localStorage.removeItem(key);
|
|
99
|
+
window.localStorage.removeItem(getStorageKey(key));
|
|
78
100
|
} catch (error) {
|
|
79
|
-
logger.warn(
|
|
101
|
+
logger.warn(
|
|
102
|
+
`[WIDGET] Failed to remove ${getStorageKey(key)} from localStorage:`,
|
|
103
|
+
error,
|
|
104
|
+
);
|
|
80
105
|
}
|
|
81
106
|
};
|
|
82
107
|
|