@multiversx/sdk-dapp-liquidity 2.1.0-alpha.0 → 2.1.0-alpha.2

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 (362) 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.js +1 -23
  38. package/helpers/assertRateConfirmationMatchesIntent.mjs +13 -16
  39. package/helpers/base64Utils.js +1 -31
  40. package/helpers/base64Utils.mjs +14 -24
  41. package/helpers/decodeLoginToken.js +1 -27
  42. package/helpers/decodeLoginToken.mjs +13 -18
  43. package/helpers/decodeToken.js +1 -39
  44. package/helpers/decodeToken.mjs +20 -31
  45. package/helpers/getApiURL.js +1 -7
  46. package/helpers/getApiURL.mjs +3 -5
  47. package/helpers/getBridgeURL.js +1 -7
  48. package/helpers/getBridgeURL.mjs +3 -5
  49. package/helpers/getDisplayName.js +1 -11
  50. package/helpers/getDisplayName.mjs +3 -8
  51. package/helpers/getMvxApiURL.js +1 -7
  52. package/helpers/getMvxApiURL.mjs +3 -5
  53. package/helpers/getMvxChainId.js +1 -7
  54. package/helpers/getMvxChainId.mjs +3 -5
  55. package/helpers/getMvxExplorerAddress.js +1 -7
  56. package/helpers/getMvxExplorerAddress.mjs +3 -5
  57. package/helpers/index.js +1 -26
  58. package/helpers/index.mjs +24 -24
  59. package/helpers/safeImageUrl.js +1 -23
  60. package/helpers/safeImageUrl.mjs +10 -20
  61. package/helpers/serializeTransaction.js +1 -8
  62. package/helpers/serializeTransaction.mjs +3 -5
  63. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.js +1 -63
  64. package/helpers/tests/assertRateConfirmationMatchesIntent.spec.mjs +31 -41
  65. package/helpers/tests/base64Utils.spec.js +1 -29
  66. package/helpers/tests/base64Utils.spec.mjs +11 -24
  67. package/helpers/tests/decodeLoginToken.spec.js +1 -34
  68. package/helpers/tests/decodeLoginToken.spec.mjs +13 -24
  69. package/helpers/tests/decodeToken.spec.js +1 -27
  70. package/helpers/tests/decodeToken.spec.mjs +7 -12
  71. package/helpers/tests/safeImageUrl.spec.js +1 -48
  72. package/helpers/tests/safeImageUrl.spec.mjs +28 -43
  73. package/helpers/tests/serializeTransaction.spec.js +1 -36
  74. package/helpers/tests/serializeTransaction.spec.mjs +13 -24
  75. package/index.js +1 -232
  76. package/index.mjs +196 -196
  77. package/package.json +5 -4
  78. package/react.esm-B0AMOHxa.js +73 -0
  79. package/react.esm-BxvJJ86Q.mjs +9949 -0
  80. package/reactjs/adapters/SuiAdapter.js +1 -378
  81. package/reactjs/adapters/SuiAdapter.mjs +160 -217
  82. package/reactjs/components/AccountAddress/AccountAddress.js +1 -31
  83. package/reactjs/components/AccountAddress/AccountAddress.mjs +16 -16
  84. package/reactjs/components/AccountAddress/index.js +1 -4
  85. package/reactjs/components/AccountAddress/index.mjs +2 -2
  86. package/reactjs/components/AmountCard/AmountCard.js +1 -33
  87. package/reactjs/components/AmountCard/AmountCard.mjs +19 -21
  88. package/reactjs/components/AmountCard/index.js +1 -4
  89. package/reactjs/components/AmountCard/index.mjs +2 -2
  90. package/reactjs/components/AmountInput/AmountInput.js +1 -71
  91. package/reactjs/components/AmountInput/AmountInput.mjs +42 -46
  92. package/reactjs/components/AmountInput/index.js +1 -4
  93. package/reactjs/components/AmountInput/index.mjs +2 -2
  94. package/reactjs/components/BridgeForm/BridgeForm.d.ts +9 -0
  95. package/reactjs/components/BridgeForm/BridgeForm.js +1 -89
  96. package/reactjs/components/BridgeForm/BridgeForm.mjs +72 -79
  97. package/reactjs/components/BridgeForm/Deposit.js +1 -675
  98. package/reactjs/components/BridgeForm/Deposit.mjs +380 -504
  99. package/reactjs/components/BridgeForm/Transfer.js +1 -561
  100. package/reactjs/components/BridgeForm/Transfer.mjs +315 -428
  101. package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.js +1 -78
  102. package/reactjs/components/BridgeForm/hooks/useBridgeAmounts.mjs +47 -70
  103. package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.js +1 -58
  104. package/reactjs/components/BridgeForm/hooks/useBridgeRateFetching.mjs +36 -47
  105. package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.js +1 -266
  106. package/reactjs/components/BridgeForm/hooks/useBridgeTokenSelection.mjs +163 -231
  107. package/reactjs/components/BridgeForm/index.js +1 -4
  108. package/reactjs/components/BridgeForm/index.mjs +2 -2
  109. package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.js +1 -76
  110. package/reactjs/components/BridgeForm/utils/bridgeFormHelpers.mjs +33 -65
  111. package/reactjs/components/BridgeHistory/BridgeHistory.js +1 -381
  112. package/reactjs/components/BridgeHistory/BridgeHistory.mjs +170 -200
  113. package/reactjs/components/BridgeHistory/index.js +1 -4
  114. package/reactjs/components/BridgeHistory/index.mjs +2 -2
  115. package/reactjs/components/Connect/BridgeAccountDisplay.js +1 -150
  116. package/reactjs/components/Connect/BridgeAccountDisplay.mjs +99 -115
  117. package/reactjs/components/Connect/BridgeConnectButton.js +1 -35
  118. package/reactjs/components/Connect/BridgeConnectButton.mjs +20 -20
  119. package/reactjs/components/Connect/ChainSelectConnect.js +1 -144
  120. package/reactjs/components/Connect/ChainSelectConnect.mjs +70 -83
  121. package/reactjs/components/Connect/CustomConnectButton.js +1 -40
  122. package/reactjs/components/Connect/CustomConnectButton.mjs +24 -30
  123. package/reactjs/components/Connect/MvxAccountDisplay.js +1 -97
  124. package/reactjs/components/Connect/MvxAccountDisplay.mjs +47 -50
  125. package/reactjs/components/Connect/MvxConnectButton.js +1 -43
  126. package/reactjs/components/Connect/MvxConnectButton.mjs +35 -40
  127. package/reactjs/components/Connect/SwitchChainButton.js +1 -29
  128. package/reactjs/components/Connect/SwitchChainButton.mjs +15 -18
  129. package/reactjs/components/Connect/index.js +1 -16
  130. package/reactjs/components/Connect/index.mjs +14 -14
  131. package/reactjs/components/CopyButton/CopyButton.js +1 -46
  132. package/reactjs/components/CopyButton/CopyButton.mjs +33 -36
  133. package/reactjs/components/CopyButton/index.js +1 -4
  134. package/reactjs/components/CopyButton/index.mjs +2 -2
  135. package/reactjs/components/CopyButton/utils/copyToClipboard.js +1 -38
  136. package/reactjs/components/CopyButton/utils/copyToClipboard.mjs +20 -32
  137. package/reactjs/components/CopyButton/utils/index.js +1 -4
  138. package/reactjs/components/CopyButton/utils/index.mjs +2 -2
  139. package/reactjs/components/DisplayAmount/DisplayAmount.js +1 -90
  140. package/reactjs/components/DisplayAmount/DisplayAmount.mjs +68 -75
  141. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.js +1 -39
  142. package/reactjs/components/DisplayAmount/components/AnimateNumber/AnimateNumber.mjs +26 -33
  143. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.js +1 -61
  144. package/reactjs/components/DisplayAmount/components/PrecisedAmount/PrecisedAmount.mjs +38 -46
  145. package/reactjs/components/DisplayAmount/index.js +1 -4
  146. package/reactjs/components/DisplayAmount/index.mjs +2 -2
  147. package/reactjs/components/DisplayAmount/utils/index.js +1 -4
  148. package/reactjs/components/DisplayAmount/utils/index.mjs +2 -2
  149. package/reactjs/components/DisplayAmount/utils/truncateAmount.js +1 -21
  150. package/reactjs/components/DisplayAmount/utils/truncateAmount.mjs +9 -13
  151. package/reactjs/components/Error/Error.js +1 -66
  152. package/reactjs/components/Error/Error.mjs +29 -29
  153. package/reactjs/components/Error/index.js +1 -4
  154. package/reactjs/components/Error/index.mjs +2 -2
  155. package/reactjs/components/SmallLoader/SmallLoader.js +1 -21
  156. package/reactjs/components/SmallLoader/SmallLoader.mjs +13 -18
  157. package/reactjs/components/SmallLoader/index.js +1 -4
  158. package/reactjs/components/SmallLoader/index.mjs +2 -2
  159. package/reactjs/components/ToggleDirection/ToggleDirection.js +1 -30
  160. package/reactjs/components/ToggleDirection/ToggleDirection.mjs +22 -28
  161. package/reactjs/components/TokenSelector/TokenSelector.js +1 -172
  162. package/reactjs/components/TokenSelector/TokenSelector.mjs +98 -118
  163. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.js +1 -94
  164. package/reactjs/components/TokenSelector/components/ChainSelect/ChainSelect.mjs +48 -57
  165. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.js +1 -55
  166. package/reactjs/components/TokenSelector/components/ChainSelect/components/ChainOptionLabel.mjs +45 -48
  167. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.js +1 -18
  168. package/reactjs/components/TokenSelector/components/ChainSelect/components/FormatChainOptionLabel.mjs +9 -14
  169. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.js +1 -6
  170. package/reactjs/components/TokenSelector/components/ChainSelect/components/IndicatorSeparator.mjs +2 -4
  171. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.js +1 -43
  172. package/reactjs/components/TokenSelector/components/ChainSelect/components/SelectedChainOption.mjs +21 -21
  173. package/reactjs/components/TokenSelector/components/SelectContainer.js +1 -40
  174. package/reactjs/components/TokenSelector/components/SelectContainer.mjs +36 -38
  175. package/reactjs/components/TokenSelector/components/SelectContent.js +1 -136
  176. package/reactjs/components/TokenSelector/components/SelectContent.mjs +79 -103
  177. package/reactjs/components/TokenSelector/components/SelectedOption.js +1 -28
  178. package/reactjs/components/TokenSelector/components/SelectedOption.mjs +22 -24
  179. package/reactjs/components/TokenSelector/components/TokenIcon.js +1 -82
  180. package/reactjs/components/TokenSelector/components/TokenIcon.mjs +52 -58
  181. package/reactjs/components/TokenSelector/components/TokenItem.js +1 -80
  182. package/reactjs/components/TokenSelector/components/TokenItem.mjs +41 -54
  183. package/reactjs/components/TokenSelector/components/TokenList.js +1 -23
  184. package/reactjs/components/TokenSelector/components/TokenList.mjs +19 -21
  185. package/reactjs/components/TokenSelector/components/TokenSymbol.js +1 -25
  186. package/reactjs/components/TokenSelector/components/TokenSymbol.mjs +14 -15
  187. package/reactjs/components/TokenSelector/index.js +1 -4
  188. package/reactjs/components/TokenSelector/index.mjs +2 -2
  189. package/reactjs/components/TransactionToast/TransactionToast.js +1 -53
  190. package/reactjs/components/TransactionToast/TransactionToast.mjs +27 -28
  191. package/reactjs/components/TransactionToast/TransactionToastContainer.js +1 -20
  192. package/reactjs/components/TransactionToast/TransactionToastContainer.mjs +16 -18
  193. package/reactjs/components/TransactionToast/index.js +1 -6
  194. package/reactjs/components/TransactionToast/index.mjs +4 -4
  195. package/reactjs/components/TrimAddress/TrimAddress.js +1 -27
  196. package/reactjs/components/TrimAddress/TrimAddress.mjs +19 -24
  197. package/reactjs/components/TrimAddress/index.js +1 -4
  198. package/reactjs/components/TrimAddress/index.mjs +2 -2
  199. package/reactjs/components/base/MxButton/MxButton.js +1 -71
  200. package/reactjs/components/base/MxButton/MxButton.mjs +46 -46
  201. package/reactjs/components/base/MxButton/index.js +1 -4
  202. package/reactjs/components/base/MxButton/index.mjs +2 -2
  203. package/reactjs/components/base/MxCard/MxCard.js +1 -54
  204. package/reactjs/components/base/MxCard/MxCard.mjs +34 -34
  205. package/reactjs/components/base/MxCard/index.js +1 -4
  206. package/reactjs/components/base/MxCard/index.mjs +2 -2
  207. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.js +1 -28
  208. package/reactjs/components/base/MxCircleLoader/MxCircleLoader.mjs +24 -26
  209. package/reactjs/components/base/MxCircleLoader/index.js +1 -4
  210. package/reactjs/components/base/MxCircleLoader/index.mjs +2 -2
  211. package/reactjs/components/base/MxLink/MxLink.js +1 -70
  212. package/reactjs/components/base/MxLink/MxLink.mjs +44 -46
  213. package/reactjs/components/base/MxLink/index.js +1 -4
  214. package/reactjs/components/base/MxLink/index.mjs +2 -2
  215. package/reactjs/components/base/MxSearch/MxSearch.js +1 -69
  216. package/reactjs/components/base/MxSearch/MxSearch.mjs +37 -41
  217. package/reactjs/components/base/MxSearch/index.js +1 -4
  218. package/reactjs/components/base/MxSearch/index.mjs +2 -2
  219. package/reactjs/components/base/MxSlideover/MxSlideover.js +1 -78
  220. package/reactjs/components/base/MxSlideover/MxSlideover.mjs +72 -74
  221. package/reactjs/components/base/MxSlideover/index.js +1 -4
  222. package/reactjs/components/base/MxSlideover/index.mjs +2 -2
  223. package/reactjs/components/base/MxTooltip/MxTooltip.js +1 -163
  224. package/reactjs/components/base/MxTooltip/MxTooltip.mjs +92 -135
  225. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.js +1 -33
  226. package/reactjs/components/base/MxTooltip/components/TooltipContainer/TooltipContainer.mjs +29 -31
  227. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.js +1 -4
  228. package/reactjs/components/base/MxTooltip/components/TooltipContainer/index.mjs +2 -2
  229. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.js +1 -27
  230. package/reactjs/components/base/MxTooltip/components/TooltipContent/TooltipContent.mjs +23 -25
  231. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.js +1 -4
  232. package/reactjs/components/base/MxTooltip/components/TooltipContent/index.mjs +2 -2
  233. package/reactjs/components/base/MxTooltip/components/index.js +1 -6
  234. package/reactjs/components/base/MxTooltip/components/index.mjs +4 -4
  235. package/reactjs/components/base/MxTooltip/index.js +1 -4
  236. package/reactjs/components/base/MxTooltip/index.mjs +2 -2
  237. package/reactjs/components/base/index.js +1 -14
  238. package/reactjs/components/base/index.mjs +12 -12
  239. package/reactjs/components/index.js +1 -54
  240. package/reactjs/components/index.mjs +52 -52
  241. package/reactjs/constants/chains.js +1 -54
  242. package/reactjs/constants/chains.mjs +33 -52
  243. package/reactjs/constants/index.js +1 -13
  244. package/reactjs/constants/index.mjs +9 -10
  245. package/reactjs/context/Web3AppProvider.js +1 -42
  246. package/reactjs/context/Web3AppProvider.mjs +34 -36
  247. package/reactjs/context/queryClient.js +1 -11
  248. package/reactjs/context/queryClient.mjs +5 -8
  249. package/reactjs/context/useWeb3App.js +1 -12
  250. package/reactjs/context/useWeb3App.mjs +7 -8
  251. package/reactjs/helpers/index.js +1 -6
  252. package/reactjs/helpers/index.mjs +4 -4
  253. package/reactjs/helpers/resolveBridgeApiChainId.js +1 -40
  254. package/reactjs/helpers/resolveBridgeApiChainId.mjs +21 -34
  255. package/reactjs/hooks/index.js +1 -35
  256. package/reactjs/hooks/index.mjs +33 -33
  257. package/reactjs/hooks/tests/useGenericSignMessage.spec.js +1 -68
  258. package/reactjs/hooks/tests/useGenericSignMessage.spec.mjs +23 -38
  259. package/reactjs/hooks/tests/useSignTransaction.spec.js +1 -195
  260. package/reactjs/hooks/tests/useSignTransaction.spec.mjs +72 -110
  261. package/reactjs/hooks/useAccount.js +1 -13
  262. package/reactjs/hooks/useAccount.mjs +7 -8
  263. package/reactjs/hooks/useBalances.js +1 -53
  264. package/reactjs/hooks/useBalances.mjs +28 -40
  265. package/reactjs/hooks/useBridgeApiChainId.js +1 -13
  266. package/reactjs/hooks/useBridgeApiChainId.mjs +9 -9
  267. package/reactjs/hooks/useBridgeFormik.js +1 -167
  268. package/reactjs/hooks/useBridgeFormik.mjs +110 -155
  269. package/reactjs/hooks/useDebounce.js +1 -13
  270. package/reactjs/hooks/useDebounce.mjs +8 -10
  271. package/reactjs/hooks/useFetchBridgeData.js +1 -45
  272. package/reactjs/hooks/useFetchBridgeData.mjs +37 -38
  273. package/reactjs/hooks/useFetchTokens.js +1 -115
  274. package/reactjs/hooks/useFetchTokens.mjs +80 -108
  275. package/reactjs/hooks/useGenericSignMessage.js +1 -75
  276. package/reactjs/hooks/useGenericSignMessage.mjs +44 -64
  277. package/reactjs/hooks/useGetChainId.js +1 -11
  278. package/reactjs/hooks/useGetChainId.mjs +7 -8
  279. package/reactjs/hooks/useResolveTokenChain.js +1 -20
  280. package/reactjs/hooks/useResolveTokenChain.mjs +11 -14
  281. package/reactjs/hooks/useSendTransactions.js +1 -25
  282. package/reactjs/hooks/useSendTransactions.mjs +19 -23
  283. package/reactjs/hooks/useSignTransaction.js +1 -112
  284. package/reactjs/hooks/useSignTransaction.mjs +50 -76
  285. package/reactjs/hooks/useSuiConnect.js +1 -86
  286. package/reactjs/hooks/useSuiConnect.mjs +52 -70
  287. package/reactjs/hooks/validation/index.js +1 -10
  288. package/reactjs/hooks/validation/index.mjs +8 -8
  289. package/reactjs/hooks/validation/useAmountSchema.js +1 -32
  290. package/reactjs/hooks/validation/useAmountSchema.mjs +8 -11
  291. package/reactjs/hooks/validation/useSecondAmountSchema.js +1 -26
  292. package/reactjs/hooks/validation/useSecondAmountSchema.mjs +5 -6
  293. package/reactjs/hooks/validation/useTestHasEnoughFunds.js +1 -37
  294. package/reactjs/hooks/validation/useTestHasEnoughFunds.mjs +20 -29
  295. package/reactjs/hooks/validation/useTestIsConnected.js +1 -27
  296. package/reactjs/hooks/validation/useTestIsConnected.mjs +13 -19
  297. package/reactjs/index.js +1 -190
  298. package/reactjs/index.mjs +154 -154
  299. package/reactjs/init/index.js +1 -5
  300. package/reactjs/init/index.mjs +3 -3
  301. package/reactjs/init/init.js +1 -147
  302. package/reactjs/init/init.mjs +57 -78
  303. package/reactjs/queries/index.js +1 -17
  304. package/reactjs/queries/index.mjs +15 -15
  305. package/reactjs/queries/useCheckAccount.query.js +1 -39
  306. package/reactjs/queries/useCheckAccount.query.mjs +29 -33
  307. package/reactjs/queries/useGetAllTokens.query.js +1 -35
  308. package/reactjs/queries/useGetAllTokens.query.mjs +26 -30
  309. package/reactjs/queries/useGetChains.query.js +1 -34
  310. package/reactjs/queries/useGetChains.query.mjs +26 -28
  311. package/reactjs/queries/useGetHistory.query.js +1 -69
  312. package/reactjs/queries/useGetHistory.query.mjs +53 -57
  313. package/reactjs/queries/useGetMvxTokensBalances.query.js +1 -66
  314. package/reactjs/queries/useGetMvxTokensBalances.query.mjs +38 -46
  315. package/reactjs/queries/useGetNonMvxTokensBalances.query.js +1 -81
  316. package/reactjs/queries/useGetNonMvxTokensBalances.query.mjs +49 -57
  317. package/reactjs/queries/useGetRate.mutation.js +1 -18
  318. package/reactjs/queries/useGetRate.mutation.mjs +12 -15
  319. package/reactjs/reexports.js +1 -48
  320. package/reactjs/reexports.mjs +13 -13
  321. package/reactjs/utils/delay.js +1 -6
  322. package/reactjs/utils/delay.mjs +3 -3
  323. package/reactjs/utils/formatAmount.js +1 -23
  324. package/reactjs/utils/formatAmount.mjs +16 -17
  325. package/reactjs/utils/getCleanStringAmount.js +1 -11
  326. package/reactjs/utils/getCleanStringAmount.mjs +6 -8
  327. package/reactjs/utils/getCompletePathname.js +1 -5
  328. package/reactjs/utils/getCompletePathname.mjs +3 -3
  329. package/reactjs/utils/getInitialTokens.js +1 -12
  330. package/reactjs/utils/getInitialTokens.mjs +6 -7
  331. package/reactjs/utils/hasEnoughFunds.js +1 -19
  332. package/reactjs/utils/hasEnoughFunds.mjs +11 -14
  333. package/reactjs/utils/index.js +1 -26
  334. package/reactjs/utils/index.mjs +24 -24
  335. package/reactjs/utils/isStringFloat.js +1 -21
  336. package/reactjs/utils/isStringFloat.mjs +11 -18
  337. package/reactjs/utils/mxClsx.js +1 -8
  338. package/reactjs/utils/mxClsx.mjs +4 -6
  339. package/reactjs/utils/pipe.js +1 -25
  340. package/reactjs/utils/pipe.mjs +13 -17
  341. package/reactjs/utils/removeCommas.js +1 -6
  342. package/reactjs/utils/removeCommas.mjs +2 -4
  343. package/reactjs/utils/roundAmount.js +1 -40
  344. package/reactjs/utils/roundAmount.mjs +16 -36
  345. package/reactjs/utils/testNumber.js +1 -4
  346. package/reactjs/utils/testNumber.mjs +2 -2
  347. package/store/inMemoryStore.js +1 -39
  348. package/store/inMemoryStore.mjs +17 -21
  349. package/style.css +1 -2274
  350. package/types/chainType.js +1 -11
  351. package/types/chainType.mjs +2 -9
  352. package/types/errors.js +1 -9
  353. package/types/errors.mjs +4 -5
  354. package/types/providerType.js +1 -9
  355. package/types/providerType.mjs +2 -7
  356. package/types/transaction.d.ts +2 -0
  357. package/all-networks-EJIVYZ_i.mjs +0 -4
  358. package/all-networks-NYACMyeN.js +0 -4
  359. package/default-BYtXv70Z.mjs +0 -4
  360. package/default-H3AbmzFV.js +0 -4
  361. package/react.esm-7GsOwMPq.js +0 -11815
  362. package/react.esm-CU-Iqz8D.mjs +0 -11796
