@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
@@ -76,8 +76,9 @@ import {
76
76
  isBcsI256,
77
77
  } from "./helpers";
78
78
  import { MoveFunction, MoveModule } from "../../types";
79
-
80
- const TEXT_ENCODER = new TextEncoder();
79
+ import { warnIfDevelopment } from "../../utils/helpers";
80
+ import { memoizeAsync } from "../../utils/memoize";
81
+ import { TEXT_ENCODER } from "../../utils";
81
82
 
82
83
  /**
83
84
  * Convert type arguments to only type tags, allowing for string representations of type tags.
@@ -99,8 +100,15 @@ export function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<
99
100
  );
100
101
  }
101
102
 
103
+ /**
104
+ * Cache TTL for module ABIs in milliseconds (5 minutes).
105
+ * ABIs rarely change, so a longer cache is acceptable.
106
+ */
107
+ const MODULE_ABI_CACHE_TTL_MS = 5 * 60 * 1000;
108
+
102
109
  /**
103
110
  * Fetches the ABI of a specified module from the on-chain module ABI.
111
+ * Results are cached for 5 minutes to reduce redundant network calls.
104
112
  *
105
113
  * @param moduleAddress - The address of the module from which to fetch the ABI.
106
114
  * @param moduleName - The name of the module containing the ABI.
@@ -113,8 +121,16 @@ export async function fetchModuleAbi(
113
121
  moduleName: string,
114
122
  aptosConfig: AptosConfig,
115
123
  ): Promise<MoveModule | undefined> {
116
- const moduleBytecode = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });
117
- return moduleBytecode.abi;
124
+ const cacheKey = `module-abi-${aptosConfig.network}-${moduleAddress}-${moduleName}`;
125
+
126
+ return memoizeAsync(
127
+ async () => {
128
+ const moduleBytecode = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });
129
+ return moduleBytecode.abi;
130
+ },
131
+ cacheKey,
132
+ MODULE_ABI_CACHE_TTL_MS,
133
+ )();
118
134
  }
119
135
 
120
136
  /**
@@ -628,10 +644,8 @@ function parseArg(
628
644
  }
629
645
 
630
646
  if (arg instanceof Uint8Array && options?.allowUnknownStructs) {
631
- // eslint-disable-next-line no-console
632
- console.warn(
633
- // eslint-disable-next-line max-len
634
- `Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`,
647
+ warnIfDevelopment(
648
+ `[Aptos SDK] Unsupported struct input type for argument ${position}. Continuing since 'allowUnknownStructs' is enabled.`,
635
649
  );
636
650
  return new FixedBytes(arg);
637
651
  }
@@ -24,6 +24,7 @@ import { getInfo } from "../../internal/utils";
24
24
  import { getLedgerInfo } from "../../internal/general";
25
25
  import { getGasPriceEstimation } from "../../internal/transaction";
26
26
  import { NetworkToChainId } from "../../utils/apiEndpoints";
27
+ import { MIN_MAX_GAS_AMOUNT } from "../../utils/const";
27
28
  import { normalizeBundle } from "../../utils/normalizeBundle";
28
29
  import {
29
30
  AccountAuthenticator,
@@ -222,7 +223,6 @@ export function generateTransactionPayloadWithABI(
222
223
  // Check that all arguments are accounted for
223
224
  if ((functionArguments?.length ?? 0) !== functionAbi.parameters.length) {
224
225
  throw new Error(
225
- // eslint-disable-next-line max-len
226
226
  `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments?.length ?? 0}`,
227
227
  );
228
228
  }
@@ -314,7 +314,6 @@ export function generateViewFunctionPayloadWithABI(args: InputViewFunctionDataWi
314
314
  // Check that all arguments are accounted for
315
315
  if (functionArguments.length !== functionAbi.parameters.length) {
316
316
  throw new Error(
317
- // eslint-disable-next-line max-len
318
317
  `Too few arguments for '${moduleAddress}::${moduleName}::${functionName}', expected ${functionAbi.parameters.length} but got ${functionArguments.length}`,
319
318
  );
320
319
  }
@@ -392,7 +391,8 @@ export async function generateRawTransaction(args: {
392
391
  const getSequenceNumber = async () => {
393
392
  if (options?.accountSequenceNumber !== undefined) {
394
393
  return options.accountSequenceNumber;
395
- } else if (options?.replayProtectionNonce !== undefined) {
394
+ }
395
+ if (options?.replayProtectionNonce !== undefined) {
396
396
  // If replay nonce is provided, use it as the sequence number
397
397
  // This is an unused value, so it's specifically to show that the sequence number is not used
398
398
  return 0xdeadbeefn;
@@ -413,7 +413,7 @@ export async function generateRawTransaction(args: {
413
413
  try {
414
414
  // Check if main signer has been created on chain, if not assign sequence number 0
415
415
  return await getSequenceNumber();
416
- } catch (e: any) {
416
+ } catch {
417
417
  return 0;
418
418
  }
419
419
  } else {
@@ -426,8 +426,11 @@ export async function generateRawTransaction(args: {
426
426
  getSequenceNumberForAny(),
427
427
  ]);
428
428
 
429
+ const userMaxGas = options?.maxGasAmount
430
+ ? BigInt(options.maxGasAmount)
431
+ : BigInt(aptosConfig.getDefaultMaxGasAmount());
429
432
  const { maxGasAmount, gasUnitPrice, expireTimestamp, replayProtectionNonce } = {
430
- maxGasAmount: options?.maxGasAmount ? BigInt(options.maxGasAmount) : BigInt(aptosConfig.getDefaultMaxGasAmount()),
433
+ maxGasAmount: userMaxGas < BigInt(MIN_MAX_GAS_AMOUNT) ? BigInt(MIN_MAX_GAS_AMOUNT) : userMaxGas,
431
434
  gasUnitPrice: options?.gasUnitPrice ?? BigInt(gasEstimate),
432
435
  expireTimestamp:
433
436
  options?.expireTimestamp ?? BigInt(Math.floor(Date.now() / 1000) + aptosConfig.getDefaultTxnExpirySecFromNow()),
@@ -460,12 +463,14 @@ export function convertPayloadToInnerPayload(
460
463
  new TransactionExecutableScript(payload.script),
461
464
  new TransactionExtraConfigV1(undefined, replayProtectionNonce),
462
465
  );
463
- } else if (payload instanceof TransactionPayloadEntryFunction) {
466
+ }
467
+ if (payload instanceof TransactionPayloadEntryFunction) {
464
468
  return new TransactionInnerPayloadV1(
465
469
  new TransactionExecutableEntryFunction(payload.entryFunction),
466
470
  new TransactionExtraConfigV1(undefined, replayProtectionNonce),
467
471
  );
468
- } else if (payload instanceof TransactionPayloadMultiSig) {
472
+ }
473
+ if (payload instanceof TransactionPayloadMultiSig) {
469
474
  const innerPayload = payload.multiSig.transaction_payload;
470
475
  let executable: TransactionExecutable;
471
476
  if (innerPayload === undefined || innerPayload?.transaction_payload === undefined) {
@@ -481,9 +486,8 @@ export function convertPayloadToInnerPayload(
481
486
  executable,
482
487
  new TransactionExtraConfigV1(payload.multiSig.multisig_address, replayProtectionNonce),
483
488
  );
484
- } else {
485
- throw new Error(`Unsupported payload type: ${payload}`);
486
489
  }
490
+ throw new Error(`Unsupported payload type: ${payload}`);
487
491
  }
488
492
 
489
493
  /**
@@ -704,9 +708,7 @@ export function getAuthenticatorForSimulation(publicKey?: PublicKey) {
704
708
  return new AnySignature(invalidSignature);
705
709
  }),
706
710
  bitmap: accountPublicKey.createBitmap({
707
- bits: Array(accountPublicKey.publicKeys.length)
708
- .fill(0)
709
- .map((_, i) => i),
711
+ bits: new Array(accountPublicKey.publicKeys.length).fill(0).map((_, i) => i),
710
712
  }),
711
713
  }),
712
714
  );
@@ -1,9 +1,6 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- /* eslint-disable @typescript-eslint/no-unused-vars */
5
- /* eslint-disable class-methods-use-this */
6
- /* eslint-disable max-classes-per-file */
7
4
  import { Deserializer } from "../../bcs/deserializer";
