@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,64 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const types_errors = require("../../types/errors.js");
4
- const helpers_assertRateConfirmationMatchesIntent = require("../assertRateConfirmationMatchesIntent.js");
5
- const makeTransaction = (overrides = {}) => ({
6
- to: "0xdeadbeef",
7
- data: "0x",
8
- gasLimit: BigInt(21e3),
9
- value: BigInt(0),
10
- account: "0xSender",
11
- txHash: "",
12
- ...overrides
13
- });
14
- describe("assertRateConfirmationMatchesIntent", () => {
15
- const intent = { fromChainId: "1", sender: "0xSender" };
16
- it("does not throw for an empty transactions array", () => {
17
- expect(() => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intent, [])).not.toThrow();
18
- });
19
- it("does not throw when chainID and account match", () => {
20
- const tx = makeTransaction({ chainID: "1", account: "0xSender" });
21
- expect(
22
- () => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intent, [tx])
23
- ).not.toThrow();
24
- });
25
- it("does not throw when chainID is undefined (field absent)", () => {
26
- const tx = makeTransaction({ account: "0xSender" });
27
- expect(
28
- () => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intent, [tx])
29
- ).not.toThrow();
30
- });
31
- it("throws RateConfirmationMismatchError when chainID does not match fromChainId", () => {
32
- const tx = makeTransaction({ chainID: "999", account: "0xSender" });
33
- expect(() => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intent, [tx])).toThrow(
34
- types_errors.RateConfirmationMismatchError
35
- );
36
- });
37
- it("throws RateConfirmationMismatchError when account does not match sender (case-insensitive)", () => {
38
- const tx = makeTransaction({ account: "0xAttacker" });
39
- expect(() => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intent, [tx])).toThrow(
40
- types_errors.RateConfirmationMismatchError
41
- );
42
- });
43
- it("does not throw when account matches sender case-insensitively", () => {
44
- const tx = makeTransaction({ account: "0xsender" });
45
- const intentLower = { fromChainId: "1", sender: "0xSENDER" };
46
- expect(
47
- () => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intentLower, [tx])
48
- ).not.toThrow();
49
- });
50
- it("throws RateConfirmationMismatchError when MvX sender field does not match", () => {
51
- const tx = makeTransaction({ account: "0xSender", sender: "erd1attacker" });
52
- const mvxIntent = { fromChainId: "1", sender: "erd1legit" };
53
- expect(() => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(mvxIntent, [tx])).toThrow(
54
- types_errors.RateConfirmationMismatchError
55
- );
56
- });
57
- it("throws on the bad transaction when mixed valid and invalid transactions are present", () => {
58
- const goodTx = makeTransaction({ chainID: "1", account: "0xSender" });
59
- const badTx = makeTransaction({ chainID: "999", account: "0xSender" });
60
- expect(
61
- () => helpers_assertRateConfirmationMatchesIntent.assertRateConfirmationMatchesIntent(intent, [goodTx, badTx])
62
- ).toThrow(types_errors.RateConfirmationMismatchError);
63
- });
64
- });
2
+ "use strict";const r=require("../../types/errors.js"),e=require("../assertRateConfirmationMatchesIntent.js"),o=(n={})=>({to:"0xdeadbeef",data:"0x",gasLimit:BigInt(21e3),value:BigInt(0),account:"0xSender",txHash:"",...n});describe("assertRateConfirmationMatchesIntent",()=>{const n={fromChainId:"1",sender:"0xSender"};it("does not throw for an empty transactions array",()=>{expect(()=>e.assertRateConfirmationMatchesIntent(n,[])).not.toThrow()}),it("does not throw when chainID and account match",()=>{const t=o({chainID:"1",account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).not.toThrow()}),it("does not throw when chainID is undefined (field absent)",()=>{const t=o({account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).not.toThrow()}),it("throws RateConfirmationMismatchError when chainID does not match fromChainId",()=>{const t=o({chainID:"999",account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).toThrow(r.RateConfirmationMismatchError)}),it("throws RateConfirmationMismatchError when account does not match sender (case-insensitive)",()=>{const t=o({account:"0xAttacker"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t])).toThrow(r.RateConfirmationMismatchError)}),it("does not throw when account matches sender case-insensitively",()=>{const t=o({account:"0xsender"}),a={fromChainId:"1",sender:"0xSENDER"};expect(()=>e.assertRateConfirmationMatchesIntent(a,[t])).not.toThrow()}),it("throws RateConfirmationMismatchError when MvX sender field does not match",()=>{const t=o({account:"0xSender",sender:"erd1attacker"}),a={fromChainId:"1",sender:"erd1legit"};expect(()=>e.assertRateConfirmationMatchesIntent(a,[t])).toThrow(r.RateConfirmationMismatchError)}),it("throws on the bad transaction when mixed valid and invalid transactions are present",()=>{const t=o({chainID:"1",account:"0xSender"}),a=o({chainID:"999",account:"0xSender"});expect(()=>e.assertRateConfirmationMatchesIntent(n,[t,a])).toThrow(r.RateConfirmationMismatchError)})});
@@ -1,62 +1,52 @@
1
- import { RateConfirmationMismatchError } from "../../types/errors.mjs";
2
- import { assertRateConfirmationMatchesIntent } from "../assertRateConfirmationMatchesIntent.mjs";
3
- const makeTransaction = (overrides = {}) => ({
1
+ import { RateConfirmationMismatchError as r } from "../../types/errors.mjs";
2
+ import { assertRateConfirmationMatchesIntent as e } from "../assertRateConfirmationMatchesIntent.mjs";
3
+ const o = (n = {}) => ({
4
4
  to: "0xdeadbeef",
5
5
  data: "0x",
6
6
  gasLimit: BigInt(21e3),
7
7
  value: BigInt(0),
8
8
  account: "0xSender",
9
9
  txHash: "",
10
- ...overrides
10
+ ...n
11
11
  });
12
12
  describe("assertRateConfirmationMatchesIntent", () => {
13
- const intent = { fromChainId: "1", sender: "0xSender" };
13
+ const n = { fromChainId: "1", sender: "0xSender" };
14
14
  it("does not throw for an empty transactions array", () => {
15
- expect(() => assertRateConfirmationMatchesIntent(intent, [])).not.toThrow();
16
- });
17
- it("does not throw when chainID and account match", () => {
18
- const tx = makeTransaction({ chainID: "1", account: "0xSender" });
15
+ expect(() => e(n, [])).not.toThrow();
16
+ }), it("does not throw when chainID and account match", () => {
17
+ const t = o({ chainID: "1", account: "0xSender" });
19
18
  expect(
20
- () => assertRateConfirmationMatchesIntent(intent, [tx])
19
+ () => e(n, [t])
21
20
  ).not.toThrow();
22
- });
23
- it("does not throw when chainID is undefined (field absent)", () => {
24
- const tx = makeTransaction({ account: "0xSender" });
21
+ }), it("does not throw when chainID is undefined (field absent)", () => {
22
+ const t = o({ account: "0xSender" });
25
23
  expect(
26
- () => assertRateConfirmationMatchesIntent(intent, [tx])
24
+ () => e(n, [t])
27
25
  ).not.toThrow();
28
- });
29
- it("throws RateConfirmationMismatchError when chainID does not match fromChainId", () => {
30
- const tx = makeTransaction({ chainID: "999", account: "0xSender" });
31
- expect(() => assertRateConfirmationMatchesIntent(intent, [tx])).toThrow(
32
- RateConfirmationMismatchError
26
+ }), it("throws RateConfirmationMismatchError when chainID does not match fromChainId", () => {
27
+ const t = o({ chainID: "999", account: "0xSender" });
28
+ expect(() => e(n, [t])).toThrow(
29
+ r
33
30
  );
34
- });
35
- it("throws RateConfirmationMismatchError when account does not match sender (case-insensitive)", () => {
36
- const tx = makeTransaction({ account: "0xAttacker" });
37
- expect(() => assertRateConfirmationMatchesIntent(intent, [tx])).toThrow(
38
- RateConfirmationMismatchError
31
+ }), it("throws RateConfirmationMismatchError when account does not match sender (case-insensitive)", () => {
32
+ const t = o({ account: "0xAttacker" });
33
+ expect(() => e(n, [t])).toThrow(
34
+ r
39
35
  );
40
- });
41
- it("does not throw when account matches sender case-insensitively", () => {
42
- const tx = makeTransaction({ account: "0xsender" });
43
- const intentLower = { fromChainId: "1", sender: "0xSENDER" };
36
+ }), it("does not throw when account matches sender case-insensitively", () => {
37
+ const t = o({ account: "0xsender" }), a = { fromChainId: "1", sender: "0xSENDER" };
44
38
  expect(
45
- () => assertRateConfirmationMatchesIntent(intentLower, [tx])
39
+ () => e(a, [t])
46
40
  ).not.toThrow();
47
- });
48
- it("throws RateConfirmationMismatchError when MvX sender field does not match", () => {
49
- const tx = makeTransaction({ account: "0xSender", sender: "erd1attacker" });
50
- const mvxIntent = { fromChainId: "1", sender: "erd1legit" };
51
- expect(() => assertRateConfirmationMatchesIntent(mvxIntent, [tx])).toThrow(
52
- RateConfirmationMismatchError
41
+ }), it("throws RateConfirmationMismatchError when MvX sender field does not match", () => {
42
+ const t = o({ account: "0xSender", sender: "erd1attacker" }), a = { fromChainId: "1", sender: "erd1legit" };
43
+ expect(() => e(a, [t])).toThrow(
44
+ r
53
45
  );
54
- });
55
- it("throws on the bad transaction when mixed valid and invalid transactions are present", () => {
56
- const goodTx = makeTransaction({ chainID: "1", account: "0xSender" });
57
- const badTx = makeTransaction({ chainID: "999", account: "0xSender" });
46
+ }), it("throws on the bad transaction when mixed valid and invalid transactions are present", () => {
47
+ const t = o({ chainID: "1", account: "0xSender" }), a = o({ chainID: "999", account: "0xSender" });
58
48
  expect(
59
- () => assertRateConfirmationMatchesIntent(intent, [goodTx, badTx])
60
- ).toThrow(RateConfirmationMismatchError);
49
+ () => e(n, [t, a])
50
+ ).toThrow(r);
61
51
  });
62
52
  });
@@ -1,30 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const helpers_base64Utils = require("../base64Utils.js");
4
- describe("base64Utils", () => {
5
- it("encodes a string to base64", () => {
6
- const input = "Hello, World!";
7
- const expectedOutput = "SGVsbG8sIFdvcmxkIQ==";
8
- expect(helpers_base64Utils.encodeToBase64(input)).toBe(expectedOutput);
9
- });
10
- it("decodes a base64 string", () => {
11
- const input = "SGVsbG8sIFdvcmxkIQ==";
12
- const expectedOutput = "Hello, World!";
13
- expect(helpers_base64Utils.decodeBase64(input)).toBe(expectedOutput);
14
- });
15
- it("encodes an empty string to base64", () => {
16
- const input = "";
17
- const expectedOutput = "";
18
- expect(helpers_base64Utils.encodeToBase64(input)).toBe(expectedOutput);
19
- });
20
- it("decodes an empty base64 string", () => {
21
- const input = "";
22
- const expectedOutput = "";
23
- expect(helpers_base64Utils.decodeBase64(input)).toBe(expectedOutput);
24
- });
25
- it("retrieve the given input if is an invalid base64 string", () => {
26
- const input = "Invalid base64 string";
27
- const decoded = helpers_base64Utils.decodeBase64(input);
28
- expect(decoded).toEqual(input);
29
- });
30
- });
2
+ "use strict";const s=require("../base64Utils.js");describe("base64Utils",()=>{it("encodes a string to base64",()=>{expect(s.encodeToBase64("Hello, World!")).toBe("SGVsbG8sIFdvcmxkIQ==")}),it("decodes a base64 string",()=>{expect(s.decodeBase64("SGVsbG8sIFdvcmxkIQ==")).toBe("Hello, World!")}),it("encodes an empty string to base64",()=>{expect(s.encodeToBase64("")).toBe("")}),it("decodes an empty base64 string",()=>{expect(s.decodeBase64("")).toBe("")}),it("retrieve the given input if is an invalid base64 string",()=>{const e="Invalid base64 string",t=s.decodeBase64(e);expect(t).toEqual(e)})});
@@ -1,28 +1,15 @@
1
- import { encodeToBase64, decodeBase64 } from "../base64Utils.mjs";
1
+ import { encodeToBase64 as n, decodeBase64 as s } from "../base64Utils.mjs";
2
2
  describe("base64Utils", () => {
3
3
  it("encodes a string to base64", () => {
4
- const input = "Hello, World!";
5
- const expectedOutput = "SGVsbG8sIFdvcmxkIQ==";
6
- expect(encodeToBase64(input)).toBe(expectedOutput);
7
- });
8
- it("decodes a base64 string", () => {
9
- const input = "SGVsbG8sIFdvcmxkIQ==";
10
- const expectedOutput = "Hello, World!";
11
- expect(decodeBase64(input)).toBe(expectedOutput);
12
- });
13
- it("encodes an empty string to base64", () => {
14
- const input = "";
15
- const expectedOutput = "";
16
- expect(encodeToBase64(input)).toBe(expectedOutput);
17
- });
18
- it("decodes an empty base64 string", () => {
19
- const input = "";
20
- const expectedOutput = "";
21
- expect(decodeBase64(input)).toBe(expectedOutput);
22
- });
23
- it("retrieve the given input if is an invalid base64 string", () => {
24
- const input = "Invalid base64 string";
25
- const decoded = decodeBase64(input);
26
- expect(decoded).toEqual(input);
4
+ expect(n("Hello, World!")).toBe("SGVsbG8sIFdvcmxkIQ==");
5
+ }), it("decodes a base64 string", () => {
6
+ expect(s("SGVsbG8sIFdvcmxkIQ==")).toBe("Hello, World!");
7
+ }), it("encodes an empty string to base64", () => {
8
+ expect(n("")).toBe("");
9
+ }), it("decodes an empty base64 string", () => {
10
+ expect(s("")).toBe("");
11
+ }), it("retrieve the given input if is an invalid base64 string", () => {
12
+ const t = "Invalid base64 string", e = s(t);
13
+ expect(e).toEqual(t);
27
14
  });
28
15
  });
@@ -1,35 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const helpers_decodeLoginToken = require("../decodeLoginToken.js");
4
- describe("decodeLoginToken", () => {
5
- it("decodes a valid login token", () => {
6
- const token = "aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9";
7
- const expectedPayload = {
8
- origin: "https://devnet.template-dapp.multiversx.com",
9
- blockHash: "ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651",
10
- ttl: 86400,
11
- extraInfo: { timestamp: 1733489400 }
12
- };
13
- expect(helpers_decodeLoginToken.decodeLoginToken(token)).toEqual(expectedPayload);
14
- });
15
- it("returns null for an invalid login token", () => {
16
- const token = "invalid.token.here";
17
- expect(helpers_decodeLoginToken.decodeLoginToken(token)).toBeNull();
18
- });
19
- it("returns null for an empty token", () => {
20
- const token = "";
21
- expect(helpers_decodeLoginToken.decodeLoginToken(token)).toBeNull();
22
- });
23
- it("returns null for a token with less than 4 parts", () => {
24
- const token = "part1.part2.part3";
25
- expect(helpers_decodeLoginToken.decodeLoginToken(token)).toBeNull();
26
- });
27
- it("returns null for a token with more than 4 parts", () => {
28
- const token = "part1.part2.part3.part4.part5";
29
- expect(helpers_decodeLoginToken.decodeLoginToken(token)).toBeNull();
30
- });
31
- it("returns null for a token with invalid JSON in extraInfo", () => {
32
- const token = "b3JpZ2lu.blockHash.3600.invalidBase64";
33
- expect(helpers_decodeLoginToken.decodeLoginToken(token)).toBeNull();
34
- });
35
- });
2
+ "use strict";const t=require("../decodeLoginToken.js");describe("decodeLoginToken",()=>{it("decodes a valid login token",()=>{const e="aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9",o={origin:"https://devnet.template-dapp.multiversx.com",blockHash:"ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651",ttl:86400,extraInfo:{timestamp:1733489400}};expect(t.decodeLoginToken(e)).toEqual(o)}),it("returns null for an invalid login token",()=>{expect(t.decodeLoginToken("invalid.token.here")).toBeNull()}),it("returns null for an empty token",()=>{expect(t.decodeLoginToken("")).toBeNull()}),it("returns null for a token with less than 4 parts",()=>{expect(t.decodeLoginToken("part1.part2.part3")).toBeNull()}),it("returns null for a token with more than 4 parts",()=>{expect(t.decodeLoginToken("part1.part2.part3.part4.part5")).toBeNull()}),it("returns null for a token with invalid JSON in extraInfo",()=>{expect(t.decodeLoginToken("b3JpZ2lu.blockHash.3600.invalidBase64")).toBeNull()})});
@@ -1,33 +1,22 @@
1
- import { decodeLoginToken } from "../decodeLoginToken.mjs";
1
+ import { decodeLoginToken as e } from "../decodeLoginToken.mjs";
2
2
  describe("decodeLoginToken", () => {
3
3
  it("decodes a valid login token", () => {
4
- const token = "aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9";
5
- const expectedPayload = {
4
+ const t = "aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9", n = {
6
5
  origin: "https://devnet.template-dapp.multiversx.com",
7
6
  blockHash: "ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651",
8
7
  ttl: 86400,
9
8
  extraInfo: { timestamp: 1733489400 }
10
9
  };
11
- expect(decodeLoginToken(token)).toEqual(expectedPayload);
12
- });
13
- it("returns null for an invalid login token", () => {
14
- const token = "invalid.token.here";
15
- expect(decodeLoginToken(token)).toBeNull();
16
- });
17
- it("returns null for an empty token", () => {
18
- const token = "";
19
- expect(decodeLoginToken(token)).toBeNull();
20
- });
21
- it("returns null for a token with less than 4 parts", () => {
22
- const token = "part1.part2.part3";
23
- expect(decodeLoginToken(token)).toBeNull();
24
- });
25
- it("returns null for a token with more than 4 parts", () => {
26
- const token = "part1.part2.part3.part4.part5";
27
- expect(decodeLoginToken(token)).toBeNull();
28
- });
29
- it("returns null for a token with invalid JSON in extraInfo", () => {
30
- const token = "b3JpZ2lu.blockHash.3600.invalidBase64";
31
- expect(decodeLoginToken(token)).toBeNull();
10
+ expect(e(t)).toEqual(n);
11
+ }), it("returns null for an invalid login token", () => {
12
+ expect(e("invalid.token.here")).toBeNull();
13
+ }), it("returns null for an empty token", () => {
14
+ expect(e("")).toBeNull();
15
+ }), it("returns null for a token with less than 4 parts", () => {
16
+ expect(e("part1.part2.part3")).toBeNull();
17
+ }), it("returns null for a token with more than 4 parts", () => {
18
+ expect(e("part1.part2.part3.part4.part5")).toBeNull();
19
+ }), it("returns null for a token with invalid JSON in extraInfo", () => {
20
+ expect(e("b3JpZ2lu.blockHash.3600.invalidBase64")).toBeNull();
32
21
  });
33
22
  });
@@ -1,28 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const helpers_decodeToken = require("../decodeToken.js");
4
- describe("decodeToken", () => {
5
- it("decodes a valid native auth token", async () => {
6
- const token = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
7
- const expectedPayload = {
8
- address: "erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex",
9
- blockHash: "ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651",
10
- body: "aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9",
11
- extraInfo: {
12
- timestamp: 1733489400
13
- },
14
- origin: "https://devnet.template-dapp.multiversx.com",
15
- signature: "04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01",
16
- ttl: 86400
17
- };
18
- expect(helpers_decodeToken.decodeToken(token)).toEqual(expectedPayload);
19
- });
20
- it("returns null for an invalid native auth token", async () => {
21
- const token = "invalid.token.here";
22
- expect(helpers_decodeToken.decodeToken(token)).toBeNull();
23
- });
24
- it("returns null for an empty token", async () => {
25
- const token = "";
26
- expect(helpers_decodeToken.decodeToken(token)).toBeNull();
27
- });
28
- });
2
+ "use strict";const a=require("../decodeToken.js");describe("decodeToken",()=>{it("decodes a valid native auth token",async()=>{const e="ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01",c={address:"erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex",blockHash:"ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651",body:"aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9",extraInfo:{timestamp:1733489400},origin:"https://devnet.template-dapp.multiversx.com",signature:"04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01",ttl:86400};expect(a.decodeToken(e)).toEqual(c)}),it("returns null for an invalid native auth token",async()=>{expect(a.decodeToken("invalid.token.here")).toBeNull()}),it("returns null for an empty token",async()=>{expect(a.decodeToken("")).toBeNull()})});
@@ -1,8 +1,7 @@
1
- import { decodeToken } from "../decodeToken.mjs";
1
+ import { decodeToken as a } from "../decodeToken.mjs";
2
2
  describe("decodeToken", () => {
3
3
  it("decodes a valid native auth token", async () => {
4
- const token = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01";
5
- const expectedPayload = {
4
+ const e = "ZXJkMXdoOWMwc2pyMnhuOGh6ZjAybHd3Y3I0amsyczg0dGF0OXVkMmthcTZ6cjd4enB2bDlsNXE4YXdtZXg.YUhSMGNITTZMeTlrWlhadVpYUXVkR1Z0Y0d4aGRHVXRaR0Z3Y0M1dGRXeDBhWFpsY25ONExtTnZiUS5lZjc2YjRjNzZlZjZlMTNhNjM5MDc2N2ZjNzhhODhjYTRiYmI1OTE4YTJiOWRkYzQ0OTQyOTI3NjkzNjUwNjUxLjg2NDAwLmV5SjBhVzFsYzNSaGJYQWlPakUzTXpNME9EazBNREI5.04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01", c = {
6
5
  address: "erd1wh9c0sjr2xn8hzf02lwwcr4jk2s84tat9ud2kaq6zr7xzpvl9l5q8awmex",
7
6
  blockHash: "ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651",
8
7
  body: "aHR0cHM6Ly9kZXZuZXQudGVtcGxhdGUtZGFwcC5tdWx0aXZlcnN4LmNvbQ.ef76b4c76ef6e13a6390767fc78a88ca4bbb5918a2b9ddc44942927693650651.86400.eyJ0aW1lc3RhbXAiOjE3MzM0ODk0MDB9",
@@ -13,14 +12,10 @@ describe("decodeToken", () => {
13
12
  signature: "04a986df7f0142837f9b1ca1ae4829f7b471e4c3470602ca6a16f2a4d7c6616c4e7628a93b4ce87d9534e95ab9215f893faeb9e0904e1d834007c16e43b12d01",
14
13
  ttl: 86400
15
14
  };
16
- expect(decodeToken(token)).toEqual(expectedPayload);
17
- });
18
- it("returns null for an invalid native auth token", async () => {
19
- const token = "invalid.token.here";
20
- expect(decodeToken(token)).toBeNull();
21
- });
22
- it("returns null for an empty token", async () => {
23
- const token = "";
24
- expect(decodeToken(token)).toBeNull();
15
+ expect(a(e)).toEqual(c);
16
+ }), it("returns null for an invalid native auth token", async () => {
17
+ expect(a("invalid.token.here")).toBeNull();
18
+ }), it("returns null for an empty token", async () => {
19
+ expect(a("")).toBeNull();
25
20
  });
26
21
  });
@@ -1,49 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const helpers_safeImageUrl = require("../safeImageUrl.js");
4
- describe("safeImageUrl", () => {
5
- it("passes through a valid https:// URL unchanged", () => {
6
- const url = "https://example.com/icon.png";
7
- expect(helpers_safeImageUrl.safeImageUrl(url)).toBe(url);
8
- });
9
- it("rejects an http:// URL and returns the default fallback", () => {
10
- expect(helpers_safeImageUrl.safeImageUrl("http://example.com/icon.png")).toBe("");
11
- });
12
- it("rejects a data: URL", () => {
13
- expect(helpers_safeImageUrl.safeImageUrl("data:image/png;base64,abc123")).toBe("");
14
- });
15
- it("rejects a javascript: URL", () => {
16
- expect(helpers_safeImageUrl.safeImageUrl("javascript:alert(1)")).toBe("");
17
- });
18
- it("rejects a file: URL", () => {
19
- expect(helpers_safeImageUrl.safeImageUrl("file:///etc/passwd")).toBe("");
20
- });
21
- it("rejects a blob: URL", () => {
22
- expect(helpers_safeImageUrl.safeImageUrl("blob:https://example.com/some-uuid")).toBe("");
23
- });
24
- it("rejects an empty string", () => {
25
- expect(helpers_safeImageUrl.safeImageUrl("")).toBe("");
26
- });
27
- it("rejects undefined", () => {
28
- expect(helpers_safeImageUrl.safeImageUrl(void 0)).toBe("");
29
- });
30
- it("rejects a URL longer than 2048 characters", () => {
31
- const url = "https://example.com/" + "a".repeat(2030);
32
- expect(url.length).toBeGreaterThan(2048);
33
- expect(helpers_safeImageUrl.safeImageUrl(url)).toBe("");
34
- });
35
- it("allows a URL of exactly 2048 characters", () => {
36
- const prefix = "https://example.com/";
37
- const url = prefix + "a".repeat(2048 - prefix.length);
38
- expect(url.length).toBe(2048);
39
- expect(helpers_safeImageUrl.safeImageUrl(url)).toBe(url);
40
- });
41
- it("returns the custom fallback when URL is invalid", () => {
42
- const fallback = "https://cdn.example.com/default.svg";
43
- expect(helpers_safeImageUrl.safeImageUrl("http://bad.example.com/icon.png", fallback)).toBe(
44
- fallback
45
- );
46
- expect(helpers_safeImageUrl.safeImageUrl(void 0, fallback)).toBe(fallback);
47
- expect(helpers_safeImageUrl.safeImageUrl("javascript:void(0)", fallback)).toBe(fallback);
48
- });
49
- });
2
+ "use strict";const t=require("../safeImageUrl.js");describe("safeImageUrl",()=>{it("passes through a valid https:// URL unchanged",()=>{const e="https://example.com/icon.png";expect(t.safeImageUrl(e)).toBe(e)}),it("rejects an http:// URL and returns the default fallback",()=>{expect(t.safeImageUrl("http://example.com/icon.png")).toBe("")}),it("rejects a data: URL",()=>{expect(t.safeImageUrl("data:image/png;base64,abc123")).toBe("")}),it("rejects a javascript: URL",()=>{expect(t.safeImageUrl("javascript:alert(1)")).toBe("")}),it("rejects a file: URL",()=>{expect(t.safeImageUrl("file:///etc/passwd")).toBe("")}),it("rejects a blob: URL",()=>{expect(t.safeImageUrl("blob:https://example.com/some-uuid")).toBe("")}),it("rejects an empty string",()=>{expect(t.safeImageUrl("")).toBe("")}),it("rejects undefined",()=>{expect(t.safeImageUrl(void 0)).toBe("")}),it("rejects a URL longer than 2048 characters",()=>{const e="https://example.com/"+"a".repeat(2030);expect(e.length).toBeGreaterThan(2048),expect(t.safeImageUrl(e)).toBe("")}),it("allows a URL of exactly 2048 characters",()=>{const e="https://example.com/",a=e+"a".repeat(2048-e.length);expect(a.length).toBe(2048),expect(t.safeImageUrl(a)).toBe(a)}),it("returns the custom fallback when URL is invalid",()=>{const e="https://cdn.example.com/default.svg";expect(t.safeImageUrl("http://bad.example.com/icon.png",e)).toBe(e),expect(t.safeImageUrl(void 0,e)).toBe(e),expect(t.safeImageUrl("javascript:void(0)",e)).toBe(e)})});
@@ -1,47 +1,32 @@
1
- import { safeImageUrl } from "../safeImageUrl.mjs";
1
+ import { safeImageUrl as t } from "../safeImageUrl.mjs";
2
2
  describe("safeImageUrl", () => {
3
3
  it("passes through a valid https:// URL unchanged", () => {
4
- const url = "https://example.com/icon.png";
5
- expect(safeImageUrl(url)).toBe(url);
6
- });
7
- it("rejects an http:// URL and returns the default fallback", () => {
8
- expect(safeImageUrl("http://example.com/icon.png")).toBe("");
9
- });
10
- it("rejects a data: URL", () => {
11
- expect(safeImageUrl("data:image/png;base64,abc123")).toBe("");
12
- });
13
- it("rejects a javascript: URL", () => {
14
- expect(safeImageUrl("javascript:alert(1)")).toBe("");
15
- });
16
- it("rejects a file: URL", () => {
17
- expect(safeImageUrl("file:///etc/passwd")).toBe("");
18
- });
19
- it("rejects a blob: URL", () => {
20
- expect(safeImageUrl("blob:https://example.com/some-uuid")).toBe("");
21
- });
22
- it("rejects an empty string", () => {
23
- expect(safeImageUrl("")).toBe("");
24
- });
25
- it("rejects undefined", () => {
26
- expect(safeImageUrl(void 0)).toBe("");
27
- });
28
- it("rejects a URL longer than 2048 characters", () => {
29
- const url = "https://example.com/" + "a".repeat(2030);
30
- expect(url.length).toBeGreaterThan(2048);
31
- expect(safeImageUrl(url)).toBe("");
32
- });
33
- it("allows a URL of exactly 2048 characters", () => {
34
- const prefix = "https://example.com/";
35
- const url = prefix + "a".repeat(2048 - prefix.length);
36
- expect(url.length).toBe(2048);
37
- expect(safeImageUrl(url)).toBe(url);
38
- });
39
- it("returns the custom fallback when URL is invalid", () => {
40
- const fallback = "https://cdn.example.com/default.svg";
41
- expect(safeImageUrl("http://bad.example.com/icon.png", fallback)).toBe(
42
- fallback
43
- );
44
- expect(safeImageUrl(void 0, fallback)).toBe(fallback);
45
- expect(safeImageUrl("javascript:void(0)", fallback)).toBe(fallback);
4
+ const e = "https://example.com/icon.png";
5
+ expect(t(e)).toBe(e);
6
+ }), it("rejects an http:// URL and returns the default fallback", () => {
7
+ expect(t("http://example.com/icon.png")).toBe("");
8
+ }), it("rejects a data: URL", () => {
9
+ expect(t("data:image/png;base64,abc123")).toBe("");
10
+ }), it("rejects a javascript: URL", () => {
11
+ expect(t("javascript:alert(1)")).toBe("");
12
+ }), it("rejects a file: URL", () => {
13
+ expect(t("file:///etc/passwd")).toBe("");
14
+ }), it("rejects a blob: URL", () => {
15
+ expect(t("blob:https://example.com/some-uuid")).toBe("");
16
+ }), it("rejects an empty string", () => {
17
+ expect(t("")).toBe("");
18
+ }), it("rejects undefined", () => {
19
+ expect(t(void 0)).toBe("");
20
+ }), it("rejects a URL longer than 2048 characters", () => {
21
+ const e = "https://example.com/" + "a".repeat(2030);
22
+ expect(e.length).toBeGreaterThan(2048), expect(t(e)).toBe("");
23
+ }), it("allows a URL of exactly 2048 characters", () => {
24
+ const e = "https://example.com/", a = e + "a".repeat(2048 - e.length);
25
+ expect(a.length).toBe(2048), expect(t(a)).toBe(a);
26
+ }), it("returns the custom fallback when URL is invalid", () => {
27
+ const e = "https://cdn.example.com/default.svg";
28
+ expect(t("http://bad.example.com/icon.png", e)).toBe(
29
+ e
30
+ ), expect(t(void 0, e)).toBe(e), expect(t("javascript:void(0)", e)).toBe(e);
46
31
  });
47
32
  });
@@ -1,37 +1,2 @@
1
1
  #!/usr/bin/env node
2
- "use strict";
3
- const helpers_serializeTransaction = require("../serializeTransaction.js");
4
- const baseTransaction = {
5
- to: "0x1234567890abcdef1234567890abcdef12345678",
6
- data: "0x",
7
- gasLimit: 21000n,
8
- value: 0n,
9
- account: "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",
10
- txHash: ""
11
- };
12
- describe("serializeTransaction", () => {
13
- it("serialises a normal small BigInt correctly", () => {
14
- const tx = { ...baseTransaction, value: 100n };
15
- const result = JSON.parse(helpers_serializeTransaction.serializeTransaction(tx));
16
- expect(result.value).toBe("100");
17
- });
18
- it("serialises a BigInt at exactly Number.MAX_SAFE_INTEGER correctly", () => {
19
- const maxSafe = 9007199254740991n;
20
- const tx = { ...baseTransaction, value: maxSafe };
21
- const result = JSON.parse(helpers_serializeTransaction.serializeTransaction(tx));
22
- expect(result.value).toBe("9007199254740991");
23
- });
24
- it("serialises 10 ETH in wei (above Number.MAX_SAFE_INTEGER) to the exact string without rounding", () => {
25
- const tenEthInWei = 10000000000000000000n;
26
- const tx = { ...baseTransaction, value: tenEthInWei };
27
- const result = JSON.parse(helpers_serializeTransaction.serializeTransaction(tx));
28
- expect(result.value).toBe("10000000000000000000");
29
- });
30
- it("serialises a value that would be corrupted by Number() to the exact string", () => {
31
- const precisionLoss = 9007199254740993n;
32
- const tx = { ...baseTransaction, value: precisionLoss };
33
- const result = JSON.parse(helpers_serializeTransaction.serializeTransaction(tx));
34
- expect(result.value).toBe("9007199254740993");
35
- expect(result.value).not.toBe("9007199254740992");
36
- });
37
- });
2
+ "use strict";const s=require("../serializeTransaction.js"),n={to:"0x1234567890abcdef1234567890abcdef12345678",data:"0x",gasLimit:21000n,value:0n,account:"0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef",txHash:""};describe("serializeTransaction",()=>{it("serialises a normal small BigInt correctly",()=>{const a={...n,value:100n},e=JSON.parse(s.serializeTransaction(a));expect(e.value).toBe("100")}),it("serialises a BigInt at exactly Number.MAX_SAFE_INTEGER correctly",()=>{const e={...n,value:9007199254740991n},t=JSON.parse(s.serializeTransaction(e));expect(t.value).toBe("9007199254740991")}),it("serialises 10 ETH in wei (above Number.MAX_SAFE_INTEGER) to the exact string without rounding",()=>{const e={...n,value:10000000000000000000n},t=JSON.parse(s.serializeTransaction(e));expect(t.value).toBe("10000000000000000000")}),it("serialises a value that would be corrupted by Number() to the exact string",()=>{const e={...n,value:9007199254740993n},t=JSON.parse(s.serializeTransaction(e));expect(t.value).toBe("9007199254740993"),expect(t.value).not.toBe("9007199254740992")})});
@@ -1,5 +1,5 @@
1
- import { serializeTransaction } from "../serializeTransaction.mjs";
2
- const baseTransaction = {
1
+ import { serializeTransaction as s } from "../serializeTransaction.mjs";
2
+ const n = {
3
3
  to: "0x1234567890abcdef1234567890abcdef12345678",
4
4
  data: "0x",
5
5
  gasLimit: 21000n,
@@ -9,27 +9,16 @@ const baseTransaction = {
9
9
  };
10
10
  describe("serializeTransaction", () => {
11
11
  it("serialises a normal small BigInt correctly", () => {
12
- const tx = { ...baseTransaction, value: 100n };
13
- const result = JSON.parse(serializeTransaction(tx));
14
- expect(result.value).toBe("100");
15
- });
16
- it("serialises a BigInt at exactly Number.MAX_SAFE_INTEGER correctly", () => {
17
- const maxSafe = 9007199254740991n;
18
- const tx = { ...baseTransaction, value: maxSafe };
19
- const result = JSON.parse(serializeTransaction(tx));
20
- expect(result.value).toBe("9007199254740991");
21
- });
22
- it("serialises 10 ETH in wei (above Number.MAX_SAFE_INTEGER) to the exact string without rounding", () => {
23
- const tenEthInWei = 10000000000000000000n;
24
- const tx = { ...baseTransaction, value: tenEthInWei };
25
- const result = JSON.parse(serializeTransaction(tx));
26
- expect(result.value).toBe("10000000000000000000");
27
- });
28
- it("serialises a value that would be corrupted by Number() to the exact string", () => {
29
- const precisionLoss = 9007199254740993n;
30
- const tx = { ...baseTransaction, value: precisionLoss };
31
- const result = JSON.parse(serializeTransaction(tx));
32
- expect(result.value).toBe("9007199254740993");
33
- expect(result.value).not.toBe("9007199254740992");
12
+ const a = { ...n, value: 100n }, e = JSON.parse(s(a));
13
+ expect(e.value).toBe("100");
14
+ }), it("serialises a BigInt at exactly Number.MAX_SAFE_INTEGER correctly", () => {
15
+ const e = { ...n, value: 9007199254740991n }, t = JSON.parse(s(e));
16
+ expect(t.value).toBe("9007199254740991");
17
+ }), it("serialises 10 ETH in wei (above Number.MAX_SAFE_INTEGER) to the exact string without rounding", () => {
18
+ const e = { ...n, value: 10000000000000000000n }, t = JSON.parse(s(e));
19
+ expect(t.value).toBe("10000000000000000000");
20
+ }), it("serialises a value that would be corrupted by Number() to the exact string", () => {
21
+ const e = { ...n, value: 9007199254740993n }, t = JSON.parse(s(e));
22
+ expect(t.value).toBe("9007199254740993"), expect(t.value).not.toBe("9007199254740992");
34
23
  });
35
24
  });