@aptos-labs/ts-sdk 1.33.2-sc.0 → 1.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (352) hide show
  1. package/dist/common/{accountAddress-Cf1amU98.d.ts → accountAddress-CDtCLtJA.d.ts} +3 -2
  2. package/dist/common/chunk-ZYPBABLQ.js +4 -0
  3. package/dist/common/chunk-ZYPBABLQ.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +2489 -2235
  8. package/dist/common/index.js +33 -35
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  11. package/dist/esm/account/AbstractedAccount.d.mts +91 -0
  12. package/dist/esm/account/AbstractedAccount.mjs +2 -0
  13. package/dist/esm/account/Account.mjs +1 -1
  14. package/dist/esm/account/AccountUtils.d.mts +16 -16
  15. package/dist/esm/account/AccountUtils.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.mjs +1 -1
  17. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  18. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  19. package/dist/esm/account/KeylessAccount.mjs +1 -1
  20. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  21. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  22. package/dist/esm/account/index.d.mts +2 -0
  23. package/dist/esm/account/index.mjs +1 -1
  24. package/dist/esm/account/utils.mjs +1 -1
  25. package/dist/esm/api/account/abstraction.d.mts +209 -0
  26. package/dist/esm/api/account/abstraction.mjs +2 -0
  27. package/dist/esm/api/account/abstraction.mjs.map +1 -0
  28. package/dist/esm/api/account.d.mts +2 -0
  29. package/dist/esm/api/account.mjs +1 -1
  30. package/dist/esm/api/ans.mjs +1 -1
  31. package/dist/esm/api/aptos.d.mts +1 -0
  32. package/dist/esm/api/aptos.mjs +1 -1
  33. package/dist/esm/api/coin.mjs +1 -1
  34. package/dist/esm/api/digitalAsset.mjs +1 -1
  35. package/dist/esm/api/event.mjs +1 -1
  36. package/dist/esm/api/faucet.mjs +1 -1
  37. package/dist/esm/api/fungibleAsset.mjs +1 -1
  38. package/dist/esm/api/general.mjs +1 -1
  39. package/dist/esm/api/index.d.mts +1 -0
  40. package/dist/esm/api/index.mjs +1 -1
  41. package/dist/esm/api/keyless.d.mts +1 -1
  42. package/dist/esm/api/keyless.mjs +1 -1
  43. package/dist/esm/api/object.mjs +1 -1
  44. package/dist/esm/api/staking.mjs +1 -1
  45. package/dist/esm/api/table.mjs +1 -1
  46. package/dist/esm/api/transaction.mjs +1 -1
  47. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  48. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  49. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  50. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  51. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  52. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  53. package/dist/esm/api/utils.mjs +1 -1
  54. package/dist/esm/bcs/index.mjs +1 -1
  55. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  56. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  57. package/dist/esm/{chunk-CYMVZJHC.mjs → chunk-2FNFUTFJ.mjs} +2 -2
  58. package/dist/esm/{chunk-4UYVRG5Z.mjs → chunk-2GIPNLDO.mjs} +2 -2
  59. package/dist/esm/{chunk-UQ7D5CSM.mjs → chunk-33CBJFX2.mjs} +2 -2
  60. package/dist/esm/{chunk-P54RNN4V.mjs → chunk-3EY7MT2M.mjs} +2 -2
  61. package/dist/esm/{chunk-KPLWOVKG.mjs → chunk-3HFZN7L5.mjs} +2 -2
  62. package/dist/esm/chunk-42T3UGSW.mjs +2 -0
  63. package/dist/esm/chunk-42T3UGSW.mjs.map +1 -0
  64. package/dist/esm/chunk-4776UXL6.mjs +2 -0
  65. package/dist/esm/chunk-4776UXL6.mjs.map +1 -0
  66. package/dist/esm/{chunk-FC2IYWI7.mjs → chunk-4T75XRI2.mjs} +2 -2
  67. package/dist/esm/{chunk-EBS4BKER.mjs → chunk-4UK4MUSD.mjs} +2 -2
  68. package/dist/esm/{chunk-GL4OJVYH.mjs → chunk-5BSMF22B.mjs} +2 -2
  69. package/dist/esm/chunk-66HHRRIX.mjs +2 -0
  70. package/dist/esm/chunk-66HHRRIX.mjs.map +1 -0
  71. package/dist/esm/{chunk-CDYLZDD2.mjs → chunk-6JTNS5O6.mjs} +2 -2
  72. package/dist/esm/{chunk-UF6SI2QE.mjs → chunk-6LGXFXXR.mjs} +2 -2
  73. package/dist/esm/{chunk-T6NQDM7D.mjs → chunk-6PBMD2BQ.mjs} +2 -2
  74. package/dist/esm/chunk-7C2RDOWS.mjs +1 -0
  75. package/dist/esm/chunk-7C2RDOWS.mjs.map +1 -0
  76. package/dist/esm/{chunk-ECZYQTNN.mjs → chunk-7CYCKCVU.mjs} +2 -2
  77. package/dist/esm/chunk-7DPHPPMG.mjs +2 -0
  78. package/dist/esm/chunk-7DPHPPMG.mjs.map +1 -0
  79. package/dist/esm/chunk-ABXES4FS.mjs +2 -0
  80. package/dist/esm/chunk-ABXES4FS.mjs.map +1 -0
  81. package/dist/esm/{chunk-A3NEASNH.mjs → chunk-AC3BISWL.mjs} +2 -2
  82. package/dist/esm/chunk-BBUN4IO4.mjs +2 -0
  83. package/dist/esm/chunk-BBUN4IO4.mjs.map +1 -0
  84. package/dist/esm/{chunk-QHEKBHNU.mjs → chunk-BUTMGMSD.mjs} +2 -2
  85. package/dist/esm/{chunk-P4VF7BN4.mjs → chunk-BYHCW7MI.mjs} +2 -2
  86. package/dist/esm/{chunk-AD3A7DTH.mjs → chunk-CRFLR3ZY.mjs} +2 -2
  87. package/dist/esm/{chunk-CWRANLXZ.mjs → chunk-CSG67JHZ.mjs} +2 -2
  88. package/dist/esm/chunk-CSG67JHZ.mjs.map +1 -0
  89. package/dist/esm/{chunk-BFIXIXHO.mjs → chunk-CXNF73OX.mjs} +2 -2
  90. package/dist/esm/{chunk-32WLD3F3.mjs → chunk-D6T3NYOA.mjs} +2 -2
  91. package/dist/esm/chunk-DBIZE7G6.mjs +2 -0
  92. package/dist/esm/chunk-DBIZE7G6.mjs.map +1 -0
  93. package/dist/esm/{chunk-CGTHWGSJ.mjs → chunk-DLLDRANJ.mjs} +2 -2
  94. package/dist/esm/{chunk-KFGXOZ77.mjs → chunk-DMS7K76O.mjs} +2 -2
  95. package/dist/esm/{chunk-KNTAED2Z.mjs → chunk-DNJQWGB7.mjs} +2 -2
  96. package/dist/esm/{chunk-NW2WUKWV.mjs → chunk-DNWFDS7F.mjs} +2 -2
  97. package/dist/esm/{chunk-XIFIACCB.mjs → chunk-DWJ3PGWE.mjs} +2 -2
  98. package/dist/esm/chunk-EGZI6EJ2.mjs +2 -0
  99. package/dist/esm/chunk-EGZI6EJ2.mjs.map +1 -0
  100. package/dist/esm/chunk-EY2JUXEC.mjs +2 -0
  101. package/dist/esm/{chunk-AIABPCUF.mjs.map → chunk-EY2JUXEC.mjs.map} +1 -1
  102. package/dist/esm/{chunk-KG23XFU2.mjs → chunk-G6RLN6ET.mjs} +2 -2
  103. package/dist/esm/{chunk-G5ZWH5T3.mjs → chunk-GQX5KMF7.mjs} +2 -2
  104. package/dist/esm/{chunk-X3SO2LDX.mjs → chunk-H4GZWYIG.mjs} +2 -2
  105. package/dist/esm/chunk-HEAWDTLG.mjs +2 -0
  106. package/dist/esm/{chunk-XHPWHA6B.mjs.map → chunk-HEAWDTLG.mjs.map} +1 -1
  107. package/dist/esm/{chunk-SQR3AIY7.mjs → chunk-HFCWJ6QL.mjs} +2 -2
  108. package/dist/esm/{chunk-FQECACH3.mjs → chunk-HL2O3T57.mjs} +2 -2
  109. package/dist/esm/chunk-HLJE5XGE.mjs +2 -0
  110. package/dist/esm/chunk-HLJE5XGE.mjs.map +1 -0
  111. package/dist/esm/{chunk-PTS3BTOU.mjs → chunk-HT2WC3QV.mjs} +2 -2
  112. package/dist/esm/{chunk-ODEDSSQL.mjs → chunk-I7YHK6ZF.mjs} +2 -2
  113. package/dist/esm/{chunk-N4VVDQA5.mjs → chunk-IDTLNF4M.mjs} +2 -2
  114. package/dist/esm/chunk-IMTC3J2M.mjs +2 -0
  115. package/dist/esm/chunk-IMTC3J2M.mjs.map +1 -0
  116. package/dist/esm/{chunk-67ZANQ3R.mjs → chunk-J7HRQ2IH.mjs} +2 -2
  117. package/dist/esm/{chunk-H3XZ3FZY.mjs → chunk-JF66JS2R.mjs} +2 -2
  118. package/dist/esm/{chunk-I7JGKVOC.mjs → chunk-KEJAUCQF.mjs} +2 -2
  119. package/dist/esm/{chunk-Y6QTKAQO.mjs → chunk-L2AQG3G3.mjs} +2 -2
  120. package/dist/esm/{chunk-7HLNV3QL.mjs → chunk-L6FONDPA.mjs} +2 -2
  121. package/dist/esm/{chunk-ZJNPBHEI.mjs → chunk-N7C6LQPZ.mjs} +2 -2
  122. package/dist/esm/{chunk-VZELORLW.mjs → chunk-O37BZP2G.mjs} +2 -2
  123. package/dist/esm/{chunk-SOLQ5VON.mjs → chunk-OURSLL3I.mjs} +2 -2
  124. package/dist/esm/{chunk-PHJRCZQ3.mjs → chunk-P7SE5LQE.mjs} +2 -2
  125. package/dist/esm/{chunk-3XH3NNSR.mjs → chunk-PNSF3E67.mjs} +2 -2
  126. package/dist/esm/{chunk-UONSJQUV.mjs → chunk-PR3W2QEH.mjs} +2 -2
  127. package/dist/esm/{chunk-KFCLSJC3.mjs → chunk-PWYJWTEM.mjs} +2 -2
  128. package/dist/esm/{chunk-VCIJX6R4.mjs → chunk-Q7RG7KQS.mjs} +2 -2
  129. package/dist/esm/{chunk-6IIAGMDR.mjs → chunk-QBFGY74I.mjs} +2 -2
  130. package/dist/esm/{chunk-XLFX2YQA.mjs → chunk-S47HA7O7.mjs} +2 -2
  131. package/dist/esm/{chunk-6IPM5P4L.mjs → chunk-SCBYJU6K.mjs} +2 -2
  132. package/dist/esm/chunk-TDGUMBON.mjs +4 -0
  133. package/dist/esm/chunk-TDGUMBON.mjs.map +1 -0
  134. package/dist/esm/{chunk-XGF7UNEW.mjs → chunk-TM6IKHMX.mjs} +2 -2
  135. package/dist/esm/{chunk-FNXO3URE.mjs → chunk-U2SJIG2T.mjs} +2 -2
  136. package/dist/esm/{chunk-SZRZ3HIL.mjs → chunk-ULHOJ2BE.mjs} +2 -2
  137. package/dist/esm/{chunk-4ZJJINCW.mjs → chunk-UTXEW2FT.mjs} +2 -2
  138. package/dist/esm/{chunk-K2CSACQY.mjs → chunk-V2EXS6TM.mjs} +2 -2
  139. package/dist/esm/{chunk-FKJ3GCBI.mjs → chunk-V7G2EDNR.mjs} +2 -2
  140. package/dist/esm/{chunk-R7QOPBWA.mjs → chunk-VKDTI6NX.mjs} +2 -2
  141. package/dist/esm/{chunk-PNDCGNVH.mjs → chunk-VOCI2675.mjs} +2 -2
  142. package/dist/esm/{chunk-VVAKGJDN.mjs → chunk-WXDA4CCR.mjs} +2 -2
  143. package/dist/esm/{chunk-66AQ2MJ6.mjs → chunk-X24PSWCX.mjs} +2 -2
  144. package/dist/esm/chunk-X2CPDUOS.mjs +2 -0
  145. package/dist/esm/chunk-X2CPDUOS.mjs.map +1 -0
  146. package/dist/esm/{chunk-67BUAZ6O.mjs → chunk-X6IHNXWY.mjs} +2 -2
  147. package/dist/esm/{chunk-JJM6ELMS.mjs → chunk-XAPQNCTN.mjs} +2 -2
  148. package/dist/esm/{chunk-DW3ETAZB.mjs → chunk-XDIX7NIP.mjs} +2 -2
  149. package/dist/esm/{chunk-6XHBRRS6.mjs → chunk-XH3BEKII.mjs} +2 -2
  150. package/dist/esm/{chunk-PUNTBVRJ.mjs → chunk-XXHZQFYW.mjs} +2 -2
  151. package/dist/esm/{chunk-YPGI5HAA.mjs → chunk-Y3Y4DVCK.mjs} +2 -2
  152. package/dist/esm/{chunk-CNCRJ56P.mjs → chunk-YIF242TF.mjs} +2 -2
  153. package/dist/esm/{chunk-CWKNJZB6.mjs → chunk-ZCEBDPBJ.mjs} +2 -2
  154. package/dist/esm/{chunk-Q3VS6AEN.mjs → chunk-ZP5EBIBE.mjs} +2 -2
  155. package/dist/esm/cli/index.mjs +1 -1
  156. package/dist/esm/cli/localNode.mjs +1 -1
  157. package/dist/esm/client/core.mjs +1 -1
  158. package/dist/esm/client/get.mjs +1 -1
  159. package/dist/esm/client/index.mjs +1 -1
  160. package/dist/esm/client/post.mjs +1 -1
  161. package/dist/esm/core/account/index.mjs +1 -1
  162. package/dist/esm/core/account/utils/address.mjs +1 -1
  163. package/dist/esm/core/account/utils/index.mjs +1 -1
  164. package/dist/esm/core/accountAddress.mjs +1 -1
  165. package/dist/esm/core/authenticationKey.mjs +1 -1
  166. package/dist/esm/core/crypto/abstraction.d.mts +30 -0
  167. package/dist/esm/core/crypto/abstraction.mjs +2 -0
  168. package/dist/esm/core/crypto/abstraction.mjs.map +1 -0
  169. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  170. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  171. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  172. package/dist/esm/core/crypto/index.mjs +1 -1
  173. package/dist/esm/core/crypto/keyless.mjs +1 -1
  174. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  175. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  176. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  177. package/dist/esm/core/crypto/proof.mjs +1 -1
  178. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  179. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  180. package/dist/esm/core/crypto/signature.mjs +1 -1
  181. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  182. package/dist/esm/core/index.mjs +1 -1
  183. package/dist/esm/errors/index.mjs +1 -1
  184. package/dist/esm/index.d.mts +6 -3
  185. package/dist/esm/index.mjs +1 -1
  186. package/dist/esm/internal/abstraction.d.mts +55 -0
  187. package/dist/esm/internal/abstraction.mjs +2 -0
  188. package/dist/esm/internal/abstraction.mjs.map +1 -0
  189. package/dist/esm/internal/account.mjs +1 -1
  190. package/dist/esm/internal/ans.mjs +1 -1
  191. package/dist/esm/internal/coin.mjs +1 -1
  192. package/dist/esm/internal/digitalAsset.mjs +1 -1
  193. package/dist/esm/internal/event.mjs +1 -1
  194. package/dist/esm/internal/faucet.mjs +1 -1
  195. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  196. package/dist/esm/internal/general.mjs +1 -1
  197. package/dist/esm/internal/keyless.mjs +1 -1
  198. package/dist/esm/internal/object.mjs +1 -1
  199. package/dist/esm/internal/staking.mjs +1 -1
  200. package/dist/esm/internal/table.mjs +1 -1
  201. package/dist/esm/internal/transaction.mjs +1 -1
  202. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  203. package/dist/esm/internal/view.mjs +1 -1
  204. package/dist/esm/transactions/authenticator/account.d.mts +11 -3
  205. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  206. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  207. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  208. package/dist/esm/transactions/authenticator/transaction.d.mts +2 -2
  209. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  210. package/dist/esm/transactions/index.d.mts +2 -2
  211. package/dist/esm/transactions/index.mjs +1 -1
  212. package/dist/esm/transactions/instances/index.mjs +1 -1
  213. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  214. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  215. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  216. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  217. package/dist/esm/transactions/instances/signedTransaction.d.mts +4 -4
  218. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  219. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  220. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  221. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  222. package/dist/esm/transactions/management/index.mjs +1 -1
  223. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  224. package/dist/esm/transactions/scriptComposer/index.d.mts +6 -0
  225. package/dist/esm/transactions/scriptComposer/index.mjs +1 -1
  226. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +2 -17
  227. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  228. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  229. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  230. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  231. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  232. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  233. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  234. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  235. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  236. package/dist/esm/types/abstraction.d.mts +8 -0
  237. package/dist/esm/types/abstraction.mjs +2 -0
  238. package/dist/esm/types/abstraction.mjs.map +1 -0
  239. package/dist/esm/types/index.mjs +1 -1
  240. package/dist/esm/types/types.d.mts +2 -1
  241. package/dist/esm/types/types.mjs +1 -1
  242. package/dist/esm/utils/helpers.d.mts +18 -2
  243. package/dist/esm/utils/helpers.mjs +1 -1
  244. package/dist/esm/utils/index.d.mts +1 -1
  245. package/dist/esm/utils/index.mjs +1 -1
  246. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  247. package/dist/esm/version.d.mts +1 -1
  248. package/dist/esm/version.mjs +1 -1
  249. package/package.json +1 -1
  250. package/src/account/AbstractedAccount.ts +111 -0
  251. package/src/account/index.ts +1 -0
  252. package/src/api/account/abstraction.ts +239 -0
  253. package/src/api/account.ts +6 -1
  254. package/src/api/aptos.ts +3 -0
  255. package/src/core/crypto/abstraction.ts +47 -0
  256. package/src/internal/abstraction.ts +79 -0
  257. package/src/transactions/authenticator/account.ts +52 -1
  258. package/src/transactions/scriptComposer/index.ts +8 -7
  259. package/src/transactions/transactionBuilder/helpers.ts +1 -22
  260. package/src/transactions/transactionBuilder/remoteAbi.ts +7 -0
  261. package/src/transactions/transactionBuilder/transactionBuilder.ts +2 -1
  262. package/src/types/abstraction.ts +6 -0
  263. package/src/types/types.ts +1 -0
  264. package/src/utils/helpers.ts +28 -1
  265. package/src/version.ts +1 -1
  266. package/dist/common/chunk-IHUCZKG2.js +0 -2
  267. package/dist/common/chunk-IHUCZKG2.js.map +0 -1
  268. package/dist/esm/chunk-AIABPCUF.mjs +0 -2
  269. package/dist/esm/chunk-CWRANLXZ.mjs.map +0 -1
  270. package/dist/esm/chunk-DAFSKSZ5.mjs +0 -2
  271. package/dist/esm/chunk-DAFSKSZ5.mjs.map +0 -1
  272. package/dist/esm/chunk-FQXEX2HN.mjs +0 -2
  273. package/dist/esm/chunk-FQXEX2HN.mjs.map +0 -1
  274. package/dist/esm/chunk-GP4TLDVZ.mjs +0 -1
  275. package/dist/esm/chunk-IJ2QKE4W.mjs +0 -2
  276. package/dist/esm/chunk-IJ2QKE4W.mjs.map +0 -1
  277. package/dist/esm/chunk-NDUIXMIA.mjs +0 -2
  278. package/dist/esm/chunk-NDUIXMIA.mjs.map +0 -1
  279. package/dist/esm/chunk-Q2C6ZY5N.mjs +0 -4
  280. package/dist/esm/chunk-Q2C6ZY5N.mjs.map +0 -1
  281. package/dist/esm/chunk-U2PRGW4O.mjs +0 -2
  282. package/dist/esm/chunk-U2PRGW4O.mjs.map +0 -1
  283. package/dist/esm/chunk-UYONA6PP.mjs +0 -2
  284. package/dist/esm/chunk-UYONA6PP.mjs.map +0 -1
  285. package/dist/esm/chunk-XHPWHA6B.mjs +0 -2
  286. /package/dist/esm/{chunk-GP4TLDVZ.mjs.map → account/AbstractedAccount.mjs.map} +0 -0
  287. /package/dist/esm/{chunk-CYMVZJHC.mjs.map → chunk-2FNFUTFJ.mjs.map} +0 -0
  288. /package/dist/esm/{chunk-4UYVRG5Z.mjs.map → chunk-2GIPNLDO.mjs.map} +0 -0
  289. /package/dist/esm/{chunk-UQ7D5CSM.mjs.map → chunk-33CBJFX2.mjs.map} +0 -0
  290. /package/dist/esm/{chunk-P54RNN4V.mjs.map → chunk-3EY7MT2M.mjs.map} +0 -0
  291. /package/dist/esm/{chunk-KPLWOVKG.mjs.map → chunk-3HFZN7L5.mjs.map} +0 -0
  292. /package/dist/esm/{chunk-FC2IYWI7.mjs.map → chunk-4T75XRI2.mjs.map} +0 -0
  293. /package/dist/esm/{chunk-EBS4BKER.mjs.map → chunk-4UK4MUSD.mjs.map} +0 -0
  294. /package/dist/esm/{chunk-GL4OJVYH.mjs.map → chunk-5BSMF22B.mjs.map} +0 -0
  295. /package/dist/esm/{chunk-CDYLZDD2.mjs.map → chunk-6JTNS5O6.mjs.map} +0 -0
  296. /package/dist/esm/{chunk-UF6SI2QE.mjs.map → chunk-6LGXFXXR.mjs.map} +0 -0
  297. /package/dist/esm/{chunk-T6NQDM7D.mjs.map → chunk-6PBMD2BQ.mjs.map} +0 -0
  298. /package/dist/esm/{chunk-ECZYQTNN.mjs.map → chunk-7CYCKCVU.mjs.map} +0 -0
  299. /package/dist/esm/{chunk-A3NEASNH.mjs.map → chunk-AC3BISWL.mjs.map} +0 -0
  300. /package/dist/esm/{chunk-QHEKBHNU.mjs.map → chunk-BUTMGMSD.mjs.map} +0 -0
  301. /package/dist/esm/{chunk-P4VF7BN4.mjs.map → chunk-BYHCW7MI.mjs.map} +0 -0
  302. /package/dist/esm/{chunk-AD3A7DTH.mjs.map → chunk-CRFLR3ZY.mjs.map} +0 -0
  303. /package/dist/esm/{chunk-BFIXIXHO.mjs.map → chunk-CXNF73OX.mjs.map} +0 -0
  304. /package/dist/esm/{chunk-32WLD3F3.mjs.map → chunk-D6T3NYOA.mjs.map} +0 -0
  305. /package/dist/esm/{chunk-CGTHWGSJ.mjs.map → chunk-DLLDRANJ.mjs.map} +0 -0
  306. /package/dist/esm/{chunk-KFGXOZ77.mjs.map → chunk-DMS7K76O.mjs.map} +0 -0
  307. /package/dist/esm/{chunk-KNTAED2Z.mjs.map → chunk-DNJQWGB7.mjs.map} +0 -0
  308. /package/dist/esm/{chunk-NW2WUKWV.mjs.map → chunk-DNWFDS7F.mjs.map} +0 -0
  309. /package/dist/esm/{chunk-XIFIACCB.mjs.map → chunk-DWJ3PGWE.mjs.map} +0 -0
  310. /package/dist/esm/{chunk-KG23XFU2.mjs.map → chunk-G6RLN6ET.mjs.map} +0 -0
  311. /package/dist/esm/{chunk-G5ZWH5T3.mjs.map → chunk-GQX5KMF7.mjs.map} +0 -0
  312. /package/dist/esm/{chunk-X3SO2LDX.mjs.map → chunk-H4GZWYIG.mjs.map} +0 -0
  313. /package/dist/esm/{chunk-SQR3AIY7.mjs.map → chunk-HFCWJ6QL.mjs.map} +0 -0
  314. /package/dist/esm/{chunk-FQECACH3.mjs.map → chunk-HL2O3T57.mjs.map} +0 -0
  315. /package/dist/esm/{chunk-PTS3BTOU.mjs.map → chunk-HT2WC3QV.mjs.map} +0 -0
  316. /package/dist/esm/{chunk-ODEDSSQL.mjs.map → chunk-I7YHK6ZF.mjs.map} +0 -0
  317. /package/dist/esm/{chunk-N4VVDQA5.mjs.map → chunk-IDTLNF4M.mjs.map} +0 -0
  318. /package/dist/esm/{chunk-67ZANQ3R.mjs.map → chunk-J7HRQ2IH.mjs.map} +0 -0
  319. /package/dist/esm/{chunk-H3XZ3FZY.mjs.map → chunk-JF66JS2R.mjs.map} +0 -0
  320. /package/dist/esm/{chunk-I7JGKVOC.mjs.map → chunk-KEJAUCQF.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-Y6QTKAQO.mjs.map → chunk-L2AQG3G3.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-7HLNV3QL.mjs.map → chunk-L6FONDPA.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-ZJNPBHEI.mjs.map → chunk-N7C6LQPZ.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-VZELORLW.mjs.map → chunk-O37BZP2G.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-SOLQ5VON.mjs.map → chunk-OURSLL3I.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-PHJRCZQ3.mjs.map → chunk-P7SE5LQE.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-3XH3NNSR.mjs.map → chunk-PNSF3E67.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-UONSJQUV.mjs.map → chunk-PR3W2QEH.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-KFCLSJC3.mjs.map → chunk-PWYJWTEM.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-VCIJX6R4.mjs.map → chunk-Q7RG7KQS.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-6IIAGMDR.mjs.map → chunk-QBFGY74I.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-XLFX2YQA.mjs.map → chunk-S47HA7O7.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-6IPM5P4L.mjs.map → chunk-SCBYJU6K.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-XGF7UNEW.mjs.map → chunk-TM6IKHMX.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-FNXO3URE.mjs.map → chunk-U2SJIG2T.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-SZRZ3HIL.mjs.map → chunk-ULHOJ2BE.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-4ZJJINCW.mjs.map → chunk-UTXEW2FT.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-K2CSACQY.mjs.map → chunk-V2EXS6TM.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-FKJ3GCBI.mjs.map → chunk-V7G2EDNR.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-R7QOPBWA.mjs.map → chunk-VKDTI6NX.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-PNDCGNVH.mjs.map → chunk-VOCI2675.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-VVAKGJDN.mjs.map → chunk-WXDA4CCR.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-66AQ2MJ6.mjs.map → chunk-X24PSWCX.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-67BUAZ6O.mjs.map → chunk-X6IHNXWY.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-JJM6ELMS.mjs.map → chunk-XAPQNCTN.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-DW3ETAZB.mjs.map → chunk-XDIX7NIP.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-6XHBRRS6.mjs.map → chunk-XH3BEKII.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-PUNTBVRJ.mjs.map → chunk-XXHZQFYW.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-YPGI5HAA.mjs.map → chunk-Y3Y4DVCK.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-CNCRJ56P.mjs.map → chunk-YIF242TF.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-CWKNJZB6.mjs.map → chunk-ZCEBDPBJ.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-Q3VS6AEN.mjs.map → chunk-ZP5EBIBE.mjs.map} +0 -0
