@layerswap/widget 1.0.5 → 1.1.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 (361) hide show
  1. package/dist/esm/Models/LayerSwapSettings.js +0 -1
  2. package/dist/esm/Models/Theme.js +39 -8
  3. package/dist/esm/components/Buttons/copyButton.js +5 -3
  4. package/dist/esm/components/Buttons/submitButton.js +2 -1
  5. package/dist/esm/components/ColorSchema.js +3 -10
  6. package/dist/esm/components/Common/ConnectWalletButton.js +9 -3
  7. package/dist/esm/components/Common/CountDownTimer.js +0 -15
  8. package/dist/esm/components/Common/WarningMessage.js +4 -2
  9. package/dist/esm/components/Common/guideLink.js +4 -6
  10. package/dist/esm/components/ErrorFallback.js +11 -11
  11. package/dist/esm/components/HeaderWithMenu.js +1 -1
  12. package/dist/esm/components/Icons/Wallets/Xverse.js +3 -0
  13. package/dist/esm/components/Icons/Wallets/index.js +1 -0
  14. package/dist/esm/components/Input/Address/AddressPicker/index.js +15 -12
  15. package/dist/esm/components/Input/Amount/Balance.js +8 -2
  16. package/dist/esm/components/Input/Amount/ExchangeReceiveAmount.js +8 -0
  17. package/dist/esm/components/Input/Amount/MinMax.js +1 -1
  18. package/dist/esm/components/Input/Amount/PriceImpact.js +5 -38
  19. package/dist/esm/components/Input/Amount/ReceiveAmount.js +2 -2
  20. package/dist/esm/components/Input/Amount/index.js +3 -3
  21. package/dist/esm/components/Input/DestinationPicker.js +2 -2
  22. package/dist/esm/components/Input/NumericInput.js +7 -4
  23. package/dist/esm/components/Input/RoutePicker/Content.js +19 -3
  24. package/dist/esm/components/Input/RoutePicker/RouterPickerWalletConnect.js +5 -5
  25. package/dist/esm/components/Input/RoutePicker/Routes.js +18 -18
  26. package/dist/esm/components/Input/RoutePicker/Rows/CollapsableHeader.js +2 -2
  27. package/dist/esm/components/Input/RoutePicker/Rows/CollapsibleRow.js +3 -3
  28. package/dist/esm/components/Input/RoutePicker/Rows/StickyHeader.js +2 -2
  29. package/dist/esm/components/Input/RoutePicker/Rows/SuggestionsHeader.js +55 -0
  30. package/dist/esm/components/Input/RoutePicker/Rows/TitleRow.js +11 -0
  31. package/dist/esm/components/Input/RoutePicker/Rows/index.js +6 -7
  32. package/dist/esm/components/Input/RoutePicker/index.js +2 -2
  33. package/dist/esm/components/Input/SourceWalletPicker.js +7 -5
  34. package/dist/esm/components/Menu/index.js +2 -2
  35. package/dist/esm/components/Modal/vaulModal.js +11 -16
  36. package/dist/esm/components/Pages/Campaigns/Details/Leaderboard.js +2 -2
  37. package/dist/esm/components/Pages/Campaigns/Details/Rewards.js +2 -2
  38. package/dist/esm/components/Pages/Campaigns/Details/index.js +2 -3
  39. package/dist/esm/components/Pages/Campaigns/index.js +3 -4
  40. package/dist/esm/components/Pages/Swap/Form/ExchangeForm.js +21 -19
  41. package/dist/esm/components/Pages/Swap/Form/FeeDetails/Rate.js +5 -4
  42. package/dist/esm/components/Pages/Swap/Form/FeeDetails/Refuel.js +8 -6
  43. package/dist/esm/components/Pages/Swap/Form/FeeDetails/Slippage.js +6 -1
  44. package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.js +51 -14
  45. package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/SummaryRow.js +2 -2
  46. package/dist/esm/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.js +4 -4
  47. package/dist/esm/components/Pages/Swap/Form/FeeDetails/index.js +8 -9
  48. package/dist/esm/components/Pages/Swap/Form/Form.js +27 -3
  49. package/dist/esm/components/Pages/Swap/Form/FormWrapper.js +8 -14
  50. package/dist/esm/components/Pages/Swap/Form/NetworkForm.js +11 -13
  51. package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.js +8 -6
  52. package/dist/esm/components/Pages/Swap/Form/SecondaryComponents/validationError/ErrorDisplay.js +1 -1
  53. package/dist/esm/components/Pages/Swap/Withdraw/Failed.js +12 -8
  54. package/dist/esm/components/Pages/Swap/Withdraw/ManualWithdraw.js +29 -10
  55. package/dist/esm/components/Pages/Swap/Withdraw/NotFound.js +15 -4
  56. package/dist/esm/components/Pages/Swap/Withdraw/Processing/Processing.js +36 -41
  57. package/dist/esm/components/Pages/Swap/Withdraw/Summary/Summary.js +3 -3
  58. package/dist/esm/components/Pages/Swap/Withdraw/Summary/index.js +3 -3
  59. package/dist/esm/components/Pages/Swap/Withdraw/SwapDetails.js +9 -7
  60. package/dist/esm/components/Pages/Swap/Withdraw/Wallet/Common/actionMessage.js +43 -0
  61. package/dist/esm/components/Pages/Swap/Withdraw/Wallet/Common/buttons.js +118 -71
  62. package/dist/esm/components/Pages/Swap/Withdraw/Wallet/index.js +56 -65
  63. package/dist/esm/components/Pages/Swap/Withdraw/WalletTransferButton.js +2 -2
  64. package/dist/esm/components/Pages/Swap/Withdraw/WalletTransferContent.js +2 -2
  65. package/dist/esm/components/Pages/Swap/Withdraw/Withdraw.js +3 -3
  66. package/dist/esm/components/Pages/Swap/Withdraw/index.js +5 -4
  67. package/dist/esm/components/Pages/Swap/Withdraw/messages/TransactionMessages.js +14 -15
  68. package/dist/esm/components/Pages/SwapHistory/History.js +2 -2
  69. package/dist/esm/components/Pages/SwapHistory/SwapDetailsComponent.js +4 -1
  70. package/dist/esm/components/Pages/SwapHistory/index.js +6 -6
  71. package/dist/esm/components/Wallet/WalletComponents/ConnectedWallets.js +1 -1
  72. package/dist/esm/components/Wallet/WalletComponents/WalletsList.js +4 -3
  73. package/dist/esm/components/Wallet/WalletModal/Connector.js +2 -2
  74. package/dist/esm/components/Wallet/WalletModal/ConnectorsList.js +49 -24
  75. package/dist/esm/components/Wallet/WalletModal/index.js +3 -1
  76. package/dist/esm/components/Wallet/WalletProviders/index.js +4 -2
  77. package/dist/esm/components/Widget/Content.js +2 -2
  78. package/dist/esm/components/Widget/Footer.js +1 -1
  79. package/dist/esm/components/Widget/Index.js +2 -3
  80. package/dist/esm/components/WidgetLoading.js +9 -2
  81. package/dist/esm/components/utils/RoundDecimals.js +4 -2
  82. package/dist/esm/context/ErrorProvider.js +14 -0
  83. package/dist/esm/context/LayerswapProvider.js +6 -5
  84. package/dist/esm/context/asyncModal.js +1 -1
  85. package/dist/esm/context/callbackProvider.js +54 -60
  86. package/dist/esm/context/resolverContext.js +7 -2
  87. package/dist/esm/context/swap.js +13 -18
  88. package/dist/esm/context/{balanceAccounts.js → swapAccounts.js} +17 -17
  89. package/dist/esm/context/validationContext.js +1 -1
  90. package/dist/esm/context/walletProviders.js +7 -1
  91. package/dist/esm/context/withdrawalContext.js +2 -2
  92. package/dist/esm/exports/internal.js +4 -3
  93. package/dist/esm/helpers/filterSourceNetworks.js +23 -0
  94. package/dist/esm/helpers/getSettings/getSettings.js +18 -13
  95. package/dist/esm/helpers/routes.js +4 -1
  96. package/dist/esm/hooks/useAllWithdrawalBalances.js +6 -5
  97. package/dist/esm/hooks/useFormRoutes.js +16 -8
  98. package/dist/esm/hooks/useFormValidation.js +11 -6
  99. package/dist/esm/hooks/useRouteValidation.js +1 -1
  100. package/dist/esm/hooks/useSwrSwaps.js +1 -1
  101. package/dist/esm/hooks/useTransfer.js +9 -0
  102. package/dist/esm/hooks/useWallet.js +7 -7
  103. package/dist/esm/lib/AppSettings.js +28 -17
  104. package/dist/esm/lib/ErrorHandler.js +6 -0
  105. package/dist/esm/lib/NetworkSettings.js +0 -16
  106. package/dist/esm/lib/apiClients/layerSwapApiClient.js +12 -35
  107. package/dist/esm/lib/axiosInterceptor.js +2 -2
  108. package/dist/esm/lib/balances/balanceResolver.js +9 -13
  109. package/dist/esm/lib/fees.js +50 -0
  110. package/dist/esm/lib/resolvers/resolverService.js +10 -1
  111. package/dist/esm/lib/transfers/index.js +1 -0
  112. package/dist/esm/lib/transfers/transferResolver.js +14 -0
  113. package/dist/esm/stores/balanceStore.js +1 -2
  114. package/dist/esm/stores/logStore.js +11 -0
  115. package/dist/esm/types/balance.js +8 -9
  116. package/dist/esm/types/index.js +1 -0
  117. package/dist/esm/types/logEvents.js +1 -0
  118. package/dist/index.css +2 -2
  119. package/dist/tsconfig.tsbuildinfo +1 -1
  120. package/dist/types/Models/Balance.d.ts +1 -1
  121. package/dist/types/Models/LayerSwapSettings.d.ts +7 -0
  122. package/dist/types/Models/LayerSwapSettings.d.ts.map +1 -1
  123. package/dist/types/Models/Theme.d.ts +0 -3
  124. package/dist/types/Models/Theme.d.ts.map +1 -1
  125. package/dist/types/components/Buttons/copyButton.d.ts +3 -1
  126. package/dist/types/components/Buttons/copyButton.d.ts.map +1 -1
  127. package/dist/types/components/Buttons/submitButton.d.ts +1 -1
  128. package/dist/types/components/Buttons/submitButton.d.ts.map +1 -1
  129. package/dist/types/components/ColorSchema.d.ts.map +1 -1
  130. package/dist/types/components/Common/ConnectWalletButton.d.ts +1 -1
  131. package/dist/types/components/Common/ConnectWalletButton.d.ts.map +1 -1
  132. package/dist/types/components/Common/CountDownTimer.d.ts.map +1 -1
  133. package/dist/types/components/Common/WarningMessage.d.ts.map +1 -1
  134. package/dist/types/components/Common/guideLink.d.ts.map +1 -1
  135. package/dist/types/components/ErrorFallback.d.ts.map +1 -1
  136. package/dist/types/components/HeaderWithMenu.d.ts.map +1 -1
  137. package/dist/types/components/Icons/Wallets/Xverse.d.ts +4 -0
  138. package/dist/types/components/Icons/Wallets/Xverse.d.ts.map +1 -0
  139. package/dist/types/components/Icons/Wallets/index.d.ts +1 -0
  140. package/dist/types/components/Icons/Wallets/index.d.ts.map +1 -1
  141. package/dist/types/components/Input/Address/AddressNote.d.ts +2 -2
  142. package/dist/types/components/Input/Address/AddressPicker/AddressBook.d.ts +3 -3
  143. package/dist/types/components/Input/Address/AddressPicker/AddressButton.d.ts +3 -3
  144. package/dist/types/components/Input/Address/AddressPicker/AddressWithIcon.d.ts +2 -2
  145. package/dist/types/components/Input/Address/AddressPicker/ConnectedWallets.d.ts +2 -2
  146. package/dist/types/components/Input/Address/AddressPicker/ManualAddressInput.d.ts +4 -4
  147. package/dist/types/components/Input/Address/AddressPicker/index.d.ts +4 -4
  148. package/dist/types/components/Input/Address/AddressPicker/index.d.ts.map +1 -1
  149. package/dist/types/components/Input/Address/index.d.ts +1 -1
  150. package/dist/types/components/Input/Amount/Balance.d.ts +1 -1
  151. package/dist/types/components/Input/Amount/Balance.d.ts.map +1 -1
  152. package/dist/types/components/Input/Amount/ExchangeReceiveAmount.d.ts +11 -0
  153. package/dist/types/components/Input/Amount/ExchangeReceiveAmount.d.ts.map +1 -0
  154. package/dist/types/components/Input/Amount/MinMax.d.ts +1 -1
  155. package/dist/types/components/Input/Amount/PriceImpact.d.ts +2 -6
  156. package/dist/types/components/Input/Amount/PriceImpact.d.ts.map +1 -1
  157. package/dist/types/components/Input/Amount/ReceiveAmount.d.ts +2 -3
  158. package/dist/types/components/Input/Amount/ReceiveAmount.d.ts.map +1 -1
  159. package/dist/types/components/Input/Amount/helpers.d.ts +2 -2
  160. package/dist/types/components/Input/Amount/index.d.ts +1 -1
  161. package/dist/types/components/Input/CexPicker.d.ts +1 -1
  162. package/dist/types/components/Input/DestinationPicker.d.ts +1 -1
  163. package/dist/types/components/Input/DestinationPicker.d.ts.map +1 -1
  164. package/dist/types/components/Input/NumericInput.d.ts.map +1 -1
  165. package/dist/types/components/Input/RoutePicker/Content.d.ts +5 -5
  166. package/dist/types/components/Input/RoutePicker/Content.d.ts.map +1 -1
  167. package/dist/types/components/Input/RoutePicker/RouterPickerWalletConnect.d.ts +1 -1
  168. package/dist/types/components/Input/RoutePicker/Routes.d.ts +4 -8
  169. package/dist/types/components/Input/RoutePicker/Routes.d.ts.map +1 -1
  170. package/dist/types/components/Input/RoutePicker/Rows/CollapsableHeader.d.ts +3 -4
  171. package/dist/types/components/Input/RoutePicker/Rows/CollapsableHeader.d.ts.map +1 -1
  172. package/dist/types/components/Input/RoutePicker/Rows/CollapsibleRow.d.ts +6 -5
  173. package/dist/types/components/Input/RoutePicker/Rows/CollapsibleRow.d.ts.map +1 -1
  174. package/dist/types/components/Input/RoutePicker/Rows/StickyHeader.d.ts +3 -4
  175. package/dist/types/components/Input/RoutePicker/Rows/StickyHeader.d.ts.map +1 -1
  176. package/dist/types/components/Input/RoutePicker/Rows/SuggestionsHeader.d.ts +7 -0
  177. package/dist/types/components/Input/RoutePicker/Rows/SuggestionsHeader.d.ts.map +1 -0
  178. package/dist/types/components/Input/RoutePicker/Rows/TitleRow.d.ts +7 -0
  179. package/dist/types/components/Input/RoutePicker/Rows/TitleRow.d.ts.map +1 -0
  180. package/dist/types/components/Input/RoutePicker/Rows/index.d.ts +5 -5
  181. package/dist/types/components/Input/RoutePicker/Rows/index.d.ts.map +1 -1
  182. package/dist/types/components/Input/RoutePicker/index.d.ts +1 -1
  183. package/dist/types/components/Input/RoutePicker/index.d.ts.map +1 -1
  184. package/dist/types/components/Input/SourcePicker.d.ts +1 -1
  185. package/dist/types/components/Input/SourceWalletPicker.d.ts.map +1 -1
  186. package/dist/types/components/Modal/vaulModal.d.ts.map +1 -1
  187. package/dist/types/components/Pages/Campaigns/Details/Leaderboard.d.ts +1 -1
  188. package/dist/types/components/Pages/Campaigns/Details/Rewards.d.ts +1 -1
  189. package/dist/types/components/Pages/Campaigns/Details/index.d.ts +1 -2
  190. package/dist/types/components/Pages/Campaigns/Details/index.d.ts.map +1 -1
  191. package/dist/types/components/Pages/Campaigns/index.d.ts +2 -3
  192. package/dist/types/components/Pages/Campaigns/index.d.ts.map +1 -1
  193. package/dist/types/components/Pages/Swap/Form/ExchangeForm.d.ts +3 -1
  194. package/dist/types/components/Pages/Swap/Form/ExchangeForm.d.ts.map +1 -1
  195. package/dist/types/components/Pages/Swap/Form/FeeDetails/Rate.d.ts +7 -6
  196. package/dist/types/components/Pages/Swap/Form/FeeDetails/Rate.d.ts.map +1 -1
  197. package/dist/types/components/Pages/Swap/Form/FeeDetails/ReceiveAmounts.d.ts +2 -2
  198. package/dist/types/components/Pages/Swap/Form/FeeDetails/Refuel.d.ts +1 -1
  199. package/dist/types/components/Pages/Swap/Form/FeeDetails/Refuel.d.ts.map +1 -1
  200. package/dist/types/components/Pages/Swap/Form/FeeDetails/RefuelModal.d.ts +1 -1
  201. package/dist/types/components/Pages/Swap/Form/FeeDetails/Slippage.d.ts +1 -1
  202. package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.d.ts +3 -2
  203. package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/DetailedEstimates.d.ts.map +1 -1
  204. package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/SummaryRow.d.ts +4 -4
  205. package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.d.ts +4 -4
  206. package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/index.d.ts.map +1 -1
  207. package/dist/types/components/Pages/Swap/Form/FeeDetails/SwapQuote/utils.d.ts +2 -2
  208. package/dist/types/components/Pages/Swap/Form/FeeDetails/index.d.ts +7 -4
  209. package/dist/types/components/Pages/Swap/Form/FeeDetails/index.d.ts.map +1 -1
  210. package/dist/types/components/Pages/Swap/Form/Form.d.ts.map +1 -1
  211. package/dist/types/components/Pages/Swap/Form/FormWrapper.d.ts +1 -1
  212. package/dist/types/components/Pages/Swap/Form/FormWrapper.d.ts.map +1 -1
  213. package/dist/types/components/Pages/Swap/Form/NetworkForm.d.ts +1 -1
  214. package/dist/types/components/Pages/Swap/Form/NetworkForm.d.ts.map +1 -1
  215. package/dist/types/components/Pages/Swap/Form/SecondaryComponents/FormButton.d.ts +1 -1
  216. package/dist/types/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.d.ts +2 -2
  217. package/dist/types/components/Pages/Swap/Form/SecondaryComponents/ReserveGasNote.d.ts.map +1 -1
  218. package/dist/types/components/Pages/Swap/Form/SecondaryComponents/validationError/ErrorDisplay.d.ts +1 -1
  219. package/dist/types/components/Pages/Swap/Form/SwapFormValues.d.ts +2 -2
  220. package/dist/types/components/Pages/Swap/Withdraw/Failed.d.ts.map +1 -1
  221. package/dist/types/components/Pages/Swap/Withdraw/ManualWithdraw.d.ts +4 -3
  222. package/dist/types/components/Pages/Swap/Withdraw/ManualWithdraw.d.ts.map +1 -1
  223. package/dist/types/components/Pages/Swap/Withdraw/NotFound.d.ts.map +1 -1
  224. package/dist/types/components/Pages/Swap/Withdraw/Processing/Processing.d.ts +1 -1
  225. package/dist/types/components/Pages/Swap/Withdraw/Processing/Processing.d.ts.map +1 -1
  226. package/dist/types/components/Pages/Swap/Withdraw/QuoteUpdate.d.ts +1 -1
  227. package/dist/types/components/Pages/Swap/Withdraw/Summary/Summary.d.ts +1 -1
  228. package/dist/types/components/Pages/Swap/Withdraw/SwapDetails.d.ts +2 -1
  229. package/dist/types/components/Pages/Swap/Withdraw/SwapDetails.d.ts.map +1 -1
  230. package/dist/types/components/Pages/Swap/Withdraw/SwapQuoteDetails.d.ts +3 -3
  231. package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/actionMessage.d.ts +6 -0
  232. package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/actionMessage.d.ts.map +1 -0
  233. package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/buttons.d.ts +4 -3
  234. package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/buttons.d.ts.map +1 -1
  235. package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/sharedTypes.d.ts +2 -1
  236. package/dist/types/components/Pages/Swap/Withdraw/Wallet/Common/sharedTypes.d.ts.map +1 -1
  237. package/dist/types/components/Pages/Swap/Withdraw/Wallet/index.d.ts +2 -1
  238. package/dist/types/components/Pages/Swap/Withdraw/Wallet/index.d.ts.map +1 -1
  239. package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts +2 -1
  240. package/dist/types/components/Pages/Swap/Withdraw/WalletTransferButton.d.ts.map +1 -1
  241. package/dist/types/components/Pages/Swap/Withdraw/WalletTransferContent.d.ts +1 -1
  242. package/dist/types/components/Pages/Swap/Withdraw/Withdraw.d.ts +2 -1
  243. package/dist/types/components/Pages/Swap/Withdraw/Withdraw.d.ts.map +1 -1
  244. package/dist/types/components/Pages/Swap/Withdraw/index.d.ts +1 -2
  245. package/dist/types/components/Pages/Swap/Withdraw/index.d.ts.map +1 -1
  246. package/dist/types/components/Pages/Swap/Withdraw/messages/TransactionMessages.d.ts +3 -4
  247. package/dist/types/components/Pages/Swap/Withdraw/messages/TransactionMessages.d.ts.map +1 -1
  248. package/dist/types/components/Pages/SwapHistory/HistorySummary.d.ts +2 -2
  249. package/dist/types/components/Pages/SwapHistory/StatusIcons.d.ts +1 -1
  250. package/dist/types/components/Pages/SwapHistory/SwapDetailsComponent.d.ts +1 -1
  251. package/dist/types/components/Pages/SwapHistory/SwapDetailsComponent.d.ts.map +1 -1
  252. package/dist/types/components/Pages/SwapHistory/index.d.ts +3 -1
  253. package/dist/types/components/Pages/SwapHistory/index.d.ts.map +1 -1
  254. package/dist/types/components/Wallet/WalletComponents/WalletsList.d.ts +3 -3
  255. package/dist/types/components/Wallet/WalletComponents/WalletsList.d.ts.map +1 -1
  256. package/dist/types/components/Wallet/WalletModal/Connector.d.ts +2 -1
  257. package/dist/types/components/Wallet/WalletModal/Connector.d.ts.map +1 -1
  258. package/dist/types/components/Wallet/WalletModal/ConnectorsList.d.ts +1 -1
  259. package/dist/types/components/Wallet/WalletModal/ConnectorsList.d.ts.map +1 -1
  260. package/dist/types/components/Wallet/WalletModal/index.d.ts +1 -1
  261. package/dist/types/components/Wallet/WalletModal/index.d.ts.map +1 -1
  262. package/dist/types/components/Wallet/WalletProviders/index.d.ts +3 -1
  263. package/dist/types/components/Wallet/WalletProviders/index.d.ts.map +1 -1
  264. package/dist/types/components/Widget/Content.d.ts +2 -1
  265. package/dist/types/components/Widget/Content.d.ts.map +1 -1
  266. package/dist/types/components/Widget/Footer.d.ts +2 -1
  267. package/dist/types/components/Widget/Footer.d.ts.map +1 -1
  268. package/dist/types/components/Widget/Index.d.ts +3 -2
  269. package/dist/types/components/Widget/Index.d.ts.map +1 -1
  270. package/dist/types/components/WidgetLoading.d.ts.map +1 -1
  271. package/dist/types/components/shadcn/command.d.ts +9 -52
  272. package/dist/types/components/shadcn/command.d.ts.map +1 -1
  273. package/dist/types/components/utils/RoundDecimals.d.ts.map +1 -1
  274. package/dist/types/context/ErrorProvider.d.ts +3 -0
  275. package/dist/types/context/ErrorProvider.d.ts.map +1 -0
  276. package/dist/types/context/LayerswapProvider.d.ts +22 -4
  277. package/dist/types/context/LayerswapProvider.d.ts.map +1 -1
  278. package/dist/types/context/callbackProvider.d.ts +6 -12
  279. package/dist/types/context/callbackProvider.d.ts.map +1 -1
  280. package/dist/types/context/resolverContext.d.ts.map +1 -1
  281. package/dist/types/context/swap.d.ts +7 -7
  282. package/dist/types/context/swap.d.ts.map +1 -1
  283. package/dist/types/context/{balanceAccounts.d.ts → swapAccounts.d.ts} +9 -9
  284. package/dist/types/context/swapAccounts.d.ts.map +1 -0
  285. package/dist/types/context/validationContext.d.ts +1 -0
  286. package/dist/types/context/validationContext.d.ts.map +1 -1
  287. package/dist/types/context/walletProviders.d.ts.map +1 -1
  288. package/dist/types/context/withdrawalContext.d.ts +2 -0
  289. package/dist/types/context/withdrawalContext.d.ts.map +1 -1
  290. package/dist/types/exports/internal.d.ts +9 -7
  291. package/dist/types/exports/internal.d.ts.map +1 -1
  292. package/dist/types/helpers/accountSelectHelper.d.ts +1 -1
  293. package/dist/types/helpers/balanceHelper.d.ts +2 -2
  294. package/dist/types/helpers/filterSourceNetworks.d.ts +4 -0
  295. package/dist/types/helpers/filterSourceNetworks.d.ts.map +1 -0
  296. package/dist/types/helpers/getSettings/getSettings.d.ts +1 -1
  297. package/dist/types/helpers/getSettings/getSettings.d.ts.map +1 -1
  298. package/dist/types/helpers/routes.d.ts +1 -1
  299. package/dist/types/helpers/routes.d.ts.map +1 -1
  300. package/dist/types/helpers/tokenHelper.d.ts +2 -2
  301. package/dist/types/hooks/useAllWithdrawalBalances.d.ts +2 -1
  302. package/dist/types/hooks/useAllWithdrawalBalances.d.ts.map +1 -1
  303. package/dist/types/hooks/useFee.d.ts +1 -1
  304. package/dist/types/hooks/useFormRoutes.d.ts +2 -3
  305. package/dist/types/hooks/useFormRoutes.d.ts.map +1 -1
  306. package/dist/types/hooks/useFormValidation.d.ts +10 -1
  307. package/dist/types/hooks/useFormValidation.d.ts.map +1 -1
  308. package/dist/types/hooks/useSwapHistoryData.d.ts +2 -2
  309. package/dist/types/hooks/useTransfer.d.ts +5 -0
  310. package/dist/types/hooks/useTransfer.d.ts.map +1 -0
  311. package/dist/types/hooks/useWallet.d.ts +3 -3
  312. package/dist/types/hooks/useWallet.d.ts.map +1 -1
  313. package/dist/types/lib/AppSettings.d.ts +25 -16
  314. package/dist/types/lib/AppSettings.d.ts.map +1 -1
  315. package/dist/types/lib/ErrorHandler.d.ts +3 -0
  316. package/dist/types/lib/ErrorHandler.d.ts.map +1 -0
  317. package/dist/types/lib/NetworkSettings.d.ts +0 -1
  318. package/dist/types/lib/NetworkSettings.d.ts.map +1 -1
  319. package/dist/types/lib/apiClients/layerSwapApiClient.d.ts +2 -10
  320. package/dist/types/lib/apiClients/layerSwapApiClient.d.ts.map +1 -1
  321. package/dist/types/lib/balances/balanceResolver.d.ts +3 -3
  322. package/dist/types/lib/balances/balanceResolver.d.ts.map +1 -1
  323. package/dist/types/lib/balances/helpers.d.ts +1 -1
  324. package/dist/types/lib/balances/useBalance.d.ts +1 -1
  325. package/dist/types/lib/fees.d.ts +16 -0
  326. package/dist/types/lib/fees.d.ts.map +1 -1
  327. package/dist/types/lib/gases/gasResolver.d.ts +2 -2
  328. package/dist/types/lib/gases/useSWRGas.d.ts +3 -3
  329. package/dist/types/lib/generateSwapInitialValues.d.ts +1 -1
  330. package/dist/types/lib/nft/nftBalanceResolver.d.ts +1 -1
  331. package/dist/types/lib/resolvers/resolverService.d.ts +8 -5
  332. package/dist/types/lib/resolvers/resolverService.d.ts.map +1 -1
  333. package/dist/types/lib/sorting.d.ts +1 -1
  334. package/dist/types/lib/transfers/index.d.ts +2 -0
  335. package/dist/types/lib/transfers/index.d.ts.map +1 -0
  336. package/dist/types/lib/transfers/transferResolver.d.ts +7 -0
  337. package/dist/types/lib/transfers/transferResolver.d.ts.map +1 -0
  338. package/dist/types/stores/balanceStore.d.ts.map +1 -1
  339. package/dist/types/stores/logStore.d.ts +8 -0
  340. package/dist/types/stores/logStore.d.ts.map +1 -0
  341. package/dist/types/stores/walletStore.d.ts +1 -1
  342. package/dist/types/types/balance.d.ts +2 -2
  343. package/dist/types/types/balance.d.ts.map +1 -1
  344. package/dist/types/types/gas.d.ts +2 -2
  345. package/dist/types/types/index.d.ts +1 -0
  346. package/dist/types/types/index.d.ts.map +1 -1
  347. package/dist/types/types/logEvents.d.ts +41 -0
  348. package/dist/types/types/logEvents.d.ts.map +1 -0
  349. package/dist/types/types/nft.d.ts +1 -1
  350. package/dist/types/types/transfer.d.ts +7 -2
  351. package/dist/types/types/transfer.d.ts.map +1 -1
  352. package/dist/types/types/wallet.d.ts +25 -6
  353. package/dist/types/types/wallet.d.ts.map +1 -1
  354. package/package.json +3 -3
  355. package/dist/esm/helpers/querryHelper.js +0 -13
  356. package/dist/esm/lib/logError.js +0 -17
  357. package/dist/types/context/balanceAccounts.d.ts.map +0 -1
  358. package/dist/types/helpers/querryHelper.d.ts +0 -3
  359. package/dist/types/helpers/querryHelper.d.ts.map +0 -1
  360. package/dist/types/lib/logError.d.ts +0 -3
  361. package/dist/types/lib/logError.d.ts.map +0 -1
