@multiversx/sdk-dapp-liquidity 2.0.0 → 2.1.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/all-networks--dfVLHLJ.js +2 -0
  2. package/all-networks-Czd8zS1n.mjs +4 -0
  3. package/api/checkAccount.js +1 -21
  4. package/api/checkAccount.mjs +13 -13
  5. package/api/confirmRate.js +1 -29
  6. package/api/confirmRate.mjs +17 -22
  7. package/api/getChains.js +1 -17
  8. package/api/getChains.mjs +10 -10
  9. package/api/getRate.js +1 -27
  10. package/api/getRate.mjs +17 -20
  11. package/api/getTokens.js +1 -22
  12. package/api/getTokens.mjs +14 -15
  13. package/api/getTokensBalances.js +1 -21
  14. package/api/getTokensBalances.mjs +13 -13
  15. package/api/getTransactions.js +1 -38
  16. package/api/getTransactions.mjs +25 -31
  17. package/api/index.js +1 -18
  18. package/api/index.mjs +16 -16
  19. package/api/sendTransactions.js +1 -32
  20. package/api/sendTransactions.mjs +19 -19
  21. package/api/tests/confirmRate.spec.js +1 -130
  22. package/api/tests/confirmRate.spec.mjs +44 -58
  23. package/api/tests/getChains.spec.js +1 -43
  24. package/api/tests/getChains.spec.mjs +15 -18
  25. package/api/tests/getRate.spec.js +1 -87
  26. package/api/tests/getRate.spec.mjs +35 -49
  27. package/api/tests/getTokens.spec.js +1 -68
  28. package/api/tests/getTokens.spec.mjs +23 -29
  29. package/api/tests/getTransactions.spec.js +1 -94
  30. package/api/tests/getTransactions.spec.mjs +35 -51
  31. package/api/tests/sendTransactions.spec.js +1 -96
  32. package/api/tests/sendTransactions.spec.mjs +44 -52
  33. package/constants/index.js +1 -4
  34. package/constants/index.mjs +2 -2
  35. package/default-D0Jk5ROI.mjs +4 -0
  36. package/default-DbU6vPaB.js +2 -0
  37. package/helpers/assertRateConfirmationMatchesIntent.d.ts +8 -0
  38. package/helpers/assertRateConfirmationMatchesIntent.js +2 -0
  39. package/helpers/assertRateConfirmationMatchesIntent.mjs +20 -0
  40. package/helpers/base64Utils.js +1 -31
  41. package/helpers/base64Utils.mjs +14 -24
  42. package/helpers/decodeLoginToken.js +1 -27
  43. package/helpers/decodeLoginToken.mjs +13 -18
  44. package/helpers/decodeToken.js +1 -39
  45. package/helpers/decodeToken.mjs +20 -31
  46. package/helpers/getApiURL.js +1 -7
  47. package/helpers/getApiURL.mjs +3 -5
  48. package/helpers/getBridgeURL.js +1 -7
  49. package/helpers/getBridgeURL.mjs +3 -5
  50. package/helpers/getDisplayName.js +1 -11
  51. package/helpers/getDisplayName.mjs +3 -8
  52. package/helpers/getMvxApiURL.js +1 -7
  53. package/helpers/getMvxApiURL.mjs +3 -5
  54. package/helpers/getMvxChainId.js +1 -7
  55. package/helpers/getMvxChainId.mjs +3 -5
  56. package/helpers/getMvxExplorerAddress.js +1 -7
  57. package/helpers/getMvxExplorerAddress.mjs +3 -5
  58. package/helpers/index.d.ts +2 -0
  59. package/helpers/index.js +1 -22
  60. package/helpers/index.mjs +24 -20
  61. package/helpers/safeImageUrl.d.ts +1 -0
  62. package/helpers/safeImageUrl.js +2 -0
  63. package/helpers/safeImageUrl.mjs +13 -0
  64. package/helpers/serializeTransaction.js +1 -8
  65. package/helpers/serializeTransaction.mjs +3 -5
  66. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.d.ts +1 -0
  67. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +2 -0
  68. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +52 -0
  69. package/helpers/tests/base64Utils.spec.js +1 -29
  70. package/helpers/tests/base64Utils.spec.mjs +11 -24
  71. package/helpers/tests/decodeLoginToken.spec.js +1 -34
  72. package/helpers/tests/decodeLoginToken.spec.mjs +13 -24
  73. package/helpers/tests/decodeToken.spec.js +1 -27
  74. package/helpers/tests/decodeToken.spec.mjs +7 -12
  75. package/helpers/tests/safeImageUrl.spec.d.ts +1 -0
  76. package/helpers/tests/safeImageUrl.spec.js +2 -0
  77. package/helpers/tests/safeImageUrl.spec.mjs +32 -0
  78. package/helpers/tests/serializeTransaction.spec.d.ts +1 -0
  79. package/helpers/tests/serializeTransaction.spec.js +2 -0
  80. package/helpers/tests/serializeTransaction.spec.mjs +24 -0
  81. package/index.js +1 -228
  82. package/index.mjs +196 -192
  83. package/package.json +14 -9
  84. package/react.esm-B0AMOHxa.js +73 -0
  85. package/react.esm-BxvJJ86Q.mjs +9949 -0
  86. package/reactjs/adapters/SuiAdapter.d.ts +14 -0
  87. package/reactjs/adapters/SuiAdapter.js +1 -349
  88. package/reactjs/adapters/SuiAdapter.mjs +171 -199
  89. package/reactjs/components/AccountAddress/AccountAddress.js +1 -31
  90. package/reactjs/components/AccountAddress/AccountAddress.mjs +16 -16
  91. package/reactjs/components/AccountAddress/index.js +1 -4
  92. package/reactjs/components/AccountAddress/index.mjs +2 -2
  93. package/reactjs/components/AmountCard/AmountCard.js +1 -33
  94. package/reactjs/components/AmountCard/AmountCard.mjs +19 -21
  95. package/reactjs/components/AmountCard/index.js +1 -4
  96. package/reactjs/components/AmountCard/index.mjs +2 -2
  97. package/reactjs/components/AmountInput/AmountInput.js +1 -71
  98. package/reactjs/components/AmountInput/AmountInput.mjs +42 -46
  99. package/reactjs/components/AmountInput/index.js +1 -4
  100. package/reactjs/components/AmountInput/index.mjs +2 -2
  101. package/reactjs/components/BridgeForm/BridgeForm.d.ts +9 -0
  102. package/reactjs/components/BridgeForm/BridgeForm.js +1 -89
  103. package/reactjs/components/BridgeForm/BridgeForm.mjs +72 -79
  104. package/reactjs/components/BridgeForm/Deposit.js +1 -673
  105. package/reactjs/components/BridgeForm/Deposit.mjs +381 -503
  106. package/reactjs/components/BridgeForm/Transfer.js +1 -559
  107. package/reactjs/components/BridgeForm/Transfer.mjs +316 -427
  108. package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -78
  109. package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +47 -70
  110. package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -58
  111. package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +36 -47
  112. package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -266
  113. package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +163 -231
  114. package/reactjs/components/BridgeForm/index.js +1 -4
  115. package/reactjs/components/BridgeForm/index.mjs +2 -2
  116. package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -76
  117. package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +35 -65
  118. package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -367
  119. package/reactjs/components/BridgeHistory/BridgeHistory.mjs +177 -193
  120. package/reactjs/components/BridgeHistory/index.js +1 -4
  121. package/reactjs/components/BridgeHistory/index.mjs +2 -2
  122. package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -150
  123. package/reactjs/components/Connect/BridgeAccountDisplay.mjs +99 -115
  124. package/reactjs/components/Connect/BridgeConnectButton.js +1 -34
  125. package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -19
  126. package/reactjs/components/Connect/ChainSelectConnect.js +1 -144
  127. package/reactjs/components/Connect/ChainSelectConnect.mjs +70 -83
  128. package/reactjs/components/Connect/CustomConnectButton.js +1 -40
  129. package/reactjs/components/Connect/CustomConnectButton.mjs +24 -30
  130. package/reactjs/components/Connect/MvxAccountDisplay.js +1 -97
  131. package/reactjs/components/Connect/MvxAccountDisplay.mjs +47 -50
  132. package/reactjs/components/Connect/MvxConnectButton.js +1 -43
  133. package/reactjs/components/Connect/MvxConnectButton.mjs +35 -40
  134. package/reactjs/components/Connect/SwitchChainButton.js +1 -29
  135. package/reactjs/components/Connect/SwitchChainButton.mjs +15 -18
  136. package/reactjs/components/Connect/index.js +1 -16
  137. package/reactjs/components/Connect/index.mjs +14 -14
  138. package/reactjs/components/CopyButton/CopyButton.js +1 -46
  139. package/reactjs/components/CopyButton/CopyButton.mjs +33 -36
  140. package/reactjs/components/CopyButton/index.js +1 -4
  141. package/reactjs/components/CopyButton/index.mjs +2 -2
  142. package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -38
  143. package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -32
  144. package/reactjs/components/CopyButton/utils/index.js +1 -4
  145. package/reactjs/components/CopyButton/utils/index.mjs +2 -2
  146. package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -90
  147. package/reactjs/components/DisplayAmount/DisplayAmount.mjs +68 -75
  148. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -39
  149. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +26 -33
  150. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -61
  151. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +38 -46
  152. package/reactjs/components/DisplayAmount/index.js +1 -4
  153. package/reactjs/components/DisplayAmount/index.mjs +2 -2
  154. package/reactjs/components/DisplayAmount/utils/index.js +1 -4
  155. package/reactjs/components/DisplayAmount/utils/index.mjs +2 -2
  156. package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -21
  157. package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +9 -13
  158. package/reactjs/components/Error/Error.js +1 -66
  159. package/reactjs/components/Error/Error.mjs +29 -29
  160. package/reactjs/components/Error/index.js +1 -4
  161. package/reactjs/components/Error/index.mjs +2 -2
  162. package/reactjs/components/SmallLoader/SmallLoader.js +1 -21
  163. package/reactjs/components/SmallLoader/SmallLoader.mjs +13 -18
  164. package/reactjs/components/SmallLoader/index.js +1 -4
  165. package/reactjs/components/SmallLoader/index.mjs +2 -2
  166. package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -30
  167. package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -28
  168. package/reactjs/components/TokenSelector/TokenSelector.js +1 -172
  169. package/reactjs/components/TokenSelector/TokenSelector.mjs +98 -118
  170. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -94
  171. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +48 -57
  172. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -51
  173. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -44
  174. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -18
  175. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +9 -14
  176. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -6
  177. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +2 -4
  178. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -39
  179. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +22 -18
  180. package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -40
  181. package/reactjs/components/TokenSelector/components/SelectContainer.mjs +36 -38
  182. package/reactjs/components/TokenSelector/components/SelectContent.js +1 -136
  183. package/reactjs/components/TokenSelector/components/SelectContent.mjs +79 -103
  184. package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -28
  185. package/reactjs/components/TokenSelector/components/SelectedOption.mjs +22 -24
  186. package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -81
  187. package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -57
  188. package/reactjs/components/TokenSelector/components/TokenItem.js +1 -80
  189. package/reactjs/components/TokenSelector/components/TokenItem.mjs +41 -54
  190. package/reactjs/components/TokenSelector/components/TokenList.js +1 -23
  191. package/reactjs/components/TokenSelector/components/TokenList.mjs +19 -21
  192. package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -25
  193. package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +14 -15
  194. package/reactjs/components/TokenSelector/index.js +1 -4
  195. package/reactjs/components/TokenSelector/index.mjs +2 -2
  196. package/reactjs/components/TransactionToast/TransactionToast.js +1 -53
  197. package/reactjs/components/TransactionToast/TransactionToast.mjs +27 -28
  198. package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -20
  199. package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +16 -18
  200. package/reactjs/components/TransactionToast/index.js +1 -6
  201. package/reactjs/components/TransactionToast/index.mjs +4 -4
  202. package/reactjs/components/TrimAddress/TrimAddress.js +1 -27
  203. package/reactjs/components/TrimAddress/TrimAddress.mjs +19 -24
  204. package/reactjs/components/TrimAddress/index.js +1 -4
  205. package/reactjs/components/TrimAddress/index.mjs +2 -2
  206. package/reactjs/components/base/MxButton/MxButton.js +1 -71
  207. package/reactjs/components/base/MxButton/MxButton.mjs +46 -46
  208. package/reactjs/components/base/MxButton/index.js +1 -4
  209. package/reactjs/components/base/MxButton/index.mjs +2 -2
  210. package/reactjs/components/base/MxCard/MxCard.js +1 -54
  211. package/reactjs/components/base/MxCard/MxCard.mjs +34 -34
  212. package/reactjs/components/base/MxCard/index.js +1 -4
  213. package/reactjs/components/base/MxCard/index.mjs +2 -2
  214. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -28
  215. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +24 -26
  216. package/reactjs/components/base/MxCircleLoader/index.js +1 -4
  217. package/reactjs/components/base/MxCircleLoader/index.mjs +2 -2
  218. package/reactjs/components/base/MxLink/MxLink.js +1 -70
  219. package/reactjs/components/base/MxLink/MxLink.mjs +44 -46
  220. package/reactjs/components/base/MxLink/index.js +1 -4
  221. package/reactjs/components/base/MxLink/index.mjs +2 -2
  222. package/reactjs/components/base/MxSearch/MxSearch.js +1 -69
  223. package/reactjs/components/base/MxSearch/MxSearch.mjs +37 -41
  224. package/reactjs/components/base/MxSearch/index.js +1 -4
  225. package/reactjs/components/base/MxSearch/index.mjs +2 -2
  226. package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -78
  227. package/reactjs/components/base/MxSlideover/MxSlideover.mjs +72 -74
  228. package/reactjs/components/base/MxSlideover/index.js +1 -4
  229. package/reactjs/components/base/MxSlideover/index.mjs +2 -2
  230. package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -163
  231. package/reactjs/components/base/MxTooltip/MxTooltip.mjs +92 -135
  232. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -33
  233. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +29 -31
  234. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -4
  235. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -2
  236. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -27
  237. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +23 -25
  238. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -4
  239. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +2 -2
  240. package/reactjs/components/base/MxTooltip/components/index.js +1 -6
  241. package/reactjs/components/base/MxTooltip/components/index.mjs +4 -4
  242. package/reactjs/components/base/MxTooltip/index.js +1 -4
  243. package/reactjs/components/base/MxTooltip/index.mjs +2 -2
  244. package/reactjs/components/base/index.js +1 -14
  245. package/reactjs/components/base/index.mjs +12 -12
  246. package/reactjs/components/index.js +1 -54
  247. package/reactjs/components/index.mjs +52 -52
  248. package/reactjs/constants/chains.js +1 -54
  249. package/reactjs/constants/chains.mjs +33 -52
  250. package/reactjs/constants/index.js +1 -13
  251. package/reactjs/constants/index.mjs +9 -10
  252. package/reactjs/context/Web3AppProvider.js +1 -40
  253. package/reactjs/context/Web3AppProvider.mjs +34 -34
  254. package/reactjs/context/queryClient.js +1 -11
  255. package/reactjs/context/queryClient.mjs +5 -8
  256. package/reactjs/context/useWeb3App.js +1 -12
  257. package/reactjs/context/useWeb3App.mjs +7 -8
  258. package/reactjs/helpers/index.js +1 -6
  259. package/reactjs/helpers/index.mjs +4 -4
  260. package/reactjs/helpers/resolveBridgeApiChainId.js +1 -40
  261. package/reactjs/helpers/resolveBridgeApiChainId.mjs +21 -34
  262. package/reactjs/hooks/index.js +1 -35
  263. package/reactjs/hooks/index.mjs +33 -33
  264. package/reactjs/hooks/tests/useGenericSignMessage.spec.d.ts +1 -0
  265. package/reactjs/hooks/tests/useGenericSignMessage.spec.js +2 -0
  266. package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +52 -0
  267. package/reactjs/hooks/tests/useSignTransaction.spec.d.ts +1 -0
  268. package/reactjs/hooks/tests/useSignTransaction.spec.js +2 -0
  269. package/reactjs/hooks/tests/useSignTransaction.spec.mjs +156 -0
  270. package/reactjs/hooks/useAccount.js +1 -13
  271. package/reactjs/hooks/useAccount.mjs +7 -8
  272. package/reactjs/hooks/useBalances.js +1 -53
  273. package/reactjs/hooks/useBalances.mjs +28 -40
  274. package/reactjs/hooks/useBridgeApiChainId.js +1 -13
  275. package/reactjs/hooks/useBridgeApiChainId.mjs +9 -9
  276. package/reactjs/hooks/useBridgeFormik.js +1 -162
  277. package/reactjs/hooks/useBridgeFormik.mjs +110 -150
  278. package/reactjs/hooks/useDebounce.js +1 -13
  279. package/reactjs/hooks/useDebounce.mjs +8 -10
  280. package/reactjs/hooks/useFetchBridgeData.js +1 -45
  281. package/reactjs/hooks/useFetchBridgeData.mjs +37 -38
  282. package/reactjs/hooks/useFetchTokens.js +1 -113
  283. package/reactjs/hooks/useFetchTokens.mjs +80 -106
  284. package/reactjs/hooks/useGenericSignMessage.js +1 -55
  285. package/reactjs/hooks/useGenericSignMessage.mjs +47 -47
  286. package/reactjs/hooks/useGetChainId.js +1 -11
  287. package/reactjs/hooks/useGetChainId.mjs +7 -8
  288. package/reactjs/hooks/useResolveTokenChain.js +1 -20
  289. package/reactjs/hooks/useResolveTokenChain.mjs +11 -14
  290. package/reactjs/hooks/useSendTransactions.js +1 -25
  291. package/reactjs/hooks/useSendTransactions.mjs +19 -23
  292. package/reactjs/hooks/useSignTransaction.js +1 -86
  293. package/reactjs/hooks/useSignTransaction.mjs +59 -59
  294. package/reactjs/hooks/useSuiConnect.js +1 -86
  295. package/reactjs/hooks/useSuiConnect.mjs +52 -70
  296. package/reactjs/hooks/validation/index.js +1 -10
  297. package/reactjs/hooks/validation/index.mjs +8 -8
  298. package/reactjs/hooks/validation/useAmountSchema.js +1 -32
  299. package/reactjs/hooks/validation/useAmountSchema.mjs +8 -11
  300. package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -26
  301. package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -6
  302. package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -37
  303. package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -29
  304. package/reactjs/hooks/validation/useTestIsConnected.js +1 -27
  305. package/reactjs/hooks/validation/useTestIsConnected.mjs +13 -19
  306. package/reactjs/index.js +1 -190
  307. package/reactjs/index.mjs +154 -154
  308. package/reactjs/init/index.js +1 -5
  309. package/reactjs/init/index.mjs +3 -3
  310. package/reactjs/init/init.d.ts +1 -0
  311. package/reactjs/init/init.js +1 -139
  312. package/reactjs/init/init.mjs +59 -72
  313. package/reactjs/queries/index.js +1 -17
  314. package/reactjs/queries/index.mjs +15 -15
  315. package/reactjs/queries/useCheckAccount.query.js +1 -39
  316. package/reactjs/queries/useCheckAccount.query.mjs +29 -33
  317. package/reactjs/queries/useGetAllTokens.query.js +1 -35
  318. package/reactjs/queries/useGetAllTokens.query.mjs +26 -30
  319. package/reactjs/queries/useGetChains.query.js +1 -34
  320. package/reactjs/queries/useGetChains.query.mjs +26 -28
  321. package/reactjs/queries/useGetHistory.query.d.ts +1 -1
  322. package/reactjs/queries/useGetHistory.query.js +1 -68
  323. package/reactjs/queries/useGetHistory.query.mjs +55 -58
  324. package/reactjs/queries/useGetMvxTokensBalances.query.d.ts +1 -1
  325. package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -71
  326. package/reactjs/queries/useGetMvxTokensBalances.query.mjs +40 -53
  327. package/reactjs/queries/useGetNonMvxTokensBalances.query.d.ts +1 -1
  328. package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
  329. package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +51 -59
  330. package/reactjs/queries/useGetRate.mutation.js +1 -18
  331. package/reactjs/queries/useGetRate.mutation.mjs +12 -15
  332. package/reactjs/reexports.js +1 -48
  333. package/reactjs/reexports.mjs +13 -13
  334. package/reactjs/utils/delay.js +1 -6
  335. package/reactjs/utils/delay.mjs +3 -3
  336. package/reactjs/utils/formatAmount.js +1 -23
  337. package/reactjs/utils/formatAmount.mjs +16 -17
  338. package/reactjs/utils/getCleanStringAmount.js +1 -11
  339. package/reactjs/utils/getCleanStringAmount.mjs +6 -8
  340. package/reactjs/utils/getCompletePathname.js +1 -5
  341. package/reactjs/utils/getCompletePathname.mjs +3 -3
  342. package/reactjs/utils/getInitialTokens.js +1 -12
  343. package/reactjs/utils/getInitialTokens.mjs +6 -7
  344. package/reactjs/utils/hasEnoughFunds.js +1 -19
  345. package/reactjs/utils/hasEnoughFunds.mjs +11 -14
  346. package/reactjs/utils/index.js +1 -26
  347. package/reactjs/utils/index.mjs +24 -24
  348. package/reactjs/utils/isStringFloat.js +1 -21
  349. package/reactjs/utils/isStringFloat.mjs +11 -18
  350. package/reactjs/utils/mxClsx.js +1 -8
  351. package/reactjs/utils/mxClsx.mjs +4 -6
  352. package/reactjs/utils/pipe.js +1 -25
  353. package/reactjs/utils/pipe.mjs +13 -17
  354. package/reactjs/utils/removeCommas.js +1 -6
  355. package/reactjs/utils/removeCommas.mjs +2 -4
  356. package/reactjs/utils/roundAmount.js +1 -40
  357. package/reactjs/utils/roundAmount.mjs +16 -36
  358. package/reactjs/utils/testNumber.js +1 -4
  359. package/reactjs/utils/testNumber.mjs +2 -2
  360. package/store/inMemoryStore.js +1 -39
  361. package/store/inMemoryStore.mjs +17 -21
  362. package/style.css +1 -2274
  363. package/types/chainType.js +1 -11
  364. package/types/chainType.mjs +2 -9
  365. package/types/errors.d.ts +3 -0
  366. package/types/errors.js +2 -0
  367. package/types/errors.mjs +8 -0
  368. package/types/providerType.js +1 -9
  369. package/types/providerType.mjs +2 -7
  370. package/types/transaction.d.ts +2 -0
  371. package/all-networks-EJIVYZ_i.mjs +0 -4
  372. package/all-networks-NYACMyeN.js +0 -4
  373. package/default-BYtXv70Z.mjs +0 -4
  374. package/default-H3AbmzFV.js +0 -4
  375. package/reactjs/hooks/useSignTransaction.d.ts +0 -511
