@lifi/widget 1.17.1 → 1.18.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.
Files changed (210) hide show
  1. package/App.js +6 -86
  2. package/AppDrawer.js +3 -2
  3. package/AppRoutes.d.ts +2 -0
  4. package/AppRoutes.js +85 -0
  5. package/cjs/App.js +5 -85
  6. package/cjs/AppDrawer.js +2 -1
  7. package/cjs/AppRoutes.d.ts +2 -0
  8. package/cjs/AppRoutes.js +89 -0
  9. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  10. package/cjs/components/AppContainer.d.ts +4 -5
  11. package/cjs/components/AppContainer.js +30 -29
  12. package/cjs/components/Card/Card.d.ts +1 -0
  13. package/cjs/components/Card/Card.js +13 -9
  14. package/cjs/components/ChainSelect/ChainSelect.js +3 -3
  15. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  16. package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
  17. package/cjs/components/ChainSelect/useChainSelect.js +2 -2
  18. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  19. package/cjs/components/Header/Header.d.ts +2 -1
  20. package/cjs/components/Header/Header.js +3 -2
  21. package/cjs/components/Header/Header.style.js +3 -2
  22. package/cjs/components/Header/NavigationHeader.js +4 -1
  23. package/cjs/components/Header/WalletHeader.js +1 -1
  24. package/cjs/components/Header/useHeaderActionStore.js +1 -4
  25. package/cjs/components/PoweredBy/PoweredBy.js +7 -0
  26. package/cjs/components/SendToWallet/SendToWallet.js +6 -10
  27. package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  28. package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
  29. package/cjs/components/SendToWallet/index.d.ts +1 -0
  30. package/cjs/components/SendToWallet/index.js +1 -0
  31. package/cjs/components/SendToWallet/store.d.ts +4 -0
  32. package/cjs/components/SendToWallet/store.js +13 -0
  33. package/cjs/components/SendToWallet/types.d.ts +6 -0
  34. package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
  35. package/cjs/components/StepActions/StepActions.style.js +1 -1
  36. package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
  37. package/cjs/components/SwapButton/SwapButton.js +4 -4
  38. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  39. package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
  40. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  41. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
  42. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  43. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  44. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  45. package/cjs/components/SwapRouteCard/types.d.ts +6 -2
  46. package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  47. package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
  48. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  49. package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
  50. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  51. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
  52. package/cjs/components/SwapRoutes/index.d.ts +2 -0
  53. package/cjs/components/SwapRoutes/index.js +18 -0
  54. package/cjs/components/Token/Token.d.ts +2 -1
  55. package/cjs/components/Token/Token.js +10 -6
  56. package/cjs/components/Token/Token.style.js +2 -0
  57. package/cjs/components/TokenList/TokenList.js +4 -1
  58. package/cjs/config/sentry.js +3 -26
  59. package/cjs/config/theme.js +20 -24
  60. package/cjs/config/version.d.ts +1 -1
  61. package/cjs/config/version.js +1 -1
  62. package/cjs/hooks/useChains.js +2 -2
  63. package/cjs/hooks/useGasSufficiency.js +14 -37
  64. package/cjs/hooks/useNavigateBack.js +13 -6
  65. package/cjs/hooks/useRouteExecution.js +5 -8
  66. package/cjs/hooks/useSwapRoutes.js +1 -4
  67. package/cjs/hooks/useTelemetry.js +3 -2
  68. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  69. package/cjs/hooks/useTokenBalances.js +3 -1
  70. package/cjs/hooks/useWidgetEvents.js +2 -5
  71. package/cjs/i18n/index.js +2 -5
  72. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  73. package/cjs/pages/MainPage/MainPage.js +4 -2
  74. package/cjs/pages/MainPage/MainSwapButton.js +4 -4
  75. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  76. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +1 -4
  77. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +1 -4
  78. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -5
  79. package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  80. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  81. package/cjs/pages/SwapPage/SwapPage.js +5 -1
  82. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -5
  83. package/cjs/providers/SDKProvider/SDKProvider.js +1 -4
  84. package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
  85. package/cjs/stores/chains/useChainOrder.js +1 -4
  86. package/cjs/stores/chains/useChainOrderStore.js +1 -4
  87. package/cjs/stores/index.d.ts +2 -1
  88. package/cjs/stores/index.js +2 -1
  89. package/cjs/stores/{route → routes}/index.d.ts +2 -1
  90. package/cjs/stores/{route → routes}/index.js +2 -1
  91. package/cjs/stores/{route → routes}/types.d.ts +4 -0
  92. package/cjs/stores/routes/types.js +2 -0
  93. package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  94. package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +3 -6
  95. package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  96. package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +3 -6
  97. package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
  98. package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
  99. package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  100. package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
  101. package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  102. package/cjs/stores/{route → routes}/useSwapHistory.js +3 -6
  103. package/cjs/stores/{route → routes}/utils.d.ts +0 -0
  104. package/cjs/stores/{route → routes}/utils.js +1 -4
  105. package/cjs/stores/settings/useAppearance.js +1 -4
  106. package/cjs/stores/settings/useSettings.js +1 -4
  107. package/cjs/stores/settings/useSettingsStore.js +2 -5
  108. package/cjs/types/widget.d.ts +2 -0
  109. package/cjs/utils/colors.d.ts +1 -1
  110. package/cjs/utils/format.js +1 -4
  111. package/cjs/utils/navigationRoutes.js +12 -12
  112. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  113. package/components/AppContainer.d.ts +4 -5
  114. package/components/AppContainer.js +29 -28
  115. package/components/Card/Card.d.ts +1 -0
  116. package/components/Card/Card.js +13 -9
  117. package/components/ChainSelect/ChainSelect.js +1 -1
  118. package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  119. package/components/ChainSelect/ChainSelect.style.js +2 -2
  120. package/components/ChainSelect/useChainSelect.js +1 -1
  121. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  122. package/components/Header/Header.d.ts +2 -1
  123. package/components/Header/Header.js +1 -1
  124. package/components/Header/Header.style.js +4 -3
  125. package/components/Header/NavigationHeader.js +4 -1
  126. package/components/Header/WalletHeader.js +2 -2
  127. package/components/PoweredBy/PoweredBy.js +7 -0
  128. package/components/SendToWallet/SendToWallet.js +8 -11
  129. package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  130. package/components/SendToWallet/SendToWalletButton.js +20 -0
  131. package/components/SendToWallet/index.d.ts +1 -0
  132. package/components/SendToWallet/index.js +1 -0
  133. package/components/SendToWallet/store.d.ts +4 -0
  134. package/components/SendToWallet/store.js +10 -0
  135. package/components/SendToWallet/types.d.ts +6 -0
  136. package/{stores/route → components/SendToWallet}/types.js +0 -0
  137. package/components/StepActions/StepActions.style.js +1 -1
  138. package/components/SwapButton/SwapButton.d.ts +1 -1
  139. package/components/SwapButton/SwapButton.js +4 -3
  140. package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  141. package/components/SwapRouteCard/SwapRouteCard.js +19 -16
  142. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  143. package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
  144. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  145. package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  146. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  147. package/components/SwapRouteCard/types.d.ts +6 -2
  148. package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  149. package/components/SwapRoutes/SwapRoutes.js +47 -0
  150. package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  151. package/components/SwapRoutes/SwapRoutes.style.js +44 -0
  152. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  153. package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
  154. package/components/SwapRoutes/index.d.ts +2 -0
  155. package/components/SwapRoutes/index.js +2 -0
  156. package/components/Token/Token.d.ts +2 -1
  157. package/components/Token/Token.js +11 -7
  158. package/components/Token/Token.style.js +2 -0
  159. package/components/TokenList/TokenList.js +4 -1
  160. package/config/theme.js +20 -24
  161. package/config/version.d.ts +1 -1
  162. package/config/version.js +1 -1
  163. package/hooks/useChains.js +1 -1
  164. package/hooks/useGasSufficiency.js +15 -35
  165. package/hooks/useNavigateBack.js +13 -6
  166. package/hooks/useRouteExecution.js +5 -5
  167. package/hooks/useTelemetry.js +3 -2
  168. package/hooks/useTokenBalances.d.ts +1 -1
  169. package/hooks/useTokenBalances.js +3 -1
  170. package/package.json +14 -14
  171. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  172. package/pages/MainPage/MainPage.js +4 -2
  173. package/pages/MainPage/MainSwapButton.js +4 -3
  174. package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  175. package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  176. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  177. package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  178. package/pages/SwapPage/SwapPage.js +5 -1
  179. package/pages/SwapRoutesPage/SwapRoutesPage.js +4 -6
  180. package/providers/WalletProvider/WalletProvider.js +1 -1
  181. package/stores/index.d.ts +2 -1
  182. package/stores/index.js +2 -1
  183. package/stores/{route → routes}/index.d.ts +2 -1
  184. package/stores/{route → routes}/index.js +2 -1
  185. package/stores/{route → routes}/types.d.ts +4 -0
  186. package/stores/routes/types.js +1 -0
  187. package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  188. package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
  189. package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  190. package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
  191. package/stores/routes/useSelectedRouteStore.d.ts +4 -0
  192. package/stores/routes/useSelectedRouteStore.js +9 -0
  193. package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  194. package/stores/routes/useSetExecutableRoute.js +4 -0
  195. package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  196. package/stores/{route → routes}/useSwapHistory.js +2 -2
  197. package/stores/{route → routes}/utils.d.ts +0 -0
  198. package/stores/{route → routes}/utils.js +0 -0
  199. package/stores/settings/useSettingsStore.js +1 -1
  200. package/tsconfig.cjs.tsbuildinfo +1 -1
  201. package/types/widget.d.ts +2 -0
  202. package/utils/colors.d.ts +1 -1
  203. package/utils/navigationRoutes.js +12 -12
  204. package/cjs/pages/MainPage/SwapRoutes.js +0 -43
  205. package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  206. package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
  207. package/pages/MainPage/SwapRoutes.js +0 -39
  208. package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  209. package/pages/MainPage/SwapRoutes.style.js +0 -13
  210. package/stores/route/useSetExecutableRoute.js +0 -4