@@ -1,25 +1,21 @@
1
- import { useCallback } from "react";
2
- import { sendTransactions } from "../../api/sendTransactions.mjs";
3
- const useSendTransactions = () => {
4
- return useCallback(
5
- async ({
6
- transactions,
7
- provider,
8
- url,
9
- token,
10
- axiosConfig
11
- }) => {
12
- return await sendTransactions({
13
- transactions,
14
- provider,
15
- url,
16
- token,
17
- axiosConfig
18
- });
19
- },
20
- []
21
- );
22
- };
1
+ import { useCallback as o } from "react";
2
+ import { sendTransactions as e } from "../../api/sendTransactions.mjs";
3
+ const m = () => o(
4
+ async ({
5
+ transactions: r,
6
+ provider: n,
7
+ url: a,
8
+ token: s,
9
+ axiosConfig: t
10
+ }) => await e({
11
+ transactions: r,
12
+ provider: n,
13
+ url: a,
14
+ token: s,
15
+ axiosConfig: t
16
+ }),
17
+ []
18
+ );
23
19
  export {
24
- useSendTransactions
20
+ m as useSendTransactions
25
21
  };
@@ -1,113 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const react$1 = require("@reown/appkit/react");
5
- const react = require("@reown/appkit-adapter-solana/react");
6
- const web3_js = require("@solana/web3.js");
7
- const wagmi = require("wagmi");
8
- const useSignTransaction = () => {
9
- const {
10
- data: hash,
11
- sendTransactionAsync: signEvmTransaction,
12
- ...rest
13
- } = wagmi.useSendTransaction();
14
- const { connection } = react.useAppKitConnection();
15
- const { walletProvider: solWalletProvider } = react$1.useAppKitProvider("solana");
16
- const { walletProvider: btcWalletProvider } = react$1.useAppKitProvider("bip122");
17
- const { walletProvider: suiWalletProvider } = react$1.useAppKitProvider("sui");
18
- const { address: suiAddress } = react$1.useAppKitAccount({
19
- namespace: "sui"
20
- });
21
- const signTransactionSolanaTransaction = async ({
22
- feePayer,
23
- instructions,
24
- recentBlockhash
25
- }) => {
26
- for (const instruction of instructions) {
27
- const transactionInstruction = new web3_js.TransactionInstruction({
28
- ...instruction
29
- });
30
- const transaction = new web3_js.Transaction().add(transactionInstruction);
31
- transaction.feePayer = new web3_js.PublicKey(feePayer);
32
- if (connection) {
33
- transaction.recentBlockhash = recentBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
34
- }
35
- return await solWalletProvider.signAndSendTransaction(transaction);
36
- }
37
- };
38
- const signPSBT = async (params) => {
39
- if (!btcWalletProvider) {
40
- throw Error("user is disconnected");
41
- }
42
- const signature = await btcWalletProvider.signPSBT(params);
43
- return signature.psbt;
44
- };
45
- const signSuiTransaction = async (suiParams) => {
46
- const transaction = (suiParams == null ? void 0 : suiParams.transaction) ?? (suiParams == null ? void 0 : suiParams.transactionBlock);
47
- if (!transaction) {
48
- throw new Error("No Sui transaction bytes provided");
49
- }
50
- if (!(suiParams == null ? void 0 : suiParams.address)) {
51
- throw new Error("No Sui sender address");
52
- }
53
- if (!suiWalletProvider) {
54
- throw new Error("Sui wallet not connected");
55
- }
56
- const MAX_SUI_PAYLOAD_BYTES = 32 * 1024;
57
- if (!transaction || typeof transaction !== "string") {
58
- throw new Error(
59
- "Invalid Sui transaction: payload must be a non-empty string"
60
- );
61
- }
62
- try {
63
- const decoded = atob(transaction);
64
- if (decoded.length > MAX_SUI_PAYLOAD_BYTES) {
65
- throw new Error(
66
- `Sui transaction payload exceeds maximum size of ${MAX_SUI_PAYLOAD_BYTES} bytes`
67
- );
68
- }
69
- } catch (e) {
70
- if (e instanceof Error && e.message.includes("maximum size")) {
71
- throw e;
72
- }
73
- throw new Error("Invalid Sui transaction: payload is not valid base64");
74
- }
75
- if (suiParams.address && suiAddress && suiParams.address !== suiAddress) {
76
- throw new Error(
77
- `Sui address mismatch: expected ${suiAddress}, got ${suiParams.address}`
78
- );
79
- }
80
- const result = await suiWalletProvider.request({
81
- method: "sui_signTransaction",
82
- params: {
83
- transaction,
84
- address: suiParams.address
85
- }
86
- });
87
- if (!result) {
88
- throw new Error("Sui wallet did not return a signature");
89
- }
90
- return result.signature;
91
- };
92
- return {
93
- evm: {
94
- hash,
95
- signTransaction: signEvmTransaction,
96
- ...rest
97
- },
98
- solana: {
99
- signTransaction: signTransactionSolanaTransaction,
100
- connection,
101
- walletProvider: solWalletProvider
102
- },
103
- bitcoin: {
104
- signTransaction: signPSBT,
105
- walletProvider: btcWalletProvider
106
- },
107
- sui: {
108
- signTransaction: signSuiTransaction,
109
- walletProvider: suiWalletProvider
110
- }
111
- };
112
- };
113
- exports.useSignTransaction = useSignTransaction;
2
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("@reown/appkit/react"),f=require("@reown/appkit-adapter-solana/react"),w=require("@solana/web3.js"),y=require("wagmi"),b=()=>{const{data:g,sendTransactionAsync:h,...p}=y.useSendTransaction(),{connection:s}=f.useAppKitConnection(),{walletProvider:u}=i.useAppKitProvider("solana"),{walletProvider:a}=i.useAppKitProvider("bip122"),{walletProvider:c}=i.useAppKitProvider("sui"),{address:d}=i.useAppKitAccount({namespace:"sui"}),v=async({feePayer:n,instructions:t,recentBlockhash:r})=>{for(const o of t){const e=new w.TransactionInstruction({...o}),l=new w.Transaction().add(e);return l.feePayer=new w.PublicKey(n),s&&(l.recentBlockhash=r??(await s.getLatestBlockhash("confirmed")).blockhash),await u.signAndSendTransaction(l)}},S=async n=>{if(!a)throw Error("user is disconnected");return(await a.signPSBT(n)).psbt},T=async n=>{const t=(n==null?void 0:n.transaction)??(n==null?void 0:n.transactionBlock);if(!t)throw new Error("No Sui transaction bytes provided");if(!(n!=null&&n.address))throw new Error("No Sui sender address");if(!c)throw new Error("Sui wallet not connected");const r=32*1024;if(!t||typeof t!="string")throw new Error("Invalid Sui transaction: payload must be a non-empty string");try{if(atob(t).length>r)throw new Error(`Sui transaction payload exceeds maximum size of ${r} bytes`)}catch(e){throw e instanceof Error&&e.message.includes("maximum size")?e:new Error("Invalid Sui transaction: payload is not valid base64")}if(n.address&&d&&n.address!==d)throw new Error(`Sui address mismatch: expected ${d}, got ${n.address}`);const o=await c.request({method:"sui_signTransaction",params:{transaction:t,address:n.address}});if(!o)throw new Error("Sui wallet did not return a signature");return o.signature};return{evm:{hash:g,signTransaction:h,...p},solana:{signTransaction:v,connection:s,walletProvider:u},bitcoin:{signTransaction:S,walletProvider:a},sui:{signTransaction:T,walletProvider:c}}};exports.useSignTransaction=b;
@@ -1,112 +1,86 @@
1
- import { useAppKitProvider, useAppKitAccount } 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 { address: suiAddress } = useAppKitAccount({
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({
16
11
  namespace: "sui"
17
- });
18
- const signTransactionSolanaTransaction = async ({
19
- feePayer,
20
- instructions,
21
- recentBlockhash
12
+ }), p = async ({
13
+ feePayer: n,
14
+ instructions: t,
15
+ recentBlockhash: r
22
16
  }) => {
23
- for (const instruction of instructions) {
24
- const transactionInstruction = new TransactionInstruction({
25
- ...instruction
26
- });
27
- const transaction = new Transaction().add(transactionInstruction);
28
- transaction.feePayer = new PublicKey(feePayer);
29
- if (connection) {
30
- transaction.recentBlockhash = recentBlockhash ?? (await connection.getLatestBlockhash("confirmed")).blockhash;
31
- }
32
- 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);
33
22
  }
34
- };
35
- const signPSBT = async (params) => {
36
- if (!btcWalletProvider) {
23
+ }, f = async (n) => {
24
+ if (!s)
37
25
  throw Error("user is disconnected");
38
- }
39
- const signature = await btcWalletProvider.signPSBT(params);
40
- return signature.psbt;
41
- };
42
- const signSuiTransaction = async (suiParams) => {
43
- const transaction = (suiParams == null ? void 0 : suiParams.transaction) ?? (suiParams == null ? void 0 : suiParams.transactionBlock);
44
- 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)
45
30
  throw new Error("No Sui transaction bytes provided");
46
- }
47
- if (!(suiParams == null ? void 0 : suiParams.address)) {
31
+ if (!(n != null && n.address))
48
32
  throw new Error("No Sui sender address");
49
- }
50
- if (!suiWalletProvider) {
33
+ if (!a)
51
34
  throw new Error("Sui wallet not connected");
52
- }
53
- const MAX_SUI_PAYLOAD_BYTES = 32 * 1024;
54
- if (!transaction || typeof transaction !== "string") {
35
+ const r = 32 * 1024;
36
+ if (!t || typeof t != "string")
55
37
  throw new Error(
56
38
  "Invalid Sui transaction: payload must be a non-empty string"
57
39
  );
58
- }
59
40
  try {
60
- const decoded = atob(transaction);
61
- if (decoded.length > MAX_SUI_PAYLOAD_BYTES) {
41
+ if (atob(t).length > r)
62
42
  throw new Error(
63
- `Sui transaction payload exceeds maximum size of ${MAX_SUI_PAYLOAD_BYTES} bytes`
43
+ `Sui transaction payload exceeds maximum size of ${r} bytes`
64
44
  );
65
- }
66
- } catch (e) {
67
- if (e instanceof Error && e.message.includes("maximum size")) {
68
- throw e;
69
- }
70
- throw new Error("Invalid Sui transaction: payload is not valid base64");
45
+ } catch (o) {
46
+ throw o instanceof Error && o.message.includes("maximum size") ? o : new Error("Invalid Sui transaction: payload is not valid base64");
71
47
  }
