@lifi/widget 3.30.0 → 3.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/esm/AppProvider.d.ts +0 -1
- package/dist/esm/AppProvider.js +1 -1
- package/dist/esm/AppProvider.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInput.d.ts +0 -9
- package/dist/esm/components/AmountInput/AmountInput.js +1 -1
- package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +0 -1
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js +1 -6
- package/dist/esm/components/AmountInput/AmountInputAdornment.style.js.map +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.d.ts +0 -6
- package/dist/esm/components/AmountInput/PriceFormHelperText.js +1 -1
- package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
- package/dist/esm/components/Avatar/Avatar.d.ts +0 -4
- package/dist/esm/components/Avatar/Avatar.js +1 -1
- package/dist/esm/components/Avatar/Avatar.js.map +1 -1
- package/dist/esm/components/Avatar/TokenAvatar.d.ts +0 -15
- package/dist/esm/components/Avatar/TokenAvatar.js +2 -2
- package/dist/esm/components/Avatar/TokenAvatar.js.map +1 -1
- package/dist/esm/components/Card/CardButton.style.d.ts +0 -1
- package/dist/esm/components/Card/CardButton.style.js +0 -7
- package/dist/esm/components/Card/CardButton.style.js.map +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.d.ts +2 -3
- package/dist/esm/components/FeeBreakdownTooltip.js +1 -1
- package/dist/esm/components/FeeBreakdownTooltip.js.map +1 -1
- package/dist/esm/components/Header/Header.d.ts +1 -2
- package/dist/esm/components/Header/Header.js +1 -1
- package/dist/esm/components/Header/Header.js.map +1 -1
- package/dist/esm/components/Header/WalletHeader.d.ts +0 -1
- package/dist/esm/components/Header/WalletHeader.js +1 -1
- package/dist/esm/components/Header/WalletHeader.js.map +1 -1
- package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
- package/dist/esm/components/StepActions/StepActions.d.ts +1 -10
- package/dist/esm/components/StepActions/StepActions.js +6 -6
- package/dist/esm/components/StepActions/StepActions.js.map +1 -1
- package/dist/esm/components/Tabs/Tabs.style.d.ts +0 -1
- package/dist/esm/components/Tabs/Tabs.style.js +1 -1
- package/dist/esm/components/Tabs/Tabs.style.js.map +1 -1
- package/dist/esm/components/Timer/TimerContent.js +1 -2
- package/dist/esm/components/Timer/TimerContent.js.map +1 -1
- package/dist/esm/components/Token/Token.d.ts +0 -2
- package/dist/esm/components/Token/Token.js +2 -2
- package/dist/esm/components/Token/Token.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.d.ts +1 -4
- package/dist/esm/components/TokenList/TokenListItem.js +3 -3
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/types.d.ts +2 -1
- package/dist/esm/components/TokenList/useTokenSelect.d.ts +0 -4
- package/dist/esm/components/TokenList/useTokenSelect.js +8 -3
- package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
- package/dist/esm/components/TokenRate/TokenRate.js +1 -3
- package/dist/esm/components/TokenRate/TokenRate.js.map +1 -1
- package/dist/esm/components/TransactionDetails.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/timer/time.d.ts +0 -8
- package/dist/esm/hooks/timer/time.js.map +1 -1
- package/dist/esm/hooks/timer/useTimer.d.ts +3 -2
- package/dist/esm/hooks/useAccountsBalancesData.js +1 -1
- package/dist/esm/hooks/useAccountsBalancesData.js.map +1 -1
- package/dist/esm/hooks/useAvailableChains.d.ts +2 -1
- package/dist/esm/hooks/useChain.d.ts +1 -1
- package/dist/esm/hooks/useChains.d.ts +1 -1
- package/dist/esm/hooks/useExplorer.d.ts +2 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.d.ts +2 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js +12 -3
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useListHeight.d.ts +0 -2
- package/dist/esm/hooks/useListHeight.js +2 -2
- package/dist/esm/hooks/useListHeight.js.map +1 -1
- package/dist/esm/hooks/useRoutes.js +2 -2
- package/dist/esm/hooks/useRoutes.js.map +1 -1
- package/dist/esm/hooks/useToAddressAutoPopulate.d.ts +2 -1
- package/dist/esm/hooks/useToken.js +4 -3
- package/dist/esm/hooks/useToken.js.map +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.d.ts +3 -2
- package/dist/esm/hooks/useTokenAddressBalance.js +1 -1
- package/dist/esm/hooks/useTokenAddressBalance.js.map +1 -1
- package/dist/esm/hooks/useTokenBalances.js +1 -1
- package/dist/esm/hooks/useTokenBalances.js.map +1 -1
- package/dist/esm/hooks/useTokenSearch.js +3 -3
- package/dist/esm/hooks/useTokenSearch.js.map +1 -1
- package/dist/esm/hooks/useTokens.d.ts +1 -1
- package/dist/esm/hooks/useTokens.js +27 -6
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/i18n/pt.json +4 -4
- package/dist/esm/pages/SettingsPage/SettingsCard/SettingCardExpandable.js.map +1 -1
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js +27 -17
- package/dist/esm/pages/SettingsPage/SlippageSettings/SlippageSettings.js.map +1 -1
- package/dist/esm/pages/TransactionPage/RouteTracker.d.ts +2 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.d.ts +0 -5
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js +1 -1
- package/dist/esm/pages/TransactionPage/StatusBottomSheet.js.map +1 -1
- package/dist/esm/providers/I18nProvider/types.d.ts +4 -3
- package/dist/esm/providers/WalletProvider/EVMProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/EVMProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/EVMProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/SVMProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/SuiProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/UTXOProvider.js.map +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.d.ts +0 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js +1 -1
- package/dist/esm/providers/WalletProvider/WalletProvider.js.map +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +1 -2
- package/dist/esm/stores/bookmarks/BookmarkStore.js +1 -1
- package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.d.ts +0 -5
- package/dist/esm/stores/chains/ChainOrderStore.js +2 -2
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/types.d.ts +2 -1
- package/dist/esm/stores/header/types.d.ts +2 -1
- package/dist/esm/stores/header/useHeaderStore.d.ts +1 -4
- package/dist/esm/stores/header/useHeaderStore.js +3 -3
- package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
- package/dist/esm/stores/inputMode/useInputModeStore.d.ts +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.d.ts +2 -2
- package/dist/esm/stores/routes/RouteExecutionStore.js +1 -1
- package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
- package/dist/esm/stores/settings/types.d.ts +3 -3
- package/dist/esm/stores/settings/types.js.map +1 -1
- package/dist/esm/stores/settings/useSettingsStore.d.ts +1 -2
- package/dist/esm/stores/settings/useSettingsStore.js +1 -1
- package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
- package/dist/esm/stores/settings/useSplitSubvariantStore.d.ts +1 -4
- package/dist/esm/stores/settings/useSplitSubvariantStore.js +3 -3
- package/dist/esm/stores/settings/useSplitSubvariantStore.js.map +1 -1
- package/dist/esm/types/events.d.ts +0 -4
- package/dist/esm/types/events.js +0 -4
- package/dist/esm/types/events.js.map +1 -1
- package/dist/esm/utils/fees.d.ts +1 -4
- package/dist/esm/utils/fees.js +3 -3
- package/dist/esm/utils/fees.js.map +1 -1
- package/dist/esm/utils/format.js +1 -1
- package/dist/esm/utils/format.js.map +1 -1
- package/dist/esm/utils/navigationRoutes.d.ts +2 -1
- package/dist/esm/utils/token.js +2 -2
- package/dist/esm/utils/token.js.map +1 -1
- package/dist/esm/utils/tokenList.d.ts +0 -4
- package/dist/esm/utils/tokenList.js +3 -3
- package/dist/esm/utils/tokenList.js.map +1 -1
- package/package.json +7 -7
- package/package.json.tmp +6 -6
- package/src/AppProvider.tsx +1 -1
- package/src/components/AmountInput/AmountInput.tsx +1 -1
- package/src/components/AmountInput/AmountInputAdornment.style.tsx +1 -7
- package/src/components/AmountInput/PriceFormHelperText.tsx +1 -1
- package/src/components/Avatar/Avatar.tsx +1 -1
- package/src/components/Avatar/TokenAvatar.tsx +2 -2
- package/src/components/Card/CardButton.style.tsx +0 -8
- package/src/components/FeeBreakdownTooltip.tsx +2 -5
- package/src/components/Header/Header.tsx +1 -1
- package/src/components/Header/WalletHeader.tsx +1 -1
- package/src/components/SendToWallet/SendToWalletButton.tsx +0 -1
- package/src/components/StepActions/StepActions.tsx +6 -6
- package/src/components/Tabs/Tabs.style.tsx +1 -1
- package/src/components/Timer/TimerContent.tsx +1 -2
- package/src/components/Token/Token.tsx +2 -2
- package/src/components/TokenList/TokenListItem.tsx +17 -19
- package/src/components/TokenList/types.ts +1 -1
- package/src/components/TokenList/useTokenSelect.ts +10 -8
- package/src/components/TokenRate/TokenRate.tsx +0 -1
- package/src/components/TransactionDetails.tsx +0 -1
- package/src/config/version.ts +1 -1
- package/src/hooks/timer/time.ts +0 -10
- package/src/hooks/timer/useTimer.ts +2 -2
- package/src/hooks/useAccountsBalancesData.ts +1 -1
- package/src/hooks/useAvailableChains.ts +1 -1
- package/src/hooks/useExplorer.ts +1 -1
- package/src/hooks/useFilteredByTokenBalances.ts +32 -3
- package/src/hooks/useListHeight.ts +2 -2
- package/src/hooks/useRoutes.ts +4 -2
- package/src/hooks/useToAddressAutoPopulate.ts +1 -1
- package/src/hooks/useToken.ts +10 -4
- package/src/hooks/useTokenAddressBalance.ts +2 -1
- package/src/hooks/useTokenBalances.ts +1 -1
- package/src/hooks/useTokenSearch.ts +4 -7
- package/src/hooks/useTokens.ts +44 -6
- package/src/i18n/pt.json +4 -4
- package/src/pages/SettingsPage/SettingsCard/SettingCardExpandable.tsx +0 -1
- package/src/pages/SettingsPage/SlippageSettings/SlippageSettings.tsx +33 -30
- package/src/pages/TransactionPage/RouteTracker.tsx +1 -1
- package/src/pages/TransactionPage/StatusBottomSheet.tsx +5 -3
- package/src/providers/I18nProvider/types.ts +3 -3
- package/src/providers/WalletProvider/EVMProvider.tsx +1 -1
- package/src/providers/WalletProvider/SVMProvider.tsx +1 -1
- package/src/providers/WalletProvider/SuiProvider.tsx +1 -1
- package/src/providers/WalletProvider/UTXOProvider.tsx +1 -1
- package/src/providers/WalletProvider/WalletProvider.tsx +1 -1
- package/src/stores/bookmarks/BookmarkStore.tsx +1 -1
- package/src/stores/chains/ChainOrderStore.tsx +3 -7
- package/src/stores/chains/types.ts +1 -1
- package/src/stores/header/types.ts +1 -1
- package/src/stores/header/useHeaderStore.tsx +3 -3
- package/src/stores/inputMode/useInputModeStore.ts +1 -1
- package/src/stores/routes/RouteExecutionStore.tsx +4 -3
- package/src/stores/settings/types.ts +2 -6
- package/src/stores/settings/useSettingsStore.ts +1 -1
- package/src/stores/settings/useSplitSubvariantStore.tsx +5 -4
- package/src/types/events.ts +0 -4
- package/src/utils/fees.ts +3 -3
- package/src/utils/format.ts +2 -1
- package/src/utils/navigationRoutes.ts +1 -1
- package/src/utils/token.ts +4 -2
- package/src/utils/tokenList.ts +4 -4
- package/dist/esm/AppDrawer.style.d.ts +0 -1
- package/dist/esm/AppDrawer.style.js +0 -12
- package/dist/esm/AppDrawer.style.js.map +0 -1
- package/dist/esm/components/Select.d.ts +0 -3
- package/dist/esm/components/Select.js +0 -35
- package/dist/esm/components/Select.js.map +0 -1
- package/dist/esm/components/StepActions/StepFees.d.ts +0 -5
- package/dist/esm/components/StepActions/StepFees.js +0 -32
- package/dist/esm/components/StepActions/StepFees.js.map +0 -1
- package/dist/esm/pages/MainPage/MainPage.style.d.ts +0 -1
- package/dist/esm/pages/MainPage/MainPage.style.js +0 -8
- package/dist/esm/pages/MainPage/MainPage.style.js.map +0 -1
- package/dist/esm/pages/SelectNativeTokenPage.d.ts +0 -2
- package/dist/esm/pages/SelectNativeTokenPage.js +0 -23
- package/dist/esm/pages/SelectNativeTokenPage.js.map +0 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.style.d.ts +0 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.style.js +0 -6
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.style.js.map +0 -1
- package/dist/esm/pages/SelectTokenPage/types.d.ts +0 -4
- package/dist/esm/pages/SelectTokenPage/types.js +0 -6
- package/dist/esm/pages/SelectTokenPage/types.js.map +0 -1
- package/dist/esm/providers/WidgetProvider/utils.d.ts +0 -5
- package/dist/esm/providers/WidgetProvider/utils.js +0 -17
- package/dist/esm/providers/WidgetProvider/utils.js.map +0 -1
- package/dist/esm/stores/form/useFieldController.d.ts +0 -11
- package/dist/esm/stores/form/useFieldController.js +0 -20
- package/dist/esm/stores/form/useFieldController.js.map +0 -1
- package/dist/esm/stores/form/useValidation.d.ts +0 -2
- package/dist/esm/stores/form/useValidation.js +0 -14
- package/dist/esm/stores/form/useValidation.js.map +0 -1
- package/dist/esm/stores/form/useValidationActions.d.ts +0 -2
- package/dist/esm/stores/form/useValidationActions.js +0 -10
- package/dist/esm/stores/form/useValidationActions.js.map +0 -1
- package/src/AppDrawer.style.tsx +0 -12
- package/src/components/Select.tsx +0 -42
- package/src/components/StepActions/StepFees.tsx +0 -49
- package/src/pages/MainPage/MainPage.style.tsx +0 -8
- package/src/pages/SelectNativeTokenPage.tsx +0 -47
- package/src/pages/SelectTokenPage/SearchTokenInput.style.tsx +0 -6
- package/src/pages/SelectTokenPage/types.ts +0 -4
- package/src/providers/WidgetProvider/utils.ts +0 -26
- package/src/stores/form/useFieldController.ts +0 -31
- package/src/stores/form/useValidation.ts +0 -15
- package/src/stores/form/useValidationActions.ts +0 -12
|
@@ -35,18 +35,15 @@ export const useTokenSearch = (
|
|
|
35
35
|
new Set(
|
|
36
36
|
tokens
|
|
37
37
|
.filter((t) => t.chainId === token.chainId)
|
|
38
|
-
.map((t) => t.address)
|
|
38
|
+
.map((t) => t.address.toLowerCase())
|
|
39
39
|
),
|
|
40
40
|
formType
|
|
41
41
|
)
|
|
42
42
|
|
|
43
43
|
// Return undefined if the token is denied
|
|
44
44
|
if (
|
|
45
|
-
!isFormItemAllowed(
|
|
46
|
-
|
|
47
|
-
filteredConfigTokens,
|
|
48
|
-
formType,
|
|
49
|
-
(t) => t.address
|
|
45
|
+
!isFormItemAllowed(token, filteredConfigTokens, formType, (t) =>
|
|
46
|
+
t.address.toLowerCase()
|
|
50
47
|
)
|
|
51
48
|
) {
|
|
52
49
|
return undefined
|
|
@@ -58,7 +55,7 @@ export const useTokenSearch = (
|
|
|
58
55
|
if (
|
|
59
56
|
data &&
|
|
60
57
|
!data.tokens[chainId as number]?.some(
|
|
61
|
-
(t) => t.address === token.address
|
|
58
|
+
(t) => t.address.toLowerCase() === token.address.toLowerCase()
|
|
62
59
|
)
|
|
63
60
|
) {
|
|
64
61
|
const clonedData = { ...data, tokens: { ...data.tokens } }
|
package/src/hooks/useTokens.ts
CHANGED
|
@@ -1,20 +1,36 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
ChainType,
|
|
3
|
+
getToken,
|
|
4
|
+
getTokens,
|
|
5
|
+
type TokensExtendedResponse,
|
|
6
|
+
} from '@lifi/sdk'
|
|
2
7
|
import { useQuery, useQueryClient } from '@tanstack/react-query'
|
|
3
8
|
import { useMemo } from 'react'
|
|
4
9
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
5
10
|
import type { FormType } from '../stores/form/types.js'
|
|
11
|
+
import {
|
|
12
|
+
defaultChainIdsByType,
|
|
13
|
+
getChainTypeFromAddress,
|
|
14
|
+
} from '../utils/chainType.js'
|
|
6
15
|
import { isItemAllowed } from '../utils/item.js'
|
|
7
16
|
import { getQueryKey } from '../utils/queries.js'
|
|
8
17
|
import { filterAllowedTokens } from '../utils/token.js'
|
|
9
18
|
|
|
10
|
-
export const useTokens = (
|
|
19
|
+
export const useTokens = (
|
|
20
|
+
formType?: FormType,
|
|
21
|
+
search?: string,
|
|
22
|
+
chainId?: number
|
|
23
|
+
) => {
|
|
11
24
|
const {
|
|
12
25
|
tokens: configTokens,
|
|
13
26
|
chains: chainsConfig,
|
|
14
27
|
keyPrefix,
|
|
15
28
|
} = useWidgetConfig()
|
|
16
29
|
|
|
17
|
-
const { isLoading: isSearchLoading } = useBackgroundTokenSearch(
|
|
30
|
+
const { isLoading: isSearchLoading } = useBackgroundTokenSearch(
|
|
31
|
+
search,
|
|
32
|
+
chainId
|
|
33
|
+
)
|
|
18
34
|
|
|
19
35
|
const { data, isLoading } = useQuery({
|
|
20
36
|
queryKey: [getQueryKey('tokens', keyPrefix)],
|
|
@@ -59,13 +75,14 @@ export const useTokens = (formType?: FormType, search?: string) => {
|
|
|
59
75
|
// This hook is used to search for tokens in the background.
|
|
60
76
|
// It updates the main tokens cache with the search results,
|
|
61
77
|
// if any of the tokens are not already in the cache.
|
|
62
|
-
const useBackgroundTokenSearch = (search?: string) => {
|
|
78
|
+
const useBackgroundTokenSearch = (search?: string, chainId?: number) => {
|
|
63
79
|
const { chains: chainsConfig, keyPrefix } = useWidgetConfig()
|
|
64
80
|
const queryClient = useQueryClient()
|
|
65
81
|
|
|
66
82
|
const { isLoading: isSearchLoading } = useQuery({
|
|
67
|
-
queryKey: [getQueryKey('tokens-search', keyPrefix), search],
|
|
68
|
-
queryFn: async ({ queryKey
|
|
83
|
+
queryKey: [getQueryKey('tokens-search', keyPrefix), search, chainId],
|
|
84
|
+
queryFn: async ({ queryKey, signal }) => {
|
|
85
|
+
const [, searchQuery, chainId] = queryKey as [string, string, number]
|
|
69
86
|
const chainTypes = [
|
|
70
87
|
ChainType.EVM,
|
|
71
88
|
ChainType.SVM,
|
|
@@ -83,6 +100,27 @@ const useBackgroundTokenSearch = (search?: string) => {
|
|
|
83
100
|
{ signal }
|
|
84
101
|
)
|
|
85
102
|
|
|
103
|
+
// If the chainId is not provided, try to get it from the search query
|
|
104
|
+
let _chainId = chainId
|
|
105
|
+
if (!_chainId) {
|
|
106
|
+
const chainType = getChainTypeFromAddress(searchQuery)
|
|
107
|
+
if (chainType) {
|
|
108
|
+
_chainId = defaultChainIdsByType[chainType]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Fallback: If the main search returned no tokens for the specific chainId,
|
|
113
|
+
// fetch a single token using the /token endpoint
|
|
114
|
+
if (_chainId && searchQuery) {
|
|
115
|
+
const existingTokens = tokensResponse.tokens[_chainId] || []
|
|
116
|
+
if (!existingTokens.length) {
|
|
117
|
+
const token = await getToken(_chainId, searchQuery, { signal })
|
|
118
|
+
if (token) {
|
|
119
|
+
tokensResponse.tokens[_chainId] = [token]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
86
124
|
// Merge search results into main tokens cache
|
|
87
125
|
if (searchQuery) {
|
|
88
126
|
queryClient.setQueriesData<TokensExtendedResponse>(
|
package/src/i18n/pt.json
CHANGED
|
@@ -212,7 +212,7 @@
|
|
|
212
212
|
"slippage": "A diferença percentual máxima entre o preço esperado, e o preço atual pelo qual a transferência é executada. Esse valor pode ser alterado nas configurações."
|
|
213
213
|
},
|
|
214
214
|
"main": {
|
|
215
|
-
"allNetworks": "",
|
|
215
|
+
"allNetworks": "Todas as redes",
|
|
216
216
|
"allTokens": "Todos os tokens",
|
|
217
217
|
"bridgeStepDetails": "Ponte de {{from}} para {{to}} via {{tool}}",
|
|
218
218
|
"checkoutStepDetails": "Comprar via {{tool}}",
|
|
@@ -241,7 +241,7 @@
|
|
|
241
241
|
"process": {
|
|
242
242
|
"bridge": {
|
|
243
243
|
"actionRequired": "Assinar a transação de transferência de fundos entre redes",
|
|
244
|
-
"messageRequired": "",
|
|
244
|
+
"messageRequired": "Assinar mensagem da ponte",
|
|
245
245
|
"done": "Transação da ponte confirmada",
|
|
246
246
|
"pending": "Transação de transferência de fundos entre redes, pendente",
|
|
247
247
|
"started": "Preparando a transação da ponte"
|
|
@@ -260,7 +260,7 @@
|
|
|
260
260
|
},
|
|
261
261
|
"swap": {
|
|
262
262
|
"actionRequired": "Assinar transação de troca",
|
|
263
|
-
"messageRequired": "",
|
|
263
|
+
"messageRequired": "Assinar mensagem da conversão",
|
|
264
264
|
"done": "Conversão concluída",
|
|
265
265
|
"pending": "Transação de troca pendente",
|
|
266
266
|
"started": "Preparando a transação de conversão"
|
|
@@ -313,7 +313,7 @@
|
|
|
313
313
|
"valueLoss": "Perda de Valor",
|
|
314
314
|
"searchBridges": "Pesquisar pelo nome da ponte",
|
|
315
315
|
"searchExchanges": "Pesquisar pelo nome da corretora",
|
|
316
|
-
"searchNetwork": ""
|
|
316
|
+
"searchNetwork": "Procurar rede"
|
|
317
317
|
},
|
|
318
318
|
"settings": {
|
|
319
319
|
"appearance": "Aparência",
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import Percent from '@mui/icons-material/Percent'
|
|
2
2
|
import WarningRounded from '@mui/icons-material/WarningRounded'
|
|
3
|
-
import { Box,
|
|
3
|
+
import { Box, Typography } from '@mui/material'
|
|
4
4
|
import type { ChangeEventHandler, FocusEventHandler } from 'react'
|
|
5
|
-
import {
|
|
5
|
+
import { useRef, useState } from 'react'
|
|
6
6
|
import { useTranslation } from 'react-i18next'
|
|
7
7
|
import { useSettingMonitor } from '../../../hooks/useSettingMonitor.js'
|
|
8
8
|
import { useSettings } from '../../../stores/settings/useSettings.js'
|
|
9
9
|
import { useSettingsActions } from '../../../stores/settings/useSettingsActions.js'
|
|
10
10
|
import { defaultSlippage } from '../../../stores/settings/useSettingsStore.js'
|
|
11
|
-
import { formatSlippage } from '../../../utils/format.js'
|
|
11
|
+
import { formatInputAmount, formatSlippage } from '../../../utils/format.js'
|
|
12
12
|
import { BadgedValue } from '../SettingsCard/BadgedValue.js'
|
|
13
13
|
import { SettingCardExpandable } from '../SettingsCard/SettingCardExpandable.js'
|
|
14
14
|
import {
|
|
@@ -18,7 +18,8 @@ import {
|
|
|
18
18
|
SlippageLimitsWarningContainer,
|
|
19
19
|
} from './SlippageSettings.style.js'
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const defaultSlippageInputValue = '0.5'
|
|
22
|
+
const maxFractionDigits = 5
|
|
22
23
|
|
|
23
24
|
export const SlippageSettings: React.FC = () => {
|
|
24
25
|
const { t } = useTranslation()
|
|
@@ -35,7 +36,7 @@ export const SlippageSettings: React.FC = () => {
|
|
|
35
36
|
|
|
36
37
|
const customInputValue =
|
|
37
38
|
!slippage || slippage === defaultSlippage
|
|
38
|
-
?
|
|
39
|
+
? defaultSlippageInputValue
|
|
39
40
|
: slippage
|
|
40
41
|
|
|
41
42
|
const [inputValue, setInputValue] = useState(customInputValue)
|
|
@@ -44,35 +45,37 @@ export const SlippageSettings: React.FC = () => {
|
|
|
44
45
|
setValue('slippage', defaultSlippage)
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
const formatAndSetSlippage = (value: string, returnInitial = false) => {
|
|
49
|
+
const formattedSlippage = formatSlippage(
|
|
50
|
+
value,
|
|
51
|
+
defaultValue.current,
|
|
52
|
+
returnInitial
|
|
53
|
+
)
|
|
54
|
+
const formattedValue =
|
|
55
|
+
Number(formattedSlippage) === 0 && !returnInitial
|
|
56
|
+
? '0'
|
|
57
|
+
: formatInputAmount(formattedSlippage, maxFractionDigits, returnInitial)
|
|
58
|
+
const maxLength =
|
|
59
|
+
Number(formattedValue) < 10
|
|
60
|
+
? maxFractionDigits + 2
|
|
61
|
+
: maxFractionDigits + 3
|
|
62
|
+
const slicedValue = formattedValue.slice(0, maxLength)
|
|
63
|
+
setInputValue(slicedValue)
|
|
64
|
+
setValue('slippage', slicedValue.length ? slicedValue : defaultSlippage)
|
|
65
|
+
}
|
|
54
66
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
formattedValue.length ? formattedValue : defaultSlippage
|
|
59
|
-
)
|
|
60
|
-
},
|
|
61
|
-
[debouncedSetValue]
|
|
62
|
-
)
|
|
67
|
+
const handleInputUpdate: ChangeEventHandler<HTMLInputElement> = (event) => {
|
|
68
|
+
formatAndSetSlippage(event.target.value, true)
|
|
69
|
+
}
|
|
63
70
|
|
|
64
71
|
const handleInputFocus: FocusEventHandler<HTMLInputElement> = (event) => {
|
|
65
72
|
setFocused('input')
|
|
73
|
+
formatAndSetSlippage(event.target.value)
|
|
74
|
+
}
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
setInputValue(formattedValue)
|
|
71
|
-
|
|
72
|
-
setValue(
|
|
73
|
-
'slippage',
|
|
74
|
-
formattedValue.length ? formattedValue : defaultSlippage
|
|
75
|
-
)
|
|
76
|
+
const handleInputBlur: FocusEventHandler<HTMLInputElement> = (event) => {
|
|
77
|
+
setFocused(undefined)
|
|
78
|
+
formatAndSetSlippage(event.target.value)
|
|
76
79
|
}
|
|
77
80
|
|
|
78
81
|
const badgeColor = isSlippageNotRecommended
|
|
@@ -126,7 +129,7 @@ export const SlippageSettings: React.FC = () => {
|
|
|
126
129
|
onFocus={handleInputFocus}
|
|
127
130
|
value={inputValue}
|
|
128
131
|
autoComplete="off"
|
|
129
|
-
onBlur={
|
|
132
|
+
onBlur={handleInputBlur}
|
|
130
133
|
/>
|
|
131
134
|
</SettingsFieldSet>
|
|
132
135
|
{isSlippageNotRecommended && (
|
|
@@ -5,7 +5,7 @@ import { useRoutes } from '../../hooks/useRoutes.js'
|
|
|
5
5
|
import { useRouteExecutionStoreContext } from '../../stores/routes/RouteExecutionStore.js'
|
|
6
6
|
import { useSetExecutableRoute } from '../../stores/routes/useSetExecutableRoute.js'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface RouteTrackerProps {
|
|
9
9
|
observableRouteId: string
|
|
10
10
|
onChange: Dispatch<SetStateAction<string>>
|
|
11
11
|
onFetching: Dispatch<SetStateAction<boolean>>
|
|
@@ -59,9 +59,11 @@ export const StatusBottomSheet: React.FC<RouteExecution> = ({
|
|
|
59
59
|
)
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const StatusBottomSheetContent: React.FC<StatusBottomSheetContentProps> = ({
|
|
63
|
+
status,
|
|
64
|
+
route,
|
|
65
|
+
onClose,
|
|
66
|
+
}) => {
|
|
65
67
|
const { t } = useTranslation()
|
|
66
68
|
const { navigateBack, navigate } = useNavigateBack()
|
|
67
69
|
const { setFieldValue } = useFieldActions()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as languages from '../../i18n/index.js'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
type PartialResource<T> = T extends object
|
|
4
4
|
? {
|
|
5
5
|
[P in keyof T]?: PartialResource<T[P]>
|
|
6
6
|
}
|
|
@@ -8,7 +8,7 @@ export type PartialResource<T> = T extends object
|
|
|
8
8
|
|
|
9
9
|
export type LanguageKey = keyof typeof languages
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
type LanguageResource = typeof languages.en
|
|
12
12
|
|
|
13
13
|
export type LanguageResources =
|
|
14
14
|
| {
|
|
@@ -18,7 +18,7 @@ export type LanguageResources =
|
|
|
18
18
|
[language: string]: PartialResource<LanguageResource>
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
type LanguageTranslationResource = {
|
|
22
22
|
[N in 'translation']: PartialResource<LanguageResource>
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -7,7 +7,7 @@ import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
|
7
7
|
import { EVMBaseProvider } from './EVMBaseProvider.js'
|
|
8
8
|
import { EVMExternalContext } from './EVMExternalContext.js'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function useInWagmiContext(): boolean {
|
|
11
11
|
const { chains } = useWidgetConfig()
|
|
12
12
|
const context = useContext(WagmiContext)
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
|
7
7
|
import { SVMBaseProvider } from './SVMBaseProvider.js'
|
|
8
8
|
import { SVMExternalContext } from './SVMExternalContext.js'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function useInSolanaContext(): boolean {
|
|
11
11
|
const { chains } = useWidgetConfig()
|
|
12
12
|
const context = useContext(ConnectionContext)
|
|
13
13
|
return (
|
|
@@ -7,7 +7,7 @@ import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
|
7
7
|
import { SuiBaseProvider } from './SuiBaseProvider.js'
|
|
8
8
|
import { SuiExternalContext } from './SuiExternalContext.js'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function useInSuiContext(): boolean {
|
|
11
11
|
const { chains } = useWidgetConfig()
|
|
12
12
|
const context = useContext(SuiClientContext)
|
|
13
13
|
|
|
@@ -7,7 +7,7 @@ import { useWidgetConfig } from '../WidgetProvider/WidgetProvider.js'
|
|
|
7
7
|
import { UTXOBaseProvider } from './UTXOBaseProvider.js'
|
|
8
8
|
import { UTXOExternalContext } from './UTXOExternalContext.js'
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
function useInBigmiContext(): boolean {
|
|
11
11
|
const { chains } = useWidgetConfig()
|
|
12
12
|
const context = useContext(BigmiContext)
|
|
13
13
|
|
|
@@ -25,7 +25,7 @@ export const WalletProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
|
25
25
|
)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
const WalletMenuProvider: FC<PropsWithChildren> = ({ children }) => {
|
|
29
29
|
const { walletConfig } = useWidgetConfig()
|
|
30
30
|
const { i18n } = useTranslation()
|
|
31
31
|
const { internalChainTypes } = useExternalWalletProvider()
|
|
@@ -5,7 +5,7 @@ import type { PersistStoreProviderProps } from '../types.js'
|
|
|
5
5
|
import { createBookmarksStore } from './createBookmarkStore.js'
|
|
6
6
|
import type { BookmarkState, BookmarkStore } from './types.js'
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
const BookmarkStoreContext = createContext<BookmarkStore | null>(null)
|
|
9
9
|
|
|
10
10
|
export const BookmarkStoreProvider: React.FC<PersistStoreProviderProps> = ({
|
|
11
11
|
children,
|
|
@@ -12,13 +12,9 @@ import type { PersistStoreProviderProps } from '../types.js'
|
|
|
12
12
|
import { createChainOrderStore } from './createChainOrderStore.js'
|
|
13
13
|
import type { ChainOrderState } from './types.js'
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
StoreApi<ChainOrderState>
|
|
17
|
-
>
|
|
15
|
+
type ChainOrderStore = UseBoundStoreWithEqualityFn<StoreApi<ChainOrderState>>
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
null
|
|
21
|
-
)
|
|
17
|
+
const ChainOrderStoreContext = createContext<ChainOrderStore | null>(null)
|
|
22
18
|
|
|
23
19
|
export function ChainOrderStoreProvider({
|
|
24
20
|
children,
|
|
@@ -105,7 +101,7 @@ export function ChainOrderStoreProvider({
|
|
|
105
101
|
)
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
|
|
104
|
+
function useChainOrderStoreContext() {
|
|
109
105
|
const useStore = useContext(ChainOrderStoreContext)
|
|
110
106
|
if (!useStore) {
|
|
111
107
|
throw new Error(
|
|
@@ -3,7 +3,7 @@ import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
|
|
|
3
3
|
|
|
4
4
|
export type HeaderStore = UseBoundStoreWithEqualityFn<StoreApi<HeaderState>>
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
interface HeaderStateBase {
|
|
7
7
|
element?: React.ReactNode | null
|
|
8
8
|
title?: string
|
|
9
9
|
headerHeight: number
|
|
@@ -4,7 +4,7 @@ import { createWithEqualityFn } from 'zustand/traditional'
|
|
|
4
4
|
import type { PersistStoreProviderProps } from '../types.js'
|
|
5
5
|
import type { HeaderState, HeaderStore } from './types.js'
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
const HeaderStoreContext = createContext<HeaderStore | null>(null)
|
|
8
8
|
|
|
9
9
|
export function HeaderStoreProvider({ children }: PersistStoreProviderProps) {
|
|
10
10
|
const storeRef = useRef<HeaderStore>(null)
|
|
@@ -18,7 +18,7 @@ export function HeaderStoreProvider({ children }: PersistStoreProviderProps) {
|
|
|
18
18
|
)
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
function useHeaderStoreContext() {
|
|
22
22
|
const useStore = useContext(HeaderStoreContext)
|
|
23
23
|
if (!useStore) {
|
|
24
24
|
throw new Error(
|
|
@@ -54,7 +54,7 @@ export function useSetHeaderHeight() {
|
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
const createHeaderStore = () =>
|
|
58
58
|
createWithEqualityFn<HeaderState>(
|
|
59
59
|
(set, get) => ({
|
|
60
60
|
headerHeight: 108, // a basic default height
|
|
@@ -6,12 +6,13 @@ import type { PersistStoreProviderProps } from '../types.js'
|
|
|
6
6
|
import { createRouteExecutionStore } from './createRouteExecutionStore.js'
|
|
7
7
|
import type { RouteExecutionState } from './types.js'
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type RouteExecutionStore = UseBoundStoreWithEqualityFn<
|
|
10
10
|
StoreApi<RouteExecutionState>
|
|
11
11
|
>
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
const RouteExecutionStoreContext = createContext<RouteExecutionStore | null>(
|
|
14
|
+
null
|
|
15
|
+
)
|
|
15
16
|
|
|
16
17
|
export function RouteExecutionStoreProvider({
|
|
17
18
|
children,
|
|
@@ -9,11 +9,7 @@ export type ValueSetter<S> = <K extends keyof S>(
|
|
|
9
9
|
value: S[Extract<K, string>]
|
|
10
10
|
) => void
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export type ValuesSetter<S> = <K extends keyof S>(
|
|
15
|
-
values: Record<K, S[Extract<K, string>]>
|
|
16
|
-
) => void
|
|
12
|
+
type ValueGetter<S> = <K extends keyof S>(key: K) => S[K]
|
|
17
13
|
|
|
18
14
|
export const SettingsToolTypes = ['Bridges', 'Exchanges'] as const
|
|
19
15
|
export type SettingsToolType = (typeof SettingsToolTypes)[number]
|
|
@@ -48,7 +44,7 @@ export interface SettingsActions {
|
|
|
48
44
|
|
|
49
45
|
export type SettingsState = SettingsProps & SettingsActions
|
|
50
46
|
|
|
51
|
-
|
|
47
|
+
interface SendToWalletState {
|
|
52
48
|
showSendToWallet: boolean
|
|
53
49
|
}
|
|
54
50
|
|
|
@@ -8,8 +8,9 @@ import type {
|
|
|
8
8
|
SplitSubvariantStore,
|
|
9
9
|
} from './types.js'
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
const SplitSubvariantStoreContext = createContext<SplitSubvariantStore | null>(
|
|
12
|
+
null
|
|
13
|
+
)
|
|
13
14
|
|
|
14
15
|
const shouldRecreateStore = (
|
|
15
16
|
store: SplitSubvariantStore,
|
|
@@ -34,7 +35,7 @@ export function SplitSubvariantStoreProvider({
|
|
|
34
35
|
)
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
function useSplitSubvariantStoreContext() {
|
|
38
39
|
const useStore = useContext(SplitSubvariantStoreContext)
|
|
39
40
|
if (!useStore) {
|
|
40
41
|
throw new Error(
|
|
@@ -51,7 +52,7 @@ export function useSplitSubvariantStore<T>(
|
|
|
51
52
|
return useStore(useShallow(selector))
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
const createSplitSubvariantStore = ({ state }: SplitSubvariantProps) =>
|
|
55
56
|
createWithEqualityFn<SplitSubvariantState>(
|
|
56
57
|
(set) => ({
|
|
57
58
|
state,
|
package/src/types/events.ts
CHANGED
|
@@ -20,10 +20,6 @@ export enum WidgetEvent {
|
|
|
20
20
|
* @deprecated Use `PageEntered` event instead.
|
|
21
21
|
*/
|
|
22
22
|
ReviewTransactionPageEntered = 'reviewTransactionPageEntered',
|
|
23
|
-
/**
|
|
24
|
-
* @deprecated use useWalletManagementEvents hook.
|
|
25
|
-
*/
|
|
26
|
-
WalletConnected = 'walletConnected',
|
|
27
23
|
WidgetExpanded = 'widgetExpanded',
|
|
28
24
|
PageEntered = 'pageEntered',
|
|
29
25
|
FormFieldChanged = 'formFieldChanged',
|
package/src/utils/fees.ts
CHANGED
|
@@ -31,7 +31,7 @@ export const getAccumulatedFeeCostsBreakdown = (
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
const getGasCostsBreakdown = (route: RouteExtended): FeesBreakdown[] => {
|
|
35
35
|
return Array.from(
|
|
36
36
|
route.steps
|
|
37
37
|
.reduce((groupedGasCosts, step) => {
|
|
@@ -62,7 +62,7 @@ export const getGasCostsBreakdown = (route: RouteExtended): FeesBreakdown[] => {
|
|
|
62
62
|
)
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
|
|
65
|
+
const getFeeCostsBreakdown = (
|
|
66
66
|
route: RouteExtended,
|
|
67
67
|
included?: boolean
|
|
68
68
|
): FeesBreakdown[] => {
|
|
@@ -101,7 +101,7 @@ export const getFeeCostsBreakdown = (
|
|
|
101
101
|
)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
const getStepFeeCostsBreakdown = (
|
|
105
105
|
feeCosts: FeeCost[] | GasCost[]
|
|
106
106
|
): FeesBreakdown => {
|
|
107
107
|
const { token } = feeCosts[0]
|
package/src/utils/format.ts
CHANGED
|
@@ -33,7 +33,7 @@ export function formatSlippage(
|
|
|
33
33
|
if (Number.isNaN(parsedSlippage)) {
|
|
34
34
|
return defaultValue
|
|
35
35
|
}
|
|
36
|
-
if (parsedSlippage
|
|
36
|
+
if (parsedSlippage >= 100) {
|
|
37
37
|
return '100'
|
|
38
38
|
}
|
|
39
39
|
if (parsedSlippage < 0) {
|
|
@@ -73,6 +73,7 @@ export function formatInputAmount(
|
|
|
73
73
|
}
|
|
74
74
|
integer = integer.replace(/^0+|-/, '')
|
|
75
75
|
fraction = fraction.replace(/(0+)$/, '')
|
|
76
|
+
|
|
76
77
|
return `${integer || (fraction ? '0' : '')}${fraction ? `.${fraction}` : ''}`
|
|
77
78
|
}
|
|
78
79
|
|
|
@@ -65,7 +65,7 @@ export const backButtonRoutes = [
|
|
|
65
65
|
navigationRoutes.configuredWallets,
|
|
66
66
|
]
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
type NavigationRouteTypeKeys = keyof typeof navigationRoutes
|
|
69
69
|
|
|
70
70
|
export type NavigationRouteType =
|
|
71
71
|
(typeof navigationRoutes)[NavigationRouteTypeKeys]
|
package/src/utils/token.ts
CHANGED
|
@@ -49,13 +49,15 @@ export const filterAllowedTokens = (
|
|
|
49
49
|
new Set(
|
|
50
50
|
tokens
|
|
51
51
|
.filter((t) => Number(t.chainId) === chainId)
|
|
52
|
-
.map((t) => t.address)
|
|
52
|
+
.map((t) => t.address.toLowerCase())
|
|
53
53
|
),
|
|
54
54
|
formType
|
|
55
55
|
)
|
|
56
56
|
|
|
57
57
|
const filtered = chainTokens.filter((token) =>
|
|
58
|
-
isFormItemAllowed(token, allowedAddresses, formType, (t) =>
|
|
58
|
+
isFormItemAllowed(token, allowedAddresses, formType, (t) =>
|
|
59
|
+
t.address.toLowerCase()
|
|
60
|
+
)
|
|
59
61
|
)
|
|
60
62
|
|
|
61
63
|
allowedTokensByChain[chainId] = filtered
|
package/src/utils/tokenList.ts
CHANGED
|
@@ -70,7 +70,7 @@ export const processTokenBalances = (
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
// NB: only for non-all-networks
|
|
73
|
-
|
|
73
|
+
const processedTypedTokens = (
|
|
74
74
|
tokens: TokenAmount[],
|
|
75
75
|
tokensWithBalances: TokenAmount[],
|
|
76
76
|
selectedChainId?: number,
|
|
@@ -110,13 +110,13 @@ export const processedTypedTokens = (
|
|
|
110
110
|
|
|
111
111
|
// Filter out config-added tokens from main list
|
|
112
112
|
const configTokenAddresses = new Set(
|
|
113
|
-
[...popularTokensFromConfig, ...featuredTokensFromConfig].map(
|
|
114
|
-
|
|
113
|
+
[...popularTokensFromConfig, ...featuredTokensFromConfig].map((t) =>
|
|
114
|
+
t.address.toLowerCase()
|
|
115
115
|
)
|
|
116
116
|
)
|
|
117
117
|
|
|
118
118
|
const remainingTokens = tokens.filter(
|
|
119
|
-
(token) => !configTokenAddresses.has(token.address)
|
|
119
|
+
(token) => !configTokenAddresses.has(token.address.toLowerCase())
|
|
120
120
|
)
|
|
121
121
|
|
|
122
122
|
const otherTokens: TokenAmount[] = []
|