@@ -0,0 +1,43 @@
1
+ /// <reference types="react" />
2
+ export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
+ ref?: import("react").Ref<unknown> | undefined;
4
+ children?: import("react").ReactNode;
5
+ direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
6
+ spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
7
+ divider?: import("react").ReactNode;
8
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
12
+ export declare const CollapseContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
13
+ children?: import("react").ReactNode;
14
+ component?: import("react").ElementType<any> | undefined;
15
+ ref?: import("react").Ref<unknown> | undefined;
16
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
17
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
18
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
19
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
20
+ export declare const ScrollableContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
21
+ children?: import("react").ReactNode;
22
+ component?: import("react").ElementType<any> | undefined;
23
+ ref?: import("react").Ref<unknown> | undefined;
24
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
25
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
26
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
27
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
28
+ export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
29
+ children?: import("react").ReactNode;
30
+ component?: import("react").ElementType<any> | undefined;
31
+ ref?: import("react").Ref<unknown> | undefined;
32
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
33
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
34
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
35
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
36
+ export declare const Header: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
37
+ children?: import("react").ReactNode;
38
+ component?: import("react").ElementType<any> | undefined;
39
+ ref?: import("react").Ref<unknown> | undefined;
40
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
41
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
42
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
43
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Header = exports.Container = exports.ScrollableContainer = exports.CollapseContainer = exports.Stack = void 0;
4
+ const material_1 = require("@mui/material");
5
+ const styles_1 = require("@mui/material/styles");
6
+ const AppContainer_1 = require("../AppContainer");
7
+ exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
8
+ alignItems: 'stretch',
9
+ display: 'flex',
10
+ flex: 1,
11
+ flexWrap: 'nowrap',
12
+ overflow: 'hidden',
13
+ borderRight: `solid ${theme.palette.mode === 'light'
14
+ ? theme.palette.grey[300]
15
+ : theme.palette.grey[800]}`,
16
+ width: 'calc(100% - 48px)',
17
+ }));
18
+ exports.CollapseContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
19
+ height: AppContainer_1.maxHeight,
20
+ }));
21
+ exports.ScrollableContainer = (0, styles_1.styled)(material_1.Box)({
22
+ overflowY: 'auto',
23
+ height: '100%',
24
+ flex: 1,
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ });
28
+ exports.Container = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
29
+ backgroundColor: theme.palette.background.default,
30
+ overflow: 'auto',
31
+ width: 436,
32
+ maxHeight: AppContainer_1.maxHeight,
33
+ marginLeft: theme.spacing(3),
34
+ display: 'flex',
35
+ flexDirection: 'column',
36
+ }));
37
+ exports.Header = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
38
+ backgroundColor: (0, styles_1.alpha)(theme.palette.background.default, 0.84),
39
+ backdropFilter: 'blur(12px)',
40
+ display: 'flex',
41
+ justifyContent: 'space-between',
42
+ alignItems: 'center',
43
+ padding: theme.spacing(1.5, 3),
44
+ position: 'sticky',
45
+ top: 0,
46
+ zIndex: 1200,
47
+ }));
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const SwapRoutesExpanded: () => JSX.Element;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwapRoutesExpanded = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const react_i18next_1 = require("react-i18next");
7
+ const react_router_dom_1 = require("react-router-dom");
8
+ const hooks_1 = require("../../hooks");
9
+ const providers_1 = require("../../providers");
10
+ const stores_1 = require("../../stores");
11
+ const utils_1 = require("../../utils");
12
+ const ProgressToNextUpdate_1 = require("../ProgressToNextUpdate");
13
+ const SwapRouteCard_1 = require("../SwapRouteCard");
14
+ const SwapRoutes_style_1 = require("./SwapRoutes.style");
15
+ const SwapRoutesExpanded = () => {
16
+ const { t } = (0, react_i18next_1.useTranslation)();
17
+ const { containerStyle } = (0, providers_1.useWidgetConfig)();
18
+ const navigate = (0, react_router_dom_1.useNavigate)();
19
+ const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
20
+ const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
21
+ const { pathname } = (0, react_router_dom_1.useLocation)();
22
+ const cleanedPathname = pathname.endsWith('/')
23
+ ? pathname.slice(0, -1)
24
+ : pathname;
25
+ const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
26
+ const hasPath = utils_1.navigationRoutesValues.includes(path);
27
+ const handleRouteClick = (route) => {
28
+ setExecutableRoute(route);
29
+ navigate(utils_1.navigationRoutes.swapExecution, {
30
+ state: { routeId: route.id },
31
+ });
32
+ };
33
+ const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
34
+ const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
35
+ const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
36
+ return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "extended" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "extended" }, route.id)))) }))] }) })) })) })) }));
37
+ };
38
+ exports.SwapRoutesExpanded = SwapRoutesExpanded;
@@ -0,0 +1,2 @@
1
+ export * from './SwapRoutes';
2
+ export * from './SwapRoutesExpanded';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SwapRoutes"), exports);
18
+ __exportStar(require("./SwapRoutesExpanded"), exports);
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
- import type { TokenAmount } from '@lifi/sdk';
2
+ import type { Step, TokenAmount } from '@lifi/sdk';
3
3
  import type { BoxProps } from '@mui/material';