@@ -0,0 +1,239 @@
1
+ import { AccountAddress, AccountAddressInput } from "../../core";
2
+ import {
3
+ addAuthenticationFunctionTransaction,
4
+ removeAuthenticationFunctionTransaction,
5
+ removeDispatchableAuthenticatorTransaction,
6
+ } from "../../internal/abstraction";
7
+ import { view } from "../../internal/view";
8
+ import { InputGenerateTransactionOptions, TypeTagAddress } from "../../transactions";
9
+ import { MoveFunctionId } from "../../types";
10
+ import { getFunctionParts } from "../../utils/helpers";
11
+ import { AptosConfig } from "../aptosConfig";
12
+
13
+ export class AccountAbstraction {
14
+ constructor(readonly config: AptosConfig) {}
15
+
16
+ /**
17
+ * Adds a dispatchable authentication function to the account.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const txn = await aptos.abstraction.addAuthenticationFunctionTransaction({
22
+ * accountAddress: alice.accountAddress,
23
+ * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`,
24
+ * });
25
+ *
26
+ * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction});
27
+ * await aptos.waitForTransaction({ transactionHash: txn.hash });
28
+ * ```
29
+ *
30
+ * @param args.accountAddress - The account to add the authentication function to.
31
+ * @param args.authenticationFunction - The authentication function info to add.
32
+ * @param args.options - The options for the transaction.
33
+ * @returns A transaction to add the authentication function to the account.
34
+ */
35
+ public async addAuthenticationFunctionTransaction(args: {
36
+ accountAddress: AccountAddressInput;
37
+ authenticationFunction: string;
38
+ options?: InputGenerateTransactionOptions;
39
+ }) {
40
+ const { accountAddress, authenticationFunction, options } = args;
41
+ return addAuthenticationFunctionTransaction({
42
+ aptosConfig: this.config,
43
+ authenticationFunction,
44
+ sender: accountAddress,
45
+ options,
46
+ });
47
+ }
48
+
49
+ /**
50
+ * Removes a dispatchable authentication function from the account.
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * const txn = await aptos.abstraction.removeAuthenticationFunctionTransaction({
55
+ * accountAddress: alice.accountAddress,
56
+ * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`,
57
+ * });
58
+ *
59
+ * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn });
60
+ * await aptos.waitForTransaction({ transactionHash: txn.hash });
61
+ * ```
62
+ *
63
+ * @param args.accountAddress - The account to remove the authentication function from.
64
+ * @param args.authenticationFunction - The authentication function info to remove.
65
+ * @param args.options - The options for the transaction.
66
+ * @returns A transaction to remove the authentication function from the account.
67
+ */
68
+ public async removeAuthenticationFunctionTransaction(args: {
69
+ accountAddress: AccountAddressInput;
70
+ authenticationFunction: string;
71
+ options?: InputGenerateTransactionOptions;
72
+ }) {
73
+ const { accountAddress, authenticationFunction, options } = args;
74
+ return removeAuthenticationFunctionTransaction({
75
+ aptosConfig: this.config,
76
+ sender: accountAddress,
77
+ authenticationFunction,
78
+ options,
79
+ });
80
+ }
81
+
82
+ /**
83
+ * Removes a dispatchable authenticator from the account.
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const txn = await aptos.abstraction.removeDispatchableAuthenticatorTransaction({
88
+ * accountAddress: alice.accountAddress,
89
+ * });
90
+ *
91
+ * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn });
92
+ * await aptos.waitForTransaction({ transactionHash: txn.hash });
93
+ * ```
94
+ *
95
+ * @param args.accountAddress - The account to remove the authenticator from.
96
+ * @param args.options - The options for the transaction.
97
+ * @returns A transaction to remove the authenticator from the account.
98
+ */
99
+ public async removeDispatchableAuthenticatorTransaction(args: {
100
+ accountAddress: AccountAddressInput;
101
+ options?: InputGenerateTransactionOptions;
102
+ }) {
103
+ const { accountAddress, options } = args;
104
+ return removeDispatchableAuthenticatorTransaction({ aptosConfig: this.config, sender: accountAddress, options });
105
+ }
106
+
107
+ /**
108
+ * Gets the dispatchable authentication function for the account.
109
+ *
110
+ * @example
111
+ * ```ts
112
+ * const functionInfos = await aptos.abstraction.getAuthenticationFunction({
113
+ * accountAddress: alice.accountAddress,
114
+ * });
115
+ *
116
+ * if (functionInfos) {
117
+ * console.log(`Account ${alice.accountAddress.toString()} is using account abstraction!`);
118
+ * } else {
119
+ * console.log(`Account ${alice.accountAddress.toString()} is not using account abstraction.`);
120
+ * }
121
+ * ```
122
+ *
123
+ * @param args.accountAddress - The account to get the dispatchable authentication function for.
124
+ * @returns The dispatchable authentication function for the account.
125
+ */
126
+ public async getAuthenticationFunction(args: { accountAddress: AccountAddressInput }) {
127
+ const { accountAddress } = args;
128
+ const [{ vec: functionInfoOption }] = await view<
129
+ [{ vec: { function_name: string; module_name: string; module_address: string }[][] }]
130
+ >({
131
+ aptosConfig: this.config,
132
+ payload: {
133
+ function: "0x1::account_abstraction::dispatchable_authenticator",
134
+ functionArguments: [AccountAddress.from(accountAddress)],
135
+ abi: { typeParameters: [], parameters: [new TypeTagAddress()], returnTypes: [] },
136
+ },
137
+ });
138
+
139
+ if (functionInfoOption.length === 0) return undefined;
140
+
141
+ return functionInfoOption[0].map((functionInfo) => ({
142
+ moduleAddress: AccountAddress.fromString(functionInfo.module_address),
143
+ moduleName: functionInfo.module_name,
144
+ functionName: functionInfo.function_name,
145
+ }));
146
+ }
147
+
148
+ /**
149
+ * Will return true if the account is abstracted, otherwise false.
150
+ *
151
+ * @example
152
+ * ```ts
153
+ * const isAccountAbstractionEnabled = await aptos.abstraction.isAccountAbstractionEnabled({
154
+ * accountAddress: alice.accountAddress,
155
+ * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`,
156
+ * });
157
+ * if (isAccountAbstractionEnabled) {
158
+ * console.log(`Account ${alice.accountAddress.toString()} is using account abstraction!`);
159
+ * } else {
160
+ * console.log(`Account ${alice.accountAddress.toString()} is not using account abstraction.`);
161
+ * }
162
+ * ```
163
+ *
164
+ * @param args.accountAddress - The account to check.
165
+ * @returns Whether the account is abstracted.
166
+ */
167
+ public isAccountAbstractionEnabled = async (args: {
168
+ accountAddress: AccountAddressInput;
169
+ authenticationFunction: string;
170
+ }) => {
171
+ const functionInfos = await this.getAuthenticationFunction(args);
172
+ const { moduleAddress, moduleName, functionName } = getFunctionParts(args.authenticationFunction as MoveFunctionId);
173
+ return (
174
+ functionInfos?.some(
175
+ (functionInfo) =>
176
+ AccountAddress.fromString(moduleAddress).equals(functionInfo.moduleAddress) &&
177
+ moduleName === functionInfo.moduleName &&
178
+ functionName === functionInfo.functionName,
179
+ ) ?? false
180
+ );
181
+ };
182
+
183
+ /**
184
+ * Creates a transaction to enable account abstraction with the given authentication function.
185
+ *
186
+ * @example
187
+ * ```ts
188
+ * const txn = await aptos.abstraction.enableAccountAbstractionTransaction({
189
+ * accountAddress: alice.accountAddress,
190
+ * authenticationFunction: `{alice.accountAddress}::any_authenticator::authenticate`,
191
+ * });
192
+ *
193
+ * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn });
194
+ * await aptos.waitForTransaction({ transactionHash: txn.hash });
195
+ * ```
196
+ *
197
+ * @param args.accountAddress - The account to enable account abstraction for.
198
+ * @param args.authenticationFunction - The authentication function info to use.
199
+ * @param args.options - The options for the transaction.
200
+ * @returns A transaction to enable account abstraction for the account.
201
+ */
202
+ public enableAccountAbstractionTransaction = this.addAuthenticationFunctionTransaction;
203
+
204
+ /**
205
+ * Creates a transaction to disable account abstraction. If an authentication function is provided, it will specify to
206
+ * remove the authentication function.
207
+ *
208
+ * @example
209
+ * ```ts
210
+ * const txn = await aptos.abstraction.disableAccountAbstractionTransaction({
211
+ * accountAddress: alice.accountAddress,
212
+ * authenticationFunction: `${alice.accountAddress}::any_authenticator::authenticate`,
213
+ * });
214
+ *
215
+ * const txn = await aptos.signAndSubmitTransaction({ signer: alice, transaction: txn });
216
+ * await aptos.waitForTransaction({ transactionHash: txn.hash });
217
+ * ```
218
+ *
219
+ * @param args.accountAddress - The account to disable account abstraction for.
220
+ * @param args.authenticationFunction - The authentication function info to remove.
221
+ * @param args.options - The options for the transaction.
222
+ * @returns A transaction to disable account abstraction for the account.
223
+ */
224
+ public disableAccountAbstractionTransaction = async (args: {
225
+ accountAddress: AccountAddressInput;
226
+ authenticationFunction?: string;
227
+ options?: InputGenerateTransactionOptions;
228
+ }) => {
229
+ const { accountAddress, authenticationFunction, options } = args;
230
+ if (authenticationFunction) {
231
+ return this.removeAuthenticationFunctionTransaction({
232
+ accountAddress,
233
+ authenticationFunction,
234
+ options,
235
+ });
236
+ }
237
+ return this.removeDispatchableAuthenticatorTransaction({ accountAddress, options });
238
+ };
239
+ }
@@ -47,12 +47,15 @@ import { CurrentFungibleAssetBalancesBoolExp } from "../types/generated/types";
47
47
  import { view } from "../internal/view";
