@lifi/widget 1.15.1 → 1.17.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 (346) hide show
  1. package/App.js +21 -0
  2. package/AppProvider.d.ts +0 -4
  3. package/AppProvider.js +2 -10
  4. package/README.md +1 -1
  5. package/cjs/App.js +21 -0
  6. package/cjs/AppProvider.d.ts +0 -4
  7. package/cjs/AppProvider.js +3 -12
  8. package/cjs/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
  9. package/cjs/components/ActiveSwaps/ActiveSwapItem.js +45 -0
  10. package/cjs/components/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
  11. package/cjs/components/ActiveSwaps/ActiveSwaps.js +30 -0
  12. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
  13. package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +40 -0
  14. package/cjs/components/ActiveSwaps/index.d.ts +2 -0
  15. package/cjs/components/ActiveSwaps/index.js +18 -0
  16. package/cjs/components/AppContainer.js +2 -2
  17. package/cjs/components/Card/Card.d.ts +7 -4
  18. package/cjs/components/Card/Card.js +38 -28
  19. package/cjs/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +0 -0
  20. package/cjs/components/ChainSelect/ChainSelect.js +35 -0
  21. package/cjs/components/{SwapsInProgress/SwapsInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
  22. package/cjs/components/ChainSelect/ChainSelect.style.js +19 -0
  23. package/cjs/components/ChainSelect/index.d.ts +2 -0
  24. package/cjs/components/ChainSelect/index.js +18 -0
  25. package/cjs/components/ChainSelect/useChainSelect.d.ts +8 -0
  26. package/cjs/components/ChainSelect/useChainSelect.js +33 -0
  27. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +3 -3
  28. package/cjs/components/Header/Header.js +1 -9
  29. package/cjs/components/Header/NavigationHeader.js +6 -11
  30. package/cjs/components/Header/useHeaderActionStore.d.ts +0 -2
  31. package/cjs/components/Header/useHeaderActionStore.js +1 -5
  32. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  33. package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
  34. package/cjs/components/SelectChainAndToken.js +5 -5
  35. package/cjs/components/SendToWallet/SendToWallet.js +6 -6
  36. package/cjs/components/Step/CircularProgress.js +1 -1
  37. package/cjs/components/Step/CircularProgress.style.js +1 -1
  38. package/cjs/components/Step/StepProcess.js +1 -5
  39. package/cjs/components/Step/StepProcess.style.d.ts +1 -1
  40. package/cjs/components/Step/StepTimer.d.ts +1 -0
  41. package/cjs/components/Step/StepTimer.js +6 -6
  42. package/cjs/components/SwapButton/SwapButton.js +5 -32
  43. package/cjs/components/SwapButton/types.d.ts +2 -2
  44. package/cjs/components/SwapRouteCard/SwapRouteCard.js +1 -1
  45. package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
  46. package/cjs/components/TokenList/TokenList.js +7 -3
  47. package/cjs/components/TokenList/TokenList.style.js +4 -3
  48. package/cjs/components/TokenList/TokenListItem.js +1 -1
  49. package/cjs/components/TokenList/TokenNotFound.d.ts +2 -1
  50. package/cjs/components/TokenList/TokenNotFound.js +12 -2
  51. package/cjs/components/TokenList/types.d.ts +2 -2
  52. package/cjs/config/theme.js +24 -23
  53. package/cjs/config/version.d.ts +1 -1
  54. package/cjs/config/version.js +1 -1
  55. package/cjs/hooks/index.d.ts +2 -0
  56. package/cjs/hooks/index.js +2 -0
  57. package/cjs/hooks/useChains.d.ts +1 -97
  58. package/cjs/hooks/useChains.js +26 -20
  59. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  60. package/cjs/hooks/useFeaturedTokens.js +6 -3
  61. package/cjs/hooks/useGasSufficiency.d.ts +1 -1
  62. package/cjs/hooks/useGasSufficiency.js +36 -28
  63. package/cjs/hooks/useInitializer.js +6 -0
  64. package/cjs/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
  65. package/cjs/{components/Step/utils.js → hooks/useProcessMessage.js} +16 -10
  66. package/cjs/hooks/useRouteExecution.d.ts +1 -1
  67. package/cjs/hooks/useRouteExecution.js +26 -35
  68. package/cjs/hooks/useSwapRoutes.js +10 -11
  69. package/cjs/hooks/useToken.d.ts +0 -1
  70. package/cjs/hooks/useToken.js +1 -2
  71. package/cjs/hooks/useTokenBalances.d.ts +1 -2
  72. package/cjs/hooks/useTokenBalances.js +5 -6
  73. package/cjs/hooks/useTokenSearch.js +3 -2
  74. package/cjs/hooks/useTokens.d.ts +1 -2
  75. package/cjs/hooks/useTokens.js +32 -9
  76. package/cjs/hooks/useTools.js +11 -5
  77. package/cjs/hooks/useWidgetEvents.d.ts +3 -0
  78. package/cjs/hooks/useWidgetEvents.js +13 -0
  79. package/cjs/i18n/en/translation.json +14 -10
  80. package/cjs/i18n/index.d.ts +11 -7
  81. package/cjs/index.d.ts +1 -0
  82. package/cjs/index.js +3 -1
  83. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
  84. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +18 -0
  85. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
  86. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -0
  87. package/cjs/pages/ActiveSwapsPage/index.d.ts +1 -0
  88. package/cjs/{components/SwapsInProgress → pages/ActiveSwapsPage}/index.js +1 -1
  89. package/cjs/pages/MainPage/MainPage.js +2 -3
  90. package/cjs/pages/MainPage/MainSwapButton.js +3 -1
  91. package/cjs/pages/MainPage/SwapRoutes.js +4 -1
  92. package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
  93. package/cjs/pages/SelectChainPage/SelectChainPage.js +33 -0
  94. package/cjs/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
  95. package/cjs/pages/SelectChainPage/SelectChainPage.style.js +20 -0
  96. package/cjs/pages/SelectChainPage/index.d.ts +1 -0
  97. package/cjs/pages/SelectChainPage/index.js +17 -0
  98. package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
  99. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -2
  100. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +4 -4
  101. package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
  102. package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
  103. package/cjs/pages/SettingsPage/AdvancedPreferences.js +1 -1
  104. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  105. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +3 -6
  106. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +3 -5
  107. package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
  108. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +6 -2
  109. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +1 -1
  110. package/cjs/pages/SettingsPage/SlippageInput.js +1 -1
  111. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +3 -4
  112. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -3
  113. package/cjs/pages/SwapPage/StatusBottomSheet.js +25 -36
  114. package/cjs/pages/SwapPage/SwapPage.js +16 -3
  115. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +4 -3
  116. package/cjs/providers/SDKProvider/SDKProvider.d.ts +4 -0
  117. package/cjs/providers/SDKProvider/SDKProvider.js +27 -0
  118. package/cjs/providers/SDKProvider/index.d.ts +1 -0
  119. package/cjs/providers/SDKProvider/index.js +17 -0
  120. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +4 -30
  121. package/cjs/providers/SwapFormProvider/types.d.ts +5 -5
  122. package/cjs/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
  123. package/cjs/providers/TelemetryProvider/TelemetryProvider.js +11 -0
  124. package/cjs/providers/TelemetryProvider/index.d.ts +1 -0
  125. package/cjs/providers/TelemetryProvider/index.js +17 -0
  126. package/cjs/providers/WalletProvider/WalletProvider.d.ts +1 -4
  127. package/cjs/providers/WalletProvider/WalletProvider.js +59 -1
  128. package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -16
  129. package/cjs/providers/WidgetProvider/index.d.ts +1 -0
  130. package/cjs/providers/WidgetProvider/index.js +1 -0
  131. package/cjs/providers/WidgetProvider/utils.d.ts +4 -0
  132. package/cjs/providers/WidgetProvider/utils.js +13 -0
  133. package/cjs/providers/index.d.ts +2 -0
  134. package/cjs/providers/index.js +2 -0
  135. package/cjs/stores/chains/index.d.ts +3 -0
  136. package/cjs/stores/chains/index.js +19 -0
  137. package/cjs/stores/chains/types.d.ts +8 -0
  138. package/cjs/stores/chains/types.js +2 -0
  139. package/cjs/stores/chains/useChainOrder.d.ts +1 -0
  140. package/cjs/stores/chains/useChainOrder.js +12 -0
  141. package/cjs/stores/chains/useChainOrderStore.d.ts +19 -0
  142. package/cjs/stores/chains/useChainOrderStore.js +45 -0
  143. package/cjs/stores/route/index.d.ts +2 -1
  144. package/cjs/stores/route/index.js +2 -1
  145. package/cjs/stores/route/useExecutingRoutesIds.d.ts +1 -0
  146. package/cjs/stores/route/useExecutingRoutesIds.js +20 -0
  147. package/cjs/stores/route/useRouteStore.js +5 -4
  148. package/cjs/stores/route/utils.d.ts +4 -0
  149. package/cjs/stores/route/utils.js +21 -0
  150. package/cjs/stores/settings/index.d.ts +0 -1
  151. package/cjs/stores/settings/index.js +0 -1
  152. package/cjs/stores/settings/useAppearance.js +3 -1
  153. package/cjs/stores/settings/useSettingsStore.js +5 -2
  154. package/cjs/types/events.d.ts +5 -0
  155. package/cjs/types/events.js +9 -0
  156. package/cjs/types/index.d.ts +1 -0
  157. package/cjs/types/index.js +1 -0
  158. package/cjs/types/widget.d.ts +31 -23
  159. package/cjs/utils/colors.d.ts +1 -1
  160. package/cjs/utils/navigationRoutes.d.ts +5 -0
  161. package/cjs/utils/navigationRoutes.js +31 -4
  162. package/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
  163. package/components/ActiveSwaps/ActiveSwapItem.js +41 -0
  164. package/components/{SwapsInProgress/SwapsInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
  165. package/components/ActiveSwaps/ActiveSwaps.js +26 -0
  166. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
  167. package/components/ActiveSwaps/ActiveSwaps.style.js +37 -0
  168. package/components/ActiveSwaps/index.d.ts +2 -0
  169. package/components/ActiveSwaps/index.js +2 -0
  170. package/components/AppContainer.js +1 -1
  171. package/components/Card/Card.d.ts +7 -4
  172. package/components/Card/Card.js +39 -29
  173. package/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +0 -0
  174. package/components/ChainSelect/ChainSelect.js +31 -0
  175. package/components/{SwapsInProgress/SwapsInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
  176. package/components/ChainSelect/ChainSelect.style.js +16 -0
  177. package/components/ChainSelect/index.d.ts +2 -0
  178. package/components/ChainSelect/index.js +2 -0
  179. package/components/ChainSelect/useChainSelect.d.ts +8 -0
  180. package/components/ChainSelect/useChainSelect.js +29 -0
  181. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +3 -3
  182. package/components/Header/Header.js +1 -9
  183. package/components/Header/NavigationHeader.js +6 -11
  184. package/components/Header/useHeaderActionStore.d.ts +0 -2
  185. package/components/Header/useHeaderActionStore.js +0 -3
  186. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  187. package/components/PoweredBy/PoweredBy.style.js +1 -0
  188. package/components/SelectChainAndToken.js +1 -1
  189. package/components/SendToWallet/SendToWallet.js +6 -6
  190. package/components/Step/CircularProgress.js +3 -3
  191. package/components/Step/CircularProgress.style.js +1 -1
  192. package/components/Step/StepProcess.js +2 -6
  193. package/components/Step/StepProcess.style.d.ts +1 -1
  194. package/components/Step/StepTimer.d.ts +1 -0
  195. package/components/Step/StepTimer.js +6 -6
  196. package/components/SwapButton/SwapButton.js +7 -34
  197. package/components/SwapButton/types.d.ts +2 -2
  198. package/components/SwapRouteCard/SwapRouteCard.js +1 -1
  199. package/components/TokenAvatar/TokenAvatar.style.js +0 -3
  200. package/components/TokenList/TokenList.js +7 -3
  201. package/components/TokenList/TokenList.style.js +4 -3
  202. package/components/TokenList/TokenListItem.js +1 -1
  203. package/components/TokenList/TokenNotFound.d.ts +2 -1
  204. package/components/TokenList/TokenNotFound.js +12 -2
  205. package/components/TokenList/types.d.ts +2 -2
  206. package/config/theme.js +24 -23
  207. package/config/version.d.ts +1 -1
  208. package/config/version.js +1 -1
  209. package/hooks/index.d.ts +2 -0
  210. package/hooks/index.js +2 -0
  211. package/hooks/useChains.d.ts +1 -97
  212. package/hooks/useChains.js +26 -20
  213. package/hooks/useFeaturedTokens.d.ts +1 -1
  214. package/hooks/useFeaturedTokens.js +6 -3
  215. package/hooks/useGasSufficiency.d.ts +1 -1
  216. package/hooks/useGasSufficiency.js +32 -24
  217. package/hooks/useInitializer.js +6 -0
  218. package/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
  219. package/{pages/SwapPage/utils.js → hooks/useProcessMessage.js} +15 -10
  220. package/hooks/useRouteExecution.d.ts +1 -1
  221. package/hooks/useRouteExecution.js +26 -35
  222. package/hooks/useSwapRoutes.js +3 -4
  223. package/hooks/useToken.d.ts +0 -1
  224. package/hooks/useToken.js +1 -2
  225. package/hooks/useTokenBalances.d.ts +1 -2
  226. package/hooks/useTokenBalances.js +4 -5
  227. package/hooks/useTokenSearch.js +3 -2
  228. package/hooks/useTokens.d.ts +1 -2
  229. package/hooks/useTokens.js +32 -9
  230. package/hooks/useTools.js +11 -5
  231. package/hooks/useWidgetEvents.d.ts +3 -0
  232. package/hooks/useWidgetEvents.js +6 -0
  233. package/i18n/en/translation.json +14 -10
  234. package/i18n/index.d.ts +11 -7
  235. package/index.d.ts +1 -0
  236. package/index.js +1 -0
  237. package/package.json +15 -14
  238. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
  239. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +14 -0
  240. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
  241. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +17 -0
  242. package/pages/ActiveSwapsPage/index.d.ts +1 -0
  243. package/pages/ActiveSwapsPage/index.js +1 -0
  244. package/pages/MainPage/MainPage.js +2 -3
  245. package/pages/MainPage/MainSwapButton.js +3 -1
  246. package/pages/MainPage/SwapRoutes.js +4 -1
  247. package/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
  248. package/pages/SelectChainPage/SelectChainPage.js +29 -0
  249. package/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
  250. package/pages/SelectChainPage/SelectChainPage.style.js +17 -0
  251. package/pages/SelectChainPage/index.d.ts +1 -0
  252. package/pages/SelectChainPage/index.js +1 -0
  253. package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
  254. package/pages/SelectTokenPage/SelectTokenPage.js +2 -2
  255. package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
  256. package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
  257. package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
  258. package/pages/SettingsPage/AdvancedPreferences.js +2 -2
  259. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  260. package/pages/SettingsPage/EnabledBridgesSelect.js +4 -7
  261. package/pages/SettingsPage/EnabledExchangesSelect.js +4 -6
  262. package/pages/SettingsPage/GasPriceSelect.js +2 -2
  263. package/pages/SettingsPage/RoutePrioritySelect.js +7 -3
  264. package/pages/SettingsPage/ShowDestinationWallet.js +2 -2
  265. package/pages/SettingsPage/SlippageInput.js +2 -2
  266. package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -5
  267. package/pages/SwapHistoryPage/SwapHistoryPage.js +3 -4
  268. package/pages/SwapPage/StatusBottomSheet.js +27 -38
  269. package/pages/SwapPage/SwapPage.js +16 -3
  270. package/pages/SwapRoutesPage/SwapRoutesPage.js +5 -4
  271. package/providers/SDKProvider/SDKProvider.d.ts +4 -0
  272. package/providers/SDKProvider/SDKProvider.js +19 -0
  273. package/providers/SDKProvider/index.d.ts +1 -0
  274. package/providers/SDKProvider/index.js +1 -0
  275. package/providers/SwapFormProvider/SwapFormProvider.js +4 -30
  276. package/providers/SwapFormProvider/types.d.ts +5 -5
  277. package/providers/TelemetryProvider/TelemetryProvider.d.ts +4 -0
  278. package/providers/TelemetryProvider/TelemetryProvider.js +7 -0
  279. package/providers/TelemetryProvider/index.d.ts +1 -0
  280. package/providers/TelemetryProvider/index.js +1 -0
  281. package/providers/WalletProvider/WalletProvider.d.ts +1 -4
  282. package/providers/WalletProvider/WalletProvider.js +59 -1
  283. package/providers/WidgetProvider/WidgetProvider.js +3 -18
  284. package/providers/WidgetProvider/index.d.ts +1 -0
  285. package/providers/WidgetProvider/index.js +1 -0
  286. package/providers/WidgetProvider/utils.d.ts +4 -0
  287. package/providers/WidgetProvider/utils.js +9 -0
  288. package/providers/index.d.ts +2 -0
  289. package/providers/index.js +2 -0
  290. package/stores/chains/index.d.ts +3 -0
  291. package/stores/chains/index.js +3 -0
  292. package/stores/chains/types.d.ts +8 -0
  293. package/stores/chains/types.js +1 -0
  294. package/stores/chains/useChainOrder.d.ts +1 -0
  295. package/stores/chains/useChainOrder.js +5 -0
  296. package/stores/chains/useChainOrderStore.d.ts +19 -0
  297. package/stores/chains/useChainOrderStore.js +39 -0
  298. package/stores/route/index.d.ts +2 -1
  299. package/stores/route/index.js +2 -1
  300. package/stores/route/useExecutingRoutesIds.d.ts +1 -0
  301. package/stores/route/useExecutingRoutesIds.js +13 -0
  302. package/stores/route/useRouteStore.js +5 -4
  303. package/stores/route/utils.d.ts +4 -0
  304. package/stores/route/utils.js +15 -0
  305. package/stores/settings/index.d.ts +0 -1
  306. package/stores/settings/index.js +0 -1
  307. package/stores/settings/useAppearance.js +3 -1
  308. package/stores/settings/useSettingsStore.js +5 -2
  309. package/tsconfig.cjs.tsbuildinfo +1 -1
  310. package/types/events.d.ts +5 -0
  311. package/types/events.js +6 -0
  312. package/types/index.d.ts +1 -0
  313. package/types/index.js +1 -0
  314. package/types/widget.d.ts +31 -23
  315. package/utils/colors.d.ts +1 -1
  316. package/utils/navigationRoutes.d.ts +5 -0
  317. package/utils/navigationRoutes.js +30 -3
  318. package/cjs/components/SwapButton/SwapButton.style.d.ts +0 -65
  319. package/cjs/components/SwapButton/SwapButton.style.js +0 -15
  320. package/cjs/components/SwapsInProgress/SwapsInProgress.js +0 -29
  321. package/cjs/components/SwapsInProgress/SwapsInProgress.style.js +0 -17
  322. package/cjs/components/SwapsInProgress/index.d.ts +0 -1
  323. package/cjs/config/lifi.d.ts +0 -4
  324. package/cjs/config/lifi.js +0 -14
  325. package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -31
  326. package/cjs/pages/SwapPage/utils.d.ts +0 -6
  327. package/cjs/pages/SwapPage/utils.js +0 -93
  328. package/cjs/stores/route/useExecutingRoutes.d.ts +0 -2
  329. package/cjs/stores/route/useExecutingRoutes.js +0 -13
  330. package/cjs/stores/settings/useSetSettings.d.ts +0 -5
  331. package/cjs/stores/settings/useSetSettings.js +0 -12
  332. package/components/Step/utils.js +0 -89
  333. package/components/SwapButton/SwapButton.style.d.ts +0 -65
  334. package/components/SwapButton/SwapButton.style.js +0 -12
  335. package/components/SwapsInProgress/SwapsInProgress.js +0 -25
  336. package/components/SwapsInProgress/SwapsInProgress.style.js +0 -14
  337. package/components/SwapsInProgress/index.d.ts +0 -1
  338. package/components/SwapsInProgress/index.js +0 -1
  339. package/config/lifi.d.ts +0 -4
  340. package/config/lifi.js +0 -7
  341. package/pages/SelectTokenPage/ChainSelect.js +0 -27
  342. package/pages/SwapPage/utils.d.ts +0 -6
  343. package/stores/route/useExecutingRoutes.d.ts +0 -2
  344. package/stores/route/useExecutingRoutes.js +0 -6
  345. package/stores/settings/useSetSettings.d.ts +0 -5
  346. package/stores/settings/useSetSettings.js +0 -5
@@ -10,19 +10,28 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  import { useMutation } from '@tanstack/react-query';
11
11
  import { useCallback, useEffect, useRef } from 'react';
12
12
  import shallow from 'zustand/shallow';
13
- import { LiFi } from '../config/lifi';
14
- import { useWallet } from '../providers/WalletProvider';
15
- import { useRouteStore } from '../stores';
13
+ import { useLiFi, useWallet } from '../providers';
14
+ import { isRouteActive, isRouteCompleted, isRouteFailed, useRouteStore, } from '../stores';
15
+ import { WidgetEvent } from '../types/events';
16
16
  import { deepClone } from '../utils';
17
- export const useRouteExecution = (routeId) => {
17
+ import { useWidgetEvents } from './useWidgetEvents';
18
+ export const useRouteExecution = (routeId, executeInBackground) => {
19
+ const lifi = useLiFi();
18
20
  const { account, switchChain } = useWallet();
19
21
  const resumedAfterMount = useRef(false);
22
+ const emitter = useWidgetEvents();
20
23
  const routeExecution = useRouteStore((state) => state.routes[routeId]);
21
24
  const [updateRoute, restartRoute, deleteRoute] = useRouteStore((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow);
22
25
  const updateCallback = (updatedRoute) => {
23
26
  const clonedUpdatedRoute = deepClone(updatedRoute);
24
27
  console.log('Route updated.', clonedUpdatedRoute);
25
28
  updateRoute(clonedUpdatedRoute);
29
+ if (isRouteCompleted(clonedUpdatedRoute)) {
30
+ emitter.emit(WidgetEvent.SwapCompleted);
31
+ }
32
+ if (isRouteFailed(clonedUpdatedRoute)) {
33
+ emitter.emit(WidgetEvent.SwapFailed);
34
+ }
26
35
  };
27
36
  const switchChainHook = (requiredChainId) => __awaiter(void 0, void 0, void 0, function* () {
28
37
  if (!account.isActive || !account.signer) {
@@ -44,20 +53,16 @@ export const useRouteExecution = (routeId) => {
44
53
  if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
45
54
  throw Error('Execution route not found.');
46
55
  }
47
- return LiFi.executeRoute(account.signer, routeExecution.route, {
56
+ return lifi.executeRoute(account.signer, routeExecution.route, {
48
57
  updateCallback,
49
58
  switchChainHook,
50
59
  infiniteApproval: false,
60
+ executeInBackground,
51
61
  });
52
62
  }, {
53
63
  onMutate: () => {
54
64
  console.log('Execution started.', routeId);
55
- },
56
- onError: () => {
57
- console.warn('Execution failed.', routeId);
58
- },
59
- onSuccess: (route) => {
60
- console.log('Executed successfully.', routeId);
65
+ emitter.emit(WidgetEvent.SwapStarted);
61
66
  },
62
67
  });
63
68
  const resumeRouteMutation = useMutation((resumedRoute) => {
@@ -67,30 +72,25 @@ export const useRouteExecution = (routeId) => {
67
72
  if (!(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route)) {
68
73
  throw Error('Execution route not found.');
69
74
  }
70
- return LiFi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : routeExecution.route, {
75
+ return lifi.resumeRoute(account.signer, resumedRoute !== null && resumedRoute !== void 0 ? resumedRoute : routeExecution.route, {
71
76
  updateCallback,
72
77
  switchChainHook,
73
78
  infiniteApproval: false,
79
+ executeInBackground,
74
80
  });
75
81
  }, {
76
82
  onMutate: () => {
77
83
  console.log('Resumed to execution.', routeId);
78
84
  },
79
- onError: () => {
80
- console.warn('Resumed execution failed.', routeId);
81
- },
82
- onSuccess: (route) => {
83
- console.log('Resumed execution successful.', route);
84
- },
85
85
  });
86
86
  const executeRoute = useCallback(() => {
87
87
  executeRouteMutation.mutateAsync(undefined, {
88
88
  onError: () => {
89
- console.warn('Real execution failed!', routeId);
89
+ console.warn('Execution failed!', routeId);
90
90
  // Notification.showNotification(NotificationType.SwapExecution_ERROR);
91
91
  },
92
92
  onSuccess: (route) => {
93
- console.log('Real execution successfully!', route);
93
+ console.log('Executed successfully!', route);
94
94
  // Notification.showNotification(NotificationType.TRANSACTION_SUCCESSFULL);
95
95
  },
96
96
  });
@@ -98,10 +98,10 @@ export const useRouteExecution = (routeId) => {
98
98
  const resumeRoute = useCallback((route) => {
99
99
  resumeRouteMutation.mutateAsync(route, {
100
100
  onError: () => {
101
- console.warn('Real resumed execution failed.', routeId);
101
+ console.warn('Resumed execution failed.', routeId);
102
102
  },
103
103
  onSuccess: (route) => {
104
- console.log('Real resumed execution successful.', route);
104
+ console.log('Resumed execution successful.', route);
105
105
  },
106
106
  });
107
107
  }, [resumeRouteMutation, routeId]);
@@ -117,7 +117,7 @@ export const useRouteExecution = (routeId) => {
117
117
  // Resume route execution after page reload
118
118
  useEffect(() => {
119
119
  // Check if route is eligible for automatic resuming
120
- if (isActiveRoute(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route) &&
120
+ if (isRouteActive(routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route) &&
121
121
  account.isActive &&
122
122
  !resumedAfterMount.current) {
123
123
  resumedAfterMount.current = true;
@@ -129,14 +129,14 @@ export const useRouteExecution = (routeId) => {
129
129
  return () => {
130
130
  var _a;
131
131
  const route = (_a = useRouteStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
132
- if (!route || !isActiveRoute(route)) {
132
+ if (!route || !isRouteActive(route)) {
133
133
  return;
134
134
  }
135
- LiFi.moveExecutionToBackground(route);
135
+ lifi.updateRouteExecution(route, { executeInBackground: true });
136
136
  console.log('Move route execution to background.', routeId);
137
137
  resumedAfterMount.current = false;
138
138
  };
139
- }, [routeId]);
139
+ }, [lifi, routeId]);
140
140
  return {
141
141
  executeRoute,
142
142
  restartRoute: restartRouteMutation,
@@ -145,12 +145,3 @@ export const useRouteExecution = (routeId) => {
145
145
  status: routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.status,
146
146
  };
147
147
  };
148
- const isActiveRoute = (route) => {
149
- if (!route) {
150
- return false;
151
- }
152
- const allDone = route.steps.every((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE'; });
153
- const isFailed = route.steps.some((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
154
- const alreadyStarted = route.steps.some((step) => step.execution);
155
- return !allDone && !isFailed && alreadyStarted;
156
- };
@@ -12,13 +12,12 @@ import { useQuery, useQueryClient } from '@tanstack/react-query';
12
12
  import Big from 'big.js';
13
13
  import { useWatch } from 'react-hook-form';
14
14
  import { useDebouncedWatch, useToken } from '.';
15
- import { LiFi } from '../config/lifi';
16
- import { SwapFormKey } from '../providers/SwapFormProvider';
17
- import { useWallet } from '../providers/WalletProvider';
15
+ import { SwapFormKey, useLiFi, useWallet } from '../providers';
18
16
  import { useSettings } from '../stores';
19
17
  const refetchTime = 60000;
20
18
  export const useSwapRoutes = () => {
21
19
  var _a;
20
+ const lifi = useLiFi();
22
21
  const { account, provider } = useWallet();
23
22
  const queryClient = useQueryClient();
24
23
  const { slippage, enabledBridges, enabledExchanges, routePriority } = useSettings([
@@ -75,7 +74,7 @@ export const useSwapRoutes = () => {
75
74
  catch (_d) {
76
75
  toWalletAddress = isAddress(toAddress) ? toAddress : fromAddress;
77
76
  }
78
- return LiFi.getRoutes({
77
+ return lifi.getRoutes({
79
78
  fromChainId,
80
79
  fromAmount: Big(Number(fromTokenAmount) * Math.pow(10, ((_c = token === null || token === void 0 ? void 0 : token.decimals) !== null && _c !== void 0 ? _c : 0))).toString(),
81
80
  fromTokenAddress,
@@ -1,5 +1,4 @@
1
1
  export declare const useToken: (chainId: number, tokenAddress: string) => {
2
2
  token: import("..").Token | undefined;
3
3
  isLoading: boolean;
4
- isFetching: boolean;
5
4
  };
package/hooks/useToken.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { useMemo } from 'react';
2
2
  import { useTokens } from './useTokens';
3
3
  export const useToken = (chainId, tokenAddress) => {
4
- const { tokens, isLoading, isFetching } = useTokens(chainId);
4
+ const { tokens, isLoading } = useTokens(chainId);
5
5
  const token = useMemo(() => {
6
6
  const token = tokens === null || tokens === void 0 ? void 0 : tokens.find((token) => token.address === tokenAddress && token.chainId === chainId);
7
7
  return token;
@@ -9,6 +9,5 @@ export const useToken = (chainId, tokenAddress) => {
9
9
  return {
10
10
  token,
11
11
  isLoading,
12
- isFetching,
13
12
  };
14
13
  };
@@ -2,9 +2,8 @@ import type { Token } from '../types';
2
2
  export declare const useTokenBalances: (selectedChainId: number) => {
3
3
  tokens: Token[] | undefined;
4
4
  tokensWithBalance: Token[] | undefined;
5
- featuredTokens: import("@lifi/types").Token[] | undefined;
5
+ featuredTokens: import("@lifi/types").Token[];
6
6
  isLoading: boolean;
7
7
  isBalanceLoading: boolean;
8
- isBalanceFetched: boolean;
9
8
  refetch: <TPageData>(options?: (import("@tanstack/react-query").RefetchOptions & import("@tanstack/react-query").RefetchQueryFilters<TPageData>) | undefined) => Promise<import("@tanstack/react-query").QueryObserverResult<Token[] | undefined, unknown>>;
10
9
  };
@@ -10,24 +10,24 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  /* eslint-disable consistent-return */
11
11
  import { useQuery } from '@tanstack/react-query';
12
12
  import { useState } from 'react';
13
- import { LiFi } from '../config/lifi';
14
- import { useWallet } from '../providers/WalletProvider';
13
+ import { useLiFi, useWallet } from '../providers';
15
14
  import { formatTokenAmount } from '../utils';
16
15
  import { useFeaturedTokens } from './useFeaturedTokens';
17
16
  import { useTokens } from './useTokens';
18
17
  const defaultRefetchInterval = 60000;
19
18
  const minRefetchInterval = 1000;
20
19
  export const useTokenBalances = (selectedChainId) => {
20
+ const lifi = useLiFi();
21
21
  const { account } = useWallet();
22
22
  const featuredTokens = useFeaturedTokens(selectedChainId);
23
23
  const { tokens, isLoading } = useTokens(selectedChainId);
24
24
  const [refetchInterval, setRefetchInterval] = useState(defaultRefetchInterval);
25
25
  const isBalanceLoadingEnabled = Boolean(account.address) && Boolean(tokens === null || tokens === void 0 ? void 0 : tokens.length);
26
- const { data: tokensWithBalance, isLoading: isBalanceLoading, isFetched: isBalanceFetched, refetch, } = 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* () {
26
+ const { data: tokensWithBalance, isLoading: isBalanceLoading, refetch, } = 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* () {
27
27
  if (!accountAddress || !tokens) {
28
28
  return;
29
29
  }
30
- const tokenBalances = yield LiFi.getTokenBalances(accountAddress, tokens);
30
+ const tokenBalances = yield lifi.getTokenBalances(accountAddress, tokens);
31
31
  if (!(tokenBalances === null || tokenBalances === void 0 ? void 0 : tokenBalances.length)) {
32
32
  // Sometimes RPCs (e.g. Arbitrum) don't return balances on first call
33
33
  // TODO: fix and remove backplane
@@ -70,7 +70,6 @@ export const useTokenBalances = (selectedChainId) => {
70
70
  featuredTokens,
71
71
  isLoading,
72
72
  isBalanceLoading: isBalanceLoading && isBalanceLoadingEnabled,
73
- isBalanceFetched,
74
73
  refetch,
75
74
  };
76
75
  };
@@ -8,11 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { useQuery, useQueryClient } from '@tanstack/react-query';
11
- import { LiFi } from '../config/lifi';
11
+ import { useLiFi } from '../providers';
12
12
  export const useTokenSearch = (token, chainId, enabled) => {
13
+ const lifi = useLiFi();
13
14
  const queryClient = useQueryClient();
14
15
  const { data, isLoading, isFetching, isFetched } = useQuery(['token-search', chainId, token], ({ queryKey: [, chainId, token], signal }) => __awaiter(void 0, void 0, void 0, function* () {
15
- const data = yield LiFi.getToken(chainId, token, {
16
+ const data = yield lifi.getToken(chainId, token, {
16
17
  signal,
17
18
  });
18
19
  if (data) {
@@ -1,6 +1,5 @@
1
1
  import type { Token } from '../types';
2
- export declare const useTokens: (selectedChainId: number) => {
2
+ export declare const useTokens: (selectedChainId?: number) => {
3
3
  tokens: Token[] | undefined;
4
4
  isLoading: boolean;
5
- isFetching: boolean;
6
5
  };
@@ -8,25 +8,48 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { useQuery } from '@tanstack/react-query';
11
- import { LiFi } from '../config/lifi';
11
+ import { isItemAllowed, useLiFi, useWidgetConfig } from '../providers';
12
12
  import { useFeaturedTokens } from './useFeaturedTokens';
13
13
  export const useTokens = (selectedChainId) => {
14
+ var _a, _b, _c, _d;
15
+ const lifi = useLiFi();
14
16
  const featuredTokens = useFeaturedTokens(selectedChainId);
15
- const { data: tokens, isLoading, isFetching, } = useQuery(['tokens', selectedChainId, featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length], () => __awaiter(void 0, void 0, void 0, function* () {
16
- var _a, _b, _c;
17
- const data = yield LiFi.getTokens({ chains: [selectedChainId] });
17
+ const { tokens, chains, disabledChains } = useWidgetConfig();
18
+ const { data, isLoading } = useQuery([
19
+ 'tokens',
20
+ selectedChainId,
21
+ featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.length,
22
+ (_a = tokens === null || tokens === void 0 ? void 0 : tokens.allow) === null || _a === void 0 ? void 0 : _a.length,
23
+ (_b = tokens === null || tokens === void 0 ? void 0 : tokens.deny) === null || _b === void 0 ? void 0 : _b.length,
24
+ (_c = chains === null || chains === void 0 ? void 0 : chains.allow) === null || _c === void 0 ? void 0 : _c.length,
25
+ (_d = chains === null || chains === void 0 ? void 0 : chains.deny) === null || _d === void 0 ? void 0 : _d.length,
26
+ ], () => __awaiter(void 0, void 0, void 0, function* () {
27
+ var _e, _f, _g, _h, _j;
28
+ const chainAllowed = selectedChainId &&
29
+ isItemAllowed(selectedChainId, chains, disabledChains);
30
+ if (!chainAllowed) {
31
+ return [];
32
+ }
33
+ let filteredTokens = (_e = tokens === null || tokens === void 0 ? void 0 : tokens.allow) === null || _e === void 0 ? void 0 : _e.filter((token) => token.chainId === selectedChainId);
34
+ if (!(filteredTokens === null || filteredTokens === void 0 ? void 0 : filteredTokens.length)) {
35
+ const data = yield lifi.getTokens({ chains: [selectedChainId] });
36
+ filteredTokens = (_f = data.tokens) === null || _f === void 0 ? void 0 : _f[selectedChainId];
37
+ }
38
+ const deniedTokenAddresses = (_g = tokens === null || tokens === void 0 ? void 0 : tokens.deny) === null || _g === void 0 ? void 0 : _g.filter((token) => token.chainId === selectedChainId).map((token) => token.address);
39
+ if (deniedTokenAddresses === null || deniedTokenAddresses === void 0 ? void 0 : deniedTokenAddresses.length) {
40
+ filteredTokens = filteredTokens === null || filteredTokens === void 0 ? void 0 : filteredTokens.filter((token) => !deniedTokenAddresses.includes(token.address));
41
+ }
18
42
  const featuredTokenAddresses = new Set(featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => token.address));
19
43
  return [
20
- ...((_a = featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => {
44
+ ...((_h = featuredTokens === null || featuredTokens === void 0 ? void 0 : featuredTokens.map((token) => {
21
45
  token.featured = true;
22
46
  return token;
23
- })) !== null && _a !== void 0 ? _a : []),
24
- ...((_c = (_b = data.tokens) === null || _b === void 0 ? void 0 : _b[selectedChainId].filter((token) => !featuredTokenAddresses.has(token.address))) !== null && _c !== void 0 ? _c : []),
47
+ })) !== null && _h !== void 0 ? _h : []),
48
+ ...((_j = filteredTokens === null || filteredTokens === void 0 ? void 0 : filteredTokens.filter((token) => !featuredTokenAddresses.has(token.address))) !== null && _j !== void 0 ? _j : []),
25
49
  ];
26
50
  }));
27
51
  return {
28
- tokens,
52
+ tokens: data,
29
53
  isLoading,
30
- isFetching,
31
54
  };
32
55
  };
package/hooks/useTools.js CHANGED
@@ -1,13 +1,19 @@
1
1
  import { useQuery } from '@tanstack/react-query';
2
2
  import { useMemo } from 'react';
3
- import { LiFi } from '../config/lifi';
3
+ import { isItemAllowed, useLiFi, useWidgetConfig } from '../providers';
4
4
  import { useSettingsStore } from '../stores';
5
5
  export const useTools = () => {
6
- const initializeTools = useSettingsStore((state) => state.initializeTools);
7
- const { data } = useQuery(['tools'], ({ signal }) => LiFi.getTools(undefined, { signal }), {
6
+ const lifi = useLiFi();
7
+ const { bridges, exchanges } = useWidgetConfig();
8
+ const { data } = useQuery(['tools'], ({ signal }) => lifi.getTools(undefined, { signal }), {
8
9
  onSuccess(data) {
9
- initializeTools('Bridges', data.bridges.map((bridge) => bridge.key));
10
- initializeTools('Exchanges', data.exchanges.map((exchange) => exchange.key));
10
+ const { initializeTools } = useSettingsStore.getState();
11
+ initializeTools('Bridges', data.bridges
12
+ .filter((bridge) => isItemAllowed(bridge.key, bridges))
13
+ .map((bridge) => bridge.key));
14
+ initializeTools('Exchanges', data.exchanges
15
+ .filter((exchange) => isItemAllowed(exchange.key, exchanges))
16
+ .map((exchange) => exchange.key));
11
17
  },
12
18
  });
13
19
  const formattedTools = useMemo(() => ({
@@ -0,0 +1,3 @@
1
+ /// <reference types="node" />
2
+ import { EventEmitter } from 'events';
3
+ export declare const useWidgetEvents: () => EventEmitter;
@@ -0,0 +1,6 @@
1
+ import { EventEmitter } from 'events';
2
+ import create from 'zustand';
3
+ const emitterStore = create()(() => new EventEmitter());
4
+ export const useWidgetEvents = () => {
5
+ return emitterStore();
6
+ };
@@ -6,14 +6,15 @@
6
6
  "swap": "Swap",
7
7
  "from": "Swap from",
8
8
  "to": "Swap to",
9
+ "selectChain": "Select chain",
9
10
  "settings": "Settings",
10
11
  "routes": "You get",
11
12
  "swapHistory": "Swap history",
12
- "swapDetails": "Swap details"
13
+ "swapDetails": "Swap details",
14
+ "activeSwaps": "Active swaps"
13
15
  },
14
16
  "button": {
15
17
  "connectWallet": "Connect wallet",
16
- "switchChain": "Switch chain",
17
18
  "swap": "Swap",
18
19
  "reviewSwap": "Review swap",
19
20
  "startSwap": "Start swap",
@@ -31,6 +32,7 @@
31
32
  "delete": "Delete",
32
33
  "hide": "Hide",
33
34
  "max": "max",
35
+ "showAll": "Show all",
34
36
  "contactSupport": "Contact support",
35
37
  "lifiSwap": "LI.FI Swap"
36
38
  },
@@ -53,8 +55,6 @@
53
55
  "featuredTokens": "Featured tokens",
54
56
  "otherTokens": "Other tokens",
55
57
  "inProgress": "in progress",
56
- "activeTransfers": "Active transfers",
57
- "couldntFindTokens": "We couldn't find tokens on this chain or you don't have any.",
58
58
  "stepSwap": "Swap",
59
59
  "stepBridge": "Bridge",
60
60
  "stepSwapAndBridge": "Swap and bridge",
@@ -63,7 +63,7 @@
63
63
  "swapStepDetails": "Swap on {{chain}} via {{tool}}",
64
64
  "tokenOnChain": "{{tokenSymbol}} on {{chainName}}",
65
65
  "tokenOnChainAmount": "{{amount}} {{tokenSymbol}} on {{chainName}}",
66
- "routeId": "Route ID",
66
+ "supportId": "Support ID",
67
67
  "sendToWallet": "Send to a different wallet",
68
68
  "walletAddressOrEns": "Wallet address or ENS name",
69
69
  "tags": {
@@ -84,11 +84,14 @@
84
84
  "info": {
85
85
  "title": {
86
86
  "routeNotFound": "No routes available",
87
- "emptySwapHistory": "No recent swaps"
87
+ "emptySwapHistory": "No recent swaps",
88
+ "emptyActiveSwaps": "No active swaps"
88
89
  },
89
90
  "message": {
90
91
  "routeNotFound": "Try another token combination.",
91
- "emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data."
92
+ "emptySwapHistory": "Swap history is only stored locally and will be deleted if you clear your browser data.",
93
+ "emptyActiveSwaps": "Swaps in progress will appear here. Once completed, find them in swap history.",
94
+ "emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please try search again or choose another chain."
92
95
  }
93
96
  },
94
97
  "warning": {
@@ -105,18 +108,19 @@
105
108
  },
106
109
  "error": {
107
110
  "title": {
111
+ "failed": "Swap failed.",
108
112
  "chainSwitch": "Chain switch required.",
109
113
  "transactionFailed": "Transaction has failed.",
110
114
  "transactionUnderpriced": "Transaction is underpriced.",
111
115
  "transactionUnprepared": "Unable to prepare transaction.",
116
+ "transactionRejected": "Signature required.",
112
117
  "unknown": "Something went wrong.",
113
- "userRejectedSignatureRequest": "Signature required.",
114
118
  "slippageTooLarge": "Slippage too large.",
115
119
  "walletAddressInvalid": "Wallet address is invalid.",
116
120
  "walletEnsAddressInvalid": "Wallet address is invalid or network doesn't support ENS."
117
121
  },
118
122
  "message": {
119
- "signatureRequired": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
123
+ "transactionRejected": "Your signature is required to complete the transaction. {{amount}} {{tokenSymbol}} on {{chainName}} remain in your wallet.",
120
124
  "transactionFailed": "Please check the block explorer for more information.",
121
125
  "transactionNotSent": "Transaction was not sent, your funds are still in your wallet ({{amount}} {{tokenSymbol}} on {{chainName}}).",
122
126
  "slippageTooLarge": "The slippage is larger than the defined threshold. Please request a new route to get a fresh quote."
@@ -129,7 +133,7 @@
129
133
  "done": "Token allowance approved."
130
134
  },
131
135
  "switchChain": {
132
- "pending": "Chain switch required.",
136
+ "actionRequired": "Chain switch required.",
133
137
  "done": "Chain switched successfully."
134
138
  },
135
139
  "swap": {
package/i18n/index.d.ts CHANGED
@@ -9,14 +9,15 @@ export declare const resources: {
9
9
  swap: string;
10
10
  from: string;
11
11
  to: string;
12
+ selectChain: string;
12
13
  settings: string;
13
14
  routes: string;
14
15
  swapHistory: string;
15
16
  swapDetails: string;
17
+ activeSwaps: string;
16
18
  };
17
19
  button: {
18
20
  connectWallet: string;
19
- switchChain: string;
20
21
  swap: string;
21
22
  reviewSwap: string;
22
23
  startSwap: string;
@@ -34,6 +35,7 @@ export declare const resources: {
34
35
  delete: string;
35
36
  hide: string;
36
37
  max: string;
38
+ showAll: string;
37
39
  contactSupport: string;
38
40
  lifiSwap: string;
39
41
  };
@@ -56,8 +58,6 @@ export declare const resources: {
56
58
  featuredTokens: string;
57
59
  otherTokens: string;
58
60
  inProgress: string;
59
- activeTransfers: string;
60
- couldntFindTokens: string;
61
61
  stepSwap: string;
62
62
  stepBridge: string;
63
63
  stepSwapAndBridge: string;
@@ -66,7 +66,7 @@ export declare const resources: {
66
66
  swapStepDetails: string;
67
67
  tokenOnChain: string;
68
68
  tokenOnChainAmount: string;
69
- routeId: string;
69
+ supportId: string;
70
70
  sendToWallet: string;
71
71
  walletAddressOrEns: string;
72
72
  tags: {
@@ -88,10 +88,13 @@ export declare const resources: {
88
88
  title: {
89
89
  routeNotFound: string;
90
90
  emptySwapHistory: string;
91
+ emptyActiveSwaps: string;
91
92
  };
92
93
  message: {
93
94
  routeNotFound: string;
94
95
  emptySwapHistory: string;
96
+ emptyActiveSwaps: string;
97
+ emptyTokenList: string;
95
98
  };
96
99
  };
97
100
  warning: {
@@ -108,18 +111,19 @@ export declare const resources: {
108
111
  };
109
112
  error: {
110
113
  title: {
114
+ failed: string;
111
115
  chainSwitch: string;
112
116
  transactionFailed: string;
113
117
  transactionUnderpriced: string;
114
118
  transactionUnprepared: string;
119
+ transactionRejected: string;
115
120
  unknown: string;
116
- userRejectedSignatureRequest: string;
117
121
  slippageTooLarge: string;
118
122
  walletAddressInvalid: string;
119
123
  walletEnsAddressInvalid: string;
120
124
  };
121
125
  message: {
122
- signatureRequired: string;
126
+ transactionRejected: string;
123
127
  transactionFailed: string;
124
128
  transactionNotSent: string;
125
129
  slippageTooLarge: string;
@@ -132,7 +136,7 @@ export declare const resources: {
132
136
  done: string;
133
137
  };
134
138
  switchChain: {
135
- pending: string;
139
+ actionRequired: string;
136
140
  done: string;
137
141
  };
138
142
  swap: {
package/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import './fonts/inter.css';
3
+ export { useWidgetEvents } from './hooks';
3
4
  export * from './types';
4
5
  export declare const LiFiWidget: import("react").FC<import("./AppProvider").AppProps>;
5
6
  export declare const LiFiWidgetDrawer: import("react").ForwardRefExoticComponent<Pick<import("./AppDrawer").AppDrawerProps, "className" | "style" | "classes" | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "key" | "transitionDuration" | "variant" | "open" | "anchor" | "elementRef" | "components" | "componentsProps" | "BackdropComponent" | "BackdropProps" | "closeAfterTransition" | "container" | "disableAutoFocus" | "disableEnforceFocus" | "disableEscapeKeyDown" | "disablePortal" | "disableRestoreFocus" | "disableScrollLock" | "hideBackdrop" | "keepMounted" | "onBackdropClick" | "onClose" | "config" | "elevation" | "ModalProps" | "PaperProps" | "SlideProps"> & import("react").RefAttributes<import("./AppDrawer").AppDrawerBase>>;
package/index.js CHANGED
@@ -2,6 +2,7 @@ import { App } from './App';
2
2
  import { AppDrawer } from './AppDrawer';
3
3
  import './fonts/inter.css';
4
4
  import { configureReactI18next } from './i18n';
5
+ export { useWidgetEvents } from './hooks';
5
6
  export * from './types';
6
7
  configureReactI18next();
7
8
  // ClassNameGenerator.configure((componentName) =>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.15.1",
3
+ "version": "1.17.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
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -37,28 +37,29 @@
37
37
  "lifi"
38
38
  ],
39
39
  "dependencies": {
40
- "@emotion/react": "^11.10.0",
41
- "@emotion/styled": "^11.10.0",
40
+ "@emotion/react": "^11.10.4",
41
+ "@emotion/styled": "^11.10.4",
42
42
  "@ethersproject/address": "^5.7.0",
43
43
  "@ethersproject/experimental": "^5.7.0",
44
44
  "@ethersproject/providers": "^5.7.0",
45
- "@lifi/sdk": "^1.2.2",
46
- "@lifi/wallet-management": "^1.1.8",
47
- "@mui/icons-material": "^5.10.2",
48
- "@mui/lab": "^5.0.0-alpha.96",
49
- "@mui/material": "^5.10.2",
50
- "@sentry/integrations": "^7.11.1",
51
- "@sentry/react": "^7.11.1",
52
- "@sentry/tracing": "^7.11.1",
53
- "@tanstack/react-query": "^4.2.1",
45
+ "@lifi/sdk": "^1.5.0",
46
+ "@lifi/wallet-management": "^1.1.9",
47
+ "@mui/icons-material": "^5.10.3",
48
+ "@mui/lab": "^5.0.0-alpha.98",
49
+ "@mui/material": "^5.10.4",
50
+ "@sentry/integrations": "^7.12.1",
51
+ "@sentry/react": "^7.12.1",
52
+ "@sentry/tracing": "^7.12.1",
53
+ "@tanstack/react-query": "^4.3.4",
54
54
  "@tanstack/react-virtual": "^3.0.0-beta.17",
55
55
  "big.js": "^6.2.1",
56
+ "events": "^3.3.0",
56
57
  "i18next": "^21.9.1",
57
58
  "immer": "^9.0.15",
58
59
  "react": "^18.2.0",
59
60
  "react-dom": "^18.2.0",
60
- "react-hook-form": "^7.34.2",
61
- "react-i18next": "^11.18.4",
61
+ "react-hook-form": "^7.35.0",
62
+ "react-i18next": "^11.18.6",
62
63
  "react-router-dom": "^6.3.0",
63
64
  "react-timer-hook": "^3.0.5",
64
65
  "zustand": "^4.1.1"
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const ActiveSwapsEmpty: React.FC;