@aptos-labs/ts-sdk 1.11.0 → 1.12.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 (332) hide show
  1. package/README.md +5 -6
  2. package/dist/common/index.d.ts +73 -31
  3. package/dist/common/index.js +26 -26
  4. package/dist/common/index.js.map +1 -1
  5. package/dist/esm/api/account.mjs +1 -1
  6. package/dist/esm/api/ans.d.mts +13 -11
  7. package/dist/esm/api/ans.mjs +1 -1
  8. package/dist/esm/api/aptos.d.mts +6 -4
  9. package/dist/esm/api/aptos.mjs +1 -1
  10. package/dist/esm/api/coin.d.mts +9 -7
  11. package/dist/esm/api/coin.mjs +1 -1
  12. package/dist/esm/api/digitalAsset.d.mts +3 -1
  13. package/dist/esm/api/digitalAsset.mjs +1 -1
  14. package/dist/esm/api/event.mjs +1 -1
  15. package/dist/esm/api/faucet.mjs +1 -1
  16. package/dist/esm/api/fungibleAsset.d.mts +6 -4
  17. package/dist/esm/api/fungibleAsset.mjs +1 -1
  18. package/dist/esm/api/general.d.mts +2 -0
  19. package/dist/esm/api/general.mjs +1 -1
  20. package/dist/esm/api/index.d.mts +6 -4
  21. package/dist/esm/api/index.mjs +1 -1
  22. package/dist/esm/api/staking.mjs +1 -1
  23. package/dist/esm/api/transaction.d.mts +6 -4
  24. package/dist/esm/api/transaction.mjs +1 -1
  25. package/dist/esm/api/transactionSubmission/build.d.mts +9 -7
  26. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  27. package/dist/esm/api/transactionSubmission/management.d.mts +5 -3
  28. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -0
  30. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  31. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  32. package/dist/esm/api/transactionSubmission/simulate.d.mts +2 -0
  33. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  34. package/dist/esm/api/transactionSubmission/submit.d.mts +2 -0
  35. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  36. package/dist/esm/api/utils.mjs +1 -1
  37. package/dist/esm/bcs/index.mjs +1 -1
  38. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  39. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  40. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  41. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  42. package/dist/esm/bcs/serializer.mjs +1 -1
  43. package/dist/esm/{chunk-VNNLHEJ4.mjs → chunk-2MRYBOYC.mjs} +2 -2
  44. package/dist/esm/{chunk-TTM66JZ4.mjs → chunk-2XVDVF5C.mjs} +2 -2
  45. package/dist/esm/chunk-3D7GOEFD.mjs +2 -0
  46. package/dist/esm/chunk-3D7GOEFD.mjs.map +1 -0
  47. package/dist/esm/{chunk-3RRZ4MSV.mjs → chunk-3GTT6K3X.mjs} +2 -2
  48. package/dist/esm/{chunk-Y3CHPF6X.mjs → chunk-4J5V4M3P.mjs} +2 -2
  49. package/dist/esm/{chunk-VKWPCOZA.mjs → chunk-4KMISR2H.mjs} +2 -2
  50. package/dist/esm/{chunk-BWG5NCHC.mjs → chunk-5LI6PUQN.mjs} +2 -2
  51. package/dist/esm/{chunk-QDD2MDJZ.mjs → chunk-5NSXEM3O.mjs} +2 -2
  52. package/dist/esm/{chunk-Q5GNCAA6.mjs → chunk-6F7X2C22.mjs} +2 -2
  53. package/dist/esm/{chunk-XXKA2GO7.mjs → chunk-6MLNYBCP.mjs} +2 -2
  54. package/dist/esm/chunk-6MLNYBCP.mjs.map +1 -0
  55. package/dist/esm/{chunk-U5CKFPSM.mjs → chunk-6X6G2RC3.mjs} +2 -2
  56. package/dist/esm/chunk-6X6G2RC3.mjs.map +1 -0
  57. package/dist/esm/{chunk-T43CJS4C.mjs → chunk-7JZWCHLH.mjs} +2 -2
  58. package/dist/esm/{chunk-W5PK4QCX.mjs → chunk-7PNFDDIG.mjs} +2 -2
  59. package/dist/esm/chunk-AFTMLXYT.mjs +2 -0
  60. package/dist/esm/chunk-BCUSI3N6.mjs +2 -0
  61. package/dist/esm/chunk-BCUSI3N6.mjs.map +1 -0
  62. package/dist/esm/{chunk-HSITRYZ5.mjs → chunk-C67SYOXM.mjs} +2 -2
  63. package/dist/esm/{chunk-HYQSORWM.mjs → chunk-CHVWOPVA.mjs} +2 -2
  64. package/dist/esm/{chunk-JKXSSRNT.mjs → chunk-CPQPVRKV.mjs} +2 -2
  65. package/dist/esm/{chunk-P434YHBQ.mjs → chunk-D5Q7BI3J.mjs} +2 -2
  66. package/dist/esm/chunk-DAC5J2BG.mjs +2 -0
  67. package/dist/esm/chunk-DAC5J2BG.mjs.map +1 -0
  68. package/dist/esm/{chunk-O5L7WGNH.mjs → chunk-EIXGNR6D.mjs} +2 -2
  69. package/dist/esm/{chunk-OWEAY3N3.mjs → chunk-EOQOTFO7.mjs} +2 -2
  70. package/dist/esm/chunk-F7EMGK4M.mjs +2 -0
  71. package/dist/esm/chunk-F7EMGK4M.mjs.map +1 -0
  72. package/dist/esm/chunk-F7J7ZW4H.mjs +2 -0
  73. package/dist/esm/{chunk-2BGOMPDV.mjs → chunk-FNKDXPPQ.mjs} +2 -2
  74. package/dist/esm/{chunk-VBSAEAWA.mjs → chunk-HOTGXRPG.mjs} +2 -2
  75. package/dist/esm/{chunk-O22J7RER.mjs → chunk-HTTPFWYL.mjs} +2 -2
  76. package/dist/esm/chunk-HTWJVZZ5.mjs +2 -0
  77. package/dist/esm/chunk-HTWJVZZ5.mjs.map +1 -0
  78. package/dist/esm/chunk-ICXA3DZH.mjs +1 -0
  79. package/dist/esm/{chunk-2NC32JRF.mjs → chunk-IQSAG5Y5.mjs} +2 -2
  80. package/dist/esm/{chunk-4P6KFDXF.mjs → chunk-J43BXPJ3.mjs} +2 -2
  81. package/dist/esm/chunk-J43BXPJ3.mjs.map +1 -0
  82. package/dist/esm/{chunk-JX3IRXNX.mjs → chunk-JE7INUQ2.mjs} +2 -2
  83. package/dist/esm/chunk-JNDRFTEA.mjs +2 -0
  84. package/dist/esm/chunk-JNDRFTEA.mjs.map +1 -0
  85. package/dist/esm/{chunk-27ML4NFD.mjs → chunk-JV2PBG6G.mjs} +2 -2
  86. package/dist/esm/{chunk-3EKNELIS.mjs → chunk-JV2UOHGR.mjs} +2 -2
  87. package/dist/esm/{chunk-43QJL2AV.mjs → chunk-JVBXZ6OJ.mjs} +2 -2
  88. package/dist/esm/{chunk-RWBAKP5G.mjs → chunk-KJI5PY5Z.mjs} +2 -2
  89. package/dist/esm/chunk-KPDWT3LC.mjs +2 -0
  90. package/dist/esm/chunk-KPDWT3LC.mjs.map +1 -0
  91. package/dist/esm/{chunk-PAY4TBCF.mjs → chunk-L54P6EGN.mjs} +2 -2
  92. package/dist/esm/{chunk-PAY4TBCF.mjs.map → chunk-L54P6EGN.mjs.map} +1 -1
  93. package/dist/esm/{chunk-Y3R5DLBS.mjs → chunk-L6KXN3YD.mjs} +2 -2
  94. package/dist/esm/{chunk-SQW7K56J.mjs → chunk-LF6IQT54.mjs} +2 -2
  95. package/dist/esm/{chunk-JF4E53MH.mjs → chunk-LSKVPMOF.mjs} +2 -2
  96. package/dist/esm/{chunk-JF4E53MH.mjs.map → chunk-LSKVPMOF.mjs.map} +1 -1
  97. package/dist/esm/{chunk-Y7G5W2QZ.mjs → chunk-MS76A6LX.mjs} +2 -2
  98. package/dist/esm/{chunk-JLDOXN33.mjs → chunk-MV7RDJFK.mjs} +2 -2
  99. package/dist/esm/{chunk-LD7YBNH5.mjs → chunk-NLMMCXLR.mjs} +2 -2
  100. package/dist/esm/{chunk-A5ACWD7S.mjs → chunk-NLPPL42P.mjs} +2 -2
  101. package/dist/esm/chunk-NMASPJTH.mjs +2 -0
  102. package/dist/esm/chunk-NMASPJTH.mjs.map +1 -0
  103. package/dist/esm/{chunk-OH6HD5SF.mjs → chunk-O3YFW4T3.mjs} +2 -2
  104. package/dist/esm/chunk-O3YFW4T3.mjs.map +1 -0
  105. package/dist/esm/{chunk-4LQNMXX3.mjs → chunk-P2CIREOD.mjs} +2 -2
  106. package/dist/esm/{chunk-H4Q7YQD3.mjs → chunk-PE6R6XQV.mjs} +2 -2
  107. package/dist/esm/chunk-QAMK2MSI.mjs +2 -0
  108. package/dist/esm/chunk-QAMK2MSI.mjs.map +1 -0
  109. package/dist/esm/{chunk-AVQSQJUO.mjs → chunk-QMFBU2CG.mjs} +2 -2
  110. package/dist/esm/{chunk-HEDMDM2U.mjs → chunk-R3ELNYY5.mjs} +2 -2
  111. package/dist/esm/chunk-R3ELNYY5.mjs.map +1 -0
  112. package/dist/esm/{chunk-C62XI6VN.mjs → chunk-R4ERAOCM.mjs} +2 -2
  113. package/dist/esm/{chunk-2TRSGKMS.mjs → chunk-RP66QS6R.mjs} +2 -2
  114. package/dist/esm/chunk-RVUPGO4R.mjs +2 -0
  115. package/dist/esm/chunk-RVUPGO4R.mjs.map +1 -0
  116. package/dist/esm/{chunk-WHNLDDPT.mjs → chunk-S5AGI7RQ.mjs} +2 -2
  117. package/dist/esm/{chunk-NDV4GZ5U.mjs → chunk-UCDLUHVW.mjs} +2 -2
  118. package/dist/esm/chunk-UCDLUHVW.mjs.map +1 -0
  119. package/dist/esm/{chunk-GHMYWL3R.mjs → chunk-UEI62FBQ.mjs} +2 -2
  120. package/dist/esm/chunk-VU2W3ZLX.mjs +2 -0
  121. package/dist/esm/{chunk-LNS5RI5S.mjs.map → chunk-VU2W3ZLX.mjs.map} +1 -1
  122. package/dist/esm/{chunk-AT2HAXSH.mjs → chunk-VUZDLGDK.mjs} +2 -2
  123. package/dist/esm/{chunk-XDZF5IUF.mjs → chunk-WNVUG2UF.mjs} +2 -2
  124. package/dist/esm/{chunk-CIMZIZY3.mjs → chunk-WXXASZQ4.mjs} +2 -2
  125. package/dist/esm/{chunk-EBCIZ4D6.mjs → chunk-WZSVQBPA.mjs} +2 -2
  126. package/dist/esm/{chunk-HYOPI6T2.mjs → chunk-X3QW43I2.mjs} +2 -2
  127. package/dist/esm/{chunk-VK3H7DMJ.mjs → chunk-XMJEWG3I.mjs} +2 -2
  128. package/dist/esm/{chunk-JEQSSMDK.mjs → chunk-XQMUVQI3.mjs} +2 -2
  129. package/dist/esm/chunk-Y2AFC3E6.mjs +2 -0
  130. package/dist/esm/chunk-Y2AFC3E6.mjs.map +1 -0
  131. package/dist/esm/{chunk-AE2K65NN.mjs → chunk-Y52TZMRO.mjs} +2 -2
  132. package/dist/esm/chunk-Y52TZMRO.mjs.map +1 -0
  133. package/dist/esm/{chunk-RP4FMC6O.mjs → chunk-YJIRT3GJ.mjs} +2 -2
  134. package/dist/esm/{chunk-CJLZV5JK.mjs → chunk-YMFCBU4L.mjs} +2 -2
  135. package/dist/esm/{chunk-NHVLEE5G.mjs → chunk-ZPS4RIFU.mjs} +2 -2
  136. package/dist/esm/chunk-ZPS4RIFU.mjs.map +1 -0
  137. package/dist/esm/cli/index.mjs +1 -1
  138. package/dist/esm/cli/localNode.d.mts +1 -1
  139. package/dist/esm/cli/localNode.mjs +1 -1
  140. package/dist/esm/client/core.mjs +1 -1
  141. package/dist/esm/client/get.mjs +1 -1
  142. package/dist/esm/client/index.mjs +1 -1
  143. package/dist/esm/client/post.mjs +1 -1
  144. package/dist/esm/core/account/Account.mjs +1 -1
  145. package/dist/esm/core/account/Ed25519Account.mjs +1 -1
  146. package/dist/esm/core/account/SingleKeyAccount.mjs +1 -1
  147. package/dist/esm/core/account/index.d.mts +1 -1
  148. package/dist/esm/core/account/index.mjs +1 -1
  149. package/dist/esm/core/account/utils/address.d.mts +10 -1
  150. package/dist/esm/core/account/utils/address.mjs +1 -1
  151. package/dist/esm/core/account/utils/index.d.mts +1 -1
  152. package/dist/esm/core/account/utils/index.mjs +1 -1
  153. package/dist/esm/core/accountAddress.mjs +1 -1
  154. package/dist/esm/core/authenticationKey.mjs +1 -1
  155. package/dist/esm/core/crypto/ed25519.d.mts +2 -2
  156. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  157. package/dist/esm/core/crypto/index.mjs +1 -1
  158. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  159. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  160. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  161. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  162. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  163. package/dist/esm/core/crypto/signature.mjs +1 -1
  164. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  165. package/dist/esm/core/crypto/utils.d.mts +16 -0
  166. package/dist/esm/core/crypto/utils.mjs +2 -0
  167. package/dist/esm/core/crypto/utils.mjs.map +1 -0
  168. package/dist/esm/core/hex.d.mts +2 -2
  169. package/dist/esm/core/hex.mjs +1 -1
  170. package/dist/esm/core/index.d.mts +1 -1
  171. package/dist/esm/core/index.mjs +1 -1
  172. package/dist/esm/index.d.mts +5 -3
  173. package/dist/esm/index.mjs +1 -1
  174. package/dist/esm/internal/account.mjs +1 -1
  175. package/dist/esm/internal/ans.d.mts +7 -5
  176. package/dist/esm/internal/ans.mjs +1 -1
  177. package/dist/esm/internal/coin.d.mts +3 -1
  178. package/dist/esm/internal/coin.mjs +1 -1
  179. package/dist/esm/internal/digitalAsset.d.mts +3 -1
  180. package/dist/esm/internal/digitalAsset.mjs +1 -1
  181. package/dist/esm/internal/event.mjs +1 -1
  182. package/dist/esm/internal/faucet.mjs +1 -1
  183. package/dist/esm/internal/fungibleAsset.d.mts +6 -4
  184. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  185. package/dist/esm/internal/general.mjs +1 -1
  186. package/dist/esm/internal/staking.mjs +1 -1
  187. package/dist/esm/internal/transaction.mjs +1 -1
  188. package/dist/esm/internal/transactionSubmission.d.mts +3 -1
  189. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  190. package/dist/esm/internal/view.d.mts +2 -0
  191. package/dist/esm/internal/view.mjs +1 -1
  192. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  193. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  194. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  195. package/dist/esm/transactions/index.d.mts +4 -2
  196. package/dist/esm/transactions/index.mjs +1 -1
  197. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  198. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  199. package/dist/esm/transactions/instances/index.d.mts +1 -0
  200. package/dist/esm/transactions/instances/index.mjs +1 -1
  201. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  202. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +41 -0
  203. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +2 -0
  204. package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -0
  205. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  206. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  207. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  208. package/dist/esm/transactions/instances/simpleTransaction.d.mts +41 -0
  209. package/dist/esm/transactions/instances/simpleTransaction.mjs +2 -0
  210. package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -0
  211. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  212. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  213. package/dist/esm/transactions/management/index.d.mts +2 -0
  214. package/dist/esm/transactions/management/index.mjs +1 -1
  215. package/dist/esm/transactions/management/transactionWorker.d.mts +3 -1
  216. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  217. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +2 -0
  218. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  219. package/dist/esm/transactions/transactionBuilder/index.d.mts +3 -1
  220. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  221. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -0
  222. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  223. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +14 -2
  224. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  225. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  226. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  227. package/dist/esm/transactions/types.d.mts +3 -22
  228. package/dist/esm/version.d.mts +1 -1
  229. package/dist/esm/version.mjs +1 -1
  230. package/package.json +1 -1
  231. package/src/api/ans.ts +8 -7
  232. package/src/api/coin.ts +2 -1
  233. package/src/api/digitalAsset.ts +2 -1
  234. package/src/api/fungibleAsset.ts +2 -1
  235. package/src/api/transaction.ts +1 -1
  236. package/src/api/transactionSubmission/build.ts +3 -6
  237. package/src/cli/localNode.ts +1 -1
  238. package/src/core/account/utils/address.ts +18 -0
  239. package/src/core/crypto/ed25519.ts +7 -5
  240. package/src/core/crypto/secp256k1.ts +6 -4
  241. package/src/core/crypto/utils.ts +24 -0
  242. package/src/core/hex.ts +4 -4
  243. package/src/internal/ans.ts +9 -5
  244. package/src/internal/coin.ts +2 -1
  245. package/src/internal/digitalAsset.ts +2 -1
  246. package/src/internal/fungibleAsset.ts +1 -1
  247. package/src/internal/transactionSubmission.ts +2 -2
  248. package/src/transactions/instances/index.ts +1 -0
  249. package/src/transactions/instances/multiAgentTransaction.ts +68 -0
  250. package/src/transactions/instances/simpleTransaction.ts +60 -0
  251. package/src/transactions/management/transactionWorker.ts +2 -1
  252. package/src/transactions/transactionBuilder/transactionBuilder.ts +38 -11
  253. package/src/transactions/types.ts +2 -23
  254. package/src/version.ts +1 -1
  255. package/dist/esm/chunk-3OOOAQJG.mjs +0 -2
  256. package/dist/esm/chunk-3OOOAQJG.mjs.map +0 -1
  257. package/dist/esm/chunk-4P6KFDXF.mjs.map +0 -1
  258. package/dist/esm/chunk-4UMTUJL5.mjs +0 -2
  259. package/dist/esm/chunk-4UMTUJL5.mjs.map +0 -1
  260. package/dist/esm/chunk-AE2K65NN.mjs.map +0 -1
  261. package/dist/esm/chunk-BZMO6Q6L.mjs +0 -2
  262. package/dist/esm/chunk-BZMO6Q6L.mjs.map +0 -1
  263. package/dist/esm/chunk-D2XKVVEN.mjs +0 -2
  264. package/dist/esm/chunk-D2XKVVEN.mjs.map +0 -1
  265. package/dist/esm/chunk-EXX55N2B.mjs +0 -2
  266. package/dist/esm/chunk-EXX55N2B.mjs.map +0 -1
  267. package/dist/esm/chunk-GQTC6QIS.mjs +0 -2
  268. package/dist/esm/chunk-GQTC6QIS.mjs.map +0 -1
  269. package/dist/esm/chunk-HEDMDM2U.mjs.map +0 -1
  270. package/dist/esm/chunk-HTZTTZQJ.mjs +0 -1
  271. package/dist/esm/chunk-IWPVPIKD.mjs +0 -2
  272. package/dist/esm/chunk-LG6SZTWR.mjs +0 -2
  273. package/dist/esm/chunk-LG6SZTWR.mjs.map +0 -1
  274. package/dist/esm/chunk-LNS5RI5S.mjs +0 -2
  275. package/dist/esm/chunk-NDV4GZ5U.mjs.map +0 -1
  276. package/dist/esm/chunk-NHVLEE5G.mjs.map +0 -1
  277. package/dist/esm/chunk-OH5ADEJO.mjs +0 -2
  278. package/dist/esm/chunk-OH6HD5SF.mjs.map +0 -1
  279. package/dist/esm/chunk-TBSPLLCB.mjs +0 -2
  280. package/dist/esm/chunk-TBSPLLCB.mjs.map +0 -1
  281. package/dist/esm/chunk-U5CKFPSM.mjs.map +0 -1
  282. package/dist/esm/chunk-XXKA2GO7.mjs.map +0 -1
  283. /package/dist/esm/{chunk-VNNLHEJ4.mjs.map → chunk-2MRYBOYC.mjs.map} +0 -0
  284. /package/dist/esm/{chunk-TTM66JZ4.mjs.map → chunk-2XVDVF5C.mjs.map} +0 -0
  285. /package/dist/esm/{chunk-3RRZ4MSV.mjs.map → chunk-3GTT6K3X.mjs.map} +0 -0
  286. /package/dist/esm/{chunk-Y3CHPF6X.mjs.map → chunk-4J5V4M3P.mjs.map} +0 -0
  287. /package/dist/esm/{chunk-VKWPCOZA.mjs.map → chunk-4KMISR2H.mjs.map} +0 -0
  288. /package/dist/esm/{chunk-BWG5NCHC.mjs.map → chunk-5LI6PUQN.mjs.map} +0 -0
  289. /package/dist/esm/{chunk-QDD2MDJZ.mjs.map → chunk-5NSXEM3O.mjs.map} +0 -0
  290. /package/dist/esm/{chunk-Q5GNCAA6.mjs.map → chunk-6F7X2C22.mjs.map} +0 -0
  291. /package/dist/esm/{chunk-T43CJS4C.mjs.map → chunk-7JZWCHLH.mjs.map} +0 -0
  292. /package/dist/esm/{chunk-W5PK4QCX.mjs.map → chunk-7PNFDDIG.mjs.map} +0 -0
  293. /package/dist/esm/{chunk-OH5ADEJO.mjs.map → chunk-AFTMLXYT.mjs.map} +0 -0
  294. /package/dist/esm/{chunk-HSITRYZ5.mjs.map → chunk-C67SYOXM.mjs.map} +0 -0
  295. /package/dist/esm/{chunk-HYQSORWM.mjs.map → chunk-CHVWOPVA.mjs.map} +0 -0
  296. /package/dist/esm/{chunk-JKXSSRNT.mjs.map → chunk-CPQPVRKV.mjs.map} +0 -0
  297. /package/dist/esm/{chunk-P434YHBQ.mjs.map → chunk-D5Q7BI3J.mjs.map} +0 -0
  298. /package/dist/esm/{chunk-O5L7WGNH.mjs.map → chunk-EIXGNR6D.mjs.map} +0 -0
  299. /package/dist/esm/{chunk-OWEAY3N3.mjs.map → chunk-EOQOTFO7.mjs.map} +0 -0
  300. /package/dist/esm/{chunk-IWPVPIKD.mjs.map → chunk-F7J7ZW4H.mjs.map} +0 -0
  301. /package/dist/esm/{chunk-2BGOMPDV.mjs.map → chunk-FNKDXPPQ.mjs.map} +0 -0
  302. /package/dist/esm/{chunk-VBSAEAWA.mjs.map → chunk-HOTGXRPG.mjs.map} +0 -0
  303. /package/dist/esm/{chunk-O22J7RER.mjs.map → chunk-HTTPFWYL.mjs.map} +0 -0
  304. /package/dist/esm/{chunk-HTZTTZQJ.mjs.map → chunk-ICXA3DZH.mjs.map} +0 -0
  305. /package/dist/esm/{chunk-2NC32JRF.mjs.map → chunk-IQSAG5Y5.mjs.map} +0 -0
  306. /package/dist/esm/{chunk-JX3IRXNX.mjs.map → chunk-JE7INUQ2.mjs.map} +0 -0
  307. /package/dist/esm/{chunk-27ML4NFD.mjs.map → chunk-JV2PBG6G.mjs.map} +0 -0
  308. /package/dist/esm/{chunk-3EKNELIS.mjs.map → chunk-JV2UOHGR.mjs.map} +0 -0
  309. /package/dist/esm/{chunk-43QJL2AV.mjs.map → chunk-JVBXZ6OJ.mjs.map} +0 -0
  310. /package/dist/esm/{chunk-RWBAKP5G.mjs.map → chunk-KJI5PY5Z.mjs.map} +0 -0
  311. /package/dist/esm/{chunk-Y3R5DLBS.mjs.map → chunk-L6KXN3YD.mjs.map} +0 -0
  312. /package/dist/esm/{chunk-SQW7K56J.mjs.map → chunk-LF6IQT54.mjs.map} +0 -0
  313. /package/dist/esm/{chunk-Y7G5W2QZ.mjs.map → chunk-MS76A6LX.mjs.map} +0 -0
  314. /package/dist/esm/{chunk-JLDOXN33.mjs.map → chunk-MV7RDJFK.mjs.map} +0 -0
  315. /package/dist/esm/{chunk-LD7YBNH5.mjs.map → chunk-NLMMCXLR.mjs.map} +0 -0
  316. /package/dist/esm/{chunk-A5ACWD7S.mjs.map → chunk-NLPPL42P.mjs.map} +0 -0
  317. /package/dist/esm/{chunk-4LQNMXX3.mjs.map → chunk-P2CIREOD.mjs.map} +0 -0
  318. /package/dist/esm/{chunk-H4Q7YQD3.mjs.map → chunk-PE6R6XQV.mjs.map} +0 -0
  319. /package/dist/esm/{chunk-AVQSQJUO.mjs.map → chunk-QMFBU2CG.mjs.map} +0 -0
  320. /package/dist/esm/{chunk-C62XI6VN.mjs.map → chunk-R4ERAOCM.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-2TRSGKMS.mjs.map → chunk-RP66QS6R.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-WHNLDDPT.mjs.map → chunk-S5AGI7RQ.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-GHMYWL3R.mjs.map → chunk-UEI62FBQ.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-AT2HAXSH.mjs.map → chunk-VUZDLGDK.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-XDZF5IUF.mjs.map → chunk-WNVUG2UF.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-CIMZIZY3.mjs.map → chunk-WXXASZQ4.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-EBCIZ4D6.mjs.map → chunk-WZSVQBPA.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-HYOPI6T2.mjs.map → chunk-X3QW43I2.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-VK3H7DMJ.mjs.map → chunk-XMJEWG3I.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-JEQSSMDK.mjs.map → chunk-XQMUVQI3.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-RP4FMC6O.mjs.map → chunk-YJIRT3GJ.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-CJLZV5JK.mjs.map → chunk-YMFCBU4L.mjs.map} +0 -0