8
5
  import { Serializable, Serializer } from "../../bcs/serializer";
9
6
  import { AccountAddress } from "../../core";
@@ -299,7 +299,6 @@ export function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolea
299
299
  throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedWhitespaceCharacter);
300
300
  }
301
301
 
302
- // eslint-disable-next-line no-continue
303
302
  continue;
304
303
  } else {
305
304
  // Any other characters just append to the current string
@@ -383,7 +382,7 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
383
382
  throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedVectorTypeArgumentCount);
384
383
  }
385
384
  return new TypeTagVector(types[0]);
386
- default:
385
+ default: {
387
386
  // Reference will have to handle the inner type
388
387
  if (isRef(trimmedStr)) {
389
388
  const actualType = trimmedStr.substring(1);
@@ -404,18 +403,16 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
404
403
  }
405
404
 
406
405
  // Parse for a struct tag
407
- // eslint-disable-next-line no-case-declarations
408
406
  const structParts = trimmedStr.split("::");
409
407
  if (structParts.length !== 3) {
410
408
  throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);
411
409
  }
412
410
 
413
411
  // Validate struct address
414
- // eslint-disable-next-line no-case-declarations
415
412
  let address: AccountAddress;
416
413
  try {
417
414
  address = AccountAddress.fromString(structParts[0]);
418
- } catch (error: any) {
415
+ } catch {
419
416
  throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidAddress);
