@lifi/widget 3.25.0 → 3.26.1

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.
Files changed (244) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/esm/components/AmountInput/AmountInput.js +75 -17
  3. package/dist/esm/components/AmountInput/AmountInput.js.map +1 -1
  4. package/dist/esm/components/AmountInput/AmountInput.style.d.ts +4 -0
  5. package/dist/esm/components/AmountInput/AmountInput.style.js +11 -0
  6. package/dist/esm/components/AmountInput/AmountInput.style.js.map +1 -1
  7. package/dist/esm/components/AmountInput/AmountInputAdornment.style.d.ts +1 -0
  8. package/dist/esm/components/AmountInput/AmountInputAdornment.style.js +64 -5
  9. package/dist/esm/components/AmountInput/AmountInputAdornment.style.js.map +1 -1
  10. package/dist/esm/components/AmountInput/AmountInputEndAdornment.js +20 -7
  11. package/dist/esm/components/AmountInput/AmountInputEndAdornment.js.map +1 -1
  12. package/dist/esm/components/AmountInput/PriceFormHelperText.js +41 -15
  13. package/dist/esm/components/AmountInput/PriceFormHelperText.js.map +1 -1
  14. package/dist/esm/components/AmountInput/PriceFormHelperText.style.d.ts +1 -0
  15. package/dist/esm/components/AmountInput/PriceFormHelperText.style.js +29 -0
  16. package/dist/esm/components/AmountInput/PriceFormHelperText.style.js.map +1 -0
  17. package/dist/esm/components/AppContainer.js +1 -0
  18. package/dist/esm/components/AppContainer.js.map +1 -1
  19. package/dist/esm/components/ChainSelect/useChainSelect.js +2 -4
  20. package/dist/esm/components/ChainSelect/useChainSelect.js.map +1 -1
  21. package/dist/esm/components/Chains/ChainsExpanded.d.ts +1 -1
  22. package/dist/esm/components/Chains/ChainsExpanded.js +3 -2
  23. package/dist/esm/components/Chains/ChainsExpanded.js.map +1 -1
  24. package/dist/esm/components/Chains/ChainsExpanded.style.js +1 -2
  25. package/dist/esm/components/Chains/ChainsExpanded.style.js.map +1 -1
  26. package/dist/esm/components/Chains/SelectChainContent.d.ts +1 -1
  27. package/dist/esm/components/Chains/SelectChainContent.js +3 -2
  28. package/dist/esm/components/Chains/SelectChainContent.js.map +1 -1
  29. package/dist/esm/components/Chains/VirtualizedChainList.js +5 -3
  30. package/dist/esm/components/Chains/VirtualizedChainList.js.map +1 -1
  31. package/dist/esm/components/Expansion/Expansion.js +5 -16
  32. package/dist/esm/components/Expansion/Expansion.js.map +1 -1
  33. package/dist/esm/components/Expansion/Expansion.style.d.ts +32 -0
  34. package/dist/esm/components/Expansion/Expansion.style.js +40 -0
  35. package/dist/esm/components/Expansion/Expansion.style.js.map +1 -0
  36. package/dist/esm/components/Expansion/ExpansionTransition.d.ts +0 -1
  37. package/dist/esm/components/Expansion/ExpansionTransition.js +1 -30
  38. package/dist/esm/components/Expansion/ExpansionTransition.js.map +1 -1
  39. package/dist/esm/components/Header/NavigationHeader.js +5 -1
  40. package/dist/esm/components/Header/NavigationHeader.js.map +1 -1
  41. package/dist/esm/components/Routes/RoutesContent.d.ts +2 -3
  42. package/dist/esm/components/Routes/RoutesContent.js +8 -23
  43. package/dist/esm/components/Routes/RoutesContent.js.map +1 -1
  44. package/dist/esm/components/Routes/RoutesExpanded.d.ts +2 -3
  45. package/dist/esm/components/Routes/RoutesExpanded.js +24 -8
  46. package/dist/esm/components/Routes/RoutesExpanded.js.map +1 -1
  47. package/dist/esm/components/Routes/RoutesExpanded.style.js +2 -2
  48. package/dist/esm/components/Routes/RoutesExpanded.style.js.map +1 -1
  49. package/dist/esm/components/SendToWallet/SendToWalletButton.js +1 -1
  50. package/dist/esm/components/SendToWallet/SendToWalletButton.js.map +1 -1
  51. package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js +3 -3
  52. package/dist/esm/components/SendToWallet/SendToWalletExpandButton.js.map +1 -1
  53. package/dist/esm/components/Step/StepProcess.js +3 -8
  54. package/dist/esm/components/Step/StepProcess.js.map +1 -1
  55. package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +1 -2
  56. package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
  57. package/dist/esm/components/TokenList/useTokenSelect.js +2 -4
  58. package/dist/esm/components/TokenList/useTokenSelect.js.map +1 -1
  59. package/dist/esm/config/version.d.ts +1 -1
  60. package/dist/esm/config/version.js +1 -1
  61. package/dist/esm/hooks/useFromAmountThreshold.js +2 -2
  62. package/dist/esm/hooks/useFromAmountThreshold.js.map +1 -1
  63. package/dist/esm/hooks/useGasSufficiency.js +3 -3
  64. package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
  65. package/dist/esm/hooks/useNavigateBack.d.ts +1 -1
  66. package/dist/esm/hooks/useNavigateBack.js +8 -2
  67. package/dist/esm/hooks/useNavigateBack.js.map +1 -1
  68. package/dist/esm/hooks/useRouteExecution.js +1 -2
  69. package/dist/esm/hooks/useRouteExecution.js.map +1 -1
  70. package/dist/esm/hooks/useRoutes.js +51 -8
  71. package/dist/esm/hooks/useRoutes.js.map +1 -1
  72. package/dist/esm/hooks/useSettingMonitor.js +1 -2
  73. package/dist/esm/hooks/useSettingMonitor.js.map +1 -1
  74. package/dist/esm/hooks/useTokenAddressBalance.js +4 -1
  75. package/dist/esm/hooks/useTokenAddressBalance.js.map +1 -1
  76. package/dist/esm/hooks/useTokenSearch.js +5 -2
  77. package/dist/esm/hooks/useTokenSearch.js.map +1 -1
  78. package/dist/esm/hooks/useTokens.js +2 -2
  79. package/dist/esm/hooks/useTokens.js.map +1 -1
  80. package/dist/esm/hooks/useTools.js +2 -2
  81. package/dist/esm/hooks/useTools.js.map +1 -1
  82. package/dist/esm/i18n/bn.json +1 -1
  83. package/dist/esm/i18n/de.json +1 -1
  84. package/dist/esm/i18n/en.json +1 -1
  85. package/dist/esm/i18n/es.json +1 -1
  86. package/dist/esm/i18n/fr.json +1 -1
  87. package/dist/esm/i18n/hi.json +1 -1
  88. package/dist/esm/i18n/id.json +1 -1
  89. package/dist/esm/i18n/it.json +1 -1
  90. package/dist/esm/i18n/ja.json +1 -1
  91. package/dist/esm/i18n/ko.json +1 -1
  92. package/dist/esm/i18n/pt.json +1 -1
  93. package/dist/esm/i18n/th.json +1 -1
  94. package/dist/esm/i18n/tr.json +1 -1
  95. package/dist/esm/i18n/uk.json +1 -1
  96. package/dist/esm/i18n/vi.json +1 -1
  97. package/dist/esm/i18n/zh.json +1 -1
  98. package/dist/esm/pages/SelectEnabledToolsPage.js +4 -2
  99. package/dist/esm/pages/SelectEnabledToolsPage.js.map +1 -1
  100. package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js +14 -7
  101. package/dist/esm/pages/SelectTokenPage/SearchTokenInput.js.map +1 -1
  102. package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js +1 -2
  103. package/dist/esm/pages/SettingsPage/BridgeAndExchangeSettings.js.map +1 -1
  104. package/dist/esm/pages/TransactionPage/TransactionPage.js +5 -3
  105. package/dist/esm/pages/TransactionPage/TransactionPage.js.map +1 -1
  106. package/dist/esm/stores/bookmarks/BookmarkStore.d.ts +1 -2
  107. package/dist/esm/stores/bookmarks/BookmarkStore.js +3 -3
  108. package/dist/esm/stores/bookmarks/BookmarkStore.js.map +1 -1
  109. package/dist/esm/stores/bookmarks/useBookmarkActions.js +1 -2
  110. package/dist/esm/stores/bookmarks/useBookmarkActions.js.map +1 -1
  111. package/dist/esm/stores/bookmarks/useBookmarks.js +1 -2
  112. package/dist/esm/stores/bookmarks/useBookmarks.js.map +1 -1
  113. package/dist/esm/stores/chains/ChainOrderStore.d.ts +1 -1
  114. package/dist/esm/stores/chains/ChainOrderStore.js +3 -2
  115. package/dist/esm/stores/chains/ChainOrderStore.js.map +1 -1
  116. package/dist/esm/stores/chains/useChainOrder.js +1 -2
  117. package/dist/esm/stores/chains/useChainOrder.js.map +1 -1
  118. package/dist/esm/stores/form/useFieldActions.js +1 -2
  119. package/dist/esm/stores/form/useFieldActions.js.map +1 -1
  120. package/dist/esm/stores/form/useFieldValues.js +1 -2
  121. package/dist/esm/stores/form/useFieldValues.js.map +1 -1
  122. package/dist/esm/stores/form/useFormStore.d.ts +1 -2
  123. package/dist/esm/stores/form/useFormStore.js +3 -3
  124. package/dist/esm/stores/form/useFormStore.js.map +1 -1
  125. package/dist/esm/stores/form/useTouchedFields.js +1 -2
  126. package/dist/esm/stores/form/useTouchedFields.js.map +1 -1
  127. package/dist/esm/stores/form/useValidation.js +5 -2
  128. package/dist/esm/stores/form/useValidation.js.map +1 -1
  129. package/dist/esm/stores/form/useValidationActions.js +1 -2
  130. package/dist/esm/stores/form/useValidationActions.js.map +1 -1
  131. package/dist/esm/stores/header/useHeaderStore.d.ts +1 -1
  132. package/dist/esm/stores/header/useHeaderStore.js +3 -2
  133. package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
  134. package/dist/esm/stores/inputMode/useInputModeStore.d.ts +9 -0
  135. package/dist/esm/stores/inputMode/useInputModeStore.js +19 -0
  136. package/dist/esm/stores/inputMode/useInputModeStore.js.map +1 -0
  137. package/dist/esm/stores/routes/RouteExecutionStore.d.ts +1 -1
  138. package/dist/esm/stores/routes/RouteExecutionStore.js +3 -2
  139. package/dist/esm/stores/routes/RouteExecutionStore.js.map +1 -1
  140. package/dist/esm/stores/routes/useExecutingRoutesIds.js +1 -2
  141. package/dist/esm/stores/routes/useExecutingRoutesIds.js.map +1 -1
  142. package/dist/esm/stores/settings/useSendToWalletStore.d.ts +2 -1
  143. package/dist/esm/stores/settings/useSendToWalletStore.js +6 -3
  144. package/dist/esm/stores/settings/useSendToWalletStore.js.map +1 -1
  145. package/dist/esm/stores/settings/useSettings.js +1 -2
  146. package/dist/esm/stores/settings/useSettings.js.map +1 -1
  147. package/dist/esm/stores/settings/useSettingsActions.js +1 -2
  148. package/dist/esm/stores/settings/useSettingsActions.js.map +1 -1
  149. package/dist/esm/stores/settings/useSettingsStore.d.ts +2 -1
  150. package/dist/esm/stores/settings/useSettingsStore.js +5 -1
  151. package/dist/esm/stores/settings/useSettingsStore.js.map +1 -1
  152. package/dist/esm/stores/settings/useSplitSubvariantStore.js +2 -1
  153. package/dist/esm/stores/settings/useSplitSubvariantStore.js.map +1 -1
  154. package/dist/esm/themes/createTheme.js +5 -1
  155. package/dist/esm/themes/createTheme.js.map +1 -1
  156. package/dist/esm/types/widget.d.ts +2 -1
  157. package/dist/esm/types/widget.js +1 -0
  158. package/dist/esm/types/widget.js.map +1 -1
  159. package/dist/esm/utils/format.d.ts +4 -0
  160. package/dist/esm/utils/format.js +26 -0
  161. package/dist/esm/utils/format.js.map +1 -1
  162. package/dist/esm/utils/getPriceImpact.d.ts +2 -2
  163. package/dist/esm/utils/getPriceImpact.js.map +1 -1
  164. package/package.json +12 -12
  165. package/package.json.tmp +14 -14
  166. package/src/components/AmountInput/AmountInput.style.tsx +13 -0
  167. package/src/components/AmountInput/AmountInput.tsx +91 -18
  168. package/src/components/AmountInput/AmountInputAdornment.style.tsx +66 -5
  169. package/src/components/AmountInput/AmountInputEndAdornment.tsx +40 -10
  170. package/src/components/AmountInput/PriceFormHelperText.style.tsx +29 -0
  171. package/src/components/AmountInput/PriceFormHelperText.tsx +63 -19
  172. package/src/components/AppContainer.tsx +1 -0
  173. package/src/components/ChainSelect/useChainSelect.ts +2 -4
  174. package/src/components/Chains/ChainsExpanded.style.tsx +1 -2
  175. package/src/components/Chains/ChainsExpanded.tsx +6 -2
  176. package/src/components/Chains/SelectChainContent.tsx +81 -82
  177. package/src/components/Chains/VirtualizedChainList.tsx +5 -6
  178. package/src/components/Expansion/Expansion.style.tsx +43 -0
  179. package/src/components/Expansion/Expansion.tsx +8 -23
  180. package/src/components/Expansion/ExpansionTransition.tsx +5 -33
  181. package/src/components/Header/NavigationHeader.tsx +10 -1
  182. package/src/components/Routes/RoutesContent.tsx +14 -31
  183. package/src/components/Routes/RoutesExpanded.style.ts +2 -2
  184. package/src/components/Routes/RoutesExpanded.tsx +33 -13
  185. package/src/components/SendToWallet/SendToWalletButton.tsx +1 -1
  186. package/src/components/SendToWallet/SendToWalletExpandButton.tsx +8 -3
  187. package/src/components/Step/StepProcess.tsx +3 -8
  188. package/src/components/TokenList/TokenDetailsSheetContent.tsx +1 -2
  189. package/src/components/TokenList/useTokenSelect.ts +2 -4
  190. package/src/config/version.ts +1 -1
  191. package/src/hooks/useFromAmountThreshold.ts +6 -2
  192. package/src/hooks/useGasSufficiency.ts +4 -4
  193. package/src/hooks/useNavigateBack.ts +26 -17
  194. package/src/hooks/useRouteExecution.ts +1 -3
  195. package/src/hooks/useRoutes.ts +92 -37
  196. package/src/hooks/useSettingMonitor.ts +7 -11
  197. package/src/hooks/useTokenAddressBalance.ts +6 -1
  198. package/src/hooks/useTokenSearch.ts +5 -2
  199. package/src/hooks/useTokens.ts +2 -2
  200. package/src/hooks/useTools.ts +2 -2
  201. package/src/i18n/bn.json +1 -1
  202. package/src/i18n/de.json +1 -1
  203. package/src/i18n/en.json +1 -1
  204. package/src/i18n/es.json +1 -1
  205. package/src/i18n/fr.json +1 -1
  206. package/src/i18n/hi.json +1 -1
  207. package/src/i18n/id.json +1 -1
  208. package/src/i18n/it.json +1 -1
  209. package/src/i18n/ja.json +1 -1
  210. package/src/i18n/ko.json +1 -1
  211. package/src/i18n/pt.json +1 -1
  212. package/src/i18n/th.json +1 -1
  213. package/src/i18n/tr.json +1 -1
  214. package/src/i18n/uk.json +1 -1
  215. package/src/i18n/vi.json +1 -1
  216. package/src/i18n/zh.json +1 -1
  217. package/src/pages/SelectEnabledToolsPage.tsx +4 -5
  218. package/src/pages/SelectTokenPage/SearchTokenInput.tsx +19 -7
  219. package/src/pages/SettingsPage/BridgeAndExchangeSettings.tsx +1 -2
  220. package/src/pages/TransactionPage/TransactionPage.tsx +17 -9
  221. package/src/stores/bookmarks/BookmarkStore.tsx +3 -6
  222. package/src/stores/bookmarks/useBookmarkActions.ts +9 -13
  223. package/src/stores/bookmarks/useBookmarks.ts +1 -3
  224. package/src/stores/chains/ChainOrderStore.tsx +3 -3
  225. package/src/stores/chains/useChainOrder.ts +1 -5
  226. package/src/stores/form/useFieldActions.ts +10 -14
  227. package/src/stores/form/useFieldValues.ts +1 -3
  228. package/src/stores/form/useFormStore.ts +3 -6
  229. package/src/stores/form/useTouchedFields.ts +1 -2
  230. package/src/stores/form/useValidation.ts +5 -5
  231. package/src/stores/form/useValidationActions.ts +5 -9
  232. package/src/stores/header/useHeaderStore.tsx +3 -5
  233. package/src/stores/inputMode/useInputModeStore.ts +29 -0
  234. package/src/stores/routes/RouteExecutionStore.tsx +3 -3
  235. package/src/stores/routes/useExecutingRoutesIds.ts +14 -17
  236. package/src/stores/settings/useSendToWalletStore.ts +11 -8
  237. package/src/stores/settings/useSettings.ts +8 -11
  238. package/src/stores/settings/useSettingsActions.ts +8 -12
  239. package/src/stores/settings/useSettingsStore.ts +8 -1
  240. package/src/stores/settings/useSplitSubvariantStore.tsx +2 -1
  241. package/src/themes/createTheme.ts +5 -1
  242. package/src/types/widget.ts +1 -0
  243. package/src/utils/format.ts +33 -0
  244. package/src/utils/getPriceImpact.ts +2 -2