package/src/api/ans.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { Account, AccountAddressInput } from "../core";
4
+ import { Account, AccountAddress, AccountAddressInput } from "../core";
5
5
  import {
6
6
  RegisterNameParameters,
7
7
  getExpiration,
@@ -22,9 +22,10 @@ import {
22
22
  getDomainSubdomains,
23
23
  GetDomainSubdomainsArgs,
24
24
  } from "../internal/ans";
25
- import { GetANSNameResponse, MoveAddressType } from "../types";
26
- import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types";
25
+ import { GetANSNameResponse } from "../types";
26
+ import { InputGenerateTransactionOptions } from "../transactions/types";
27
27
  import { AptosConfig } from "./aptosConfig";
28
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
28
29
 
29
30
  /**
30
31
  * A class to handle all `ANS` operations
@@ -43,9 +44,9 @@ export class ANS {
43
44
  *
44
45
  * @param args.name - A string of the name to retrieve
45
46
  *
46
- * @returns MoveAddressType if the name is owned, undefined otherwise
47
+ * @returns AccountAddress if the name is owned, undefined otherwise
47
48
  */
48
- async getOwnerAddress(args: { name: string }): Promise<MoveAddressType | undefined> {
49
+ async getOwnerAddress(args: { name: string }): Promise<AccountAddress | undefined> {
49
50
  return getOwnerAddress({ aptosConfig: this.config, ...args });
50
51
  }
51
52
 
@@ -78,9 +79,9 @@ export class ANS {
78
79
  *
79
80
  * @param args.name - A string of the name: primary, primary.apt, secondary.primary, secondary.primary.apt, etc.
80
81
  *
81
- * @returns MoveAddressType if the name has a target, undefined otherwise
82
+ * @returns AccountAddress if the name has a target, undefined otherwise
82
83
  */
83
- async getTargetAddress(args: { name: string }): Promise<MoveAddressType | undefined> {
84
+ async getTargetAddress(args: { name: string }): Promise<AccountAddress | undefined> {
84
85
  return getTargetAddress({ aptosConfig: this.config, ...args });
85
86
  }
86
87
 
package/src/api/coin.ts CHANGED
@@ -3,7 +3,8 @@
3
3
 
4
4
  import { AccountAddressInput } from "../core";
5
5
  import { transferCoinTransaction } from "../internal/coin";
6
- import { SimpleTransaction, InputGenerateTransactionOptions } from "../transactions/types";
6
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
7
+ import { InputGenerateTransactionOptions } from "../transactions/types";
7
8
  import { AnyNumber, MoveStructId } from "../types";
8
9
  import { AptosConfig } from "./aptosConfig";
9
10
 
@@ -14,7 +14,7 @@ import {
14
14
  TokenStandardArg,
15
15
  } from "../types";
16
16
  import { Account, AccountAddress, AccountAddressInput } from "../core";
17
- import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types";
17
+ import { InputGenerateTransactionOptions } from "../transactions/types";
18
18
  import {
19
19
  addDigitalAssetPropertyTransaction,
20
20
  addDigitalAssetTypedPropertyTransaction,
@@ -45,6 +45,7 @@ import {
45
45
  import { ProcessorType } from "../utils/const";
46
46
  import { AptosConfig } from "./aptosConfig";
47
47
  import { waitForIndexerOnVersion } from "./utils";
48
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
48
49
 
49
50
  /**
50
51
  * A class to query all `DigitalAsset` related queries on Aptos.
@@ -24,7 +24,8 @@ import { ProcessorType } from "../utils/const";
24
24
  import { AptosConfig } from "./aptosConfig";
25
25
  import { waitForIndexerOnVersion } from "./utils";
26
26
  import { Account, AccountAddress } from "../core";
27
- import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions";
27
+ import { InputGenerateTransactionOptions } from "../transactions";
28
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
28
29
 
29
30
  /**
30
31
  * A class to query all `FungibleAsset` related queries on Aptos.
@@ -32,13 +32,13 @@ import {
32
32
  AnyRawTransaction,
33
33
  InputGenerateTransactionOptions,
34
34
  InputGenerateTransactionPayloadData,
35
- SimpleTransaction,
36
35
  } from "../transactions";
37
36
  import { AccountAddressInput, Account, PrivateKey } from "../core";
38
37
  import { Build } from "./transactionSubmission/build";
39
38
  import { Simulate } from "./transactionSubmission/simulate";
40
39
  import { Submit } from "./transactionSubmission/submit";
41
40
  import { TransactionManagement } from "./transactionSubmission/management";
41
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
42
42
 
43
43
  export class Transaction {
44
44
  readonly config: AptosConfig;
@@ -3,12 +3,9 @@
3
3
 
4
4
  import { AccountAddressInput } from "../../core";
5
5
  import { generateTransaction } from "../../internal/transactionSubmission";
6
- import {
7
- InputGenerateTransactionPayloadData,
8
- InputGenerateTransactionOptions,
9
- SimpleTransaction,
10
- MultiAgentTransaction,
11
- } from "../../transactions";
6
+ import { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from "../../transactions";
7
+ import { MultiAgentTransaction } from "../../transactions/instances/multiAgentTransaction";
8
+ import { SimpleTransaction } from "../../transactions/instances/simpleTransaction";
12
9
  import { AptosConfig } from "../aptosConfig";
13
10
 
14
11
  /**
@@ -3,7 +3,7 @@ import kill from "tree-kill";
3
3
  import { sleep } from "../utils/helpers";
4
4
 
5
5
  export class LocalNode {
6
- readonly MAXIMUM_WAIT_TIME_SEC = 30;
6
+ readonly MAXIMUM_WAIT_TIME_SEC = 75;
7
7
 
8
8
  readonly READINESS_ENDPOINT = "http://127.0.0.1:8070/";
9
9
 
@@ -20,6 +20,24 @@ export const createObjectAddress = (creatorAddress: AccountAddress, seed: Uint8A
20
20
  return new AccountAddress(sha3_256(bytes));
21
21
  };
22
22
 
23
+ /**
24
+ * Creates an resource address from creator address and seed
25
+ *
26
+ * @param creatorAddress The creator account address
27
+ * @param seed The seed in either Uint8Array | string type
28
+ *
29
+ * @returns The resource account address
30
+ */
31
+ export const createResourceAddress = (creatorAddress: AccountAddress, seed: Uint8Array | string): AccountAddress => {
32
+ const creatorBytes = creatorAddress.bcsToBytes();
33
+
34
+ const seedBytes = typeof seed === "string" ? Buffer.from(seed, "utf8") : seed;
35
+
36
+ const bytes = new Uint8Array([...creatorBytes, ...seedBytes, DeriveScheme.DeriveResourceAccountAddress]);
37
+
38
+ return new AccountAddress(sha3_256(bytes));
39
+ };
40
+
23
41
  /**
24
42
  * Creates a token object address from creator address, collection name and token name
25
43
  *
@@ -11,6 +11,7 @@ import { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSee
11
11
  import { PrivateKey } from "./privateKey";
12
12
  import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
13
13
  import { Signature } from "./signature";
14
+ import { convertSigningMessage } from "./utils";
14
15
 
15
16
  /**
16
17
  * Represents the public key of an Ed25519 key pair.
@@ -52,7 +53,7 @@ export class Ed25519PublicKey extends AccountPublicKey {
52
53
 
53
54
  /**
54
55
  * Verifies a signed data with a public key
55
- * @param args.message a signed message
56
+ * @param args.message a signed message as a Hex string or Uint8Array
56
57
  * @param args.signature the signature of the message
57
58
  */
58
59
  verifySignature(args: VerifySignatureArgs): boolean {
@@ -60,8 +61,8 @@ export class Ed25519PublicKey extends AccountPublicKey {
60
61
  if (!(signature instanceof Ed25519Signature)) {
61
62
  return false;
62
63
  }
63
-
64
- const messageBytes = Hex.fromHexInput(message).toUint8Array();
64
+ const messageToVerify = convertSigningMessage(message);
65
+ const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();
65
66
  const signatureBytes = signature.toUint8Array();
66
67
  const publicKeyBytes = this.key.toUint8Array();
67
68
  return nacl.sign.detached.verify(messageBytes, signatureBytes, publicKeyBytes);
@@ -213,11 +214,12 @@ export class Ed25519PrivateKey extends Serializable implements PrivateKey {
213
214
  /**
214
215
  * Sign the given message with the private key.
215
216
  *
216
- * @param message in HexInput format
217
+ * @param message a message as a string or Uint8Array
217
218
  * @returns Signature
218
219
  */
219
220
  sign(message: HexInput): Ed25519Signature {
220
- const messageBytes = Hex.fromHexInput(message).toUint8Array();
221
+ const messageToSign = convertSigningMessage(message);
222
+ const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();
221
223
  const signatureBytes = nacl.sign.detached(messageBytes, this.signingKeyPair.secretKey);
222
224
  return new Ed25519Signature(signatureBytes);
223
225
  }
@@ -11,6 +11,7 @@ import { isValidBIP44Path, mnemonicToSeed } from "./hdKey";
11
11
  import { PrivateKey } from "./privateKey";
12
12
  import { PublicKey, VerifySignatureArgs } from "./publicKey";
13
13
  import { Signature } from "./signature";
14
+ import { convertSigningMessage } from "./utils";
14
15
 
15
16
  /**
16
17
  * Represents the Secp256k1 ecdsa public key
@@ -46,8 +47,8 @@ export class Secp256k1PublicKey extends PublicKey {
46
47
  if (!(signature instanceof Secp256k1Signature)) {
47
48
  return false;
48
49
  }
49
-
50
- const messageBytes = Hex.fromHexInput(message).toUint8Array();
50
+ const messageToVerify = convertSigningMessage(message);
51
+ const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();
51
52
  const messageSha3Bytes = sha3_256(messageBytes);
52
53
  const signatureBytes = signature.toUint8Array();
53
54
  return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array());
@@ -165,11 +166,12 @@ export class Secp256k1PrivateKey extends Serializable implements PrivateKey {
165
166
  /**
166
167
  * Sign the given message with the private key.
167
168
  *
168
- * @param message in HexInput format
169
+ * @param message a message as a string or Uint8Array
169
170
  * @returns Signature
170
171
  */
171
172
  sign(message: HexInput): Secp256k1Signature {
172
- const messageBytes = Hex.fromHexInput(message);
173
+ const messageToSign = convertSigningMessage(message);
174
+ const messageBytes = Hex.fromHexInput(messageToSign);
173
175
  const messageHashBytes = sha3_256(messageBytes.toUint8Array());
174
176
  const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array());
175
177
  return new Secp256k1Signature(signature.toCompactRawBytes());
@@ -0,0 +1,24 @@
1
+ import { HexInput } from "../../types";
2
+ import { Hex } from "../hex";
3
+
4
+ /**
5
+ * Helper function to convert a message to sign or to verify to a valid message input
6
+ *
7
+ * @param message a message as a string or Uint8Array
8
+ *
9
+ * @returns a valid HexInput - string or Uint8Array
10
+ */
11
+ export const convertSigningMessage = (message: HexInput): HexInput => {
12
+ // if message is of type string, verify it is a valid Hex string
13
+ if (typeof message === "string") {
14
+ const isValid = Hex.isValid(message);
15
+ // If message is not a valid Hex string, convert it into a Buffer
16
+ if (!isValid.valid) {
17
+ return Buffer.from(message, "utf8");
18
+ }
19
+ // If message is a valid Hex string, return it
20
+ return message;
21
+ }
22
+ // message is a Uint8Array
23
+ return message;
24
+ };
package/src/core/hex.ts CHANGED
@@ -37,7 +37,7 @@ export enum HexInvalidReason {
37
37
  * with a leading 0x prefix, regardless of what the input format was.
38
38
  *
39
39
  * These are some other ways to chain the functions together:
40
- * - `Hex.fromString({ hexInput: "0x1f" }).toUint8Array()`
40
+ * - `Hex.fromHexString({ hexInput: "0x1f" }).toUint8Array()`
41
41
  * - `new Hex([1, 3]).toStringWithoutPrefix()`
42
42
  */
43
43
  export class Hex {
@@ -95,7 +95,7 @@ export class Hex {
95
95
  *
96
96
  * @returns Hex
97
97
  */
98
- static fromString(str: string): Hex {
98
+ static fromHexString(str: string): Hex {
99
99
  let input = str;
100
100
 
101
101
  if (input.startsWith("0x")) {
@@ -132,7 +132,7 @@ export class Hex {
132
132
  */
133
133
  static fromHexInput(hexInput: HexInput): Hex {
134
134
  if (hexInput instanceof Uint8Array) return new Hex(hexInput);
135
- return Hex.fromString(hexInput);
135
+ return Hex.fromHexString(hexInput);
136
136
  }
137
137
 
138
138
  // ===
@@ -150,7 +150,7 @@ export class Hex {
150
150
  */
151
151
  static isValid(str: string): ParsingResult<HexInvalidReason> {
152
152
  try {
153
- Hex.fromString(str);
153
+ Hex.fromHexString(str);
154
154
  return { valid: true };
155
155
  } catch (error: any) {
156
156
  return {
@@ -10,7 +10,7 @@
10
10
 
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { Account, AccountAddress, AccountAddressInput } from "../core";
13
- import { InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types";
13
+ import { InputGenerateTransactionOptions } from "../transactions/types";
14
14
  import { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from "../types";
15
15
  import { GetNamesQuery } from "../types/generated/operations";
16
16
  import { GetNames } from "../types/generated/queries";
@@ -19,6 +19,7 @@ import { Network } from "../utils/apiEndpoints";
19
19
  import { queryIndexer } from "./general";
20
20
  import { view } from "./view";
21
21
  import { generateTransaction } from "./transactionSubmission";
22
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
22
23
 
23
24
  export const VALIDATION_RULES_DESCRIPTION = [
24
25
  "A name must be between 3 and 63 characters long,",
@@ -94,7 +95,10 @@ const unwrapOption = <T>(option: any): T | undefined => {
94
95
  return undefined;
95
96
  };
96
97
 
97
- export async function getOwnerAddress(args: { aptosConfig: AptosConfig; name: string }): Promise<string | undefined> {
98
+ export async function getOwnerAddress(args: {
99
+ aptosConfig: AptosConfig;
100
+ name: string;
101
+ }): Promise<AccountAddress | undefined> {
98
102
  const { aptosConfig, name } = args;
99
103
  const routerAddress = getRouterAddress(aptosConfig);
100
104
  const { domainName, subdomainName } = isValidANSName(name);
@@ -109,7 +113,7 @@ export async function getOwnerAddress(args: { aptosConfig: AptosConfig; name: st
109
113
 
110
114
  const owner = unwrapOption<MoveAddressType>(res[0]);
111
115
 
112
- return owner ? AccountAddress.from(owner).toString() : undefined;
116
+ return owner ? AccountAddress.from(owner) : undefined;
113
117
  }
114
118
 
115
119
  export interface RegisterNameParameters {
@@ -289,7 +293,7 @@ export async function setPrimaryName(args: {
289
293
  export async function getTargetAddress(args: {
290
294
  aptosConfig: AptosConfig;
291
295
  name: string;
292
- }): Promise<MoveAddressType | undefined> {
296
+ }): Promise<AccountAddress | undefined> {
293
297
  const { aptosConfig, name } = args;
294
298
  const routerAddress = getRouterAddress(aptosConfig);
295
299
  const { domainName, subdomainName } = isValidANSName(name);
@@ -303,7 +307,7 @@ export async function getTargetAddress(args: {
303
307
  });
304
308
 
305
309
  const target = unwrapOption<MoveAddressType>(res[0]);
306
- return target ? AccountAddress.from(target).toString() : undefined;
310
+ return target ? AccountAddress.from(target) : undefined;
307
311
  }
308
312
 
309
313
  export async function setTargetAddress(args: {
@@ -1,10 +1,11 @@
1
1
  import { AptosConfig } from "../api/aptosConfig";
2
2
  import { AccountAddressInput } from "../core";
3
- import { EntryFunctionABI, InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types";
3
+ import { EntryFunctionABI, InputGenerateTransactionOptions } from "../transactions/types";
4
4
  import { AnyNumber, MoveStructId } from "../types";
5
5
  import { APTOS_COIN } from "../utils/const";
6
6
  import { generateTransaction } from "./transactionSubmission";
7
7
  import { TypeTagAddress, TypeTagU64 } from "../transactions";
8
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
8
9
 
9
10
  const coinTransferAbi: EntryFunctionABI = {
10
11
  typeParameters: [{ constraints: [] }],
@@ -11,7 +11,7 @@
11
11
  import { AptosConfig } from "../api/aptosConfig";
12
12
  import { Bool, MoveString, MoveVector, U64 } from "../bcs";
13
13
  import { Account, AccountAddress, AccountAddressInput } from "../core";
14
- import { EntryFunctionABI, InputGenerateTransactionOptions, SimpleTransaction } from "../transactions/types";
14
+ import { EntryFunctionABI, InputGenerateTransactionOptions } from "../transactions/types";
15
15
  import {
16
16
  AnyNumber,
17
17
  GetCollectionDataResponse,
@@ -53,6 +53,7 @@ import {
53
53
  TypeTagU64,
54
54
  TypeTagVector,
55
55
  } from "../transactions";
56
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
56
57
 
57
58
  // A property type map for the user input and what Move expects
58
59
  const PropertyTypeMap = {
@@ -38,11 +38,11 @@ import {
38
38
  EntryFunctionABI,
39
39
  InputGenerateTransactionOptions,
40
40
  parseTypeTag,
41
- SimpleTransaction,
42
41
  TypeTagAddress,
43
42
  TypeTagU64,
44
43
  } from "../transactions";
45
44
  import { generateTransaction } from "./transactionSubmission";
45
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
46
46
 
47
47
  export async function getFungibleAssetMetadata(args: {
48
48
  aptosConfig: AptosConfig;
@@ -26,18 +26,18 @@ import {
26
26
  AnyRawTransaction,
27
27
  InputSimulateTransactionData,
28
28
  InputGenerateTransactionOptions,
29
- SimpleTransaction,
30
29
  InputGenerateTransactionPayloadDataWithRemoteABI,
31
30
  InputSubmitTransactionData,
32
31
  InputGenerateMultiAgentRawTransactionData,
33
32
  InputGenerateSingleSignerRawTransactionData,
34
- MultiAgentTransaction,
35
33
  AnyTransactionPayloadInstance,
36
34
  EntryFunctionABI,
37
35
  } from "../transactions/types";
38
36
  import { getInfo } from "./account";
39
37
  import { UserTransactionResponse, PendingTransactionResponse, MimeType, HexInput, TransactionResponse } from "../types";
40
38
  import { TypeTagU8, TypeTagVector } from "../transactions";
39
+ import { SimpleTransaction } from "../transactions/instances/simpleTransaction";
40
+ import { MultiAgentTransaction } from "../transactions/instances/multiAgentTransaction";
41
41
 
42
42
  /**
43
43
  * We are defining function signatures, each with its specific input and output.
@@ -9,3 +9,4 @@ export * from "./rotationProofChallenge";
9
9
  export * from "./signedTransaction";
10
10
  export * from "./transactionArgument";
11
11
  export * from "./transactionPayload";
12
+ export * from "./simpleTransaction";
@@ -0,0 +1,68 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /* eslint-disable @typescript-eslint/naming-convention */
5
+
6
+ import { Deserializer } from "../../bcs/deserializer";
7
+ import { Serializable, Serializer } from "../../bcs/serializer";
8
+ import { AccountAddress } from "../../core";
9
+ import { RawTransaction } from "./rawTransaction";
10
+
11
+ /**
12
+ * Representation of a Raw Transaction that can serialized and deserialized
13
+ */
14
+ export class MultiAgentTransaction extends Serializable {
15
+ public rawTransaction: RawTransaction;
16
+
17
+ public feePayerAddress?: AccountAddress | undefined;
18
+
19
+ public secondarySignerAddresses: AccountAddress[];
20
+
21
+ /**
22
+ * SimpleTransaction represents a simple transaction type of a single signer that
23
+ * can be submitted to Aptos chain for execution.
24
+ *
25
+ * SimpleTransaction metadata contains the Raw Transaction and an optional
26
+ * sponsor Account Address to pay the gas fees.
27
+ *
28
+ * @param rawTransaction The Raw Tranasaction
29
+ * @param feePayerAddress The sponsor Account Address
30
+ */
31
+ constructor(
32
+ rawTransaction: RawTransaction,
33
+ secondarySignerAddresses: AccountAddress[],
34
+ feePayerAddress?: AccountAddress,
35
+ ) {
36
+ super();
37
+ this.rawTransaction = rawTransaction;
38
+ this.feePayerAddress = feePayerAddress;
39
+ this.secondarySignerAddresses = secondarySignerAddresses;
40
+ }
41
+
42
+ serialize(serializer: Serializer): void {
43
+ this.rawTransaction.serialize(serializer);
44
+
45
+ serializer.serializeVector<AccountAddress>(this.secondarySignerAddresses);
46
+
47
+ if (this.feePayerAddress === undefined) {
48
+ serializer.serializeBool(false);
49
+ } else {
50
+ serializer.serializeBool(true);
51
+ this.feePayerAddress.serialize(serializer);
52
+ }
53
+ }
54
+
55
+ static deserialize(deserializer: Deserializer): MultiAgentTransaction {
56
+ const rawTransaction = RawTransaction.deserialize(deserializer);
57
+
58
+ const secondarySignerAddresses = deserializer.deserializeVector(AccountAddress);
59
+
60
+ const feepayerPresent = deserializer.deserializeBool();
61
+ let feePayerAddress;
62
+ if (feepayerPresent) {
63
+ feePayerAddress = AccountAddress.deserialize(deserializer);
64
+ }
65
+
66
+ return new MultiAgentTransaction(rawTransaction, secondarySignerAddresses, feePayerAddress);
67
+ }
68
+ }
@@ -0,0 +1,60 @@
1
+ // Copyright © Aptos Foundation
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ /* eslint-disable @typescript-eslint/naming-convention */
5
+
6
+ import { Deserializer } from "../../bcs/deserializer";
7
+ import { Serializable, Serializer } from "../../bcs/serializer";
8
+ import { AccountAddress } from "../../core";
9
+ import { RawTransaction } from "./rawTransaction";
10
+
11
+ /**
12
+ * Representation of a SimpleTransaction that can serialized and deserialized
13
+ */
14
+ export class SimpleTransaction extends Serializable {
15
+ public rawTransaction: RawTransaction;
16
+
17
+ public feePayerAddress?: AccountAddress | undefined;
18
+
19
+ // We dont really need it, we add it for type checkings we do
20
+ // throughout the SDK
21
+ public readonly secondarySignerAddresses: undefined;
22
+
23
+ /**
24
+ * SimpleTransaction represents a simple transaction type of a single signer that
25
+ * can be submitted to Aptos chain for execution.
26
+ *
27
+ * SimpleTransaction metadata contains the Raw Transaction and an optional
28
+ * sponsor Account Address to pay the gas fees.
29
+ *
30
+ * @param rawTransaction The Raw Tranasaction
31
+ * @param feePayerAddress The sponsor Account Address
32
+ */
33
+ constructor(rawTransaction: RawTransaction, feePayerAddress?: AccountAddress) {
34
+ super();
35
+ this.rawTransaction = rawTransaction;
36
+ this.feePayerAddress = feePayerAddress;
37
+ }
38
+
39
+ serialize(serializer: Serializer): void {
40
+ this.rawTransaction.serialize(serializer);
41
+
42
+ if (this.feePayerAddress === undefined) {
43
+ serializer.serializeBool(false);
44
+ } else {
45
+ serializer.serializeBool(true);
46
+ this.feePayerAddress.serialize(serializer);
47
+ }
48
+ }
49
+
50
+ static deserialize(deserializer: Deserializer): SimpleTransaction {
51
+ const rawTransaction = RawTransaction.deserialize(deserializer);
52
+ const feepayerPresent = deserializer.deserializeBool();
53
+ let feePayerAddress;
54
+ if (feepayerPresent) {
55
+ feePayerAddress = AccountAddress.deserialize(deserializer);
56
+ }
57
+
58
+ return new SimpleTransaction(rawTransaction, feePayerAddress);
59
+ }
60
+ }
@@ -6,9 +6,10 @@ import { Account } from "../../core";
6
6
  import { waitForTransaction } from "../../internal/transaction";
7
7
  import { generateTransaction, signAndSubmitTransaction } from "../../internal/transactionSubmission";
8
8
  import { PendingTransactionResponse, TransactionResponse } from "../../types";
9
- import { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData, SimpleTransaction } from "../types";
9
+ import { InputGenerateTransactionOptions, InputGenerateTransactionPayloadData } from "../types";
10
10
  import { AccountSequenceNumber } from "./accountSequenceNumber";
11
11
  import { AsyncQueue, AsyncQueueCancelledError } from "./asyncQueue";
12
+ import { SimpleTransaction } from "../instances/simpleTransaction";
12
13
 
13
14
  export const promiseFulfilledStatus = "fulfilled";
14
15
 
@@ -57,9 +57,7 @@ import {
57
57
  InputGenerateMultiAgentRawTransactionArgs,
58
58
  InputGenerateRawTransactionArgs,
59
59
  InputGenerateSingleSignerRawTransactionArgs,
60
- SimpleTransaction,
61
60
  InputGenerateTransactionOptions,
62
- MultiAgentTransaction,
63
61
  InputScriptData,
64
62
  InputSimulateTransactionData,
65
63
  InputMultiSigDataWithRemoteABI,
@@ -77,6 +75,8 @@ import { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardi
77
75
  import { memoizeAsync } from "../../utils/memoize";
78
76
  import { AnyNumber } from "../../types";
79
77
  import { getFunctionParts, isScriptDataInput } from "./helpers";
78
+ import { SimpleTransaction } from "../instances/simpleTransaction";
79
+ import { MultiAgentTransaction } from "../instances/multiAgentTransaction";
80
80
 
81
81
  /**
82
82
  * We are defining function signatures, each with its specific input and output.
@@ -347,17 +347,14 @@ export async function buildTransaction(args: InputGenerateRawTransactionArgs): P
347
347
  const signers: Array<AccountAddress> =
348
348
  args.secondarySignerAddresses?.map((signer) => AccountAddress.from(signer)) ?? [];
349
349
 
350
- return {
351
- rawTransaction: rawTxn,
352
- secondarySignerAddresses: signers,
353
- feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,
354
- };
350
+ return new MultiAgentTransaction(
351
+ rawTxn,
352
+ signers,
353
+ args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,
354
+ );
355
355
  }
356
356
  // return the raw transaction
357
- return {
358
- rawTransaction: rawTxn,
359
- feePayerAddress: args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined,
360
- };
357
+ return new SimpleTransaction(rawTxn, args.feePayerAddress ? AccountAddress.from(args.feePayerAddress) : undefined);
361
358
  }
362
359
 
363
360
  /**
@@ -527,6 +524,36 @@ export function generateSignedTransaction(args: InputSubmitTransactionData): Uin
527
524
  );
528
525
  }
529
526
 
527
+ /**
528
+ * Hashes the set of values with a SHA-3 256 hash
529
+ * @param input array of UTF-8 strings or Uint8array byte arrays
530
+ */
531
+ export function hashValues(input: (Uint8Array | string)[]): Uint8Array {
532
+ const hash = sha3Hash.create();
533
+ for (const item of input) {
534
+ hash.update(item);
535
+ }
536
+ return hash.digest();
537
+ }
538
+
539
+ /**
540
+ * The domain separated prefix for hashing transacitons
541
+ */
542
+ const TRANSACTION_PREFIX = hashValues(["APTOS::Transaction"]);
543
+
544
+ /**
545
+ * Generates a user transaction hash for the given transaction payload. It must already have an authenticator
546
+ * @param args InputSubmitTransactionData
547
+ */
548
+ export function generateUserTransactionHash(args: InputSubmitTransactionData): string {
549
+ const signedTransaction = generateSignedTransaction(args);
550
+
551
+ // Transaction signature is defined as, the domain separated prefix based on struct (Transaction)
552
+ // Then followed by the type of the transaction for the enum, UserTransaction is 0
553
+ // Then followed by BCS encoded bytes of the signed transaction
554
+ return new Hex(hashValues([TRANSACTION_PREFIX, new Uint8Array([0]), signedTransaction])).toString();
555
+ }
556
+
530
557
  /**
531
558
  * Derive the raw transaction type - FeePayerRawTransaction or MultiAgentRawTransaction or RawTransaction
532
559
  *