@aptos-labs/ts-sdk 1.33.0-sc.0 → 1.33.0-zeta.1

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 (385) hide show
  1. package/dist/common/{accountAddress-fJZJVSBc.d.ts → accountAddress-BHsGaOsa.d.ts} +14 -1
  2. package/dist/common/chunk-F43XVDYJ.js.map +1 -1
  3. package/dist/common/cli/index.d.ts +1 -1
  4. package/dist/common/cli/index.js.map +1 -1
  5. package/dist/common/index.d.ts +4 -105
  6. package/dist/common/index.js +31 -31
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/account/AbstractKeylessAccount.d.mts +0 -1
  9. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  10. package/dist/esm/account/Account.d.mts +0 -1
  11. package/dist/esm/account/Account.mjs +1 -1
  12. package/dist/esm/account/Ed25519Account.d.mts +0 -1
  13. package/dist/esm/account/Ed25519Account.mjs +1 -1
  14. package/dist/esm/account/EphemeralKeyPair.d.mts +0 -1
  15. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  16. package/dist/esm/account/FederatedKeylessAccount.d.mts +0 -1
  17. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  18. package/dist/esm/account/KeylessAccount.d.mts +0 -1
  19. package/dist/esm/account/KeylessAccount.mjs +1 -1
  20. package/dist/esm/account/MultiKeyAccount.d.mts +0 -1
  21. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  22. package/dist/esm/account/SingleKeyAccount.d.mts +0 -1
  23. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  24. package/dist/esm/account/index.d.mts +0 -1
  25. package/dist/esm/account/index.mjs +1 -1
  26. package/dist/esm/api/account.d.mts +0 -1
  27. package/dist/esm/api/account.mjs +1 -1
  28. package/dist/esm/api/ans.d.mts +0 -1
  29. package/dist/esm/api/ans.mjs +1 -1
  30. package/dist/esm/api/aptos.d.mts +0 -2
  31. package/dist/esm/api/aptos.mjs +1 -1
  32. package/dist/esm/api/aptosConfig.d.mts +0 -1
  33. package/dist/esm/api/coin.d.mts +2 -3
  34. package/dist/esm/api/coin.mjs +1 -1
  35. package/dist/esm/api/digitalAsset.d.mts +0 -1
  36. package/dist/esm/api/digitalAsset.mjs +1 -1
  37. package/dist/esm/api/event.d.mts +0 -1
  38. package/dist/esm/api/event.mjs +1 -1
  39. package/dist/esm/api/faucet.d.mts +0 -1
  40. package/dist/esm/api/faucet.mjs +1 -1
  41. package/dist/esm/api/fungibleAsset.d.mts +0 -1
  42. package/dist/esm/api/fungibleAsset.mjs +1 -1
  43. package/dist/esm/api/general.d.mts +0 -1
  44. package/dist/esm/api/general.mjs +1 -1
  45. package/dist/esm/api/index.d.mts +0 -2
  46. package/dist/esm/api/index.mjs +1 -1
  47. package/dist/esm/api/keyless.d.mts +1 -2
  48. package/dist/esm/api/keyless.mjs +1 -1
  49. package/dist/esm/api/object.d.mts +0 -1
  50. package/dist/esm/api/object.mjs +1 -1
  51. package/dist/esm/api/staking.d.mts +0 -1
  52. package/dist/esm/api/staking.mjs +1 -1
  53. package/dist/esm/api/table.d.mts +0 -1
  54. package/dist/esm/api/table.mjs +1 -1
  55. package/dist/esm/api/transaction.d.mts +0 -2
  56. package/dist/esm/api/transaction.mjs +1 -1
  57. package/dist/esm/api/transactionSubmission/build.d.mts +0 -66
  58. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  59. package/dist/esm/api/transactionSubmission/management.d.mts +0 -1
  60. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/sign.d.mts +0 -1
  62. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  64. package/dist/esm/api/transactionSubmission/simulate.d.mts +0 -1
  65. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  66. package/dist/esm/api/transactionSubmission/submit.d.mts +0 -1
  67. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  68. package/dist/esm/api/utils.d.mts +0 -1
  69. package/dist/esm/api/utils.mjs +1 -1
  70. package/dist/esm/bcs/consts.d.mts +0 -1
  71. package/dist/esm/bcs/deserializer.d.mts +14 -2
  72. package/dist/esm/bcs/deserializer.mjs +1 -1
  73. package/dist/esm/bcs/index.d.mts +0 -1
  74. package/dist/esm/bcs/index.mjs +1 -1
  75. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +0 -1
  76. package/dist/esm/bcs/serializable/fixedBytes.d.mts +0 -1
  77. package/dist/esm/bcs/serializable/movePrimitives.d.mts +0 -1
  78. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  79. package/dist/esm/bcs/serializable/moveStructs.d.mts +0 -1
  80. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  81. package/dist/esm/bcs/serializer.d.mts +0 -1
  82. package/dist/esm/{chunk-5O3RHPER.mjs → chunk-25DLTVYQ.mjs} +2 -2
  83. package/dist/esm/{chunk-L2SDI7PI.mjs → chunk-2POONZMB.mjs} +2 -2
  84. package/dist/esm/{chunk-O4MRRWRI.mjs → chunk-2T3UISSK.mjs} +2 -2
  85. package/dist/esm/{chunk-MWWYVW65.mjs → chunk-46E4LEHN.mjs} +2 -2
  86. package/dist/esm/{chunk-PKWX45UR.mjs → chunk-4B3VHMHM.mjs} +2 -2
  87. package/dist/esm/{chunk-YFIXGTWP.mjs → chunk-4ULPBQ3M.mjs} +2 -2
  88. package/dist/esm/{chunk-THRFTTUG.mjs → chunk-4ZNSNWQL.mjs} +2 -2
  89. package/dist/esm/{chunk-HMDLBOCN.mjs → chunk-5XLZACVT.mjs} +2 -2
  90. package/dist/esm/{chunk-NQW2T6H6.mjs → chunk-5ZBV2SRL.mjs} +2 -2
  91. package/dist/esm/{chunk-2E3EAJPC.mjs → chunk-64IZ5PQR.mjs} +2 -2
  92. package/dist/esm/{chunk-VUZFKJBB.mjs → chunk-6A552D3E.mjs} +2 -2
  93. package/dist/esm/{chunk-5BZEH4H5.mjs → chunk-6GFBPLVZ.mjs} +2 -2
  94. package/dist/esm/{chunk-YSBSCW5S.mjs → chunk-6HBGNVXC.mjs} +2 -2
  95. package/dist/esm/{chunk-A3USS2NC.mjs → chunk-7TCZ6LW2.mjs} +2 -2
  96. package/dist/esm/{chunk-CW6P2DDJ.mjs → chunk-ALOYOMRE.mjs} +2 -2
  97. package/dist/esm/{chunk-T6QKKUEK.mjs → chunk-AQJVP77Y.mjs} +2 -2
  98. package/dist/esm/chunk-BUAHUVAD.mjs +2 -0
  99. package/dist/esm/chunk-BUAHUVAD.mjs.map +1 -0
  100. package/dist/esm/chunk-CDEYH77E.mjs +2 -0
  101. package/dist/esm/{chunk-SBQJ3A7H.mjs → chunk-DBTUGRRG.mjs} +2 -2
  102. package/dist/esm/chunk-DDJIA4B2.mjs +2 -0
  103. package/dist/esm/chunk-DDJIA4B2.mjs.map +1 -0
  104. package/dist/esm/{chunk-HPYBNJ7J.mjs → chunk-EHC7KQMS.mjs} +2 -2
  105. package/dist/esm/{chunk-2E3BT4YW.mjs → chunk-ESMLYVYO.mjs} +2 -2
  106. package/dist/esm/{chunk-3NPN2MSI.mjs → chunk-FA6EF6SC.mjs} +2 -2
  107. package/dist/esm/chunk-FD6FGKYY.mjs +1 -0
  108. package/dist/esm/{chunk-QQM47PHZ.mjs → chunk-FRWZCXDG.mjs} +2 -2
  109. package/dist/esm/{chunk-QCUXDDCU.mjs → chunk-GM547BBN.mjs} +2 -2
  110. package/dist/esm/{chunk-BMAIA7QJ.mjs → chunk-H53YQWYM.mjs} +2 -2
  111. package/dist/esm/{chunk-JEKZN7SO.mjs → chunk-HKVZ7CAG.mjs} +2 -2
  112. package/dist/esm/chunk-I5OYNCZS.mjs +1 -0
  113. package/dist/esm/{chunk-IT42PQ4G.mjs → chunk-I7A6PMOO.mjs} +2 -2
  114. package/dist/esm/{chunk-XWUMN7TI.mjs → chunk-IHQ63OVD.mjs} +2 -2
  115. package/dist/esm/{chunk-4GNR3AQF.mjs → chunk-J3E2M7S3.mjs} +2 -2
  116. package/dist/esm/chunk-J3E4UMBB.mjs +2 -0
  117. package/dist/esm/chunk-J3E4UMBB.mjs.map +1 -0
  118. package/dist/esm/{chunk-3R3XGOPC.mjs → chunk-JRODZWJE.mjs} +2 -2
  119. package/dist/esm/{chunk-D54FD6XE.mjs → chunk-JYEJEI2U.mjs} +2 -2
  120. package/dist/esm/{chunk-6NEN65HA.mjs → chunk-JZIVVVJB.mjs} +2 -2
  121. package/dist/esm/{chunk-4IQZOAN7.mjs → chunk-KMA3V3MT.mjs} +2 -2
  122. package/dist/esm/{chunk-A6AAR5TS.mjs → chunk-LNZ7FQOP.mjs} +2 -2
  123. package/dist/esm/{chunk-DULHBLPY.mjs → chunk-LUHB2LBO.mjs} +2 -2
  124. package/dist/esm/{chunk-L365GPP2.mjs → chunk-LZLNRFRG.mjs} +2 -2
  125. package/dist/esm/{chunk-YZFMBFJN.mjs → chunk-NNFCHV2S.mjs} +2 -2
  126. package/dist/esm/{chunk-QAYDBQJZ.mjs → chunk-P7S53273.mjs} +2 -2
  127. package/dist/esm/{chunk-UTOO6IVJ.mjs → chunk-QK32EQSF.mjs} +2 -2
  128. package/dist/esm/{chunk-2VDQXUT4.mjs → chunk-RLSGD2HN.mjs} +2 -2
  129. package/dist/esm/{chunk-6H5QNZRH.mjs → chunk-RRBK4GSD.mjs} +2 -2
  130. package/dist/esm/chunk-RRY6KIZL.mjs +2 -0
  131. package/dist/esm/chunk-RRY6KIZL.mjs.map +1 -0
  132. package/dist/esm/{chunk-OCE3XXUA.mjs → chunk-RSBUPLET.mjs} +2 -2
  133. package/dist/esm/{chunk-BFBRLEQM.mjs → chunk-RV7PNWDY.mjs} +2 -2
  134. package/dist/esm/{chunk-632VRZYX.mjs → chunk-SFGDP62T.mjs} +2 -2
  135. package/dist/esm/{chunk-UKXLESMW.mjs → chunk-T6IEHMCZ.mjs} +2 -2
  136. package/dist/esm/chunk-TQS2LUZ4.mjs +2 -0
  137. package/dist/esm/chunk-TQS2LUZ4.mjs.map +1 -0
  138. package/dist/esm/{chunk-7M3NKATD.mjs → chunk-U7UTBXJD.mjs} +2 -2
  139. package/dist/esm/{chunk-RKMIDNYX.mjs → chunk-UEEB4ZOS.mjs} +2 -2
  140. package/dist/esm/{chunk-TXD342Q6.mjs → chunk-UYMNYTLM.mjs} +2 -2
  141. package/dist/esm/{chunk-TQA6HY6A.mjs → chunk-V5QOG3IB.mjs} +2 -2
  142. package/dist/esm/{chunk-UZGSDK63.mjs → chunk-V7GSH3L3.mjs} +2 -2
  143. package/dist/esm/{chunk-WF3HSWHT.mjs → chunk-VAKNMHOA.mjs} +2 -2
  144. package/dist/esm/{chunk-6YJW6OC5.mjs → chunk-WXVF7N56.mjs} +2 -2
  145. package/dist/esm/{chunk-B77HJ77O.mjs → chunk-X2U7SKK7.mjs} +2 -2
  146. package/dist/esm/{chunk-YM6SNW4X.mjs → chunk-Y64YVKUG.mjs} +2 -2
  147. package/dist/esm/{chunk-4FIBPKCN.mjs → chunk-YBQSVZVE.mjs} +2 -2
  148. package/dist/esm/{chunk-BU6PBOHF.mjs → chunk-YGDOJWMQ.mjs} +2 -2
  149. package/dist/esm/{chunk-CGDYWQSB.mjs → chunk-YIQEJP6H.mjs} +2 -2
  150. package/dist/esm/{chunk-353SWAAB.mjs → chunk-YITOC4Z6.mjs} +2 -2
  151. package/dist/esm/{chunk-Q3CWUEXI.mjs → chunk-YSIQLXM5.mjs} +2 -2
  152. package/dist/esm/{chunk-SFSQ2TIU.mjs → chunk-YTNFGM6X.mjs} +2 -2
  153. package/dist/esm/{chunk-DSKXYJFZ.mjs → chunk-Z4JEGSWO.mjs} +2 -2
  154. package/dist/esm/{chunk-7RYYUO4V.mjs → chunk-ZHJQMIPK.mjs} +2 -2
  155. package/dist/esm/cli/index.d.mts +0 -1
  156. package/dist/esm/cli/move.d.mts +0 -1
  157. package/dist/esm/client/core.d.mts +0 -1
  158. package/dist/esm/client/core.mjs +1 -1
  159. package/dist/esm/client/get.d.mts +0 -1
  160. package/dist/esm/client/get.mjs +1 -1
  161. package/dist/esm/client/index.d.mts +0 -1
  162. package/dist/esm/client/index.mjs +1 -1
  163. package/dist/esm/client/post.d.mts +0 -1
  164. package/dist/esm/client/post.mjs +1 -1
  165. package/dist/esm/core/account/index.d.mts +0 -1
  166. package/dist/esm/core/account/index.mjs +1 -1
  167. package/dist/esm/core/account/utils/address.d.mts +0 -1
  168. package/dist/esm/core/account/utils/address.mjs +1 -1
  169. package/dist/esm/core/account/utils/index.d.mts +0 -1
  170. package/dist/esm/core/account/utils/index.mjs +1 -1
  171. package/dist/esm/core/accountAddress.d.mts +0 -1
  172. package/dist/esm/core/accountAddress.mjs +1 -1
  173. package/dist/esm/core/authenticationKey.d.mts +0 -1
  174. package/dist/esm/core/authenticationKey.mjs +1 -1
  175. package/dist/esm/core/crypto/ed25519.d.mts +0 -1
  176. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  177. package/dist/esm/core/crypto/ephemeral.d.mts +0 -1
  178. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  179. package/dist/esm/core/crypto/federatedKeyless.d.mts +0 -1
  180. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  181. package/dist/esm/core/crypto/index.d.mts +0 -1
  182. package/dist/esm/core/crypto/index.mjs +1 -1
  183. package/dist/esm/core/crypto/keyless.d.mts +0 -1
  184. package/dist/esm/core/crypto/keyless.mjs +1 -1
  185. package/dist/esm/core/crypto/multiEd25519.d.mts +0 -1
  186. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  187. package/dist/esm/core/crypto/multiKey.d.mts +0 -1
  188. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  189. package/dist/esm/core/crypto/privateKey.d.mts +0 -1
  190. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  191. package/dist/esm/core/crypto/proof.d.mts +0 -1
  192. package/dist/esm/core/crypto/proof.mjs +1 -1
  193. package/dist/esm/core/crypto/publicKey.d.mts +0 -1
  194. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  195. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  196. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  197. package/dist/esm/core/crypto/signature.d.mts +0 -1
  198. package/dist/esm/core/crypto/signature.mjs +1 -1
  199. package/dist/esm/core/crypto/singleKey.d.mts +0 -1
  200. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  201. package/dist/esm/core/crypto/utils.d.mts +0 -1
  202. package/dist/esm/core/hex.d.mts +0 -1
  203. package/dist/esm/core/index.d.mts +0 -1
  204. package/dist/esm/core/index.mjs +1 -1
  205. package/dist/esm/errors/index.d.mts +0 -1
  206. package/dist/esm/errors/index.mjs +1 -1
  207. package/dist/esm/index.d.mts +2 -4
  208. package/dist/esm/index.mjs +1 -1
  209. package/dist/esm/internal/account.d.mts +0 -1
  210. package/dist/esm/internal/account.mjs +1 -1
  211. package/dist/esm/internal/ans.d.mts +0 -1
  212. package/dist/esm/internal/ans.mjs +1 -1
  213. package/dist/esm/internal/coin.d.mts +0 -1
  214. package/dist/esm/internal/coin.mjs +1 -1
  215. package/dist/esm/internal/digitalAsset.d.mts +0 -1
  216. package/dist/esm/internal/digitalAsset.mjs +1 -1
  217. package/dist/esm/internal/event.d.mts +0 -1
  218. package/dist/esm/internal/event.mjs +1 -1
  219. package/dist/esm/internal/faucet.d.mts +0 -1
  220. package/dist/esm/internal/faucet.mjs +1 -1
  221. package/dist/esm/internal/fungibleAsset.d.mts +0 -1
  222. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  223. package/dist/esm/internal/general.d.mts +0 -1
  224. package/dist/esm/internal/general.mjs +1 -1
  225. package/dist/esm/internal/keyless.d.mts +0 -1
  226. package/dist/esm/internal/keyless.mjs +1 -1
  227. package/dist/esm/internal/object.d.mts +0 -1
  228. package/dist/esm/internal/object.mjs +1 -1
  229. package/dist/esm/internal/staking.d.mts +0 -1
  230. package/dist/esm/internal/staking.mjs +1 -1
  231. package/dist/esm/internal/table.d.mts +0 -1
  232. package/dist/esm/internal/table.mjs +1 -1
  233. package/dist/esm/internal/transaction.d.mts +0 -1
  234. package/dist/esm/internal/transaction.mjs +1 -1
  235. package/dist/esm/internal/transactionSubmission.d.mts +0 -1
  236. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  237. package/dist/esm/internal/view.d.mts +0 -1
  238. package/dist/esm/internal/view.mjs +1 -1
  239. package/dist/esm/transactions/authenticator/account.d.mts +0 -1
  240. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  241. package/dist/esm/transactions/authenticator/index.d.mts +0 -1
  242. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  243. package/dist/esm/transactions/authenticator/transaction.d.mts +0 -1
  244. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  245. package/dist/esm/transactions/index.d.mts +2 -4
  246. package/dist/esm/transactions/index.mjs +1 -1
  247. package/dist/esm/transactions/instances/chainId.d.mts +0 -1
  248. package/dist/esm/transactions/instances/identifier.d.mts +0 -1
  249. package/dist/esm/transactions/instances/index.d.mts +0 -1
  250. package/dist/esm/transactions/instances/index.mjs +1 -1
  251. package/dist/esm/transactions/instances/moduleId.d.mts +0 -1
  252. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  253. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +0 -1
  254. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  255. package/dist/esm/transactions/instances/rawTransaction.d.mts +0 -1
  256. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  257. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +0 -1
  258. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  259. package/dist/esm/transactions/instances/signedTransaction.d.mts +0 -1
  260. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  261. package/dist/esm/transactions/instances/simpleTransaction.d.mts +0 -1
  262. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  263. package/dist/esm/transactions/instances/transactionArgument.d.mts +0 -1
  264. package/dist/esm/transactions/instances/transactionPayload.d.mts +0 -1
  265. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  266. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +0 -1
  267. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  268. package/dist/esm/transactions/management/index.d.mts +0 -1
  269. package/dist/esm/transactions/management/index.mjs +1 -1
  270. package/dist/esm/transactions/management/transactionWorker.d.mts +0 -1
  271. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  272. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +0 -1
  273. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  274. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
  275. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  276. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +2 -23
  277. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  278. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +0 -1
  279. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  280. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +0 -1
  281. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  282. package/dist/esm/transactions/typeTag/index.d.mts +0 -1
  283. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  284. package/dist/esm/transactions/typeTag/parser.d.mts +0 -1
  285. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  286. package/dist/esm/transactions/types.d.mts +1 -10
  287. package/dist/esm/types/index.d.mts +0 -1
  288. package/dist/esm/types/index.mjs +1 -1
  289. package/dist/esm/types/types.d.mts +0 -1
  290. package/dist/esm/utils/helpers.d.mts +0 -1
  291. package/dist/esm/utils/index.d.mts +0 -1
  292. package/dist/esm/utils/index.mjs +1 -1
  293. package/dist/esm/utils/normalizeBundle.d.mts +0 -1
  294. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  295. package/package.json +1 -2
  296. package/src/api/transactionSubmission/build.ts +1 -82
  297. package/src/bcs/deserializer.ts +17 -1
  298. package/src/core/crypto/privateKey.ts +9 -8
  299. package/src/core/crypto/secp256k1.ts +13 -3
  300. package/src/transactions/index.ts +0 -1
  301. package/src/transactions/transactionBuilder/remoteAbi.ts +1 -55
  302. package/src/transactions/types.ts +0 -11
  303. package/src/types/index.ts +0 -1
  304. package/dist/esm/chunk-2OF44LP4.mjs +0 -2
  305. package/dist/esm/chunk-2OF44LP4.mjs.map +0 -1
  306. package/dist/esm/chunk-3OLFJ65O.mjs +0 -2
  307. package/dist/esm/chunk-3OLFJ65O.mjs.map +0 -1
  308. package/dist/esm/chunk-AVZYJAXR.mjs +0 -2
  309. package/dist/esm/chunk-AVZYJAXR.mjs.map +0 -1
  310. package/dist/esm/chunk-D52UKPQF.mjs +0 -2
  311. package/dist/esm/chunk-D52UKPQF.mjs.map +0 -1
  312. package/dist/esm/chunk-KUL55M2H.mjs +0 -2
  313. package/dist/esm/chunk-KUL55M2H.mjs.map +0 -1
  314. package/dist/esm/chunk-MPEPVGWG.mjs +0 -2
  315. package/dist/esm/chunk-MPEPVGWG.mjs.map +0 -1
  316. package/dist/esm/chunk-TIKXNQYC.mjs +0 -2
  317. package/dist/esm/chunk-TIKXNQYC.mjs.map +0 -1
  318. package/dist/esm/chunk-UIRAXHDH.mjs +0 -1
  319. package/dist/esm/chunk-UZTJWOLS.mjs +0 -2
  320. package/dist/esm/transactions/script-composer/index.d.mts +0 -44
  321. package/dist/esm/transactions/script-composer/index.mjs +0 -2
  322. package/src/transactions/script-composer/index.ts +0 -76
  323. /package/dist/esm/{chunk-5O3RHPER.mjs.map → chunk-25DLTVYQ.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-L2SDI7PI.mjs.map → chunk-2POONZMB.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-O4MRRWRI.mjs.map → chunk-2T3UISSK.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-MWWYVW65.mjs.map → chunk-46E4LEHN.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-PKWX45UR.mjs.map → chunk-4B3VHMHM.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-YFIXGTWP.mjs.map → chunk-4ULPBQ3M.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-THRFTTUG.mjs.map → chunk-4ZNSNWQL.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-HMDLBOCN.mjs.map → chunk-5XLZACVT.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-NQW2T6H6.mjs.map → chunk-5ZBV2SRL.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-2E3EAJPC.mjs.map → chunk-64IZ5PQR.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-VUZFKJBB.mjs.map → chunk-6A552D3E.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-5BZEH4H5.mjs.map → chunk-6GFBPLVZ.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-YSBSCW5S.mjs.map → chunk-6HBGNVXC.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-A3USS2NC.mjs.map → chunk-7TCZ6LW2.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-CW6P2DDJ.mjs.map → chunk-ALOYOMRE.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-T6QKKUEK.mjs.map → chunk-AQJVP77Y.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-UZTJWOLS.mjs.map → chunk-CDEYH77E.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-SBQJ3A7H.mjs.map → chunk-DBTUGRRG.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-HPYBNJ7J.mjs.map → chunk-EHC7KQMS.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-2E3BT4YW.mjs.map → chunk-ESMLYVYO.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-3NPN2MSI.mjs.map → chunk-FA6EF6SC.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-UIRAXHDH.mjs.map → chunk-FD6FGKYY.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-QQM47PHZ.mjs.map → chunk-FRWZCXDG.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-QCUXDDCU.mjs.map → chunk-GM547BBN.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-BMAIA7QJ.mjs.map → chunk-H53YQWYM.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-JEKZN7SO.mjs.map → chunk-HKVZ7CAG.mjs.map} +0 -0
  349. /package/dist/esm/{transactions/script-composer/index.mjs.map → chunk-I5OYNCZS.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-IT42PQ4G.mjs.map → chunk-I7A6PMOO.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-XWUMN7TI.mjs.map → chunk-IHQ63OVD.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-4GNR3AQF.mjs.map → chunk-J3E2M7S3.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-3R3XGOPC.mjs.map → chunk-JRODZWJE.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-D54FD6XE.mjs.map → chunk-JYEJEI2U.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-6NEN65HA.mjs.map → chunk-JZIVVVJB.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-4IQZOAN7.mjs.map → chunk-KMA3V3MT.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-A6AAR5TS.mjs.map → chunk-LNZ7FQOP.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-DULHBLPY.mjs.map → chunk-LUHB2LBO.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-L365GPP2.mjs.map → chunk-LZLNRFRG.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-YZFMBFJN.mjs.map → chunk-NNFCHV2S.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-QAYDBQJZ.mjs.map → chunk-P7S53273.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-UTOO6IVJ.mjs.map → chunk-QK32EQSF.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-2VDQXUT4.mjs.map → chunk-RLSGD2HN.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-6H5QNZRH.mjs.map → chunk-RRBK4GSD.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-OCE3XXUA.mjs.map → chunk-RSBUPLET.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-BFBRLEQM.mjs.map → chunk-RV7PNWDY.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-632VRZYX.mjs.map → chunk-SFGDP62T.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-UKXLESMW.mjs.map → chunk-T6IEHMCZ.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-7M3NKATD.mjs.map → chunk-U7UTBXJD.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-RKMIDNYX.mjs.map → chunk-UEEB4ZOS.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-TXD342Q6.mjs.map → chunk-UYMNYTLM.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-TQA6HY6A.mjs.map → chunk-V5QOG3IB.mjs.map} +0 -0
  373. /package/dist/esm/{chunk-UZGSDK63.mjs.map → chunk-V7GSH3L3.mjs.map} +0 -0
  374. /package/dist/esm/{chunk-WF3HSWHT.mjs.map → chunk-VAKNMHOA.mjs.map} +0 -0
  375. /package/dist/esm/{chunk-6YJW6OC5.mjs.map → chunk-WXVF7N56.mjs.map} +0 -0
  376. /package/dist/esm/{chunk-B77HJ77O.mjs.map → chunk-X2U7SKK7.mjs.map} +0 -0
  377. /package/dist/esm/{chunk-YM6SNW4X.mjs.map → chunk-Y64YVKUG.mjs.map} +0 -0
  378. /package/dist/esm/{chunk-4FIBPKCN.mjs.map → chunk-YBQSVZVE.mjs.map} +0 -0
  379. /package/dist/esm/{chunk-BU6PBOHF.mjs.map → chunk-YGDOJWMQ.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-CGDYWQSB.mjs.map → chunk-YIQEJP6H.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-353SWAAB.mjs.map → chunk-YITOC4Z6.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-Q3CWUEXI.mjs.map → chunk-YSIQLXM5.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-SFSQ2TIU.mjs.map → chunk-YTNFGM6X.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-DSKXYJFZ.mjs.map → chunk-Z4JEGSWO.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-7RYYUO4V.mjs.map → chunk-ZHJQMIPK.mjs.map} +0 -0