package/src/i18n/vi.json CHANGED
@@ -36,7 +36,7 @@
36
36
  "getGas": "Thiết lập gas",
37
37
  "learnMore": "Xem thêm",
38
38
  "light": "Sáng",
39
- "max": "Tối đa",
39
+ "max": "",
40
40
  "ok": "Ok",
41
41
  "options": "Tùy chỉnh",
42
42
  "removeTransaction": "Xoá giao dịch",
package/src/i18n/zh.json CHANGED
@@ -36,7 +36,7 @@
36
36
  "getGas": "开始兑换燃气费",
37
37
  "learnMore": "了解更多",
38
38
  "light": "浅色主题",
39
- "max": "最大",
39
+ "max": "",
40
40
  "ok": "确认",
41
41
  "options": "选项",
42
42
  "removeTransaction": "删除交易",
@@ -14,7 +14,6 @@ import {
14
14
  import type { MouseEventHandler } from 'react'
15
15
  import { type FormEventHandler, useMemo, useState } from 'react'
16
16
  import { useTranslation } from 'react-i18next'
17
- import { shallow } from 'zustand/shallow'
18
17
  import { FullPageContainer } from '../components/FullPageContainer.js'
19
18
  import { ListItemText } from '../components/ListItemText.js'
20
19
  import { StickySearchInput } from '../components/Search/SearchInput.js'
@@ -76,10 +75,10 @@ export const SelectEnabledToolsPage: React.FC<{
76
75
  const typeKey = type.toLowerCase() as 'bridges' | 'exchanges'
77
76
  const { tools } = useTools()
78
77
  const { setToolValue, toggleToolKeys } = useSettingsActions()
79
- const [enabledTools, disabledTools] = useSettingsStore(
80
- (state) => [state[`_enabled${type}`], state[`disabled${type}`]],
81
- shallow
82
- )
78
+ const [enabledTools, disabledTools] = useSettingsStore((state) => [
79
+ state[`_enabled${type}`],
80
+ state[`disabled${type}`],
81
+ ])
83
82
 
84
83
  const { t } = useTranslation()
85
84
  const elementId = useDefaultElementId()
@@ -1,15 +1,27 @@
1
- import { useEffect } from 'react'
1
+ import { useCallback, useEffect } from 'react'
2
2
  import { useTranslation } from 'react-i18next'
3
3
  import { SearchInput } from '../../components/Search/SearchInput.js'
4
4
  import { useFieldActions } from '../../stores/form/useFieldActions.js'
5
- import { useFieldController } from '../../stores/form/useFieldController.js'
5
+ import { useFieldValues } from '../../stores/form/useFieldValues.js'
6
6
 
7
7
  export const SearchTokenInput = () => {
8
8
  const { t } = useTranslation()
9
- const { setFieldValue } = useFieldActions()
10
- const { onChange, onBlur, name, value } = useFieldController({
11
- name: 'tokenSearchFilter',
12
- })
9
+ const [value] = useFieldValues('tokenSearchFilter')
10
+ const { setFieldValue, setAsTouched } = useFieldActions()
11
+
12
+ const onChange = useCallback(
13
+ (newValue: string | number | undefined) => {
14
+ setFieldValue('tokenSearchFilter', newValue, {
15
+ isDirty: true,
16
+ isTouched: true,
17
+ })
18
+ },
19
+ [setFieldValue]
20
+ )
21
+
22
+ const onBlur = useCallback(() => {
23
+ setAsTouched('tokenSearchFilter')
24
+ }, [setAsTouched])
13
25
 
14
26
  useEffect(
15
27
  () => () => {
@@ -20,7 +32,7 @@ export const SearchTokenInput = () => {
20
32
 
21
33
  return (
22
34
  <SearchInput
23
- name={name}
35
+ name="tokenSearchFilter"
24
36
  placeholder={t('main.tokenSearch')}
25
37
  onChange={(e) => onChange((e.target as HTMLInputElement).value)}
26
38
  onBlur={onBlur}
@@ -2,7 +2,6 @@ import AirlineStops from '@mui/icons-material/AirlineStops'
2
2
  import SwapHoriz from '@mui/icons-material/SwapHoriz'
3
3
  import { useTranslation } from 'react-i18next'
4
4
  import { useNavigate } from 'react-router-dom'
5
- import { shallow } from 'zustand/shallow'
6
5
  import { CardButton } from '../../components/Card/CardButton.js'
7
6
  import { useSettingMonitor } from '../../hooks/useSettingMonitor.js'
8
7
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
@@ -25,7 +24,7 @@ export const BridgeAndExchangeSettings: React.FC<{
25
24
  const [enabledTools, tools] = useSettingsStore((state) => {
26
25
  const enabledTools = Object.values(state[`_enabled${type}`])
27
26
  return [enabledTools.filter(Boolean).length, enabledTools.length]
28
- }, shallow)
27
+ })
29
28
 
30
29
  const { hiddenUI } = useWidgetConfig()
31
30
 
@@ -19,6 +19,7 @@ import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.j
19
19
  import { useFieldActions } from '../../stores/form/useFieldActions.js'
20
20
  import { RouteExecutionStatus } from '../../stores/routes/types.js'
21
21
  import { WidgetEvent } from '../../types/events.js'
22
+ import { HiddenUI } from '../../types/widget.js'
22
23
  import { getAccumulatedFeeCostsBreakdown } from '../../utils/fees.js'
23
24
  import { ConfirmToAddressSheet } from './ConfirmToAddressSheet.js'
24
25
  import type { ExchangeRateBottomSheetBase } from './ExchangeRateBottomSheet.js'
@@ -37,8 +38,12 @@ export const TransactionPage: React.FC = () => {
37
38
  const { setFieldValue } = useFieldActions()
38
39
  const emitter = useWidgetEvents()
39
40
  const { navigateBack } = useNavigateBack()
40
- const { subvariant, subvariantOptions, contractSecondaryComponent } =
41
- useWidgetConfig()
41
+ const {
42
+ subvariant,
43
+ subvariantOptions,
44
+ contractSecondaryComponent,
45
+ hiddenUI,
46
+ } = useWidgetConfig()
42
47
  const { state }: any = useLocation()
43
48
  const stateRouteId = state?.routeId
44
49
  const [routeId, setRouteId] = useState<string>(stateRouteId)
@@ -141,7 +146,8 @@ export const TransactionPage: React.FC = () => {
141
146
  toAddress &&
142
147
  !hasActivity &&
143
148
  !isLoadingAddressActivity &&
144
- isActivityAddressFetched
149
+ isActivityAddressFetched &&
150
+ !hiddenUI?.includes(HiddenUI.LowAddressActivityConfirmation)
145
151
  ) {
146
152
  confirmToAddressSheetRef.current?.open()
147
153
  return
@@ -248,12 +254,14 @@ export const TransactionPage: React.FC = () => {
248
254
  />
249
255
  ) : null}
250
256
  <ExchangeRateBottomSheet ref={exchangeRateBottomSheetRef} />
251
- <ConfirmToAddressSheet
252
- ref={confirmToAddressSheetRef}
253
- onContinue={handleExecuteRoute}
254
- toAddress={toAddress!}
255
- toChainId={route.toChainId!}
256
- />
257
+ {!hiddenUI?.includes(HiddenUI.LowAddressActivityConfirmation) ? (
258
+ <ConfirmToAddressSheet
259
+ ref={confirmToAddressSheetRef}
260
+ onContinue={handleExecuteRoute}
261
+ toAddress={toAddress!}
262
+ toChainId={route.toChainId!}
263
+ />
264
+ ) : null}
257
265
  </PageContainer>
258
266
  )
259
267
  }
@@ -1,5 +1,5 @@
1
1
  import { createContext, useContext, useRef } from 'react'
2
- import { shallow } from 'zustand/shallow'
2
+ import { useShallow } from 'zustand/shallow'
3
3
  import { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'
4
4
  import type { PersistStoreProviderProps } from '../types.js'
5
5
  import { createBookmarksStore } from './createBookmarkStore.js'
@@ -25,10 +25,7 @@ export const BookmarkStoreProvider: React.FC<PersistStoreProviderProps> = ({
25
25
  )
26
26
  }
27
27
 
28
- export function useBookmarkStore<T>(
29
- selector: (store: BookmarkState) => T,
30
- equalityFunction = shallow
31
- ) {
28
+ export function useBookmarkStore<T>(selector: (store: BookmarkState) => T) {
32
29
  const useStore = useContext(BookmarkStoreContext)
33
30
 
34
31
  if (!useStore) {
@@ -37,5 +34,5 @@ export function useBookmarkStore<T>(
37
34
  )
38
35
  }
39
36
 
40
- return useStore(selector, equalityFunction)
37
+ return useStore(useShallow(selector))
41
38
  }
@@ -1,20 +1,16 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import { useBookmarkStore } from './BookmarkStore.js'
3
2
  import type { BookmarkActions } from './types.js'
4
3
 
5
4
  export const useBookmarkActions = () => {
6
- const actions = useBookmarkStore<BookmarkActions>(
7
- (store) => ({
8
- getBookmark: store.getBookmark,
9
- addBookmark: store.addBookmark,
10
- removeBookmark: store.removeBookmark,
11
- setSelectedBookmark: store.setSelectedBookmark,
12
- getSelectedBookmark: store.getSelectedBookmark,
13
- addRecentWallet: store.addRecentWallet,
14
- removeRecentWallet: store.removeRecentWallet,
15
- }),
16
- shallow
17
- )
5
+ const actions = useBookmarkStore<BookmarkActions>((store) => ({
6
+ getBookmark: store.getBookmark,
7
+ addBookmark: store.addBookmark,
8
+ removeBookmark: store.removeBookmark,
9
+ setSelectedBookmark: store.setSelectedBookmark,
10
+ getSelectedBookmark: store.getSelectedBookmark,
11
+ addRecentWallet: store.addRecentWallet,
12
+ removeRecentWallet: store.removeRecentWallet,
13
+ }))
18
14
 
19
15
  return actions
20
16
  }
@@ -1,11 +1,9 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import { useBookmarkStore } from './BookmarkStore.js'
3
2
  import type { BookmarkProps } from './types.js'
4
3
 
5
4
  export const useBookmarks = (): BookmarkProps => {
6
5
  const [bookmarks, selectedBookmark, recentWallets] = useBookmarkStore(
7
- (store) => [store.bookmarks, store.selectedBookmark, store.recentWallets],
8
- shallow
6
+ (store) => [store.bookmarks, store.selectedBookmark, store.recentWallets]
9
7
  )
10
8
 
11
9
  return {
@@ -1,5 +1,6 @@
1
1
  import { createContext, useContext, useEffect, useRef } from 'react'
2
2
  import type { StoreApi } from 'zustand'
3
+ import { useShallow } from 'zustand/shallow'
3
4
  import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
4
5
  import { useChains } from '../../hooks/useChains.js'
5
6
  import { useExternalWalletProvider } from '../../providers/WalletProvider/useExternalWalletProvider.js'
@@ -115,9 +116,8 @@ export function useChainOrderStoreContext() {
115
116
  }
116
117
 
117
118
  export function useChainOrderStore<T>(
118
- selector: (state: ChainOrderState) => T,
119
- equalityFn?: (left: T, right: T) => boolean
119
+ selector: (state: ChainOrderState) => T
120
120
  ): T {
121
121
  const useStore = useChainOrderStoreContext()
122
- return useStore(selector, equalityFn)
122
+ return useStore(useShallow(selector))
123
123
  }
@@ -1,12 +1,8 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import type { FormType } from '../form/types.js'
3
2
  import { useChainOrderStore } from './ChainOrderStore.js'
4
3
 
5
4
  export const useChainOrder = (
6
5
  type: FormType
7
6
  ): [number[], (chainId: number, type: FormType) => void] => {
8
- return useChainOrderStore(
9
- (state) => [state.chainOrder[type], state.setChain],
10
- shallow
11
- )
7
+ return useChainOrderStore((state) => [state.chainOrder[type], state.setChain])
12
8
  }
@@ -1,5 +1,4 @@
1
1
  import { useCallback } from 'react'
2
- import { shallow } from 'zustand/shallow'
3
2
  import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
4
3
  import type { FormFieldChanged } from '../../types/events.js'
5
4
  import { WidgetEvent } from '../../types/events.js'
@@ -14,19 +13,16 @@ import { useFormStore } from './useFormStore.js'
14
13
 
15
14
  export const useFieldActions = () => {
16
15
  const emitter = useWidgetEvents()
17
- const actions = useFormStore<FormActions>(
18
- (store) => ({
19
- getFieldValues: store.getFieldValues,
20
- isTouched: store.isTouched,
21
- isDirty: store.isDirty,
22
- resetField: store.resetField,
23
- setAsTouched: store.setAsTouched,
24
- setDefaultValues: store.setDefaultValues,
25
- setFieldValue: store.setFieldValue,
26
- setUserAndDefaultValues: store.setUserAndDefaultValues,
27
- }),
28
- shallow
29
- )
16
+ const actions = useFormStore<FormActions>((store) => ({
17
+ getFieldValues: store.getFieldValues,
18
+ isTouched: store.isTouched,
19
+ isDirty: store.isDirty,
20
+ resetField: store.resetField,
21
+ setAsTouched: store.setAsTouched,
22
+ setDefaultValues: store.setDefaultValues,
23
+ setFieldValue: store.setFieldValue,
24
+ setUserAndDefaultValues: store.setUserAndDefaultValues,
25
+ }))
30
26
 
31
27
  const setFieldValueWithEmittedEvents = useCallback(
32
28
  (
@@ -1,4 +1,3 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import type { FormFieldArray, FormFieldNames } from './types.js'
3
2
  import { useFormStore } from './useFormStore.js'
4
3
 
@@ -6,8 +5,7 @@ import { useFormStore } from './useFormStore.js'
6
5
  export const useFieldValues = <T extends FormFieldNames[]>(...names: T) => {
7
6
  const values = useFormStore(
8
7
  (store) =>
9
- names.map((name) => store.userValues[name]?.value) as FormFieldArray<T>,
10
- shallow
8
+ names.map((name) => store.userValues[name]?.value) as FormFieldArray<T>
11
9
  )
12
10
 
13
11
  return values
@@ -1,17 +1,14 @@
1
1
  import { useContext } from 'react'
2
- import { shallow } from 'zustand/shallow'
2
+ import { useShallow } from 'zustand/shallow'
3
3
  import { FormStoreContext } from './FormStoreContext.js'
4
4
  import type { FormValuesState } from './types.js'
5
5
 
6
- export function useFormStore<T>(
7
- selector: (state: FormValuesState) => T,
8
- equalityFn = shallow
9
- ): T {
6
+ export function useFormStore<T>(selector: (state: FormValuesState) => T): T {
10
7
  const useStore = useContext(FormStoreContext)
11
8
 
12
9
  if (!useStore) {
13
10
  throw new Error('You forgot to wrap your component in <FormStoreProvider>.')
14
11
  }
15
12
 
16
- return useStore(selector, equalityFn)
13
+ return useStore(useShallow(selector))
17
14
  }
@@ -1,8 +1,7 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import { useFormStore } from './useFormStore.js'
3
2
 
4
3
  export const useTouchedFields = () => {
5
- const touchedFields = useFormStore((store) => store.touchedFields, shallow)
4
+ const touchedFields = useFormStore((store) => store.touchedFields)
6
5
 
7
6
  return touchedFields
8
7
  }
@@ -1,11 +1,11 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import type { ValidationProps } from './types.js'
3
2
  import { useFormStore } from './useFormStore.js'
4
3
  export const useValidation = (): Omit<ValidationProps, 'validation'> => {
5
- const [isValid, isValidating, errors] = useFormStore(
6
- (store) => [store.isValid, store.isValidating, store.errors],
7
- shallow
8
- )
4
+ const [isValid, isValidating, errors] = useFormStore((store) => [
5
+ store.isValid,
6
+ store.isValidating,
7
+ store.errors,
8
+ ])
9
9
 
10
10
  return {
11
11
  isValid,
@@ -1,16 +1,12 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import type { ValidationActions } from './types.js'
3
2
  import { useFormStore } from './useFormStore.js'
4
3
 
5
4
  export const useValidationActions = () => {
6
- const actions = useFormStore<ValidationActions>(
7
- (store) => ({
8
- addFieldValidation: store.addFieldValidation,
9
- triggerFieldValidation: store.triggerFieldValidation,
10
- clearErrors: store.clearErrors,
11
- }),
12
- shallow
13
- )
5
+ const actions = useFormStore<ValidationActions>((store) => ({
6
+ addFieldValidation: store.addFieldValidation,
7
+ triggerFieldValidation: store.triggerFieldValidation,
8
+ clearErrors: store.clearErrors,
9
+ }))
14
10
 
15
11
  return actions
16
12
  }
@@ -1,4 +1,5 @@
1
1
  import { createContext, useContext, useRef } from 'react'
2
+ import { useShallow } from 'zustand/shallow'
2
3
  import { createWithEqualityFn } from 'zustand/traditional'
3
4
  import type { PersistStoreProviderProps } from '../types.js'
4
5
  import type { HeaderState, HeaderStore } from './types.js'
@@ -27,12 +28,9 @@ export function useHeaderStoreContext() {
27
28
  return useStore
28
29
  }
29
30
 
30
- export function useHeaderStore<T>(
31
- selector: (state: HeaderState) => T,
32
- equalityCheck?: (objA: T, objB: T) => boolean
33
- ): T {
31
+ export function useHeaderStore<T>(selector: (state: HeaderState) => T): T {
34
32
  const useStore = useHeaderStoreContext()
35
- return useStore(selector, equalityCheck)
33
+ return useStore(useShallow(selector))
36
34
  }
37
35
 
38
36
  // We use fixed position on the header when Widget is in Full Height layout.
@@ -0,0 +1,29 @@
1
+ import { create } from 'zustand'
2
+ import type { FormTypeProps } from '../form/types.js'
3
+
4
+ export type InputMode = 'amount' | 'price'
5
+
6
+ interface InputModeState {
7
+ inputMode: Record<'from' | 'to', InputMode>
8
+ setInputMode: (formType: FormTypeProps['formType'], mode: InputMode) => void
9
+ toggleInputMode: (formType: FormTypeProps['formType']) => void
10
+ }
11
+
12
+ export const useInputModeStore = create<InputModeState>((set, get) => ({
13
+ inputMode: {
14
+ from: 'amount',
15
+ to: 'amount',
16
+ },
17
+ setInputMode: (formType, mode) =>
18
+ set((state) => ({
19
+ inputMode: {
20
+ ...state.inputMode,
21
+ [formType]: mode,
22
+ },
23
+ })),
24
+ toggleInputMode: (formType) => {
25
+ const currentMode = get().inputMode[formType]
26
+ const newMode = currentMode === 'amount' ? 'price' : 'amount'
27
+ get().setInputMode(formType, newMode)
28
+ },
29
+ }))
@@ -1,5 +1,6 @@
1
1
  import { createContext, useContext, useRef } from 'react'
2
2
  import type { StoreApi } from 'zustand'
3
+ import { useShallow } from 'zustand/shallow'
3
4
  import type { UseBoundStoreWithEqualityFn } from 'zustand/traditional'
4
5
  import type { PersistStoreProviderProps } from '../types.js'
5
6
  import { createRouteExecutionStore } from './createRouteExecutionStore.js'
@@ -38,9 +39,8 @@ export function useRouteExecutionStoreContext() {
38
39
  }
39
40
 
40
41
  export function useRouteExecutionStore<T>(
41
- selector: (state: RouteExecutionState) => T,
42
- equalityFn?: (left: T, right: T) => boolean
42
+ selector: (state: RouteExecutionState) => T
43
43
  ): T {
44
44
  const useStore = useRouteExecutionStoreContext()
45
- return useStore(selector, equalityFn)
45
+ return useStore(useShallow(selector))
46
46
  }
@@ -1,5 +1,4 @@
1
1
  import { useAccount } from '@lifi/wallet-management'
2
- import { shallow } from 'zustand/shallow'
3
2
  import { useRouteExecutionStore } from './RouteExecutionStore.js'
4
3
  import type { RouteExecution } from './types.js'
5
4
  import { RouteExecutionStatus } from './types.js'
@@ -7,21 +6,19 @@ import { RouteExecutionStatus } from './types.js'
7
6
  export const useExecutingRoutesIds = () => {
8
7
  const { accounts } = useAccount()
9
8
  const accountAddresses = accounts.map((account) => account.address)
10
- return useRouteExecutionStore(
11
- (state) =>
12
- (Object.values(state.routes) as RouteExecution[])
13
- .filter(
14
- (item) =>
15
- accountAddresses.includes(item.route.fromAddress) &&
16
- (item.status === RouteExecutionStatus.Pending ||
17
- item.status === RouteExecutionStatus.Failed)
18
- )
19
- .sort(
20
- (a, b) =>
21
- (b?.route.steps[0].execution?.process[0]?.startedAt ?? 0) -
22
- (a?.route.steps[0].execution?.process[0]?.startedAt ?? 0)
23
- )
24
- .map(({ route }) => route.id),
25
- shallow
9
+ return useRouteExecutionStore((state) =>
10
+ (Object.values(state.routes) as RouteExecution[])
11
+ .filter(
12
+ (item) =>
13
+ accountAddresses.includes(item.route.fromAddress) &&
14
+ (item.status === RouteExecutionStatus.Pending ||
15
+ item.status === RouteExecutionStatus.Failed)
16
+ )
17
+ .sort(
18
+ (a, b) =>
19
+ (b?.route.steps[0].execution?.process[0]?.startedAt ?? 0) -
20
+ (a?.route.steps[0].execution?.process[0]?.startedAt ?? 0)
21
+ )
22
+ .map(({ route }) => route.id)
26
23
  )
27
24
  }
@@ -1,8 +1,8 @@
1
- import { shallow } from 'zustand/shallow'
1
+ import { useShallow } from 'zustand/shallow'
2
2
  import { createWithEqualityFn } from 'zustand/traditional'
3
3
  import type { SendToWalletStore } from './types.js'
4
4
 
5
- export const useSendToWalletStore = createWithEqualityFn<SendToWalletStore>(
5
+ export const sendToWalletStore = createWithEqualityFn<SendToWalletStore>(
6
6
  (set) => ({
7
7
  showSendToWallet: false,
8
8
  setSendToWallet: (value) =>
@@ -13,13 +13,16 @@ export const useSendToWalletStore = createWithEqualityFn<SendToWalletStore>(
13
13
  Object.is
14
14
  )
15
15
 
16
+ export const useSendToWalletStore = <T>(
17
+ selector: (state: SendToWalletStore) => T
18
+ ): T => {
19
+ return sendToWalletStore(useShallow(selector))
20
+ }
21
+
16
22
  export const useSendToWalletActions = () => {
17
- const actions = useSendToWalletStore(
18
- (store) => ({
19
- setSendToWallet: store.setSendToWallet,
20
- }),
21
- shallow
22
- )
23
+ const actions = useSendToWalletStore((store) => ({
24
+ setSendToWallet: store.setSendToWallet,
25
+ }))
23
26
 
24
27
  return actions
25
28
  }
@@ -1,19 +1,16 @@
1
- import { shallow } from 'zustand/shallow'
2
1
  import type { SettingsState } from './types.js'
3
2
  import { useSettingsStore } from './useSettingsStore.js'
4
3
 
5
4
  export const useSettings = <K extends keyof SettingsState>(
6
5
  keys: Array<K>
7
6
  ): Pick<SettingsState, (typeof keys)[number]> => {
8
- return useSettingsStore(
9
- (state) =>
10
- keys.reduce(
11
- (values, key) => {
12
- values[key] = state[key]
13
- return values
14
- },
15
- {} as Pick<SettingsState, (typeof keys)[number]>
16
- ),
17
- shallow
7
+ return useSettingsStore((state) =>
8
+ keys.reduce(
9
+ (values, key) => {
10
+ values[key] = state[key]
11
+ return values
12
+ },
13
+ {} as Pick<SettingsState, (typeof keys)[number]>
14
+ )
18
15
  )
19
16
  }
@@ -1,5 +1,4 @@
1
1
  import { useCallback } from 'react'
2
- import { shallow } from 'zustand/shallow'
3
2
  import type { widgetEvents } from '../../hooks/useWidgetEvents.js'
4
3
  import { useWidgetEvents } from '../../hooks/useWidgetEvents.js'
5
4
  import { WidgetEvent } from '../../types/events.js'
@@ -47,17 +46,14 @@ const emitEventOnChange = <T extends (...args: any[]) => any>(
47
46
 
48
47
  export const useSettingsActions = () => {
49
48
  const emitter = useWidgetEvents()
50
- const actions = useSettingsStore(
51
- (state) => ({
52
- setValue: state.setValue,
53
- getValue: state.getValue,
54
- getSettings: state.getSettings,
55
- reset: state.reset,
56
- setToolValue: state.setToolValue,
57
- toggleToolKeys: state.toggleToolKeys,
58
- }),
59
- shallow
60
- )
49
+ const actions = useSettingsStore((state) => ({
50
+ setValue: state.setValue,
51
+ getValue: state.getValue,
52
+ getSettings: state.getSettings,
53
+ reset: state.reset,
54
+ setToolValue: state.setToolValue,
55
+ toggleToolKeys: state.toggleToolKeys,
56
+ }))
61
57
 
62
58
  const setValueWithEmittedEvent = useCallback<ValueSetter<SettingsProps>>(
63
59
  (value, newValue) => {
@@ -1,6 +1,7 @@
1
1
  /** biome-ignore-all lint/correctness/noUnusedVariables: allowed in this store */
2
2
  import type { StateCreator } from 'zustand'
3
3
  import { persist } from 'zustand/middleware'
4
+ import { useShallow } from 'zustand/shallow'
4
5
  import { createWithEqualityFn } from 'zustand/traditional'
5
6
  import type { SettingsProps, SettingsState } from './types.js'
6
7
  import { SettingsToolTypes } from './types.js'
@@ -28,7 +29,7 @@ export const defaultSettings: SettingsProps = {
28
29
  _enabledExchanges: {},
29
30
  }
30
31
 
31
- export const useSettingsStore = createWithEqualityFn<SettingsState>(
32
+ export const settingsStore = createWithEqualityFn<SettingsState>(
32
33
  persist(
33
34
  (set, get) => ({
34
35
  ...defaultSettings,
@@ -176,3 +177,9 @@ export const useSettingsStore = createWithEqualityFn<SettingsState>(
176
177
  ) as StateCreator<SettingsState, [], [], SettingsState>,
177
178
  Object.is
178
179
  )
180
+
181
+ export const useSettingsStore = <T>(
182
+ selector: (state: SettingsState) => T
183
+ ): T => {
184
+ return settingsStore(useShallow(selector))
185
+ }
@@ -1,4 +1,5 @@
1
1
  import { createContext, useContext, useRef } from 'react'
2
+ import { useShallow } from 'zustand/shallow'
2
3
  import { createWithEqualityFn } from 'zustand/traditional'
3
4
  import type {
4
5
  SplitSubvariantProps,
@@ -47,7 +48,7 @@ export function useSplitSubvariantStore<T>(
47
48
  selector: (state: SplitSubvariantState) => T
48
49
  ): T {
49
50
  const useStore = useSplitSubvariantStoreContext()
50
- return useStore(selector)
51
+ return useStore(useShallow(selector))
51
52
  }
52
53
 
53
54
  export const createSplitSubvariantStore = ({ state }: SplitSubvariantProps) =>