@@ -1,266 +1,198 @@
1
- import { useRef, useState, useMemo, useCallback, useEffect } from "react";
2
- import { sameBridgeApiChainId } from "../../../helpers/resolveBridgeApiChainId.mjs";
3
- import { getInitialTokens } from "../../../utils/getInitialTokens.mjs";
4
- import { getAvailableTokens, getDefaultReceivingToken, updateUrlParams } from "../utils/bridgeFormHelpers.mjs";
5
- const useBridgeTokenSelection = ({
6
- chains,
7
- firstTokenIdentifier,
8
- secondTokenIdentifier,
9
- fromTokens,
10
- toTokens,
11
- isTokensLoading,
12
- activeChainId,
13
- mvxChainId,
14
- callbackRoute,
15
- forcedDestinationTokenSymbol,
16
- onNavigate,
17
- switchNetwork,
18
- sdkChains,
19
- activeChain
1
+ import { useRef as _, useState as Q, useMemo as p, useCallback as O, useEffect as z } from "react";
2
+ import { sameBridgeApiChainId as m } from "../../../helpers/resolveBridgeApiChainId.mjs";
3
+ import { getInitialTokens as n } from "../../../utils/getInitialTokens.mjs";
4
+ import { getAvailableTokens as x, getDefaultReceivingToken as i, updateUrlParams as N } from "../utils/bridgeFormHelpers.mjs";
5
+ const ee = ({
6
+ chains: f,
7
+ firstTokenIdentifier: D,
8
+ secondTokenIdentifier: F,
9
+ fromTokens: s,
10
+ toTokens: t,
11
+ isTokensLoading: o,
12
+ activeChainId: C,
13
+ mvxChainId: g,
14
+ callbackRoute: E,
15
+ forcedDestinationTokenSymbol: M,
16
+ onNavigate: j,
17
+ switchNetwork: w,
18
+ sdkChains: I,
19
+ activeChain: y
20
20
  }) => {
21
- const initializedInitialTokensRef = useRef(false);
22
- const [firstToken, setFirstToken] = useState();
23
- const [secondToken, setSecondToken] = useState();
24
- const fromOptions = useMemo(
25
- () => (fromTokens == null ? void 0 : fromTokens.filter((token) => {
26
- if (mvxChainId) {
27
- return token.chainId.toString().toLowerCase() === mvxChainId.toString().toLowerCase();
28
- }
29
- return true;
30
- }).map((token) => ({
31
- ...token,
32
- identifier: token.address,
33
- ticker: token.symbol
21
+ const U = _(!1), [d, S] = Q(), [l, A] = Q(), L = p(
22
+ () => (s == null ? void 0 : s.filter((e) => g ? e.chainId.toString().toLowerCase() === g.toString().toLowerCase() : !0).map((e) => ({
23
+ ...e,
24
+ identifier: e.address,
25
+ ticker: e.symbol
34
26
  }))) ?? [],
35
- [fromTokens, mvxChainId]
36
- );
37
- const getAvailableTokens$1 = useCallback(
38
- (option) => getAvailableTokens(
39
- option,
40
- toTokens,
41
- forcedDestinationTokenSymbol
27
+ [s, g]
28
+ ), P = O(
29
+ (e) => x(
30
+ e,
31
+ t,
32
+ M
42
33
  ),
43
- [toTokens, forcedDestinationTokenSymbol]
44
- );
45
- const toOptions = useMemo(() => {
46
- if (!firstToken) {
47
- return [];
48
- }
49
- return (toTokens == null ? void 0 : toTokens.filter(
50
- (token) => token.symbol.toLowerCase() === firstToken.symbol.toLowerCase()
51
- ).map((token) => ({
52
- ...token,
53
- identifier: token.address,
54
- ticker: token.symbol
55
- }))) ?? [];
56
- }, [firstToken == null ? void 0 : firstToken.symbol, toTokens]);
57
- const selectedChainOption = useMemo(() => {
58
- const anchorToken = mvxChainId ? secondToken : firstToken;
59
- const byAnchorToken = anchorToken && (chains == null ? void 0 : chains.find(
60
- (option) => sameBridgeApiChainId(option.chainId, anchorToken.chainId)
34
+ [t, M]
35
+ ), V = p(() => d ? (t == null ? void 0 : t.filter(
36
+ (e) => e.symbol.toLowerCase() === d.symbol.toLowerCase()
37
+ ).map((e) => ({
38
+ ...e,
39
+ identifier: e.address,
40
+ ticker: e.symbol
41
+ }))) ?? [] : [], [d == null ? void 0 : d.symbol, t]), W = p(() => {
42
+ const e = g ? l : d, r = e && (f == null ? void 0 : f.find(
43
+ (c) => m(c.chainId, e.chainId)
61
44
  ));
62
- if (byAnchorToken) {
63
- return byAnchorToken;
64
- }
65
- const byActiveChain = chains == null ? void 0 : chains.find(
66
- (option) => sameBridgeApiChainId(option.chainId, activeChain == null ? void 0 : activeChain.id)
45
+ if (r)
46
+ return r;
47
+ const u = f == null ? void 0 : f.find(
48
+ (c) => m(c.chainId, y == null ? void 0 : y.id)
67
49
  );
68
- if (byActiveChain) {
69
- return byActiveChain;
70
- }
71
- const byOtherToken = mvxChainId ? firstToken && (chains == null ? void 0 : chains.find(
72
- (option) => sameBridgeApiChainId(option.chainId, firstToken.chainId)
73
- )) : secondToken && (chains == null ? void 0 : chains.find(
74
- (option) => sameBridgeApiChainId(option.chainId, secondToken.chainId)
75
- ));
76
- return byOtherToken ?? (chains == null ? void 0 : chains[0]);
50
+ return u || ((g ? d && (f == null ? void 0 : f.find(
51
+ (c) => m(c.chainId, d.chainId)
52
+ )) : l && (f == null ? void 0 : f.find(
53
+ (c) => m(c.chainId, l.chainId)
54
+ ))) ?? (f == null ? void 0 : f[0]));
77
55
  }, [
78
- activeChain == null ? void 0 : activeChain.id,
79
- chains,
80
- firstToken == null ? void 0 : firstToken.chainId,
81
- mvxChainId,
82
- secondToken == null ? void 0 : secondToken.chainId
83
- ]);
84
- const getDefaultReceivingToken$1 = useCallback(
85
- (values) => getDefaultReceivingToken(values, toTokens),
86
- [toTokens]
87
- );
88
- const updateUrlParams$1 = useCallback(
56
+ y == null ? void 0 : y.id,
57
+ f,
58
+ d == null ? void 0 : d.chainId,
59
+ g,
60
+ l == null ? void 0 : l.chainId
61
+ ]), R = O(
62
+ (e) => i(e, t),
63
+ [t]
64
+ ), b = O(
89
65
  ({
90
- firstTokenId,
91
- secondTokenId
66
+ firstTokenId: e,
67
+ secondTokenId: r
92
68
  }) => {
93
- updateUrlParams({
94
- firstTokenId,
95
- secondTokenId,
96
- callbackRoute,
97
- isTokensLoading,
98
- onNavigate
69
+ N({
70
+ firstTokenId: e,
71
+ secondTokenId: r,
72
+ callbackRoute: E,
73
+ isTokensLoading: o,
74
+ onNavigate: j
99
75
  });
100
76
  },
101
- [callbackRoute, isTokensLoading, onNavigate]
102
- );
103
- const onChangeFirstSelect = useCallback(
104
- (option) => {
105
- if (!option) {
77
+ [E, o, j]
78
+ ), X = O(
79
+ (e) => {
80
+ if (!e)
106
81
  return;
107
- }
108
- setFirstToken(option);
109
- updateUrlParams$1({ firstTokenId: option.address });
110
- let secondOption = toTokens == null ? void 0 : toTokens.find(
111
- (x) => x.symbol.toLowerCase() === option.symbol.toLowerCase()
82
+ S(e), b({ firstTokenId: e.address });
83
+ let r = t == null ? void 0 : t.find(
84
+ (u) => u.symbol.toLowerCase() === e.symbol.toLowerCase()
112
85
  );
113
- if (!secondOption) {
114
- const availableTokens = getAvailableTokens$1(option);
115
- secondOption = availableTokens.find(
116
- (x) => x.symbol.toLowerCase() === option.symbol.toLowerCase()
117
- ) ?? getDefaultReceivingToken$1(availableTokens);
118
- }
119
- if (secondOption) {
120
- setSecondToken(secondOption);
121
- updateUrlParams$1({ secondTokenId: secondOption.address });
86
+ if (!r) {
87
+ const u = P(e);
88
+ r = u.find(
89
+ ($) => $.symbol.toLowerCase() === e.symbol.toLowerCase()
90
+ ) ?? R(u);
122
91
  }
92
+ r && (A(r), b({ secondTokenId: r.address }));
123
93
  },
124
- [getAvailableTokens$1, getDefaultReceivingToken$1, updateUrlParams$1, toTokens]
125
- );
126
- const onChangeSecondSelect = useCallback(
127
- (option) => {
128
- if (!option) {
94
+ [P, R, b, t]
95
+ ), Y = O(
96
+ (e) => {
97
+ if (!e)
129
98
  return;
130
- }
131
- setSecondToken(option);
132
- updateUrlParams$1({ secondTokenId: option.address });
133
- const firstOption = fromOptions.find(
134
- (x) => x.symbol.toLowerCase() === option.symbol.toLowerCase()
99
+ A(e), b({ secondTokenId: e.address });
100
+ const r = L.find(
101
+ (u) => u.symbol.toLowerCase() === e.symbol.toLowerCase()
135
102
  );
136
- if (firstOption) {
137
- setFirstToken(firstOption);
138
- updateUrlParams$1({ firstTokenId: firstOption.address });
139
- }
103
+ r && (S(r), b({ firstTokenId: r.address }));
140
104
  },
141
- [fromOptions, updateUrlParams$1]
142
- );
143
- const handleChangeDirection = useCallback(() => {
144
- if (!firstToken || !secondToken) {
105
+ [L, b]
106
+ ), Z = O(() => {
107
+ if (!d || !l)
145
108
  return;
146
- }
147
- setFirstToken(secondToken);
148
- setSecondToken(firstToken);
149
- updateUrlParams$1({
150
- firstTokenId: secondToken.address,
151
- secondTokenId: firstToken.address
109
+ S(l), A(d), b({
110
+ firstTokenId: l.address,
111
+ secondTokenId: d.address
152
112
  });
153
- const selectedOptionChain = sdkChains == null ? void 0 : sdkChains.find(
154
- (chain) => sameBridgeApiChainId(chain.id, secondToken.chainId)
113
+ const e = I == null ? void 0 : I.find(
114
+ (r) => m(r.id, l.chainId)
155
115
  );
156
- if (selectedOptionChain && switchNetwork) {
157
- switchNetwork(selectedOptionChain);
158
- }
159
- }, [firstToken, secondToken, updateUrlParams$1, sdkChains, switchNetwork]);
160
- useEffect(() => {
161
- var _a, _b, _c, _d;
162
- if (isTokensLoading || initializedInitialTokensRef.current || !fromOptions.length) {
116
+ e && w && w(e);
117
+ }, [d, l, b, I, w]);
118
+ return z(() => {
119
+ var q, G, H, J;
120
+ if (o || U.current || !L.length)
163
121
  return;
164
- }
165
- if (firstToken && secondToken) {
166
- initializedInitialTokensRef.current = true;
122
+ if (d && l) {
123
+ U.current = !0;
167
124
  return;
168
125
  }
169
- const initialTokens = getInitialTokens({
170
- firstTokenId: firstTokenIdentifier,
171
- secondTokenId: secondTokenIdentifier
172
- });
173
- const firstOption = fromOptions.find(
174
- ({ identifier }) => (initialTokens == null ? void 0 : initialTokens.firstTokenId) === identifier
175
- ) ?? fromOptions.find(
176
- (option) => sameBridgeApiChainId(option.chainId, activeChainId)
177
- ) ?? fromOptions[0];
178
- let secondOption = toTokens == null ? void 0 : toTokens.find(
179
- (x) => x.symbol.toLowerCase() === (firstOption == null ? void 0 : firstOption.symbol.toLowerCase())
126
+ const e = n({
127
+ firstTokenId: D,
128
+ secondTokenId: F
129
+ }), r = L.find(
130
+ ({ identifier: a }) => (e == null ? void 0 : e.firstTokenId) === a
131
+ ) ?? L.find(
132
+ (a) => m(a.chainId, C)
133
+ ) ?? L[0];
134
+ let u = t == null ? void 0 : t.find(
135
+ (a) => a.symbol.toLowerCase() === (r == null ? void 0 : r.symbol.toLowerCase())
180
136
  );
181
- if (!secondOption) {
182
- const availableTokens = getAvailableTokens$1(firstOption);
183
- secondOption = (availableTokens == null ? void 0 : availableTokens.find(
184
- ({ address }) => {
185
- var _a2;
186
- return address.toLowerCase() === ((_a2 = (firstOption == null ? void 0 : firstOption.symbol) ?? (initialTokens == null ? void 0 : initialTokens.secondTokenId)) == null ? void 0 : _a2.toLowerCase());
137
+ if (!u) {
138
+ const a = P(r);
139
+ u = (a == null ? void 0 : a.find(
140
+ ({ address: B }) => {
141
+ var K;
142
+ return B.toLowerCase() === ((K = (r == null ? void 0 : r.symbol) ?? (e == null ? void 0 : e.secondTokenId)) == null ? void 0 : K.toLowerCase());
187
143
  }
188
- )) ?? availableTokens.find(
189
- (x) => x.symbol.toLowerCase() === (firstOption == null ? void 0 : firstOption.symbol.toLowerCase())
190
- ) ?? getDefaultReceivingToken$1(availableTokens);
144
+ )) ?? a.find(
145
+ (B) => B.symbol.toLowerCase() === (r == null ? void 0 : r.symbol.toLowerCase())
146
+ ) ?? R(a);
191
147
  }
192
- const hasOptionsSelected = Boolean(firstToken) && Boolean(secondToken) && ((_a = firstToken == null ? void 0 : firstToken.address) == null ? void 0 : _a.toLowerCase()) === ((_b = firstOption == null ? void 0 : firstOption.address) == null ? void 0 : _b.toLowerCase()) && ((_c = secondToken == null ? void 0 : secondToken.address) == null ? void 0 : _c.toLowerCase()) === ((_d = secondOption == null ? void 0 : secondOption.address) == null ? void 0 : _d.toLowerCase());
193
- if (hasOptionsSelected) {
148
+ if (!!d && !!l && ((q = d == null ? void 0 : d.address) == null ? void 0 : q.toLowerCase()) === ((G = r == null ? void 0 : r.address) == null ? void 0 : G.toLowerCase()) && ((H = l == null ? void 0 : l.address) == null ? void 0 : H.toLowerCase()) === ((J = u == null ? void 0 : u.address) == null ? void 0 : J.toLowerCase()))
194
149
  return;
150
+ let c = !1;
151
+ if (r) {
152
+ S(r), b({ firstTokenId: r.address });
153
+ const a = (I == null ? void 0 : I.find(
154
+ (B) => m(B.id, r.chainId)
155
+ )) ?? y;
156
+ a && w && w(a), c = !0;
195
157
  }
196
- let initialized = false;
197
- if (firstOption) {
198
- setFirstToken(firstOption);
199
- updateUrlParams$1({ firstTokenId: firstOption.address });
200
- const selectedOptionChain = (sdkChains == null ? void 0 : sdkChains.find(
201
- (chain) => sameBridgeApiChainId(chain.id, firstOption.chainId)
202
- )) ?? activeChain;
203
- if (selectedOptionChain && switchNetwork) {
204
- switchNetwork(selectedOptionChain);
205
- }
206
- initialized = true;
207
- }
208
- if (secondOption) {
209
- setSecondToken(secondOption);
210
- updateUrlParams$1({ secondTokenId: secondOption.address });
211
- initialized = initialized && true;
212
- }
213
- initializedInitialTokensRef.current = initialized;
158
+ u && (A(u), b({ secondTokenId: u.address }), c = c && !0), U.current = c;
214
159
  }, [
215
- isTokensLoading,
216
- fromOptions,
217
- toTokens,
218
- firstTokenIdentifier,
219
- secondTokenIdentifier,
220
- activeChainId,
221
- getAvailableTokens$1,
222
- getDefaultReceivingToken$1,
223
- updateUrlParams$1,
224
- sdkChains,
225
- activeChain,
226
- switchNetwork,
227
- firstToken,
228
- secondToken
229
- ]);
230
- useEffect(() => {
231
- const selectedTokenOption = fromTokens == null ? void 0 : fromTokens.find(
232
- (x) => x.address === (firstToken == null ? void 0 : firstToken.address)
160
+ o,
161
+ L,
162
+ t,
163
+ D,
164
+ F,
165
+ C,
166
+ P,
167
+ R,
168
+ b,
169
+ I,
170
+ y,
171
+ w
172
+ ]), z(() => {
173
+ const e = s == null ? void 0 : s.find(
174
+ (r) => r.address === (d == null ? void 0 : d.address)
233
175
  );
234
- if (selectedTokenOption) {
235
- setFirstToken((prev) => {
236
- return prev ? { ...prev, balance: selectedTokenOption.balance } : prev;
237
- });
238
- }
239
- }, [fromTokens, firstToken == null ? void 0 : firstToken.address]);
240
- useEffect(() => {
241
- const selectedTokenOption = toTokens == null ? void 0 : toTokens.find(
242
- (x) => x.address === (secondToken == null ? void 0 : secondToken.address)
176
+ e && S((r) => r && { ...r, balance: e.balance });
177
+ }, [s, d == null ? void 0 : d.address]), z(() => {
178
+ const e = t == null ? void 0 : t.find(
179
+ (r) => r.address === (l == null ? void 0 : l.address)
243
180
  );
244
- if (selectedTokenOption) {
245
- setSecondToken((prev) => {
246
- return prev ? { ...prev, balance: selectedTokenOption.balance } : prev;
247
- });
248
- }
249
- }, [toTokens, secondToken == null ? void 0 : secondToken.address]);
250
- return {
251
- firstToken,
252
- secondToken,
253
- fromOptions,
254
- toOptions,
255
- selectedChainOption,
256
- setFirstToken,
257
- setSecondToken,
258
- onChangeFirstSelect,
259
- onChangeSecondSelect,
260
- handleChangeDirection,
261
- updateUrlParams: updateUrlParams$1
181
+ e && A((r) => r && { ...r, balance: e.balance });
182
+ }, [t, l == null ? void 0 : l.address]), {
183
+ firstToken: d,
184
+ secondToken: l,
185
+ fromOptions: L,
186
+ toOptions: V,
187
+ selectedChainOption: W,
188
+ setFirstToken: S,
189
+ setSecondToken: A,
190
+ onChangeFirstSelect: X,
191
+ onChangeSecondSelect: Y,
192
+ handleChangeDirection: Z,
193
+ updateUrlParams: b
262
194
  };
263
195
  };
264
196
  export {
265
- useBridgeTokenSelection
197
+ ee as useBridgeTokenSelection
266
198
  };
@@ -1,5 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const reactjs_components_BridgeForm_BridgeForm = require("./BridgeForm.js");
5
- exports.BridgeForm = reactjs_components_BridgeForm_BridgeForm.BridgeForm;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./BridgeForm.js");exports.BridgeForm=e.BridgeForm;
@@ -1,4 +1,4 @@
1
- import { BridgeForm } from "./BridgeForm.mjs";
1
+ import { BridgeForm as e } from "./BridgeForm.mjs";
2
2
  export {
3
- BridgeForm
3
+ e as BridgeForm
4
4
  };
@@ -1,77 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const types_chainType = require("../../../../types/chainType.js");
5
- const reactjs_constants_index = require("../../../constants/index.js");
6
- const reactjs_utils_getCompletePathname = require("../../../utils/getCompletePathname.js");
7
- const updateUrlParams = ({
8
- firstTokenId,
9
- secondTokenId,
10
- callbackRoute,
11
- isTokensLoading,
12
- onNavigate
13
- }) => {
14
- if (isTokensLoading) {
15
- return;
16
- }
17
- const currentUrl = reactjs_utils_getCompletePathname.getCompletePathname();
18
- const searchParams = new URLSearchParams(reactjs_constants_index.safeWindow.location.search);
19
- if (firstTokenId) {
20
- searchParams.set("firstToken", firstTokenId);
21
- }
22
- if (secondTokenId) {
23
- searchParams.set("secondToken", secondTokenId);
24
- }
25
- const newUrl = `${callbackRoute}?${searchParams.toString()}`;
26
- if (currentUrl === newUrl) {
27
- return;
28
- }
29
- onNavigate == null ? void 0 : onNavigate(newUrl, { replace: true });
30
- };
31
- function resolveSigningChainType(transaction, fallbackChain) {
32
- var _a, _b;
33
- if (((_a = transaction.suiParams) == null ? void 0 : _a.transactionBytes) && ((_b = transaction.suiParams) == null ? void 0 : _b.sender)) {
34
- return types_chainType.ChainType.sui;
35
- }
36
- if (transaction.instructions && transaction.feePayer) {
37
- return types_chainType.ChainType.sol;
38
- }
39
- if (transaction.bitcoinParams) {
40
- return types_chainType.ChainType.btc;
41
- }
42
- if (transaction.to && transaction.data !== void 0) {
43
- return types_chainType.ChainType.evm;
44
- }
45
- return fallbackChain == null ? void 0 : fallbackChain.chainType;
46
- }
47
- const getAvailableTokens = (option, targetTokens, forcedDestinationTokenSymbol) => {
48
- if (forcedDestinationTokenSymbol) {
49
- const forcedToken = targetTokens == null ? void 0 : targetTokens.find(
50
- (token) => token.symbol.toLowerCase() === forcedDestinationTokenSymbol.toLowerCase()
51
- );
52
- if (forcedToken) {
53
- return [forcedToken];
54
- }
55
- return [];
56
- }
57
- if (!(option == null ? void 0 : option.availableTokens)) {
58
- return [];
59
- }
60
- const foundTokens = [];
61
- for (const availableToken of option.availableTokens) {
62
- const foundToken = targetTokens == null ? void 0 : targetTokens.find(
63
- (token) => token.address.toLowerCase() === availableToken.address.toLowerCase()
64
- );
65
- if (foundToken) {
66
- foundTokens.push(foundToken);
67
- }
68
- }
69
- return foundTokens;
70
- };
71
- const getDefaultReceivingToken = (values, fallbackTokens) => {
72
- return values.find((x) => x.symbol.toLowerCase().includes("usdc")) ?? (fallbackTokens == null ? void 0 : fallbackTokens.find((x) => x.symbol.toLowerCase().includes("usdc")));
73
- };
74
- exports.getAvailableTokens = getAvailableTokens;
75
- exports.getDefaultReceivingToken = getDefaultReceivingToken;
76
- exports.resolveSigningChainType = resolveSigningChainType;
77
- exports.updateUrlParams = updateUrlParams;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../../../../types/chainType.js"),f=require("../../../constants/index.js"),l=require("../../../utils/getCompletePathname.js"),y=({firstTokenId:e,secondTokenId:r,callbackRoute:s,isTokensLoading:n,onNavigate:i})=>{var o,a;if(n)return;const u=l.getCompletePathname(),t=new URLSearchParams(f.safeWindow.location.search);e&&t.set("firstToken",e),r&&t.set("secondToken",r);const d=`${s}?${t.toString()}`;u!==d&&((a=(o=f.safeWindow.history)==null?void 0:o.replaceState)==null||a.call(o,null,"",d),i==null||i(d,{replace:!0}))};function m(e,r){var s,n;return(s=e.suiParams)!=null&&s.transactionBytes&&((n=e.suiParams)!=null&&n.sender)?c.ChainType.sui:e.instructions&&e.feePayer?c.ChainType.sol:e.bitcoinParams?c.ChainType.btc:e.to&&e.data!==void 0?c.ChainType.evm:r==null?void 0:r.chainType}const p=(e,r,s)=>{if(s){const i=r==null?void 0:r.find(u=>u.symbol.toLowerCase()===s.toLowerCase());return i?[i]:[]}if(!(e!=null&&e.availableTokens))return[];const n=[];for(const i of e.availableTokens){const u=r==null?void 0:r.find(t=>t.address.toLowerCase()===i.address.toLowerCase());u&&n.push(u)}return n},h=(e,r)=>e.find(s=>s.symbol.toLowerCase().includes("usdc"))??(r==null?void 0:r.find(s=>s.symbol.toLowerCase().includes("usdc")));exports.getAvailableTokens=p;exports.getDefaultReceivingToken=h;exports.resolveSigningChainType=m;exports.updateUrlParams=y;
@@ -1,76 +1,46 @@
1
- import { ChainType } from "../../../../types/chainType.mjs";
2
- import { safeWindow } from "../../../constants/index.mjs";
3
- import { getCompletePathname } from "../../../utils/getCompletePathname.mjs";
4
- const updateUrlParams = ({
5
- firstTokenId,
6
- secondTokenId,
7
- callbackRoute,
8
- isTokensLoading,
9
- onNavigate
1
+ import { ChainType as t } from "../../../../types/chainType.mjs";
2
+ import { safeWindow as c } from "../../../constants/index.mjs";
3
+ import { getCompletePathname as w } from "../../../utils/getCompletePathname.mjs";
4
+ const p = ({
5
+ firstTokenId: e,
6
+ secondTokenId: r,
7
+ callbackRoute: s,
8
+ isTokensLoading: i,
9
+ onNavigate: u
10
10
  }) => {
11
- if (isTokensLoading) {
11
+ var n, m;
12
+ if (i)
12
13
  return;
13
- }
14
- const currentUrl = getCompletePathname();
15
- const searchParams = new URLSearchParams(safeWindow.location.search);
16
- if (firstTokenId) {
17
- searchParams.set("firstToken", firstTokenId);
18
- }
19
- if (secondTokenId) {
20
- searchParams.set("secondToken", secondTokenId);
21
- }
22
- const newUrl = `${callbackRoute}?${searchParams.toString()}`;
23
- if (currentUrl === newUrl) {
24
- return;
25
- }
26
- onNavigate == null ? void 0 : onNavigate(newUrl, { replace: true });
14
+ const o = w(), f = new URLSearchParams(c.location.search);
15
+ e && f.set("firstToken", e), r && f.set("secondToken", r);
16
+ const d = `${s}?${f.toString()}`;
17
+ o !== d && ((m = (n = c.history) == null ? void 0 : n.replaceState) == null || m.call(n, null, "", d), u == null || u(d, { replace: !0 }));
27
18
  };
28
- function resolveSigningChainType(transaction, fallbackChain) {
29
- var _a, _b;
30
- if (((_a = transaction.suiParams) == null ? void 0 : _a.transactionBytes) && ((_b = transaction.suiParams) == null ? void 0 : _b.sender)) {
31
- return ChainType.sui;
32
- }
33
- if (transaction.instructions && transaction.feePayer) {
34
- return ChainType.sol;
35
- }
36
- if (transaction.bitcoinParams) {
37
- return ChainType.btc;
38
- }
39
- if (transaction.to && transaction.data !== void 0) {
40
- return ChainType.evm;
41
- }
42
- return fallbackChain == null ? void 0 : fallbackChain.chainType;
19
+ function L(e, r) {
20
+ var s, i;
21
+ return (s = e.suiParams) != null && s.transactionBytes && ((i = e.suiParams) != null && i.sender) ? t.sui : e.instructions && e.feePayer ? t.sol : e.bitcoinParams ? t.btc : e.to && e.data !== void 0 ? t.evm : r == null ? void 0 : r.chainType;
43
22
  }
44
- const getAvailableTokens = (option, targetTokens, forcedDestinationTokenSymbol) => {
45
- if (forcedDestinationTokenSymbol) {
46
- const forcedToken = targetTokens == null ? void 0 : targetTokens.find(
47
- (token) => token.symbol.toLowerCase() === forcedDestinationTokenSymbol.toLowerCase()
23
+ const h = (e, r, s) => {
24
+ if (s) {
25
+ const u = r == null ? void 0 : r.find(
26
+ (o) => o.symbol.toLowerCase() === s.toLowerCase()
48
27
  );
49
- if (forcedToken) {
50
- return [forcedToken];
51
- }
52
- return [];
28
+ return u ? [u] : [];
53
29
  }
54
- if (!(option == null ? void 0 : option.availableTokens)) {
30
+ if (!(e != null && e.availableTokens))
55
31
  return [];
56
- }
57
- const foundTokens = [];
58
- for (const availableToken of option.availableTokens) {
59
- const foundToken = targetTokens == null ? void 0 : targetTokens.find(
60
- (token) => token.address.toLowerCase() === availableToken.address.toLowerCase()
32
+ const i = [];
33
+ for (const u of e.availableTokens) {
34
+ const o = r == null ? void 0 : r.find(
35
+ (f) => f.address.toLowerCase() === u.address.toLowerCase()
61
36
  );
62
- if (foundToken) {
63
- foundTokens.push(foundToken);
64
- }
37
+ o && i.push(o);
65
38
  }
66
- return foundTokens;
67
- };
68
- const getDefaultReceivingToken = (values, fallbackTokens) => {
69
- return values.find((x) => x.symbol.toLowerCase().includes("usdc")) ?? (fallbackTokens == null ? void 0 : fallbackTokens.find((x) => x.symbol.toLowerCase().includes("usdc")));
70
- };
39
+ return i;
40
+ }, C = (e, r) => e.find((s) => s.symbol.toLowerCase().includes("usdc")) ?? (r == null ? void 0 : r.find((s) => s.symbol.toLowerCase().includes("usdc")));
71
41
  export {
72
- getAvailableTokens,
73
- getDefaultReceivingToken,
74
- resolveSigningChainType,
75
- updateUrlParams
42
+ h as getAvailableTokens,
43
+ C as getDefaultReceivingToken,
44
+ L as resolveSigningChainType,
45
+ p as updateUrlParams
76
46
  };