@@ -3,17 +3,10 @@
3
3
 
4
4
  import { AccountAddressInput } from "../../core";
5
5
  import { generateTransaction } from "../../internal/transactionSubmission";
6
- import {
7
- InputGenerateTransactionPayloadData,
8
- InputGenerateTransactionOptions,
9
- AptosScriptComposer,
10
- TransactionPayloadScript,
11
- generateRawTransaction,
12
- } from "../../transactions";
6
+ import { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from "../../transactions";
13
7
  import { MultiAgentTransaction } from "../../transactions/instances/multiAgentTransaction";
14
8
  import { SimpleTransaction } from "../../transactions/instances/simpleTransaction";
15
9
  import { AptosConfig } from "../aptosConfig";
16
- import { Deserializer } from "../../bcs";
17
10
 
18
11
  /**
19
12
  * A class to handle all `Build` transaction operations.
@@ -100,80 +93,6 @@ export class Build {
100
93
  return generateTransaction({ aptosConfig: this.config, ...args });
101
94
  }
102
95
 
103
- /**
104
- * Build a transaction from a series of Move calls.
105
- *
106
- * This function allows you to create a transaction with a list of Move calls.
107
- *
108
- * Right now we only tested this logic with single signer and we will add support
109
- * for mutli agent transactions if needed.
110
- *
111
- * @param args.sender - The sender account address.
112
- * @param args.builder - The closure to construct the list of calls.
113
- * @param args.options - Optional transaction configurations.
114
- * @param args.withFeePayer - Whether there is a fee payer for the transaction.
115
- *
116
- * @returns SimpleTransaction
117
- *
118
- * @example
119
- * ```typescript
120
- * import { Aptos, AptosConfig, Network } from "@aptos-labs/ts-sdk";
121
- *
122
- * const config = new AptosConfig({ network: Network.TESTNET });
123
- * const aptos = new Aptos(config);
124
- *
125
- * async function runExample() {
126
- * // Build a transaction from a chained series of Move calls.
127
- * const transaction = await aptos.transaction.script_composer({
128
- * sender: "0x1", // replace with a real sender account address
129
- * builder: builder: async (builder) => {
130
- * const coin = await builder.addBatchedCalls({
131
- * function: "0x1::coin::withdraw",
132
- * functionArguments: [CallArgument.new_signer(0), 1],
133
- * typeArguments: ["0x1::aptos_coin::AptosCoin"],
134
- * });
135
- *
136
- * // Pass the returned value from the first function call to the second call
137
- * const fungibleAsset = await builder.addBatchedCalls({
138
- * function: "0x1::coin::coin_to_fungible_asset",
139
- * functionArguments: [coin[0]],
140
- * typeArguments: ["0x1::aptos_coin::AptosCoin"],
141
- * });
142
- *
143
- * await builder.addBatchedCalls({
144
- * function: "0x1::primary_fungible_store::deposit",
145
- * functionArguments: [singleSignerED25519SenderAccount.accountAddress, fungibleAsset[0]],
146
- * typeArguments: [],
147
- * });
148
- * return builder;
149
- * },
150
- * options: {
151
- * gasUnitPrice: 100, // specify your own gas unit price if needed
152
- * maxGasAmount: 1000, // specify your own max gas amount if needed
153
- * },
154
- * });
155
- *
156
- * console.log(transaction);
157
- * }
158
- * runExample().catch(console.error);
159
- * ```
160
- */
161
- async scriptComposer(args: {
162
- sender: AccountAddressInput;
163
- builder: (builder: AptosScriptComposer) => Promise<AptosScriptComposer>;
164
- options?: InputGenerateTransactionOptions;
165
- withFeePayer?: boolean;
166
- }): Promise<SimpleTransaction> {
167
- const builder = await args.builder(new AptosScriptComposer(this.config));
168
- const bytes = builder.build();
169
- const rawTxn = await generateRawTransaction({
170
- aptosConfig: this.config,
171
- payload: TransactionPayloadScript.load(new Deserializer(bytes)),
172
- ...args,
173
- });
174
- return new SimpleTransaction(rawTxn);
175
- }
176
-
177
96
  /**
178
97
  * Build a multi-agent transaction that allows multiple signers to authorize a transaction.
179
98
  *
@@ -82,7 +82,6 @@ export class Deserializer {
82
82
  }
83
83
 
84
84
  /**
85
- * @deprecated use `deserializeOption` instead.
86
85
  * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,
87
86
  * followed by the actual byte content, and decodes it into a string.
88
87
  *
@@ -101,6 +100,23 @@ export class Deserializer {
101
100
  return textDecoder.decode(value);
102
101
  }
103
102
 
103
+ /**
104
+ * @deprecated use `deserializeOption("string")` instead.
105
+ *
106
+ * The BCS layout for Optional<String> is 0 if none, else 1 followed by the string length and string content.
107
+ * @returns The deserialized string if it exists, otherwise undefined.
108
+ * @example
109
+ * ```typescript
110
+ * const deserializer = new Deserializer(new Uint8Array([0x00]));
111
+ * assert(deserializer.deserializeOptionStr() === undefined);
112
+ * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));
113
+ * assert(deserializer.deserializeOptionStr() === "1234abcd");
114
+ * ```
115
+ */
116
+ deserializeOptionStr(): string | undefined {
117
+ return this.deserializeOption("string");
118
+ }
119
+
104
120
  /**
105
121
  * Deserializes an optional value from the buffer.
106
122
  *
@@ -49,7 +49,15 @@ export class PrivateKey {
49
49
  */
50
50
  public static formatPrivateKey(privateKey: HexInput, type: PrivateKeyVariants): string {
51
51
  const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];
52
- return `${aip80Prefix}${Hex.fromHexInput(privateKey).toString()}`;
52
+
53
+ // Remove the prefix if it exists
54
+ let formattedPrivateKey = privateKey;
55
+ if (typeof formattedPrivateKey === "string" && formattedPrivateKey.startsWith(aip80Prefix)) {
56
+ // eslint-disable-next-line prefer-destructuring
57
+ formattedPrivateKey = formattedPrivateKey.split("-")[2];
58
+ }
59
+
60
+ return `${aip80Prefix}${Hex.fromHexInput(formattedPrivateKey).toString()}`;
53
61
  }
