@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,86 +1,86 @@
1
- import { useAppKitProvider } from "@reown/appkit/react";
2
- import { useAppKitConnection } from "@reown/appkit-adapter-solana/react";
3
- import { TransactionInstruction, Transaction, PublicKey } from "@solana/web3.js";
4
- import { useSendTransaction } from "wagmi";
5
- const useSignTransaction = () => {
1
+ import { useAppKitProvider as l, useAppKitAccount as S } from "@reown/appkit/react";
2
+ import { useAppKitConnection as v } from "@reown/appkit-adapter-solana/react";
3
+ import { TransactionInstruction as y, Transaction as E, PublicKey as b } from "@solana/web3.js";
4
+ import { useSendTransaction as A } from "wagmi";
5
+ const k = () => {
6
6
  const {
7
- data: hash,
8
- sendTransactionAsync: signEvmTransaction,
9
- ...rest
10
- } = useSendTransaction();
11
- const { connection } = useAppKitConnection();
12
- const { walletProvider: solWalletProvider } = useAppKitProvider("solana");
13
- const { walletProvider: btcWalletProvider } = useAppKitProvider("bip122");
14
- const { walletProvider: suiWalletProvider } = useAppKitProvider("sui");
15
- const signTransactionSolanaTransaction = async ({
16
- feePayer,
17
- instructions,
18
- recentBlockhash
7
+ data: u,
8
+ sendTransactionAsync: g,
9
+ ...h
10
+ } = A(), { connection: i } = v(), { walletProvider: w } = l("solana"), { walletProvider: s } = l("bip122"), { walletProvider: a } = l("sui"), { address: c } = S({
11
+ namespace: "sui"
12
+ }), p = async ({
13
+ feePayer: n,
14
+ instructions: t,
15
+ recentBlockhash: r
19
16
  }) => {
20
- for (const instruction of instructions) {
21
- const transactionInstruction = new TransactionInstruction({
22
- ...instruction
23
- });
24
- const transaction = new Transaction().add(transactionInstruction);
25
- transaction.feePayer = new PublicKey(feePayer);
26
- if (connection) {
27
- transaction.recentBlockhash = recentBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
28
- }
29
- return await solWalletProvider.signAndSendTransaction(transaction);
17
+ for (const e of t) {
18
+ const o = new y({
19
+ ...e
20
+ }), d = new E().add(o);
21
+ return d.feePayer = new b(n), i && (d.recentBlockhash = r ?? (await i.getLatestBlockhash("confirmed")).blockhash), await w.signAndSendTransaction(d);
30
22
  }
31
- };
32
- const signPSBT = async (params) => {
33
- if (!btcWalletProvider) {
23
+ }, f = async (n) => {
24
+ if (!s)
34
25
  throw Error("user is disconnected");
35
- }
36
- params.signInputs = [];
37
- const signature = await btcWalletProvider.signPSBT(params);
38
- return signature.psbt;
39
- };
40
- const signSuiTransaction = async (suiParams) => {
41
- const transaction = (suiParams == null ? void 0 : suiParams.transaction) ?? (suiParams == null ? void 0 : suiParams.transactionBlock);
42
- if (!transaction) {
26
+ return (await s.signPSBT(n)).psbt;
27
+ }, T = async (n) => {
28
+ const t = (n == null ? void 0 : n.transaction) ?? (n == null ? void 0 : n.transactionBlock);
29
+ if (!t)
43
30
  throw new Error("No Sui transaction bytes provided");
44
- }
45
- if (!(suiParams == null ? void 0 : suiParams.address)) {
31
+ if (!(n != null && n.address))
46
32
  throw new Error("No Sui sender address");
47
- }
48
- if (!suiWalletProvider) {
33
+ if (!a)
49
34
  throw new Error("Sui wallet not connected");
35
+ const r = 32 * 1024;
36
+ if (!t || typeof t != "string")
37
+ throw new Error(
38
+ "Invalid Sui transaction: payload must be a non-empty string"
39
+ );
40
+ try {
41
+ if (atob(t).length > r)
42
+ throw new Error(
43
+ `Sui transaction payload exceeds maximum size of ${r} bytes`
44
+ );
45
+ } catch (o) {
46
+ throw o instanceof Error && o.message.includes("maximum size") ? o : new Error("Invalid Sui transaction: payload is not valid base64");
50
47
  }
51
- const result = await suiWalletProvider.request({
48
+ if (n.address && c && n.address !== c)
49
+ throw new Error(
50
+ `Sui address mismatch: expected ${c}, got ${n.address}`
51
+ );
52
+ const e = await a.request({
52
53
  method: "sui_signTransaction",
53
54
  params: {
54
- transaction,
55
- address: suiParams.address
55
+ transaction: t,
56
+ address: n.address
56
57
  }
57
58
  });
58
- if (!result) {
59
+ if (!e)
59
60
  throw new Error("Sui wallet did not return a signature");
60
- }
61
- return result.signature;
61
+ return e.signature;
62
62
  };
63
63
  return {
64
64
  evm: {
65
- hash,
66
- signTransaction: signEvmTransaction,
67
- ...rest
65
+ hash: u,
66
+ signTransaction: g,
67
+ ...h
68
68
  },
69
69
  solana: {
70
- signTransaction: signTransactionSolanaTransaction,
71
- connection,
72
- walletProvider: solWalletProvider
70
+ signTransaction: p,
71
+ connection: i,
72
+ walletProvider: w
73
73
  },
74
74
  bitcoin: {
75
- signTransaction: signPSBT,
76
- walletProvider: btcWalletProvider
75
+ signTransaction: f,
76
+ walletProvider: s
77
77
  },
78
78
  sui: {
79
- signTransaction: signSuiTransaction,
80
- walletProvider: suiWalletProvider
79
+ signTransaction: T,
80
+ walletProvider: a
81
81
  }
82
82
  };
83
83
  };
84
84
  export {
85
- useSignTransaction
85
+ k as useSignTransaction
86
86
  };
@@ -1,87 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const react = require("@reown/appkit/react");
5
- const appkitControllers = require("@reown/appkit-controllers");
6
- const React = require("react");
7
- const SUI_NS = "sui";
8
- const STUCK_WHILE_MODAL_OPEN_MS = 6e4;
9
- const STUCK_WHILE_MODAL_CLOSED_MS = 8e3;
10
- const MODAL_CLOSE_SETTLE_MS = 200;
11
- const WC_RECONNECT_GRACE_MS = 25e3;
12
- function useSuiConnect() {
13
- const { open: openAppKitModal } = react.useAppKit();
14
- const { open: isModalOpen } = react.useAppKitState();
15
- const { disconnect: appKitDisconnect } = react.useDisconnect();
16
- const appKitAccount = react.useAppKitAccount({ namespace: SUI_NS });
17
- const wasModalOpenRef = React.useRef(isModalOpen);
18
- const [reconnectGraceExpired, setReconnectGraceExpired] = React.useState(false);
19
- React.useEffect(() => {
20
- const t = globalThis.setTimeout(
21
- () => setReconnectGraceExpired(true),
22
- WC_RECONNECT_GRACE_MS
23
- );
24
- return () => globalThis.clearTimeout(t);
25
- }, []);
26
- const clearStuckConnecting = React.useCallback(async () => {
27
- if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
28
- return;
29
- }
30
- try {
31
- await appKitDisconnect({ namespace: SUI_NS });
32
- } catch {
33
- }
34
- try {
35
- appkitControllers.ChainController.resetAccount(SUI_NS);
36
- } catch {
37
- }
38
- }, [appKitAccount.status, appKitAccount.isConnected, appKitDisconnect]);
39
- React.useEffect(() => {
40
- const prev = wasModalOpenRef.current;
41
- wasModalOpenRef.current = isModalOpen;
42
- if (prev === true && isModalOpen === false) {
43
- const t = globalThis.setTimeout(() => {
44
- void clearStuckConnecting();
45
- }, MODAL_CLOSE_SETTLE_MS);
46
- return () => globalThis.clearTimeout(t);
47
- }
48
- }, [isModalOpen, clearStuckConnecting]);
49
- React.useEffect(() => {
50
- if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
51
- return;
52
- }
53
- if (!reconnectGraceExpired) {
54
- return;
55
- }
56
- const delayMs = isModalOpen ? STUCK_WHILE_MODAL_OPEN_MS : STUCK_WHILE_MODAL_CLOSED_MS;
57
- const t = globalThis.setTimeout(() => {
58
- void clearStuckConnecting();
59
- }, delayMs);
60
- return () => globalThis.clearTimeout(t);
61
- }, [
62
- appKitAccount.status,
63
- appKitAccount.isConnected,
64
- isModalOpen,
65
- reconnectGraceExpired,
66
- clearStuckConnecting
67
- ]);
68
- const connect = React.useCallback(() => {
69
- openAppKitModal({ view: "Connect", namespace: SUI_NS });
70
- }, [openAppKitModal]);
71
- const disconnect = React.useCallback(async () => {
72
- try {
73
- await appKitDisconnect({ namespace: SUI_NS });
74
- } catch (error) {
75
- console.error("Sui disconnect failed:", error);
76
- }
77
- }, [appKitDisconnect]);
78
- return {
79
- suiAddress: appKitAccount.address ?? null,
80
- isConnecting: appKitAccount.status === "connecting",
81
- isConnected: appKitAccount.isConnected,
82
- connect,
83
- disconnect,
84
- cancelPendingConnection: clearStuckConnecting
85
- };
86
- }
87
- exports.useSuiConnect = useSuiConnect;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("@reown/appkit/react"),T=require("@reown/appkit-controllers"),t=require("react"),o="sui",f=6e4,E=8e3,_=200,g=25e3;function b(){const{open:u}=a.useAppKit(),{open:c}=a.useAppKitState(),{disconnect:i}=a.useDisconnect(),e=a.useAppKitAccount({namespace:o}),l=t.useRef(c),[p,d]=t.useState(!1);t.useEffect(()=>{const n=globalThis.setTimeout(()=>d(!0),g);return()=>globalThis.clearTimeout(n)},[]);const s=t.useCallback(async()=>{if(!(e.status!=="connecting"||e.isConnected)){try{await i({namespace:o})}catch{}try{T.ChainController.resetAccount(o)}catch{}}},[e.status,e.isConnected,i]);t.useEffect(()=>{const n=l.current;if(l.current=c,n===!0&&c===!1){const r=globalThis.setTimeout(()=>{s()},_);return()=>globalThis.clearTimeout(r)}},[c,s]),t.useEffect(()=>{if(e.status!=="connecting"||e.isConnected||!p)return;const n=c?f:E,r=globalThis.setTimeout(()=>{s()},n);return()=>globalThis.clearTimeout(r)},[e.status,e.isConnected,c,p,s]);const C=t.useCallback(()=>{u({view:"Connect",namespace:o})},[u]),S=t.useCallback(async()=>{try{await i({namespace:o})}catch(n){console.error("Sui disconnect failed:",n)}},[i]);return{suiAddress:e.address??null,isConnecting:e.status==="connecting",isConnected:e.isConnected,connect:C,disconnect:S,cancelPendingConnection:s}}exports.useSuiConnect=b;
@@ -1,86 +1,68 @@
1
- import { useAppKit, useAppKitState, useDisconnect, useAppKitAccount } from "@reown/appkit/react";
2
- import { ChainController } from "@reown/appkit-controllers";
3
- import { useRef, useState, useEffect, useCallback } from "react";
4
- const SUI_NS = "sui";
5
- const STUCK_WHILE_MODAL_OPEN_MS = 6e4;
6
- const STUCK_WHILE_MODAL_CLOSED_MS = 8e3;
7
- const MODAL_CLOSE_SETTLE_MS = 200;
8
- const WC_RECONNECT_GRACE_MS = 25e3;
9
- function useSuiConnect() {
10
- const { open: openAppKitModal } = useAppKit();
11
- const { open: isModalOpen } = useAppKitState();
12
- const { disconnect: appKitDisconnect } = useDisconnect();
13
- const appKitAccount = useAppKitAccount({ namespace: SUI_NS });
14
- const wasModalOpenRef = useRef(isModalOpen);
15
- const [reconnectGraceExpired, setReconnectGraceExpired] = useState(false);
16
- useEffect(() => {
1
+ import { useAppKit as m, useAppKitState as S, useDisconnect as f, useAppKitAccount as _ } from "@reown/appkit/react";
2
+ import { ChainController as E } from "@reown/appkit-controllers";
3
+ import { useRef as g, useState as A, useEffect as a, useCallback as r } from "react";
4
+ const o = "sui", M = 6e4, h = 8e3, O = 200, K = 25e3;
5
+ function D() {
6
+ const { open: u } = m(), { open: n } = S(), { disconnect: s } = f(), e = _({ namespace: o }), l = g(n), [p, d] = A(!1);
7
+ a(() => {
17
8
  const t = globalThis.setTimeout(
18
- () => setReconnectGraceExpired(true),
19
- WC_RECONNECT_GRACE_MS
9
+ () => d(!0),
10
+ K
20
11
  );
21
12
  return () => globalThis.clearTimeout(t);
22
13
  }, []);
23
- const clearStuckConnecting = useCallback(async () => {
24
- if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
25
- return;
26
- }
27
- try {
28
- await appKitDisconnect({ namespace: SUI_NS });
29
- } catch {
30
- }
31
- try {
32
- ChainController.resetAccount(SUI_NS);
33
- } catch {
14
+ const c = r(async () => {
15
+ if (!(e.status !== "connecting" || e.isConnected)) {
16
+ try {
17
+ await s({ namespace: o });
18
+ } catch {
19
+ }
20
+ try {
21
+ E.resetAccount(o);
22
+ } catch {
23
+ }
34
24
  }
35
- }, [appKitAccount.status, appKitAccount.isConnected, appKitDisconnect]);
36
- useEffect(() => {
37
- const prev = wasModalOpenRef.current;
38
- wasModalOpenRef.current = isModalOpen;
39
- if (prev === true && isModalOpen === false) {
40
- const t = globalThis.setTimeout(() => {
41
- void clearStuckConnecting();
42
- }, MODAL_CLOSE_SETTLE_MS);
43
- return () => globalThis.clearTimeout(t);
25
+ }, [e.status, e.isConnected, s]);
26
+ a(() => {
27
+ const t = l.current;
28
+ if (l.current = n, t === !0 && n === !1) {
29
+ const i = globalThis.setTimeout(() => {
30
+ c();
31
+ }, O);
32
+ return () => globalThis.clearTimeout(i);
44
33
  }
45
- }, [isModalOpen, clearStuckConnecting]);
46
- useEffect(() => {
47
- if (appKitAccount.status !== "connecting" || appKitAccount.isConnected) {
34
+ }, [n, c]), a(() => {
35
+ if (e.status !== "connecting" || e.isConnected || !p)
48
36
  return;
49
- }
50
- if (!reconnectGraceExpired) {
51
- return;
52
- }
53
- const delayMs = isModalOpen ? STUCK_WHILE_MODAL_OPEN_MS : STUCK_WHILE_MODAL_CLOSED_MS;
54
- const t = globalThis.setTimeout(() => {
55
- void clearStuckConnecting();
56
- }, delayMs);
57
- return () => globalThis.clearTimeout(t);
37
+ const t = n ? M : h, i = globalThis.setTimeout(() => {
38
+ c();
39
+ }, t);
40
+ return () => globalThis.clearTimeout(i);
58
41
  }, [
59
- appKitAccount.status,
60
- appKitAccount.isConnected,
61
- isModalOpen,
62
- reconnectGraceExpired,
63
- clearStuckConnecting
42
+ e.status,
43
+ e.isConnected,
44
+ n,
45
+ p,
46
+ c
64
47
  ]);
65
- const connect = useCallback(() => {
66
- openAppKitModal({ view: "Connect", namespace: SUI_NS });
67
- }, [openAppKitModal]);
68
- const disconnect = useCallback(async () => {
48
+ const C = r(() => {
49
+ u({ view: "Connect", namespace: o });
50
+ }, [u]), T = r(async () => {
69
51
  try {
70
- await appKitDisconnect({ namespace: SUI_NS });
71
- } catch (error) {
72
- console.error("Sui disconnect failed:", error);
52
+ await s({ namespace: o });
53
+ } catch (t) {
54
+ console.error("Sui disconnect failed:", t);
73
55
  }
74
- }, [appKitDisconnect]);
56
+ }, [s]);
75
57
  return {
76
- suiAddress: appKitAccount.address ?? null,
77
- isConnecting: appKitAccount.status === "connecting",
78
- isConnected: appKitAccount.isConnected,
79
- connect,
80
- disconnect,
81
- cancelPendingConnection: clearStuckConnecting
58
+ suiAddress: e.address ?? null,
59
+ isConnecting: e.status === "connecting",
60
+ isConnected: e.isConnected,
61
+ connect: C,
62
+ disconnect: T,
63
+ cancelPendingConnection: c
82
64
  };
83
65
  }
84
66
  export {
85
- useSuiConnect
67
+ D as useSuiConnect
86
68
  };
@@ -1,11 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const reactjs_hooks_validation_useAmountSchema = require("./useAmountSchema.js");
5
- const reactjs_hooks_validation_useSecondAmountSchema = require("./useSecondAmountSchema.js");
6
- const reactjs_hooks_validation_useTestHasEnoughFunds = require("./useTestHasEnoughFunds.js");
7
- const reactjs_hooks_validation_useTestIsConnected = require("./useTestIsConnected.js");
8
- exports.useAmountSchema = reactjs_hooks_validation_useAmountSchema.useAmountSchema;
9
- exports.useSecondAmountSchema = reactjs_hooks_validation_useSecondAmountSchema.useSecondAmountSchema;
10
- exports.useTestHasEnoughFunds = reactjs_hooks_validation_useTestHasEnoughFunds.useTestHasEnoughFunds;
11
- exports.useTestIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./useAmountSchema.js"),s=require("./useSecondAmountSchema.js"),o=require("./useTestHasEnoughFunds.js"),n=require("./useTestIsConnected.js");exports.useAmountSchema=e.useAmountSchema;exports.useSecondAmountSchema=s.useSecondAmountSchema;exports.useTestHasEnoughFunds=o.useTestHasEnoughFunds;exports.useTestIsConnected=n.useTestIsConnected;
@@ -1,10 +1,10 @@
1
- import { useAmountSchema } from "./useAmountSchema.mjs";
2
- import { useSecondAmountSchema } from "./useSecondAmountSchema.mjs";
3
- import { useTestHasEnoughFunds } from "./useTestHasEnoughFunds.mjs";
4
- import { useTestIsConnected } from "./useTestIsConnected.mjs";
1
+ import { useAmountSchema as s } from "./useAmountSchema.mjs";
2
+ import { useSecondAmountSchema as m } from "./useSecondAmountSchema.mjs";
3
+ import { useTestHasEnoughFunds as u } from "./useTestHasEnoughFunds.mjs";
4
+ import { useTestIsConnected as c } from "./useTestIsConnected.mjs";
5
5
  export {
6
- useAmountSchema,
7
- useSecondAmountSchema,
8
- useTestHasEnoughFunds,
9
- useTestIsConnected
6
+ s as useAmountSchema,
7
+ m as useSecondAmountSchema,
8
+ u as useTestHasEnoughFunds,
9
+ c as useTestIsConnected
10
10
  };
@@ -1,33 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const yup = require("yup");
5
- const reactjs_hooks_validation_useTestHasEnoughFunds = require("./useTestHasEnoughFunds.js");
6
- const reactjs_hooks_validation_useTestIsConnected = require("./useTestIsConnected.js");
7
- function _interopNamespaceDefault(e) {
8
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
9
- if (e) {
10
- for (const k in e) {
11
- if (k !== "default") {
12
- const d = Object.getOwnPropertyDescriptor(e, k);
13
- Object.defineProperty(n, k, d.get ? d : {
14
- enumerable: true,
15
- get: () => e[k]
16
- });
17
- }
18
- }
19
- }
20
- n.default = e;
21
- return Object.freeze(n);
22
- }
23
- const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
24
- const useAmountSchema = ({
25
- isMvxConnected
26
- }) => {
27
- const testHasEnoughFunds = reactjs_hooks_validation_useTestHasEnoughFunds.useTestHasEnoughFunds();
28
- const testIsConnected = reactjs_hooks_validation_useTestIsConnected.useTestIsConnected({ isMvxConnected });
29
- const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
30
- const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
31
- return yup__namespace.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
32
- };
33
- exports.useAmountSchema = useAmountSchema;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("yup"),c=require("./useTestHasEnoughFunds.js"),i=require("./useTestIsConnected.js");function d(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const s in t)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(t,s);Object.defineProperty(n,s,o.get?o:{enumerable:!0,get:()=>t[s]})}}return n.default=t,Object.freeze(n)}const a=d(u),m=({isMvxConnected:t})=>{const n=c.useTestHasEnoughFunds(),s=i.useTestIsConnected({isMvxConnected:t}),o=e=>!(e!=null&&e.startsWith(".")),r=e=>!(e!=null&&e.endsWith("."));return a.string().required("Amount is a required field").test("account",s).test("startDot","Amount must not start with dot",o).test("endDot","Amount must not end with dot",r).test("funds",n)};exports.useAmountSchema=m;
@@ -1,15 +1,12 @@
1
- import * as yup from "yup";
2
- import { useTestHasEnoughFunds } from "./useTestHasEnoughFunds.mjs";
3
- import { useTestIsConnected } from "./useTestIsConnected.mjs";
4
- const useAmountSchema = ({
5
- isMvxConnected
1
+ import * as d from "yup";
2
+ import { useTestHasEnoughFunds as m } from "./useTestHasEnoughFunds.mjs";
3
+ import { useTestIsConnected as i } from "./useTestIsConnected.mjs";
4
+ const h = ({
5
+ isMvxConnected: s
6
6
  }) => {
7
- const testHasEnoughFunds = useTestHasEnoughFunds();
8
- const testIsConnected = useTestIsConnected({ isMvxConnected });
9
- const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
10
- const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
11
- return yup.string().required("Amount is a required field").test("account", testIsConnected).test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot).test("funds", testHasEnoughFunds);
7
+ const o = m(), n = i({ isMvxConnected: s }), e = (t) => !(t != null && t.startsWith(".")), r = (t) => !(t != null && t.endsWith("."));
8
+ return d.string().required("Amount is a required field").test("account", n).test("startDot", "Amount must not start with dot", e).test("endDot", "Amount must not end with dot", r).test("funds", o);
12
9
  };
13
10
  export {
14
- useAmountSchema
11
+ h as useAmountSchema
15
12
  };
@@ -1,27 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const yup = require("yup");
5
- function _interopNamespaceDefault(e) {
6
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
7
- if (e) {
8
- for (const k in e) {
9
- if (k !== "default") {
10
- const d = Object.getOwnPropertyDescriptor(e, k);
11
- Object.defineProperty(n, k, d.get ? d : {
12
- enumerable: true,
13
- get: () => e[k]
14
- });
15
- }
16
- }
17
- }
18
- n.default = e;
19
- return Object.freeze(n);
20
- }
21
- const yup__namespace = /* @__PURE__ */ _interopNamespaceDefault(yup);
22
- const useSecondAmountSchema = () => {
23
- const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
24
- const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
25
- return yup__namespace.string().required("Amount is a required field").test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot);
26
- };
27
- exports.useSecondAmountSchema = useSecondAmountSchema;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("yup");function s(e){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return n.default=e,Object.freeze(n)}const c=s(r),i=()=>{const e=t=>!(t!=null&&t.startsWith(".")),n=t=>!(t!=null&&t.endsWith("."));return c.string().required("Amount is a required field").test("startDot","Amount must not start with dot",e).test("endDot","Amount must not end with dot",n)};exports.useSecondAmountSchema=i;
@@ -1,9 +1,8 @@
1
- import * as yup from "yup";
2
- const useSecondAmountSchema = () => {
3
- const testStartDot = (value) => !(value == null ? void 0 : value.startsWith("."));
4
- const testEndDot = (value) => !(value == null ? void 0 : value.endsWith("."));
5
- return yup.string().required("Amount is a required field").test("startDot", "Amount must not start with dot", testStartDot).test("endDot", "Amount must not end with dot", testEndDot);
1
+ import * as n from "yup";
2
+ const r = () => {
3
+ const o = (t) => !(t != null && t.startsWith(".")), s = (t) => !(t != null && t.endsWith("."));
4
+ return n.string().required("Amount is a required field").test("startDot", "Amount must not start with dot", o).test("endDot", "Amount must not end with dot", s);
6
5
  };
7
6
  export {
8
- useSecondAmountSchema
7
+ r as useSecondAmountSchema
9
8
  };
@@ -1,38 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const React = require("react");
5
- const reactjs_utils_hasEnoughFunds = require("../../utils/hasEnoughFunds.js");
6
- const reactjs_utils_testNumber = require("../../utils/testNumber.js");
7
- const useTestHasEnoughFunds = () => {
8
- const shouldThrow = React.useCallback(
9
- (value, context) => {
10
- if (!reactjs_utils_testNumber.testNumber(value)) {
11
- return false;
12
- }
13
- const asset = context.parent.firstToken;
14
- const balance = (asset == null ? void 0 : asset.balance) ?? "0";
15
- const decimals = asset == null ? void 0 : asset.decimals;
16
- const hasFunds = reactjs_utils_hasEnoughFunds.hasEnoughFunds({
17
- balance: balance ?? "0",
18
- amount: value ?? "0",
19
- decimals
20
- });
21
- return !hasFunds;
22
- },
23
- []
24
- );
25
- return React.useCallback(
26
- (value, context) => {
27
- if (!shouldThrow(value, context)) {
28
- return true;
29
- }
30
- return context.createError({
31
- message: "Not enough funds",
32
- path: context.path
33
- });
34
- },
35
- [shouldThrow]
36
- );
37
- };
38
- exports.useTestHasEnoughFunds = useTestHasEnoughFunds;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),o=require("../../utils/hasEnoughFunds.js"),c=require("../../utils/testNumber.js"),l=()=>{const u=r.useCallback((n,s)=>{if(!c.testNumber(n))return!1;const e=s.parent.firstToken,t=(e==null?void 0:e.balance)??"0",a=e==null?void 0:e.decimals;return!o.hasEnoughFunds({balance:t??"0",amount:n??"0",decimals:a})},[]);return r.useCallback((n,s)=>u(n,s)?s.createError({message:"Not enough funds",path:s.path}):!0,[u])};exports.useTestHasEnoughFunds=l;
@@ -1,37 +1,28 @@
1
- import { useCallback } from "react";
2
- import { hasEnoughFunds } from "../../utils/hasEnoughFunds.mjs";
3
- import { testNumber } from "../../utils/testNumber.mjs";
4
- const useTestHasEnoughFunds = () => {
5
- const shouldThrow = useCallback(
6
- (value, context) => {
7
- if (!testNumber(value)) {
8
- return false;
9
- }
10
- const asset = context.parent.firstToken;
11
- const balance = (asset == null ? void 0 : asset.balance) ?? "0";
12
- const decimals = asset == null ? void 0 : asset.decimals;
13
- const hasFunds = hasEnoughFunds({
14
- balance: balance ?? "0",
15
- amount: value ?? "0",
16
- decimals
1
+ import { useCallback as e } from "react";
2
+ import { hasEnoughFunds as a } from "../../utils/hasEnoughFunds.mjs";
3
+ import { testNumber as c } from "../../utils/testNumber.mjs";
4
+ const i = () => {
5
+ const s = e(
6
+ (o, n) => {
7
+ if (!c(o))
8
+ return !1;
9
+ const r = n.parent.firstToken, t = (r == null ? void 0 : r.balance) ?? "0", u = r == null ? void 0 : r.decimals;
10
+ return !a({
11
+ balance: t ?? "0",
12
+ amount: o ?? "0",
13
+ decimals: u
17
14
  });
18
- return !hasFunds;
19
15
  },
20
16
  []
21
17
  );
22
- return useCallback(
23
- (value, context) => {
24
- if (!shouldThrow(value, context)) {
25
- return true;
26
- }
27
- return context.createError({
28
- message: "Not enough funds",
29
- path: context.path
30
- });
31
- },
32
- [shouldThrow]
18
+ return e(
19
+ (o, n) => s(o, n) ? n.createError({
20
+ message: "Not enough funds",
21
+ path: n.path
22
+ }) : !0,
23
+ [s]
33
24
  );
34
25
  };
35
26
  export {
36
- useTestHasEnoughFunds
27
+ i as useTestHasEnoughFunds
37
28
  };
@@ -1,28 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const React = require("react");
5
- const helpers_getMvxChainId = require("../../../helpers/getMvxChainId.js");
6
- const reactjs_hooks_useAccount = require("../useAccount.js");
7
- const useTestIsConnected = ({
8
- isMvxConnected
9
- }) => {
10
- const { address } = reactjs_hooks_useAccount.useAccount();
11
- return React.useCallback(
12
- (_value, context) => {
13
- const firstToken = context.parent.firstToken;
14
- const mvxChainId = helpers_getMvxChainId.getMvxChainId();
15
- const isFromMvxChain = (firstToken == null ? void 0 : firstToken.chainId) === mvxChainId;
16
- const isConnected = isFromMvxChain ? isMvxConnected : Boolean(address);
17
- if (isConnected) {
18
- return true;
19
- }
20
- return context.createError({
21
- message: "Please connect your wallet",
22
- path: context.path
23
- });
24
- },
25
- [address, isMvxConnected]
26
- );
27
- };
28
- exports.useTestIsConnected = useTestIsConnected;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react"),c=require("../../../helpers/getMvxChainId.js"),a=require("../useAccount.js"),u=({isMvxConnected:s})=>{const{address:t}=a.useAccount();return o.useCallback((i,e)=>{const n=e.parent.firstToken,r=c.getMvxChainId();return((n==null?void 0:n.chainId)===r?s:!!t)?!0:e.createError({message:"Please connect your wallet",path:e.path})},[t,s])};exports.useTestIsConnected=u;