4
4
  export declare const Token: React.FC<{
5
5
  token: TokenAmount;
6
6
  connected?: boolean;
7
+ step?: Step;
7
8
  } & BoxProps>;
@@ -17,19 +17,23 @@ const material_1 = require("@mui/material");
17
17
  const react_i18next_1 = require("react-i18next");
18
18
  const hooks_1 = require("../../hooks");
19
19
  const utils_1 = require("../../utils");
20
+ const SmallAvatar_1 = require("../SmallAvatar");
20
21
  const TextFitter_1 = require("../TextFitter");
21
22
  const TokenAvatar_1 = require("../TokenAvatar");
22
23
  const Token_style_1 = require("./Token.style");
23
24
  const Token = (_a) => {
24
25
  var _b;
25
- var { token, connected } = _a, other = __rest(_a, ["token", "connected"]);
26
+ var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
26
27
  const { t } = (0, react_i18next_1.useTranslation)();
27
28
  const { getChainById } = (0, hooks_1.useChains)();
28
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1 }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 32, textStyle: {
29
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
29
30
  fontWeight: 700,
30
- } }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
31
- tokenSymbol: token.symbol,
32
- chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
33
- }) }))] })));
31
+ } }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
32
+ tokenSymbol: token.symbol,
33
+ chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
34
+ }) })), step ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1 }, { children: "\u2022" })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 0.75 }, { children: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
35
+ border: 0,
36
+ marginBottom: -0.25,
37
+ } }, { children: step.toolDetails.name[0] })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))) : null] }))] })));
34
38
  };