54
62
 
55
63
  /**
@@ -91,13 +99,6 @@ export class PrivateKey {
91
99
  } else {
92
100
  // The value is an Uint8Array
93
101
  data = Hex.fromHexInput(value);
94
- // If the strictness is false, the user has opted into non-AIP-80 compliant private keys.
95
- if (strict !== false) {
96
- // eslint-disable-next-line no-console
97
- console.warn(
98
- "[Aptos SDK] It is recommended that private keys are parsed as AIP-80 compliant strings instead of Uint8Array (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: Uint8Array, type: 'ed25519' | 'secp256k1'): string`.",
99
- );
100
- }
101
102
  }
102
103
 
103
104
  return data;
@@ -23,6 +23,9 @@ export class Secp256k1PublicKey extends PublicKey {
23
23
  // Secp256k1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.
24
24
  static readonly LENGTH: number = 65;
25
25
 
26
+ // If it's compressed, it is only 33 bytes
27
+ static readonly COMPRESSED_LENGTH: number = 33;
28
+
26
29
  // Hex value of the public key
27
30
  private readonly key: Hex;
28
31
 
@@ -37,10 +40,17 @@ export class Secp256k1PublicKey extends PublicKey {
37
40
  super();
38
41
 
39
42
  const hex = Hex.fromHexInput(hexInput);
40
- if (hex.toUint8Array().length !== Secp256k1PublicKey.LENGTH) {
41
- throw new Error(`PublicKey length should be ${Secp256k1PublicKey.LENGTH}`);
43
+ const { length } = hex.toUint8Array();
44
+ if (length === Secp256k1PublicKey.LENGTH) {
45
+ this.key = hex;
46
+ } else if (length === Secp256k1PublicKey.COMPRESSED_LENGTH) {
47
+ const point = secp256k1.ProjectivePoint.fromHex(hex.toUint8Array());
48
+ this.key = Hex.fromHexInput(point.toRawBytes(false));
49
+ } else {
50
+ throw new Error(
51
+ `PublicKey length should be ${Secp256k1PublicKey.LENGTH} or ${Secp256k1PublicKey.COMPRESSED_LENGTH}, received ${length}`,
52
+ );
42
53
  }
43
- this.key = hex;
44
54
  }
45
55
 
46
56
  // region PublicKey
@@ -7,4 +7,3 @@ export * from "./transactionBuilder";
7
7
  export * from "./typeTag";
8
8
  export * from "./typeTag/parser";
9
9
  export * from "./types";
10
- export * from "./script-composer";
@@ -45,7 +45,7 @@ import {
45
45
  throwTypeMismatch,
46
46
  convertNumber,
47
47
  } from "./helpers";
48
- import { CallArgument, MoveFunction } from "../../types";
48
+ import { MoveFunction } from "../../types";
49
49
 
50
50
  const TEXT_ENCODER = new TextEncoder();
51
51
 
@@ -92,34 +92,6 @@ export async function fetchFunctionAbi(
92
92
  return undefined;
93
93
  }
94
94
 
95
- /**
96
- * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.
97
- * @param moduleAddress
98
- * @param moduleName
99
- * @param functionName
100
- * @param aptosConfig
101
- */
102
- export async function fetchMoveFunctionAbi(
103
- moduleAddress: string,
104
- moduleName: string,
105
- functionName: string,
106
- aptosConfig: AptosConfig,
107
- ): Promise<FunctionABI> {
108
- const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);
109
- if (!functionAbi) {
110
- throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);
111
- }
112
- const params: TypeTag[] = [];
113
- for (let i = 0; i < functionAbi.params.length; i += 1) {
114
- params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));
115
- }
116
-
117
- return {
118
- typeParameters: functionAbi.generic_type_params,
119
- parameters: params,
120
- };
121
- }
122
-
123
95
  /**
124
96
  * Fetches the ABI for an entry function from the specified module address.
125
97
  * This function validates if the ABI corresponds to an entry function and retrieves its parameters.
@@ -211,32 +183,6 @@ export async function fetchViewFunctionAbi(
211
183
  };
212
184
  }
213
185
 
214
- /**
215
- * Converts a entry function argument into CallArgument, if necessary.
216
- * This function checks the provided argument against the expected parameter type and converts it accordingly.
217
- *
218
- * @param functionName - The name of the function for which the argument is being converted.
219
- * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.
220
- * @param argument - The argument to be converted, which can be of various types. If the argument is already
221
- * CallArgument returned from TransactionComposer it would be returned immediately.
222
- * @param position - The index of the argument in the function's parameter list.
223
- * @param genericTypeParams - An array of type tags for any generic type parameters.
224
- */
225
- export function convertCallArgument(
226
- argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,
227
- functionName: string,
228
- functionAbi: FunctionABI,
229
- position: number,
230
- genericTypeParams: Array<TypeTag>,
231
- ): CallArgument {
232
- if (argument instanceof CallArgument) {
233
- return argument;
234
- }
235
- return CallArgument.new_bytes(
236
- convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),
237
- );
238
- }
239
-
240
186
  /**
241
187
  * Converts a non-BCS encoded argument into BCS encoded, if necessary.
242
188
  * This function checks the provided argument against the expected parameter type and converts it accordingly.
@@ -1,7 +1,6 @@
1
1
  // Copyright © Aptos Foundation
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
- import { CallArgument } from "@aptos-labs/script-composer-pack";
5
4
  import { AptosConfig } from "../api/aptosConfig";
6
5
  import { MoveOption, MoveString, MoveVector } from "../bcs/serializable/moveStructs";
7
6
  import { Bool, U128, U16, U256, U32, U64, U8 } from "../bcs/serializable/movePrimitives";
@@ -165,16 +164,6 @@ export type InputMultiSigDataWithABI = {
165
164
  * Combines input function data with Aptos configuration for remote ABI interactions.
166
165
  */