@@ -1,3 +1,2 @@
1
1
  export class LayerSwapSettings {
2
2
  }
3
- ;
@@ -3,7 +3,6 @@ export const THEME_COLORS = {
3
3
  buttonTextColor: '255, 255, 255',
4
4
  tertiary: '140, 152, 192',
5
5
  logo: '255, 255, 255',
6
- footerLogo: 'none',
7
6
  primary: {
8
7
  DEFAULT: '46, 236, 255',
9
8
  '100': '209, 251, 255',
@@ -35,7 +34,6 @@ export const THEME_COLORS = {
35
34
  tertiary: '134, 134, 134',
36
35
  buttonTextColor: '17, 17, 17',
37
36
  logo: '255, 0, 147',
38
- footerLogo: 'none',
39
37
  primary: {
40
38
  DEFAULT: '228, 37, 117',
41
39
  '100': '246, 182, 209',
@@ -67,7 +65,6 @@ export const THEME_COLORS = {
67
65
  tertiary: '118, 128, 147',
68
66
  buttonTextColor: '228, 229, 240',
69
67
  logo: '255, 0, 147',
70
- footerLogo: 'none',
71
68
  borderRadius: 'medium',
72
69
  warning: {
73
70
  Foreground: '255, 201, 74',
@@ -112,7 +109,6 @@ export const THEME_COLORS = {
112
109
  tertiary: "110, 80, 140",
113
110
  buttonTextColor: "255, 240, 200",
114
111
  logo: '255, 0, 147',
115
- footerLogo: "none",
116
112
  warning: {
117
113
  Foreground: "255, 180, 70",
118
114
  Background: "45, 30, 10",
@@ -156,7 +152,6 @@ export const THEME_COLORS = {
156
152
  tertiary: '134, 134, 134',
157
153
  buttonTextColor: '15, 15, 15',
158
154
  logo: '15, 15, 15',
159
- footerLogo: 'none',
160
155
  primary: {
161
156
  DEFAULT: '51, 144, 236',
162
157
  '100': '246, 182, 209',
@@ -188,9 +183,45 @@ export const THEME_COLORS = {
188
183
  tertiary: '182, 182, 182',
189
184
  buttonTextColor: '19, 19, 19',
190
185
  logo: '187, 187, 187',
191
- headerLogo: 'none',
192
- footerLogo: 'block',
193
- footerLogoHeight: '20px',
186
+ primary: {
187
+ DEFAULT: '243, 243, 243',
188
+ '100': '255, 255, 255',
189
+ '200': '255, 255, 255',
190
+ '300': '255, 255, 255',
191
+ '400': '255, 255, 255',
192
+ '500': '243, 243, 243',
193
+ '600': '215, 215, 215',
194
+ '700': '187, 187, 187',
195
+ '800': '159, 159, 159',
196
+ '900': '131, 131, 131',
197
+ 'text': '243, 243, 243',
198
+ },
199
+ secondary: {
200
+ DEFAULT: '37, 37, 37',
201
+ '100': '119, 119, 119',
202
+ '200': '98, 98, 98',
203
+ '300': '78, 78, 78',
204
+ '400': '57, 57, 57',
205
+ '500': '37, 37, 37',
206
+ '600': '13, 13, 13',
207
+ '700': '13, 13, 13',
208
+ '800': '13, 13, 13',
209
+ '900': '0, 0, 0',
210
+ 'text': '182, 182, 182',
211
+ },
212
+ },
213
+ "immutablePlay": {
214
+ tertiary: '182, 182, 182',
215
+ buttonTextColor: '19, 19, 19',
216
+ logo: '187, 187, 187',
217
+ header: {
218
+ hideMenu: true,
219
+ hideTabs: true,
220
+ hideWallets: true,
221
+ },
222
+ cardBackgroundStyle: {
223
+ backgroundColor: 'transparent',
224
+ },
194
225
  primary: {
195
226
  DEFAULT: '243, 243, 243',
196
227
  '100': '255, 255, 255',
@@ -1,18 +1,20 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Check } from 'lucide-react';
4
4
  import { classNames } from '../utils/classNames';
5
5
  import useCopyClipboard from '../../hooks/useCopyClipboard';
6
6
  import { useState } from 'react';
7
7
  import { Tooltip, TooltipContent, TooltipTrigger } from '../shadcn/tooltip';
8
8
  import CopyIcon from '../Icons/CopyIcon';
9
- const CopyButton = ({ className, toCopy, children, iconSize, iconClassName }) => {
9
+ const CopyButton = ({ className, toCopy, children, iconSize, iconClassName, disabled = false, }) => {
10
10
  const [isCopied, setCopied] = useCopyClipboard();
11
11
  const [isTooltipOpen, setTooltipOpen] = useState(false);
12
12
  const handleCopyClick = () => {
13
+ if (disabled)
14
+ return;
13
15
  setCopied(toCopy);
14
16
  setTooltipOpen(true);
15
17
  };
16
- return (_jsxs(Tooltip, { open: isTooltipOpen, onOpenChange: setTooltipOpen, children: [_jsx(TooltipTrigger, { children: _jsx("div", { className: classNames(className), onClick: handleCopyClick, children: isCopied ? (_jsxs("div", { className: "flex items-center gap-1 cursor-pointer", children: [_jsx(Check, { className: iconClassName, width: iconSize ? iconSize : 16, height: iconSize ? iconSize : 16 }), children] })) : (_jsxs("div", { className: "flex items-center gap-1 cursor-pointer", children: [_jsx(CopyIcon, { className: iconClassName, width: iconSize ? iconSize : 16, height: iconSize ? iconSize : 16 }), children] })) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: isCopied ? "Copied" : "Copy" }) })] }));
18
+ return (_jsxs(Tooltip, { open: isTooltipOpen, onOpenChange: setTooltipOpen, children: [_jsx(TooltipTrigger, { children: _jsx("div", { className: classNames(className, "flex items-center gap-1", "cursor-pointer", disabled && "opacity-50 cursor-not-allowed pointer-events-none"), onClick: handleCopyClick, tabIndex: disabled ? -1 : 0, "aria-disabled": disabled, children: isCopied ? (_jsxs(_Fragment, { children: [_jsx(Check, { className: iconClassName, width: iconSize ? iconSize : 16, height: iconSize ? iconSize : 16 }), children] })) : (_jsxs(_Fragment, { children: [_jsx(CopyIcon, { className: iconClassName, width: iconSize ? iconSize : 16, height: iconSize ? iconSize : 16 }), children] })) }) }), _jsx(TooltipContent, { children: _jsx("p", { children: isCopied ? "Copied" : "Copy" }) })] }));
17
19
  };
18
20
  export default CopyButton;
@@ -13,9 +13,10 @@ const SubmitButton = ({ isDisabled, isSubmitting, icon, children, type, onClick,
13
13
  return (_jsxs("button", { disabled: isDisabled || isSubmitting, type: type, onClick: onClick, style: style, className: clsx('enabled:active:animate-press-down text-primary focus:outline-none focus:ring-0 items-center space-x-1 disabled:bg-secondary-300 disabled:text-secondary-text/50 disabled:cursor-not-allowed relative w-full flex justify-center font-medium rounded-xl transform hover:brightness-125 transition duration-200 ease-in-out', {
14
14
  className,
15
15
  'text-primary-buttonTextColor bg-primary-500': buttonStyle === 'filled',
16
+ 'text-primary-text bg-secondary-300 hover:bg-secondary-400': buttonStyle === 'secondary',
16
17
  'py-4 px-4': size === 'large',
17
18
  'py-3 px-2 md:px-3': size === 'medium',
18
- 'py-1.5 px-1.5': size === 'small',
19
+ 'py-2.5 px-2.5 text-sm': size === 'small',
19
20
  }), children: [_jsxs("span", { className: `${button_align === "right" ? 'order-last' : 'order-first'} ${text_align === 'center' ? "absolute left-0 inset-y-0 flex items-center pl-3" : "relative"}`, children: [(!isDisabled && !isSubmitting) && icon, isSubmitting ?
20
21
  _jsx(SpinIcon, { className: "animate-spin h-5 w-5" })
21
22
  : null] }), _jsx("span", { className: `grow ${text_align === 'left' ? 'text-left' : 'text-center'}`, children: children })] }));
@@ -85,20 +85,13 @@ const ColorSchema = ({ themeData }) => {
85
85
  --ls-colors-secondary-900: ${mergedTheme.secondary?.[900]};
86
86
  --ls-colors-secondary-text: ${mergedTheme.secondary?.text};
87
87
 
88
- --ls-color-warning-foreground: ${mergedTheme.warning?.Foreground};
88
+ --ls-colors-warning-foreground: ${mergedTheme.warning?.Foreground};
89
89
  --ls-colors-warning-background: ${mergedTheme.warning?.Background};
90
- --ls-color-error-foreground: ${mergedTheme.error?.Foreground};
90
+ --ls-colors-error-foreground: ${mergedTheme.error?.Foreground};
91
91
  --ls-colors-error-background: ${mergedTheme.error?.Background};
92
- --ls-color-success-foreground: ${mergedTheme.success?.Foreground};
92
+ --ls-colors-success-foreground: ${mergedTheme.success?.Foreground};
93
93
  --ls-colors-success-background: ${mergedTheme.success?.Background};
94
94
  }
95
- .headerLogo {
96
- display: ${mergedTheme.headerLogo};
97
- }
98
- .footerLogo {
99
- display: ${mergedTheme.footerLogo};
100
- height: ${mergedTheme.footerLogoHeight};
101
- }
102
95
  ` }) }));
103
96
  };
104
97
  export default ColorSchema;
@@ -7,16 +7,22 @@ import { classNames } from "../../components/utils/classNames";
7
7
  const ConnectWalletButton = ({ provider, onConnect, descriptionText, ...rest }) => {
8
8
  const [isLoading, setIsLoading] = useState(false);
9
9
  const { connect } = useConnectModal();
10
+ const isProviderReady = typeof provider?.ready === 'boolean' ? provider.ready : true;
10
11
  const handleConnect = async () => {
12
+ if (!isProviderReady)
13
+ return;
11
14
  setIsLoading(true);
12
15
  const result = await connect(provider);
13
16
  if (onConnect && result)
14
17
  onConnect(result);
15
18
  setIsLoading(false);
16
19
  };
17
- return _jsx("button", { ...rest, type: "button", onClick: handleConnect, className: classNames(`py-5 px-6 bg-secondary-500 hover:bg-secondary-400 transition-colors duration-200 rounded-xl ${isLoading && 'cursor-progress opacity-80'}`, rest.className), children: _jsxs("div", { className: "flex flex-row justify-between gap-9 items-stretch", children: [_jsx(ResolveConnectorIcon, { connector: provider?.name, iconClassName: "w-10 h-10 p-0.5 rounded-lg bg-secondary-800 border border-secondary-400", className: "grid grid-cols-2 gap-1 min-w-fit" }), _jsxs("div", { className: "h-full space-y-2", children: [_jsx("p", { className: "text-sm font-medium text-secondary-text text-start", children: descriptionText ?? 'Connect your wallet to browse and select from your addresses' }), _jsx("div", { className: "bg-primary-700/30 border-none text-primary! py-2 rounded-lg text-base font-semibold", children: isLoading ?
18
- _jsxs("div", { className: "flex items-center gap-1 justify-center", children: [_jsx(RefreshCw, { className: "h-3 w-auto animate-spin" }), _jsx("span", { className: "ml-1", children: "Connecting..." })] })
20
+ return _jsx("button", { ...rest, type: "button", onClick: handleConnect, disabled: !isProviderReady || rest.disabled, className: classNames(`py-5 px-6 bg-secondary-500 hover:bg-secondary-400 transition-colors duration-200 rounded-xl ${(isLoading || !isProviderReady) && 'cursor-progress opacity-80'} disabled:opacity-50 disabled:cursor-not-allowed`, rest.className), children: _jsxs("div", { className: "flex flex-row justify-between gap-9 items-stretch", children: [_jsx(ResolveConnectorIcon, { connector: provider?.name, iconClassName: "w-10 h-10 p-0.5 rounded-lg bg-secondary-800 border border-secondary-400", className: "grid grid-cols-2 gap-1 min-w-fit" }), _jsxs("div", { className: "h-full space-y-2", children: [_jsx("p", { className: "text-sm font-medium text-secondary-text text-start", children: descriptionText ?? 'Connect your wallet to browse and select from your addresses' }), _jsx("div", { className: "bg-primary-700/30 border-none text-primary! py-2 rounded-lg text-base font-semibold", children: !isProviderReady ?
21
+ _jsxs("div", { className: "flex items-center gap-1 justify-center", children: [_jsx(RefreshCw, { className: "h-3 w-auto animate-spin" }), _jsx("span", { className: "ml-1", children: "Initializing..." })] })
19
22
  :
20
- _jsx(_Fragment, { children: "Connect Now" }) })] })] }) });
23
+ isLoading ?
24
+ _jsxs("div", { className: "flex items-center gap-1 justify-center", children: [_jsx(RefreshCw, { className: "h-3 w-auto animate-spin" }), _jsx("span", { className: "ml-1", children: "Connecting..." })] })
25
+ :
26
+ _jsx(_Fragment, { children: "Connect Now" }) })] })] }) });
21
27
  };
22
28
  export default ConnectWalletButton;
@@ -2,7 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useEffect, useState } from "react";
3
3
  import { SwapStatus } from "../../Models/SwapStatus";
4
4
  import { TransactionType } from "../../lib/apiClients/layerSwapApiClient";
5
- // import posthog from "posthog-js";
6
5
  const CountdownTimer = ({ initialTime, swapDetails, onThresholdChange }) => {
7
6
  const [elapsedTimer, setElapsedTimer] = useState(0);
8
7
  const [thresholdElapsed, setThresholdElapsed] = useState(false);
@@ -33,20 +32,6 @@ const CountdownTimer = ({ initialTime, swapDetails, onThresholdChange }) => {
33
32
  return `${formattedHours}${formattedMinutes}:${formattedSeconds}`;
34
33
  };
35
34
  const formatted = formatTime(elapsedTimer);
36
- if (thresholdElapsed && swapDetails.status !== SwapStatus.Completed) {
37
- const renderingError = new Error("Transaction is taking longer than expected");
38
- renderingError.name = `LongTransactionError`;
39
- renderingError.cause = renderingError;
40
- // posthog.capture('$exception', {
41
- // name: renderingError.name,
42
- // message: renderingError.message,
43
- // $layerswap_exception_type: "Long Transaction Error",
44
- // stack: renderingError.stack,
45
- // cause: renderingError.cause,
46
- // where: 'longTransactionError',
47
- // severity: 'error',
48
- // });
49
- }
50
35
  return (_jsx("div", { className: 'flex items-center justify-center space-x-1', children: swapDetails.status === SwapStatus.Completed ? ("") : (_jsxs("div", { className: 'text-secondary-text flex items-center', children: [_jsx("span", { children: "Elapsed time:" }), _jsx("span", { className: 'text-primary-text ml-0.5', children: formatted })] })) }));
51
36
  };
52
37
  export default CountdownTimer;
@@ -1,10 +1,12 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AlertOctagon, Scroll } from "lucide-react";
2
+ import { Scroll } from "lucide-react";
3
+ import InfoIcon from "../../components/Icons/InfoIcon";
4
+ import { ICON_CLASSES_WARNING } from "../../components/Pages/Swap/Form/SecondaryComponents/validationError/constants";
3
5
  function constructIcons(messageType) {
4
6
  let iconStyle;
5
7
  switch (messageType) {
6
8
  case 'warning':
7
- iconStyle = _jsx(AlertOctagon, { className: "sm:h-5 h-4 text-primary-text inline sm:block" });
9
+ iconStyle = _jsx(InfoIcon, { className: ICON_CLASSES_WARNING });
8
10
  break;
9
11
  case 'informing':
10
12
  iconStyle = _jsx(Scroll, { className: "sm:h-5 h-4 text-primary-text inline sm:block" });
@@ -1,12 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
3
  import SecondaryButton from "../Buttons/secondaryButton";
4
- import { DocIframe } from "./docInIframe";
5
- import Modal from "../Modal/modal";
6
4
  export default function GuideLink({ userGuideUrl, text, button, buttonClassNames }) {
7
5
  const [showGuide, setShowGuide] = useState(false);
8
- return (_jsxs(_Fragment, { children: [button ?
9
- _jsx(SecondaryButton, { onClick: () => setShowGuide(true), className: buttonClassNames, children: button })
10
- :
11
- _jsxs("span", { className: 'text-primary cursor-pointer hover:text-primary-400', onClick: () => setShowGuide(true), children: ["\u00A0", _jsx("span", { children: text })] }), _jsx(Modal, { className: "bg-[#181c1f]", height: "full", header: text || button, show: showGuide, setShow: setShowGuide, modalId: "guide", children: _jsx(DocIframe, { onConfirm: () => setShowGuide(false), URl: userGuideUrl }) })] }));
6
+ return (_jsx(_Fragment, { children: button ?
7
+ _jsx(SecondaryButton, { onClick: () => setShowGuide(true), className: buttonClassNames, children: button })
8
+ :
9
+ _jsxs("a", { target: "_blank", href: userGuideUrl, className: 'text-primary cursor-pointer hover:text-primary-400', children: ["\u00A0", _jsx("span", { children: text })] }) }));
12
10
  }
@@ -1,22 +1,22 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useCallback } from "react";
2
+ import { useCallback, useEffect } from "react";
3
3
  import { useIntercom } from "react-use-intercom";
4
4
  import { Home, RotateCcw } from "lucide-react";
5
- // import posthog from "posthog-js";
6
5
  import MessageComponent from "./Common/MessageComponent";
7
6
  import NotFoundIcon from "./Icons/NotFoundIcon";
8
7
  import SubmitButton from "./Buttons/submitButton";
8
+ import { ErrorHandler } from "../lib/ErrorHandler";
9
9
  export default function ErrorFallback({ error, resetErrorBoundary }) {
10
10
  const { boot, show } = useIntercom();
11
- // useEffect(() => {
12
- // posthog.capture('$exception', {
13
- // name: error?.name,
14
- // $layerswap_exception_type: "Error Fallback",
15
- // message: error?.message,
16
- // where: 'ErrorFallback',
17
- // severity: 'error',
18
- // });
19
- // }, [])
11
+ useEffect(() => {
12
+ ErrorHandler({
13
+ type: "ErrorFallback",
14
+ message: error.message,
15
+ name: error.name,
16
+ stack: error.stack,
17
+ cause: error.cause
18
+ });
19
+ }, [error]);
20
20
  const startIntercom = useCallback(() => {
21
21
  boot();
22
22
  show();
@@ -13,7 +13,7 @@ function HeaderWithMenu({ goBack, contextualMenu }) {
13
13
  LayerSwapApiClient.apiKey !== AppSettings.LayerswapApiKeys['testnet'];
14
14
  const headerConfigs = AppSettings.ThemeData?.header;
15
15
  return (_jsxs("div", { className: "items-center justify-between sm:flex sm:items-center grid grid-cols-5 w-full sm:grid-cols-none sm:grid-none mt-2 pb-2 px-4", children: [_jsx("div", { className: "self-center col-start-1 md:col-start-2 md:col-span-3 justify-self-start md:justify-self-center flex items-center gap-2", children: goBack ?
16
- _jsx(IconButton, { onClick: goBack, "aria-label": "Go back", className: "-ml-2 inline-flex", icon: _jsx(ArrowLeft, { strokeWidth: "2" }) })
16
+ _jsx("div", { className: "ml-0", children: _jsx(IconButton, { onClick: goBack, "aria-label": "Go back", icon: _jsx(ArrowLeft, { strokeWidth: "2" }) }) })
17
17
  :
18
18
  headerConfigs?.hideTabs ? null :
19
19
  AppSettings.ThemeData?.enableWideVersion == true ?
@@ -0,0 +1,3 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ const Xverse = (props) => _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "300", height: "300", viewBox: "0 0 300 300", fill: "none", ...props, children: [_jsx("rect", { width: "300", height: "300", fill: "#0F0F0F" }), _jsx("path", { d: "M266 265.11V221.791C266 220.073 265.329 218.435 264.132 217.218L82.9028 32.8997C81.7061 31.6825 80.0952 31 78.4064 31H35.8141C33.7113 31 32 32.7405 32 34.8791V75.1258C32 76.8435 32.6711 78.4815 33.8679 79.6987L98.9197 145.859C100.407 147.372 100.407 149.829 98.9197 151.342L33.1185 218.264C32.4027 218.992 32 219.982 32 221.006V265.11C32 267.246 33.7113 268.989 35.8141 268.989H106.984C109.087 268.989 110.798 267.246 110.798 265.11V239.127C110.798 238.103 111.201 237.114 111.917 236.386L147.216 200.484C148.704 198.971 151.12 198.971 152.608 200.484L218.107 267.1C219.303 268.317 220.914 269 222.603 269H262.175C264.278 269 265.989 267.258 265.989 265.121L266 265.11Z", fill: "white" }), _jsx("path", { d: "M170.853 88.6326H206.533C208.648 88.6326 210.372 90.3964 210.372 92.5611V129.062C210.372 132.567 214.515 134.32 216.933 131.834L265.879 81.6807C266.595 80.9475 267 79.9512 267 78.9089V34.9857C267 32.8211 265.285 31.0573 263.159 31.0573L219.586 31C218.568 31 217.594 31.4123 216.866 32.1453L168.132 81.9211C165.714 84.395 167.427 88.6326 170.842 88.6326H170.853Z", fill: "#EE7A30" })] });
3
+ export default Xverse;
@@ -22,3 +22,4 @@ export { default as BraavosIcon } from "./Braavos";
22
22
  export { default as ArgentXIcon } from "./ArgentX";
23
23
  export { default as FueletIcon } from "./Fuelet";
24
24
  export { default as KeplrIcon } from "./Keplr";
25
+ export { default as XverseIcon } from "./Xverse";
@@ -10,7 +10,7 @@ import AddressBook from "./AddressBook";
10
10
  import AddressButton from "./AddressButton";
11
11
  import { useInitialSettings } from "../../../../context/settings";
12
12
  import ConnectedWallets from "./ConnectedWallets";
13
- import { useSelectedAccount, useUpdateBalanceAccount } from "../../../../context/balanceAccounts";
13
+ import { useSelectedAccount, useSelectSwapAccount } from "../../../../context/swapAccounts";
14
14
  import VaulDrawer from "../../../../components/Modal/vaulModal";
15
15
  export var AddressGroup;
16
16
  (function (AddressGroup) {
@@ -22,14 +22,15 @@ export var AddressGroup;
22
22
  const AddressPicker = forwardRef(function Address({ showAddressModal, setShowAddressModal, name, canFocus, close, address_book, partner, children }, ref) {
23
23
  const { values, setFieldValue } = useFormikContext();
24
24
  const initialSettings = useInitialSettings();
25
- const { destination_address, to: destination } = values;
26
- const selectDestinationAccount = useUpdateBalanceAccount("to");
27
- const { provider, unAvailableWallets } = useWallet(destination, 'autofil');
25
+ const { destination_address, to: destination, toExchange } = values;
26
+ const selectDestinationAccount = useSelectSwapAccount("to");
27
+ const { provider, unAvailableWallets } = useWallet(destination, 'autofill');
28
28
  const connectedWallets = provider?.connectedWallets?.filter(w => !w.isNotAvailable) || [];
29
29
  const defaultAccount = useSelectedAccount("to", values.to?.name);
30
30
  const connectedWalletskey = connectedWallets?.map(w => w.addresses.join('')).join('');
31
31
  const [manualAddress, setManualAddress] = useState('');
32
- const [newAddress, setNewAddress] = useState();
32
+ // Get manually added address from context (shared across all AddressPicker instances)
33
+ const manualAddressFromContext = defaultAccount?.id === 'manually_added' ? defaultAccount.address : undefined;
33
34
  useEffect(() => {
34
35
  if (destination_address && destination && !isValidAddress(destination_address, destination)) {
35
36
  updateDestAddress('');
@@ -42,10 +43,11 @@ const AddressPicker = forwardRef(function Address({ showAddressModal, setShowAdd
42
43
  address_book,
43
44
  destination,
44
45
  wallets: connectedWallets,
45
- newAddress,
46
- addressFromQuery: initialSettings.destination_address
46
+ manualAddressFromContext,
47
+ addressFromQuery: initialSettings.destination_address,
48
+ destination_address
47
49
  });
48
- }, [address_book, destination, connectedWallets, newAddress, initialSettings.destination_address, connectedWalletskey]);
50
+ }, [address_book, destination, connectedWallets, manualAddressFromContext, initialSettings.destination_address, connectedWalletskey]);
49
51
  const destinationAddressItem = destination && destination_address ?
50
52
  groupedAddresses?.find(a => a.address.toLowerCase() === destination_address.toLowerCase())
51
53
  : undefined;
@@ -102,13 +104,13 @@ const AddressPicker = forwardRef(function Address({ showAddressModal, setShowAdd
102
104
  return (_jsxs(_Fragment, { children: [_jsx(AddressButton, { addressItem: destinationAddressItem, openAddressModal: () => setShowAddressModal(true), connectedWallet: connectedWallet, partner: partner, destination: destination, children: children({ destination, addressItem: destinationAddressItem, connectedWallet: connectedWallet, partner }) }), _jsx(VaulDrawer, { header: 'Send To', show: showAddressModal, setShow: setShowAddressModal, modalId: "address", children: _jsx(VaulDrawer.Snap, { id: "item-1", children: _jsx("div", { className: 'w-full flex flex-col justify-between h-full text-primary-text min-h-[200px]', children: _jsxs("div", { className: 'flex flex-col self-center grow w-full space-y-5 h-full', children: [destination
103
105
  && provider
104
106
  && !connectedWallets.length &&
105
- _jsx(ConnectWalletButton, { provider: provider, onConnect: onConnect }), _jsx(ManualAddressInput, { manualAddress: manualAddress, setManualAddress: setManualAddress, setNewAddress: (props) => { setNewAddress(props); updateDestAddress(props?.address); }, values: values, partner: partner, name: name, inputReference: inputReference, setFieldValue: setFieldValue, close: close, addresses: groupedAddresses, connectedWallet: connectedWallet }), destination
107
+ _jsx(ConnectWalletButton, { provider: provider, onConnect: onConnect }), _jsx(ManualAddressInput, { manualAddress: manualAddress, setManualAddress: setManualAddress, setNewAddress: (props) => updateDestAddress(props?.address), values: values, partner: partner, name: name, inputReference: inputReference, setFieldValue: setFieldValue, close: close, addresses: groupedAddresses, connectedWallet: connectedWallet }), destination
106
108
  && provider
107
109
  && !manualAddress &&
108
110
  _jsx(ConnectedWallets, { provider: provider, notCompatibleWallets: unAvailableWallets, onClick: (props) => handleSelectAddress(props.address), onConnect: onConnect, destination: destination, destination_address: destination_address }), addressBookAddresses && addressBookAddresses?.length > 0 && !manualAddress && destination &&
109
111
  _jsx(AddressBook, { addressBook: addressBookAddresses, onSelectAddress: handleSelectAddress, destination: destination, destination_address: destination_address, partner: partner })] }) }) }) })] }));
110
112
  });
111
- const resolveAddressGroups = ({ address_book, destination, wallets, newAddress, addressFromQuery, }) => {
113
+ const resolveAddressGroups = ({ address_book, destination, wallets, manualAddressFromContext, addressFromQuery, destination_address, }) => {
112
114
  if (!destination)
113
115
  return;
114
116
  const filteredAddressBook = address_book?.filter(a => a.networks?.some(n => destination?.name === n) && isValidAddress(a.address, destination)) || [];
@@ -125,8 +127,9 @@ const resolveAddressGroups = ({ address_book, destination, wallets, newAddress,
125
127
  if (recentlyUsedAddresses.length > 0) {
126
128
  addresses = [...addresses, ...recentlyUsedAddresses];
127
129
  }
128
- if (newAddress?.address && newAddress.networkType === destination?.type) {
129
- addresses.push({ address: newAddress.address, group: AddressGroup.ManualAdded });
130
+ // Include manually added address from context (shared across all instances)
131
+ if (manualAddressFromContext && isValidAddress(manualAddressFromContext, destination)) {
132
+ addresses.push({ address: manualAddressFromContext, group: AddressGroup.ManualAdded });
130
133
  }
131
134
  const uniqueAddresses = addresses.filter((a, index, self) => self.findIndex(t => addressFormat(t.address, destination) === addressFormat(a.address, destination)) === index);
132
135
  return uniqueAddresses;
@@ -1,6 +1,6 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { truncateDecimals } from "../../../components/utils/RoundDecimals";
3
- import { useSelectedAccount } from "../../../context/balanceAccounts";
3
+ import { useSelectedAccount } from "../../../context/swapAccounts";
4
4
  import { useBalance } from "../../../lib/balances/useBalance";
5
5
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/shadcn/tooltip";
6
6
  import InfoIcon from "../../../components/Icons/InfoIcon";
@@ -18,7 +18,7 @@ const Balance = ({ values, direction }) => {
18
18
  return _jsx("div", { className: "min-w-4/5 p-1 mx-2 relative rounded-b-lg text-center bg-secondary-400 py-0.5 text-xs text-secondary-text leading-[18px] font-normal", children: isLoading ?
19
19
  _jsx("div", { className: 'h-[10px] w-fit px-4 inline-flex bg-gray-500 rounded-xs animate-pulse' })
20
20
  : !truncatedBalance ?
21
- _jsxs("div", { className: "flex items-center justify-center gap-1 text-orange-400", children: [_jsx(InfoIcon, { className: 'w-3 h-3' }), _jsx("span", { children: "Network issue" })] })
21
+ _jsx(NetworkIssue, { network: network })
22
22
  : (network && token && truncatedBalance) ?
23
23
  ((Number(tokenBalance?.amount) >= 0 && Number(tokenBalance?.amount) < Number(values.amount) && values.depositMethod === 'wallet' && direction == 'from') ?
24
24
  _jsx(InsufficientBalance, { balance: truncatedBalance })
@@ -26,6 +26,12 @@ const Balance = ({ values, direction }) => {
26
26
  _jsx("span", { children: truncatedBalance }))
27
27
  : null });
28
28
  };
29
+ const NetworkIssue = ({ network }) => {
30
+ return _jsxs(Tooltip, { openOnClick: true, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: "flex items-center gap-1 text-warning-foreground justify-center", children: [_jsx(InfoIcon, { className: 'w-3 h-3' }), _jsx("p", { children: "Network issue" })] }) }), _jsx(TooltipContent, { className: "!bg-secondary-400 !border-0 !p-3 !rounded-xl", children: _jsxs("div", { className: "flex items-center gap-2 justify-center max-w-[300px]", children: [_jsx("div", { className: "w-4 h-4", children: _jsx(InfoIcon, { className: 'w-4 h-4 text-warning-foreground' }) }), _jsx("p", { className: "text-sm", children: _jsxs("span", { children: [_jsx("span", { children: "We are currently unable to retrieve balance information for " }), _jsx("span", { children: network?.display_name ?
31
+ _jsx("span", { children: network?.display_name })
32
+ :
33
+ _jsx("span", { children: "the network" }) })] }) })] }) })] });
34
+ };
29
35
  const InsufficientBalance = ({ balance }) => {
30
36
  return _jsxs(Tooltip, { openOnClick: true, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsxs("div", { className: "flex items-center gap-1 text-warning-foreground justify-center", children: [_jsx(InfoIcon, { className: 'w-3 h-3' }), _jsx("p", { children: balance })] }) }), _jsx(TooltipContent, { className: "!bg-secondary-400 !border-0 !p-3 !rounded-xl", children: _jsxs("div", { className: "flex items-center gap-2 justify-center", children: [_jsx(InfoIcon, { className: 'w-4 h-4 text-warning-foreground' }), _jsx("p", { className: "text-sm", children: "Insufficient balance" })] }) })] });
31
37
  };
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import NumberFlow from "@number-flow/react";
3
+ import clsx from "clsx";
4
+ export const ExchangeReceiveAmount = ({ destination_token, fee, isFeeLoading }) => {
5
+ const receive_amount = fee?.quote.receive_amount;
6
+ const receiveAmountInUsd = receive_amount && destination_token && fee.quote?.destination_token?.price_in_usd ? (receive_amount * fee.quote.destination_token.price_in_usd).toFixed(2) : undefined;
7
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "w-full flex min-w-0 font-normal border-0 text-xl text-primary-text relative truncate items-baseline flex-row", children: [_jsx("div", { className: "flex items-center justify-start relative w-fit", children: _jsxs("div", { className: clsx("w-full flex items-center py-[3px] pr-2", { "animate-pulse-stronger": isFeeLoading }, { "text-secondary-text": !receive_amount }), children: [_jsx(NumberFlow, { value: receive_amount || 0, trend: 0, format: { maximumFractionDigits: fee?.quote.destination_token?.decimals || 2 } }), _jsx("span", { className: "ml-1", children: destination_token?.symbol })] }) }), _jsx("div", { className: "flex items-baseline space-x-2 mt-1.5", children: _jsx("span", { className: "text-sm leading-4 font-medium text-secondary-text h-5", children: _jsx(NumberFlow, { className: "p-0", value: Number(receiveAmountInUsd) || 0, format: { style: 'currency', currency: 'USD', maximumFractionDigits: receiveAmountInUsd ? 2 : 0 }, trend: 0 }) }) })] }) }));
8
+ };
@@ -4,7 +4,7 @@ import useSWRGas from "../../../lib/gases/useSWRGas";
4
4
  import { useMemo } from "react";
5
5
  import { resolveMaxAllowedAmount } from "./helpers";
6
6
  import { Tooltip, TooltipContent, TooltipTrigger } from "../../../components/shadcn/tooltip";
7
- import { useSelectedAccount } from "../../../context/balanceAccounts";
7
+ import { useSelectedAccount } from "../../../context/swapAccounts";
8
8
  import { useBalance } from "../../../lib/balances/useBalance";
9
9
  import useWallet from "../../../hooks/useWallet";
10
10
  const MinMax = (props) => {
@@ -3,45 +3,12 @@ import { useMemo } from "react";
3
3
  import { Triangle } from "lucide-react";
4
4
  import { Tooltip, TooltipArrow, TooltipContent, TooltipTrigger } from "../../../components/shadcn/tooltip";
5
5
  import clsx from 'clsx';
6
- export const PriceImpact = ({ receiveAmount, requestedAmount, sourceTokenPriceUsd, destinationTokenPriceUsd, serviceFee, bridgeFee, className, }) => {
7
- const toAmountUSD = useMemo(() => {
8
- if (!receiveAmount || !destinationTokenPriceUsd)
9
- return undefined;
10
- return receiveAmount * destinationTokenPriceUsd;
11
- }, [receiveAmount, destinationTokenPriceUsd]);
12
- const fromAmountUSD = useMemo(() => {
13
- if (!requestedAmount || !sourceTokenPriceUsd)
14
- return undefined;
15
- return requestedAmount * sourceTokenPriceUsd;
16
- }, [requestedAmount, sourceTokenPriceUsd]);
17
- const priceImpact = useMemo(() => {
18
- if (fromAmountUSD === undefined || toAmountUSD === undefined)
19
- return undefined;
20
- return (toAmountUSD - fromAmountUSD);
21
- }, [fromAmountUSD, toAmountUSD]);
22
- const layerswapFees = useMemo(() => {
23
- if (serviceFee == null || sourceTokenPriceUsd == null)
24
- return undefined;
25
- return (serviceFee * sourceTokenPriceUsd);
26
- }, [serviceFee, sourceTokenPriceUsd]);
27
- const bridgeExpenses = useMemo(() => {
28
- if (bridgeFee == null || sourceTokenPriceUsd == null)
29
- return undefined;
30
- return (bridgeFee * sourceTokenPriceUsd);
31
- }, [bridgeFee, sourceTokenPriceUsd]);
32
- const marketImpact = useMemo(() => {
33
- if (priceImpact === undefined || layerswapFees === undefined || bridgeExpenses === undefined)
34
- return undefined;
35
- return (priceImpact + Number(layerswapFees) + Number(bridgeExpenses));
36
- }, [priceImpact, layerswapFees, bridgeExpenses]);
37
- const priceImpactPercentage = useMemo(() => {
38
- if (fromAmountUSD === undefined || toAmountUSD === undefined)
39
- return undefined;
40
- return Number((((toAmountUSD - fromAmountUSD) / fromAmountUSD) * 100).toFixed(2));
41
- }, [fromAmountUSD, toAmountUSD]);
42
- if (priceImpact === undefined)
6
+ import { resolvePriceImpactValues } from "../../../lib/fees";
7
+ export const PriceImpact = ({ quote, className }) => {
8
+ const priceImpactValues = useMemo(() => quote ? resolvePriceImpactValues(quote) : undefined, [quote]);
9
+ if (priceImpactValues === undefined)
43
10
  return null;
44
- return (_jsx(_Fragment, { children: _jsxs(Tooltip, { openOnClick: true, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: clsx("flex text-secondary-text items-center cursor-default hover:text-primary-text", className), children: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsx("span", { children: "(" }), _jsx(Triangle, { fill: "currentColor", className: `w-3.5 h-3.5 stroke-1 fill-current transition-transform ${priceImpact < 0 ? "rotate-180" : ""}` }), _jsxs("span", { children: ["$", Math.abs(priceImpact).toFixed(2)] }), _jsx("span", { children: ")" })] }) }) }), _jsxs(TooltipContent, { arrowClasses: "!bg-secondary-500 !fill-secondary-500", side: "top", align: "center", className: "!bg-secondary-500 !border-secondary-500 !text-secondary-text text-xs font-normal rounded-xl !p-4 shadow-card", children: [_jsxs("p", { className: "text-primary-text font-medium text-sm flex items-baseline space-x-0.5 mb-1", children: [_jsx("span", { children: "Price impact:" }), _jsx("span", { children: formatCurrency(priceImpact) }), _jsx("span", { className: "text-secondary-text text-xs font-normal", children: priceImpactPercentage ? `(${priceImpact < 0 ? "-" : "+"}${Math.abs(priceImpactPercentage)}%)` : "" })] }), _jsx("p", { children: "This is the difference in total USD value" }), _jsx("p", { children: "between the assets you send and the assets you receive." }), _jsxs("ul", { className: "mt-3 space-y-2 ", children: [_jsxs("li", { className: "list-none flex justify-between", children: [_jsx("span", { children: "Market impact" }), _jsx("span", { className: "text-primary-text", children: _jsx("span", { children: formatCurrency(marketImpact) }) })] }), _jsxs("li", { className: "list-none flex justify-between", children: [_jsx("span", { children: "Bridge expenses" }), _jsxs("span", { className: "text-primary-text", children: [_jsx("span", { children: bridgeExpenses?.toFixed(2) !== (0).toFixed(2) ? "-$" : "$" }), _jsx("span", { children: Math.abs(Number(bridgeExpenses)).toFixed(2) })] })] }), _jsxs("li", { className: "list-none flex justify-between", children: [_jsx("span", { children: "Layerswap fees" }), _jsxs("span", { className: "text-primary-text", children: [_jsx("span", { children: layerswapFees?.toFixed(2) !== (0).toFixed(2) ? "-$" : "$" }), _jsx("span", { children: Math.abs(Number(layerswapFees)).toFixed(2) })] })] })] }), _jsx(TooltipArrow, { className: "!bg-secondary-500 !fill-secondary-500" })] })] }) }));
11
+ return (_jsx(_Fragment, { children: _jsxs(Tooltip, { openOnClick: true, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("span", { className: clsx("flex text-secondary-text items-center cursor-default hover:text-primary-text", className, { "text-warning-foreground hover:text-warning-foreground/80": priceImpactValues.highMarketPriceImpact }), children: _jsxs("span", { className: "flex items-center gap-0.5", children: [_jsx("span", { children: "(" }), _jsx(Triangle, { fill: "currentColor", className: `w-3 h-3 stroke-1 fill-current transition-transform ${priceImpactValues.priceImpact !== undefined && priceImpactValues.priceImpact < 0 ? "rotate-180" : ""}` }), _jsxs("span", { children: ["$", Math.abs(priceImpactValues.priceImpact || 0).toFixed(2)] }), _jsx("span", { children: ")" })] }) }) }), _jsxs(TooltipContent, { arrowClasses: "!bg-secondary-500 !fill-secondary-500", side: "top", align: "center", className: "bg-secondary-500! border-secondary-500! text-secondary-text! text-xs font-normal rounded-xl p-4! shadow-card", children: [_jsxs("p", { className: clsx("text-primary-text font-medium text-sm flex items-baseline space-x-0.5 mb-1", { "text-warning-foreground": priceImpactValues.highMarketPriceImpact }), children: [priceImpactValues.highMarketPriceImpact ? (priceImpactValues.criticalMarketPriceImpact ? _jsx("span", { children: "Critical price impact:" }) : _jsx("span", { children: "High price impact:" })) : _jsx("span", { children: "Price impact:" }), _jsx("span", { children: formatCurrency(priceImpactValues.priceImpact) }), _jsx("span", { className: clsx("text-secondary-text text-xs font-normal", { "text-warning-foreground": priceImpactValues.highMarketPriceImpact }), children: priceImpactValues.priceImpactPercentage ? `(${priceImpactValues.priceImpactPercentage < 0 ? "-" : "+"}${Math.abs(priceImpactValues.priceImpactPercentage)}%)` : "" })] }), _jsx("p", { children: "This is the difference in total USD value" }), _jsx("p", { children: "between the assets you send and the assets you receive." }), _jsxs("ul", { className: "mt-3 space-y-2 ", children: [_jsxs("li", { className: "list-none flex justify-between", children: [_jsx("span", { children: "Market impact" }), _jsx("span", { className: "text-primary-text", children: _jsx("span", { children: formatCurrency(priceImpactValues.marketImpact) }) })] }), _jsxs("li", { className: "list-none flex justify-between", children: [_jsx("span", { children: "Bridge expenses" }), _jsxs("span", { className: "text-primary-text", children: [_jsx("span", { children: priceImpactValues.bridgeExpenses?.toFixed(2) !== (0).toFixed(2) ? "-$" : "$" }), _jsx("span", { children: Math.abs(Number(priceImpactValues.bridgeExpenses)).toFixed(2) })] })] }), _jsxs("li", { className: "list-none flex justify-between", children: [_jsx("span", { children: "Layerswap fees" }), _jsxs("span", { className: "text-primary-text", children: [_jsx("span", { children: priceImpactValues.layerswapFees?.toFixed(2) !== (0).toFixed(2) ? "-$" : "$" }), _jsx("span", { children: Math.abs(Number(priceImpactValues.layerswapFees)).toFixed(2) })] })] })] }), _jsx(TooltipArrow, { className: "bg-secondary-500! fill-secondary-500!" })] })] }) }));
45
12
  };
46
13
  const formatCurrency = (value, decimals = 2) => {
47
14
  if (value === undefined || isNaN(value))
@@ -2,9 +2,9 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
2
2
  import NumberFlow from "@number-flow/react";
3
3
  import clsx from "clsx";
4
4
  import { PriceImpact } from "./PriceImpact";
5
- export const ReceiveAmount = ({ source_token, destination_token, fee, isFeeLoading }) => {
5
+ export const ReceiveAmount = ({ destination_token, fee, isFeeLoading }) => {
6
6
  const receive_amount = fee?.quote.receive_amount;
7
7
  const receiveAmountInUsd = receive_amount && destination_token && fee.quote?.destination_token?.price_in_usd ? (receive_amount * fee.quote.destination_token.price_in_usd).toFixed(2) : undefined;
8
8
  const quote = fee?.quote;
9
- return (_jsx(_Fragment, { children: _jsxs("div", { className: "flex flex-col min-w-0 font-normal border-0 text-[28px] leading-7 text-primary-text w-full relative truncate", children: [_jsx("div", { className: "flex items-center justify-start w-full relative", children: _jsx("div", { className: clsx("w-full flex items-center pt-2 pr-3", { "animate-pulse-stronger": isFeeLoading }, { "text-secondary-text": !receive_amount }), children: _jsx(NumberFlow, { value: receive_amount || 0, trend: 0, format: { maximumFractionDigits: fee?.quote.destination_token?.decimals || 2 } }) }) }), _jsxs("div", { className: "flex items-baseline space-x-2 h-5", children: [_jsx("span", { className: "text-base leading-5 font-medium text-secondary-text h-5", children: _jsx(NumberFlow, { className: "p-0", value: Number(receiveAmountInUsd) || 0, format: { style: 'currency', currency: 'USD', maximumFractionDigits: receiveAmountInUsd ? 2 : 0 }, trend: 0 }) }), _jsx(PriceImpact, { className: "h-5 text-base leading-5", bridgeFee: quote?.blockchain_fee, destinationTokenPriceUsd: quote?.destination_token?.price_in_usd, receiveAmount: quote?.receive_amount, requestedAmount: quote?.requested_amount, serviceFee: quote?.service_fee, sourceTokenPriceUsd: quote?.source_token?.price_in_usd })] })] }) }));
9
+ return (_jsx(_Fragment, { children: _jsxs("div", { className: "flex-col w-full flex min-w-0 font-normal border-0 text-[28px] leading-7 text-primary-text relative truncate", children: [_jsx("div", { className: "w-full flex items-center justify-start relative", children: _jsx("div", { className: clsx("w-full flex items-center pt-2 pr-3", { "animate-pulse-stronger": isFeeLoading }, { "text-secondary-text": !receive_amount }), children: _jsx(NumberFlow, { value: receive_amount || 0, trend: 0, format: { maximumFractionDigits: fee?.quote.destination_token?.decimals || 2 } }) }) }), _jsxs("div", { className: "flex items-baseline space-x-2 h-5", children: [_jsx("span", { className: "text-base leading-5 font-medium text-secondary-text h-5", children: _jsx(NumberFlow, { className: "p-0", value: Number(receiveAmountInUsd) || 0, format: { style: 'currency', currency: 'USD', maximumFractionDigits: receiveAmountInUsd ? 2 : 0 }, trend: 0 }) }), _jsx(PriceImpact, { className: "h-5 text-base leading-5", quote: quote })] })] }) }));
10
10
  };
@@ -38,10 +38,10 @@ const AmountField = forwardRef(function AmountField({ usdPosition = "bottom", ac
38
38
  const disabled = Boolean(fromExchange && !toCurrency);
39
39
  return (_jsx(_Fragment, { children: _jsxs("div", { className: clsx("flex flex-col bg-secondary-500 space-y-0.5 relative w-full group", className, {
40
40
  'focus-within:[&_.usd-suffix]:invisible': usdPosition === "right"
41
- }), children: [_jsx(NumericInput, { disabled: disabled, placeholder: placeholder, step: isNaN(step) ? 0.01 : step, name: name, ref: amountRef, precision: fromCurrency?.precision, tempValue: actionValue, className: "w-full text-[28px] leading-[34px] pt-2 rounded-xl text-primary-text focus:outline-none focus:border-none focus:ring-0 duration-300 ease-in-out !bg-secondary-500 !font-normal group-[.exchange-amount-field]:px-2.5 group-[.exchange-amount-field]:pb-2 group-[.exchange-amount-field]:pr-2 group-[.exchange-amount-field]:bg-secondary-300! pl-0", onChange: e => {
41
+ }), children: [_jsx(NumericInput, { disabled: disabled, placeholder: placeholder, step: isNaN(step) ? 0.01 : step, name: name, ref: amountRef, precision: fromCurrency?.precision, tempValue: actionValue, className: "w-full text-[28px] leading-[34px] rounded-xl text-primary-text focus:outline-none focus:border-none focus:ring-0 duration-300 ease-in-out !bg-secondary-500 !font-normal group-[.exchange-amount-field]:px-2.5 group-[.exchange-amount-field]:pb-2 group-[.exchange-amount-field]:pr-2 group-[.exchange-amount-field]:bg-secondary-300! group-[.exchange-amount-field]:pt-2! pl-0", onChange: e => {
42
42
  /^[0-9]*[.,]?[0-9]*$/.test(e.target.value) && handleChange(e);
43
- } }), _jsx("div", { className: clsx("usd-suffix text-base leading-5 font-medium text-secondary-text pointer-events-none", {
44
- "absolute bottom-3": usdPosition === "right",
43
+ } }), _jsx("div", { className: clsx("usd-suffix text-base group-[.exchange-amount-field]:text-sm leading-5 font-medium text-secondary-text pointer-events-none", {
44
+ "absolute bottom-[11px]": usdPosition === "right",
45
45
  "h-5": usdPosition !== "right",
46
46
  "text-secondary-text/45": !!actionValueInUsd
47
47
  }, "group-hover:block"), ref: suffixRef, children: `${actionValueInUsd ?? requestedAmountInUsd ?? '$0'}` })] }) }));
@@ -11,12 +11,12 @@ import { useSwapDataState } from "../../context/swap";
11
11
  const DestinationPicker = (props) => {
12
12
  const { partner } = props;
13
13
  const { values } = useFormikContext();
14
- const { fromAsset: fromCurrency, toAsset: toCurrency } = values;
14
+ const { toAsset: toCurrency } = values;
15
15
  const quoteArgs = useMemo(() => transformFormValuesToQuoteArgs(values, true), [values]);
16
16
  const { swapId } = useSwapDataState();
17
17
  const quoteRefreshInterval = !!swapId ? 0 : undefined;
18
18
  const { quote, isQuoteLoading } = useQuoteData(quoteArgs, quoteRefreshInterval);
19
- return _jsxs("div", { className: "flex flex-col w-full bg-secondary-500 rounded-2xl p-4 pb-[15px] space-y-[27px]", children: [_jsxs("div", { className: "grid grid-cols-9 gap-2 items-center h-7", children: [_jsx("label", { htmlFor: "To", className: "block col-span-4 font-normal text-secondary-text text-base leading-5 w-30", children: "Receive at" }), _jsx("div", { className: "col-span-5 justify-self-end", children: _jsx(Address, { partner: partner, children: ({ destination, addressItem, connectedWallet, partner }) => _jsx(DestinationWalletPicker, { destination: destination, addressItem: addressItem, connectedWallet: connectedWallet, partner: partner }) }) })] }), _jsx("div", { className: "items-center space-y-2", children: _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-2 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(ReceiveAmount, { source_token: fromCurrency, destination_token: toCurrency, fee: quote, isFeeLoading: isQuoteLoading }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "to" }) })] }) })] });
19
+ return _jsxs("div", { className: "flex flex-col w-full bg-secondary-500 rounded-2xl p-4 pb-[15px] space-y-[27px]", children: [_jsxs("div", { className: "grid grid-cols-9 gap-2 items-center h-7", children: [_jsx("label", { htmlFor: "To", className: "block col-span-4 font-normal text-secondary-text text-base leading-5 w-30", children: "Receive at" }), _jsx("div", { className: "col-span-5 justify-self-end", children: _jsx(Address, { partner: partner, children: ({ destination, addressItem, connectedWallet, partner }) => _jsx(DestinationWalletPicker, { destination: destination, addressItem: addressItem, connectedWallet: connectedWallet, partner: partner }) }) })] }), _jsx("div", { className: "items-center space-y-2", children: _jsxs("div", { className: "grid grid-cols-[1fr_auto] gap-2 w-full max-w-full", children: [_jsx("div", { className: "min-w-0 overflow-hidden", children: _jsx(ReceiveAmount, { destination_token: toCurrency, fee: quote, isFeeLoading: isQuoteLoading }) }), _jsx("div", { className: "justify-self-end self-start", children: _jsx(RoutePicker, { direction: "to" }) })] }) })] });
20
20
  };
21
21
  export const SecondDestinationWalletPicker = () => {
22
22
  return _jsxs("div", { className: " justify-center w-full pl-3 pr-2 py-2 bg-secondary-400 items-center flex font-light space-x-2 mx-auto rounded-lg focus-peer:ring-primary focus-peer:border-secondary-400 focus-peer:border focus-peer:ring-1 focus:outline-none disabled:cursor-not-allowed relative grow h-12 ", children: [_jsx(PlusIcon, { className: "stroke-1" }), " ", _jsx("span", { children: "Destination Address" })] });
@@ -4,12 +4,15 @@ import { forwardRef } from "react";
4
4
  import { classNames } from '../utils/classNames';
5
5
  import { isScientific } from "../utils/RoundDecimals";
6
6
  // Use with Formik
7
- const NumericInput = forwardRef(function NumericInput({ label, tempValue, disabled, placeholder, minLength, maxLength, precision, step, name, className, children, onChange, onFocus, onBlur }, ref) {
7
+ const NumericInput = forwardRef(function NumericInput({ label, disabled, tempValue, placeholder, minLength, maxLength, precision, step, name, className, children, onChange, onFocus, onBlur }, ref) {
8
8
  const { handleChange } = useFormikContext();
9
9
  const [field] = useField(name);
10
- const formattedTempValue = isScientific(tempValue)
11
- ? tempValue?.toFixed(precision ?? 0).replace(/\.?0+$/, '')
12
- : tempValue?.toString();
10
+ const formattedTempValue = tempValue ? isScientific(tempValue)
11
+ ? (!isNaN(Number(tempValue))
12
+ ? Number(tempValue).toFixed(precision ?? 0).replace(/\.?0+$/, '')
13
+ : '')
14
+ : tempValue?.toString()
15
+ : '';
13
16
  return _jsxs("div", { children: [label &&
14
17
  _jsx("label", { htmlFor: name, className: "block font-semibold text-secondary-text text-sm mb-1.5 w-full", children: label }), _jsxs("div", { className: "flex relative w-full", children: [Number(tempValue) > 0 &&
15
18
  _jsx("span", { className: classNames('py-2 flex text-secondary-text/45 items-center h-12 leading-4 bg-secondary-700 min-w-0 rounded-lg font-semibold border-0 ', className), ref: ref, children: _jsx("span", { children: formattedTempValue }) }), !tempValue &&