35
39
  exports.Token = Token;
@@ -21,6 +21,8 @@ exports.TextSecondary = (0, styles_1.styled)(material_1.Typography, {
21
21
  padding: connected
22
22
  ? theme.spacing(0, 0, 0, 3.875)
23
23
  : theme.spacing(0, 0, 0, 0),
24
+ display: 'flex',
25
+ alignItems: 'flex-start',
24
26
  }));
25
27
  exports.TokenDivider = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
26
28
  height: 12,
@@ -26,7 +26,10 @@ const TokenList = ({ formType, height, onClick, }) => {
26
26
  token.symbol.toUpperCase().includes(searchFilter) ||
27
27
  token.address.toUpperCase().includes(searchFilter))
28
28
  : filteredTokens;
29
- const tokenSearchEnabled = !filteredTokens.length && !isTokensLoading;
29
+ const tokenSearchEnabled = !isTokensLoading &&
30
+ !!filteredTokens.length &&
31
+ !!tokenSearchFilter &&
32
+ !!selectedChainId;
30
33
  const { token: searchedToken, isLoading: isSearchedTokenLoading } = (0, hooks_1.useTokenSearch)(tokenSearchFilter, selectedChainId, tokenSearchEnabled);
31
34
  const isLoading = isTokensLoading || (tokenSearchEnabled && isSearchedTokenLoading);