167
166
  export type InputEntryFunctionDataWithRemoteABI = InputEntryFunctionData & { aptosConfig: AptosConfig };
168
-
169
- /**
170
- * The data needed to generate a batched function payload
171
- */
172
- export type InputBatchedFunctionData = {
173
- function: MoveFunctionId;
174
- typeArguments?: Array<TypeArgument>;
175
- functionArguments: Array<EntryFunctionArgumentTypes | CallArgument | SimpleEntryFunctionArgumentTypes>;
176
- };
177
-
178
167
  /**
179
168
  * The data needed to generate a Multi Sig payload
180
169
  */
@@ -1,3 +1,2 @@
1
1
  export * from "./indexer";
2
2
  export * from "./types";
3
- export { CallArgument } from "@aptos-labs/script-composer-pack";
@@ -1,2 +0,0 @@
1
- import{a as c,c as u,f as l}from"./chunk-TIKXNQYC.mjs";import{u as m}from"./chunk-5O3RHPER.mjs";import{TransactionComposer as f,initSync as h,wasm as A}from"@aptos-labs/script-composer-pack";(async()=>h({module:A}))();var g=class{constructor(t){this.builder=f.single_signer(),this.config=t}async addBatchedCalls(t){let{moduleAddress:r,moduleName:o,functionName:i}=m(t.function),s=this.config.getRequestUrl("Fullnode");if(await this.builder.load_module(s,`${r}::${o}`),t.typeArguments!==void 0)for(let e of t.typeArguments)await this.builder.load_type_tag(s,e.toString());let n=c(t.typeArguments),a=await u(r,o,i,this.config);if(n.length!==a.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${a.typeParameters.length}, received ${n.length}`);let d=t.functionArguments.map((e,p)=>l(e,i,a,p,n));return this.builder.add_batched_call(`${r}::${o}`,i,n.map(e=>e.toString()),d)}build(){return this.builder.generate_batched_calls(!0)}};export{g as a};
2
- //# sourceMappingURL=chunk-2OF44LP4.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/transactions/script-composer/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { TransactionComposer, initSync, wasm } from \"@aptos-labs/script-composer-pack\";\nimport { AptosApiType } from \"../../utils\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { InputBatchedFunctionData } from \"../types\";\nimport { fetchMoveFunctionAbi, getFunctionParts, standardizeTypeTags } from \"../transactionBuilder\";\nimport { CallArgument } from \"../../types\";\nimport { convertCallArgument } from \"../transactionBuilder/remoteAbi\";\n\n(async () => {\n initSync({ module: wasm });\n})();\n\n// A wrapper class around TransactionComposer, which is a WASM library compiled\n// from aptos-core/aptos-move/script-composer.\n//\n// This class allows the SDK caller to build a transaction that invokes multiple Move functions\n// and allow for arguments to be passed around.\nexport class AptosScriptComposer {\n private builder: TransactionComposer;\n\n private config: AptosConfig;\n\n constructor(aptosConfig: AptosConfig) {\n this.builder = TransactionComposer.single_signer();\n this.config = aptosConfig;\n }\n\n // Add a move function invocation to the TransactionComposer.\n //\n // Similar to how to create an entry function, the difference is that input arguments could\n // either be a `CallArgument` which represents an abstract value returned from a previous Move call\n // or the regular entry function arguments.\n //\n // The function would also return a list of `CallArgument` that can be passed on to future calls.\n async addBatchedCalls(input: InputBatchedFunctionData): Promise<CallArgument[]> {\n const { moduleAddress, moduleName, functionName } = getFunctionParts(input.function);\n const nodeUrl = this.config.getRequestUrl(AptosApiType.FULLNODE);\n\n // Load the calling module into the builder.\n await this.builder.load_module(nodeUrl, `${moduleAddress}::${moduleName}`);\n\n // Load the calling type arguments into the loader.\n if (input.typeArguments !== undefined) {\n for (const typeTag of input.typeArguments) {\n // eslint-disable-next-line no-await-in-loop\n await this.builder.load_type_tag(nodeUrl, typeTag.toString());\n }\n }\n const typeArguments = standardizeTypeTags(input.typeArguments);\n const functionAbi = await fetchMoveFunctionAbi(moduleAddress, moduleName, functionName, this.config);\n // Check the type argument count against the ABI\n if (typeArguments.length !== functionAbi.typeParameters.length) {\n throw new Error(\n `Type argument count mismatch, expected ${functionAbi.typeParameters.length}, received ${typeArguments.length}`,\n );\n }\n\n const functionArguments: CallArgument[] = input.functionArguments.map((arg, i) =>\n convertCallArgument(arg, functionName, functionAbi, i, typeArguments),\n );\n\n return this.builder.add_batched_call(\n `${moduleAddress}::${moduleName}`,\n functionName,\n typeArguments.map((arg) => arg.toString()),\n functionArguments,\n );\n }\n\n build(): Uint8Array {\n return this.builder.generate_batched_calls(true);\n }\n}\n"],"mappings":"gGAGA,OAAS,uBAAAA,EAAqB,YAAAC,EAAU,QAAAC,MAAY,oCAQnD,SACCC,EAAS,CAAE,OAAQC,CAAK,CAAC,KAQpB,IAAMC,EAAN,KAA0B,CAK/B,YAAYC,EAA0B,CACpC,KAAK,QAAUC,EAAoB,cAAc,EACjD,KAAK,OAASD,CAChB,CASA,MAAM,gBAAgBE,EAA0D,CAC9E,GAAM,CAAE,cAAAC,EAAe,WAAAC,EAAY,aAAAC,CAAa,EAAIC,EAAiBJ,EAAM,QAAQ,EAC7EK,EAAU,KAAK,OAAO,wBAAmC,EAM/D,GAHA,MAAM,KAAK,QAAQ,YAAYA,EAAS,GAAGJ,CAAa,KAAKC,CAAU,EAAE,EAGrEF,EAAM,gBAAkB,OAC1B,QAAWM,KAAWN,EAAM,cAE1B,MAAM,KAAK,QAAQ,cAAcK,EAASC,EAAQ,SAAS,CAAC,EAGhE,IAAMC,EAAgBC,EAAoBR,EAAM,aAAa,EACvDS,EAAc,MAAMC,EAAqBT,EAAeC,EAAYC,EAAc,KAAK,MAAM,EAEnG,GAAII,EAAc,SAAWE,EAAY,eAAe,OACtD,MAAM,IAAI,MACR,0CAA0CA,EAAY,eAAe,MAAM,cAAcF,EAAc,MAAM,EAC/G,EAGF,IAAMI,EAAoCX,EAAM,kBAAkB,IAAI,CAACY,EAAKC,IAC1EC,EAAoBF,EAAKT,EAAcM,EAAaI,EAAGN,CAAa,CACtE,EAEA,OAAO,KAAK,QAAQ,iBAClB,GAAGN,CAAa,KAAKC,CAAU,GAC/BC,EACAI,EAAc,IAAKK,GAAQA,EAAI,SAAS,CAAC,EACzCD,CACF,CACF,CAEA,OAAoB,CAClB,OAAO,KAAK,QAAQ,uBAAuB,EAAI,CACjD,CACF","names":["TransactionComposer","initSync","wasm","initSync","wasm","AptosScriptComposer","aptosConfig","TransactionComposer","input","moduleAddress","moduleName","functionName","getFunctionParts","nodeUrl","typeTag","typeArguments","standardizeTypeTags","functionAbi","fetchMoveFunctionAbi","functionArguments","arg","i","convertCallArgument"]}
@@ -1,2 +0,0 @@
1
- import{CallArgument as t}from"@aptos-labs/script-composer-pack";export{t as a};
2
- //# sourceMappingURL=chunk-3OLFJ65O.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./indexer\";\nexport * from \"./types\";\nexport { CallArgument } from \"@aptos-labs/script-composer-pack\";\n"],"mappings":"AAEA,OAAS,gBAAAA,MAAoB","names":["CallArgument"]}
@@ -1,2 +0,0 @@
1
- import{b as e}from"./chunk-SPRNSFUV.mjs";var r=class r{static formatPrivateKey(t,n){return`${r.AIP80_PREFIXES[n]}${e.fromHexInput(t).toString()}`}static parseHexInput(t,n,i){let a,p=r.AIP80_PREFIXES[n];if(typeof t=="string")if(!i&&!t.startsWith(p))a=e.fromHexInput(t),i!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(t.startsWith(p))a=e.fromHexString(t.split("-")[2]);else throw i?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else a=e.fromHexInput(t),i!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are parsed as AIP-80 compliant strings instead of Uint8Array (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: Uint8Array, type: 'ed25519' | 'secp256k1'): string`.");return a}};r.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var o=r;export{o as a};
2
- //# sourceMappingURL=chunk-AVZYJAXR.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/privateKey.ts"],"sourcesContent":["/* eslint-disable max-len */\n\nimport { HexInput, PrivateKeyVariants } from \"../../types\";\nimport { Hex } from \"../hex\";\nimport { PublicKey } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents a private key used for signing messages and deriving the associated public key.\n */\nexport interface PrivateKey {\n /**\n * Sign the given message with the private key to create a signature.\n * @param message - The message to be signed, provided in HexInput format.\n * @returns A Signature object representing the signed message.\n */\n sign(message: HexInput): Signature;\n\n /**\n * Derive the public key associated with the private key.\n */\n publicKey(): PublicKey;\n\n /**\n * Get the private key in bytes (Uint8Array).\n */\n toUint8Array(): Uint8Array;\n}\n\nexport class PrivateKey {\n /**\n * The AIP-80 compliant prefixes for each private key type. Append this to a private key's hex representation\n * to get an AIP-80 compliant string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n */\n public static readonly AIP80_PREFIXES = {\n [PrivateKeyVariants.Ed25519]: \"ed25519-priv-\",\n [PrivateKeyVariants.Secp256k1]: \"secp256k1-priv-\",\n };\n\n /**\n * Format a HexInput to an AIP-80 compliant string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param privateKey - The HexString or Uint8Array format of the private key.\n * @param privateKeyType - The private key type\n */\n public static formatPrivateKey(privateKey: HexInput, type: PrivateKeyVariants): string {\n const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];\n return `${aip80Prefix}${Hex.fromHexInput(privateKey).toString()}`;\n }\n\n /**\n * Parse a HexInput that may be a HexString, Uint8Array, or a AIP-80 compliant string to a Hex instance.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param value - A HexString, Uint8Array, or a AIP-80 compliant string.\n * @param privateKeyType - The private key type\n * @param strict - If true, the value MUST be compliant with AIP-80.\n */\n public static parseHexInput(value: HexInput, type: PrivateKeyVariants, strict?: boolean): Hex {\n let data: Hex;\n\n const aip80Prefix = PrivateKey.AIP80_PREFIXES[type];\n if (typeof value === \"string\") {\n if (!strict && !value.startsWith(aip80Prefix)) {\n // HexString input\n data = Hex.fromHexInput(value);\n // If the strictness is false, the user has opted into non-AIP-80 compliant private keys.\n if (strict !== false) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.\",\n );\n }\n } else if (value.startsWith(aip80Prefix)) {\n // AIP-80 Compliant String input\n data = Hex.fromHexString(value.split(\"-\")[2]);\n } else {\n if (strict) {\n // The value does not start with the AIP-80 prefix, and strict is true.\n throw new Error(\"Invalid HexString input while parsing private key. Must AIP-80 compliant string.\");\n }\n\n // This condition should never be reached.\n throw new Error(\"Invalid HexString input while parsing private key.\");\n }\n } else {\n // The value is an Uint8Array\n data = Hex.fromHexInput(value);\n // If the strictness is false, the user has opted into non-AIP-80 compliant private keys.\n if (strict !== false) {\n // eslint-disable-next-line no-console\n console.warn(\n \"[Aptos SDK] It is recommended that private keys are parsed as AIP-80 compliant strings instead of Uint8Array (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: Uint8Array, type: 'ed25519' | 'secp256k1'): string`.\",\n );\n }\n }\n\n return data;\n }\n}\n"],"mappings":"yCA6BO,IAAMA,EAAN,MAAMA,CAAW,CAoBtB,OAAc,iBAAiBC,EAAsBC,EAAkC,CAErF,MAAO,GADaF,EAAW,eAAeE,CAAI,CAC7B,GAAGC,EAAI,aAAaF,CAAU,EAAE,SAAS,CAAC,EACjE,CAWA,OAAc,cAAcG,EAAiBF,EAA0BG,EAAuB,CAC5F,IAAIC,EAEEC,EAAcP,EAAW,eAAeE,CAAI,EAClD,GAAI,OAAOE,GAAU,SACnB,GAAI,CAACC,GAAU,CAACD,EAAM,WAAWG,CAAW,EAE1CD,EAAOH,EAAI,aAAaC,CAAK,EAEzBC,IAAW,IAEb,QAAQ,KACN,uRACF,UAEOD,EAAM,WAAWG,CAAW,EAErCD,EAAOH,EAAI,cAAcC,EAAM,MAAM,GAAG,EAAE,CAAC,CAAC,MAE5C,OAAIC,EAEI,IAAI,MAAM,kFAAkF,EAI9F,IAAI,MAAM,oDAAoD,OAItEC,EAAOH,EAAI,aAAaC,CAAK,EAEzBC,IAAW,IAEb,QAAQ,KACN,mUACF,EAIJ,OAAOC,CACT,CACF,EA3EaN,EAOY,eAAiB,CACrC,QAA6B,gBAC7B,UAA+B,iBAClC,EAVK,IAAMQ,EAANR","names":["_PrivateKey","privateKey","type","Hex","value","strict","data","aip80Prefix","PrivateKey"]}
@@ -1,2 +0,0 @@
1
- import{c as t}from"./chunk-56CNRT2K.mjs";var s=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOption(e,i){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(i===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(i)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<t;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(i),!(r&128))break;i+=7}if(e>t)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),r=new Array;for(let n=0;n<i;n+=1)r.push(this.deserialize(e));return r}};export{s as a};
2
- //# sourceMappingURL=chunk-D52UKPQF.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n *\n * @template T - The type that this will deserialize into.\n */\nexport interface Deserializable<T> {\n /**\n * Deserializes the buffered bytes into an instance of the specified class type.\n * This function provides an alternative syntax for deserialization, allowing users to call\n * `deserializer.deserialize(MyClass)` instead of `MyClass.deserialize(deserializer)`.\n *\n * @param deserializer - The deserializer instance with the buffered bytes.\n * @returns The deserialized value of class type T.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * ```\n */\n deserialize(deserializer: Deserializer): T;\n}\n\n/**\n * A class that provides methods for deserializing various data types from a byte buffer.\n * It supports deserialization of primitive types, strings, and complex objects using a BCS (Binary Common Serialization) layout.\n */\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n /**\n * Creates a new instance of the class with a copy of the provided data buffer.\n * This prevents outside mutation of the buffer.\n *\n * @param data - The data to be copied into the internal buffer as a Uint8Array.\n */\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n /**\n * Reads a specified number of bytes from the buffer and advances the offset.\n *\n * @param length - The number of bytes to read from the buffer.\n * @throws Throws an error if the read operation exceeds the buffer's length.\n */\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Returns the number of bytes remaining in the buffer.\n *\n * This information is useful to determine if there's more data to be read.\n *\n * @returns The number of bytes remaining in the buffer.\n */\n remaining(): number {\n return this.buffer.byteLength - this.offset;\n }\n\n /**\n * @deprecated use `deserializeOption` instead.\n * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,\n * followed by the actual byte content, and decodes it into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes an optional value from the buffer.\n *\n * The BCS layout for Optional<T> starts with a boolean byte (0 if none, 1 if some),\n * followed by the value if present.\n *\n * @template T - The type of the value to deserialize\n * @param type - Either a Deserializable class or one of the string literals: \"string\", \"bytes\", or \"fixedBytes\"\n * @param len - Required length when type is \"fixedBytes\", ignored otherwise\n * @returns The deserialized value if present, undefined otherwise\n *\n * @throws {Error} When \"fixedBytes\" is specified without a length\n *\n * @example\n * ```typescript\n * // Deserialize an optional string\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 97, 98, 99]));\n * const optStr = deserializer.deserializeOption(\"string\");\n * // optStr === \"abc\"\n *\n * // Deserialize an optional custom type\n * const deserializer = new Deserializer(new Uint8Array([0]));\n * const optValue = deserializer.deserializeOption(MyClass);\n * // optValue === undefined\n *\n * // Deserialize optional bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 3, 1, 2, 3]));\n * const optBytes = deserializer.deserializeOption(\"bytes\");\n * // optBytes === Uint8Array[1, 2, 3]\n *\n * // Deserialize optional fixed bytes\n * const deserializer = new Deserializer(new Uint8Array([1, 1, 2, 3, 4]));\n * const optBytes = deserializer.deserializeOption(\"fixedBytes\", 4);\n * // optBytes === Uint8Array[1, 2, 3, 4]\n * ```\n */\n deserializeOption(type: \"string\"): string | undefined;\n deserializeOption(type: \"bytes\"): Uint8Array | undefined;\n deserializeOption(type: \"fixedBytes\", len: number): Uint8Array | undefined;\n deserializeOption<T>(type: Deserializable<T>): T | undefined;\n deserializeOption<T>(\n type: Deserializable<T> | \"string\" | \"bytes\" | \"fixedBytes\",\n len?: number,\n ): T | string | Uint8Array | undefined {\n const exists = this.deserializeBool();\n if (!exists) return undefined;\n\n if (type === \"string\") {\n return this.deserializeStr();\n }\n if (type === \"bytes\") {\n return this.deserializeBytes();\n }\n if (type === \"fixedBytes\") {\n if (len === undefined) {\n throw new Error(\"Fixed bytes length not provided\");\n }\n return this.deserializeFixedBytes(len);\n }\n\n return this.deserialize(type);\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * The BCS layout for \"bytes\" consists of a bytes_length followed by the bytes themselves, where bytes_length is a u32 integer\n * encoded as a uleb128 integer, indicating the length of the bytes array.\n *\n * @returns {Uint8Array} The deserialized array of bytes.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes of a specified length.\n *\n * @param len - The number of bytes to read from the source.\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value from a byte stream.\n *\n * The BCS layout for a boolean uses one byte, where \"0x01\" represents true and \"0x00\" represents false.\n * An error is thrown if the byte value is not valid.\n *\n * @returns The deserialized boolean value.\n * @throws Throws an error if the boolean value is invalid.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number from the binary data.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized uint8 number.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint16\": Two bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint32\": Four bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * This function combines two 32-bit values to return a 64-bit unsigned integer in little-endian representation.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number from its binary representation.\n * This function combines two 64-bit values to return a single uint128 value in little-endian format.\n *\n * @returns {BigInt} The deserialized uint128 number.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number from its binary representation.\n *\n * The BCS layout for \"uint256\" consists of thirty-two bytes in little-endian format.\n *\n * @returns {BigInt} The deserialized uint256 number.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * This function is used for interpreting lengths of variable-length sequences and tags of enum values in BCS encoding.\n *\n * @throws {Error} Throws an error if the parsed value exceeds the maximum uint32 number.\n * @returns {number} The deserialized uint32 value.\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @returns An array of deserialized values of type T.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"yCAsCO,IAAMA,EAAN,KAAmB,CAWxB,YAAYC,EAAkB,CAE5B,KAAK,OAAS,IAAI,YAAYA,EAAK,MAAM,EACzC,IAAI,WAAW,KAAK,MAAM,EAAE,IAAIA,EAAM,CAAC,EACvC,KAAK,OAAS,CAChB,CAQQ,KAAKC,EAA6B,CACxC,GAAI,KAAK,OAASA,EAAS,KAAK,OAAO,WACrC,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EAAQ,KAAK,OAAO,MAAM,KAAK,OAAQ,KAAK,OAASD,CAAM,EACjE,YAAK,QAAUA,EACRC,CACT,CASA,WAAoB,CAClB,OAAO,KAAK,OAAO,WAAa,KAAK,MACvC,CAgBA,gBAAyB,CACvB,IAAMC,EAAQ,KAAK,iBAAiB,EAEpC,OADoB,IAAI,YAAY,EACjB,OAAOA,CAAK,CACjC,CA0CA,kBACEC,EACAC,EACqC,CAErC,GADe,KAAK,gBAAgB,EAGpC,IAAID,IAAS,SACX,OAAO,KAAK,eAAe,EAE7B,GAAIA,IAAS,QACX,OAAO,KAAK,iBAAiB,EAE/B,GAAIA,IAAS,aAAc,CACzB,GAAIC,IAAQ,OACV,MAAM,IAAI,MAAM,iCAAiC,EAEnD,OAAO,KAAK,sBAAsBA,CAAG,CACvC,CAEA,OAAO,KAAK,YAAYD,CAAI,EAC9B,CAUA,kBAA+B,CAC7B,IAAMC,EAAM,KAAK,wBAAwB,EACzC,OAAO,IAAI,WAAW,KAAK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,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAOP,CAAK,CACrB,CAeA,YAAeS,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAwBA,kBAAqBA,EAAkC,CACrD,IAAMX,EAAS,KAAK,wBAAwB,EACtCY,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIb,EAAQa,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYD,CAAG,CAAC,EAEnC,OAAOC,CACT,CACF","names":["Deserializer","data","length","bytes","value","type","len","bool","low","high","shift","MAX_U32_NUMBER","byte","cls","vector","i"]}
@@ -1,2 +0,0 @@
1
- import{a as p}from"./chunk-5B3SMBXQ.mjs";import{a as u}from"./chunk-AVZYJAXR.mjs";import{a as f}from"./chunk-MHN6XY4Z.mjs";import{a as v}from"./chunk-4O5XDQDO.mjs";import{e as h,j as d}from"./chunk-OIOGOW6I.mjs";import{a as g}from"./chunk-AJ5JHBAE.mjs";import{b as a}from"./chunk-SPRNSFUV.mjs";import{sha3_256 as H}from"@noble/hashes/sha3";import{secp256k1 as o}from"@noble/curves/secp256k1";import{HDKey as K}from"@scure/bip32";var n=class n extends f{constructor(e){super();let t=a.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`PublicKey length should be ${n.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:i}=e,l=p(t),c=a.fromHexInput(l).toUint8Array(),x=H(c),A=i.toUint8Array();return o.verify(A,x,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new y(t)}static deserialize(e){let t=e.deserializeBytes();return new n(t)}static isPublicKey(e){return e instanceof n}static isInstance(e){return"key"in e&&e.key?.data?.length===n.LENGTH}};n.LENGTH=65;var m=n,r=class r extends g{constructor(e,t){super();let i=u.parseHexInput(e,"secp256k1",t);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.key=i}static generate(){let e=o.utils.randomPrivateKey();return new r(e,!1)}static fromDerivationPath(e,t){if(!h(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,d(t))}static fromDerivationPathInner(e,t){let{privateKey:i}=K.fromMasterSeed(t).derive(e);if(i===null)throw new Error("Invalid key");return new r(i,!1)}sign(e){let t=p(e),i=a.fromHexInput(t),l=H(i.toUint8Array()),c=o.sign(l,this.key.toUint8Array(),{lowS:!0});return new y(c.toCompactRawBytes())}publicKey(){let e=o.getPublicKey(this.key.toUint8Array(),!1);return new m(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.key.toString()}toAIP80String(){return u.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new r(t,!1)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32;var S=r,s=class s extends v{constructor(e){super();let t=a.fromHexInput(e);if(t.toUint8Array().length!==s.LENGTH)throw new Error(`Signature length should be ${s.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new s(t)}};s.LENGTH=64;var y=s;export{m as a,S as b,y as c};
2
- //# sourceMappingURL=chunk-KUL55M2H.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/core/crypto/secp256k1.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 } from \"@noble/hashes/sha3\";\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\nimport { HDKey } from \"@scure/bip32\";\nimport { Serializable, Deserializer, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport { HexInput, PrivateKeyVariants } from \"../../types\";\nimport { isValidBIP44Path, mnemonicToSeed } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * Represents a Secp256k1 ECDSA public key.\n *\n * @extends PublicKey\n * @property LENGTH - The length of the Secp256k1 public key in bytes.\n */\nexport class Secp256k1PublicKey extends PublicKey {\n // Secp256k1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.\n static readonly LENGTH: number = 65;\n\n // Hex value of the public key\n private readonly key: Hex;\n\n /**\n * Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array.\n * This constructor validates the length of the provided signature data.\n *\n * @param hexInput - A HexInput (string or Uint8Array) representing the signature data.\n * @throws Error if the length of the signature data is not equal to Secp256k1Signature.LENGTH.\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Secp256k1PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Secp256k1PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region PublicKey\n /**\n * Verifies a Secp256k1 signature against the public key.\n *\n * This function checks the validity of a signature for a given message, ensuring that the signature is canonical as a malleability check.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify against the public key.\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const messageSha3Bytes = sha3_256(messageBytes);\n const signatureBytes = signature.toUint8Array();\n return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array(), { lowS: true });\n }\n\n /**\n * Get the data as a Uint8Array representation.\n *\n * @returns Uint8Array representation of the data.\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256k1Signature from the provided deserializer.\n * This function allows you to reconstruct a Secp256k1Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n // eslint-disable-next-line class-methods-use-this\n deserialize(deserializer: Deserializer) {\n const hex = deserializer.deserializeBytes();\n return new Secp256k1Signature(hex);\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256k1PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Secp256k1PublicKey.\n *\n * @deprecated use `instanceof Secp256k1PublicKey` instead\n * @param publicKey - The public key to check.\n */\n static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey {\n return publicKey instanceof Secp256k1PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid instance of a Secp256k1 public key.\n * This function checks for the presence of a \"key\" property and validates the length of the key data.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Secp256k1 public key.\n */\n static isInstance(publicKey: PublicKey): publicKey is Secp256k1PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Secp256k1PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents a Secp256k1 ECDSA private key, providing functionality to create, sign messages,\n * derive public keys, and serialize/deserialize the key.\n */\nexport class Secp256k1PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of Secp256k1 ecdsa private key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The private key bytes\n * @private\n */\n private readonly key: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Secp256k1, strict);\n if (privateKeyHex.toUint8Array().length !== Secp256k1PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Secp256k1PrivateKey.LENGTH}`);\n }\n\n this.key = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Secp256k1PrivateKey - A newly generated Secp256k1 private key.\n */\n static generate(): Secp256k1PrivateKey {\n const hexInput = secp256k1.utils.randomPrivateKey();\n return new Secp256k1PrivateKey(hexInput, false);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n *\n * @param path - The BIP44 path to derive the key from.\n * @param mnemonics - The mnemonic seed phrase used for key generation.\n *\n * @returns The generated private key.\n *\n * @throws Error if the provided path is not a valid BIP44 path.\n */\n static fromDerivationPath(path: string, mnemonics: string): Secp256k1PrivateKey {\n if (!isValidBIP44Path(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Secp256k1PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a private key from a specified BIP44 path using a given seed.\n * This function is essential for generating keys that follow the hierarchical deterministic (HD) wallet structure.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param seed - The seed phrase created by the mnemonics, represented as a Uint8Array.\n * @returns The generated private key as an instance of Secp256k1PrivateKey.\n * @throws Error if the derived private key is invalid.\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array): Secp256k1PrivateKey {\n const { privateKey } = HDKey.fromMasterSeed(seed).derive(path);\n // library returns privateKey as Uint8Array | null\n if (privateKey === null) {\n throw new Error(\"Invalid key\");\n }\n\n return new Secp256k1PrivateKey(privateKey, false);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Sign the given message with the private key.\n * This function generates a cryptographic signature for the provided message, ensuring the signature is canonical and non-malleable.\n *\n * @param message - A message in HexInput format to be signed.\n * @returns Signature - The generated signature for the provided message.\n */\n sign(message: HexInput): Secp256k1Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign);\n const messageHashBytes = sha3_256(messageBytes.toUint8Array());\n const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array(), { lowS: true });\n return new Secp256k1Signature(signature.toCompactRawBytes());\n }\n\n /**\n * Derive the Secp256k1PublicKey from this private key.\n *\n * @returns Secp256k1PublicKey The derived public key.\n */\n publicKey(): Secp256k1PublicKey {\n const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);\n return new Secp256k1PublicKey(bytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the private key as a string representation.\n *\n * @returns string representation of the private key\n */\n toString(): string {\n return this.toHexString();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toHexString(): string {\n return this.key.toString();\n }\n\n /**\n * Get the private key as a AIP-80 compliant hex string.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @returns AIP-80 compliant string representation of the private key.\n */\n toAIP80String(): string {\n return PrivateKey.formatPrivateKey(this.key.toString(), PrivateKeyVariants.Secp256k1);\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256k1PrivateKey(bytes, false);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Secp256k1PrivateKey.\n *\n * @param privateKey - The private key to be checked.\n *\n * @deprecated use `instanceof Secp256k1PrivateKey` instead\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey {\n return privateKey instanceof Secp256k1PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using a Secp256k1 ECDSA private key.\n *\n */\nexport class Secp256k1Signature extends Signature {\n /**\n * Secp256k1 ecdsa signatures are 256-bit or 64 bytes\n * @readonly\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n */\n private readonly data: Hex;\n\n // region Constructors\n\n /**\n * Create a new Signature instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Secp256k1Signature.LENGTH) {\n throw new Error(\n `Signature length should be ${Secp256k1Signature.LENGTH}, received ${data.toUint8Array().length}`,\n );\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1Signature {\n const hex = deserializer.deserializeBytes();\n return new Secp256k1Signature(hex);\n }\n\n // endregion\n}\n"],"mappings":"sSAGA,OAAS,YAAAA,MAAgB,qBACzB,OAAS,aAAAC,MAAiB,0BAC1B,OAAS,SAAAC,MAAa,eAgBf,IAAMC,EAAN,MAAMA,UAA2BC,CAAU,CAchD,YAAYC,EAAoB,CAC9B,MAAM,EAEN,IAAMC,EAAMC,EAAI,aAAaF,CAAQ,EACrC,GAAIC,EAAI,aAAa,EAAE,SAAWH,EAAmB,OACnD,MAAM,IAAI,MAAM,8BAA8BA,EAAmB,MAAM,EAAE,EAE3E,KAAK,IAAMG,CACb,CAYA,gBAAgBE,EAAoC,CAClD,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EACzBG,EAAkBC,EAAsBH,CAAO,EAC/CI,EAAeN,EAAI,aAAaI,CAAe,EAAE,aAAa,EAC9DG,EAAmBC,EAASF,CAAY,EACxCG,EAAiBN,EAAU,aAAa,EAC9C,OAAOO,EAAU,OAAOD,EAAgBF,EAAkB,KAAK,I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jG,EAEF,KAAK,KAAOA,CACd,CAMA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CAMA,UAAUvB,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMb,EAAMa,EAAa,iBAAiB,EAC1C,OAAO,IAAIoB,EAAmBjC,CAAG,CACnC,CAGF,EArDaiC,EAKK,OAAS,GALpB,IAAMnB,EAANmB","names":["sha3_256","secp256k1","HDKey","_Secp256k1PublicKey","PublicKey","hexInput","hex","Hex","args","message","signature","messageToVerify","convertSigningMessage","messageBytes","messageSha3Bytes","sha3_256","signatureBytes","secp256k1","serializer","deserializer","Secp256k1Signature","bytes","publicKey","Secp256k1PublicKey","_Secp256k1PrivateKey","Serializable","strict","privateKeyHex","PrivateKey","path","mnemonics","isValidBIP44Path","mnemonicToSeed","seed","privateKey","HDKey","messageToSign","messageHashBytes","Secp256k1PrivateKey","_Secp256k1Signature","Signature","data"]}
@@ -1,2 +0,0 @@
1
- import{a as t}from"./chunk-7RYYUO4V.mjs";import{a as i}from"./chunk-2OF44LP4.mjs";import{e as a}from"./chunk-QCUXDDCU.mjs";import{a as r}from"./chunk-O4MRRWRI.mjs";import{c as e}from"./chunk-A3USS2NC.mjs";import{a as o}from"./chunk-D52UKPQF.mjs";var s=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async scriptComposer(n){let p=(await n.builder(new i(this.config))).build(),c=await a({aptosConfig:this.config,payload:e.load(new o(p)),...n});return new r(c)}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{s as a};
2
- //# sourceMappingURL=chunk-MPEPVGWG.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/api/transactionSubmission/build.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddressInput } from \"../../core\";\nimport { generateTransaction } from \"../../internal/transactionSubmission\";\nimport {\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionOptions,\n AptosScriptComposer,\n TransactionPayloadScript,\n generateRawTransaction,\n} from \"../../transactions\";\nimport { MultiAgentTransaction } from \"../../transactions/instances/multiAgentTransaction\";\nimport { SimpleTransaction } from \"../../transactions/instances/simpleTransaction\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { Deserializer } from \"../../bcs\";\n\n/**\n * A class to handle all `Build` transaction operations.\n */\nexport class Build {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n * @param config.account - The account details for authentication.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\", // specify the node URL\n * });\n *\n * // Initialize the Aptos client\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Build a simple transaction.\n *\n * This function allows you to create a transaction with specified sender and data.\n *\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a simple transaction\n * const transaction = await aptos.transaction.simple({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async simple(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Build a transaction from a series of Move calls.\n *\n * This function allows you to create a transaction with a list of Move calls.\n *\n * Right now we only tested this logic with single signer and we will add support\n * for mutli agent transactions if needed.\n *\n * @param args.sender - The sender account address.\n * @param args.builder - The closure to construct the list of calls.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns SimpleTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a transaction from a chained series of Move calls.\n * const transaction = await aptos.transaction.script_composer({\n * sender: \"0x1\", // replace with a real sender account address\n * builder: builder: async (builder) => {\n * const coin = await builder.addBatchedCalls({\n * function: \"0x1::coin::withdraw\",\n * functionArguments: [CallArgument.new_signer(0), 1],\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * });\n *\n * // Pass the returned value from the first function call to the second call\n * const fungibleAsset = await builder.addBatchedCalls({\n * function: \"0x1::coin::coin_to_fungible_asset\",\n * functionArguments: [coin[0]],\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * });\n *\n * await builder.addBatchedCalls({\n * function: \"0x1::primary_fungible_store::deposit\",\n * functionArguments: [singleSignerED25519SenderAccount.accountAddress, fungibleAsset[0]],\n * typeArguments: [],\n * });\n * return builder;\n * },\n * options: {\n * gasUnitPrice: 100, // specify your own gas unit price if needed\n * maxGasAmount: 1000, // specify your own max gas amount if needed\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async scriptComposer(args: {\n sender: AccountAddressInput;\n builder: (builder: AptosScriptComposer) => Promise<AptosScriptComposer>;\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<SimpleTransaction> {\n const builder = await args.builder(new AptosScriptComposer(this.config));\n const bytes = builder.build();\n const rawTxn = await generateRawTransaction({\n aptosConfig: this.config,\n payload: TransactionPayloadScript.load(new Deserializer(bytes)),\n ...args,\n });\n return new SimpleTransaction(rawTxn);\n }\n\n /**\n * Build a multi-agent transaction that allows multiple signers to authorize a transaction.\n *\n * @param args - The parameters for creating the multi-agent transaction.\n * @param args.sender - The sender account address.\n * @param args.data - The transaction data.\n * @param args.secondarySignerAddresses - An array of the secondary signers' account addresses.\n * @param args.options - Optional transaction configurations.\n * @param args.withFeePayer - Whether there is a fee payer for the transaction.\n *\n * @returns MultiAgentTransaction\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Build a multi-agent transaction\n * const transaction = await aptos.multiAgent({\n * sender: \"0x1\", // replace with a real sender account address\n * data: {\n * // Transaction data structure\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [\"0x2\", 100], // replace with a real destination account address and amount\n * },\n * secondarySignerAddresses: [\"0x3\", \"0x4\"], // replace with real secondary signer addresses\n * options: {\n * // Optional transaction configurations\n * maxGasAmount: \"1000\",\n * gasUnitPrice: \"1\",\n * },\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async multiAgent(args: {\n sender: AccountAddressInput;\n data: InputGenerateTransactionPayloadData;\n secondarySignerAddresses: AccountAddressInput[];\n options?: InputGenerateTransactionOptions;\n withFeePayer?: boolean;\n }): Promise<MultiAgentTransaction> {\n return generateTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"sPAoBO,IAAMA,EAAN,KAAY,CA+BjB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAwCA,MAAM,OAAOC,EAKkB,CAC7B,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CA4DA,MAAM,eAAeA,EAKU,CAE7B,IAAME,GADU,MAAMF,EAAK,QAAQ,IAAIG,EAAoB,KAAK,MAAM,CAAC,GACjD,MAAM,EACtBC,EAAS,MAAMC,EAAuB,CAC1C,YAAa,KAAK,OAClB,QAASC,EAAyB,KAAK,IAAIC,EAAaL,CAAK,CAAC,EAC9D,GAAGF,CACL,CAAC,EACD,OAAO,IAAIQ,EAAkBJ,CAAM,CACrC,CA2CA,MAAM,WAAWJ,EAMkB,CACjC,OAAOC,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAClE,CACF","names":["Build","config","args","generateTransaction","bytes","AptosScriptComposer","rawTxn","generateRawTransaction","TransactionPayloadScript","Deserializer","SimpleTransaction"]}
@@ -1,2 +0,0 @@
1
- import{a as k,b as y,d as g,e as w,f as z,g as D,h as L,i as d,j as R,l as X,m as q,n as H,o as J,p as K,q as Q,s as i,t as W}from"./chunk-5O3RHPER.mjs";import{c as l}from"./chunk-AOROYJ74.mjs";import{c as j}from"./chunk-MWWYVW65.mjs";import{b as C,c as x,d as a,e as M,f as _,g as O,h as V,i as G,n as P}from"./chunk-T6ADNZE5.mjs";import{b as m}from"./chunk-JNO7KPMG.mjs";import{a as T,c as I,d as f}from"./chunk-Q3CWUEXI.mjs";import{a as A,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-42H7WETG.mjs";import{a as p}from"./chunk-3OLFJ65O.mjs";var Y=new TextEncoder;function yn(n){return n?.map(e=>y(e)?l(e):e)??[]}async function B(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(s=>s.name===t)}async function Tn(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let s=[];for(let c=0;c<r.params.length;c+=1)s.push(l(r.params[c],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s}}async function ln(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let s=W(r),c=[];for(let o=s;o<r.params.length;o+=1)c.push(l(r.params[o],{allowGenerics:!0}));return{signers:s,typeParameters:r.generic_type_params,parameters:c}}async function An(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let s=[];for(let o=0;o<r.params.length;o+=1)s.push(l(r.params[o],{allowGenerics:!0}));let c=[];for(let o=0;o<r.return.length;o+=1)c.push(l(r.return[o],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s,returnTypes:c}}function gn(n,e,t,u,r){return n instanceof p?n:p.new_bytes(Z(e,t,n,u,r).bcsToBytes())}function Z(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let s=e.parameters[u];return U(t,s,u,r)}function U(n,e,t,u){return D(n)?(h(e,n,t),n):N(n,e,t,u)}function N(n,e,t,u){if(e.isBool()){if(k(n))return new A(n);if(y(n)){if(n==="true")return new A(!0);if(n==="false")return new A(!1)}i("boolean",t)}if(e.isAddress()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=g(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU16()){let r=g(n);if(r!==void 0)return new v(r);i("number | string",t)}if(e.isU32()){let r=g(n);if(r!==void 0)return new b(r);i("number | string",t)}if(e.isU64()){if(w(n))return new F(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(w(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(w(n))return new S(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return U(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(y(n))return T.U8(Y.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(r=>U(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(y(n))return new I(n);i("string",t)}if(e.isObject()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(z(n)){let r=e.value.typeArgs[0];return r instanceof C?new f(null):r instanceof G?new f(null):r instanceof x?new f(null):r instanceof a?new f(null):r instanceof M?new f(null):r instanceof _?new f(null):r instanceof O?new f(null):r instanceof V?new f(null):new f(null)}return new f(U(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function h(n,e,t){if(n.isBool()){if(L(e))return;i("Bool",t)}if(n.isAddress()){if(d(e))return;i("AccountAddress",t)}if(n.isU8()){if(X(e))return;i("U8",t)}if(n.isU16()){if(q(e))return;i("U16",t)}if(n.isU32()){if(H(e))return;i("U32",t)}if(n.isU64()){if(J(e))return;i("U64",t)}if(n.isU128()){if(K(e))return;i("U128",t)}if(n.isU256()){if(Q(e))return;i("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&h(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof P){if(n.isString()){if(R(e))return;i("MoveString",t)}if(n.isObject()){if(d(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof f){e.value!==void 0&&h(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{yn as a,B as b,Tn as c,ln as d,An as e,gn as f,Z as g,U as h};
2
- //# sourceMappingURL=chunk-TIKXNQYC.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/account\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { CallArgument, MoveFunction } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n // This fetch from the API is currently cached\n const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n\n if (module.abi) {\n return module.abi.exposed_functions.find((func) => func.name === functionName);\n }\n\n return undefined;\n}\n\n/**\n * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n */\nexport async function fetchMoveFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<FunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n if (!functionAbi) {\n throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a entry function argument into CallArgument, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param argument - The argument to be converted, which can be of various types. If the argument is already\n * CallArgument returned from TransactionComposer it would be returned immediately.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertCallArgument(\n argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n functionName: string,\n functionAbi: FunctionABI,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): CallArgument {\n if (argument instanceof CallArgument) {\n return argument;\n }\n return CallArgument.new_bytes(\n convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),\n );\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertArgument(\n functionName: string,\n functionAbi: FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // Ensure not too many arguments\n if (position >= functionAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);\n }\n\n const param = functionAbi.parameters[position];\n return checkOrConvertArgument(arg, param, position, genericTypeParams);\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n */\n throwTypeMismatch(\"boolean\", position);\n }\n // TODO: support uint8array?\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);\n}\n"],"mappings":"wiBAiDA,IAAMA,EAAe,IAAI,YAQlB,SAASC,GAAoBC,EAAqD,CACvF,OACEA,GAAe,IAAKC,GAEdC,EAASD,CAAO,EACXE,EAAaF,CAAO,EAEtBA,CACR,GAAK,CAAC,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AIqC,EAAStC,CAAG,EACd,OAEFQ,EAAkB,MAAOZ,CAAQ,CACnC,CACA,GAAIK,EAAM,MAAM,EAAG,CACjB,GAAIsC,EAASvC,CAAG,EACd,OAEFQ,EAAkB,MAAOZ,CAAQ,CACnC,CACA,GAAIK,EAAM,OAAO,EAAG,CAClB,GAAIuC,EAAUxC,CAAG,EACf,OAEFQ,EAAkB,OAAQZ,CAAQ,CACpC,CACA,GAAIK,EAAM,OAAO,EAAG,CAClB,GAAIwC,EAAUzC,CAAG,EACf,OAEFQ,EAAkB,OAAQZ,CAAQ,CACpC,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAeoB,EAAY,CAGzBpB,EAAI,OAAO,OAAS,GACtBI,EAAUH,EAAM,MAAOD,EAAI,OAAO,CAAC,EAAGJ,CAAQ,EAGhD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CAGA,GAAIK,aAAiByC,EAAe,CAClC,GAAIzC,EAAM,SAAS,EAAG,CACpB,GAAI0C,EAAY3C,CAAG,EACjB,OAEFQ,EAAkB,aAAcZ,CAAQ,CAC1C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAIkC,EAAanC,CAAG,EAClB,OAEFQ,EAAkB,iBAAkBZ,CAAQ,CAC9C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAe0B,EAAY,CAEzB1B,EAAI,QAAU,QAChBI,EAAUH,EAAM,MAAM,SAAS,CAAC,EAAGD,EAAI,MAAOJ,CAAQ,EAExD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CACF,CAEA,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeK,EAAM,SAAS,CAAC,GAAG,CAC1F","names":["TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","isString","parseTypeTag","fetchFunctionAbi","moduleAddress","moduleName","functionName","aptosConfig","module","getModule","func","fetchMoveFunctionAbi","functionAbi","params","i","fetchEntryFunctionAbi","numSigners","findFirstNonSignerArg","fetchViewFunctionAbi","returnTypes","convertCallArgument","argument","position","genericTypeParams","CallArgument","convertArgument","arg","param","checkOrConvertArgument","isEncodedEntryFunctionArgument","checkType","parseArg","isBool","Bool","throwTypeMismatch","AccountAddress","num","convertNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isEmptyOption","innerParam","TypeTagBool","MoveOption","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
@@ -1 +0,0 @@
1
- //# sourceMappingURL=chunk-UIRAXHDH.mjs.map
@@ -1,2 +0,0 @@
1
- import{a as e}from"./chunk-D52UKPQF.mjs";function t(i,r){let l=r.bcsToBytes(),a=new e(l);return i.deserialize(a)}export{t as a};
2
- //# sourceMappingURL=chunk-UZTJWOLS.mjs.map