@aptos-labs/ts-sdk 6.0.0 → 6.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (467) hide show
  1. package/README.md +9 -13
  2. package/dist/common/{account-Dpz_N9h-.d.ts → account-DGpxrkAn.d.ts} +187 -20
  3. package/dist/common/chunk-2VR6ONNW.js +4 -0
  4. package/dist/common/chunk-2VR6ONNW.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +2 -2
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +69 -6
  9. package/dist/common/index.js +34 -45
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/{Ed25519Account-BW_kXHC2.d.mts → Ed25519Account-BCt2cu_M.d.mts} +2 -2
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/AbstractedAccount.d.mts +2 -2
  15. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  16. package/dist/esm/account/Account.d.mts +2 -2
  17. package/dist/esm/account/Account.mjs +1 -1
  18. package/dist/esm/account/AccountUtils.d.mts +3 -3
  19. package/dist/esm/account/AccountUtils.mjs +1 -1
  20. package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
  21. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  22. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  23. package/dist/esm/account/Ed25519Account.mjs +1 -1
  24. package/dist/esm/account/EphemeralKeyPair.d.mts +26 -2
  25. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  26. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  27. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  28. package/dist/esm/account/KeylessAccount.d.mts +3 -3
  29. package/dist/esm/account/KeylessAccount.mjs +1 -1
  30. package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
  31. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  32. package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
  33. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  34. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  35. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  36. package/dist/esm/account/index.d.mts +3 -3
  37. package/dist/esm/account/index.mjs +1 -1
  38. package/dist/esm/account/utils.d.mts +1 -1
  39. package/dist/esm/account/utils.mjs +1 -1
  40. package/dist/esm/{account-CcxnCdYZ.d.mts → account-Dg0ejXHy.d.mts} +172 -8
  41. package/dist/esm/api/account/abstraction.d.mts +1 -1
  42. package/dist/esm/api/account/abstraction.mjs +1 -1
  43. package/dist/esm/api/account.d.mts +2 -2
  44. package/dist/esm/api/account.mjs +1 -1
  45. package/dist/esm/api/ans.d.mts +1 -1
  46. package/dist/esm/api/ans.mjs +1 -1
  47. package/dist/esm/api/aptos.d.mts +3 -3
  48. package/dist/esm/api/aptos.mjs +1 -1
  49. package/dist/esm/api/aptosConfig.d.mts +1 -1
  50. package/dist/esm/api/aptosConfig.mjs +1 -1
  51. package/dist/esm/api/coin.d.mts +1 -1
  52. package/dist/esm/api/coin.mjs +1 -1
  53. package/dist/esm/api/digitalAsset.d.mts +2 -2
  54. package/dist/esm/api/digitalAsset.mjs +1 -1
  55. package/dist/esm/api/faucet.d.mts +1 -1
  56. package/dist/esm/api/faucet.mjs +1 -1
  57. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  58. package/dist/esm/api/fungibleAsset.mjs +1 -1
  59. package/dist/esm/api/general.d.mts +1 -1
  60. package/dist/esm/api/general.mjs +1 -1
  61. package/dist/esm/api/index.d.mts +3 -3
  62. package/dist/esm/api/index.mjs +1 -1
  63. package/dist/esm/api/keyless.d.mts +3 -3
  64. package/dist/esm/api/keyless.mjs +1 -1
  65. package/dist/esm/api/object.d.mts +1 -1
  66. package/dist/esm/api/object.mjs +1 -1
  67. package/dist/esm/api/staking.d.mts +1 -1
  68. package/dist/esm/api/staking.mjs +1 -1
  69. package/dist/esm/api/table.d.mts +1 -1
  70. package/dist/esm/api/table.mjs +1 -1
  71. package/dist/esm/api/transaction.d.mts +2 -2
  72. package/dist/esm/api/transaction.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  74. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  75. package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
  76. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  77. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  78. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  79. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  80. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  81. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  82. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  83. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  84. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  85. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  86. package/dist/esm/api/utils.d.mts +1 -1
  87. package/dist/esm/api/utils.mjs +1 -1
  88. package/dist/esm/bcs/consts.d.mts +1 -1
  89. package/dist/esm/bcs/deserializer.d.mts +1 -1
  90. package/dist/esm/bcs/deserializer.mjs +1 -1
  91. package/dist/esm/bcs/index.d.mts +1 -1
  92. package/dist/esm/bcs/index.mjs +1 -1
  93. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
  94. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  95. package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
  96. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  97. package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
  98. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  99. package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
  100. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  101. package/dist/esm/bcs/serializer.d.mts +1 -1
  102. package/dist/esm/bcs/serializer.mjs +1 -1
  103. package/dist/esm/{chunk-5FNZUL2Y.mjs → chunk-2VBY2V4Z.mjs} +2 -2
  104. package/dist/esm/chunk-2VHA77EO.mjs +2 -0
  105. package/dist/esm/chunk-2VHA77EO.mjs.map +1 -0
  106. package/dist/esm/{chunk-35DKMW7Q.mjs → chunk-44MMFX5F.mjs} +1 -1
  107. package/dist/esm/chunk-44MMFX5F.mjs.map +1 -0
  108. package/dist/esm/chunk-5HHC2YG4.mjs +2 -0
  109. package/dist/esm/chunk-5LMLIRGK.mjs +2 -0
  110. package/dist/esm/chunk-5LMLIRGK.mjs.map +1 -0
  111. package/dist/esm/chunk-66F7RP7K.mjs +2 -0
  112. package/dist/esm/chunk-66F7RP7K.mjs.map +1 -0
  113. package/dist/esm/chunk-6CD6PDFJ.mjs +4 -0
  114. package/dist/esm/chunk-6CD6PDFJ.mjs.map +1 -0
  115. package/dist/esm/{chunk-FW6UHAQV.mjs → chunk-A7SQEK23.mjs} +2 -2
  116. package/dist/esm/chunk-A7SQEK23.mjs.map +1 -0
  117. package/dist/esm/{chunk-G3HAIETV.mjs → chunk-ASFFADWS.mjs} +2 -2
  118. package/dist/esm/chunk-ASFFADWS.mjs.map +1 -0
  119. package/dist/esm/chunk-AUGTNOKZ.mjs +2 -0
  120. package/dist/esm/{chunk-RQN6LA7E.mjs.map → chunk-AUGTNOKZ.mjs.map} +1 -1
  121. package/dist/esm/chunk-BT742BFQ.mjs +2 -0
  122. package/dist/esm/chunk-BT742BFQ.mjs.map +1 -0
  123. package/dist/esm/chunk-C2KVLMPH.mjs +2 -0
  124. package/dist/esm/chunk-C2KVLMPH.mjs.map +1 -0
  125. package/dist/esm/{chunk-DIFSO4N6.mjs → chunk-CD3EZCI5.mjs} +2 -2
  126. package/dist/esm/{chunk-43LWUUXS.mjs → chunk-E3DHFXN4.mjs} +2 -2
  127. package/dist/esm/{chunk-QDJDZ3ON.mjs → chunk-EIWPAECI.mjs} +2 -2
  128. package/dist/esm/{chunk-GOXRBEIJ.mjs → chunk-F45HI7LU.mjs} +1 -1
  129. package/dist/esm/chunk-F45HI7LU.mjs.map +1 -0
  130. package/dist/esm/chunk-F4LHBGG2.mjs +2 -0
  131. package/dist/esm/chunk-F4LHBGG2.mjs.map +1 -0
  132. package/dist/esm/{chunk-MEG27LEV.mjs → chunk-FDHHQUS3.mjs} +3 -3
  133. package/dist/esm/chunk-FDHHQUS3.mjs.map +1 -0
  134. package/dist/esm/{chunk-LS2HRAVW.mjs → chunk-G5OONGWS.mjs} +1 -12
  135. package/dist/esm/chunk-G5OONGWS.mjs.map +1 -0
  136. package/dist/esm/{chunk-F3NI6N7R.mjs → chunk-H2T2SU5O.mjs} +2 -2
  137. package/dist/esm/chunk-H2T2SU5O.mjs.map +1 -0
  138. package/dist/esm/chunk-ITZN23GU.mjs +2 -0
  139. package/dist/esm/{chunk-X674XJNJ.mjs → chunk-KOVWYU53.mjs} +2 -2
  140. package/dist/esm/{chunk-PXJEKGEG.mjs → chunk-LDK76MDN.mjs} +2 -2
  141. package/dist/esm/chunk-M65PXVDO.mjs +2 -0
  142. package/dist/esm/chunk-M65PXVDO.mjs.map +1 -0
  143. package/dist/esm/{chunk-WZ6FL7CH.mjs → chunk-NWP2VEMB.mjs} +2 -2
  144. package/dist/esm/chunk-ODNZJSOC.mjs +2 -0
  145. package/dist/esm/chunk-ODNZJSOC.mjs.map +1 -0
  146. package/dist/esm/{chunk-6IWGTO2J.mjs → chunk-POQ4FT4E.mjs} +2 -2
  147. package/dist/esm/{chunk-76SVQZDX.mjs → chunk-Q4KYBAYN.mjs} +2 -2
  148. package/dist/esm/chunk-Q5ESW36C.mjs +2 -0
  149. package/dist/esm/chunk-Q5ESW36C.mjs.map +1 -0
  150. package/dist/esm/{chunk-52PWWLJJ.mjs → chunk-QRW7MQDA.mjs} +2 -2
  151. package/dist/esm/chunk-QRW7MQDA.mjs.map +1 -0
  152. package/dist/esm/{chunk-3P474TWM.mjs → chunk-R7PCBRRT.mjs} +2 -2
  153. package/dist/esm/chunk-T32P4APJ.mjs +2 -0
  154. package/dist/esm/chunk-T32P4APJ.mjs.map +1 -0
  155. package/dist/esm/chunk-TAHLOBRG.mjs +2 -0
  156. package/dist/esm/chunk-TAHLOBRG.mjs.map +1 -0
  157. package/dist/esm/{chunk-RYOICF37.mjs → chunk-TSPG5VED.mjs} +2 -2
  158. package/dist/esm/{chunk-56IXVVXX.mjs → chunk-UPHD2B4I.mjs} +2 -2
  159. package/dist/esm/{chunk-QREVMGQZ.mjs → chunk-UVJW4DPP.mjs} +1 -1
  160. package/dist/esm/{chunk-QREVMGQZ.mjs.map → chunk-UVJW4DPP.mjs.map} +1 -1
  161. package/dist/esm/chunk-UYG4XVVO.mjs +2 -0
  162. package/dist/esm/chunk-UYG4XVVO.mjs.map +1 -0
  163. package/dist/esm/chunk-WFZFTRRS.mjs +2 -0
  164. package/dist/esm/chunk-WFZFTRRS.mjs.map +1 -0
  165. package/dist/esm/{chunk-CUXCVNES.mjs → chunk-X4IR6WX6.mjs} +2 -2
  166. package/dist/esm/chunk-YJVBGKWM.mjs +2 -0
  167. package/dist/esm/chunk-YJVBGKWM.mjs.map +1 -0
  168. package/dist/esm/{chunk-NTLOKAPD.mjs → chunk-YTFJ5W7U.mjs} +2 -2
  169. package/dist/esm/cli/index.d.mts +2 -2
  170. package/dist/esm/cli/index.mjs +1 -1
  171. package/dist/esm/cli/localNode.d.mts +1 -1
  172. package/dist/esm/cli/localNode.mjs +1 -1
  173. package/dist/esm/cli/move.d.mts +1 -1
  174. package/dist/esm/cli/move.mjs +1 -1
  175. package/dist/esm/client/core.d.mts +1 -1
  176. package/dist/esm/client/core.mjs +1 -1
  177. package/dist/esm/client/get.d.mts +1 -1
  178. package/dist/esm/client/get.mjs +1 -1
  179. package/dist/esm/client/index.d.mts +1 -1
  180. package/dist/esm/client/index.mjs +1 -1
  181. package/dist/esm/client/post.d.mts +1 -1
  182. package/dist/esm/client/post.mjs +1 -1
  183. package/dist/esm/core/account/index.d.mts +1 -1
  184. package/dist/esm/core/account/index.mjs +1 -1
  185. package/dist/esm/core/account/utils/address.d.mts +1 -1
  186. package/dist/esm/core/account/utils/address.mjs +1 -1
  187. package/dist/esm/core/account/utils/index.d.mts +1 -1
  188. package/dist/esm/core/account/utils/index.mjs +1 -1
  189. package/dist/esm/core/accountAddress.d.mts +1 -1
  190. package/dist/esm/core/accountAddress.mjs +1 -1
  191. package/dist/esm/core/authenticationKey.d.mts +1 -1
  192. package/dist/esm/core/authenticationKey.mjs +1 -1
  193. package/dist/esm/core/crypto/abstraction.d.mts +1 -1
  194. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  195. package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
  196. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  197. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  198. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  199. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  200. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  201. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
  202. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  203. package/dist/esm/core/crypto/index.d.mts +2 -2
  204. package/dist/esm/core/crypto/index.mjs +1 -1
  205. package/dist/esm/core/crypto/keyless.d.mts +2 -2
  206. package/dist/esm/core/crypto/keyless.mjs +1 -1
  207. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  208. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  209. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  210. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  211. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  212. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  213. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  214. package/dist/esm/core/crypto/proof.d.mts +1 -1
  215. package/dist/esm/core/crypto/proof.mjs +1 -1
  216. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  217. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  218. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  219. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  220. package/dist/esm/core/crypto/secp256r1.d.mts +1 -1
  221. package/dist/esm/core/crypto/secp256r1.mjs +1 -1
  222. package/dist/esm/core/crypto/signature.d.mts +1 -1
  223. package/dist/esm/core/crypto/signature.mjs +1 -1
  224. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  225. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  226. package/dist/esm/core/crypto/types.d.mts +1 -1
  227. package/dist/esm/core/crypto/utils.d.mts +1 -1
  228. package/dist/esm/core/crypto/utils.mjs +1 -1
  229. package/dist/esm/core/hex.d.mts +1 -1
  230. package/dist/esm/core/index.d.mts +2 -2
  231. package/dist/esm/core/index.mjs +1 -1
  232. package/dist/esm/errors/index.d.mts +1 -1
  233. package/dist/esm/errors/index.mjs +1 -1
  234. package/dist/esm/{federatedKeyless-BzaYmP03.d.mts → federatedKeyless-BYLu31Sa.d.mts} +13 -2
  235. package/dist/esm/index.d.mts +5 -5
  236. package/dist/esm/index.mjs +1 -1
  237. package/dist/esm/internal/abstraction.d.mts +1 -1
  238. package/dist/esm/internal/abstraction.mjs +1 -1
  239. package/dist/esm/internal/account.d.mts +3 -3
  240. package/dist/esm/internal/account.mjs +1 -1
  241. package/dist/esm/internal/ans.d.mts +2 -2
  242. package/dist/esm/internal/ans.mjs +1 -1
  243. package/dist/esm/internal/coin.d.mts +1 -1
  244. package/dist/esm/internal/coin.mjs +1 -1
  245. package/dist/esm/internal/digitalAsset.d.mts +3 -3
  246. package/dist/esm/internal/digitalAsset.mjs +1 -1
  247. package/dist/esm/internal/faucet.d.mts +1 -1
  248. package/dist/esm/internal/faucet.mjs +1 -1
  249. package/dist/esm/internal/fungibleAsset.d.mts +4 -4
  250. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  251. package/dist/esm/internal/general.d.mts +4 -2
  252. package/dist/esm/internal/general.mjs +1 -1
  253. package/dist/esm/internal/keyless.d.mts +3 -3
  254. package/dist/esm/internal/keyless.mjs +1 -1
  255. package/dist/esm/internal/object.d.mts +1 -1
  256. package/dist/esm/internal/object.mjs +1 -1
  257. package/dist/esm/internal/staking.d.mts +2 -2
  258. package/dist/esm/internal/staking.mjs +1 -1
  259. package/dist/esm/internal/table.d.mts +1 -1
  260. package/dist/esm/internal/table.mjs +1 -1
  261. package/dist/esm/internal/transaction.d.mts +1 -1
  262. package/dist/esm/internal/transaction.mjs +1 -1
  263. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  264. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  265. package/dist/esm/internal/utils/index.d.mts +1 -1
  266. package/dist/esm/internal/utils/index.mjs +1 -1
  267. package/dist/esm/internal/utils/utils.d.mts +1 -1
  268. package/dist/esm/internal/utils/utils.mjs +1 -1
  269. package/dist/esm/internal/view.d.mts +1 -1
  270. package/dist/esm/internal/view.mjs +1 -1
  271. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  272. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  273. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  274. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  275. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  276. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  277. package/dist/esm/transactions/index.d.mts +1 -1
  278. package/dist/esm/transactions/index.mjs +1 -1
  279. package/dist/esm/transactions/instances/chainId.d.mts +1 -1
  280. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  281. package/dist/esm/transactions/instances/identifier.d.mts +1 -1
  282. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  283. package/dist/esm/transactions/instances/index.d.mts +1 -1
  284. package/dist/esm/transactions/instances/index.mjs +1 -1
  285. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  286. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  287. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
  288. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  289. package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
  290. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  291. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  292. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  293. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  294. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  295. package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
  296. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  297. package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
  298. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  299. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  300. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  301. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  302. package/dist/esm/transactions/management/index.d.mts +2 -2
  303. package/dist/esm/transactions/management/index.mjs +1 -1
  304. package/dist/esm/transactions/management/transactionWorker.d.mts +12 -4
  305. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  306. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  307. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  308. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  309. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  310. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -1
  311. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  312. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  313. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  314. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  315. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  316. package/dist/esm/transactions/typeTag/index.d.mts +1 -1
  317. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  318. package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
  319. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  320. package/dist/esm/transactions/types.d.mts +1 -1
  321. package/dist/esm/types/generated/operations.d.mts +0 -11
  322. package/dist/esm/types/generated/queries.d.mts +1 -1
  323. package/dist/esm/types/generated/queries.mjs +1 -1
  324. package/dist/esm/types/index.d.mts +1 -1
  325. package/dist/esm/types/index.mjs +1 -1
  326. package/dist/esm/types/indexer.d.mts +1 -1
  327. package/dist/esm/types/types.d.mts +1 -1
  328. package/dist/esm/types/types.mjs +1 -1
  329. package/dist/esm/utils/const.d.mts +16 -2
  330. package/dist/esm/utils/const.mjs +1 -1
  331. package/dist/esm/utils/helpers.d.mts +21 -2
  332. package/dist/esm/utils/helpers.mjs +1 -1
  333. package/dist/esm/utils/index.d.mts +3 -3
  334. package/dist/esm/utils/index.mjs +1 -1
  335. package/dist/esm/utils/memoize.d.mts +23 -1
  336. package/dist/esm/utils/memoize.mjs +1 -1
  337. package/dist/esm/utils/normalizeBundle.d.mts +1 -1
  338. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  339. package/dist/esm/version.d.mts +1 -1
  340. package/dist/esm/version.mjs +1 -1
  341. package/package.json +36 -50
  342. package/src/account/AbstractKeylessAccount.ts +2 -3
  343. package/src/account/DerivableAbstractedAccount.ts +1 -3
  344. package/src/account/EphemeralKeyPair.ts +53 -2
  345. package/src/account/MultiEd25519Account.ts +0 -2
  346. package/src/account/MultiKeyAccount.ts +0 -2
  347. package/src/account/SingleKeyAccount.ts +0 -1
  348. package/src/api/account.ts +1 -2
  349. package/src/api/ans.ts +0 -1
  350. package/src/api/aptos.ts +1 -1
  351. package/src/api/aptosConfig.ts +12 -1
  352. package/src/api/transaction.ts +4 -4
  353. package/src/api/transactionSubmission/build.ts +1 -5
  354. package/src/api/transactionSubmission/helpers.ts +0 -1
  355. package/src/api/transactionSubmission/sign.ts +2 -2
  356. package/src/bcs/deserializer.ts +64 -17
  357. package/src/bcs/serializable/movePrimitives.ts +15 -28
  358. package/src/bcs/serializable/moveStructs.ts +4 -6
  359. package/src/bcs/serializer.ts +147 -12
  360. package/src/cli/localNode.ts +4 -7
  361. package/src/cli/move.ts +7 -7
  362. package/src/client/get.ts +8 -10
  363. package/src/core/account/utils/address.ts +3 -3
  364. package/src/core/accountAddress.ts +2 -3
  365. package/src/core/crypto/abstraction.ts +0 -3
  366. package/src/core/crypto/ed25519.ts +66 -1
  367. package/src/core/crypto/federatedKeyless.ts +1 -1
  368. package/src/core/crypto/keyless.ts +65 -14
  369. package/src/core/crypto/multiEd25519.ts +1 -3
  370. package/src/core/crypto/multiKey.ts +4 -7
  371. package/src/core/crypto/poseidon.ts +0 -1
  372. package/src/core/crypto/privateKey.ts +2 -5
  373. package/src/core/crypto/secp256k1.ts +68 -3
  374. package/src/core/crypto/secp256r1.ts +1 -1
  375. package/src/core/crypto/singleKey.ts +4 -1
  376. package/src/core/crypto/utils.ts +6 -3
  377. package/src/errors/index.ts +4 -5
  378. package/src/internal/account.ts +21 -30
  379. package/src/internal/ans.ts +5 -6
  380. package/src/internal/general.ts +24 -6
  381. package/src/internal/keyless.ts +1 -1
  382. package/src/internal/queries/getAccountAddressesForAuthKey.graphql +4 -1
  383. package/src/internal/queries/getAuthKeysForPublicKey.graphql +4 -1
  384. package/src/internal/queries/getCollectionData.graphql +0 -11
  385. package/src/internal/queries/getTableItemsData.graphql +1 -1
  386. package/src/internal/queries/getTableItemsMetadata.graphql +2 -2
  387. package/src/internal/transaction.ts +5 -7
  388. package/src/internal/transactionSubmission.ts +23 -0
  389. package/src/transactions/authenticator/account.ts +0 -4
  390. package/src/transactions/authenticator/transaction.ts +0 -2
  391. package/src/transactions/instances/multiAgentTransaction.ts +0 -2
  392. package/src/transactions/instances/rawTransaction.ts +0 -2
  393. package/src/transactions/instances/signedTransaction.ts +0 -2
  394. package/src/transactions/instances/simpleTransaction.ts +0 -2
  395. package/src/transactions/instances/transactionPayload.ts +5 -7
  396. package/src/transactions/management/accountSequenceNumber.ts +0 -4
  397. package/src/transactions/management/transactionWorker.ts +40 -10
  398. package/src/transactions/transactionBuilder/remoteAbi.ts +22 -8
  399. package/src/transactions/transactionBuilder/transactionBuilder.ts +14 -12
  400. package/src/transactions/typeTag/index.ts +0 -3
  401. package/src/transactions/typeTag/parser.ts +3 -5
  402. package/src/types/generated/operations.ts +0 -11
  403. package/src/types/generated/queries.ts +0 -11
  404. package/src/types/types.ts +26 -0
  405. package/src/utils/const.ts +17 -1
  406. package/src/utils/helpers.ts +47 -8
  407. package/src/utils/memoize.ts +177 -11
  408. package/src/version.ts +1 -1
  409. package/dist/common/chunk-4RHBBU7C.js +0 -4
  410. package/dist/common/chunk-4RHBBU7C.js.map +0 -1
  411. package/dist/esm/chunk-2DPQMXUG.mjs +0 -4
  412. package/dist/esm/chunk-2DPQMXUG.mjs.map +0 -1
  413. package/dist/esm/chunk-2LCPW76G.mjs +0 -2
  414. package/dist/esm/chunk-2LCPW76G.mjs.map +0 -1
  415. package/dist/esm/chunk-2PASUPUO.mjs +0 -2
  416. package/dist/esm/chunk-2PASUPUO.mjs.map +0 -1
  417. package/dist/esm/chunk-35DKMW7Q.mjs.map +0 -1
  418. package/dist/esm/chunk-52PWWLJJ.mjs.map +0 -1
  419. package/dist/esm/chunk-54C2P534.mjs +0 -2
  420. package/dist/esm/chunk-54C2P534.mjs.map +0 -1
  421. package/dist/esm/chunk-BGZDJ5SM.mjs +0 -2
  422. package/dist/esm/chunk-BGZDJ5SM.mjs.map +0 -1
  423. package/dist/esm/chunk-C5UZZHA4.mjs +0 -2
  424. package/dist/esm/chunk-C5UZZHA4.mjs.map +0 -1
  425. package/dist/esm/chunk-F3NI6N7R.mjs.map +0 -1
  426. package/dist/esm/chunk-FW6UHAQV.mjs.map +0 -1
  427. package/dist/esm/chunk-G3HAIETV.mjs.map +0 -1
  428. package/dist/esm/chunk-GOXRBEIJ.mjs.map +0 -1
  429. package/dist/esm/chunk-I42Z32Q2.mjs +0 -2
  430. package/dist/esm/chunk-I42Z32Q2.mjs.map +0 -1
  431. package/dist/esm/chunk-JN65XG2P.mjs +0 -2
  432. package/dist/esm/chunk-JN65XG2P.mjs.map +0 -1
  433. package/dist/esm/chunk-KUF4DKN5.mjs +0 -2
  434. package/dist/esm/chunk-LD3I4CYO.mjs +0 -2
  435. package/dist/esm/chunk-LS2HRAVW.mjs.map +0 -1
  436. package/dist/esm/chunk-MEG27LEV.mjs.map +0 -1
  437. package/dist/esm/chunk-NCKJ7X57.mjs +0 -2
  438. package/dist/esm/chunk-NCKJ7X57.mjs.map +0 -1
  439. package/dist/esm/chunk-NK3Y3PV3.mjs +0 -2
  440. package/dist/esm/chunk-NK3Y3PV3.mjs.map +0 -1
  441. package/dist/esm/chunk-OLILO7VD.mjs +0 -2
  442. package/dist/esm/chunk-OLILO7VD.mjs.map +0 -1
  443. package/dist/esm/chunk-PYVKCTUN.mjs +0 -2
  444. package/dist/esm/chunk-PYVKCTUN.mjs.map +0 -1
  445. package/dist/esm/chunk-QEHKRR3I.mjs +0 -2
  446. package/dist/esm/chunk-QEHKRR3I.mjs.map +0 -1
  447. package/dist/esm/chunk-RQN6LA7E.mjs +0 -2
  448. package/dist/esm/chunk-Y426VCPM.mjs +0 -2
  449. package/dist/esm/chunk-Y426VCPM.mjs.map +0 -1
  450. package/dist/esm/chunk-YOZBVVKL.mjs +0 -2
  451. package/dist/esm/chunk-YOZBVVKL.mjs.map +0 -1
  452. /package/dist/esm/{chunk-5FNZUL2Y.mjs.map → chunk-2VBY2V4Z.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-KUF4DKN5.mjs.map → chunk-5HHC2YG4.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-DIFSO4N6.mjs.map → chunk-CD3EZCI5.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-43LWUUXS.mjs.map → chunk-E3DHFXN4.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-QDJDZ3ON.mjs.map → chunk-EIWPAECI.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-LD3I4CYO.mjs.map → chunk-ITZN23GU.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-X674XJNJ.mjs.map → chunk-KOVWYU53.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-PXJEKGEG.mjs.map → chunk-LDK76MDN.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-WZ6FL7CH.mjs.map → chunk-NWP2VEMB.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-6IWGTO2J.mjs.map → chunk-POQ4FT4E.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-76SVQZDX.mjs.map → chunk-Q4KYBAYN.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-3P474TWM.mjs.map → chunk-R7PCBRRT.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-RYOICF37.mjs.map → chunk-TSPG5VED.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-56IXVVXX.mjs.map → chunk-UPHD2B4I.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-CUXCVNES.mjs.map → chunk-X4IR6WX6.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-NTLOKAPD.mjs.map → chunk-YTFJ5W7U.mjs.map} +0 -0