32
35
  const tokens = filteredTokens.length
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
3
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
4
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -41,9 +18,9 @@ const initSentry = (enabled) => __awaiter(void 0, void 0, void 0, function* () {
41
18
  }
42
19
  if (enabled || sentryLoaded) {
43
20
  const [Sentry, { CaptureConsole }, { BrowserTracing }] = yield Promise.all([
44
- Promise.resolve().then(() => __importStar(require('@sentry/react'))),
45
- Promise.resolve().then(() => __importStar(require('@sentry/integrations'))),
46
- Promise.resolve().then(() => __importStar(require('@sentry/tracing'))),
21
+ Promise.resolve().then(() => require('@sentry/react')),
22
+ Promise.resolve().then(() => require('@sentry/integrations')),
23
+ Promise.resolve().then(() => require('@sentry/tracing')),
47
24
  ]);
48
25
  Sentry.init({
49
26
  dsn: 'https://bc1312161bf948db9b9c82618035ec22@o1302189.ingest.sentry.io/6539228',
@@ -28,6 +28,17 @@ const palette = {
28
28
  main: '#297EFF',
29
29
  },
30
30
  };
31
+ const paletteLight = {
32
+ text: {
33
+ primary: '#000000',
34
+ secondary: '#747474',
35
+ },
36
+ };
37
+ const paletteDark = {
38
+ background: {
39
+ paper: '#212121',
40
+ },
41
+ };
31
42
  const shape = {
32
43
  borderRadius: 12,
33
44
  borderRadiusSecondary: 6,
@@ -47,27 +58,7 @@ const createTheme = (mode, theme = {}) => {
47
58
  main: (_m = (_l = (_k = theme.palette) === null || _k === void 0 ? void 0 : _k.secondary) === null || _l === void 0 ? void 0 : _l.main) !== null && _m !== void 0 ? _m : palette.secondary.main,
48
59
  light: (0, styles_1.lighten)((_q = (_p = (_o = theme.palette) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p.main) !== null && _q !== void 0 ? _q : palette.secondary.main, 0.5),
49
60
  dark: (0, styles_1.darken)((_t = (_s = (_r = theme.palette) === null || _r === void 0 ? void 0 : _r.secondary) === null || _s === void 0 ? void 0 : _s.main) !== null && _t !== void 0 ? _t : palette.secondary.main, 0.2),
50
- } }), (mode === 'light'
51
- ? {
52
- text: {
53
- primary: '#000',
54
- secondary: '#52575b',
55
- },
56
- grey: {
57
- 100: '#F4F5F6',
58
- 200: '#EFF1F2',
59
- 300: '#E3E7E9',
60
- 400: '#C6C9CD',
61
- 500: '#AEB3B7',
62
- 600: '#798086',
63
- 700: '#57595C',
64
- },
65
- }
66
- : {
67
- background: {
68
- paper: '#212121',
69
- },
70
- })),
61
+ } }), (mode === 'light' ? paletteLight : paletteDark)),
71
62
  shape: Object.assign(Object.assign({}, shape), theme.shape),