48
48
  import { isEncodedStruct, parseEncodedStruct } from "../utils";
49
49
  import { memoizeAsync } from "../utils/memoize";
50
+ import { AccountAbstraction } from "./account/abstraction";
50
51
 
51
52
  /**
52
53
  * A class to query all `Account` related queries on Aptos.
53
54
  * @group Account
54
55
  */
55
56
  export class Account {
57
+ abstraction: AccountAbstraction;
58
+
56
59
  /**
57
60
  * Creates an instance of the Aptos client with the provided configuration.
58
61
  *
@@ -73,7 +76,9 @@ export class Account {
73
76
  * ```
74
77
  * @group Account
75
78
  */
76
- constructor(readonly config: AptosConfig) {}
79
+ constructor(readonly config: AptosConfig) {
80
+ this.abstraction = new AccountAbstraction(config);
81
+ }
77
82
 
78
83
  /**
79
84
  * Queries the current state for an Aptos account given its account address.
package/src/api/aptos.ts CHANGED
@@ -15,6 +15,7 @@ import { Transaction } from "./transaction";
15
15
  import { Table } from "./table";
16
16
  import { Keyless } from "./keyless";
17
17
  import { AptosObject } from "./object";
18
+ import { AccountAbstraction } from "./account/abstraction";
18
19
 
19
20
  /**
20
21
  * The main entry point for interacting with the Aptos APIs,
@@ -94,6 +95,7 @@ export class Aptos {
94
95
  constructor(settings?: AptosConfig) {
95
96
  this.config = new AptosConfig(settings);
96
97
  this.account = new Account(this.config);
98
+ this.abstraction = new AccountAbstraction(this.config);
97
99
  this.ans = new ANS(this.config);
98
100
  this.coin = new Coin(this.config);
99
101
  this.digitalAsset = new DigitalAsset(this.config);
@@ -149,6 +151,7 @@ function applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {
149
151
  }
150
152
 
151
153
  applyMixin(Aptos, Account, "account");
154
+ applyMixin(Aptos, AccountAbstraction, "abstraction");
152
155
  applyMixin(Aptos, ANS, "ans");
153
156
  applyMixin(Aptos, Coin, "coin");
154
157
  applyMixin(Aptos, DigitalAsset, "digitalAsset");
@@ -0,0 +1,47 @@
1
+ import { Deserializer, Serializer } from "../../bcs";
2
+ import { HexInput } from "../../types";
3
+ import { AccountAddress } from "../accountAddress";
4
+ import { AuthenticationKey } from "../authenticationKey";
5
+ import { Hex } from "../hex";
6
+ import { AccountPublicKey, VerifySignatureArgs } from "./publicKey";
7
+ import { Signature } from "./signature";
8
+
9
+ export class AbstractSignature extends Signature {
10
+ readonly value: Hex;
11
+
12
+ constructor(value: HexInput) {
13
+ super();
14
+ this.value = Hex.fromHexInput(value);
15
+ }
16
+
17
+ serialize(serializer: Serializer): void {
18
+ serializer.serializeBytes(this.value.toUint8Array());
19
+ }
20
+
21
+ static deserialize(deserializer: Deserializer): AbstractSignature {
22
+ return new AbstractSignature(deserializer.deserializeBytes());
23
+ }
24
+ }
25
+
26
+ export class AbstractPublicKey extends AccountPublicKey {
27
+ readonly accountAddress: AccountAddress;
28
+
29
+ constructor(accountAddress: AccountAddress) {
30
+ super();
31
+ this.accountAddress = accountAddress;
32
+ }
33
+
34
+ authKey(): AuthenticationKey {
35
+ return new AuthenticationKey({ data: this.accountAddress.toUint8Array() });
36
+ }
37
+
38
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
39
+ verifySignature(args: VerifySignatureArgs): boolean {
40
+ throw new Error("This function is not implemented for AbstractPublicKey.");
41
+ }
42
+
43
+ // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
44
+ serialize(serializer: Serializer): void {
45
+ throw new Error("This function is not implemented for AbstractPublicKey.");
46
+ }
47
+ }
@@ -0,0 +1,79 @@
1
+ import {
2
+ SimpleTransaction,
3
+ InputGenerateTransactionOptions,
4
+ TypeTagAddress,
5
+ TypeTagStruct,
6
+ stringStructTag,
7
+ } from "../transactions";
8
+ import { AccountAddressInput } from "../core";
9
+ import { generateTransaction } from "./transactionSubmission";
10
+ import { MoveFunctionId } from "../types";
11
+ import { AptosConfig } from "../api/aptosConfig";
12
+ import { getFunctionParts } from "../utils/helpers";
13
+
14
+ export async function addAuthenticationFunctionTransaction(args: {
15
+ aptosConfig: AptosConfig;
16
+ sender: AccountAddressInput;
17
+ authenticationFunction: string;
18
+ options?: InputGenerateTransactionOptions;
19
+ }): Promise<SimpleTransaction> {
20
+ const { aptosConfig, sender, authenticationFunction, options } = args;
21
+ const { moduleAddress, moduleName, functionName } = getFunctionParts(authenticationFunction as MoveFunctionId);
22
+ return generateTransaction({
23
+ aptosConfig,
24
+ sender,
25
+ data: {
26
+ function: "0x1::account_abstraction::add_authentication_function",
27
+ typeArguments: [],
28
+ functionArguments: [moduleAddress, moduleName, functionName],
29
+ abi: {
30
+ typeParameters: [],
31
+ parameters: [new TypeTagAddress(), new TypeTagStruct(stringStructTag()), new TypeTagStruct(stringStructTag())],
32
+ },
33
+ },
34
+ options,
35
+ });
36
+ }
37
+
38
+ export async function removeAuthenticationFunctionTransaction(args: {
39
+ aptosConfig: AptosConfig;
40
+ sender: AccountAddressInput;
41
+ authenticationFunction: string;
42
+ options?: InputGenerateTransactionOptions;
43
+ }) {
44
+ const { aptosConfig, sender, authenticationFunction, options } = args;
45
+ const { moduleAddress, moduleName, functionName } = getFunctionParts(authenticationFunction as MoveFunctionId);
46
+ return generateTransaction({
47
+ aptosConfig,
48
+ sender,
49
+ data: {
50
+ function: "0x1::account_abstraction::remove_authentication_function",
51
+ typeArguments: [],
52
+ functionArguments: [moduleAddress, moduleName, functionName],
53
+ abi: {
54
+ typeParameters: [],
55
+ parameters: [new TypeTagAddress(), new TypeTagStruct(stringStructTag()), new TypeTagStruct(stringStructTag())],
56
+ },
57
+ },
58
+ options,
59
+ });
60
+ }
61
+
62
+ export async function removeDispatchableAuthenticatorTransaction(args: {
63
+ aptosConfig: AptosConfig;
64
+ sender: AccountAddressInput;
65
+ options?: InputGenerateTransactionOptions;
66
+ }) {
67
+ const { aptosConfig, sender, options } = args;
68
+ return generateTransaction({
69
+ aptosConfig,
70
+ sender,
71
+ data: {
72
+ function: "0x1::account_abstraction::remove_authenticator",
73
+ typeArguments: [],
74
+ functionArguments: [],
75
+ abi: { typeParameters: [], parameters: [] },
76
+ },
77
+ options,
78
+ });
79
+ }
@@ -8,7 +8,10 @@ import { AnyPublicKey, AnySignature } from "../../core/crypto";
8
8
  import { Ed25519PublicKey, Ed25519Signature } from "../../core/crypto/ed25519";
9
9
  import { MultiEd25519PublicKey, MultiEd25519Signature } from "../../core/crypto/multiEd25519";
10
10
  import { MultiKey, MultiKeySignature } from "../../core/crypto/multiKey";
11
- import { AccountAuthenticatorVariant } from "../../types";
11
+ import { AccountAuthenticatorVariant, HexInput, MoveFunctionId } from "../../types";
12
+ import { AbstractionAuthDataVariant } from "../../types/abstraction";
13
+ import { AccountAddress, Hex } from "../../core";
14
+ import { getFunctionParts, isValidFunctionInfo } from "../../utils/helpers";
12
15
 
13
16
  /**
14
17
  * Represents an account authenticator that can handle multiple authentication variants.
@@ -43,6 +46,8 @@ export abstract class AccountAuthenticator extends Serializable {
43
46
  return AccountAuthenticatorMultiKey.load(deserializer);
44
47
  case AccountAuthenticatorVariant.NoAccountAuthenticator:
45
48
  return AccountAuthenticatorNoAccountAuthenticator.load(deserializer);
49
+ case AccountAuthenticatorVariant.Abstraction:
50
+ return AccountAuthenticatorAbstraction.load(deserializer);
46
51
  default:
47
52
  throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);
48
53
  }
@@ -263,3 +268,49 @@ export class AccountAuthenticatorNoAccountAuthenticator extends AccountAuthentic
263
268
  return new AccountAuthenticatorNoAccountAuthenticator();
264
269
  }
265
270
  }
271
+
272
+ export class AccountAuthenticatorAbstraction extends AccountAuthenticator {
273
+ public readonly functionInfo: string;
274
+
275
+ public readonly signingMessageDigest: Hex;
276
+
277
+ public readonly authenticator: Hex;
278
+
279
+ constructor(functionInfo: string, signingMessageDigest: HexInput, authenticator: HexInput) {
280
+ super();
281
+ if (!isValidFunctionInfo(functionInfo)) {
282
+ throw new Error(`Invalid function info ${functionInfo} passed into AccountAuthenticatorAbstraction`);
283
+ }
284
+ this.functionInfo = functionInfo;
285
+ this.authenticator = Hex.fromHexInput(authenticator);
286
+ this.signingMessageDigest = Hex.fromHexInput(Hex.fromHexInput(signingMessageDigest).toUint8Array());
287
+ }
288
+
289
+ serialize(serializer: Serializer): void {
290
+ serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.Abstraction);
291
+ const { moduleAddress, moduleName, functionName } = getFunctionParts(this.functionInfo as MoveFunctionId);
292
+ AccountAddress.fromString(moduleAddress).serialize(serializer);
293
+ serializer.serializeStr(moduleName);
294
+ serializer.serializeStr(functionName);
295
+ serializer.serializeU32AsUleb128(AbstractionAuthDataVariant.V1);
296
+ serializer.serializeBytes(this.signingMessageDigest.toUint8Array());
297
+ serializer.serializeFixedBytes(this.authenticator.toUint8Array());
298
+ }
299
+
300
+ static load(deserializer: Deserializer): AccountAuthenticatorAbstraction {
301
+ const moduleAddress = AccountAddress.deserialize(deserializer);
302
+ const moduleName = deserializer.deserializeStr();
303
+ const functionName = deserializer.deserializeStr();
304
+ const variant = deserializer.deserializeUleb128AsU32();
305
+ if (variant === AbstractionAuthDataVariant.V1) {
306
+ const signingMessageDigest = deserializer.deserializeBytes();
307
+ const authenticator = deserializer.deserializeFixedBytes(deserializer.remaining());
308
+ return new AccountAuthenticatorAbstraction(
309
+ `${moduleAddress}::${moduleName}::${functionName}`,
310
+ signingMessageDigest,
311
+ authenticator,
312
+ );
313
+ }
314
+ throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${variant}`);
315
+ }
316
+ }
@@ -2,18 +2,19 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { ScriptComposerWasm } from "@aptos-labs/script-composer-pack";
5
- import { AptosApiType } from "../../utils";
5
+ import { AptosApiType, getFunctionParts } from "../../utils";
6
6
  import { AptosConfig } from "../../api/aptosConfig";
7
7
  import { InputBatchedFunctionData } from "../types";
8
- import { fetchMoveFunctionAbi, getFunctionParts, standardizeTypeTags } from "../transactionBuilder";
8
+ import { fetchMoveFunctionAbi, standardizeTypeTags } from "../transactionBuilder";
9
9
  import { CallArgument } from "../../types";
10
10
  import { convertCallArgument } from "../transactionBuilder/remoteAbi";
11
11
 
12
- // A wrapper class around TransactionComposer, which is a WASM library compiled
13
- // from aptos-core/aptos-move/script-composer.
14
- //
15
- // This class allows the SDK caller to build a transaction that invokes multiple Move functions
16
- // and allow for arguments to be passed around.
12
+ /**
13
+ * A wrapper class around TransactionComposer, which is a WASM library compiled
14
+ * from aptos-core/aptos-move/script-composer.
15
+ * This class allows the SDK caller to build a transaction that invokes multiple Move functions
16
+ * and allow for arguments to be passed around.
17
+ * */
17
18
  export class AptosScriptComposer {
18
19
  private config: AptosConfig;
19
20
 
@@ -10,7 +10,7 @@ import {
10
10
  } from "../types";
11
11
  import { Bool, FixedBytes, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from "../../bcs";
12
12
  import { AccountAddress } from "../../core";
13
- import { MoveFunction, MoveFunctionId } from "../../types";
13
+ import { MoveFunction } from "../../types";
14
14
 
15
15
  /**
16
16
  * Determines if the provided argument is of type boolean.
@@ -317,24 +317,3 @@ export function findFirstNonSignerArg(functionAbi: MoveFunction): number {
317
317
  }
318
318
  return index;
319
319
  }
320
-
321
- /**
322
- * Splits a function identifier into its constituent parts: module address, module name, and function name.
323
- * This function helps in validating and extracting details from a function identifier string.
324
- *
325
- * @param functionArg - The function identifier string in the format "moduleAddress::moduleName::functionName".
326
- * @returns An object containing the module address, module name, and function name.
327
- * @throws Error if the function identifier does not contain exactly three parts.
328
- * @group Implementation
329
- * @category Transactions
330
- */
331
- export function getFunctionParts(functionArg: MoveFunctionId) {
332
- const funcNameParts = functionArg.split("::");
333
- if (funcNameParts.length !== 3) {
334
- throw new Error(`Invalid function ${functionArg}`);
335
- }
336
- const moduleAddress = funcNameParts[0];
337
- const moduleName = funcNameParts[1];
338
- const functionName = funcNameParts[2];
339
- return { moduleAddress, moduleName, functionName };
340
- }
@@ -423,6 +423,13 @@ function parseArg(
423
423
  }
424
424
  }
425
425
 
426
+ if (isString(arg)) {
427
+ // In a web env, arguments are passing as strings
428
+ if (arg.startsWith("[")) {
429
+ return checkOrConvertArgument(JSON.parse(arg), param, position, genericTypeParams);
430
+ }
431
+ }
432
+
426
433
  // TODO: Support Uint16Array, Uint32Array, BigUint64Array?
427
434
 
428
435
  if (Array.isArray(arg)) {
@@ -77,9 +77,10 @@ import {
77
77
  } from "../types";
78
78
  import { convertArgument, fetchEntryFunctionAbi, fetchViewFunctionAbi, standardizeTypeTags } from "./remoteAbi";
79
79
  import { memoizeAsync } from "../../utils/memoize";
80
- import { getFunctionParts, isScriptDataInput } from "./helpers";
80
+ import { isScriptDataInput } from "./helpers";
81
81
  import { SimpleTransaction } from "../instances/simpleTransaction";
82
82
  import { MultiAgentTransaction } from "../instances/multiAgentTransaction";
83
+ import { getFunctionParts } from "../../utils/helpers";
83
84
 
84
85
  /**
85
86
  * Builds a transaction payload based on the provided arguments and returns a transaction payload.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The variant for the AbstractionAuthData enum.
3
+ */
4
+ export enum AbstractionAuthDataVariant {
5
+ V1 = 0,
6
+ }
@@ -106,6 +106,7 @@ export enum AccountAuthenticatorVariant {
106
106
  SingleKey = 2,
107
107
  MultiKey = 3,
108
108
  NoAccountAuthenticator = 4,
109
+ Abstraction = 5,
109
110
  }
110
111
 
111
112
  /**
@@ -2,7 +2,8 @@
2
2
  // SPDX-License-Identifier: Apache-2.0
3
3
 
4
4
  import { decode } from "js-base64";
5
- import { MoveStructId } from "../types";
5
+ import { MoveFunctionId, MoveStructId } from "../types";
6
+ import { AccountAddress } from "../core/accountAddress";
6
7
 
7
8
  /**
8
9
  * Sleep for the specified amount of time in milliseconds.
@@ -175,3 +176,29 @@ export const isEncodedStruct = (
175
176
  typeof structObj.account_address === "string" &&
176
177
  typeof structObj.module_name === "string" &&
177
178
  typeof structObj.struct_name === "string";
179
+
180
+ /**
181
+ * Splits a function identifier into its constituent parts: module address, module name, and function name.
182
+ * This function helps in validating and extracting details from a function identifier string.
183
+ *
184
+ * @param functionArg - The function identifier string in the format "moduleAddress::moduleName::functionName".
185
+ * @returns An object containing the module address, module name, and function name.
186
+ * @throws Error if the function identifier does not contain exactly three parts.
187
+ * @group Implementation
188
+ * @category Transactions
189
+ */
190
+ export function getFunctionParts(functionArg: MoveFunctionId) {
191
+ const funcNameParts = functionArg.split("::");
192
+ if (funcNameParts.length !== 3) {
193
+ throw new Error(`Invalid function ${functionArg}`);
194
+ }
195
+ const moduleAddress = funcNameParts[0];
196
+ const moduleName = funcNameParts[1];
197
+ const functionName = funcNameParts[2];
198
+ return { moduleAddress, moduleName, functionName };
199
+ }
200
+
201
+ export function isValidFunctionInfo(functionInfo: string): boolean {
202
+ const parts = functionInfo.split("::");
203
+ return parts.length === 3 && AccountAddress.isValid({ input: parts[0] }).valid;
204
+ }
package/src/version.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  *
7
7
  * hardcoded for now, we would want to have it injected dynamically
8
8
  */
9
- export const VERSION = "1.33.2-sc.0";
9
+ export const VERSION = "1.34.0";
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});var i=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var m=(e,n,t,r)=>{for(var o=r>1?void 0:r?u(n,t):n,s=e.length-1,a;s>=0;s--)(a=e[s])&&(o=(r?a(n,t,o):a(o))||o);return r&&o&&i(n,t,o),o};var _jsbase64 = require('js-base64');async function p(e){return new Promise(n=>{setTimeout(n,e)})}function f(e){return e instanceof Error?e.message:String(e)}var _=()=>Math.floor(Date.now()/1e3);function S(e){let n=new Date(e*1e3);return n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0),Math.floor(n.getTime()/1e3)}function x(e){let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n+"==".substring(0,(3-n.length%3)%3);return _jsbase64.decode.call(void 0, t)}var h=(e,n)=>e*10**n,y= exports.h =(e,n)=>e/10**n,c=e=>{let n="";for(let t=2;t<e.length;t+=2)n+=String.fromCharCode(parseInt(e.substring(t,t+2),16));return n},b= exports.i =e=>{let{account_address:n,module_name:t,struct_name:r}=e,o=c(t),s=c(r);return`${n}::${o}::${s}`},M= exports.j =e=>typeof e=="object"&&!Array.isArray(e)&&e!==null&&"account_address"in e&&"module_name"in e&&"struct_name"in e&&typeof e.account_address=="string"&&typeof e.module_name=="string"&&typeof e.struct_name=="string";exports.a = m; exports.b = p; exports.c = f; exports.d = _; exports.e = S; exports.f = x; exports.g = h; exports.h = y; exports.i = b; exports.j = M;
2
- //# sourceMappingURL=chunk-IHUCZKG2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["/Users/philip/Documents/General/aptos-ts-sdk/dist/common/chunk-IHUCZKG2.js","../../src/utils/helpers.ts"],"names":["sleep","timeMs","resolve","getErrorMessage","error","nowInSeconds","floorToWholeHour","timestampInSeconds","date","base64UrlDecode","base64Url","base64","paddedBase64","decode","convertAmountFromHumanReadableToOnChain","value","decimal","convertAmountFromOnChainToHumanReadable","hexToAscii","hex","str","n","parseEncodedStruct","structObj","account_address","module_name","struct_name","moduleName","structName"],"mappings":"AAAA,6EAAI,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CCGvM,qCAAuB,MAWvB,SAAsBA,CAAAA,CAAMC,CAAAA,CAA+B,CACzD,OAAO,IAAI,OAAA,CAASC,CAAAA,EAAY,CAC9B,UAAA,CAAWA,CAAAA,CAASD,CAAM,CAC5B,CAAC,CACH,CAUO,SAASE,CAAAA,CAAgBC,CAAAA,CAAwB,CACtD,OAAOA,EAAAA,WAAiB,KAAA,CAAQA,CAAAA,CAAM,OAAA,CAAU,MAAA,CAAOA,CAAK,CAC9D,CAMO,IAAMC,CAAAA,CAAe,CAAA,CAAA,EAAM,IAAA,CAAK,KAAA,CAAM,IAAA,CAAK,GAAA,CAAI,CAAA,CAAI,GAAI,CAAA,CAUvD,SAASC,CAAAA,CAAiBC,CAAAA,CAAoC,CACnE,IAAMC,CAAAA,CAAO,IAAI,IAAA,CAAKD,CAAAA,CAAqB,GAAI,CAAA,CAE/C,OAAAC,CAAAA,CAAK,UAAA,CAAW,CAAC,CAAA,CACjBA,CAAAA,CAAK,UAAA,CAAW,CAAC,CAAA,CACjBA,CAAAA,CAAK,eAAA,CAAgB,CAAC,CAAA,CACf,IAAA,CAAK,KAAA,CAAMA,CAAAA,CAAK,OAAA,CAAQ,CAAA,CAAI,GAAI,CACzC,CAWO,SAASC,CAAAA,CAAgBC,CAAAA,CAA2B,CAEzD,IAAMC,CAAAA,CAASD,CAAAA,CAAU,OAAA,CAAQ,IAAA,CAAM,GAAG,CAAA,CAAE,OAAA,CAAQ,IAAA,CAAM,GAAG,CAAA,CAEvDE,CAAAA,CAAeD,CAAAA,CAAS,IAAA,CAAK,SAAA,CAAU,CAAA,CAAA,CAAI,CAAA,CAAKA,CAAAA,CAAO,MAAA,CAAS,CAAA,CAAA,CAAM,CAAC,CAAA,CAE7E,OADsBE,8BAAAA,CAAmB,CAE3C,CAeO,IAAMC,CAAAA,CAA0C,CAACC,CAAAA,CAAeC,CAAAA,CAAAA,EAAoBD,CAAAA,CAAQ,EAAA,EAAMC,CAAAA,CAe5FC,CAAAA,aAA0C,CAACF,CAAAA,CAAeC,CAAAA,CAAAA,EAAoBD,CAAAA,CAAQ,EAAA,EAAMC,CAAAA,CAYnGE,CAAAA,CAAcC,CAAAA,EAAgB,CAClC,IAAIC,CAAAA,CAAM,EAAA,CACV,GAAA,CAAA,IAASC,CAAAA,CAAI,CAAA,CAAGA,CAAAA,CAAIF,CAAAA,CAAI,MAAA,CAAQE,CAAAA,EAAK,CAAA,CACnCD,CAAAA,EAAO,MAAA,CAAO,YAAA,CAAa,QAAA,CAASD,CAAAA,CAAI,SAAA,CAAUE,CAAAA,CAAGA,CAAAA,CAAI,CAAC,CAAA,CAAG,EAAE,CAAC,CAAA,CAElE,OAAOD,CACT,CAAA,CAmBaE,CAAAA,aAAsBC,CAAAA,EAIf,CAElB,GAAM,CAAE,eAAA,CAAAC,CAAAA,CAAiB,WAAA,CAAAC,CAAAA,CAAa,WAAA,CAAAC,CAAY,CAAA,CAAIH,CAAAA,CAChDI,CAAAA,CAAaT,CAAAA,CAAWO,CAAW,CAAA,CACnCG,CAAAA,CAAaV,CAAAA,CAAWQ,CAAW,CAAA,CACzC,MAAO,CAAA,EAAA","file":"/Users/philip/Documents/General/aptos-ts-sdk/dist/common/chunk-IHUCZKG2.js","sourcesContent":[null,"// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { decode } from \"js-base64\";\nimport { MoveStructId } from \"../types\";\n\n/**\n * Sleep for the specified amount of time in milliseconds.\n * This function can be used to introduce delays in asynchronous operations.\n *\n * @param timeMs - The time in milliseconds to sleep.\n * @group Implementation\n * @category Utils\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n\n/**\n * Get the error message from an unknown error.\n *\n * @param error The error to get the message from\n * @returns The error message\n * @group Implementation\n * @category Utils\n */\nexport function getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\n/**\n * @group Implementation\n * @category Utils\n */\nexport const nowInSeconds = () => Math.floor(Date.now() / 1000);\n\n/**\n * Floors the given timestamp to the nearest whole hour.\n * This function is useful for normalizing timestamps to hourly intervals.\n *\n * @param timestampInSeconds - The timestamp in seconds to be floored.\n * @group Implementation\n * @category Utils\n */\nexport function floorToWholeHour(timestampInSeconds: number): number {\n const date = new Date(timestampInSeconds * 1000);\n // Reset minutes and seconds to zero\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n return Math.floor(date.getTime() / 1000);\n}\n\n/**\n * Decodes a base64 URL-encoded string into its original form.\n * This function is useful for converting base64 URL-encoded data back to a readable format.\n *\n * @param base64Url - The base64 URL-encoded string to decode.\n * @returns The decoded string.\n * @group Implementation\n * @category Utils\n */\nexport function base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * a human-readable amount format to the smallest unit format\n * @example\n * human-readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human-readable format\n * @param decimal The token decimal\n * @returns The value in the smallest units\n * @group Implementation\n * @category Utils\n */\nexport const convertAmountFromHumanReadableToOnChain = (value: number, decimal: number) => value * 10 ** decimal;\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * the smallest unit format to a human-readable amount format\n * @example\n * human-readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human-readable format\n * @param decimal The token decimal\n * @returns The value in the smallest units\n * @group Implementation\n * @category Utils\n */\nexport const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;\n\n/**\n * Convert a hex string to an ascii string with the `0x` prefix.\n *\n * `0x6170746f735f636f696e` --> `aptos_coin`\n *\n * @param hex The hex string to convert (e.g. `0x6170746f735f636f696e`)\n * @returns The ascii string\n * @group Implementation\n * @category Utils\n */\nconst hexToAscii = (hex: string) => {\n let str = \"\";\n for (let n = 2; n < hex.length; n += 2) {\n str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));\n }\n return str;\n};\n\n/**\n * Convert an encoded struct to a MoveStructId.\n *\n * @example\n * const structObj = {\n * account_address: \"0x1\",\n * module_name: \"0x6170746f735f636f696e\",\n * struct_name: \"0x4170746f73436f696e\",\n * };\n * // structId is \"0x1::aptos_coin::AptosCoin\"\n * const structId = parseEncodedStruct(structObj);\n *\n * @param structObj The struct with account_address, module_name, and struct_name properties\n * @returns The MoveStructId\n * @group Implementation\n * @category Utils\n */\nexport const parseEncodedStruct = (structObj: {\n account_address: string;\n module_name: string;\n struct_name: string;\n}): MoveStructId => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { account_address, module_name, struct_name } = structObj;\n const moduleName = hexToAscii(module_name);\n const structName = hexToAscii(struct_name);\n return `${account_address}::${moduleName}::${structName}`;\n};\n\n/**\n * Determines whether the given object is an encoded struct type with the following properties:\n * - account_address: string\n * - module_name: string\n * - struct_name: string\n *\n * @param structObj The object to check\n * @returns Whether the object is an encoded struct type\n * @group Implementation\n * @category Utils\n */\nexport const isEncodedStruct = (\n structObj: any,\n): structObj is {\n account_address: string;\n module_name: string;\n struct_name: string;\n} =>\n typeof structObj === \"object\" &&\n !Array.isArray(structObj) &&\n structObj !== null &&\n \"account_address\" in structObj &&\n \"module_name\" in structObj &&\n \"struct_name\" in structObj &&\n typeof structObj.account_address === \"string\" &&\n typeof structObj.module_name === \"string\" &&\n typeof structObj.struct_name === \"string\";\n"]}