@lifi/widget 3.30.4 → 3.30.6-beta.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/CHANGELOG.md +7 -0
- package/dist/esm/components/ChainSelect/ChainSelect.js +9 -9
- package/dist/esm/components/ChainSelect/ChainSelect.js.map +1 -1
- package/dist/esm/components/Chains/ChainList.d.ts +3 -1
- package/dist/esm/components/Chains/ChainList.js +2 -2
- package/dist/esm/components/Chains/ChainList.js.map +1 -1
- package/dist/esm/components/Chains/SelectChainContent.js +1 -1
- package/dist/esm/components/Chains/SelectChainContent.js.map +1 -1
- package/dist/esm/components/Chains/VirtualizedChainList.d.ts +3 -1
- package/dist/esm/components/Chains/VirtualizedChainList.js +15 -14
- package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
- package/dist/esm/components/Messages/useMessageQueue.js +3 -1
- package/dist/esm/components/Messages/useMessageQueue.js.map +1 -1
- package/dist/esm/components/TokenList/TokenList.js +1 -1
- package/dist/esm/components/TokenList/TokenList.js.map +1 -1
- package/dist/esm/components/TokenList/TokenNotFound.js +2 -9
- package/dist/esm/components/TokenList/TokenNotFound.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js +1 -1
- package/dist/esm/hooks/useToAddressRequirements.js.map +1 -1
- package/dist/esm/hooks/useTokens.js +3 -3
- package/dist/esm/hooks/useTokens.js.map +1 -1
- package/dist/esm/i18n/en.json +1 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.d.ts +6 -1
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +2 -2
- package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js +1 -1
- package/dist/esm/pages/SelectTokenPage/SelectTokenPage.js.map +1 -1
- package/dist/esm/stores/chains/ChainOrderStore.js +4 -0
- package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/createChainOrderStore.js +13 -4
- package/dist/esm/stores/chains/createChainOrderStore.js.map +1 -1
- package/dist/esm/stores/chains/types.d.ts +6 -2
- package/dist/esm/utils/token.js +2 -2
- package/dist/esm/utils/token.js.map +1 -1
- package/package.json +3 -3
- package/package.json.tmp +2 -2
- package/src/components/ChainSelect/ChainSelect.tsx +11 -10
- package/src/components/Chains/ChainList.tsx +4 -0
- package/src/components/Chains/SelectChainContent.tsx +1 -0
- package/src/components/Chains/VirtualizedChainList.tsx +28 -18
- package/src/components/Messages/useMessageQueue.ts +5 -1
- package/src/components/TokenList/TokenList.tsx +3 -1
- package/src/components/TokenList/TokenNotFound.tsx +2 -11
- package/src/config/version.ts +1 -1
- package/src/hooks/useToAddressRequirements.ts +1 -1
- package/src/hooks/useTokens.ts +3 -3
- package/src/i18n/en.json +1 -1
- package/src/pages/SelectTokenPage/SearchTokenInput.tsx +9 -2
- package/src/pages/SelectTokenPage/SelectTokenPage.tsx +1 -1
- package/src/stores/chains/ChainOrderStore.tsx +5 -0
- package/src/stores/chains/createChainOrderStore.ts +13 -4
- package/src/stores/chains/types.ts +6 -2
- package/src/utils/token.ts +3 -6
- package/dist/esm/utils/eip7702.d.ts +0 -22
- package/dist/esm/utils/eip7702.js +0 -23
- package/dist/esm/utils/eip7702.js.map +0 -1
- package/src/utils/eip7702.ts +0 -23
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createChainOrderStore.js","sourceRoot":"","sources":["../../../../src/stores/chains/createChainOrderStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAI1D,qCAAqC;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,GAAG,CAAC,CAAA;AACrD,yDAAyD;AACzD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,GAAG,CAAC,CAAA;AAEnD,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,EAAE;IACR,EAAE,EAAE,EAAE;CACP,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAE,UAAU,EAAqB,EAAE,EAAE,CACzE,oBAAoB,CAClB,OAAO,CACL,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACb,UAAU,EAAE,iBAAiB;IAC7B,
|
|
1
|
+
{"version":3,"file":"createChainOrderStore.js","sourceRoot":"","sources":["../../../../src/stores/chains/createChainOrderStore.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAI1D,qCAAqC;AACrC,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAA;AACpC,MAAM,CAAC,MAAM,eAAe,GAAG,kBAAkB,GAAG,CAAC,CAAA;AACrD,yDAAyD;AACzD,6CAA6C;AAC7C,MAAM,CAAC,MAAM,gBAAgB,GAAG,eAAe,GAAG,CAAC,CAAA;AAEnD,MAAM,iBAAiB,GAAG;IACxB,IAAI,EAAE,EAAE;IACR,EAAE,EAAE,EAAE;CACP,CAAA;AAED,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,EAAE,UAAU,EAAqB,EAAE,EAAE,CACzE,oBAAoB,CAClB,OAAO,CACL,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,CAAC;IACb,UAAU,EAAE,iBAAiB;IAC7B,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,IAAI;IACrB,mBAAmB,EAAE,IAAI;IACzB,iBAAiB,EAAE,IAAI;IACvB,eAAe,EAAE,iBAAiB;IAClC,YAAY,EAAE,EAAE;IAChB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AAE,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,OAAO,CAAC;iBAC1D,CAAA;YACH,CAAC;YACD,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;YAC1B,OAAO;gBACL,YAAY;aACb,CAAA;QACH,CAAC,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,EACF;IACE,IAAI,EAAE,GAAG,UAAU,IAAI,OAAO,sBAAsB;IACpD,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,mBAAmB,EAAE,KAAK,CAAC,mBAAmB;QAC9C,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;QAC1C,YAAY,EAAE,KAAK,CAAC,YAAY;KACjC,CAAC;CACH,CACwD,EAC3D,MAAM,CAAC,EAAE,CACV,CAAA"}
|
|
@@ -8,13 +8,17 @@ interface ChainOrderProps {
|
|
|
8
8
|
from: number[];
|
|
9
9
|
to: number[];
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
fromShowAllNetworks: boolean;
|
|
12
|
+
toShowAllNetworks: boolean;
|
|
13
|
+
fromIsAllNetworks: boolean;
|
|
14
|
+
toIsAllNetworks: boolean;
|
|
12
15
|
pinnedChains: number[];
|
|
13
16
|
}
|
|
14
17
|
export interface ChainOrderState extends ChainOrderProps {
|
|
15
18
|
initializeChains(chainIds: number[], type: FormType): number[];
|
|
16
19
|
setChain(chainId: number, type: FormType): void;
|
|
17
|
-
setIsAllNetworks(isAllNetworks: boolean): void;
|
|
20
|
+
setIsAllNetworks(isAllNetworks: boolean, formType: FormType): void;
|
|
21
|
+
setShowAllNetworks(showAllNetworks: boolean, formType: FormType): void;
|
|
18
22
|
setPinnedChain(chainId: number): void;
|
|
19
23
|
}
|
|
20
24
|
export {};
|
package/dist/esm/utils/token.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getConfigItemSets, isFormItemAllowed
|
|
1
|
+
import { getConfigItemSets, isFormItemAllowed } from './item.js';
|
|
2
2
|
export const filterAllowedTokens = (dataTokens, configTokens, chainsConfig, formType) => {
|
|
3
3
|
if (!dataTokens) {
|
|
4
4
|
return;
|
|
@@ -10,7 +10,7 @@ export const filterAllowedTokens = (dataTokens, configTokens, chainsConfig, form
|
|
|
10
10
|
])).map((chainId) => Number(chainId));
|
|
11
11
|
const configChainIdsSet = getConfigItemSets(chainsConfig, (chainIds) => new Set(chainIds), formType);
|
|
12
12
|
const allowedChainIds = configChainIdsSet
|
|
13
|
-
? allChainIds.filter((chainId) =>
|
|
13
|
+
? allChainIds.filter((chainId) => isFormItemAllowed(chainId, configChainIdsSet, formType))
|
|
14
14
|
: allChainIds;
|
|
15
15
|
const allowedTokensByChain = {};
|
|
16
16
|
for (const chainId of allowedChainIds) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/utils/token.ts"],"names":[],"mappings":"AAGA,OAAO,
|
|
1
|
+
{"version":3,"file":"token.js","sourceRoot":"","sources":["../../../src/utils/token.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAEhE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CACjC,UAA8D,EAC9D,YAA2B,EAC3B,YAA2B,EAC3B,QAAmB,EACiC,EAAE;IACtD,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAM;IACR,CAAC;IAED,MAAM,cAAc,GAAG,YAAY,EAAE,OAAO,IAAI,EAAE,CAAA;IAClD,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAC5B,IAAI,GAAG,CAAC;QACN,GAAG,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAA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gBAAgB,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CACzD,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,CACxB,CACF,CAAA;QAED,oBAAoB,CAAC,OAAO,CAAC,GAAG,QAAQ,CAAA;IAC1C,CAAC;IAED,OAAO,oBAAoB,CAAA;AAC7B,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.6-beta.0",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@bigmi/core": "^0.5.2",
|
|
35
35
|
"@emotion/react": "^11.14.0",
|
|
36
36
|
"@emotion/styled": "^11.14.1",
|
|
37
|
-
"@lifi/sdk": "^3.12.
|
|
37
|
+
"@lifi/sdk": "^3.12.5-beta.0",
|
|
38
38
|
"@mui/icons-material": "^7.3.2",
|
|
39
39
|
"@mui/material": "^7.3.2",
|
|
40
40
|
"@mui/system": "^7.3.2",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"react-transition-group": "^4.4.5",
|
|
53
53
|
"viem": "^2.37.5",
|
|
54
54
|
"zustand": "^5.0.8",
|
|
55
|
-
"@lifi/wallet-management": "^3.16.
|
|
55
|
+
"@lifi/wallet-management": "^3.16.4-beta.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"@bigmi/react": ">=0.5.0",
|
package/package.json.tmp
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "3.30.
|
|
3
|
+
"version": "3.30.6-beta.0",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@bigmi/core": "^0.5.2",
|
|
54
54
|
"@emotion/react": "^11.14.0",
|
|
55
55
|
"@emotion/styled": "^11.14.1",
|
|
56
|
-
"@lifi/sdk": "^3.12.
|
|
56
|
+
"@lifi/sdk": "^3.12.5-beta.0",
|
|
57
57
|
"@lifi/wallet-management": "workspace:^",
|
|
58
58
|
"@mui/icons-material": "^7.3.2",
|
|
59
59
|
"@mui/material": "^7.3.2",
|
|
@@ -41,10 +41,13 @@ export const ChainSelect = memo(({ formType }: FormTypeProps) => {
|
|
|
41
41
|
setCurrentChain,
|
|
42
42
|
} = useChainSelect(formType)
|
|
43
43
|
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const [showAllNetworks, isAllNetworks, setIsAllNetworks] = useChainOrderStore(
|
|
45
|
+
(state) => [
|
|
46
|
+
state[`${formType}ShowAllNetworks`],
|
|
47
|
+
state[`${formType}IsAllNetworks`],
|
|
48
|
+
state.setIsAllNetworks,
|
|
49
|
+
]
|
|
50
|
+
)
|
|
48
51
|
|
|
49
52
|
const [chainId] = useFieldValues(FormKeyHelper.getChainKey(formType))
|
|
50
53
|
|
|
@@ -60,10 +63,10 @@ export const ChainSelect = memo(({ formType }: FormTypeProps) => {
|
|
|
60
63
|
|
|
61
64
|
const onChainSelect = useCallback(
|
|
62
65
|
(selectedChainId: number) => {
|
|
63
|
-
setIsAllNetworks(false)
|
|
66
|
+
setIsAllNetworks(false, formType)
|
|
64
67
|
setCurrentChain(selectedChainId)
|
|
65
68
|
},
|
|
66
|
-
[setIsAllNetworks, setCurrentChain]
|
|
69
|
+
[setIsAllNetworks, setCurrentChain, formType]
|
|
67
70
|
)
|
|
68
71
|
|
|
69
72
|
const showAllChains = useCallback(() => {
|
|
@@ -71,9 +74,9 @@ export const ChainSelect = memo(({ formType }: FormTypeProps) => {
|
|
|
71
74
|
}, [navigate, formType])
|
|
72
75
|
|
|
73
76
|
const selectAllNetworks = useCallback(() => {
|
|
74
|
-
setIsAllNetworks(true)
|
|
77
|
+
setIsAllNetworks(true, formType)
|
|
75
78
|
setFieldValue('tokenSearchFilter', '')
|
|
76
|
-
}, [setIsAllNetworks, setFieldValue])
|
|
79
|
+
}, [setIsAllNetworks, setFieldValue, formType])
|
|
77
80
|
|
|
78
81
|
const chainsToHide =
|
|
79
82
|
chains?.length === maxChainsToShow
|
|
@@ -85,8 +88,6 @@ export const ChainSelect = memo(({ formType }: FormTypeProps) => {
|
|
|
85
88
|
[chainsToHide, getSelectedChains, chains]
|
|
86
89
|
)
|
|
87
90
|
|
|
88
|
-
const showAllNetworks = chainsToShow.length > 1
|
|
89
|
-
|
|
90
91
|
const tilesCount =
|
|
91
92
|
chainsToShow.length + (showAllNetworks ? 1 : 0) + (chainsToHide > 0 ? 1 : 0)
|
|
92
93
|
|
|
@@ -2,6 +2,7 @@ import type { ExtendedChain } from '@lifi/sdk'
|
|
|
2
2
|
import { Skeleton } from '@mui/material'
|
|
3
3
|
import type { RefObject } from 'react'
|
|
4
4
|
import { useTranslation } from 'react-i18next'
|
|
5
|
+
import type { FormType } from '../../stores/form/types.js'
|
|
5
6
|
import { SearchNotFound } from '../Search/SearchNotFound.js'
|
|
6
7
|
import {
|
|
7
8
|
List,
|
|
@@ -13,6 +14,7 @@ import { VirtualizedChainList } from './VirtualizedChainList.js'
|
|
|
13
14
|
|
|
14
15
|
interface ChainListProps {
|
|
15
16
|
parentRef: RefObject<HTMLDivElement | null>
|
|
17
|
+
formType: FormType
|
|
16
18
|
chains: ExtendedChain[]
|
|
17
19
|
onSelect: (chain: ExtendedChain) => void
|
|
18
20
|
selectedChainId?: number
|
|
@@ -23,6 +25,7 @@ interface ChainListProps {
|
|
|
23
25
|
|
|
24
26
|
export const ChainList = ({
|
|
25
27
|
parentRef,
|
|
28
|
+
formType,
|
|
26
29
|
chains,
|
|
27
30
|
hasSearchQuery,
|
|
28
31
|
onSelect,
|
|
@@ -79,6 +82,7 @@ export const ChainList = ({
|
|
|
79
82
|
return (
|
|
80
83
|
<VirtualizedChainList
|
|
81
84
|
scrollElementRef={parentRef}
|
|
85
|
+
formType={formType}
|
|
82
86
|
chains={chains}
|
|
83
87
|
hasSearchQuery={hasSearchQuery}
|
|
84
88
|
onSelect={onSelect}
|
|
@@ -4,6 +4,7 @@ import type { RefObject } from 'react'
|
|
|
4
4
|
import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
6
|
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore.js'
|
|
7
|
+
import type { FormType } from '../../stores/form/types.js'
|
|
7
8
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
8
9
|
import { AllChainsAvatar } from './AllChainsAvatar.js'
|
|
9
10
|
import {
|
|
@@ -17,6 +18,7 @@ import { ChainListItem } from './ChainListItem.js'
|
|
|
17
18
|
|
|
18
19
|
interface VirtualizedChainListProps {
|
|
19
20
|
scrollElementRef: RefObject<HTMLDivElement | null>
|
|
21
|
+
formType: FormType
|
|
20
22
|
chains: ExtendedChain[]
|
|
21
23
|
onSelect: (chain: ExtendedChain) => void
|
|
22
24
|
selectedChainId?: number
|
|
@@ -26,6 +28,7 @@ interface VirtualizedChainListProps {
|
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export const VirtualizedChainList = ({
|
|
31
|
+
formType,
|
|
29
32
|
chains,
|
|
30
33
|
hasSearchQuery,
|
|
31
34
|
onSelect,
|
|
@@ -38,13 +41,20 @@ export const VirtualizedChainList = ({
|
|
|
38
41
|
const { setFieldValue } = useFieldActions()
|
|
39
42
|
const selectedChainIdRef = useRef(selectedChainId) // Store the initial selected chain ID to scroll to it once chains are loaded
|
|
40
43
|
const hasScrolledRef = useRef(false)
|
|
41
|
-
const [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
const [
|
|
45
|
+
pinnedChains,
|
|
46
|
+
setPinnedChain,
|
|
47
|
+
isAllNetworks,
|
|
48
|
+
setIsAllNetworks,
|
|
49
|
+
showAllNetworks,
|
|
50
|
+
] = useChainOrderStore((state) => [
|
|
51
|
+
state.pinnedChains,
|
|
52
|
+
state.setPinnedChain,
|
|
53
|
+
state[`${formType}IsAllNetworks`],
|
|
54
|
+
state.setIsAllNetworks,
|
|
55
|
+
state[`${formType}ShowAllNetworks`],
|
|
56
|
+
])
|
|
57
|
+
|
|
48
58
|
const onPin = useCallback(
|
|
49
59
|
(chainId: number) => {
|
|
50
60
|
setPinnedChain(chainId)
|
|
@@ -65,30 +75,30 @@ export const VirtualizedChainList = ({
|
|
|
65
75
|
return [...pinned, ...rest]
|
|
66
76
|
}, [chains, pinnedChains])
|
|
67
77
|
|
|
68
|
-
const
|
|
78
|
+
const showAllNetworksOption = showAllNetworks && !hasSearchQuery
|
|
69
79
|
|
|
70
80
|
const getItemKey = useCallback(
|
|
71
81
|
(index: number) => {
|
|
72
|
-
if (
|
|
82
|
+
if (showAllNetworksOption && index === 0) {
|
|
73
83
|
return 'all-chains'
|
|
74
84
|
}
|
|
75
|
-
const chainIndex = index - (
|
|
85
|
+
const chainIndex = index - (showAllNetworksOption ? 1 : 0)
|
|
76
86
|
return `${sortedChains[chainIndex].id}-${index}`
|
|
77
87
|
},
|
|
78
|
-
[sortedChains,
|
|
88
|
+
[sortedChains, showAllNetworksOption]
|
|
79
89
|
)
|
|
80
90
|
|
|
81
91
|
const onChainSelect = useCallback(
|
|
82
92
|
(chain: ExtendedChain) => {
|
|
83
|
-
setIsAllNetworks(false)
|
|
93
|
+
setIsAllNetworks(false, formType)
|
|
84
94
|
onSelect(chain)
|
|
85
95
|
},
|
|
86
|
-
[onSelect, setIsAllNetworks]
|
|
96
|
+
[onSelect, setIsAllNetworks, formType]
|
|
87
97
|
)
|
|
88
98
|
|
|
89
99
|
const { getVirtualItems, getTotalSize, measure, range, getOffsetForIndex } =
|
|
90
100
|
useVirtualizer({
|
|
91
|
-
count: sortedChains.length + (
|
|
101
|
+
count: sortedChains.length + (showAllNetworksOption ? 1 : 0), // +1 for the all networks item
|
|
92
102
|
overscan: 3,
|
|
93
103
|
paddingEnd: 0,
|
|
94
104
|
getScrollElement: () => scrollElementRef.current,
|
|
@@ -152,9 +162,9 @@ export const VirtualizedChainList = ({
|
|
|
152
162
|
}, [sortedChains, scrollToIndex, range, isAllNetworks])
|
|
153
163
|
|
|
154
164
|
const selectAllNetworks = useCallback(() => {
|
|
155
|
-
setIsAllNetworks(true)
|
|
165
|
+
setIsAllNetworks(true, formType)
|
|
156
166
|
setFieldValue('tokenSearchFilter', '')
|
|
157
|
-
}, [setIsAllNetworks, setFieldValue])
|
|
167
|
+
}, [setIsAllNetworks, setFieldValue, formType])
|
|
158
168
|
|
|
159
169
|
return (
|
|
160
170
|
<List
|
|
@@ -163,7 +173,7 @@ export const VirtualizedChainList = ({
|
|
|
163
173
|
disablePadding
|
|
164
174
|
>
|
|
165
175
|
{getVirtualItems().map((item) => {
|
|
166
|
-
if (
|
|
176
|
+
if (showAllNetworksOption && item.index === 0) {
|
|
167
177
|
return (
|
|
168
178
|
<ListItem
|
|
169
179
|
key={item.key}
|
|
@@ -190,7 +200,7 @@ export const VirtualizedChainList = ({
|
|
|
190
200
|
)
|
|
191
201
|
}
|
|
192
202
|
|
|
193
|
-
const chain = sortedChains[item.index - (
|
|
203
|
+
const chain = sortedChains[item.index - (showAllNetworksOption ? 1 : 0)]
|
|
194
204
|
return (
|
|
195
205
|
<ChainListItem
|
|
196
206
|
key={item.key}
|
|
@@ -76,7 +76,11 @@ export const useMessageQueue = (route?: Route, allowInteraction?: boolean) => {
|
|
|
76
76
|
})
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
if (
|
|
79
|
+
if (
|
|
80
|
+
requiredToAddress &&
|
|
81
|
+
accountDeployedAtDestination &&
|
|
82
|
+
!allowInteraction
|
|
83
|
+
) {
|
|
80
84
|
queue.push({
|
|
81
85
|
id: 'ACCOUNT_DEPLOYED',
|
|
82
86
|
priority: 7,
|
|
@@ -21,7 +21,9 @@ export const TokenList: FC<TokenListProps> = memo(
|
|
|
21
21
|
FormKeyHelper.getTokenKey(formType)
|
|
22
22
|
)
|
|
23
23
|
|
|
24
|
-
const isAllNetworks = useChainOrderStore(
|
|
24
|
+
const isAllNetworks = useChainOrderStore(
|
|
25
|
+
(state) => state[`${formType}IsAllNetworks`]
|
|
26
|
+
)
|
|
25
27
|
|
|
26
28
|
const [tokenSearchFilter]: string[] = useDebouncedWatch(
|
|
27
29
|
320,
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
import { useTranslation } from 'react-i18next'
|
|
2
|
-
import { useAvailableChains } from '../../hooks/useAvailableChains.js'
|
|
3
2
|
import type { FormTypeProps } from '../../stores/form/types.js'
|
|
4
|
-
import { FormKeyHelper } from '../../stores/form/types.js'
|
|
5
|
-
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
6
3
|
import { SearchNotFound } from '../Search/SearchNotFound.js'
|
|
7
4
|
|
|
8
|
-
export const TokenNotFound: React.FC<FormTypeProps> = (
|
|
5
|
+
export const TokenNotFound: React.FC<FormTypeProps> = () => {
|
|
9
6
|
const { t } = useTranslation()
|
|
10
|
-
const [selectedChainId] = useFieldValues(FormKeyHelper.getChainKey(formType))
|
|
11
|
-
const { getChainById } = useAvailableChains()
|
|
12
7
|
|
|
13
8
|
return (
|
|
14
|
-
<SearchNotFound
|
|
15
|
-
message={t('info.message.emptyTokenList', {
|
|
16
|
-
chainName: getChainById(selectedChainId)?.name,
|
|
17
|
-
})}
|
|
18
|
-
/>
|
|
9
|
+
<SearchNotFound message={t('info.message.emptyTokenListAllNetworks')} />
|
|
19
10
|
)
|
|
20
11
|
}
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '3.30.
|
|
2
|
+
export const version = '3.30.6-beta.0'
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RouteExtended } from '@lifi/sdk'
|
|
2
|
+
import { isDelegationDesignatorCode } from '@lifi/sdk'
|
|
2
3
|
import { useAccount } from '@lifi/wallet-management'
|
|
3
4
|
import { useChain } from '../hooks/useChain.js'
|
|
4
5
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
5
6
|
import { useFieldValues } from '../stores/form/useFieldValues.js'
|
|
6
7
|
import { HiddenUI, RequiredUI } from '../types/widget.js'
|
|
7
|
-
import { isDelegationDesignatorCode } from '../utils/eip7702.js'
|
|
8
8
|
import { useIsContractAddress } from './useIsContractAddress.js'
|
|
9
9
|
|
|
10
10
|
export const useToAddressRequirements = (route?: RouteExtended) => {
|
package/src/hooks/useTokens.ts
CHANGED
|
@@ -72,9 +72,9 @@ export const useTokens = (
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
/** This hook is used to search for tokens in the background.
|
|
76
|
+
* It updates the main tokens cache with the search results,
|
|
77
|
+
* if any of the tokens are not already in the cache. */
|
|
78
78
|
const useBackgroundTokenSearch = (search?: string, chainId?: number) => {
|
|
79
79
|
const { chains: chainsConfig, keyPrefix } = useWidgetConfig()
|
|
80
80
|
const queryClient = useQueryClient()
|
package/src/i18n/en.json
CHANGED
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"emptyBridgesList": "We couldn't find any bridges that match your search",
|
|
93
93
|
"emptyChainList": "We couldn't find any chains that match your search",
|
|
94
94
|
"emptyExchangesList": "We couldn't find any exchanges that match your search",
|
|
95
|
-
"
|
|
95
|
+
"emptyTokenListAllNetworks": "We couldn't find any tokens. Please search by contract address if your token doesn't appear, or try selecting a different chain.",
|
|
96
96
|
"emptyTransactionHistory": "Transaction history is only stored locally and will be deleted if you clear your browser data.",
|
|
97
97
|
"routeNotFound": "Reasons for that could be: low liquidity, amount selected is too low, gas costs are too high or there are no routes for the selected combination.",
|
|
98
98
|
"toAddressIsRequired": "The destination wallet address is required to proceed with the transfer.",
|
|
@@ -2,15 +2,22 @@ import { useCallback, useEffect } from 'react'
|
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
import { SearchInput } from '../../components/Search/SearchInput.js'
|
|
4
4
|
import { useChainOrderStore } from '../../stores/chains/ChainOrderStore.js'
|
|
5
|
+
import type { FormType } from '../../stores/form/types.js'
|
|
5
6
|
import { useFieldActions } from '../../stores/form/useFieldActions.js'
|
|
6
7
|
import { useFieldValues } from '../../stores/form/useFieldValues.js'
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
interface SearchTokenInputProps {
|
|
10
|
+
formType: FormType
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const SearchTokenInput = ({ formType }: SearchTokenInputProps) => {
|
|
9
14
|
const { t } = useTranslation()
|
|
10
15
|
const [value] = useFieldValues('tokenSearchFilter')
|
|
11
16
|
const { setFieldValue, setAsTouched } = useFieldActions()
|
|
12
17
|
const [fromChain, toChain] = useFieldValues('fromChain', 'toChain')
|
|
13
|
-
const isAllNetworks = useChainOrderStore(
|
|
18
|
+
const isAllNetworks = useChainOrderStore(
|
|
19
|
+
(state) => state[`${formType}IsAllNetworks`]
|
|
20
|
+
)
|
|
14
21
|
|
|
15
22
|
const onChange = useCallback(
|
|
16
23
|
(newValue: string | number | undefined) => {
|
|
@@ -62,6 +62,11 @@ export function ChainOrderStoreProvider({
|
|
|
62
62
|
key
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
+
// Show "All networks" button if there are multiple networks
|
|
66
|
+
const showAllNetworks = filteredChains.length > 1
|
|
67
|
+
storeRef.current?.getState().setIsAllNetworks(showAllNetworks, key)
|
|
68
|
+
storeRef.current?.getState().setShowAllNetworks(showAllNetworks, key)
|
|
69
|
+
|
|
65
70
|
const [chainValue] = getFieldValues(`${key}Chain`)
|
|
66
71
|
if (chainValue) {
|
|
67
72
|
return
|
|
@@ -21,7 +21,10 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
21
21
|
persist(
|
|
22
22
|
(set, get) => ({
|
|
23
23
|
chainOrder: defaultChainState,
|
|
24
|
-
|
|
24
|
+
fromIsAllNetworks: true,
|
|
25
|
+
toIsAllNetworks: true,
|
|
26
|
+
fromShowAllNetworks: true,
|
|
27
|
+
toShowAllNetworks: true,
|
|
25
28
|
availableChains: defaultChainState,
|
|
26
29
|
pinnedChains: [],
|
|
27
30
|
initializeChains: (chainIds, type) => {
|
|
@@ -82,8 +85,11 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
82
85
|
}
|
|
83
86
|
})
|
|
84
87
|
},
|
|
85
|
-
setIsAllNetworks: (isAllNetworks) => {
|
|
86
|
-
set({ isAllNetworks })
|
|
88
|
+
setIsAllNetworks: (isAllNetworks, formType) => {
|
|
89
|
+
set({ [`${formType}IsAllNetworks`]: isAllNetworks })
|
|
90
|
+
},
|
|
91
|
+
setShowAllNetworks: (showAllNetworks, formType) => {
|
|
92
|
+
set({ [`${formType}ShowAllNetworks`]: showAllNetworks })
|
|
87
93
|
},
|
|
88
94
|
setPinnedChain: (chainId) => {
|
|
89
95
|
set((state: ChainOrderState) => {
|
|
@@ -105,7 +111,10 @@ export const createChainOrderStore = ({ namePrefix }: PersistStoreProps) =>
|
|
|
105
111
|
version: 2,
|
|
106
112
|
partialize: (state) => ({
|
|
107
113
|
chainOrder: state.chainOrder,
|
|
108
|
-
|
|
114
|
+
fromIsAllNetworks: state.fromIsAllNetworks,
|
|
115
|
+
toIsAllNetworks: state.toIsAllNetworks,
|
|
116
|
+
fromShowAllNetworks: state.fromShowAllNetworks,
|
|
117
|
+
toShowAllNetworks: state.toShowAllNetworks,
|
|
109
118
|
pinnedChains: state.pinnedChains,
|
|
110
119
|
}),
|
|
111
120
|
}
|
|
@@ -9,13 +9,17 @@ interface ChainOrderProps {
|
|
|
9
9
|
from: number[]
|
|
10
10
|
to: number[]
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
fromShowAllNetworks: boolean
|
|
13
|
+
toShowAllNetworks: boolean
|
|
14
|
+
fromIsAllNetworks: boolean
|
|
15
|
+
toIsAllNetworks: boolean
|
|
13
16
|
pinnedChains: number[]
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface ChainOrderState extends ChainOrderProps {
|
|
17
20
|
initializeChains(chainIds: number[], type: FormType): number[]
|
|
18
21
|
setChain(chainId: number, type: FormType): void
|
|
19
|
-
setIsAllNetworks(isAllNetworks: boolean): void
|
|
22
|
+
setIsAllNetworks(isAllNetworks: boolean, formType: FormType): void
|
|
23
|
+
setShowAllNetworks(showAllNetworks: boolean, formType: FormType): void
|
|
20
24
|
setPinnedChain(chainId: number): void
|
|
21
25
|
}
|
package/src/utils/token.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import type { BaseToken, TokenExtended } from '@lifi/sdk'
|
|
2
2
|
import type { FormType } from '../stores/form/types.js'
|
|
3
3
|
import type { WidgetChains, WidgetTokens } from '../types/widget.js'
|
|
4
|
-
import {
|
|
5
|
-
getConfigItemSets,
|
|
6
|
-
isFormItemAllowed,
|
|
7
|
-
isItemAllowedForSets,
|
|
8
|
-
} from './item.js'
|
|
4
|
+
import { getConfigItemSets, isFormItemAllowed } from './item.js'
|
|
9
5
|
|
|
10
6
|
export const filterAllowedTokens = (
|
|
11
7
|
dataTokens: { [chainId: number]: TokenExtended[] } | undefined,
|
|
@@ -30,9 +26,10 @@ export const filterAllowedTokens = (
|
|
|
30
26
|
(chainIds: number[]) => new Set(chainIds),
|
|
31
27
|
formType
|
|
32
28
|
)
|
|
29
|
+
|
|
33
30
|
const allowedChainIds = configChainIdsSet
|
|
34
31
|
? allChainIds.filter((chainId) =>
|
|
35
|
-
|
|
32
|
+
isFormItemAllowed(chainId, configChainIdsSet, formType)
|
|
36
33
|
)
|
|
37
34
|
: allChainIds
|
|
38
35
|
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EIP-7702 introduces delegation designators that allow EOAs to delegate execution to other contracts.
|
|
3
|
-
* A delegation designator starts with 0xef0100 followed by the target contract address.
|
|
4
|
-
*
|
|
5
|
-
* When an EOA has this code, it means:
|
|
6
|
-
* - The EOA can still send transactions (unlike other contract accounts)
|
|
7
|
-
* - All contract calls are delegated to the target address
|
|
8
|
-
* - The code itself remains as the delegation designator (0xef0100 || address)
|
|
9
|
-
*
|
|
10
|
-
* Delegation Designator Structure:
|
|
11
|
-
*
|
|
12
|
-
* ─────┬───┬──┬───────────────────────────────────────┐
|
|
13
|
-
* │ │ │ │
|
|
14
|
-
* 0x ef 0100 a94f5374fce5edbc8e2a8697c15331677e6ebf0b
|
|
15
|
-
* │ │ └───────────────────────────────────────┘
|
|
16
|
-
* │ │ Target Address
|
|
17
|
-
* │ └── 7702
|
|
18
|
-
* └── 3541
|
|
19
|
-
*
|
|
20
|
-
* @see https://eips.ethereum.org/EIPS/eip-7702
|
|
21
|
-
*/
|
|
22
|
-
export declare const isDelegationDesignatorCode: (code?: string) => boolean | undefined;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EIP-7702 introduces delegation designators that allow EOAs to delegate execution to other contracts.
|
|
3
|
-
* A delegation designator starts with 0xef0100 followed by the target contract address.
|
|
4
|
-
*
|
|
5
|
-
* When an EOA has this code, it means:
|
|
6
|
-
* - The EOA can still send transactions (unlike other contract accounts)
|
|
7
|
-
* - All contract calls are delegated to the target address
|
|
8
|
-
* - The code itself remains as the delegation designator (0xef0100 || address)
|
|
9
|
-
*
|
|
10
|
-
* Delegation Designator Structure:
|
|
11
|
-
*
|
|
12
|
-
* ─────┬───┬──┬───────────────────────────────────────┐
|
|
13
|
-
* │ │ │ │
|
|
14
|
-
* 0x ef 0100 a94f5374fce5edbc8e2a8697c15331677e6ebf0b
|
|
15
|
-
* │ │ └───────────────────────────────────────┘
|
|
16
|
-
* │ │ Target Address
|
|
17
|
-
* │ └── 7702
|
|
18
|
-
* └── 3541
|
|
19
|
-
*
|
|
20
|
-
* @see https://eips.ethereum.org/EIPS/eip-7702
|
|
21
|
-
*/
|
|
22
|
-
export const isDelegationDesignatorCode = (code) => code?.startsWith('0xef0100');
|
|
23
|
-
//# sourceMappingURL=eip7702.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"eip7702.js","sourceRoot":"","sources":["../../../src/utils/eip7702.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAAa,EAAE,EAAE,CAC1D,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC,CAAA"}
|
package/src/utils/eip7702.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* EIP-7702 introduces delegation designators that allow EOAs to delegate execution to other contracts.
|
|
3
|
-
* A delegation designator starts with 0xef0100 followed by the target contract address.
|
|
4
|
-
*
|
|
5
|
-
* When an EOA has this code, it means:
|
|
6
|
-
* - The EOA can still send transactions (unlike other contract accounts)
|
|
7
|
-
* - All contract calls are delegated to the target address
|
|
8
|
-
* - The code itself remains as the delegation designator (0xef0100 || address)
|
|
9
|
-
*
|
|
10
|
-
* Delegation Designator Structure:
|
|
11
|
-
*
|
|
12
|
-
* ─────┬───┬──┬───────────────────────────────────────┐
|
|
13
|
-
* │ │ │ │
|
|
14
|
-
* 0x ef 0100 a94f5374fce5edbc8e2a8697c15331677e6ebf0b
|
|
15
|
-
* │ │ └───────────────────────────────────────┘
|
|
16
|
-
* │ │ Target Address
|
|
17
|
-
* │ └── 7702
|
|
18
|
-
* └── 3541
|
|
19
|
-
*
|
|
20
|
-
* @see https://eips.ethereum.org/EIPS/eip-7702
|
|
21
|
-
*/
|
|
22
|
-
export const isDelegationDesignatorCode = (code?: string) =>
|
|
23
|
-
code?.startsWith('0xef0100')
|