72
63
  breakpoints: {
73
64
  values: {
@@ -99,6 +90,11 @@ const createTheme = (mode, theme = {}) => {
99
90
  cursor: 'not-allowed',
100
91
  pointerEvents: 'auto',
101
92
  },
93
+ }, text: {
94
+ backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.08),
95
+ '&:hover': {
96
+ backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.12),
97
+ },
102
98
  }, contained: {
103
99
  '&:hover': {
104
100
  color: (0, styles_1.getContrastRatio)(colors_1.common.white, primaryMainColor) >= 3
@@ -121,10 +117,10 @@ const createTheme = (mode, theme = {}) => {
121
117
  },
122
118
  },
123
119
  text: {
124
- color: primaryLightColor,
120
+ backgroundColor: paletteDark.background.paper,
121
+ color: colors_1.common.white,
125
122
  '&:hover': {
126
- backgroundColor: (0, styles_1.alpha)(primaryLightColor, 0.08),
127
- borderColor: primaryLightColor,
123
+ backgroundColor: (0, styles_1.lighten)(paletteDark.background.paper, 0.02),
128
124
  },
129
125
  },
130
126
  }
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.17.1";
2
+ export declare const version = "1.18.0";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '1.17.1';
5
+ exports.version = '1.18.0';
@@ -14,7 +14,7 @@ const react_query_1 = require("@tanstack/react-query");
14
14
  const react_1 = require("react");
15
15
  const react_hook_form_1 = require("react-hook-form");
16
16
  const providers_1 = require("../providers");