@@ -1,6 +1,5 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
-
4
3
  import {
5
4
  MAX_U128_BIG_INT,
6
5
  MAX_U16_NUMBER,
@@ -77,14 +76,14 @@ export class Bool extends Serializable implements TransactionArgument {
77
76
  /**
78
77
  * Serializes the current instance for use in an entry function by converting it to a byte sequence.
79
78
  * This allows the instance to be properly formatted for serialization in transactions.
79
+ * Uses the optimized serializeAsBytes method to reduce allocations.
80
80
  *
81
81
  * @param serializer - The serializer instance used to serialize the byte sequence.
82
82
  * @group Implementation
83
83
  * @category BCS
84
84
  */
85
85
  serializeForEntryFunction(serializer: Serializer): void {
86
- const bcsBytes = this.bcsToBytes();
87
- serializer.serializeBytes(bcsBytes);
86
+ serializer.serializeAsBytes(this);
88
87
  }
89
88
 
90
89
  /**
@@ -107,7 +106,7 @@ export class Bool extends Serializable implements TransactionArgument {
107
106
  * @group Implementation
108
107
  * @category BCS
109
108
  */
110
- // eslint-disable-next-line class-methods-use-this
109
+
111
110
  deserialize(deserializer: Deserializer) {
112
111
  return new U256(deserializer.deserializeU256());
113
112
  }
@@ -139,8 +138,7 @@ export class U8 extends Serializable implements TransactionArgument {
139
138
  }
140
139
 
141
140
  serializeForEntryFunction(serializer: Serializer): void {
142
- const bcsBytes = this.bcsToBytes();
143
- serializer.serializeBytes(bcsBytes);
141
+ serializer.serializeAsBytes(this);
144
142
  }
145
143
 
146
144
  serializeForScriptFunction(serializer: Serializer): void {
@@ -176,8 +174,7 @@ export class U16 extends Serializable implements TransactionArgument {
176
174
  }
177
175
 
178
176
  serializeForEntryFunction(serializer: Serializer): void {
179
- const bcsBytes = this.bcsToBytes();
180
- serializer.serializeBytes(bcsBytes);
177
+ serializer.serializeAsBytes(this);
181
178
  }
182
179
 
183
180
  serializeForScriptFunction(serializer: Serializer): void {
@@ -212,8 +209,7 @@ export class U32 extends Serializable implements TransactionArgument {
212
209
  }
213
210
 
214
211
  serializeForEntryFunction(serializer: Serializer): void {
215
- const bcsBytes = this.bcsToBytes();
216
- serializer.serializeBytes(bcsBytes);
212
+ serializer.serializeAsBytes(this);
217
213
  }
218
214
 
219
215
  serializeForScriptFunction(serializer: Serializer): void {
@@ -251,8 +247,7 @@ export class U64 extends Serializable implements TransactionArgument {
251
247
  }
252
248
 
253
249
  serializeForEntryFunction(serializer: Serializer): void {
254
- const bcsBytes = this.bcsToBytes();
255
- serializer.serializeBytes(bcsBytes);
250
+ serializer.serializeAsBytes(this);
256
251
  }
257
252
 
258
253
  serializeForScriptFunction(serializer: Serializer): void {
@@ -288,8 +283,7 @@ export class U128 extends Serializable implements TransactionArgument {
288
283
  }
289
284
 
290
285
  serializeForEntryFunction(serializer: Serializer): void {
291
- const bcsBytes = this.bcsToBytes();
292
- serializer.serializeBytes(bcsBytes);
286
+ serializer.serializeAsBytes(this);
293
287
  }
294
288
 
295
289
  serializeForScriptFunction(serializer: Serializer): void {
@@ -325,8 +319,7 @@ export class U256 extends Serializable implements TransactionArgument {
325
319
  }
326
320
 
327
321
  serializeForEntryFunction(serializer: Serializer): void {
328
- const bcsBytes = this.bcsToBytes();
329
- serializer.serializeBytes(bcsBytes);
322
+ serializer.serializeAsBytes(this);
330
323
  }
331
324
 
332
325
  serializeForScriptFunction(serializer: Serializer): void {
@@ -361,8 +354,7 @@ export class I8 extends Serializable implements TransactionArgument {
361
354
  }
362
355
 
363
356
  serializeForEntryFunction(serializer: Serializer): void {
364
- const bcsBytes = this.bcsToBytes();
365
- serializer.serializeBytes(bcsBytes);
357
+ serializer.serializeAsBytes(this);
366
358
  }
367
359
 
368
360
  serializeForScriptFunction(serializer: Serializer): void {
@@ -398,8 +390,7 @@ export class I16 extends Serializable implements TransactionArgument {
398
390
  }
399
391
 
400
392
  serializeForEntryFunction(serializer: Serializer): void {
401
- const bcsBytes = this.bcsToBytes();
402
- serializer.serializeBytes(bcsBytes);
393
+ serializer.serializeAsBytes(this);
403
394
  }
404
395
 
405
396
  serializeForScriptFunction(serializer: Serializer): void {
@@ -434,8 +425,7 @@ export class I32 extends Serializable implements TransactionArgument {
434
425
  }
435
426
 
436
427
  serializeForEntryFunction(serializer: Serializer): void {
437
- const bcsBytes = this.bcsToBytes();
438
- serializer.serializeBytes(bcsBytes);
428
+ serializer.serializeAsBytes(this);
439
429
  }
440
430
 
441
431
  serializeForScriptFunction(serializer: Serializer): void {
@@ -473,8 +463,7 @@ export class I64 extends Serializable implements TransactionArgument {
473
463
  }
474
464
 
475
465
  serializeForEntryFunction(serializer: Serializer): void {
476
- const bcsBytes = this.bcsToBytes();
477
- serializer.serializeBytes(bcsBytes);
466
+ serializer.serializeAsBytes(this);
478
467
  }
479
468
 
480
469
  serializeForScriptFunction(serializer: Serializer): void {
@@ -510,8 +499,7 @@ export class I128 extends Serializable implements TransactionArgument {
510
499
  }
511
500
 
512
501
  serializeForEntryFunction(serializer: Serializer): void {
513
- const bcsBytes = this.bcsToBytes();
514
- serializer.serializeBytes(bcsBytes);
502
+ serializer.serializeAsBytes(this);
515
503
  }
516
504
 
517
505
  serializeForScriptFunction(serializer: Serializer): void {
@@ -547,8 +535,7 @@ export class I256 extends Serializable implements TransactionArgument {
547
535
  }
548
536
 
549
537
  serializeForEntryFunction(serializer: Serializer): void {
550
- const bcsBytes = this.bcsToBytes();
551
- serializer.serializeBytes(bcsBytes);
538
+ serializer.serializeAsBytes(this);
552
539
  }
553
540
 
554
541
  serializeForScriptFunction(serializer: Serializer): void {
@@ -69,14 +69,14 @@ export class MoveVector<T extends Serializable & EntryFunctionArgument>
69
69
  /**
70
70
  * Serializes the current instance into a byte sequence suitable for entry functions.
71
71
  * This allows the data to be properly formatted for transmission or storage.
72
+ * Uses the optimized serializeAsBytes method to reduce allocations.
72
73
  *
73
74
  * @param serializer - The serializer instance used to serialize the byte sequence.
74
75
  * @group Implementation
75
76
  * @category BCS
76
77
  */
77
78
  serializeForEntryFunction(serializer: Serializer): void {
78
- const bcsBytes = this.bcsToBytes();
79
- serializer.serializeBytes(bcsBytes);
79
+ serializer.serializeAsBytes(this);
80
80
  }
81
81
 
82
82
  /**
@@ -493,8 +493,7 @@ export class MoveString extends Serializable implements TransactionArgument {
493
493
  }
494
494
 
495
495
  serializeForEntryFunction(serializer: Serializer): void {
496
- const bcsBytes = this.bcsToBytes();
497
- serializer.serializeBytes(bcsBytes);
496
+ serializer.serializeAsBytes(this);
498
497
  }
499
498
 
500
499
  serializeForScriptFunction(serializer: Serializer): void {
@@ -531,8 +530,7 @@ export class MoveOption<T extends Serializable & EntryFunctionArgument>
531
530
  }
532
531
 
533
532
  serializeForEntryFunction(serializer: Serializer): void {
534
- const bcsBytes = this.bcsToBytes();
535
- serializer.serializeBytes(bcsBytes);
533
+ serializer.serializeAsBytes(this);
536
534
  }
537
535
 
538
536
  /**
@@ -1,7 +1,6 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- /* eslint-disable no-bitwise */
5
4
  import {
6
5
  MAX_U128_BIG_INT,
7
6
  MAX_U16_NUMBER,
@@ -24,6 +23,7 @@ import {
24
23
  } from "./consts";
25
24
  import { Hex } from "../core/hex";
26
25
  import { AnyNumber, Uint16, Uint32, Uint8 } from "../types";
26
+ import { TEXT_ENCODER } from "../utils/const";
27
27
 
28
28
  /**
29
29
  * This class serves as a base class for all serializable types. It facilitates
@@ -77,6 +77,41 @@ export abstract class Serializable {
77
77
  }
78
78
  }
79
79
 
80
+ /**
81
+ * Minimum buffer growth increment to avoid too many small reallocations.
82
+ */
83
+ const MIN_BUFFER_GROWTH = 256;
84
+
85
+ /**
86
+ * Pool of reusable Serializer instances for temporary serialization operations.
87
+ * This reduces allocations when using serializeAsBytes() repeatedly.
88
+ */
89
+ const serializerPool: Serializer[] = [];
90
+ const MAX_POOL_SIZE = 8;
91
+
92
+ /**
93
+ * Acquires a Serializer from the pool or creates a new one.
94
+ * @internal
95
+ */
96
+ function acquireSerializer(): Serializer {
97
+ const serializer = serializerPool.pop();
98
+ if (serializer) {
99
+ serializer.reset();
100
+ return serializer;
101
+ }
102
+ return new Serializer();
103
+ }
104
+
105
+ /**
106
+ * Returns a Serializer to the pool for reuse.
107
+ * @internal
108
+ */
109
+ function releaseSerializer(serializer: Serializer): void {
110
+ if (serializerPool.length < MAX_POOL_SIZE) {
111
+ serializerPool.push(serializer);
112
+ }
113
+ }
114
+
80
115
  /**
81
116
  * A class for serializing various data types into a binary format.
82
117
  * It provides methods to serialize strings, bytes, numbers, and other serializable objects
@@ -90,6 +125,12 @@ export class Serializer {
90
125
 
91
126
  private offset: number;
92
127
 
128
+ /**
129
+ * Reusable DataView instance to reduce allocations during serialization.
130
+ * Recreated when buffer is resized.
131
+ */
132
+ private dataView: DataView;
133
+
93
134
  /**
94
135
  * Constructs a serializer with a buffer of size `length` bytes, 64 bytes by default.
95
136
  * The `length` must be greater than 0.
@@ -103,23 +144,33 @@ export class Serializer {
103
144
  throw new Error("Length needs to be greater than 0");
104
145
  }
105
146
  this.buffer = new ArrayBuffer(length);
147
+ this.dataView = new DataView(this.buffer);
106
148
  this.offset = 0;
107
149
  }
108
150
 
109
151
  /**
110
152
  * Ensures that the internal buffer can accommodate the specified number of bytes.
111
- * This function dynamically resizes the buffer if the current size is insufficient.
153
+ * This function dynamically resizes the buffer using a growth factor of 1.5x with
154
+ * a minimum growth increment to balance memory usage and reallocation frequency.
112
155
  *
113
156
  * @param bytes - The number of bytes to ensure the buffer can handle.
114
157
  * @group Implementation
115
158
  * @category BCS
116
159
  */
117
160
  private ensureBufferWillHandleSize(bytes: number) {
118
- while (this.buffer.byteLength < this.offset + bytes) {
119
- const newBuffer = new ArrayBuffer(this.buffer.byteLength * 2);
120
- new Uint8Array(newBuffer).set(new Uint8Array(this.buffer));
121
- this.buffer = newBuffer;
161
+ const requiredSize = this.offset + bytes;
162
+ if (this.buffer.byteLength >= requiredSize) {
163
+ return;
122
164
  }
165
+
166
+ // Calculate new size: max of (1.5x current size) or (current + required + MIN_GROWTH)
167
+ // Using 1.5x instead of 2x provides better memory efficiency
168
+ const growthSize = Math.max(Math.floor(this.buffer.byteLength * 1.5), requiredSize + MIN_BUFFER_GROWTH);
169
+
170
+ const newBuffer = new ArrayBuffer(growthSize);
171
+ new Uint8Array(newBuffer).set(new Uint8Array(this.buffer, 0, this.offset));
172
+ this.buffer = newBuffer;
173
+ this.dataView = new DataView(this.buffer);
123
174
  }
124
175
 
125
176
  /**
@@ -137,6 +188,7 @@ export class Serializer {
137
188
 
138
189
  /**
139
190
  * Serializes a value into the buffer using the provided function, ensuring the buffer can accommodate the size.
191
+ * Uses the cached DataView instance for better performance.
140
192
  *
141
193
  * @param fn - The function to serialize the value, which takes a byte offset, the value to serialize, and an optional little-endian flag.
142
194
  * @param fn.byteOffset - The byte offset at which to write the value.
@@ -152,8 +204,7 @@ export class Serializer {
152
204
  value: number,
153
205
  ) {
154
206
  this.ensureBufferWillHandleSize(bytesLength);
155
- const dv = new DataView(this.buffer, this.offset);
156
- fn.apply(dv, [0, value, true]);
207
+ fn.apply(this.dataView, [this.offset, value, true]);
157
208
  this.offset += bytesLength;
158
209
  }
159
210
 
@@ -177,8 +228,7 @@ export class Serializer {
177
228
  * @category BCS
178
229
  */
179
230
  serializeStr(value: string) {
180
- const textEncoder = new TextEncoder();
181
- this.serializeBytes(textEncoder.encode(value));
231
+ this.serializeBytes(TEXT_ENCODER.encode(value));
182
232
  }
183
233
 
184
234
  /**
@@ -473,13 +523,57 @@ export class Serializer {
473
523
  * Returns the buffered bytes as a Uint8Array.
474
524
  *
475
525
  * This function allows you to retrieve the byte representation of the buffer up to the current offset.
526
+ * For better performance, returns a view when the buffer is exactly the right size, or copies
527
+ * only the used portion otherwise.
476
528
  *
477
529
  * @returns Uint8Array - The byte array representation of the buffer.
478
530
  * @group Implementation
479
531
  * @category BCS
480
532
  */
481
533
  toUint8Array(): Uint8Array {
482
- return new Uint8Array(this.buffer).slice(0, this.offset);
534
+ // Return a copy of only the used portion of the buffer
535
+ // Using subarray + slice pattern for efficiency
536
+ return new Uint8Array(this.buffer, 0, this.offset).slice();
537
+ }
538
+
539
+ /**
540
+ * Resets the serializer to its initial state, allowing the buffer to be reused.
541
+ * This clears the buffer contents to prevent data leakage between uses.
542
+ *
543
+ * @group Implementation
544
+ * @category BCS
545
+ */
546
+ reset(): void {
547
+ // Clear buffer contents to prevent data leakage when reusing pooled serializers
548
+ // Only clear the portion that was used (up to offset) for efficiency
549
+ if (this.offset > 0) {
550
+ new Uint8Array(this.buffer, 0, this.offset).fill(0);
551
+ }
552
+ this.offset = 0;
553
+ }
554
+
555
+ /**
556
+ * Returns the current number of bytes written to the serializer.
557
+ *
558
+ * @returns The number of bytes written.
559
+ * @group Implementation
560
+ * @category BCS
561
+ */
562
+ getOffset(): number {
563
+ return this.offset;
564
+ }
565
+
566
+ /**
567
+ * Returns a view of the serialized bytes without copying.
568
+ * WARNING: The returned view is only valid until the next write operation.
569
+ * Use toUint8Array() if you need a persistent copy.
570
+ *
571
+ * @returns A Uint8Array view of the buffer (not a copy).
572
+ * @group Implementation
573
+ * @category BCS
574
+ */
575
+ toUint8ArrayView(): Uint8Array {
576
+ return new Uint8Array(this.buffer, 0, this.offset);
483
577
  }
484
578
 
485
579
  /**
@@ -497,6 +591,47 @@ export class Serializer {
497
591
  value.serialize(this);
498
592
  }
499
593
 
594
+ /**
595
+ * Serializes a Serializable value as a byte array with a length prefix.
596
+ * This is the optimized pattern for entry function argument serialization.
597
+ *
598
+ * Instead of:
599
+ * ```typescript
600
+ * const bcsBytes = value.bcsToBytes(); // Creates new Serializer, copies bytes
601
+ * serializer.serializeBytes(bcsBytes);
602
+ * ```
603
+ *
604
+ * Use:
605
+ * ```typescript
606
+ * serializer.serializeAsBytes(value); // Uses pooled Serializer, avoids extra copy
607
+ * ```
608
+ *
609
+ * This method uses a pooled Serializer instance to reduce allocations and
610
+ * directly appends the serialized bytes with a length prefix.
611
+ *
612
+ * @param value - The Serializable value to serialize as bytes.
613
+ * @group Implementation
614
+ * @category BCS
615
+ */
616
+ serializeAsBytes<T extends Serializable>(value: T): void {
617
+ // Acquire a pooled serializer for temporary use
618
+ const tempSerializer = acquireSerializer();
619
+
620
+ try {
621
+ // Serialize the value to the temporary serializer
622
+ value.serialize(tempSerializer);
623
+
624
+ // Get the serialized bytes (as a view to avoid copying)
625
+ const bytes = tempSerializer.toUint8ArrayView();
626
+
627
+ // Serialize with length prefix to this serializer
628
+ this.serializeBytes(bytes);
629
+ } finally {
630
+ // Return the serializer to the pool for reuse
631
+ releaseSerializer(tempSerializer);
632
+ }
633
+ }
634
+
500
635
  /**
501
636
  * Serializes an array of BCS Serializable values to a serializer instance.
502
637
  * The bytes are added to the serializer instance's byte buffer.
@@ -630,7 +765,7 @@ export function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T
630
765
  function checkNumberRange<T extends AnyNumber>(minValue: T, maxValue: T) {
631
766
  return (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => {
632
767
  const childFunction = descriptor.value;
633
- // eslint-disable-next-line no-param-reassign
768
+
634
769
  descriptor.value = function deco(value: AnyNumber) {
635
770
  validateNumberInRange(value, minValue, maxValue);
636
771
  return childFunction.apply(this, [value]);
@@ -1,8 +1,6 @@
1
- /* eslint-disable no-console */
2
-
3
- import { ChildProcessWithoutNullStreams, spawn } from "child_process";
1
+ import { ChildProcessWithoutNullStreams, spawn } from "node:child_process";
4
2
  import kill from "tree-kill";
5
- import { platform } from "os";
3
+ import { platform } from "node:os";
6
4
 
7
5
  import { sleep } from "../utils/helpers";
8
6
 
@@ -130,9 +128,8 @@ export class LocalNode {
130
128
  let last = start;
131
129
 
132
130
  while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {
133
- // eslint-disable-next-line no-await-in-loop
134
131
  await sleep(1000);
135
- // eslint-disable-next-line no-await-in-loop
132
+
136
133
  operational = await this.checkIfProcessIsUp();
137
134
  last = Date.now() / 1000;
138
135
  }
@@ -161,7 +158,7 @@ export class LocalNode {
161
158
  return true;
162
159
  }
163
160
  return false;
164
- } catch (err: any) {
161
+ } catch {
165
162
  return false;
166
163
  }
167
164
  }
package/src/cli/move.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { spawn } from "child_process";
2
- import { platform } from "os";
1
+ import { spawn } from "node:child_process";
2
+ import { platform } from "node:os";
3
3
 
4
4
  import { AccountAddress } from "../core";
5
5
  import { Network } from "../utils";
@@ -353,7 +353,7 @@ export class Move {
353
353
  * @group Implementation
354
354
  * @category CLI
355
355
  */
356
- // eslint-disable-next-line class-methods-use-this
356
+
357
357
  private async runCommand(args: Array<string>, showStdout: boolean = true): Promise<{ result?: any; output: string }> {
358
358
  return new Promise((resolve, reject) => {
359
359
  const currentPlatform = platform();
@@ -391,7 +391,7 @@ export class Move {
391
391
  } else if (parsed.Result) {
392
392
  resolve({ result: parsed.Result, output: stdout }); // Resolve if the "Result" key exists
393
393
  }
394
- } catch (error: any) {
394
+ } catch {
395
395
  // resolve the stdout as it might be just a stdout
396
396
  resolve({ output: stdout });
397
397
  }
@@ -411,7 +411,7 @@ export class Move {
411
411
  * @group Implementation
412
412
  * @category CLI
413
413
  */
414
- // eslint-disable-next-line class-methods-use-this
414
+
415
415
  private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {
416
416
  const totalNames = namedAddresses.size;
417
417
  const newArgs: Array<string> = [];
@@ -442,7 +442,7 @@ export class Move {
442
442
  * @group Implementation
443
443
  * @category CLI
444
444
  */
445
- // eslint-disable-next-line class-methods-use-this
445
+
446
446
  private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {
447
447
  const addressesMap = new Map();
448
448
 
@@ -463,7 +463,7 @@ export class Move {
463
463
  * @group Implementation
464
464
  * @category CLI
465
465
  */
466
- // eslint-disable-next-line class-methods-use-this
466
+
467
467
  private extractAddressFromOutput(output: string): string {
468
468
  const match = output.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");
469
469
  if (match) {
package/src/client/get.ts CHANGED
@@ -162,11 +162,10 @@ export async function getAptosPepperService<Req extends {}, Res extends {}>(
162
162
  export async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(
163
163
  options: GetAptosRequestOptions,
164
164
  ): Promise<Res> {
165
- const out: Res = new Array(0) as Res;
165
+ let out: Res = [] as unknown as Res;
166
166
  let cursor: string | undefined;
167
167
  const requestParams = options.params as { start?: string; limit?: number };
168
168
  do {
169
- // eslint-disable-next-line no-await-in-loop
170
169
  const response = await get<Req, Res>({
171
170
  type: AptosApiType.FULLNODE,
172
171
  aptosConfig: options.aptosConfig,
@@ -186,7 +185,8 @@ export async function paginateWithCursor<Req extends Record<string, any>, Res ex
186
185
  // Now that we have the cursor (if any), we remove the headers before
187
186
  // adding these to the output of this function.
188
187
  delete response.headers;
189
- out.push(...response.data);
188
+ // Use concat instead of push(...) for better performance with large arrays
189
+ out = out.concat(response.data) as Res;
190
190
  requestParams.start = cursor;
191
191
  } while (cursor !== null && cursor !== undefined);
192
192
  return out;
@@ -196,12 +196,11 @@ export async function paginateWithCursor<Req extends Record<string, any>, Res ex
196
196
  export async function paginateWithObfuscatedCursor<Req extends Record<string, any>, Res extends Array<{}>>(
197
197
  options: GetAptosRequestOptions,
198
198
  ): Promise<Res> {
199
- const out: Res = new Array(0) as Res;
199
+ let out: Res = [] as unknown as Res;
200
200
  let cursor: string | undefined;
201
201
  const requestParams = options.params as { start?: string; limit?: number };
202
202
  const totalLimit = requestParams.limit;
203
203
  do {
204
- // eslint-disable-next-line no-await-in-loop
205
204
  const { response, cursor: newCursor } = await getPageWithObfuscatedCursor<Req, Res>({ ...options });
206
205
 
207
206
  /**
@@ -210,7 +209,8 @@ export async function paginateWithObfuscatedCursor<Req extends Record<string, an
210
209
  * to query the next chunk of data.
211
210
  */
212
211
  cursor = newCursor;
213
- out.push(...response.data);
212
+ // Use concat instead of push(...) for better performance with large arrays
213
+ out = out.concat(response.data) as Res;
214
214
  if (options?.params) {
215
215
  options.params.start = cursor;
216
216
  }
@@ -230,8 +230,7 @@ export async function paginateWithObfuscatedCursor<Req extends Record<string, an
230
230
  export async function getPageWithObfuscatedCursor<Req extends Record<string, any>, Res extends Array<{}>>(
231
231
  options: GetAptosRequestOptions,
232
232
  ): Promise<{ response: AptosResponse<Req, Res>; cursor: string | undefined }> {
233
- let cursor: string | undefined;
234
- let requestParams: { start?: string; limit?: number } = {};
233
+ const requestParams: { start?: string; limit?: number } = {};
235
234
 
236
235
  // Drop any other values
237
236
  // TODO: Throw error if cursor is not a string
@@ -242,7 +241,6 @@ export async function getPageWithObfuscatedCursor<Req extends Record<string, any
242
241
  requestParams.limit = options.params.limit;
243
242
  }
244
243
 
245
- // eslint-disable-next-line no-await-in-loop
246
244
  const response = await get<Req, Res>({
247
245
  type: AptosApiType.FULLNODE,
248
246
  aptosConfig: options.aptosConfig,
@@ -257,6 +255,6 @@ export async function getPageWithObfuscatedCursor<Req extends Record<string, any
257
255
  * should not need to "care" what it represents but just use it
258
256
  * to query the next chunk of data.
259
257
  */
260
- cursor = response.headers["x-aptos-cursor"];
258
+ const cursor = response.headers["x-aptos-cursor"] ?? undefined;
261
259
  return { response, cursor };
262
260
  }
@@ -1,6 +1,7 @@
1
1
  import { sha3_256 } from "@noble/hashes/sha3";
2
2
  import { AccountAddress } from "../../accountAddress";
3
3
  import { DeriveScheme } from "../../../types";
4
+ import { TEXT_ENCODER } from "../../../utils/const";
4
5
 
5
6
  /**
6
7
  * Creates an object address from creator address and seed
@@ -14,8 +15,7 @@ import { DeriveScheme } from "../../../types";
14
15
  */
15
16
  export const createObjectAddress = (creatorAddress: AccountAddress, seed: Uint8Array | string): AccountAddress => {
16
17
  const creatorBytes = creatorAddress.bcsToBytes();
17
-
18
- const seedBytes = typeof seed === "string" ? Buffer.from(seed, "utf8") : seed;
18
+ const seedBytes = typeof seed === "string" ? TEXT_ENCODER.encode(seed) : seed;
19
19
 
20
20
  const bytes = new Uint8Array([...creatorBytes, ...seedBytes, DeriveScheme.DeriveObjectAddressFromSeed]);
21
21
 
@@ -35,7 +35,7 @@ export const createObjectAddress = (creatorAddress: AccountAddress, seed: Uint8A
35
35
  export const createResourceAddress = (creatorAddress: AccountAddress, seed: Uint8Array | string): AccountAddress => {
36
36
  const creatorBytes = creatorAddress.bcsToBytes();
37
37
 
38
- const seedBytes = typeof seed === "string" ? Buffer.from(seed, "utf8") : seed;
38
+ const seedBytes = typeof seed === "string" ? TEXT_ENCODER.encode(seed) : seed;
39
39
 
40
40
  const bytes = new Uint8Array([...creatorBytes, ...seedBytes, DeriveScheme.DeriveResourceAccountAddress]);
41
41
 
@@ -240,14 +240,14 @@ export class AccountAddress extends Serializable implements TransactionArgument
240
240
  /**
241
241
  * Serializes the current instance into a byte sequence suitable for entry functions.
242
242
  * This allows for the proper encoding of data when interacting with entry functions in the blockchain.
243
+ * Uses the optimized serializeAsBytes method to reduce allocations.
243
244
  *
244
245
  * @param serializer - The serializer instance used to convert the data into bytes.
245
246
  * @group Implementation
246
247
  * @category Serialization
247
248
  */
248
249
  serializeForEntryFunction(serializer: Serializer): void {
249
- const bcsBytes = this.bcsToBytes();
250
- serializer.serializeBytes(bcsBytes);
250
+ serializer.serializeAsBytes(this);
251
251
  }
252
252
 
253
253
  /**
@@ -339,7 +339,6 @@ export class AccountAddress extends Serializable implements TransactionArgument
339
339
  } else if (input.length !== 3) {
340
340
  // 0x + one hex char is the only valid SHORT form for special addresses.
341
341
  throw new ParsingError(
342
- // eslint-disable-next-line max-len
343
342
  `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,
344
343
  AddressInvalidReason.INVALID_PADDING_ZEROES,
345
344
  );
@@ -35,17 +35,14 @@ export class AbstractPublicKey extends AccountPublicKey {
35
35
  return new AuthenticationKey({ data: this.accountAddress.toUint8Array() });
36
36
  }
37
37
 
38
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
39
38
  verifySignature(args: VerifySignatureArgs): boolean {
40
39
  throw new Error("This function is not implemented for AbstractPublicKey.");
41
40
  }
42
41
 
43
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
44
42
  async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {
45
43
  throw new Error("This function is not implemented for AbstractPublicKey.");
46
44
  }
47
45
 
48
- // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
49
46
  serialize(serializer: Serializer): void {
50
47
  throw new Error("This function is not implemented for AbstractPublicKey.");
51
48
  }