420
417
  }
421
418
 
@@ -430,5 +427,6 @@ function parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: bo
430
427
  return new TypeTagStruct(
431
428
  new StructTag(address, new Identifier(structParts[1]), new Identifier(structParts[2]), types),
432
429
  );
430
+ }
433
431
  }
434
432
  }
@@ -403,17 +403,6 @@ export type GetCollectionDataQuery = {
403
403
  description: string;
404
404
  last_transaction_timestamp: any;
405
405
  last_transaction_version: any;
406
- cdn_asset_uris?: {
407
- cdn_image_uri?: string | null;
408
- asset_uri: string;
409
- animation_optimizer_retry_count: number;
410
- cdn_animation_uri?: string | null;
411
- cdn_json_uri?: string | null;
412
- image_optimizer_retry_count: number;
413
- json_parser_retry_count: number;
414
- raw_animation_uri?: string | null;
415
- raw_image_uri?: string | null;
416
- } | null;
417
406
  }>;
418
407
  };
419
408
 
@@ -267,17 +267,6 @@ export const GetCollectionData = `
267
267
  description
268
268
  last_transaction_timestamp
269
269
  last_transaction_version
270
- cdn_asset_uris {
271
- cdn_image_uri
272
- asset_uri
273
- animation_optimizer_retry_count
274
- cdn_animation_uri
275
- cdn_json_uri
276
- image_optimizer_retry_count
277
- json_parser_retry_count
278
- raw_animation_uri
279
- raw_image_uri
280
- }
281
270
  }
282
271
  }
283
272
  `;
@@ -172,6 +172,11 @@ export enum AnyPublicKeyVariant {
172
172
  Secp256r1 = 2,
173
173
  Keyless = 3,
174
174
  FederatedKeyless = 4,
175
+ /**
176
+ * Post-quantum signature scheme (SLH-DSA-SHA2-128s).
177
+ * Note: Full implementation not yet available in this SDK.
178
+ */
179
+ SlhDsaSha2_128s = 5,
175
180
  }
176
181
 
177
182
  export function anyPublicKeyVariantToString(variant: AnyPublicKeyVariant): string {
@@ -186,6 +191,8 @@ export function anyPublicKeyVariantToString(variant: AnyPublicKeyVariant): strin
186
191
  return "keyless";
187
192
  case AnyPublicKeyVariant.FederatedKeyless:
188
193
  return "federated_keyless";
194
+ case AnyPublicKeyVariant.SlhDsaSha2_128s:
195
+ return "slh_dsa_sha2_128s";
189
196
  default:
190
197
  throw new Error("Unknown public key variant");
191
198
  }
@@ -199,6 +206,11 @@ export enum AnySignatureVariant {
199
206
  Secp256k1 = 1,
200
207
  WebAuthn = 2,
201
208
  Keyless = 3,
209
+ /**
210
+ * Post-quantum signature scheme (SLH-DSA-SHA2-128s).
211
+ * Note: Full implementation not yet available in this SDK.
212
+ */
213
+ SlhDsaSha2_128s = 4,
202
214
  }