17
- const chains_1 = require("../stores/chains");
17
+ const stores_1 = require("../stores");
18
18
  const useChains = () => {
19
19
  const { disabledChains, chains } = (0, providers_1.useWidgetConfig)();
20
20
  const lifi = (0, providers_1.useLiFi)();
@@ -22,7 +22,7 @@ const useChains = () => {
22
22
  const { data, isLoading } = (0, react_query_1.useQuery)(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
23
23
  const availableChains = yield lifi.getChains();
24
24
  const filteredChains = availableChains.filter((chain) => (0, providers_1.isItemAllowed)(chain.id, chains, disabledChains));
25
- const chainOrder = chains_1.useChainOrderStore
25
+ const chainOrder = stores_1.useChainOrderStore
26
26
  .getState()
27
27
  .initializeChains(filteredChains.map((chain) => chain.id));
28
28
  const [fromChainValue, toChainValue] = getValues([
@@ -8,34 +8,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.useGasSufficiency = void 0;
16
- const big_js_1 = __importDefault(require("big.js"));
13
+ const big_js_1 = require("big.js");
17
14
  const react_1 = require("react");
18
- const react_hook_form_1 = require("react-hook-form");
19
15
  const _1 = require(".");
20
16
  const providers_1 = require("../providers");
21
17
  const useTokenBalances_1 = require("./useTokenBalances");
22
18
  const useGasSufficiency = (route) => {
23
19
  const lifi = (0, providers_1.useLiFi)();
24
20
  const { account } = (0, providers_1.useWallet)();
25
- const [fromChainId, toChainId, fromToken] = (0, react_hook_form_1.useWatch)({
26
- name: [
27
- providers_1.SwapFormKeyHelper.getChainKey('from'),
28
- providers_1.SwapFormKeyHelper.getChainKey('to'),
29
- providers_1.SwapFormKey.FromToken,
30
- ],
31
- });
32
- const fromAmount = (0, _1.useDebouncedWatch)(providers_1.SwapFormKey.FromAmount, 250);
33
21
  const { getChainById } = (0, _1.useChains)();
34
- const { tokensWithBalance: fromChainTokenBalances } = (0, useTokenBalances_1.useTokenBalances)(fromChainId);
22
+ const { tokensWithBalance: fromChainTokenBalances } = (0, useTokenBalances_1.useTokenBalances)(route === null || route === void 0 ? void 0 : route.fromChainId);
35
23
  const [insufficientGas, setInsufficientGas] = (0, react_1.useState)();
36
24
  const checkInsufficientGas = (0, react_1.useCallback)(() => __awaiter(void 0, void 0, void 0, function* () {
37
- var _a;
38
- if (!account.isActive || !route || !fromAmount) {
25
+ var _a, _b;
26
+ if (!account.isActive || !route) {
39
27
  setInsufficientGas(undefined);
40
28
  return;
41
29
  }
@@ -59,16 +47,15 @@ const useGasSufficiency = (route) => {
59
47
  }
60
48
  return groupedGasCosts;
61
49
  }, {});
62
- if (gasCosts[fromChainId] &&
63
- route.fromToken.address === gasCosts[fromChainId].token.address) {
64
- gasCosts[fromChainId].tokenAmount = (_a = gasCosts[fromChainId]) === null || _a === void 0 ? void 0 : _a.gasAmount.plus((0, big_js_1.default)(fromAmount));
50
+ if (route.fromToken.address === ((_a = gasCosts[route.fromChainId]) === null || _a === void 0 ? void 0 : _a.token.address)) {
51
+ gasCosts[route.fromChainId].tokenAmount = (_b = gasCosts[route.fromChainId]) === null || _b === void 0 ? void 0 : _b.gasAmount.plus((0, big_js_1.default)(route.fromAmount).div(Math.pow(10, route.fromToken.decimals)));
65
52
  }
66
53
  const tokenBalances = yield lifi.getTokenBalances(account.address, Object.values(gasCosts).map((item) => item.token));
67
54
  if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
68
55
  setInsufficientGas(undefined);
69
56
  return;
70
57
  }
71
- [fromChainId, toChainId].forEach((chainId) => {
58
+ [route.fromChainId, route.toChainId].forEach((chainId) => {
72
59
  var _a, _b, _c, _d, _e, _f;
73
60
  if (gasCosts[chainId]) {
74
61
  const gasTokenBalance = (0, big_js_1.default)((_b = (_a = tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.find((t) => t.chainId === gasCosts[chainId].token.chainId &&
@@ -84,27 +71,17 @@ const useGasSufficiency = (route) => {
84
71
  });
85
72
  const gasCostResult = Object.values(gasCosts).filter((gasCost) => gasCost.insufficient);
86
73
  setInsufficientGas(gasCostResult);
87
- }), [
88
- account.address,
89
- account.isActive,
90
- fromAmount,
91
- fromChainId,
92
- getChainById,
93
- lifi,
94
- route,
95
- toChainId,
96
- ]);
74
+ }), [account.address, account.isActive, getChainById, lifi, route]);
97
75
  const insufficientFunds = (0, react_1.useMemo)(() => {
98
76
  var _a, _b;
99
- if (!account.isActive ||
100
- !fromToken ||
101
- !fromAmount ||
102
- !fromChainTokenBalances) {
77
+ if (!account.isActive || !fromChainTokenBalances || !route) {
103
78
  return false;
104
79
  }
105
- const balance = (0, big_js_1.default)((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === fromToken)) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
106
- return (0, big_js_1.default)(fromAmount).gt(balance);
107
- }, [account.isActive, fromAmount, fromChainTokenBalances, fromToken]);
80
+ const balance = (0, big_js_1.default)((_b = (_a = fromChainTokenBalances === null || fromChainTokenBalances === void 0 ? void 0 : fromChainTokenBalances.find((t) => t.address === (route === null || route === void 0 ? void 0 : route.fromToken.address))) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0);
81
+ return (0, big_js_1.default)(route.fromAmount)
82
+ .div(Math.pow(10, route.fromToken.decimals))
83
+ .gt(balance);
84
+ }, [account.isActive, fromChainTokenBalances, route]);
108
85
  (0, react_1.useEffect)(() => {
109
86
  checkInsufficientGas();
110
87
  }, [checkInsufficientGas]);
@@ -6,12 +6,19 @@ const react_router_dom_1 = require("react-router-dom");
6
6
  const useNavigateBack = () => {
7
7
  const navigate = (0, react_router_dom_1.useNavigate)();
8
8
  const navigateBack = (0, react_1.useCallback)(() => {
9
- if (window.history.state && window.history.state.idx > 0) {
10
- navigate(-1);
11
- }
12
- else {
13
- navigate(window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) || '/', { replace: true });
14
- }
9
+ // https://github.com/remix-run/react-router/pull/9112
10
+ //
11
+ // if (window.history.length > 2) {
12
+ navigate(-1);
13
+ // } else {
14
+ // navigate(
15
+ // window.location.pathname.substring(
16
+ // 0,
17
+ // window.location.pathname.lastIndexOf('/'),
18
+ // ) || '/',
19
+ // { replace: true },
20
+ // );
21
+ // }
15
22
  }, [navigate]);
16
23
  return { navigateBack, navigate };
17
24
  };
@@ -8,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.useRouteExecution = void 0;
16
13
  const react_query_1 = require("@tanstack/react-query");
17
14
  const react_1 = require("react");
18
- const shallow_1 = __importDefault(require("zustand/shallow"));
15
+ const shallow_1 = require("zustand/shallow");
19
16
  const providers_1 = require("../providers");
20
17
  const stores_1 = require("../stores");
21
18
  const events_1 = require("../types/events");
@@ -26,10 +23,10 @@ const useRouteExecution = (routeId, executeInBackground) => {
26
23
  const { account, switchChain } = (0, providers_1.useWallet)();
27
24
  const resumedAfterMount = (0, react_1.useRef)(false);
28
25
  const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
29
- const routeExecution = (0, stores_1.useRouteStore)((state) => state.routes[routeId]);
30
- const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
26
+ const routeExecution = (0, stores_1.useRouteExecutionStore)((state) => state.routes[routeId]);
27
+ const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteExecutionStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
31
28
  const updateCallback = (updatedRoute) => {
32
- const routeExecution = stores_1.useRouteStore.getState().routes[updatedRoute.id];
29
+ const routeExecution = stores_1.useRouteExecutionStore.getState().routes[updatedRoute.id];
33
30
  if (!routeExecution) {
34
31
  return;
35
32
  }
@@ -150,7 +147,7 @@ const useRouteExecution = (routeId, executeInBackground) => {
150
147
  (0, react_1.useEffect)(() => {
151
148
  return () => {
152
149
  var _a;
153
- const route = (_a = stores_1.useRouteStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
150
+ const route = (_a = stores_1.useRouteExecutionStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
154
151
  if (!route || !(0, stores_1.isRouteActive)(route)) {
155
152
  return;
156
153
  }
@@ -8,14 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  step((generator = generator.apply(thisArg, _arguments || [])).next());
9
9
  });
10
10
  };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
11
  Object.defineProperty(exports, "__esModule", { value: true });
15
12
  exports.useSwapRoutes = void 0;
16
13
  const address_1 = require("@ethersproject/address");
17
14
  const react_query_1 = require("@tanstack/react-query");
18
- const big_js_1 = __importDefault(require("big.js"));
15
+ const big_js_1 = require("big.js");
19
16
  const react_hook_form_1 = require("react-hook-form");
20
17
  const _1 = require(".");
21
18
  const providers_1 = require("../providers");
@@ -4,11 +4,12 @@ exports.useTelemetry = void 0;
4
4
  /* eslint-disable consistent-return */
5
5
  const react_1 = require("react");
6
6
  const sentry_1 = require("../config/sentry");
7
+ const version_1 = require("../config/version");
7
8
  const useTelemetry = (disabled) => {
8
9
  (0, react_1.useEffect)(() => {
9
10
  if (disabled) {
10
- if (process.env.NODE_ENV === 'production') {
11
- console.warn('Enable crash reports and diagnostic data to be collected. This helps us to better understand how the widget is performing and where improvements need to be made.');
11
+ if (process.env.NODE_ENV === 'development') {
12
+ console.warn(`[${version_1.name}] Enable crash reports and diagnostic data to be collected. This helps us to better understand how the widget is performing and where improvements need to be made.`);
12
13
  }
13
14
  }
14
15
  else {
@@ -1,5 +1,5 @@
1
1
  import type { Token } from '../types';
2
- export declare const useTokenBalances: (selectedChainId: number) => {
2
+ export declare const useTokenBalances: (selectedChainId?: number) => {
3
3
  tokens: Token[] | undefined;
4
4
  tokensWithBalance: Token[] | undefined;
5
5
  featuredTokens: import("@lifi/types").Token[];
@@ -25,7 +25,9 @@ const useTokenBalances = (selectedChainId) => {
25
25
  const featuredTokens = (0, useFeaturedTokens_1.useFeaturedTokens)(selectedChainId);
26
26
  const { tokens, isLoading } = (0, useTokens_1.useTokens)(selectedChainId);
27
27
  const [refetchInterval, setRefetchInterval] = (0, react_1.useState)(defaultRefetchInterval);
28
- const isBalanceLoadingEnabled = Boolean(account.address) && Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length);
28
+ const isBalanceLoadingEnabled = Boolean(account.address) &&
29
+ Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length) &&
30
+ Boolean(selectedChainId);
29
31
  const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = (0, react_query_1.useQuery)(['token-balances', account.address, selectedChainId, tokens === null || tokens === void 0 ? void 0 : tokens.length], ({ queryKey: [, accountAddress] }) => __awaiter(void 0, void 0, void 0, function* () {
30
32
  if (!accountAddress || !tokens) {
31
33
  return;