72
- if (suiParams.address && suiAddress && suiParams.address !== suiAddress) {
48
+ if (n.address && c && n.address !== c)
73
49
  throw new Error(
74
- `Sui address mismatch: expected ${suiAddress}, got ${suiParams.address}`
50
+ `Sui address mismatch: expected ${c}, got ${n.address}`
75
51
  );
76
- }
77
- const result = await suiWalletProvider.request({
52
+ const e = await a.request({
78
53
  method: "sui_signTransaction",
79
54
  params: {
80
- transaction,
81
- address: suiParams.address
55
+ transaction: t,
56
+ address: n.address
82
57
  }
83
58
  });
84
- if (!result) {
59
+ if (!e)
85
60
  throw new Error("Sui wallet did not return a signature");
86
- }
87
- return result.signature;
61
+ return e.signature;
88
62
  };
89
63
  return {
90
64
  evm: {
91
- hash,
92
- signTransaction: signEvmTransaction,
93
- ...rest
65
+ hash: u,
66
+ signTransaction: g,
67
+ ...h
94
68
  },
95
69
  solana: {
96
- signTransaction: signTransactionSolanaTransaction,
97
- connection,
98
- walletProvider: solWalletProvider
70
+ signTransaction: p,
71
+ connection: i,
72
+ walletProvider: w
99
73
  },
100
74
  bitcoin: {
101
- signTransaction: signPSBT,
102
- walletProvider: btcWalletProvider
75
+ signTransaction: f,
76
+ walletProvider: s
103
77
  },
104
78
  sui: {
105
- signTransaction: signSuiTransaction,
106
- walletProvider: suiWalletProvider
79
+ signTransaction: T,
80
+ walletProvider: a
107
81
  }
108
82
  };
109
83
  };
110
84
  export {
111
- useSignTransaction
85
+ k as useSignTransaction
112
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
  };