203
215
 
204
216
  /**
@@ -368,6 +380,20 @@ export interface WhereArg<T extends {}> {
368
380
 
369
381
  /**
370
382
  * A configuration object for requests to the server, including API key, extra headers, and cookie handling options.
383
+ *
384
+ * Security Note: Consider implementing client-side rate limiting in your application to prevent
385
+ * accidental API abuse. You can use libraries like 'bottleneck' or 'p-queue' to limit request rates.
386
+ *
387
+ * @example
388
+ * ```typescript
389
+ * import Bottleneck from 'bottleneck';
390
+ *
391
+ * // Create a limiter that allows 10 requests per second
392
+ * const limiter = new Bottleneck({ minTime: 100, maxConcurrent: 5 });
393
+ *
394
+ * // Wrap your Aptos calls with the limiter
395
+ * const result = await limiter.schedule(() => aptos.getAccountInfo({ accountAddress }));
396
+ * ```
371
397
  */
372
398
  export type ClientConfig = ClientHeadersType & {
373
399
  WITH_CREDENTIALS?: boolean;
@@ -24,7 +24,18 @@ export enum AptosApiType {
24
24
  * @group Implementation
25
25
  * @category Utils
26
26
  */
27
- export const DEFAULT_MAX_GAS_AMOUNT = 200000;
27
+ export const DEFAULT_MAX_GAS_AMOUNT = 2000000;
28
+
29
+ /**
30
+ * The minimum max gas amount that the SDK will allow for a transaction.
31
+ *
32
+ * This value acts as a floor to prevent transactions from being built with a max gas amount
33
+ * below the network's minimum transaction gas units, which would cause
34
+ * MAX_GAS_UNITS_BELOW_MIN_TRANSACTION_GAS_UNITS errors.
35
+ * @group Implementation
36
+ * @category Utils
37
+ */
38
+ export const MIN_MAX_GAS_AMOUNT = 2000;
28
39
 
29
40
  /**
30
41
  * The default transaction expiration seconds from now.
@@ -98,3 +109,8 @@ export enum ProcessorType {
98
109
  * where project-id can contain letters, numbers, hyphens, and underscores
99
110
  */
100
111
  export const FIREBASE_AUTH_ISS_PATTERN = /^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;
112
+
113
+ /**
114
+ * Shared TextEncoder instance for string serialization to avoid repeated instantiation.
115
+ */
116
+ export const TEXT_ENCODER = new TextEncoder();
@@ -1,11 +1,52 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { decode } from "js-base64";
4
+ import { Base64, decode } from "js-base64";
5
5
  import { MoveFunctionId, MoveStructId } from "../types";
6
6
  import { AccountAddress } from "../core/accountAddress";
7
7
  import { createObjectAddress } from "../core/account/utils/address";
8
8
 
9
+ /**
10
+ * Checks if the current runtime environment is Bun.
11
+ * This is useful for detecting Bun-specific compatibility issues.
12
+ *
13
+ * @returns true if running in Bun, false otherwise.
14
+ * @group Implementation
15
+ * @category Utils
16
+ */
17
+ export function isBun(): boolean {
18
+ try {
19
+ // Bun exposes a global `Bun` object.
20
+ return typeof globalThis !== "undefined" && "Bun" in globalThis;
21
+ } catch {
22
+ return false;
23
+ }
24
+ }
25
+
26
+ /**
27
+ * Logs a warning message to the console only in development environments.
28
+ * This function helps reduce information leakage in production while maintaining
29
+ * helpful warnings during development.
30
+ *
31
+ * @param message - The warning message to log.
32
+ * @group Implementation
33
+ * @category Utils
34
+ */
35
+ export function warnIfDevelopment(message: string): void {
36
+ // Check common environment variables to determine if we're in development
37
+ // This works in Node.js, bundlers like webpack/vite, and most build systems
38
+ const isDevelopment =
39
+ typeof process !== "undefined" &&
40
+ process.env &&
41
+ (process.env.NODE_ENV === "development" ||
42
+ process.env.NODE_ENV === "test" ||
43
+ process.env.APTOS_SDK_WARNINGS === "true");
44
+
45
+ if (isDevelopment) {
46
+ console.warn(message);
47
+ }
48
+ }
49
+
9
50
  /**
10
51
  * Sleep for the specified amount of time in milliseconds.
11
52
  * This function can be used to introduce delays in asynchronous operations.
@@ -80,8 +121,8 @@ export function base64UrlToBytes(base64Url: string): Uint8Array {
80
121
  while (base64.length % 4 !== 0) {
81
122
  base64 += "=";
82
123
  }
83
- // Use Buffer to convert base64 to Uint8Array
84
- return new Uint8Array(Buffer.from(base64, "base64"));
124
+ // Use js-base64 to convert base64 to Uint8Array
125
+ return Base64.toUint8Array(base64);
85
126
  }
86
127
 
87
128
  /**
@@ -154,7 +195,6 @@ export const parseEncodedStruct = (structObj: {
154
195
  module_name: string;
155
196
  struct_name: string;
156
197
  }): MoveStructId => {
157
- // eslint-disable-next-line @typescript-eslint/naming-convention
158
198
  const { account_address, module_name, struct_name } = structObj;
159
199
  const moduleName = hexToAscii(module_name);
160
200
  const structName = hexToAscii(struct_name);
@@ -241,7 +281,6 @@ export function truncateAddress(address: string, start: number = 6, end: number
241
281
  * Constants for metadata address calculation
242
282
  */
243
283
  const APTOS_COIN_TYPE_STR = "0x1::aptos_coin::AptosCoin";
244
- const APT_METADATA_ADDRESS_HEX = AccountAddress.A.toStringLong();
245
284
 
246
285
  /**
247
286
  * Helper function to standardize Move type string by converting all addresses to short form,
@@ -252,10 +291,10 @@ function standardizeMoveTypeString(input: string): string {
252
291
  // This regex matches "0x" followed by hex digits, handling both standalone addresses and those within <>
253
292
  const addressRegex = /0x[0-9a-fA-F]+/g;
254
293
 
255
- return input.replace(addressRegex, (match) => {
294
+ return input.replace(addressRegex, (match) =>
256
295
  // Use AccountAddress to handle the address
257
- return AccountAddress.from(match, { maxMissingChars: 63 }).toStringShort();
258
- });
296
+ AccountAddress.from(match, { maxMissingChars: 63 }).toStringShort(),
297
+ );
259
298
  }
260
299
 
261
300
  /**
@@ -2,18 +2,130 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  /**
5
- * The global cache Map shared across all functions. Must keep care to ensure that the
6
- * cache keys are unique across all functions.
5
+ * Maximum number of entries to keep in the cache to prevent unbounded memory growth.
6
+ * When this limit is exceeded, the oldest entries are evicted.
7
+ */
8
+ const MAX_CACHE_SIZE = 1000;
9
+
10
+ /**
11
+ * Interval in milliseconds for periodic cleanup of expired cache entries.
12
+ */
13
+ const CLEANUP_INTERVAL_MS = 60000; // 1 minute
14
+
15
+ /**
16
+ * Minimum required key length to help ensure uniqueness.
17
+ * Keys should include a namespace prefix (e.g., "module-abi-", "ledger-info-").
18
+ */
19
+ const MIN_KEY_LENGTH = 10;
20
+
21
+ /**
22
+ * Set of known cache key prefixes to help detect potential collisions.
23
+ * Each caller should use a unique prefix.
24
+ */
25
+ const knownKeyPrefixes = new Set<string>();
26
+
27
+ /**
28
+ * Validates a cache key for basic security requirements.
29
+ * @param key - The cache key to validate
30
+ * @throws Error if the key is invalid
31
+ */
32
+ function validateCacheKey(key: string): void {
33
+ if (!key || typeof key !== "string") {
34
+ throw new Error("Cache key must be a non-empty string");
35
+ }
36
+ if (key.length < MIN_KEY_LENGTH) {
37
+ throw new Error(
38
+ `Cache key "${key}" is too short. Keys should be at least ${MIN_KEY_LENGTH} characters and include a namespace prefix.`,
39
+ );
40
+ }
41
+ // Extract prefix (everything before the last hyphen or the first 10 chars)
42
+ const prefixMatch = key.match(/^([a-z]+-[a-z]+-)/i);
43
+ if (prefixMatch) {
44
+ knownKeyPrefixes.add(prefixMatch[1]);
45
+ }
46
+ }
47
+
48
+ /**
49
+ * Cache entry structure with value, timestamp, and last access time for LRU eviction.
50
+ */
51
+ interface CacheEntry<T> {
52
+ value: T;
53
+ timestamp: number;
54
+ lastAccess: number;
55
+ ttlMs?: number;
56
+ }
57
+
58
+ /**
59
+ * The global cache Map shared across all functions with LRU eviction support.
60
+ * SECURITY: All cache keys should include a unique namespace prefix to prevent
61
+ * collisions between different caching use cases (e.g., "module-abi-", "ledger-info-").
7
62
  * @group Implementation
8
63
  * @category Utils
9
64
  */
10
- const cache = new Map<string, { value: any; timestamp: number }>();
65
+ const cache = new Map<string, CacheEntry<any>>();
66
+
67
+ /**
68
+ * Track whether cleanup interval is set up.
69
+ */
70
+ let cleanupIntervalId: ReturnType<typeof setInterval> | null = null;
71
+
72
+ /**
73
+ * Sets up periodic cleanup of expired cache entries if not already running.
74
+ * This prevents memory leaks from accumulating expired entries.
75
+ */
76
+ function ensureCleanupInterval(): void {
77
+ if (cleanupIntervalId === null) {
78
+ cleanupIntervalId = setInterval(() => {
79
+ const now = Date.now();
80
+ const keysToDelete: string[] = [];
81
+
82
+ cache.forEach((entry, key) => {
83
+ // Remove entries that have expired
84
+ if (entry.ttlMs !== undefined && now - entry.timestamp > entry.ttlMs) {
85
+ keysToDelete.push(key);
86
+ }
87
+ });
88
+
89
+ keysToDelete.forEach((key) => cache.delete(key));
90
+
91
+ // If cache is empty, stop the cleanup interval to avoid unnecessary overhead
92
+ if (cache.size === 0 && cleanupIntervalId !== null) {
93
+ clearInterval(cleanupIntervalId);
94
+ cleanupIntervalId = null;
95
+ }
96
+ }, CLEANUP_INTERVAL_MS);
97
+
98
+ // Ensure the interval doesn't prevent Node.js from exiting
99
+ if (typeof cleanupIntervalId === "object" && "unref" in cleanupIntervalId) {
100
+ cleanupIntervalId.unref();
101
+ }
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Evicts the least recently used entries when cache exceeds maximum size.
107
+ */
108
+ function evictIfNeeded(): void {
109
+ if (cache.size >= MAX_CACHE_SIZE) {
110
+ // Find and remove the least recently accessed entries (remove ~10% of cache)
111
+ const entriesToRemove = Math.ceil(MAX_CACHE_SIZE * 0.1);
112
+ const entries = Array.from(cache.entries()).sort((a, b) => a[1].lastAccess - b[1].lastAccess);
113
+
114
+ for (let i = 0; i < entriesToRemove && i < entries.length; i += 1) {
115
+ cache.delete(entries[i][0]);
116
+ }
117
+ }
118
+ }
11
119
 
12
120
  /**
13
121
  * A memoize higher-order function to cache the response of an async function.
14
122
  * This function helps to improve performance by avoiding repeated calls to the same async function with the same arguments
15
123
  * within a specified time-to-live (TTL).
16
124
  *
125
+ * Features:
126
+ * - LRU eviction when cache exceeds MAX_CACHE_SIZE entries
127
+ * - Periodic cleanup of expired entries to prevent memory leaks
128
+ *
17
129
  * @param func The async function to cache the result of.
18
130
  * @param key The cache key used to store the result.
19
131
  * @param ttlMs The time-to-live in milliseconds for cached data.
@@ -26,20 +138,35 @@ export function memoizeAsync<T>(
26
138
  key: string,
27
139
  ttlMs?: number,
28
140
  ): (...args: any[]) => Promise<T> {
141
+ // Validate key format on first call to catch misuse early
142
+ validateCacheKey(key);
143
+
29
144
  return async (...args: any[]) => {
145
+ const now = Date.now();
146
+
30
147
  // Check if the cached result exists and is within TTL
31
148
  if (cache.has(key)) {
32
- const { value, timestamp } = cache.get(key)!;
33
- if (ttlMs === undefined || Date.now() - timestamp <= ttlMs) {
34
- return value;
149
+ const entry = cache.get(key)!;
150
+ if (ttlMs === undefined || now - entry.timestamp <= ttlMs) {
151
+ // Update last access time for LRU
152
+ entry.lastAccess = now;
153
+ return entry.value;
35
154
  }
155
+ // Entry expired, remove it
156
+ cache.delete(key);
36
157
  }
37
158
 
38
159
  // If not cached or TTL expired, compute the result
39
160
  const result = await func(...args);
40
161
 
162
+ // Evict old entries if needed before adding new one
163
+ evictIfNeeded();
164
+
41
165
  // Cache the result with a timestamp
42
- cache.set(key, { value: result, timestamp: Date.now() });
166
+ cache.set(key, { value: result, timestamp: now, lastAccess: now, ttlMs });
167
+
168
+ // Ensure cleanup is running
169
+ ensureCleanupInterval();
43
170
 
44
171
  return result;
45
172
  };
@@ -48,6 +175,10 @@ export function memoizeAsync<T>(
48
175
  /**
49
176
  * Caches the result of a function call to improve performance on subsequent calls with the same arguments.
50
177
  *
178
+ * Features:
179
+ * - LRU eviction when cache exceeds MAX_CACHE_SIZE entries
180
+ * - Periodic cleanup of expired entries to prevent memory leaks
181
+ *
51
182
  * @param key - The key to cache on, all accesses by this key will return the cached value.
52
183
  * @param func - The function whose result will be cached.
53
184
  * @param ttlMs - The time-to-live in milliseconds for cached data.
@@ -56,21 +187,56 @@ export function memoizeAsync<T>(
56
187
  * @category Utils
57
188
  */
58
189
  export function memoize<T>(func: (...args: any[]) => T, key: string, ttlMs?: number): (...args: any[]) => T {
190
+ // Validate key format on first call to catch misuse early
191
+ validateCacheKey(key);
192
+
59
193
  return (...args: any[]) => {
194
+ const now = Date.now();
195
+
60
196
  // Check if the cached result exists and is within TTL
61
197
  if (cache.has(key)) {
62
- const { value, timestamp } = cache.get(key)!;
63
- if (ttlMs === undefined || Date.now() - timestamp <= ttlMs) {
64
- return value;
198
+ const entry = cache.get(key)!;
199
+ if (ttlMs === undefined || now - entry.timestamp <= ttlMs) {
200
+ // Update last access time for LRU
201
+ entry.lastAccess = now;
202
+ return entry.value;
65
203
  }
204
+ // Entry expired, remove it
205
+ cache.delete(key);
66
206
  }
67
207
 
68
208
  // If not cached or TTL expired, compute the result
69
209
  const result = func(...args);
70
210
 
211
+ // Evict old entries if needed before adding new one
212
+ evictIfNeeded();
213
+
71
214
  // Cache the result with a timestamp
72
- cache.set(key, { value: result, timestamp: Date.now() });
215
+ cache.set(key, { value: result, timestamp: now, lastAccess: now, ttlMs });
216
+
217
+ // Ensure cleanup is running
218
+ ensureCleanupInterval();
73
219
 
74
220
  return result;
75
221
  };
76
222
  }
223
+
224
+ /**
225
+ * Clears all entries from the memoization cache.
226
+ * Useful for testing or when you need to force fresh data.
227
+ * @group Implementation
228
+ * @category Utils
229
+ */
230
+ export function clearMemoizeCache(): void {
231
+ cache.clear();
232
+ }
233
+
234
+ /**
235
+ * Returns the current size of the memoization cache.
236
+ * Useful for monitoring and debugging.
237
+ * @group Implementation
238
+ * @category Utils
239
+ */
240
+ export function getMemoizeCacheSize(): number {
241
+ return cache.size;
242
+ }
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "6.0.0";
9
+ export const VERSION = "6.2.0";