@aptos-labs/ts-sdk 1.33.0 → 1.33.2-sc.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 (718) hide show
  1. package/README.md +11 -6
  2. package/dist/common/{accountAddress-fJZJVSBc.d.ts → accountAddress-Cf1amU98.d.ts} +293 -1
  3. package/dist/common/{chunk-F43XVDYJ.js → chunk-IHUCZKG2.js} +1 -1
  4. package/dist/common/chunk-IHUCZKG2.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +56 -9
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +2126 -305
  9. package/dist/common/index.js +33 -33
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/{Ed25519Account-B3xHXAQe.d.mts → Ed25519Account-D4j3_WIS.d.mts} +122 -12
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +82 -7
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +6 -4
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/AccountUtils.d.mts +65 -0
  17. package/dist/esm/account/AccountUtils.mjs +2 -0
  18. package/dist/esm/account/Ed25519Account.d.mts +4 -2
  19. package/dist/esm/account/Ed25519Account.mjs +1 -1
  20. package/dist/esm/account/EphemeralKeyPair.d.mts +30 -1
  21. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  22. package/dist/esm/account/FederatedKeylessAccount.d.mts +26 -5
  23. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  24. package/dist/esm/account/KeylessAccount.d.mts +31 -5
  25. package/dist/esm/account/KeylessAccount.mjs +1 -1
  26. package/dist/esm/account/MultiKeyAccount.d.mts +41 -5
  27. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  28. package/dist/esm/account/SingleKeyAccount.d.mts +5 -3
  29. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  30. package/dist/esm/account/index.d.mts +5 -2
  31. package/dist/esm/account/index.mjs +1 -1
  32. package/dist/esm/account/utils.d.mts +19 -0
  33. package/dist/esm/account/utils.mjs +2 -0
  34. package/dist/esm/api/account.d.mts +26 -4
  35. package/dist/esm/api/account.mjs +1 -1
  36. package/dist/esm/api/ans.d.mts +19 -2
  37. package/dist/esm/api/ans.mjs +1 -1
  38. package/dist/esm/api/aptos.d.mts +7 -2
  39. package/dist/esm/api/aptos.mjs +1 -1
  40. package/dist/esm/api/aptosConfig.d.mts +17 -0
  41. package/dist/esm/api/aptosConfig.mjs +1 -1
  42. package/dist/esm/api/coin.d.mts +8 -3
  43. package/dist/esm/api/coin.mjs +1 -1
  44. package/dist/esm/api/digitalAsset.d.mts +30 -2
  45. package/dist/esm/api/digitalAsset.mjs +1 -1
  46. package/dist/esm/api/event.d.mts +7 -0
  47. package/dist/esm/api/event.mjs +1 -1
  48. package/dist/esm/api/faucet.d.mts +12 -2
  49. package/dist/esm/api/faucet.mjs +1 -1
  50. package/dist/esm/api/fungibleAsset.d.mts +12 -2
  51. package/dist/esm/api/fungibleAsset.mjs +1 -1
  52. package/dist/esm/api/general.d.mts +15 -1
  53. package/dist/esm/api/general.mjs +1 -1
  54. package/dist/esm/api/index.d.mts +5 -2
  55. package/dist/esm/api/index.mjs +1 -1
  56. package/dist/esm/api/keyless.d.mts +10 -3
  57. package/dist/esm/api/keyless.mjs +1 -1
  58. package/dist/esm/api/object.d.mts +4 -0
  59. package/dist/esm/api/object.mjs +1 -1
  60. package/dist/esm/api/staking.d.mts +6 -0
  61. package/dist/esm/api/staking.mjs +1 -1
  62. package/dist/esm/api/table.d.mts +6 -0
  63. package/dist/esm/api/table.mjs +1 -1
  64. package/dist/esm/api/transaction.d.mts +25 -6
  65. package/dist/esm/api/transaction.mjs +1 -1
  66. package/dist/esm/api/transactionSubmission/build.d.mts +72 -1
  67. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  68. package/dist/esm/api/transactionSubmission/helpers.d.mts +2 -0
  69. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/management.d.mts +9 -2
  71. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  72. package/dist/esm/api/transactionSubmission/sign.d.mts +8 -2
  73. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  74. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  75. package/dist/esm/api/transactionSubmission/simulate.d.mts +7 -1
  76. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  77. package/dist/esm/api/transactionSubmission/submit.d.mts +7 -1
  78. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  79. package/dist/esm/api/utils.d.mts +2 -0
  80. package/dist/esm/api/utils.mjs +1 -1
  81. package/dist/esm/bcs/consts.d.mts +1 -0
  82. package/dist/esm/bcs/deserializer.d.mts +57 -2
  83. package/dist/esm/bcs/deserializer.mjs +1 -1
  84. package/dist/esm/bcs/index.d.mts +1 -0
  85. package/dist/esm/bcs/index.mjs +1 -1
  86. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +11 -0
  87. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  88. package/dist/esm/bcs/serializable/fixedBytes.d.mts +13 -0
  89. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  90. package/dist/esm/bcs/serializable/movePrimitives.d.mts +25 -0
  91. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  92. package/dist/esm/bcs/serializable/moveStructs.d.mts +57 -0
  93. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  94. package/dist/esm/bcs/serializer.d.mts +61 -0
  95. package/dist/esm/bcs/serializer.mjs +1 -1
  96. package/dist/esm/{chunk-XVPWTWPY.mjs → chunk-32WLD3F3.mjs} +2 -2
  97. package/dist/esm/chunk-32WLD3F3.mjs.map +1 -0
  98. package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
  99. package/dist/esm/chunk-35DKMW7Q.mjs.map +1 -0
  100. package/dist/esm/chunk-3OLFJ65O.mjs +2 -0
  101. package/dist/esm/chunk-3OLFJ65O.mjs.map +1 -0
  102. package/dist/esm/chunk-3XH3NNSR.mjs +2 -0
  103. package/dist/esm/chunk-3XH3NNSR.mjs.map +1 -0
  104. package/dist/esm/chunk-4RXKALLC.mjs +2 -0
  105. package/dist/esm/chunk-4RXKALLC.mjs.map +1 -0
  106. package/dist/esm/{chunk-64IZ5PQR.mjs → chunk-4UYVRG5Z.mjs} +2 -2
  107. package/dist/esm/chunk-4UYVRG5Z.mjs.map +1 -0
  108. package/dist/esm/chunk-4YLUM62M.mjs +2 -0
  109. package/dist/esm/chunk-4YLUM62M.mjs.map +1 -0
  110. package/dist/esm/{chunk-KKLF7DQV.mjs → chunk-4ZJJINCW.mjs} +2 -2
  111. package/dist/esm/chunk-4ZJJINCW.mjs.map +1 -0
  112. package/dist/esm/{chunk-U7UTBXJD.mjs → chunk-66AQ2MJ6.mjs} +2 -2
  113. package/dist/esm/chunk-66AQ2MJ6.mjs.map +1 -0
  114. package/dist/esm/{chunk-LZ5PSDOS.mjs → chunk-67BUAZ6O.mjs} +2 -2
  115. package/dist/esm/chunk-67BUAZ6O.mjs.map +1 -0
  116. package/dist/esm/{chunk-A3USS2NC.mjs → chunk-67ZANQ3R.mjs} +2 -2
  117. package/dist/esm/chunk-67ZANQ3R.mjs.map +1 -0
  118. package/dist/esm/{chunk-JUQBFGUD.mjs → chunk-6IIAGMDR.mjs} +2 -2
  119. package/dist/esm/chunk-6IIAGMDR.mjs.map +1 -0
  120. package/dist/esm/{chunk-BWV6OYLG.mjs → chunk-6IPM5P4L.mjs} +2 -2
  121. package/dist/esm/chunk-6IPM5P4L.mjs.map +1 -0
  122. package/dist/esm/{chunk-WXLSHECY.mjs → chunk-6XHBRRS6.mjs} +2 -2
  123. package/dist/esm/chunk-6XHBRRS6.mjs.map +1 -0
  124. package/dist/esm/chunk-7HLNV3QL.mjs +2 -0
  125. package/dist/esm/chunk-7HLNV3QL.mjs.map +1 -0
  126. package/dist/esm/{chunk-CK5NDXQT.mjs → chunk-A3NEASNH.mjs} +2 -2
  127. package/dist/esm/chunk-A3NEASNH.mjs.map +1 -0
  128. package/dist/esm/{chunk-2CJC43CV.mjs → chunk-A5L76YP7.mjs} +1 -1
  129. package/dist/esm/chunk-A5L76YP7.mjs.map +1 -0
  130. package/dist/esm/{chunk-P74XXLE4.mjs → chunk-AD3A7DTH.mjs} +2 -2
  131. package/dist/esm/chunk-AD3A7DTH.mjs.map +1 -0
  132. package/dist/esm/chunk-AIABPCUF.mjs +2 -0
  133. package/dist/esm/{chunk-YQHOQJRQ.mjs.map → chunk-AIABPCUF.mjs.map} +1 -1
  134. package/dist/esm/{chunk-AOROYJ74.mjs → chunk-AZWVCBK2.mjs} +2 -2
  135. package/dist/esm/chunk-AZWVCBK2.mjs.map +1 -0
  136. package/dist/esm/chunk-BFIXIXHO.mjs +2 -0
  137. package/dist/esm/chunk-BFIXIXHO.mjs.map +1 -0
  138. package/dist/esm/{chunk-6ZOVTYLJ.mjs → chunk-BI3BTSUB.mjs} +2 -2
  139. package/dist/esm/chunk-BI3BTSUB.mjs.map +1 -0
  140. package/dist/esm/{chunk-OIOGOW6I.mjs → chunk-C3Q23D22.mjs} +1 -1
  141. package/dist/esm/chunk-C3Q23D22.mjs.map +1 -0
  142. package/dist/esm/{chunk-KPPM2BSC.mjs → chunk-CDYLZDD2.mjs} +2 -2
  143. package/dist/esm/chunk-CDYLZDD2.mjs.map +1 -0
  144. package/dist/esm/{chunk-5XLZACVT.mjs → chunk-CGTHWGSJ.mjs} +2 -2
  145. package/dist/esm/chunk-CGTHWGSJ.mjs.map +1 -0
  146. package/dist/esm/{chunk-P6RNNESB.mjs → chunk-CNCRJ56P.mjs} +2 -2
  147. package/dist/esm/chunk-CNCRJ56P.mjs.map +1 -0
  148. package/dist/esm/{chunk-VQZMI3EZ.mjs → chunk-CWKNJZB6.mjs} +2 -2
  149. package/dist/esm/chunk-CWKNJZB6.mjs.map +1 -0
  150. package/dist/esm/chunk-CWRANLXZ.mjs +2 -0
  151. package/dist/esm/chunk-CWRANLXZ.mjs.map +1 -0
  152. package/dist/esm/{chunk-476F5NJ6.mjs → chunk-CYMVZJHC.mjs} +2 -2
  153. package/dist/esm/chunk-CYMVZJHC.mjs.map +1 -0
  154. package/dist/esm/{chunk-V4FKFCBL.mjs → chunk-DAFSKSZ5.mjs} +1 -1
  155. package/dist/esm/chunk-DAFSKSZ5.mjs.map +1 -0
  156. package/dist/esm/chunk-DPW6ELCQ.mjs +2 -0
  157. package/dist/esm/chunk-DPW6ELCQ.mjs.map +1 -0
  158. package/dist/esm/{chunk-HKVZ7CAG.mjs → chunk-DW3ETAZB.mjs} +2 -2
  159. package/dist/esm/chunk-DW3ETAZB.mjs.map +1 -0
  160. package/dist/esm/{chunk-AJ5JHBAE.mjs → chunk-EBMEXURY.mjs} +2 -2
  161. package/dist/esm/chunk-EBMEXURY.mjs.map +1 -0
  162. package/dist/esm/{chunk-4IQZOAN7.mjs → chunk-EBS4BKER.mjs} +2 -2
  163. package/dist/esm/chunk-EBS4BKER.mjs.map +1 -0
  164. package/dist/esm/{chunk-VAKNMHOA.mjs → chunk-ECZYQTNN.mjs} +2 -2
  165. package/dist/esm/chunk-ECZYQTNN.mjs.map +1 -0
  166. package/dist/esm/chunk-EMURYYVO.mjs +2 -0
  167. package/dist/esm/chunk-EMURYYVO.mjs.map +1 -0
  168. package/dist/esm/chunk-F2ZTBAJJ.mjs +2 -0
  169. package/dist/esm/chunk-F2ZTBAJJ.mjs.map +1 -0
  170. package/dist/esm/chunk-FC2IYWI7.mjs +2 -0
  171. package/dist/esm/chunk-FC2IYWI7.mjs.map +1 -0
  172. package/dist/esm/chunk-FKJ3GCBI.mjs +2 -0
  173. package/dist/esm/chunk-FKJ3GCBI.mjs.map +1 -0
  174. package/dist/esm/{chunk-AKIO3OIT.mjs → chunk-FN4C3CKC.mjs} +2 -2
  175. package/dist/esm/chunk-FN4C3CKC.mjs.map +1 -0
  176. package/dist/esm/{chunk-6AEXQEO2.mjs → chunk-FNXO3URE.mjs} +2 -2
  177. package/dist/esm/chunk-FNXO3URE.mjs.map +1 -0
  178. package/dist/esm/{chunk-FH27D7S3.mjs → chunk-FQECACH3.mjs} +2 -2
  179. package/dist/esm/chunk-FQECACH3.mjs.map +1 -0
  180. package/dist/esm/{chunk-LK67PZX3.mjs → chunk-FQXEX2HN.mjs} +2 -2
  181. package/dist/esm/chunk-FQXEX2HN.mjs.map +1 -0
  182. package/dist/esm/{chunk-T6ADNZE5.mjs → chunk-G4O6FXCF.mjs} +2 -2
  183. package/dist/esm/chunk-G4O6FXCF.mjs.map +1 -0
  184. package/dist/esm/chunk-G5ZWH5T3.mjs +2 -0
  185. package/dist/esm/chunk-G5ZWH5T3.mjs.map +1 -0
  186. package/dist/esm/{chunk-HULCIESG.mjs → chunk-GL4OJVYH.mjs} +2 -2
  187. package/dist/esm/chunk-GL4OJVYH.mjs.map +1 -0
  188. package/dist/esm/{chunk-GMKKHGXK.mjs → chunk-GOXRBEIJ.mjs} +1 -1
  189. package/dist/esm/chunk-GOXRBEIJ.mjs.map +1 -0
  190. package/dist/esm/chunk-GP4TLDVZ.mjs +1 -0
  191. package/dist/esm/{chunk-ALOYOMRE.mjs → chunk-H3XZ3FZY.mjs} +2 -2
  192. package/dist/esm/{chunk-ALOYOMRE.mjs.map → chunk-H3XZ3FZY.mjs.map} +1 -1
  193. package/dist/esm/{chunk-O4MRRWRI.mjs → chunk-I7JGKVOC.mjs} +2 -2
  194. package/dist/esm/chunk-I7JGKVOC.mjs.map +1 -0
  195. package/dist/esm/{chunk-6Q2O5G3J.mjs → chunk-IF4UU2MT.mjs} +1 -1
  196. package/dist/esm/chunk-IF4UU2MT.mjs.map +1 -0
  197. package/dist/esm/{chunk-QN7AK5PU.mjs → chunk-IJ2QKE4W.mjs} +2 -2
  198. package/dist/esm/chunk-IJ2QKE4W.mjs.map +1 -0
  199. package/dist/esm/chunk-JJM6ELMS.mjs +2 -0
  200. package/dist/esm/chunk-JJM6ELMS.mjs.map +1 -0
  201. package/dist/esm/{chunk-TQA6HY6A.mjs → chunk-K2CSACQY.mjs} +2 -2
  202. package/dist/esm/chunk-K2CSACQY.mjs.map +1 -0
  203. package/dist/esm/{chunk-2D7OMWVL.mjs → chunk-KFCLSJC3.mjs} +2 -2
  204. package/dist/esm/chunk-KFGXOZ77.mjs +2 -0
  205. package/dist/esm/chunk-KFGXOZ77.mjs.map +1 -0
  206. package/dist/esm/{chunk-B5BXB2BB.mjs → chunk-KG23XFU2.mjs} +2 -2
  207. package/dist/esm/chunk-KG23XFU2.mjs.map +1 -0
  208. package/dist/esm/chunk-KNTAED2Z.mjs +2 -0
  209. package/dist/esm/chunk-KNTAED2Z.mjs.map +1 -0
  210. package/dist/esm/{chunk-4ZNSNWQL.mjs → chunk-KPLWOVKG.mjs} +2 -2
  211. package/dist/esm/chunk-KPLWOVKG.mjs.map +1 -0
  212. package/dist/esm/{chunk-BRV3RLKW.mjs → chunk-MT2RJ7H3.mjs} +2 -2
  213. package/dist/esm/chunk-MT2RJ7H3.mjs.map +1 -0
  214. package/dist/esm/{chunk-ACVIE7IE.mjs → chunk-N4DM5FYH.mjs} +2 -2
  215. package/dist/esm/chunk-N4DM5FYH.mjs.map +1 -0
  216. package/dist/esm/{chunk-Q3CWUEXI.mjs → chunk-N4VVDQA5.mjs} +2 -2
  217. package/dist/esm/chunk-N4VVDQA5.mjs.map +1 -0
  218. package/dist/esm/{chunk-LGTOOAQI.mjs → chunk-N6YTF76Q.mjs} +2 -2
  219. package/dist/esm/chunk-N6YTF76Q.mjs.map +1 -0
  220. package/dist/esm/{chunk-OEM75TVE.mjs → chunk-NDUIXMIA.mjs} +2 -2
  221. package/dist/esm/chunk-NDUIXMIA.mjs.map +1 -0
  222. package/dist/esm/{chunk-FUC7SLH7.mjs → chunk-NW2WUKWV.mjs} +2 -2
  223. package/dist/esm/chunk-NW2WUKWV.mjs.map +1 -0
  224. package/dist/esm/{chunk-I3452DF5.mjs → chunk-ODEDSSQL.mjs} +2 -2
  225. package/dist/esm/chunk-ODEDSSQL.mjs.map +1 -0
  226. package/dist/esm/{chunk-42H7WETG.mjs → chunk-ORMOQWWH.mjs} +2 -2
  227. package/dist/esm/chunk-ORMOQWWH.mjs.map +1 -0
  228. package/dist/esm/{chunk-JKA22FG5.mjs → chunk-P4VF7BN4.mjs} +2 -2
  229. package/dist/esm/chunk-P4VF7BN4.mjs.map +1 -0
  230. package/dist/esm/chunk-P54RNN4V.mjs +2 -0
  231. package/dist/esm/chunk-P54RNN4V.mjs.map +1 -0
  232. package/dist/esm/{chunk-D54FD6XE.mjs → chunk-PHJRCZQ3.mjs} +2 -2
  233. package/dist/esm/chunk-PHJRCZQ3.mjs.map +1 -0
  234. package/dist/esm/{chunk-YITOC4Z6.mjs → chunk-PNDCGNVH.mjs} +2 -2
  235. package/dist/esm/chunk-PNDCGNVH.mjs.map +1 -0
  236. package/dist/esm/{chunk-Y5HLXDYG.mjs → chunk-PTS3BTOU.mjs} +2 -2
  237. package/dist/esm/chunk-PTS3BTOU.mjs.map +1 -0
  238. package/dist/esm/{chunk-737YW3CY.mjs → chunk-PUNTBVRJ.mjs} +2 -2
  239. package/dist/esm/chunk-PUNTBVRJ.mjs.map +1 -0
  240. package/dist/esm/{chunk-MWNYODWU.mjs → chunk-Q2C6ZY5N.mjs} +2 -2
  241. package/dist/esm/chunk-Q2C6ZY5N.mjs.map +1 -0
  242. package/dist/esm/{chunk-R2YT2IM5.mjs → chunk-Q3VS6AEN.mjs} +2 -2
  243. package/dist/esm/{chunk-R2YT2IM5.mjs.map → chunk-Q3VS6AEN.mjs.map} +1 -1
  244. package/dist/esm/{chunk-JNO7KPMG.mjs → chunk-Q4C4U6I4.mjs} +2 -2
  245. package/dist/esm/chunk-Q4C4U6I4.mjs.map +1 -0
  246. package/dist/esm/{chunk-F45G3GP3.mjs → chunk-QHEKBHNU.mjs} +2 -2
  247. package/dist/esm/chunk-R7QOPBWA.mjs +2 -0
  248. package/dist/esm/chunk-R7QOPBWA.mjs.map +1 -0
  249. package/dist/esm/{chunk-J7PJSK3J.mjs → chunk-RJ7F4JDV.mjs} +1 -1
  250. package/dist/esm/chunk-RJ7F4JDV.mjs.map +1 -0
  251. package/dist/esm/chunk-ROT6S6BM.mjs +2 -0
  252. package/dist/esm/chunk-ROT6S6BM.mjs.map +1 -0
  253. package/dist/esm/{chunk-OGBU52BQ.mjs → chunk-SOLQ5VON.mjs} +2 -2
  254. package/dist/esm/chunk-SOLQ5VON.mjs.map +1 -0
  255. package/dist/esm/{chunk-L3J2QVIY.mjs → chunk-SQR3AIY7.mjs} +2 -2
  256. package/dist/esm/chunk-SQR3AIY7.mjs.map +1 -0
  257. package/dist/esm/{chunk-SPRNSFUV.mjs → chunk-STY74NUA.mjs} +2 -2
  258. package/dist/esm/chunk-STY74NUA.mjs.map +1 -0
  259. package/dist/esm/{chunk-YT3IP57B.mjs → chunk-SZRZ3HIL.mjs} +2 -2
  260. package/dist/esm/chunk-SZRZ3HIL.mjs.map +1 -0
  261. package/dist/esm/{chunk-QZT2M7UA.mjs → chunk-T6NQDM7D.mjs} +2 -2
  262. package/dist/esm/chunk-T6NQDM7D.mjs.map +1 -0
  263. package/dist/esm/{chunk-ZMBXHMVQ.mjs → chunk-TOBQ5UE6.mjs} +2 -2
  264. package/dist/esm/chunk-TOBQ5UE6.mjs.map +1 -0
  265. package/dist/esm/{chunk-4ULPBQ3M.mjs → chunk-UF6SI2QE.mjs} +2 -2
  266. package/dist/esm/chunk-UF6SI2QE.mjs.map +1 -0
  267. package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
  268. package/dist/esm/chunk-UIRAXHDH.mjs.map +1 -0
  269. package/dist/esm/{chunk-S3YVCCYI.mjs → chunk-UONSJQUV.mjs} +2 -2
  270. package/dist/esm/chunk-UONSJQUV.mjs.map +1 -0
  271. package/dist/esm/{chunk-S22QVNK7.mjs → chunk-UQ7D5CSM.mjs} +2 -2
  272. package/dist/esm/chunk-UQ7D5CSM.mjs.map +1 -0
  273. package/dist/esm/{chunk-5O3RHPER.mjs → chunk-UYONA6PP.mjs} +2 -2
  274. package/dist/esm/chunk-UYONA6PP.mjs.map +1 -0
  275. package/dist/esm/{chunk-A7TJF3BX.mjs → chunk-VCIJX6R4.mjs} +2 -2
  276. package/dist/esm/chunk-VCIJX6R4.mjs.map +1 -0
  277. package/dist/esm/{chunk-FSBEKFEF.mjs → chunk-VVAKGJDN.mjs} +2 -2
  278. package/dist/esm/chunk-VVAKGJDN.mjs.map +1 -0
  279. package/dist/esm/chunk-VZELORLW.mjs +2 -0
  280. package/dist/esm/chunk-VZELORLW.mjs.map +1 -0
  281. package/dist/esm/{chunk-IHGA5KAD.mjs → chunk-W4BSN6SK.mjs} +1 -1
  282. package/dist/esm/chunk-W4BSN6SK.mjs.map +1 -0
  283. package/dist/esm/chunk-WCMW2L3P.mjs +2 -0
  284. package/dist/esm/chunk-WCMW2L3P.mjs.map +1 -0
  285. package/dist/esm/{chunk-XOOYRVFK.mjs → chunk-X3SO2LDX.mjs} +2 -2
  286. package/dist/esm/chunk-X3SO2LDX.mjs.map +1 -0
  287. package/dist/esm/{chunk-TTERI67T.mjs → chunk-XGF7UNEW.mjs} +2 -2
  288. package/dist/esm/chunk-XGF7UNEW.mjs.map +1 -0
  289. package/dist/esm/chunk-XHPWHA6B.mjs +2 -0
  290. package/dist/esm/chunk-XHPWHA6B.mjs.map +1 -0
  291. package/dist/esm/{chunk-2E3BT4YW.mjs → chunk-XIFIACCB.mjs} +2 -2
  292. package/dist/esm/chunk-XIFIACCB.mjs.map +1 -0
  293. package/dist/esm/chunk-XJJVJOX5.mjs +2 -0
  294. package/dist/esm/{chunk-UGTIALNW.mjs.map → chunk-XJJVJOX5.mjs.map} +1 -1
  295. package/dist/esm/{chunk-OPO5EYF7.mjs → chunk-XKUIMGKU.mjs} +2 -2
  296. package/dist/esm/chunk-XKUIMGKU.mjs.map +1 -0
  297. package/dist/esm/{chunk-7ZVXQAG4.mjs → chunk-XLFX2YQA.mjs} +2 -2
  298. package/dist/esm/chunk-XLFX2YQA.mjs.map +1 -0
  299. package/dist/esm/chunk-XTOIL6MB.mjs +2 -0
  300. package/dist/esm/chunk-XTOIL6MB.mjs.map +1 -0
  301. package/dist/esm/{chunk-RV7PNWDY.mjs → chunk-Y6QTKAQO.mjs} +2 -2
  302. package/dist/esm/chunk-Y6QTKAQO.mjs.map +1 -0
  303. package/dist/esm/{chunk-HBIDHQ2M.mjs → chunk-YOZBVVKL.mjs} +1 -1
  304. package/dist/esm/chunk-YOZBVVKL.mjs.map +1 -0
  305. package/dist/esm/{chunk-QK32EQSF.mjs → chunk-YPGI5HAA.mjs} +2 -2
  306. package/dist/esm/chunk-YPGI5HAA.mjs.map +1 -0
  307. package/dist/esm/{chunk-GT7QFXER.mjs → chunk-ZJNPBHEI.mjs} +2 -2
  308. package/dist/esm/chunk-ZJNPBHEI.mjs.map +1 -0
  309. package/dist/esm/cli/index.d.mts +1 -0
  310. package/dist/esm/cli/index.mjs +1 -1
  311. package/dist/esm/cli/localNode.d.mts +20 -8
  312. package/dist/esm/cli/localNode.mjs +1 -1
  313. package/dist/esm/cli/move.d.mts +36 -0
  314. package/dist/esm/cli/move.mjs +1 -1
  315. package/dist/esm/client/core.d.mts +5 -0
  316. package/dist/esm/client/core.mjs +1 -1
  317. package/dist/esm/client/get.d.mts +34 -1
  318. package/dist/esm/client/get.mjs +1 -1
  319. package/dist/esm/client/index.d.mts +2 -1
  320. package/dist/esm/client/index.mjs +1 -1
  321. package/dist/esm/client/post.d.mts +38 -0
  322. package/dist/esm/client/post.mjs +1 -1
  323. package/dist/esm/core/account/index.d.mts +1 -0
  324. package/dist/esm/core/account/index.mjs +1 -1
  325. package/dist/esm/core/account/utils/address.d.mts +7 -0
  326. package/dist/esm/core/account/utils/address.mjs +1 -1
  327. package/dist/esm/core/account/utils/index.d.mts +1 -0
  328. package/dist/esm/core/account/utils/index.mjs +1 -1
  329. package/dist/esm/core/accountAddress.d.mts +47 -0
  330. package/dist/esm/core/accountAddress.mjs +1 -1
  331. package/dist/esm/core/authenticationKey.d.mts +2 -1
  332. package/dist/esm/core/authenticationKey.mjs +1 -1
  333. package/dist/esm/core/common.d.mts +14 -0
  334. package/dist/esm/core/common.mjs +1 -1
  335. package/dist/esm/core/crypto/ed25519.d.mts +58 -5
  336. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  337. package/dist/esm/core/crypto/ephemeral.d.mts +24 -1
  338. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  339. package/dist/esm/core/crypto/federatedKeyless.d.mts +14 -1
  340. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  341. package/dist/esm/core/crypto/hdKey.d.mts +28 -0
  342. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  343. package/dist/esm/core/crypto/index.d.mts +3 -2
  344. package/dist/esm/core/crypto/index.mjs +1 -1
  345. package/dist/esm/core/crypto/keyless.d.mts +132 -1
  346. package/dist/esm/core/crypto/keyless.mjs +1 -1
  347. package/dist/esm/core/crypto/multiEd25519.d.mts +42 -1
  348. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  349. package/dist/esm/core/crypto/multiKey.d.mts +39 -1
  350. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  351. package/dist/esm/core/crypto/poseidon.d.mts +10 -0
  352. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  353. package/dist/esm/core/crypto/privateKey.d.mts +10 -1
  354. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  355. package/dist/esm/core/crypto/proof.d.mts +3 -0
  356. package/dist/esm/core/crypto/proof.mjs +1 -1
  357. package/dist/esm/core/crypto/publicKey.d.mts +2 -1
  358. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  359. package/dist/esm/core/crypto/secp256k1.d.mts +52 -3
  360. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  361. package/dist/esm/core/crypto/signature.d.mts +7 -0
  362. package/dist/esm/core/crypto/signature.mjs +1 -1
  363. package/dist/esm/core/crypto/singleKey.d.mts +37 -2
  364. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  365. package/dist/esm/core/crypto/utils.d.mts +3 -0
  366. package/dist/esm/core/crypto/utils.mjs +1 -1
  367. package/dist/esm/core/hex.d.mts +21 -0
  368. package/dist/esm/core/hex.mjs +1 -1
  369. package/dist/esm/core/index.d.mts +3 -2
  370. package/dist/esm/core/index.mjs +1 -1
  371. package/dist/esm/errors/index.d.mts +1 -0
  372. package/dist/esm/errors/index.mjs +1 -1
  373. package/dist/esm/index.d.mts +9 -6
  374. package/dist/esm/index.mjs +1 -1
  375. package/dist/esm/internal/account.d.mts +25 -4
  376. package/dist/esm/internal/account.mjs +1 -1
  377. package/dist/esm/internal/ans.d.mts +28 -2
  378. package/dist/esm/internal/ans.mjs +1 -1
  379. package/dist/esm/internal/coin.d.mts +4 -1
  380. package/dist/esm/internal/coin.mjs +1 -1
  381. package/dist/esm/internal/digitalAsset.d.mts +32 -2
  382. package/dist/esm/internal/digitalAsset.mjs +1 -1
  383. package/dist/esm/internal/event.d.mts +6 -0
  384. package/dist/esm/internal/event.mjs +1 -1
  385. package/dist/esm/internal/faucet.d.mts +6 -0
  386. package/dist/esm/internal/faucet.mjs +1 -1
  387. package/dist/esm/internal/fungibleAsset.d.mts +9 -2
  388. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  389. package/dist/esm/internal/general.d.mts +8 -0
  390. package/dist/esm/internal/general.mjs +1 -1
  391. package/dist/esm/internal/keyless.d.mts +7 -2
  392. package/dist/esm/internal/keyless.mjs +1 -1
  393. package/dist/esm/internal/object.d.mts +3 -0
  394. package/dist/esm/internal/object.mjs +1 -1
  395. package/dist/esm/internal/staking.d.mts +6 -1
  396. package/dist/esm/internal/staking.mjs +1 -1
  397. package/dist/esm/internal/table.d.mts +4 -0
  398. package/dist/esm/internal/table.mjs +1 -1
  399. package/dist/esm/internal/transaction.d.mts +15 -0
  400. package/dist/esm/internal/transaction.mjs +1 -1
  401. package/dist/esm/internal/transactionSubmission.d.mts +17 -5
  402. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  403. package/dist/esm/internal/view.d.mts +3 -1
  404. package/dist/esm/internal/view.mjs +1 -1
  405. package/dist/esm/{publicKey-BVXX1nVl.d.mts → publicKey-BMtGNNLg.d.mts} +36 -0
  406. package/dist/esm/transactions/authenticator/account.d.mts +29 -1
  407. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  408. package/dist/esm/transactions/authenticator/index.d.mts +3 -1
  409. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  410. package/dist/esm/transactions/authenticator/transaction.d.mts +24 -2
  411. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  412. package/dist/esm/transactions/index.d.mts +6 -3
  413. package/dist/esm/transactions/index.mjs +1 -1
  414. package/dist/esm/transactions/instances/chainId.d.mts +9 -0
  415. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  416. package/dist/esm/transactions/instances/identifier.d.mts +9 -0
  417. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  418. package/dist/esm/transactions/instances/index.d.mts +3 -1
  419. package/dist/esm/transactions/instances/index.mjs +1 -1
  420. package/dist/esm/transactions/instances/moduleId.d.mts +11 -0
  421. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  422. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +9 -0
  423. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  424. package/dist/esm/transactions/instances/rawTransaction.d.mts +31 -0
  425. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  426. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +8 -1
  427. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  428. package/dist/esm/transactions/instances/signedTransaction.d.mts +11 -1
  429. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  430. package/dist/esm/transactions/instances/simpleTransaction.d.mts +9 -0
  431. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  432. package/dist/esm/transactions/instances/transactionArgument.d.mts +17 -0
  433. package/dist/esm/transactions/instances/transactionPayload.d.mts +49 -0
  434. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  435. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +20 -2
  436. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  437. package/dist/esm/transactions/management/asyncQueue.d.mts +16 -0
  438. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  439. package/dist/esm/transactions/management/index.d.mts +4 -2
  440. package/dist/esm/transactions/management/index.mjs +1 -1
  441. package/dist/esm/transactions/management/transactionWorker.d.mts +46 -7
  442. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  443. package/dist/esm/transactions/scriptComposer/index.d.mts +47 -0
  444. package/dist/esm/transactions/scriptComposer/index.mjs +2 -0
  445. package/dist/esm/transactions/scriptComposer/index.mjs.map +1 -0
  446. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +65 -1
  447. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  448. package/dist/esm/transactions/transactionBuilder/index.d.mts +4 -2
  449. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  450. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +37 -3
  451. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  452. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +11 -1
  453. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  454. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +43 -1
  455. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  456. package/dist/esm/transactions/typeTag/index.d.mts +83 -0
  457. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  458. package/dist/esm/transactions/typeTag/parser.d.mts +9 -0
  459. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  460. package/dist/esm/transactions/types.d.mts +90 -2
  461. package/dist/esm/types/index.d.mts +1 -0
  462. package/dist/esm/types/index.mjs +1 -1
  463. package/dist/esm/types/indexer.d.mts +52 -0
  464. package/dist/esm/types/keyless.d.mts +12 -0
  465. package/dist/esm/types/types.d.mts +1 -0
  466. package/dist/esm/utils/apiEndpoints.d.mts +30 -0
  467. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  468. package/dist/esm/utils/const.d.mts +24 -0
  469. package/dist/esm/utils/const.mjs +1 -1
  470. package/dist/esm/utils/helpers.d.mts +21 -0
  471. package/dist/esm/utils/helpers.mjs +1 -1
  472. package/dist/esm/utils/index.d.mts +1 -0
  473. package/dist/esm/utils/index.mjs +1 -1
  474. package/dist/esm/utils/memoize.d.mts +4 -0
  475. package/dist/esm/utils/memoize.mjs +1 -1
  476. package/dist/esm/utils/normalizeBundle.d.mts +9 -0
  477. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  478. package/dist/esm/version.d.mts +1 -1
  479. package/dist/esm/version.mjs +1 -1
  480. package/package.json +10 -4
  481. package/src/account/AbstractKeylessAccount.ts +80 -9
  482. package/src/account/Account.ts +51 -6
  483. package/src/account/AccountUtils.ts +216 -0
  484. package/src/account/Ed25519Account.ts +26 -0
  485. package/src/account/EphemeralKeyPair.ts +30 -0
  486. package/src/account/FederatedKeylessAccount.ts +10 -3
  487. package/src/account/KeylessAccount.ts +13 -1
  488. package/src/account/MultiKeyAccount.ts +75 -12
  489. package/src/account/SingleKeyAccount.ts +63 -6
  490. package/src/account/index.ts +1 -0
  491. package/src/account/utils.ts +16 -0
  492. package/src/api/account.ts +22 -2
  493. package/src/api/ans.ts +15 -0
  494. package/src/api/aptos.ts +3 -0
  495. package/src/api/aptosConfig.ts +24 -0
  496. package/src/api/coin.ts +3 -0
  497. package/src/api/digitalAsset.ts +26 -0
  498. package/src/api/event.ts +6 -0
  499. package/src/api/faucet.ts +11 -2
  500. package/src/api/fungibleAsset.ts +8 -0
  501. package/src/api/general.ts +12 -0
  502. package/src/api/keyless.ts +6 -0
  503. package/src/api/object.ts +3 -0
  504. package/src/api/staking.ts +5 -0
  505. package/src/api/table.ts +5 -0
  506. package/src/api/transaction.ts +19 -3
  507. package/src/api/transactionSubmission/build.ts +89 -2
  508. package/src/api/transactionSubmission/helpers.ts +2 -0
  509. package/src/api/transactionSubmission/management.ts +5 -0
  510. package/src/api/transactionSubmission/sign.ts +4 -0
  511. package/src/api/transactionSubmission/simulate.ts +4 -0
  512. package/src/api/transactionSubmission/submit.ts +4 -0
  513. package/src/api/utils.ts +1 -0
  514. package/src/bcs/deserializer.ts +64 -2
  515. package/src/bcs/serializable/entryFunctionBytes.ts +10 -0
  516. package/src/bcs/serializable/fixedBytes.ts +12 -0
  517. package/src/bcs/serializable/movePrimitives.ts +26 -0
  518. package/src/bcs/serializable/moveStructs.ts +56 -0
  519. package/src/bcs/serializer.ts +64 -1
  520. package/src/cli/localNode.ts +22 -8
  521. package/src/cli/move.ts +42 -0
  522. package/src/client/core.ts +4 -0
  523. package/src/client/get.ts +75 -1
  524. package/src/client/post.ts +37 -0
  525. package/src/core/account/utils/address.ts +6 -0
  526. package/src/core/accountAddress.ts +46 -0
  527. package/src/core/authenticationKey.ts +22 -0
  528. package/src/core/common.ts +14 -0
  529. package/src/core/crypto/ed25519.ts +58 -4
  530. package/src/core/crypto/ephemeral.ts +22 -0
  531. package/src/core/crypto/federatedKeyless.ts +12 -0
  532. package/src/core/crypto/hdKey.ts +29 -0
  533. package/src/core/crypto/keyless.ts +134 -0
  534. package/src/core/crypto/multiEd25519.ts +40 -0
  535. package/src/core/crypto/multiKey.ts +37 -1
  536. package/src/core/crypto/poseidon.ts +20 -0
  537. package/src/core/crypto/privateKey.ts +17 -8
  538. package/src/core/crypto/proof.ts +2 -0
  539. package/src/core/crypto/publicKey.ts +14 -0
  540. package/src/core/crypto/secp256k1.ts +62 -5
  541. package/src/core/crypto/signature.ts +8 -0
  542. package/src/core/crypto/singleKey.ts +34 -2
  543. package/src/core/crypto/utils.ts +2 -0
  544. package/src/core/hex.ts +20 -0
  545. package/src/internal/account.ts +27 -7
  546. package/src/internal/ans.ts +27 -0
  547. package/src/internal/coin.ts +1 -0
  548. package/src/internal/digitalAsset.ts +30 -0
  549. package/src/internal/event.ts +6 -0
  550. package/src/internal/faucet.ts +5 -0
  551. package/src/internal/fungibleAsset.ts +5 -0
  552. package/src/internal/general.ts +7 -0
  553. package/src/internal/keyless.ts +4 -0
  554. package/src/internal/object.ts +2 -0
  555. package/src/internal/staking.ts +5 -1
  556. package/src/internal/table.ts +3 -0
  557. package/src/internal/transaction.ts +16 -0
  558. package/src/internal/transactionSubmission.ts +15 -2
  559. package/src/transactions/authenticator/account.ts +26 -0
  560. package/src/transactions/authenticator/transaction.ts +20 -0
  561. package/src/transactions/index.ts +1 -0
  562. package/src/transactions/instances/chainId.ts +8 -0
  563. package/src/transactions/instances/identifier.ts +8 -0
  564. package/src/transactions/instances/moduleId.ts +10 -0
  565. package/src/transactions/instances/multiAgentTransaction.ts +8 -0
  566. package/src/transactions/instances/rawTransaction.ts +30 -0
  567. package/src/transactions/instances/rotationProofChallenge.ts +6 -0
  568. package/src/transactions/instances/signedTransaction.ts +8 -0
  569. package/src/transactions/instances/simpleTransaction.ts +8 -0
  570. package/src/transactions/instances/transactionArgument.ts +16 -0
  571. package/src/transactions/instances/transactionPayload.ts +50 -0
  572. package/src/transactions/management/accountSequenceNumber.ts +16 -0
  573. package/src/transactions/management/asyncQueue.ts +16 -0
  574. package/src/transactions/management/transactionWorker.ts +42 -5
  575. package/src/transactions/scriptComposer/index.ts +86 -0
  576. package/src/transactions/transactionBuilder/helpers.ts +82 -10
  577. package/src/transactions/transactionBuilder/remoteAbi.ts +75 -1
  578. package/src/transactions/transactionBuilder/signingMessage.ts +10 -0
  579. package/src/transactions/transactionBuilder/transactionBuilder.ts +58 -0
  580. package/src/transactions/typeTag/index.ts +82 -0
  581. package/src/transactions/typeTag/parser.ts +24 -0
  582. package/src/transactions/types.ts +89 -0
  583. package/src/types/index.ts +1 -0
  584. package/src/types/indexer.ts +52 -0
  585. package/src/types/keyless.ts +12 -0
  586. package/src/utils/apiEndpoints.ts +30 -2
  587. package/src/utils/const.ts +24 -1
  588. package/src/utils/helpers.ts +22 -0
  589. package/src/utils/memoize.ts +6 -0
  590. package/src/utils/normalizeBundle.ts +8 -1
  591. package/src/version.ts +1 -1
  592. package/dist/common/chunk-F43XVDYJ.js.map +0 -1
  593. package/dist/esm/chunk-2CJC43CV.mjs.map +0 -1
  594. package/dist/esm/chunk-2E3BT4YW.mjs.map +0 -1
  595. package/dist/esm/chunk-42H7WETG.mjs.map +0 -1
  596. package/dist/esm/chunk-476F5NJ6.mjs.map +0 -1
  597. package/dist/esm/chunk-4IQZOAN7.mjs.map +0 -1
  598. package/dist/esm/chunk-4O5XDQDO.mjs +0 -2
  599. package/dist/esm/chunk-4O5XDQDO.mjs.map +0 -1
  600. package/dist/esm/chunk-4ULPBQ3M.mjs.map +0 -1
  601. package/dist/esm/chunk-4ZNSNWQL.mjs.map +0 -1
  602. package/dist/esm/chunk-5B3SMBXQ.mjs +0 -2
  603. package/dist/esm/chunk-5B3SMBXQ.mjs.map +0 -1
  604. package/dist/esm/chunk-5O3RHPER.mjs.map +0 -1
  605. package/dist/esm/chunk-5XLZACVT.mjs.map +0 -1
  606. package/dist/esm/chunk-64IZ5PQR.mjs.map +0 -1
  607. package/dist/esm/chunk-6AEXQEO2.mjs.map +0 -1
  608. package/dist/esm/chunk-6Q2O5G3J.mjs.map +0 -1
  609. package/dist/esm/chunk-6ZOVTYLJ.mjs.map +0 -1
  610. package/dist/esm/chunk-737YW3CY.mjs.map +0 -1
  611. package/dist/esm/chunk-7ZA434Z3.mjs +0 -2
  612. package/dist/esm/chunk-7ZA434Z3.mjs.map +0 -1
  613. package/dist/esm/chunk-7ZVXQAG4.mjs.map +0 -1
  614. package/dist/esm/chunk-A3USS2NC.mjs.map +0 -1
  615. package/dist/esm/chunk-A7TJF3BX.mjs.map +0 -1
  616. package/dist/esm/chunk-ACVIE7IE.mjs.map +0 -1
  617. package/dist/esm/chunk-AITN3DO4.mjs +0 -2
  618. package/dist/esm/chunk-AITN3DO4.mjs.map +0 -1
  619. package/dist/esm/chunk-AJ5JHBAE.mjs.map +0 -1
  620. package/dist/esm/chunk-AKIO3OIT.mjs.map +0 -1
  621. package/dist/esm/chunk-AOROYJ74.mjs.map +0 -1
  622. package/dist/esm/chunk-AVZYJAXR.mjs +0 -2
  623. package/dist/esm/chunk-AVZYJAXR.mjs.map +0 -1
  624. package/dist/esm/chunk-B5BXB2BB.mjs.map +0 -1
  625. package/dist/esm/chunk-BRV3RLKW.mjs.map +0 -1
  626. package/dist/esm/chunk-BWV6OYLG.mjs.map +0 -1
  627. package/dist/esm/chunk-CK5NDXQT.mjs.map +0 -1
  628. package/dist/esm/chunk-D3OEQLUE.mjs +0 -2
  629. package/dist/esm/chunk-D3OEQLUE.mjs.map +0 -1
  630. package/dist/esm/chunk-D52UKPQF.mjs +0 -2
  631. package/dist/esm/chunk-D52UKPQF.mjs.map +0 -1
  632. package/dist/esm/chunk-D54FD6XE.mjs.map +0 -1
  633. package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
  634. package/dist/esm/chunk-FH27D7S3.mjs.map +0 -1
  635. package/dist/esm/chunk-FSBEKFEF.mjs.map +0 -1
  636. package/dist/esm/chunk-FUC7SLH7.mjs.map +0 -1
  637. package/dist/esm/chunk-GAEAYY44.mjs +0 -1
  638. package/dist/esm/chunk-GMKKHGXK.mjs.map +0 -1
  639. package/dist/esm/chunk-GT7QFXER.mjs.map +0 -1
  640. package/dist/esm/chunk-H7PDLUNP.mjs +0 -2
  641. package/dist/esm/chunk-H7PDLUNP.mjs.map +0 -1
  642. package/dist/esm/chunk-HBIDHQ2M.mjs.map +0 -1
  643. package/dist/esm/chunk-HKVZ7CAG.mjs.map +0 -1
  644. package/dist/esm/chunk-HULCIESG.mjs.map +0 -1
  645. package/dist/esm/chunk-I3452DF5.mjs.map +0 -1
  646. package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
  647. package/dist/esm/chunk-IHGA5KAD.mjs.map +0 -1
  648. package/dist/esm/chunk-J7PJSK3J.mjs.map +0 -1
  649. package/dist/esm/chunk-JKA22FG5.mjs.map +0 -1
  650. package/dist/esm/chunk-JNO7KPMG.mjs.map +0 -1
  651. package/dist/esm/chunk-JUQBFGUD.mjs.map +0 -1
  652. package/dist/esm/chunk-JYGAG754.mjs +0 -2
  653. package/dist/esm/chunk-JYGAG754.mjs.map +0 -1
  654. package/dist/esm/chunk-KKLF7DQV.mjs.map +0 -1
  655. package/dist/esm/chunk-KPPM2BSC.mjs.map +0 -1
  656. package/dist/esm/chunk-L3J2QVIY.mjs.map +0 -1
  657. package/dist/esm/chunk-LGTOOAQI.mjs.map +0 -1
  658. package/dist/esm/chunk-LK67PZX3.mjs.map +0 -1
  659. package/dist/esm/chunk-LRN4ALMT.mjs +0 -2
  660. package/dist/esm/chunk-LRN4ALMT.mjs.map +0 -1
  661. package/dist/esm/chunk-LWXBEIFO.mjs +0 -2
  662. package/dist/esm/chunk-LWXBEIFO.mjs.map +0 -1
  663. package/dist/esm/chunk-LZ5PSDOS.mjs.map +0 -1
  664. package/dist/esm/chunk-MCWOKFVH.mjs +0 -2
  665. package/dist/esm/chunk-MCWOKFVH.mjs.map +0 -1
  666. package/dist/esm/chunk-MHN6XY4Z.mjs +0 -2
  667. package/dist/esm/chunk-MHN6XY4Z.mjs.map +0 -1
  668. package/dist/esm/chunk-MV5PGWJQ.mjs +0 -2
  669. package/dist/esm/chunk-MV5PGWJQ.mjs.map +0 -1
  670. package/dist/esm/chunk-MWNYODWU.mjs.map +0 -1
  671. package/dist/esm/chunk-O4MRRWRI.mjs.map +0 -1
  672. package/dist/esm/chunk-OEM75TVE.mjs.map +0 -1
  673. package/dist/esm/chunk-OGBU52BQ.mjs.map +0 -1
  674. package/dist/esm/chunk-OIOGOW6I.mjs.map +0 -1
  675. package/dist/esm/chunk-OPO5EYF7.mjs.map +0 -1
  676. package/dist/esm/chunk-P6RNNESB.mjs.map +0 -1
  677. package/dist/esm/chunk-P74XXLE4.mjs.map +0 -1
  678. package/dist/esm/chunk-Q3CWUEXI.mjs.map +0 -1
  679. package/dist/esm/chunk-QK32EQSF.mjs.map +0 -1
  680. package/dist/esm/chunk-QLC7SSLJ.mjs +0 -2
  681. package/dist/esm/chunk-QLC7SSLJ.mjs.map +0 -1
  682. package/dist/esm/chunk-QN7AK5PU.mjs.map +0 -1
  683. package/dist/esm/chunk-QZT2M7UA.mjs.map +0 -1
  684. package/dist/esm/chunk-RV7PNWDY.mjs.map +0 -1
  685. package/dist/esm/chunk-S22QVNK7.mjs.map +0 -1
  686. package/dist/esm/chunk-S3YVCCYI.mjs.map +0 -1
  687. package/dist/esm/chunk-SMFTISPN.mjs +0 -2
  688. package/dist/esm/chunk-SMFTISPN.mjs.map +0 -1
  689. package/dist/esm/chunk-SPRNSFUV.mjs.map +0 -1
  690. package/dist/esm/chunk-T6ADNZE5.mjs.map +0 -1
  691. package/dist/esm/chunk-TQA6HY6A.mjs.map +0 -1
  692. package/dist/esm/chunk-TTERI67T.mjs.map +0 -1
  693. package/dist/esm/chunk-U7UTBXJD.mjs.map +0 -1
  694. package/dist/esm/chunk-UGTIALNW.mjs +0 -2
  695. package/dist/esm/chunk-UZTJWOLS.mjs +0 -2
  696. package/dist/esm/chunk-UZTJWOLS.mjs.map +0 -1
  697. package/dist/esm/chunk-V4FKFCBL.mjs.map +0 -1
  698. package/dist/esm/chunk-V5NDNR36.mjs +0 -2
  699. package/dist/esm/chunk-V5NDNR36.mjs.map +0 -1
  700. package/dist/esm/chunk-VAKNMHOA.mjs.map +0 -1
  701. package/dist/esm/chunk-VELQA2Y3.mjs +0 -2
  702. package/dist/esm/chunk-VELQA2Y3.mjs.map +0 -1
  703. package/dist/esm/chunk-VQZMI3EZ.mjs.map +0 -1
  704. package/dist/esm/chunk-WTWWJWKC.mjs +0 -2
  705. package/dist/esm/chunk-WTWWJWKC.mjs.map +0 -1
  706. package/dist/esm/chunk-WXLSHECY.mjs.map +0 -1
  707. package/dist/esm/chunk-XOOYRVFK.mjs.map +0 -1
  708. package/dist/esm/chunk-XVPWTWPY.mjs.map +0 -1
  709. package/dist/esm/chunk-Y5HLXDYG.mjs.map +0 -1
  710. package/dist/esm/chunk-YITOC4Z6.mjs.map +0 -1
  711. package/dist/esm/chunk-YQHOQJRQ.mjs +0 -2
  712. package/dist/esm/chunk-YT3IP57B.mjs.map +0 -1
  713. package/dist/esm/chunk-ZMBXHMVQ.mjs.map +0 -1
  714. /package/dist/esm/{chunk-FD6FGKYY.mjs.map → account/AccountUtils.mjs.map} +0 -0
  715. /package/dist/esm/{chunk-GAEAYY44.mjs.map → account/utils.mjs.map} +0 -0
  716. /package/dist/esm/{chunk-I5OYNCZS.mjs.map → chunk-GP4TLDVZ.mjs.map} +0 -0
  717. /package/dist/esm/{chunk-2D7OMWVL.mjs.map → chunk-KFCLSJC3.mjs.map} +0 -0
  718. /package/dist/esm/{chunk-F45G3GP3.mjs.map → chunk-QHEKBHNU.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bcs/serializable/entryFunctionBytes.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializer, Serializable } from \"../serializer\";\nimport { Deserializer } from \"../deserializer\";\nimport { FixedBytes } from \"./fixedBytes\";\nimport { EntryFunctionArgument } from \"../../transactions/instances/transactionArgument\";\nimport { HexInput } from \"../../types\";\n\n/**\n * This class exists solely to represent a sequence of fixed bytes as a serialized entry function, because\n * serializing an entry function appends a prefix that's *only* used for entry function arguments.\n *\n * NOTE: Using this class for serialized script functions will lead to erroneous and unexpected behavior.\n *\n * If you wish to convert this class back to a TransactionArgument, you must know the type\n * of the argument beforehand, and use the appropriate class to deserialize the bytes within\n * an instance of this class.\n * @group Implementation\n * @category BCS\n */\nexport class EntryFunctionBytes extends Serializable implements EntryFunctionArgument {\n public readonly value: FixedBytes;\n\n /**\n * Creates an instance of the class with a specified hexadecimal input value.\n *\n * @param value - The hexadecimal input to be converted into FixedBytes.\n * @group Implementation\n * @category BCS\n */\n private constructor(value: HexInput) {\n super();\n this.value = new FixedBytes(value);\n }\n\n // Note that to see the Move, BCS-serialized representation of the underlying fixed byte vector,\n // we must not serialize the length prefix.\n //\n // In other words, this class is only used to represent a sequence of bytes that are already\n // BCS-serialized as a type. To represent those bytes accurately, the BCS-serialized form is the same exact\n // representation.\n\n /**\n * Serializes the value using the provided serializer.\n * This function is essential for accurately representing a sequence of bytes that are already BCS-serialized as a type.\n *\n * Note that to see the Move, BCS-serialized representation of the underlying fixed byte vector,\n * we must not serialize the length prefix.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category BCS\n */\n serialize(serializer: Serializer): void {\n serializer.serialize(this.value);\n }\n\n // When we serialize these bytes as an entry function argument, we need to\n // serialize the length prefix. This essentially converts the underlying fixed byte vector to a type-agnostic\n // byte vector to an `any` type.\n // NOTE: This, and the lack of a `serializeForScriptFunction`, is the only meaningful difference between this\n // class and FixedBytes.\n\n /**\n * Serializes the current instance for use as an entry function argument by converting the underlying fixed byte vector to a\n * type-agnostic byte vector.\n * This process includes serializing the length prefix of the byte vector.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category BCS\n */\n serializeForEntryFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(this.value.value.length);\n serializer.serialize(this);\n }\n\n /**\n * The only way to create an instance of this class is to use this static method.\n * This function should only be used when deserializing a sequence of EntryFunctionPayload arguments.\n * @param deserializer - The deserializer instance with the buffered bytes.\n * @param length - The length of the bytes to deserialize.\n * @returns An instance of this class, which will now only be usable as an EntryFunctionArgument.\n * @group Implementation\n * @category BCS\n */\n static deserialize(deserializer: Deserializer, length: number): EntryFunctionBytes {\n const fixedBytes = FixedBytes.deserialize(deserializer, length);\n return new EntryFunctionBytes(fixedBytes.value);\n }\n}\n"],"mappings":"kFAqBO,IAAMA,EAAN,MAAMC,UAA2BC,CAA8C,CAU5E,YAAYC,EAAiB,CACnC,MAAM,EACN,KAAK,MAAQ,IAAIC,EAAWD,CAAK,CACnC,CAoBA,UAAUE,EAA8B,CACtCA,EAAW,UAAU,KAAK,KAAK,CACjC,CAiBA,0BAA0BA,EAA8B,CACtDA,EAAW,sBAAsB,KAAK,MAAM,MAAM,MAAM,EACxDA,EAAW,UAAU,IAAI,CAC3B,CAWA,OAAO,YAAYC,EAA4BC,EAAoC,CACjF,IAAMC,EAAaJ,EAAW,YAAYE,EAAcC,CAAM,EAC9D,OAAO,IAAIN,EAAmBO,EAAW,KAAK,CAChD,CACF","names":["EntryFunctionBytes","_EntryFunctionBytes","Serializable","value","FixedBytes","serializer","deserializer","length","fixedBytes"]}
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as t,d as s}from"./chunk-U7UTBXJD.mjs";import{a as n}from"./chunk-ALOYOMRE.mjs";var i=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),o({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),r({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),t({aptosConfig:this.config,...e})}async getEvents(e){return await n({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"events_processor"}),s({aptosConfig:this.config,...e})}};export{i as a};
2
- //# sourceMappingURL=chunk-4ULPBQ3M.mjs.map
1
+ import{a as o,b as r,c as t,d as s}from"./chunk-66AQ2MJ6.mjs";import{a as n}from"./chunk-H3XZ3FZY.mjs";var i=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),o({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),r({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await n({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),t({aptosConfig:this.config,...e})}async getEvents(e){return await n({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"events_processor"}),s({aptosConfig:this.config,...e})}};export{i as a};
2
+ //# sourceMappingURL=chunk-UF6SI2QE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/event.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n getAccountEventsByCreationNumber,\n getAccountEventsByEventType,\n getModuleEventsByEventType,\n getEvents,\n} from \"../internal/event\";\nimport { AnyNumber, GetEventsResponse, MoveStructId, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { EventsBoolExp } from \"../types/generated/types\";\nimport { AccountAddressInput } from \"../core\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\n\n/**\n * A class to query all `Event` Aptos related queries.\n * @group Event\n */\nexport class Event {\n /**\n * Initializes a new instance of the Aptos client with the provided configuration.\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.faucetUrl - The URL of the faucet to use for funding accounts.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new Aptos client with Testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your own network if needed\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Event\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Retrieve module events based on a specified event type.\n * This function allows you to query for events that are associated with a particular module event type in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving module events.\n * @param args.eventType - The event type to filter the results.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options - Optional pagination and ordering parameters for the event results.\n *\n * @returns Promise<GetEventsResponse> - A promise that resolves to the retrieved events.\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 * // Retrieve module events for a specific event type\n * const events = await aptos.getModuleEventsByEventType({\n * eventType: \"0x1::transaction_fee::FeeStatement\", // specify the event type\n * minimumLedgerVersion: 1, // optional: specify minimum ledger version if needed\n * });\n *\n * console.log(events); // log the retrieved events\n * }\n * runExample().catch(console.error);\n * ```\n * @group Event\n */\n async getModuleEventsByEventType(args: {\n eventType: MoveStructId;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getModuleEventsByEventType({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve events associated with a specific account address and creation number.\n *\n * @param args - The parameters for retrieving account events.\n * @param args.accountAddress - The account address to query events for.\n * @param args.creationNumber - The event creation number to filter the events.\n * @param args.minimumLedgerVersion - Optional minimum ledger version to sync up to before querying.\n *\n * @returns Promise<GetEventsResponse>\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 * // Get events for the account at creation number 0\n * const events = await aptos.getAccountEventsByCreationNumber({\n * accountAddress: \"0x1\", // replace with a real account address\n * creationNumber: 0,\n * });\n *\n * console.log(events);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Event\n */\n async getAccountEventsByCreationNumber(args: {\n accountAddress: AccountAddressInput;\n creationNumber: AnyNumber;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getAccountEventsByCreationNumber({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve events associated with a specific account address and event type.\n *\n * @param args.accountAddress - The account address to query events for.\n * @param args.eventType - The type of event to filter by.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options - Optional pagination and ordering parameters for the event query.\n *\n * @returns Promise<GetEventsResponse>\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 * // Get events for a specific account and event type\n * const events = await aptos.getAccountEventsByEventType({\n * accountAddress: \"0x1\", // replace with a real account address\n * eventType: \"0x1::transaction_fee::FeeStatement\", // replace with a real event type\n * minimumLedgerVersion: 1, // optional, specify if needed\n * });\n *\n * console.log(events);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Event\n */\n async getAccountEventsByEventType(args: {\n accountAddress: AccountAddressInput;\n eventType: MoveStructId;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]>;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getAccountEventsByEventType({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieve all events from the Aptos blockchain.\n * An optional `where` clause can be provided to filter the results based on specific criteria.\n *\n * @param args Optional parameters for the query.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options Optional pagination and filtering options.\n * @param args.options.where Optional condition to filter events.\n * @param args.options.offset Optional pagination offset.\n * @param args.options.limit Optional maximum number of events to return.\n * @param args.options.orderBy Optional ordering of the results.\n *\n * @returns GetEventsQuery response type containing the events.\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 * // Retrieve all events\n * const events = await aptos.getEvents();\n *\n * // Retrieve events with filtering by account address\n * const whereCondition = {\n * account_address: { _eq: \"0x123\" }, // replace with a real account address\n * };\n * const filteredEvents = await aptos.getEvents({\n * options: { where: whereCondition },\n * });\n *\n * console.log(events);\n * console.log(filteredEvents);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Event\n */\n async getEvents(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetEventsResponse[0]> & WhereArg<EventsBoolExp>;\n }): Promise<GetEventsResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.EVENTS_PROCESSOR,\n });\n return getEvents({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"uGAoBO,IAAMA,EAAN,KAAY,CAwBjB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAiC3C,MAAM,2BAA2BC,EAIF,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACME,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACzE,CAgCA,MAAM,iCAAiCA,EAIR,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACMG,EAAiC,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC/E,CAiCA,MAAM,4BAA4BA,EAKH,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,gCACF,CAAC,EACMI,EAA4B,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC1E,CA0CA,MAAM,UAAUA,EAGe,CAC7B,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,gCACF,CAAC,EACMK,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CACxD,CACF","names":["Event","config","args","waitForIndexerOnVersion","getModuleEventsByEventType","getAccountEventsByCreationNumber","getAccountEventsByEventType","getEvents"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-UIRAXHDH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{a as r,b as t,c as o,d as s}from"./chunk-KPPM2BSC.mjs";var n=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async getProof(e){return t({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return o({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return s({aptosConfig:this.config,...e})}};export{n as a};
2
- //# sourceMappingURL=chunk-S3YVCCYI.mjs.map
1
+ import{a as r,b as t,c as o,d as s}from"./chunk-CDYLZDD2.mjs";var n=class{constructor(e){this.config=e}async getPepper(e){return r({aptosConfig:this.config,...e})}async getProof(e){return t({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return o({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return s({aptosConfig:this.config,...e})}};export{n as a};
2
+ //# sourceMappingURL=chunk-UONSJQUV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { AccountAddressInput, ZeroKnowledgeSig } from \"../core\";\nimport {\n deriveKeylessAccount,\n getPepper,\n getProof,\n updateFederatedKeylessJwkSetTransaction,\n} from \"../internal/keyless\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { HexInput } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to query all `Keyless` related queries on Aptos.\n *\n * More documentation on how to integrate Keyless Accounts see the below\n * [Aptos Keyless Integration Guide](https://aptos.dev/guides/keyless-accounts/#aptos-keyless-integration-guide).\n * @group Keyless\n */\nexport class Keyless {\n /**\n * Initializes a new instance of the Aptos class with the provided configuration.\n * This allows you to interact with the Aptos blockchain using the specified network settings.\n *\n * @param config - The configuration settings for connecting to the Aptos network.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new configuration for the Aptos client\n * const config = new AptosConfig({ network: Network.TESTNET }); // Specify your desired network\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Keyless\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Fetches the pepper from the Aptos pepper service API.\n *\n * @param args - The arguments for fetching the pepper.\n * @param args.jwt - JWT token.\n * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token.\n * @param args.derivationPath - A derivation path used for creating multiple accounts per user via the BIP-44 standard. Defaults\n * to \"m/44'/637'/0'/0'/0\".\n * @returns The pepper which is a Uint8Array of length 31.\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 * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair\n * const jwt = \"your_jwt_token\"; // replace with a real JWT token\n *\n * // Fetching the pepper using the provided JWT and ephemeral key pair\n * const pepper = await aptos.getPepper({\n * jwt,\n * ephemeralKeyPair,\n * // derivationPath: \"m/44'/637'/0'/0'/0\" // specify your own if needed\n * });\n *\n * console.log(\"Fetched pepper:\", pepper);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Keyless\n */\n async getPepper(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n derivationPath?: string;\n }): Promise<Uint8Array> {\n return getPepper({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Fetches a proof from the Aptos prover service API.\n *\n * @param args - The arguments for fetching the proof.\n * @param args.jwt - JWT token.\n * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token.\n * @param args.pepper - The pepper used for the account. If not provided, it will be fetched from the Aptos pepper service.\n * @param args.uidKey - A key in the JWT token to use to set the uidVal in the IdCommitment.\n *\n * @returns The proof which is represented by a ZeroKnowledgeSig.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, EphemeralKeyPair, getPepper } 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 * const jwt = \"your_jwt_token\"; // replace with a real JWT token\n * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair\n *\n * // Fetch the proof using the getProof function\n * const proof = await aptos.getProof({\n * jwt,\n * ephemeralKeyPair,\n * pepper: await getPepper({}), // fetch the pepper if not provided\n * uidKey: \"sub\", // specify the uid key\n * });\n *\n * console.log(\"Fetched proof:\", proof);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Keyless\n */\n async getProof(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n }): Promise<ZeroKnowledgeSig> {\n return getProof({ aptosConfig: this.config, ...args });\n }\n\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<KeylessAccount>;\n\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<FederatedKeylessAccount>;\n\n /**\n * Derives a Keyless Account from the provided JWT token and corresponding EphemeralKeyPair. This function computes the proof\n * via the proving service and can fetch the pepper from the pepper service if not explicitly provided.\n *\n * @param args - The arguments required to derive the Keyless Account.\n * @param args.jwt - The JWT token used for deriving the account.\n * @param args.ephemeralKeyPair - The EphemeralKeyPair used to generate the nonce in the JWT token.\n * @param args.jwkAddress - The address the where the JWKs used to verify signatures are found. Setting the value derives a\n * FederatedKeylessAccount.\n * @param args.uidKey - An optional key in the JWT token to set the uidVal in the IdCommitment.\n * @param args.pepper - An optional pepper value.\n * @param args.proofFetchCallback - An optional callback function for fetching the proof in the background, allowing for a more\n * responsive user experience.\n *\n * @returns A KeylessAccount that can be used to sign transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, deriveKeylessAccount } 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 * const jwt = \"your_jwt_token\"; // replace with a real JWT token\n * const ephemeralKeyPair = new EphemeralKeyPair(); // create a new ephemeral key pair\n *\n * // Deriving the Keyless Account\n * const keylessAccount = await deriveKeylessAccount({\n * jwt,\n * ephemeralKeyPair,\n * uidKey: \"your_uid_key\", // optional\n * pepper: \"your_pepper\", // optional\n * });\n *\n * console.log(\"Keyless Account derived:\", keylessAccount);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Keyless\n */\n async deriveKeylessAccount(args: {\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n }): Promise<KeylessAccount | FederatedKeylessAccount> {\n return deriveKeylessAccount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * This installs a set of FederatedJWKs at an address for a given iss.\n *\n * It will fetch the JSON Web Keyset (JWK) set from the well-known endpoint and update the FederatedJWKs at the sender's address\n * to reflect it.\n *\n * @param args.sender The account that will install the JWKs\n * @param args.iss the iss claim of the federated OIDC provider.\n * @param args.jwksUrl the URL to find the corresponding JWKs. For supported IDP providers this parameter in not necessary.\n *\n * @returns The pending transaction that results from submission.\n * @group Keyless\n */\n async updateFederatedKeylessJwkSetTransaction(args: {\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return updateFederatedKeylessJwkSetTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"8DAuBO,IAAMA,EAAN,KAAc,CAwBnB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAoC3C,MAAM,UAAUC,EAIQ,CACtB,OAAOC,EAAU,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACxD,CAsCA,MAAM,SAASA,EAKe,CAC5B,OAAOE,EAAS,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACvD,CA4DA,MAAM,qBAAqBA,EAO2B,CACpD,OAAOG,EAAqB,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACnE,CAeA,MAAM,wCAAwCA,EAKf,CAC7B,OAAOI,EAAwC,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACtF,CACF","names":["Keyless","config","args","getPepper","getProof","deriveKeylessAccount","updateFederatedKeylessJwkSetTransaction"]}
@@ -1,2 +1,2 @@
1
- import{c as s}from"./chunk-CK5NDXQT.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-YT3IP57B.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
- //# sourceMappingURL=chunk-S22QVNK7.mjs.map
1
+ import{c as s}from"./chunk-A3NEASNH.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-SZRZ3HIL.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
+ //# sourceMappingURL=chunk-UQ7D5CSM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/table.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFullNode } from \"../client\";\nimport {\n TableItemRequest,\n LedgerVersionArg,\n PaginationArgs,\n WhereArg,\n OrderByArg,\n GetTableItemsDataResponse,\n GetTableItemsMetadataResponse,\n} from \"../types\";\nimport { GetTableItemsDataQuery, GetTableItemsMetadataQuery } from \"../types/generated/operations\";\nimport { GetTableItemsData, GetTableItemsMetadata } from \"../types/generated/queries\";\nimport { TableItemsBoolExp, TableMetadatasBoolExp } from \"../types/generated/types\";\nimport { queryIndexer } from \"./general\";\n\n/**\n * Retrieves a specific item from a table in the Aptos blockchain.\n *\n * @param args - The arguments for retrieving the table item.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.handle - The identifier for the table from which to retrieve the item.\n * @param args.data - The request data for the table item.\n * @param args.options - Optional parameters for the request, including ledger version.\n * @group Implementation\n */\nexport async function getTableItem<T>(args: {\n aptosConfig: AptosConfig;\n handle: string;\n data: TableItemRequest;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, handle, data, options } = args;\n const response = await postAptosFullNode<TableItemRequest, any>({\n aptosConfig,\n originMethod: \"getTableItem\",\n path: `tables/${handle}/item`,\n params: { ledger_version: options?.ledgerVersion },\n body: data,\n });\n return response.data as T;\n}\n\n/**\n * Retrieves table items data based on specified conditions and pagination options.\n *\n * @param args - The arguments for retrieving table items data.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the table items.\n * @param args.options.orderBy - The criteria to sort the results.\n * @group Implementation\n */\nexport async function getTableItemsData(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableItemsBoolExp> & OrderByArg<GetTableItemsDataResponse[0]>;\n}) {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsData,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsData\",\n });\n\n return data.table_items;\n}\n\n/**\n * Retrieves metadata for table items based on specified options.\n *\n * @param args - The arguments for retrieving table items metadata.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for pagination and filtering.\n * @param args.options.offset - The number of items to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of items to return.\n * @param args.options.where - Conditions to filter the results.\n * @param args.options.orderBy - The order in which to return the results.\n * @returns A promise that resolves to an array of table metadata.\n * @group Implementation\n */\nexport async function getTableItemsMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<TableMetadatasBoolExp> & OrderByArg<GetTableItemsMetadataResponse[0]>;\n}): Promise<GetTableItemsMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetTableItemsMetadata,\n variables: {\n where_condition: options?.where,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetTableItemsMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getTableItemsMetadata\",\n });\n\n return data.table_metadatas;\n}\n"],"mappings":"kIA0BA,eAAsBA,EAAgBC,EAKvB,CACb,GAAM,CAAE,YAAAC,EAAa,OAAAC,EAAQ,KAAAC,EAAM,QAAAC,CAAQ,EAAIJ,EAQ/C,OAPiB,MAAMK,EAAyC,CAC9D,YAAAJ,EACA,aAAc,eACd,KAAM,UAAUC,CAAM,QACtB,OAAQ,CAAE,eAAgBE,GAAS,aAAc,EACjD,KAAMD,CACR,CAAC,GACe,IAClB,CAcA,eAAsBG,EAAkBN,EAGrC,CACD,GAAM,CAAE,YAAAC,EAAa,QAAAG,CAAQ,EAAIJ,EAE3BO,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBJ,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAQA,OANa,MAAMK,EAAqC,CACtD,YAAAR,EACA,MAAOM,EACP,aAAc,mBAChB,CAAC,GAEW,WACd,CAeA,eAAsBG,EAAsBV,EAGD,CACzC,GAAM,CAAE,YAAAC,EAAa,QAAAG,CAAQ,EAAIJ,EAE3BO,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,OAAQA,GAAS,OACjB,MAAOA,GAAS,MAChB,SAAUA,GAAS,OACrB,CACF,EAQA,OANa,MAAMK,EAAyC,CAC1D,YAAAR,EACA,MAAOM,EACP,aAAc,uBAChB,CAAC,GAEW,eACd","names":["getTableItem","args","aptosConfig","handle","data","options","postAptosFullNode","getTableItemsData","graphqlQuery","GetTableItemsData","queryIndexer","getTableItemsMetadata","GetTableItemsMetadata"]}
@@ -1,2 +1,2 @@
1
- import{b as g}from"./chunk-JNO7KPMG.mjs";import{a as r}from"./chunk-BRV3RLKW.mjs";import{a as y,c as a,d as f}from"./chunk-Q3CWUEXI.mjs";import{a as i,b as o,c as u,d as s,e as c,f as p,g as m}from"./chunk-42H7WETG.mjs";function D(n){return typeof n=="boolean"}function l(n){return typeof n=="string"}function d(n){return typeof n=="number"}function P(n){if(d(n))return n;if(l(n)&&n!=="")return Number.parseInt(n,10)}function w(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function G(n){return n==null}function $(n){return T(n)||B(n)||U(n)||b(n)||I(n)||v(n)||h(n)||E(n)||x(n)||S(n)||n instanceof y||n instanceof f}function T(n){return n instanceof i}function E(n){return n instanceof g}function x(n){return n instanceof a}function S(n){return n instanceof r}function B(n){return n instanceof o}function U(n){return n instanceof u}function b(n){return n instanceof s}function I(n){return n instanceof c}function v(n){return n instanceof p}function h(n){return n instanceof m}function O(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],A=t[2];return{moduleAddress:e,moduleName:F,functionName:A}}export{D as a,l as b,d as c,P as d,w as e,G as f,$ as g,T as h,E as i,x as j,S as k,B as l,U as m,b as n,I as o,v as p,h as q,O as r,R as s,W as t,L as u};
2
- //# sourceMappingURL=chunk-5O3RHPER.mjs.map
1
+ import{b as g}from"./chunk-Q4C4U6I4.mjs";import{a as r}from"./chunk-MT2RJ7H3.mjs";import{a as y,c as a,d as f}from"./chunk-N4VVDQA5.mjs";import{a as i,b as o,c as u,d as s,e as c,f as p,g as m}from"./chunk-ORMOQWWH.mjs";function D(n){return typeof n=="boolean"}function l(n){return typeof n=="string"}function d(n){return typeof n=="number"}function P(n){if(d(n))return n;if(l(n)&&n!=="")return Number.parseInt(n,10)}function w(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function G(n){return n==null}function $(n){return T(n)||B(n)||U(n)||b(n)||I(n)||v(n)||h(n)||E(n)||x(n)||S(n)||n instanceof y||n instanceof f}function T(n){return n instanceof i}function E(n){return n instanceof g}function x(n){return n instanceof a}function S(n){return n instanceof r}function B(n){return n instanceof o}function U(n){return n instanceof u}function b(n){return n instanceof s}function I(n){return n instanceof c}function v(n){return n instanceof p}function h(n){return n instanceof m}function O(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],A=t[2];return{moduleAddress:e,moduleName:F,functionName:A}}export{D as a,l as b,d as c,P as d,w as e,G as f,$ as g,T as h,E as i,x as j,S as k,B as l,U as m,b as n,I as o,v as p,h as q,O as r,R as s,W as t,L as u};
2
+ //# sourceMappingURL=chunk-UYONA6PP.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n EntryFunctionArgumentTypes,\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputScriptData,\n SimpleEntryFunctionArgumentTypes,\n} from \"../types\";\nimport { Bool, FixedBytes, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { MoveFunction, MoveFunctionId } from \"../../types\";\n\n/**\n * Determines if the provided argument is of type boolean.\n * This can help in validating input types before processing them further.\n *\n * @param arg - The argument to check, which can be of various types.\n * @returns A boolean indicating whether the argument is a boolean.\n * @group Implementation\n * @category Transactions\n */\nexport function isBool(arg: SimpleEntryFunctionArgumentTypes): arg is boolean {\n return typeof arg === \"boolean\";\n}\n\n/**\n * Checks if the provided argument is of type string.\n *\n * @param arg - The value to be checked for string type.\n * @returns A boolean indicating whether the argument is a string.\n * @group Implementation\n * @category Transactions\n */\nexport function isString(arg: any): arg is string {\n return typeof arg === \"string\";\n}\n\n/**\n * Determines if the provided argument is of type number.\n *\n * @param arg - The argument to check, which can be of various types.\n * @returns A boolean indicating whether the argument is a number.\n * @group Implementation\n * @category Transactions\n */\nexport function isNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number {\n return typeof arg === \"number\";\n}\n\n/**\n * Converts a number or a string representation of a number into a number type.\n * This function is useful for ensuring that the input is in a consistent numeric format,\n * which can help prevent type mismatches in further processing.\n *\n * @param arg - The input value to be converted. This can be a number, a string representing a number, or any other type.\n * @returns Returns the converted number if the input is valid; otherwise, it returns undefined.\n * @group Implementation\n * @category Transactions\n */\nexport function convertNumber(arg: SimpleEntryFunctionArgumentTypes): number | undefined {\n if (isNumber(arg)) {\n return arg;\n }\n if (isString(arg) && arg !== \"\") {\n return Number.parseInt(arg, 10);\n }\n\n return undefined;\n}\n\n/**\n * Determines if the provided argument is a large number, which can be a number, bigint, or string representation of a number.\n *\n * @param arg - The argument to check, which can be of type number, bigint, or string.\n * @group Implementation\n * @category Transactions\n */\nexport function isLargeNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number | bigint | string {\n return typeof arg === \"number\" || typeof arg === \"bigint\" || typeof arg === \"string\";\n}\n\n/**\n * Checks if the provided argument is empty, meaning it is either null or undefined.\n *\n * @param arg - The argument to check for emptiness.\n * @returns A boolean indicating whether the argument is empty.\n * @group Implementation\n * @category Transactions\n */\nexport function isEmptyOption(arg: SimpleEntryFunctionArgumentTypes): arg is null | undefined {\n return arg === null || arg === undefined;\n}\n\n/**\n * Determines if the provided argument is a valid encoded entry function argument type.\n * This function helps validate that the argument conforms to the expected types for entry function parameters.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\nexport function isEncodedEntryFunctionArgument(\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n): arg is EntryFunctionArgumentTypes {\n return (\n /**\n * Determines if the provided argument is an instance of the Bool class.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsBool(arg) ||\n /**\n * Determines if the provided argument is an instance of U8.\n * This function helps validate the type of the argument passed to ensure it is a U8 type.\n *\n * @param arg - The argument to be checked, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU8(arg) ||\n /**\n * Determines if the provided argument is an instance of U16.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU16(arg) ||\n /**\n * Determines if the provided argument is an instance of U32.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @returns A boolean indicating whether the argument is a U32 instance.\n * @group Implementation\n * @category Transactions\n */\n isBcsU32(arg) ||\n /**\n * Determine if the provided argument is an instance of U64.\n * This function helps validate that the argument conforms to the expected U64 type.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU64(arg) ||\n /**\n * Determines if the provided argument is an instance of U128.\n * This function helps validate the type of the argument passed to ensure it is a U128 type.\n *\n * @param arg - The argument to be checked, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsU128(arg) ||\n /**\n * Determines if the provided argument is an instance of U256.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @returns A boolean indicating whether the argument is a U256 instance.\n * @group Implementation\n * @category Transactions\n */\n isBcsU256(arg) ||\n /**\n * Determines if the provided argument is an instance of AccountAddress.\n * This function helps validate whether a given input corresponds to a valid BCS address type.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsAddress(arg) ||\n /**\n * Determine if the provided argument is an instance of MoveString.\n *\n * @param arg - The argument to check, which can be of types EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsString(arg) ||\n /**\n * Determine if the provided argument is an instance of FixedBytes.\n * This function helps to validate the type of the argument being passed.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @group Implementation\n * @category Transactions\n */\n isBcsFixedBytes(arg) ||\n arg instanceof MoveVector ||\n arg instanceof MoveOption\n );\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsBool(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is Bool {\n return arg instanceof Bool;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsAddress(\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n): arg is AccountAddress {\n return arg instanceof AccountAddress;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsString(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is MoveString {\n return arg instanceof MoveString;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsFixedBytes(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is FixedBytes {\n return arg instanceof FixedBytes;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U8 {\n return arg instanceof U8;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U16 {\n return arg instanceof U16;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U32 {\n return arg instanceof U32;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U64 {\n return arg instanceof U64;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U128 {\n return arg instanceof U128;\n}\n/**\n * @group Implementation\n * @category Transactions\n */\nexport function isBcsU256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U256 {\n return arg instanceof U256;\n}\n\n/**\n * Determines if the provided argument contains script data input by checking for the presence of bytecode.\n *\n * @param arg - The input data to be checked, which can either be a payload with remote ABI or a standard payload.\n * @param arg.bytecode - The bytecode of the script, present if the input is script data.\n * @param arg.function - The function associated with the transaction, which is relevant for standard payloads.\n * @param arg.args - The arguments for the function, applicable in the context of standard payloads.\n * @group Implementation\n * @category Transactions\n */\nexport function isScriptDataInput(\n arg: InputGenerateTransactionPayloadDataWithRemoteABI | InputGenerateTransactionPayloadData,\n): arg is InputScriptData {\n return \"bytecode\" in arg;\n}\n\n/**\n * Throws an error indicating a type mismatch for a specified argument position.\n * This function helps in debugging by providing clear feedback on expected types.\n *\n * @param expectedType - The type that was expected for the argument.\n * @param position - The position of the argument that caused the type mismatch.\n * @group Implementation\n * @category Transactions\n */\nexport function throwTypeMismatch(expectedType: string, position: number) {\n throw new Error(`Type mismatch for argument ${position}, expected '${expectedType}'`);\n}\n\n/**\n * Finds the index of the first non-signer argument in the function ABI parameters.\n *\n * A function is often defined with a `signer` or `&signer` arguments at the start, which are filled in\n * by signatures and not by the caller. This function helps identify the position of the first argument that\n * can be provided by the caller, allowing for easier handling of function parameters.\n *\n * @param functionAbi - The ABI of the function to analyze.\n * @returns The index of the first non-signer argument, or the length of the parameters array if none are found.\n * @group Implementation\n * @category Transactions\n */\nexport function findFirstNonSignerArg(functionAbi: MoveFunction): number {\n const index = functionAbi.params.findIndex((param) => param !== \"signer\" && param !== \"&signer\");\n if (index < 0) {\n return functionAbi.params.length;\n }\n return index;\n}\n\n/**\n * Splits a function identifier into its constituent parts: module address, module name, and function name.\n * This function helps in validating and extracting details from a function identifier string.\n *\n * @param functionArg - The function identifier string in the format \"moduleAddress::moduleName::functionName\".\n * @returns An object containing the module address, module name, and function name.\n * @throws Error if the function identifier does not contain exactly three parts.\n * @group Implementation\n * @category Transactions\n */\nexport function getFunctionParts(functionArg: MoveFunctionId) {\n const funcNameParts = functionArg.split(\"::\");\n if (funcNameParts.length !== 3) {\n throw new Error(`Invalid function ${functionArg}`);\n }\n const moduleAddress = funcNameParts[0];\n const moduleName = funcNameParts[1];\n const functionName = funcNameParts[2];\n return { moduleAddress, moduleName, functionName };\n}\n"],"mappings":"4NAuBO,SAASA,EAAOC,EAAuD,CAC5E,OAAO,OAAOA,GAAQ,SACxB,CAUO,SAASC,EAASD,EAAyB,CAChD,OAAO,OAAOA,GAAQ,QACxB,CAUO,S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BC,EAAkB,CACxE,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeD,CAAY,GAAG,CACtF,CAcO,SAASE,EAAsBC,EAAmC,CACvE,IAAMC,EAAQD,EAAY,OAAO,UAAWE,GAAUA,IAAU,UAAYA,IAAU,SAAS,EAC/F,OAAID,EAAQ,EACHD,EAAY,OAAO,OAErBC,CACT,CAYO,SAASE,EAAiBC,EAA6B,CAC5D,IAAMC,EAAgBD,EAAY,MAAM,IAAI,EAC5C,GAAIC,EAAc,SAAW,EAC3B,MAAM,IAAI,MAAM,oBAAoBD,CAAW,EAAE,EAEnD,IAAME,EAAgBD,EAAc,CAAC,EAC/BE,EAAaF,EAAc,CAAC,EAC5BG,EAAeH,EAAc,CAAC,EACpC,MAAO,CAAE,cAAAC,EAAe,WAAAC,EAAY,aAAAC,CAAa,CACnD","names":["isBool","arg","isString","isNumber","convertNumber","isLargeNumber","isEmptyOption","isEncodedEntryFunctionArgument","isBcsBool","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","isBcsAddress","isBcsString","isBcsFixedBytes","MoveVector","MoveOption","Bool","AccountAddress","MoveString","FixedBytes","U8","U16","U32","U64","U128","U256","isScriptDataInput","throwTypeMismatch","expectedType","position","findFirstNonSignerArg","functionAbi","index","param","getFunctionParts","functionArg","funcNameParts","moduleAddress","moduleName","functionName"]}
@@ -1,2 +1,2 @@
1
- import{a as o}from"./chunk-R2YT2IM5.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
2
- //# sourceMappingURL=chunk-A7TJF3BX.mjs.map
1
+ import{a as o}from"./chunk-Q3VS6AEN.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
2
+ //# sourceMappingURL=chunk-VCIJX6R4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/coin.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddressInput } from \"../core\";\nimport { transferCoinTransaction } from \"../internal/coin\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to handle all `Coin` operations.\n * @group Coin\n */\nexport class Coin {\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 *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a new Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Coin\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Generate a transfer coin transaction that can be simulated, signed, and submitted.\n * This function helps you create a transaction to transfer a specified amount of coins\n * from one account to another within the Aptos network.\n *\n * @param args The arguments for the transfer transaction.\n * @param args.sender The sender account address.\n * @param args.recipient The recipient account address.\n * @param args.amount The amount of coins to transfer.\n * @param args.coinType Optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin.\n * @param args.options Optional. Additional options for generating 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 * // Generate a transfer coin transaction\n * const transaction = await aptos.transferCoinTransaction({\n * sender: \"0x1\", // replace with a real sender account address\n * recipient: \"0x2\", // replace with a real recipient account address\n * amount: 10,\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Coin\n */\n async transferCoinTransaction(args: {\n sender: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferCoinTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAcO,IAAMA,EAAN,KAAW,CAsBhB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAqC3C,MAAM,wBAAwBC,EAMC,CAC7B,OAAOC,EAAwB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtE,CACF","names":["Coin","config","args","transferCoinTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as m}from"./chunk-476F5NJ6.mjs";import{a as g}from"./chunk-2D7OMWVL.mjs";import{c as A}from"./chunk-CK5NDXQT.mjs";import{s as f}from"./chunk-VHNX2NUR.mjs";import{b as w}from"./chunk-JNO7KPMG.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function D(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[t,n,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!D(t))throw new Error(`${t} is not valid. ${T}`);if(n&&!D(n))throw new Error(`${n} is not valid. ${T}`);return{domainName:n||t,subdomainName:n?t:void 0}}var I=(n=>(n[n.Independent=0]="Independent",n[n.FollowsDomain=1]="FollowsDomain",n))(I||{});function E(e){if(!e)return!1;let t=new Date(e.domain_expiration_timestamp).getTime()<Date.now(),n=new Date(e.expiration_timestamp).getTime()<Date.now();return e.subdomain&&t?!1:e.subdomain&&e.subdomain_expiration_policy===1?!0:!n}var j="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",v="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",O={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:v,custom:null,devnet:null};function d(e){let t=O[e.network];if(!t)throw new Error(`The ANS contract is not deployed to ${e.network}`);return t}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function F(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await g({aptosConfig:t,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function Y(e){let{aptosConfig:t,expiration:n,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(t),{domainName:y,subdomainName:N}=c(o),x=n.policy==="subdomain:independent"||n.policy==="subdomain:follow-domain";if(N&&!x)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(x&&!N)throw new Error(`Policy is set to ${n.policy} but no subdomain was provided`);if(n.policy==="domain"){let h=n.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let G=h*31536e3;return await m({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,G,s,i]},options:a})}if(!N)throw new Error(`${n.policy} requires a subdomain to be provided.`);let _=await P({aptosConfig:t,name:y});if(!_)throw new Error("The domain does not exist");let S=n.policy==="subdomain:independent"?n.expirationDate:_;if(S>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[y,N,Math.round(S/1e3),n.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function P(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n);try{let i=await g({aptosConfig:t,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function K(e){let{aptosConfig:t,address:n}=e,o=d(t),r=await g({aptosConfig:t,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(n).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function W(e){let{aptosConfig:t,sender:n,name:o,options:r}=e,s=d(t);if(!o)return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function H(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await g({aptosConfig:t,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function J(e){let{aptosConfig:t,sender:n,name:o,address:r,options:s}=e,i=d(t),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function X(e){let{aptosConfig:t,name:n}=e,{domainName:o,subdomainName:r=""}=c(n),a=(await A({aptosConfig:t,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=l(a)),E(a)?a:void 0}async function Z(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountNames",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(l)}async function ee(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountDomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(l)}async function ne(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(l)}async function te(e){let{aptosConfig:t,options:n,domain:o}=e;return(await A({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(l).filter(E)}async function C(e){let{aptosConfig:t}=e,n=d(t),[o]=await g({aptosConfig:t,payload:{function:`${n}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function oe(e){let{aptosConfig:t,sender:n,name:o,years:r=1,options:s}=e,i=d(t),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function l(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,D as b,c,I as d,E as e,j as f,v as g,F as h,Y as i,P as j,K as k,W as l,H as m,J as n,X as o,Z as p,ee as q,ne as r,te as s,oe as t};
2
- //# sourceMappingURL=chunk-FSBEKFEF.mjs.map
1
+ import{a as m}from"./chunk-CYMVZJHC.mjs";import{a as g}from"./chunk-KFCLSJC3.mjs";import{c as A}from"./chunk-A3NEASNH.mjs";import{s as f}from"./chunk-VHNX2NUR.mjs";import{b as w}from"./chunk-Q4C4U6I4.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function D(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[t,n,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!D(t))throw new Error(`${t} is not valid. ${T}`);if(n&&!D(n))throw new Error(`${n} is not valid. ${T}`);return{domainName:n||t,subdomainName:n?t:void 0}}var I=(n=>(n[n.Independent=0]="Independent",n[n.FollowsDomain=1]="FollowsDomain",n))(I||{});function E(e){if(!e)return!1;let t=new Date(e.domain_expiration_timestamp).getTime()<Date.now(),n=new Date(e.expiration_timestamp).getTime()<Date.now();return e.subdomain&&t?!1:e.subdomain&&e.subdomain_expiration_policy===1?!0:!n}var j="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",v="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",O={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:v,custom:null,devnet:null};function d(e){let t=O[e.network];if(!t)throw new Error(`The ANS contract is not deployed to ${e.network}`);return t}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function F(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await g({aptosConfig:t,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function Y(e){let{aptosConfig:t,expiration:n,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(t),{domainName:y,subdomainName:N}=c(o),x=n.policy==="subdomain:independent"||n.policy==="subdomain:follow-domain";if(N&&!x)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(x&&!N)throw new Error(`Policy is set to ${n.policy} but no subdomain was provided`);if(n.policy==="domain"){let h=n.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let G=h*31536e3;return await m({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,G,s,i]},options:a})}if(!N)throw new Error(`${n.policy} requires a subdomain to be provided.`);let _=await P({aptosConfig:t,name:y});if(!_)throw new Error("The domain does not exist");let S=n.policy==="subdomain:independent"?n.expirationDate:_;if(S>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:t,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[y,N,Math.round(S/1e3),n.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function P(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n);try{let i=await g({aptosConfig:t,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function K(e){let{aptosConfig:t,address:n}=e,o=d(t),r=await g({aptosConfig:t,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(n).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function W(e){let{aptosConfig:t,sender:n,name:o,options:r}=e,s=d(t);if(!o)return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function H(e){let{aptosConfig:t,name:n}=e,o=d(t),{domainName:r,subdomainName:s}=c(n),i=await g({aptosConfig:t,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function J(e){let{aptosConfig:t,sender:n,name:o,address:r,options:s}=e,i=d(t),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function X(e){let{aptosConfig:t,name:n}=e,{domainName:o,subdomainName:r=""}=c(n),a=(await A({aptosConfig:t,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=l(a)),E(a)?a:void 0}async function Z(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountNames",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(l)}async function ee(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountDomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(l)}async function ne(e){let{aptosConfig:t,options:n,accountAddress:o}=e,r=await C({aptosConfig:t});return(await A({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(l)}async function te(e){let{aptosConfig:t,options:n,domain:o}=e;return(await A({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:n?.limit,offset:n?.offset,order_by:n?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(l).filter(E)}async function C(e){let{aptosConfig:t}=e,n=d(t),[o]=await g({aptosConfig:t,payload:{function:`${n}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function oe(e){let{aptosConfig:t,sender:n,name:o,years:r=1,options:s}=e,i=d(t),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:t,sender:n.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function l(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,D as b,c,I as d,E as e,j as f,v as g,F as h,Y as i,P as j,K as k,W as l,H as m,J as n,X as o,Z as p,ee as q,ne as r,te as s,oe as t};
2
+ //# sourceMappingURL=chunk-VVAKGJDN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/name}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * name namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Account } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { GetNamesQuery } from \"../types/generated/operations\";\nimport { GetNames } from \"../types/generated/queries\";\nimport { CurrentAptosNamesBoolExp } from \"../types/generated/types\";\nimport { Network } from \"../utils/apiEndpoints\";\nimport { queryIndexer } from \"./general\";\nimport { view } from \"./view\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport const VALIDATION_RULES_DESCRIPTION = [\n \"A name must be between 3 and 63 characters long,\",\n \"and can only contain lowercase a-z, 0-9, and hyphens.\",\n \"A name may not start or end with a hyphen.\",\n].join(\" \");\n\n/**\n * Validate if a given fragment is a valid ANS segment.\n * This function checks the length and character constraints of the fragment to ensure it meets the ANS standards.\n *\n * @param fragment - A fragment of a name, either the domain or subdomain.\n * @returns A boolean indicating if the fragment is a valid fragment.\n * @group Implementation\n */\nexport function isValidANSSegment(fragment: string): boolean {\n if (!fragment) return false;\n if (fragment.length < 3) return false;\n if (fragment.length > 63) return false;\n // only lowercase a-z and 0-9 are allowed, along with -. a domain may not start or end with a hyphen\n if (!/^[a-z\\d][a-z\\d-]{1,61}[a-z\\d]$/.test(fragment)) return false;\n return true;\n}\n\n/**\n * Checks if an ANS name is valid or not.\n *\n * @param name - A string of the domain name, which can include or exclude the .apt suffix.\n * @group Implementation\n */\nexport function isValidANSName(name: string): { domainName: string; subdomainName?: string } {\n const [first, second, ...rest] = name.replace(/\\.apt$/, \"\").split(\".\");\n\n if (rest.length > 0) {\n throw new Error(`${name} is invalid. A name can only have two parts, a domain and a subdomain separated by a \".\"`);\n }\n\n if (!isValidANSSegment(first)) {\n throw new Error(`${first} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n if (second && !isValidANSSegment(second)) {\n throw new Error(`${second} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n return {\n domainName: second || first,\n subdomainName: second ? first : undefined,\n };\n}\n\n/**\n * Policy for determining how subdomains expire in relation to their parent domain.\n * @group Implementation\n */\nexport enum SubdomainExpirationPolicy {\n Independent = 0,\n FollowsDomain = 1,\n}\n\n/**\n * Determine if a given ANS name is considered active based on its expiration dates.\n * Domains are active if their expiration date is in the future, while subdomains may\n * follow their parent's expiration policy (1) or expire independently (0).\n * If the subdomain is expiring independently, it can expire before their parent, but not after.\n *\n * @param name - An ANS name returned from one of the functions of the SDK.\n * @returns A boolean indicating whether the contract considers the name active or not.\n * @group Implementation\n */\nexport function isActiveANSName(name: GetANSNameResponse[0]): boolean {\n if (!name) return false;\n\n const isTLDExpired = new Date(name.domain_expiration_timestamp).getTime() < Date.now();\n const isExpired = new Date(name.expiration_timestamp).getTime() < Date.now();\n\n // If we are a subdomain, if our parent is expired we are always expired\n if (name.subdomain && isTLDExpired) return false;\n\n // If we are a subdomain and our expiration policy is to follow the domain, we\n // are active (since we know our parent is not expired by this point)\n if (name.subdomain && name.subdomain_expiration_policy === SubdomainExpirationPolicy.FollowsDomain) return true;\n\n // At this point, we are either a TLD or a subdomain with an independent\n // expiration policy, we are active as long as we the expiration timestamp\n return !isExpired;\n}\n\nexport const LOCAL_ANS_ACCOUNT_PK =\n process.env.ANS_TEST_ACCOUNT_PRIVATE_KEY ??\n \"ed25519-priv-0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221\";\nexport const LOCAL_ANS_ACCOUNT_ADDRESS =\n process.env.ANS_TEST_ACCOUNT_ADDRESS ?? \"0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82\";\n\nconst NetworkToAnsContract: Record<Network, string | null> = {\n [Network.TESTNET]: \"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c\",\n [Network.MAINNET]: \"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c\",\n [Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,\n [Network.CUSTOM]: null,\n [Network.DEVNET]: null,\n};\n\n/**\n * Retrieves the address of the ANS contract based on the specified Aptos network configuration.\n *\n * @param aptosConfig - The configuration object for the Aptos network.\n * @param aptosConfig.network - The network for which to retrieve the ANS contract address.\n *\n * @throws Throws an error if the ANS contract is not deployed to the specified network.\n * @group Implementation\n */\nfunction getRouterAddress(aptosConfig: AptosConfig): string {\n const address = NetworkToAnsContract[aptosConfig.network];\n if (!address) throw new Error(`The ANS contract is not deployed to ${aptosConfig.network}`);\n return address;\n}\n\nconst unwrapOption = <T>(option: any): T | undefined => {\n if (!!option && typeof option === \"object\" && \"vec\" in option && Array.isArray(option.vec)) {\n return option.vec[0];\n }\n\n return undefined;\n};\n\n/**\n * Retrieve the owner address of a specified domain or subdomain.\n *\n * @param args - The arguments for retrieving the owner address.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.name - The name of the domain or subdomain to query.\n * @returns The account address of the owner, or undefined if not found.\n * @group Implementation\n */\nexport async function getOwnerAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_owner_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const owner = unwrapOption<MoveAddressType>(res[0]);\n\n return owner ? AccountAddress.from(owner) : undefined;\n}\n\n/**\n * Parameters for registering a name in the Aptos network.\n *\n * @param aptosConfig - Configuration settings for the Aptos network.\n * @param sender - The account initiating the name registration.\n * @param name - The name to be registered.\n * @param expiration - The expiration policy for the name registration.\n * @group Implementation\n */\nexport interface RegisterNameParameters {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n expiration:\n | { policy: \"domain\"; years?: 1 }\n | { policy: \"subdomain:follow-domain\" }\n | { policy: \"subdomain:independent\"; expirationDate: number };\n transferable?: boolean;\n toAddress?: AccountAddressInput;\n targetAddress?: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}\n\n/**\n * Registers a domain or subdomain with the specified parameters. This function ensures that the provided names and expiration\n * policies are valid before proceeding with the registration process.\n *\n * @param args - The parameters required for registering a name.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.expiration - The expiration details for the registration.\n * @param args.name - The name to be registered, which can be a domain or subdomain.\n * @param args.sender - The account details of the sender initiating the registration.\n * @param args.targetAddress - The target address for the registration.\n * @param args.toAddress - The address to which the registration is associated.\n * @param args.options - Additional options for the registration process.\n * @param args.transferable - Indicates whether the registered name is transferable.\n *\n * @throws Error if the provided expiration policy is invalid for subdomains.\n * @throws Error if the domain does not exist.\n * @throws Error if the subdomain expiration time exceeds the domain expiration time.\n *\n * @returns A transaction object representing the registration process.\n * @group Implementation\n */\nexport async function registerName(args: RegisterNameParameters): Promise<SimpleTransaction> {\n const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const hasSubdomainPolicy =\n expiration.policy === \"subdomain:independent\" || expiration.policy === \"subdomain:follow-domain\";\n\n if (subdomainName && !hasSubdomainPolicy) {\n throw new Error(\n \"Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'\",\n );\n }\n\n if (hasSubdomainPolicy && !subdomainName) {\n throw new Error(`Policy is set to ${expiration.policy} but no subdomain was provided`);\n }\n\n if (expiration.policy === \"domain\") {\n const years = expiration.years ?? 1;\n if (years !== 1) {\n throw new Error(\"For now, names can only be registered for 1 year at a time\");\n }\n\n const secondsInYear = 31536000;\n const registrationDuration = years * secondsInYear;\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_domain`,\n functionArguments: [domainName, registrationDuration, targetAddress, toAddress],\n },\n options,\n });\n\n return transaction;\n }\n\n // We are a subdomain\n if (!subdomainName) {\n throw new Error(`${expiration.policy} requires a subdomain to be provided.`);\n }\n\n const tldExpiration = await getExpiration({ aptosConfig, name: domainName });\n if (!tldExpiration) {\n throw new Error(\"The domain does not exist\");\n }\n\n const expirationDateInMillisecondsSinceEpoch =\n expiration.policy === \"subdomain:independent\" ? expiration.expirationDate : tldExpiration;\n\n if (expirationDateInMillisecondsSinceEpoch > tldExpiration) {\n throw new Error(\"The subdomain expiration time cannot be greater than the domain expiration time\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_subdomain`,\n functionArguments: [\n domainName,\n subdomainName,\n Math.round(expirationDateInMillisecondsSinceEpoch / 1000),\n expiration.policy === \"subdomain:follow-domain\" ? 1 : 0,\n !!transferable,\n targetAddress,\n toAddress,\n ],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * Retrieves the expiration time of a specified domain or subdomain in epoch milliseconds.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.name - The name of the domain or subdomain to check.\n * @returns The expiration time in epoch milliseconds, or undefined if an error occurs.\n * @group Implementation\n */\nexport async function getExpiration(args: { aptosConfig: AptosConfig; name: string }): Promise<number | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n try {\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_expiration`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n // Normalize expiration time from epoch seconds to epoch milliseconds\n return Number(res[0]) * 1000;\n } catch (e) {\n return undefined;\n }\n}\n\n/**\n * Retrieves the primary name associated with a given account address.\n * This function helps in obtaining the complete domain name by combining the subdomain and domain names.\n *\n * @param args - The arguments for retrieving the primary name.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.address - The account address for which to retrieve the primary name.\n * @returns The primary name as a string, or undefined if no domain name exists.\n * @group Implementation\n */\nexport async function getPrimaryName(args: {\n aptosConfig: AptosConfig;\n address: AccountAddressInput;\n}): Promise<string | undefined> {\n const { aptosConfig, address } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_primary_name`,\n functionArguments: [AccountAddress.from(address).toString()],\n },\n });\n\n const domainName = unwrapOption<MoveAddressType>(res[1]);\n const subdomainName = unwrapOption<MoveAddressType>(res[0]);\n\n if (!domainName) return undefined;\n\n return [subdomainName, domainName].filter(Boolean).join(\".\");\n}\n\n/**\n * Sets the primary name for the specified account, allowing for the association of a domain or subdomain with the account.\n * If no name is provided, it clears the existing primary name.\n *\n * @param args - The arguments for setting the primary name.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.sender - The account that is sending the transaction.\n * @param args.name - The name to set as the primary name. If omitted, the function will clear the primary name.\n * @param args.options - Optional transaction generation options.\n * @returns A transaction object representing the operation.\n * @group Implementation\n */\nexport async function setPrimaryName(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n if (!name) {\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::clear_primary_name`,\n functionArguments: [],\n },\n options,\n });\n\n return transaction;\n }\n\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_primary_name`,\n functionArguments: [domainName, subdomainName],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * Retrieves the target address associated with a given domain name and subdomain name.\n *\n * @param args - The arguments for retrieving the target address.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.name - The name of the domain, which may include a subdomain.\n * @returns The target address as an AccountAddress, or undefined if not found.\n * @group Implementation\n */\nexport async function getTargetAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_target_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const target = unwrapOption<MoveAddressType>(res[0]);\n return target ? AccountAddress.from(target) : undefined;\n}\n\n/**\n * Sets the target address for a specified domain and subdomain in the Aptos network.\n * This function helps to associate a given address with a domain name, allowing for easier access and management of resources.\n *\n * @param args - The arguments for setting the target address.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.sender - The account that is sending the transaction.\n * @param args.name - The name of the domain or subdomain to be set.\n * @param args.address - The address to be associated with the domain or subdomain.\n * @param args.options - Optional parameters for generating the transaction.\n *\n * @returns A transaction object representing the set target address operation.\n * @group Implementation\n */\nexport async function setTargetAddress(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, address, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_target_addr`,\n functionArguments: [domainName, subdomainName, address],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * Retrieves the active Aptos name associated with the specified domain and subdomain.\n *\n * @param args - The parameters for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.name - The name to look up, which includes the domain and optional subdomain.\n * @returns The active Aptos name if it exists; otherwise, returns undefined.\n * @group Implementation\n */\nexport async function getName(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<GetANSNameResponse[0] | undefined> {\n const { aptosConfig, name } = args;\n const { domainName, subdomainName = \"\" } = isValidANSName(name);\n\n const where: CurrentAptosNamesBoolExp = {\n domain: { _eq: domainName },\n subdomain: { _eq: subdomainName },\n };\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n query: {\n query: GetNames,\n variables: {\n where_condition: where,\n limit: 1,\n },\n },\n originMethod: \"getName\",\n });\n\n // Convert the expiration_timestamp from an ISO string to milliseconds since epoch\n let res = data.current_aptos_names[0];\n if (res) {\n res = sanitizeANSName(res);\n }\n\n return isActiveANSName(res) ? res : undefined;\n}\n\n/**\n * Options for querying names, including pagination, ordering, and filtering criteria.\n *\n * @param options - Pagination and filtering options for the query.\n * @group Implementation\n */\ninterface QueryNamesOptions {\n options?: PaginationArgs & OrderByArg<GetANSNameResponse[0]> & WhereArg<CurrentAptosNamesBoolExp>;\n}\n\n/**\n * Arguments for retrieving account names based on the specified account address.\n *\n * @param accountAddress - The address of the account for which names are to be retrieved.\n * @group Implementation\n */\nexport interface GetAccountNamesArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\n/**\n * Retrieves the current Aptos names associated with a specific account address.\n *\n * @param args - The arguments for retrieving account names.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for querying account names.\n * @param args.options.limit - The maximum number of names to retrieve.\n * @param args.options.offset - The number of names to skip before starting to collect the result set.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.accountAddress - The address of the account for which to retrieve names.\n *\n * @returns An array of sanitized Aptos names associated with the specified account address.\n * @group Implementation\n */\nexport async function getAccountNames(\n args: { aptosConfig: AptosConfig } & GetAccountNamesArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountNames\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * Arguments for retrieving the domains associated with a specific account.\n *\n * @param accountAddress - The address of the account for which to fetch domains.\n * @group Implementation\n */\nexport interface GetAccountDomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\n/**\n * Retrieves the list of top-level domains owned by a specified account.\n *\n * @param args - The arguments for retrieving account domains.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.options - Optional parameters for the query.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.offset - The number of results to skip before starting to collect the result set.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.options.where.owner_address - The address of the account whose domains are being queried.\n * @param args.options.where.expiration_timestamp - The minimum expiration timestamp for the domains.\n * @param args.options.where.subdomain - The specific subdomain to filter by.\n *\n * @returns An array of sanitized domain names owned by the specified account.\n * @group Implementation\n */\nexport async function getAccountDomains(\n args: { aptosConfig: AptosConfig } & GetAccountDomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountDomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _eq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * Arguments for retrieving subdomains associated with a specific account.\n *\n * @param accountAddress - The address of the account for which to fetch subdomains.\n * @group Implementation\n */\nexport interface GetAccountSubdomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\n/**\n * Retrieves a list of subdomains owned by a specified account address.\n * This function helps you identify all subdomains associated with a given account.\n *\n * @param args - The arguments for retrieving account subdomains.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.options - Optional parameters for the query.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.offset - The number of results to skip before starting to collect the result set.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.options.where.owner_address - The address of the account to filter by.\n * @param args.options.where.expiration_timestamp - The expiration timestamp to filter by.\n * @param args.options.where.subdomain - The subdomain condition to filter by.\n * @param args.accountAddress - The address of the account whose subdomains are being queried.\n * @group Implementation\n */\nexport async function getAccountSubdomains(\n args: { aptosConfig: AptosConfig } & GetAccountSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _neq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * Arguments for retrieving subdomains associated with a specific domain.\n *\n * @param domain - The domain for which to fetch subdomains.\n * @group Implementation\n */\nexport interface GetDomainSubdomainsArgs extends QueryNamesOptions {\n domain: string;\n}\n\n/**\n * Retrieve the active subdomains associated with a specified domain.\n *\n * @param args - The arguments for retrieving subdomains.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.options - Optional parameters for the query.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.offset - The number of results to skip before starting to collect the results.\n * @param args.options.orderBy - The field by which to order the results.\n * @param args.options.where - Additional conditions to filter the results.\n * @param args.domain - The domain for which to retrieve subdomains.\n *\n * @returns An array of active subdomain names.\n * @group Implementation\n */\nexport async function getDomainSubdomains(\n args: { aptosConfig: AptosConfig } & GetDomainSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, domain } = args;\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getDomainSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n domain: { _eq: domain },\n subdomain: { _neq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName).filter(isActiveANSName);\n}\n\n/**\n * This function returns the expiration date in which a name is fully expired as\n * defined by the contract. The grace period allows for names to be past\n * expiration for a certain amount of time before they are released to the\n * public. The names will not function as normal, but the owner can renew\n * without others taking ownership of the name. At the time of writing, the\n * contract specified 30 days.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - An AptosConfig object containing the configuration settings.\n * @returns The expiration date in ISO 8601 format.\n * @group Implementation\n */\nasync function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise<string> {\n const { aptosConfig } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const [gracePeriodInSeconds] = await view<[number]>({\n aptosConfig,\n payload: {\n function: `${routerAddress}::config::reregistration_grace_sec`,\n functionArguments: [],\n },\n });\n\n const gracePeriodInDays = gracePeriodInSeconds / 60 / 60 / 24;\n const now = () => new Date();\n return new Date(now().setDate(now().getDate() - gracePeriodInDays)).toISOString();\n}\n\n/**\n * Renews a domain for a specified duration. This function allows you to extend the registration of a domain for one year.\n *\n * @param args - The parameters required to renew the domain.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.sender - The account that is sending the renewal transaction.\n * @param args.name - The name of the domain to renew.\n * @param args.years - The number of years to renew the domain for. Currently, only 1 year renewals are supported. (optional, default is 1)\n * @param args.options - Additional options for generating the transaction. (optional)\n * @throws Error if the name contains a subdomain or if the years parameter is not equal to 1.\n * @group Implementation\n */\nexport async function renewDomain(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, years = 1, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const renewalDuration = years * 31536000;\n const { domainName, subdomainName } = isValidANSName(name);\n\n if (subdomainName) {\n throw new Error(\"Subdomains cannot be renewed\");\n }\n\n if (years !== 1) {\n throw new Error(\"Currently, only 1 year renewals are supported\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::renew_domain`,\n functionArguments: [domainName, renewalDuration],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * The indexer returns ISO strings for expiration, however the contract works in\n * epoch milliseconds. This function converts the ISO string to epoch\n * milliseconds. In the future, if other properties need sanitization, this can\n * be extended.\n *\n * @param name - The ANS name response to sanitize.\n * @param name.expiration_timestamp - The expiration timestamp in ISO string format.\n * @group Implementation\n */\nfunction sanitizeANSName(name: GetANSNameResponse[0]): GetANSNameResponse[0] {\n return {\n ...name,\n expiration_timestamp: new Date(name.expiration_timestamp).getTime(),\n };\n}\n"],"mappings":"6MAyBO,IAAMA,EAA+B,CAC1C,mDACA,wDACA,4CACF,EAAE,KAAK,GAAG,EAUH,SAASC,EAAkBC,EAA2B,CAK3D,MAJI,GAACA,GACDA,EAAS,OAAS,GAClBA,EAAS,OAAS,IAElB,CAAC,iCAAiC,KAAKA,CAAQ,EAErD,CAQO,SAASC,EAAeC,EAA8D,CAC3F,GAAM,CAACC,EAAOC,EAAQ,GAAGC,CAAI,EAAIH,EAAK,QAAQ,SAAU,EAAE,EAAE,MAAM,GAAG,EAErE,GAAIG,EAAK,OAAS,EAChB,MAAM,IAAI,MAAM,GAAGH,CAAI,0FAA0F,EAGnH,GAAI,CAACH,EAAkBI,CAAK,EAC1B,MAAM,IAAI,MAAM,GAAGA,CAAK,kBAAkBL,CAA4B,EAAE,EAG1E,GAAIM,GAAU,CAACL,EAAkBK,CAAM,EACrC,MAAM,IAAI,MAAM,GAAGA,CAAM,kBAAkBN,CAA4B,EAAE,EAG3E,MAAO,CACL,WAAYM,GAAUD,EACtB,cAAeC,EAASD,EAAQ,MAClC,CACF,CAMO,IAAKG,OACVA,IAAA,YAAc,GAAd,cACAA,IAAA,cAAgB,GAAhB,gBAFUA,OAAA,IAeL,SAASC,EAAgBL,EAAsC,CACpE,GAAI,CAACA,EA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ACtB,CACF,CAAC,EAEKuC,EAAoBD,EAAuB,GAAK,GAAK,GACrDE,EAAM,IAAM,IAAI,KACtB,OAAO,IAAI,KAAKA,EAAI,EAAE,QAAQA,EAAI,EAAE,QAAQ,EAAID,CAAiB,CAAC,EAAE,YAAY,CAClF,CAcA,eAAsBE,GAAY1C,EAMH,CAC7B,GAAM,CAAE,YAAAL,EAAa,OAAAe,EAAQ,KAAA3B,EAAM,MAAAiC,EAAQ,EAAG,QAAAH,CAAQ,EAAIb,EACpDC,EAAgBP,EAAiBC,CAAW,EAC5CgD,EAAkB3B,EAAQ,QAC1B,CAAE,WAAAd,EAAY,cAAAC,CAAc,EAAIrB,EAAeC,CAAI,EAEzD,GAAIoB,EACF,MAAM,IAAI,MAAM,8BAA8B,EAGhD,GAAIa,IAAU,EACZ,MAAM,IAAI,MAAM,+CAA+C,EAajE,OAVoB,MAAME,EAAoB,CAC5C,YAAAvB,EACA,OAAQe,EAAO,eAAe,SAAS,EACvC,KAAM,CACJ,SAAU,GAAGT,CAAa,yBAC1B,kBAAmB,CAACC,EAAYyC,CAAe,CACjD,EACA,QAAA9B,CACF,CAAC,CAGH,CAYA,SAASiB,EAAgB/C,EAAoD,CAC3E,MAAO,CACL,GAAGA,EACH,qBAAsB,IAAI,KAAKA,EAAK,oBAAoB,EAAE,QAAQ,CACpE,CACF","names":["VALIDATION_RULES_DESCRIPTION","isValidANSSegment","fragment","isValidANSName","name","first","second","rest","SubdomainExpirationPolicy","isActiveANSName","isTLDExpired","isExpired","LOCAL_ANS_ACCOUNT_PK","LOCAL_ANS_ACCOUNT_ADDRESS","NetworkToAnsContract","getRouterAddress","aptosConfig","address","unwrapOption","option","getOwnerAddress","args","routerAddress","domainName","subdomainName","res","view","owner","AccountAddress","registerName","expiration","sender","targetAddress","toAddress","options","transferable","hasSubdomainPolicy","years","registrationDuration","generateTransaction","tldExpiration","getExpiration","expirationDateInMillisecondsSinceEpoch","getPrimaryName","setPrimaryName","getTargetAddress","target","setTargetAddress","getName","queryIndexer","GetNames","sanitizeANSName","getAccountNames","accountAddress","expirationDate","getANSExpirationDate","getAccountDomains","getAccountSubdomains","getDomainSubdomains","domain","gracePeriodInSeconds","gracePeriodInDays","now","renewDomain","renewalDuration"]}
@@ -0,0 +1,2 @@
1
+ import{a as g}from"./chunk-AD3A7DTH.mjs";import{a as S}from"./chunk-R7QOPBWA.mjs";import{a as P}from"./chunk-JJM6ELMS.mjs";import{a as m,b as f}from"./chunk-BFIXIXHO.mjs";import{a as d}from"./chunk-SQR3AIY7.mjs";import{a as w}from"./chunk-KFGXOZ77.mjs";import{a as I}from"./chunk-67BUAZ6O.mjs";import{a as k}from"./chunk-3XH3NNSR.mjs";import{b}from"./chunk-G5ZWH5T3.mjs";import{n as F,r as K}from"./chunk-KG23XFU2.mjs";import{c as p}from"./chunk-XGF7UNEW.mjs";import{b as U}from"./chunk-Q4C4U6I4.mjs";import{a as v}from"./chunk-XTOIL6MB.mjs";import{b as H}from"./chunk-EBMEXURY.mjs";import{b as A}from"./chunk-STY74NUA.mjs";function D(n,s){if(s.serializeStr(n.jwt),s.serializeStr(n.uidKey),s.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(s),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(s),s.serializeOption(n.verificationKeyHash,32)}function B(n){let s=n.deserializeStr(),h=n.deserializeStr(),u=n.deserializeFixedBytes(31),x=I.deserialize(n),z=F.deserialize(n),E=n.deserializeOption("fixedBytes",32);return{jwt:s,uidKey:h,pepper:u,ephemeralKeyPair:x,proof:z,verificationKeyHash:E}}var M;($=>{function n(e){let t=new H;switch(t.serializeU32AsUleb128(e.signingScheme),e.accountAddress.serialize(t),e.signingScheme){case 0:return e.privateKey.serialize(t),t.toUint8Array();case 2:{if(!m(e))throw new Error("Account is not a SingleKeySigner");let o=e.getAnyPublicKey();switch(t.serializeU32AsUleb128(o.variant),o.variant){case 3:return D(e,t),t.toUint8Array();case 4:{let r=e;return D(r,t),r.publicKey.jwkAddress.serialize(t),t.serializeBool(r.audless),t.toUint8Array()}case 1:case 0:return e.privateKey.serialize(t),t.toUint8Array();default:throw new Error(`Invalid public key variant: ${o.variant}`)}}case 3:{let o=e;return o.publicKey.serialize(t),t.serializeU32AsUleb128(o.signers.length),o.signers.forEach(r=>{t.serializeFixedBytes(n(r))}),t.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${e.signingScheme}`)}}$.toBytes=n;function s(e){return A.hexInputToStringWithoutPrefix(n(e))}$.toHexStringWithoutPrefix=s;function h(e){return A.hexInputToString(n(e))}$.toHexString=h;function u(e){let{address:t,signingScheme:o}=P(e);switch(o){case 0:{let r=p.deserialize(e);return new d({privateKey:r,address:t})}case 2:{let r=e.deserializeUleb128AsU32();switch(r){case 0:{let i=p.deserialize(e);return new f({privateKey:i,address:t})}case 1:{let i=b.deserialize(e);return new f({privateKey:i,address:t})}case 3:{let i=B(e),a=K(i);return new g({...i,...a})}case 4:{let i=B(e),a=U.deserialize(e),y=e.deserializeBool(),l=K(i);return new w({...i,...l,jwkAddress:a,audless:y})}default:throw new Error(`Unsupported public key variant ${r}`)}}case 3:{let r=k.deserialize(e),i=e.deserializeUleb128AsU32(),a=new Array;for(let y=0;y<i;y+=1){let l=u(e);if(!m(l)&&!(l instanceof d))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");a.push(l)}return new S({multiKey:r,signers:a,address:t})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${o}`)}}$.deserialize=u;function x(e){let t=c(e);if(!(t instanceof g))throw new Error("Deserialization of KeylessAccount failed");return t}$.keylessAccountFromHex=x;function z(e){let t=c(e);if(!(t instanceof w))throw new Error("Deserialization of FederatedKeylessAccount failed");return t}$.federatedKeylessAccountFromHex=z;function E(e){let t=c(e);if(!(t instanceof S))throw new Error("Deserialization of MultiKeyAccount failed");return t}$.multiKeyAccountFromHex=E;function j(e){let t=c(e);if(!(t instanceof f))throw new Error("Deserialization of SingleKeyAccount failed");return t}$.singleKeyAccountFromHex=j;function C(e){let t=c(e);if(!(t instanceof d))throw new Error("Deserialization of Ed25519Account failed");return t}$.ed25519AccountFromHex=C;function c(e){return u(v.fromHex(e))}$.fromHex=c;function O(e){return c(e)}$.fromBytes=O})(M||(M={}));export{M as a};
2
+ //# sourceMappingURL=chunk-VZELORLW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/AccountUtils.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../bcs\";\nimport { AnyPublicKeyVariant, HexInput, SigningScheme } from \"../types\";\nimport { MultiKeyAccount } from \"./MultiKeyAccount\";\nimport { Account } from \"./Account\";\nimport { Ed25519Account } from \"./Ed25519Account\";\nimport { isSingleKeySigner, SingleKeyAccount, SingleKeySignerOrLegacyEd25519Account } from \"./SingleKeyAccount\";\nimport { KeylessAccount } from \"./KeylessAccount\";\nimport { FederatedKeylessAccount } from \"./FederatedKeylessAccount\";\nimport { AbstractKeylessAccount } from \"./AbstractKeylessAccount\";\nimport {\n AccountAddress,\n Ed25519PrivateKey,\n getIssAudAndUidVal,\n Hex,\n MultiKey,\n Secp256k1PrivateKey,\n ZeroKnowledgeSig,\n} from \"../core\";\nimport { deserializeSchemeAndAddress } from \"./utils\";\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\n\nfunction serializeKeylessAccountCommon(account: AbstractKeylessAccount, serializer: Serializer): void {\n serializer.serializeStr(account.jwt);\n serializer.serializeStr(account.uidKey);\n serializer.serializeFixedBytes(account.pepper);\n account.ephemeralKeyPair.serialize(serializer);\n if (account.proof === undefined) {\n throw new Error(\"Cannot serialize - proof undefined\");\n }\n account.proof.serialize(serializer);\n serializer.serializeOption(account.verificationKeyHash, 32);\n}\n\nfunction deserializeKeylessAccountCommon(deserializer: Deserializer): {\n jwt: string;\n uidKey: string;\n pepper: Uint8Array;\n ephemeralKeyPair: EphemeralKeyPair;\n proof: ZeroKnowledgeSig;\n verificationKeyHash?: Uint8Array;\n} {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n const verificationKeyHash = deserializer.deserializeOption(\"fixedBytes\", 32);\n return { jwt, uidKey, pepper, ephemeralKeyPair, proof, verificationKeyHash };\n}\n\n/**\n * Utility functions for working with accounts.\n */\nexport namespace AccountUtils {\n export function toBytes(account: Account): Uint8Array {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(account.signingScheme);\n account.accountAddress.serialize(serializer);\n switch (account.signingScheme) {\n case SigningScheme.Ed25519:\n (account as Ed25519Account).privateKey.serialize(serializer);\n return serializer.toUint8Array();\n case SigningScheme.SingleKey: {\n if (!isSingleKeySigner(account)) {\n throw new Error(\"Account is not a SingleKeySigner\");\n }\n const anyPublicKey = account.getAnyPublicKey();\n serializer.serializeU32AsUleb128(anyPublicKey.variant);\n switch (anyPublicKey.variant) {\n case AnyPublicKeyVariant.Keyless: {\n const keylessAccount = account as KeylessAccount;\n serializeKeylessAccountCommon(keylessAccount, serializer);\n return serializer.toUint8Array();\n }\n case AnyPublicKeyVariant.FederatedKeyless: {\n const federatedKeylessAccount = account as FederatedKeylessAccount;\n serializeKeylessAccountCommon(federatedKeylessAccount, serializer);\n federatedKeylessAccount.publicKey.jwkAddress.serialize(serializer);\n serializer.serializeBool(federatedKeylessAccount.audless);\n return serializer.toUint8Array();\n }\n case AnyPublicKeyVariant.Secp256k1:\n case AnyPublicKeyVariant.Ed25519: {\n const singleKeyAccount = account as SingleKeyAccount;\n singleKeyAccount.privateKey.serialize(serializer);\n return serializer.toUint8Array();\n }\n default: {\n throw new Error(`Invalid public key variant: ${anyPublicKey.variant}`);\n }\n }\n }\n case SigningScheme.MultiKey: {\n const multiKeyAccount = account as MultiKeyAccount;\n multiKeyAccount.publicKey.serialize(serializer);\n serializer.serializeU32AsUleb128(multiKeyAccount.signers.length);\n multiKeyAccount.signers.forEach((signer) => {\n serializer.serializeFixedBytes(toBytes(signer));\n });\n return serializer.toUint8Array();\n }\n default:\n throw new Error(`Deserialization of Account failed: invalid signingScheme value ${account.signingScheme}`);\n }\n }\n\n export function toHexStringWithoutPrefix(account: Account): string {\n return Hex.hexInputToStringWithoutPrefix(toBytes(account));\n }\n\n export function toHexString(account: Account): string {\n return Hex.hexInputToString(toBytes(account));\n }\n\n export function deserialize(deserializer: Deserializer): Account {\n const { address, signingScheme } = deserializeSchemeAndAddress(deserializer);\n switch (signingScheme) {\n case SigningScheme.Ed25519: {\n const privateKey = Ed25519PrivateKey.deserialize(deserializer);\n return new Ed25519Account({ privateKey, address });\n }\n case SigningScheme.SingleKey: {\n const variantIndex = deserializer.deserializeUleb128AsU32();\n switch (variantIndex) {\n case AnyPublicKeyVariant.Ed25519: {\n const privateKey = Ed25519PrivateKey.deserialize(deserializer);\n return new SingleKeyAccount({ privateKey, address });\n }\n case AnyPublicKeyVariant.Secp256k1: {\n const privateKey = Secp256k1PrivateKey.deserialize(deserializer);\n return new SingleKeyAccount({ privateKey, address });\n }\n case AnyPublicKeyVariant.Keyless: {\n const keylessComponents = deserializeKeylessAccountCommon(deserializer);\n const jwtClaims = getIssAudAndUidVal(keylessComponents);\n return new KeylessAccount({ ...keylessComponents, ...jwtClaims });\n }\n case AnyPublicKeyVariant.FederatedKeyless: {\n const keylessComponents = deserializeKeylessAccountCommon(deserializer);\n const jwkAddress = AccountAddress.deserialize(deserializer);\n const audless = deserializer.deserializeBool();\n const jwtClaims = getIssAudAndUidVal(keylessComponents);\n return new FederatedKeylessAccount({ ...keylessComponents, ...jwtClaims, jwkAddress, audless });\n }\n default:\n throw new Error(`Unsupported public key variant ${variantIndex}`);\n }\n }\n case SigningScheme.MultiKey: {\n const multiKey = MultiKey.deserialize(deserializer);\n const length = deserializer.deserializeUleb128AsU32();\n const signers = new Array<SingleKeySignerOrLegacyEd25519Account>();\n for (let i = 0; i < length; i += 1) {\n const signer = deserialize(deserializer);\n if (!isSingleKeySigner(signer) && !(signer instanceof Ed25519Account)) {\n throw new Error(\n \"Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account\",\n );\n }\n signers.push(signer);\n }\n return new MultiKeyAccount({ multiKey, signers, address });\n }\n default:\n throw new Error(`Deserialization of Account failed: invalid signingScheme value ${signingScheme}`);\n }\n }\n\n export function keylessAccountFromHex(hex: HexInput): KeylessAccount {\n const account = fromHex(hex);\n if (!(account instanceof KeylessAccount)) {\n throw new Error(\"Deserialization of KeylessAccount failed\");\n }\n return account;\n }\n\n export function federatedKeylessAccountFromHex(hex: HexInput): FederatedKeylessAccount {\n const account = fromHex(hex);\n if (!(account instanceof FederatedKeylessAccount)) {\n throw new Error(\"Deserialization of FederatedKeylessAccount failed\");\n }\n return account;\n }\n\n export function multiKeyAccountFromHex(hex: HexInput): MultiKeyAccount {\n const account = fromHex(hex);\n if (!(account instanceof MultiKeyAccount)) {\n throw new Error(\"Deserialization of MultiKeyAccount failed\");\n }\n return account;\n }\n\n export function singleKeyAccountFromHex(hex: HexInput): SingleKeyAccount {\n const account = fromHex(hex);\n if (!(account instanceof SingleKeyAccount)) {\n throw new Error(\"Deserialization of SingleKeyAccount failed\");\n }\n return account;\n }\n\n export function ed25519AccountFromHex(hex: HexInput): Ed25519Account {\n const account = fromHex(hex);\n if (!(account instanceof Ed25519Account)) {\n throw new Error(\"Deserialization of Ed25519Account failed\");\n }\n return account;\n }\n\n export function fromHex(hex: HexInput): Account {\n return deserialize(Deserializer.fromHex(hex));\n }\n\n export function fromBytes(bytes: Uint8Array): Account {\n return fromHex(bytes);\n }\n}\n"],"mappings":"gnBAqBA,SAASA,EAA8BC,EAAiCC,EAA8B,CAKpG,GAJAA,EAAW,aAAaD,EAAQ,GAAG,EACnCC,EAAW,aAAaD,EAAQ,MAAM,EACtCC,EAAW,oBAAoBD,EAAQ,MAAM,EAC7CA,EAAQ,iBAAiB,UAAUC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ASC,EAAuBH,EAAgC,CACrE,IAAMhD,EAAUiD,EAAQD,CAAG,EAC3B,GAAI,EAAEhD,aAAmB8C,GACvB,MAAM,IAAI,MAAM,2CAA2C,EAE7D,OAAO9C,CACT,CANOY,EAAS,uBAAAuC,EAQT,SAASC,EAAwBJ,EAAiC,CACvE,IAAMhD,EAAUiD,EAAQD,CAAG,EAC3B,GAAI,EAAEhD,aAAmB+B,GACvB,MAAM,IAAI,MAAM,4CAA4C,EAE9D,OAAO/B,CACT,CANOY,EAAS,wBAAAwC,EAQT,SAASC,EAAsBL,EAA+B,CACnE,IAAMhD,EAAUiD,EAAQD,CAAG,EAC3B,GAAI,EAAEhD,aAAmB6B,GACvB,MAAM,IAAI,MAAM,0CAA0C,EAE5D,OAAO7B,CACT,CANOY,EAAS,sBAAAyC,EAQT,SAASJ,EAAQD,EAAwB,CAC9C,OAAOzB,EAAY+B,EAAa,QAAQN,CAAG,CAAC,CAC9C,CAFOpC,EAAS,QAAAqC,EAIT,SAASM,EAAUC,EAA4B,CACpD,OAAOP,EAAQO,CAAK,CACtB,CAFO5C,EAAS,UAAA2C,IA/JD3C,MAAA","names":["serializeKeylessAccountCommon","account","serializer","deserializeKeylessAccountCommon","deserializer","jwt","uidKey","pepper","ephemeralKeyPair","EphemeralKeyPair","proof","ZeroKnowledgeSig","verificationKeyHash","AccountUtils","toBytes","Serializer","isSingleKeySigner","anyPublicKey","federatedKeylessAccount","multiKeyAccount","signer","toHexStringWithoutPrefix","Hex","toHexString","deserialize","address","signingScheme","deserializeSchemeAndAddress","privateKey","Ed25519PrivateKey","Ed25519Account","variantIndex","SingleKeyAccount","Secp256k1PrivateKey","keylessComponents","jwtClaims","getIssAudAndUidVal","KeylessAccount","jwkAddress","AccountAddress","audless","FederatedKeylessAccount","multiKey","MultiKey","length","signers","i","MultiKeyAccount","keylessAccountFromHex","hex","fromHex","federatedKeylessAccountFromHex","multiKeyAccountFromHex","singleKeyAccountFromHex","ed25519AccountFromHex","Deserializer","fromBytes","bytes"]}
@@ -1,2 +1,2 @@
1
1
  function i(r,o,t){let n=t.value;return t.value=async function(...e){let[a]=e;if(a.transaction.feePayerAddress&&!a.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return n.apply(this,e)},t}function u(r,o,t){let n=t.value;return t.value=async function(...e){return n.apply(this,e)},t}export{i as a,u as b};
2
- //# sourceMappingURL=chunk-IHGA5KAD.mjs.map
2
+ //# sourceMappingURL=chunk-W4BSN6SK.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/helpers.ts"],"sourcesContent":["/**\n * Validates the fee payer data when submitting a transaction to ensure that the fee payer authenticator is provided if a fee\n * payer address is specified.\n * This helps prevent errors in transaction submission related to fee payer authentication.\n *\n * @param target - The target object where the method is defined.\n * @param propertyKey - The name of the method being decorated.\n * @param descriptor - The property descriptor for the method.\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 * class TransactionHandler {\n * @ValidateFeePayerDataOnSubmission\n * async submitTransaction(methodArgs: { transaction: { feePayerAddress: string }, feePayerAuthenticator?: string }) {\n * // Logic to submit the transaction\n * }\n * }\n *\n * async function runExample() {\n * const handler = new TransactionHandler();\n *\n * // Attempt to submit a transaction without a fee payer authenticator\n * try {\n * await handler.submitTransaction({\n * transaction: { feePayerAddress: \"0x1\" }, // replace with a real fee payer address\n * });\n * } catch (error) {\n * console.error(error.message); // Should log the error message\n * }\n *\n * // Submit a transaction with a fee payer authenticator\n * await handler.submitTransaction({\n * transaction: { feePayerAddress: \"0x1\" }, // replace with a real fee payer address\n * feePayerAuthenticator: \"authenticatorValue\", // replace with a real authenticator\n * });\n *\n * console.log(\"Transaction submitted successfully.\");\n * }\n * runExample().catch(console.error);\n * ```\n * @group Implementation\n */\nexport function ValidateFeePayerDataOnSubmission(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n const [methodArgs] = args;\n\n if (methodArgs.transaction.feePayerAddress && !methodArgs.feePayerAuthenticator) {\n throw new Error(\"You are submitting a Fee Payer transaction but missing the feePayerAuthenticator\");\n }\n\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n\n/**\n * Validates that the fee payer public key is provided when simulating a Fee Payer transaction.\n * This ensures that all necessary data is present for the simulation to proceed correctly.\n *\n * @param target - The target object where the method is defined.\n * @param propertyKey - The name of the method being decorated.\n * @param descriptor - The property descriptor for the method.\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 * const methodArgs = {\n * transaction: {\n * feePayerAddress: \"0x1\", // replace with a real fee payer address\n * },\n * feePayerPublicKey: undefined, // missing fee payer public key\n * };\n *\n * try {\n * // This will throw an error due to missing feePayerPublicKey\n * await aptos.someMethod(methodArgs);\n * } catch (error) {\n * console.error(error.message); // Output the error message\n * }\n * }\n * runExample().catch(console.error);\n * ```\n * @group Implementation\n */\nexport function ValidateFeePayerDataOnSimulation(target: unknown, propertyKey: string, descriptor: PropertyDescriptor) {\n const originalMethod = descriptor.value;\n /* eslint-disable-next-line func-names, no-param-reassign */\n descriptor.value = async function (...args: any[]) {\n return originalMethod.apply(this, args);\n };\n\n return descriptor;\n}\n"],"mappings":"AA+CO,SAASA,EAAiCC,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,GAAM,CAACC,CAAU,EAAID,EAErB,GAAIC,EAAW,YAAY,iBAAmB,CAACA,EAAW,sBACxD,MAAM,IAAI,MAAM,kFAAkF,EAGpG,OAAOF,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT,CAoCO,SAASI,EAAiCN,EAAiBC,EAAqBC,EAAgC,CACrH,IAAMC,EAAiBD,EAAW,MAElC,OAAAA,EAAW,MAAQ,kBAAmBE,EAAa,CACjD,OAAOD,EAAe,MAAM,KAAMC,CAAI,CACxC,EAEOF,CACT","names":["ValidateFeePayerDataOnSubmission","target","propertyKey","descriptor","originalMethod","args","methodArgs","ValidateFeePayerDataOnSimulation"]}
@@ -0,0 +1,2 @@
1
+ import{a as r}from"./chunk-EBMEXURY.mjs";import{b as t}from"./chunk-STY74NUA.mjs";var o=class extends r{toUint8Array(){return this.bcsToBytes()}toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
+ //# sourceMappingURL=chunk-WCMW2L3P.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/signature.ts"],"sourcesContent":["import { Serializable } from \"../../bcs\";\nimport { Hex } from \"../hex\";\n\n/**\n * An abstract representation of a crypto signature,\n * associated with a specific signature scheme, e.g., Ed25519 or Secp256k1.\n *\n * This class represents the product of signing a message directly from a\n * PrivateKey and can be verified against a CryptoPublicKey.\n * @group Implementation\n * @category Serialization\n */\nexport abstract class Signature extends Serializable {\n /**\n * Get the raw signature bytes\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n /**\n * Get the signature as a hex string with a 0x prefix e.g. 0x123456...\n * @returns The hex string representation of the signature.\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n const bytes = this.toUint8Array();\n return Hex.fromHexInput(bytes).toString();\n }\n}\n\n/**\n * An abstract representation of an account signature,\n * associated to a specific authentication scheme e.g. Ed25519 or SingleKey\n *\n * This is the product of signing a message through an account,\n * and can be verified against an AccountPublicKey.\n * @group Implementation\n * @category Serialization\n */\n// export abstract class AccountSignature extends Serializable {\n// /**\n// * Get the raw signature bytes\n// */\n// abstract toUint8Array(): Uint8Array;\n//\n// /**\n// * Get the signature as a hex string with a 0x prefix e.g. 0x123456...\n// */\n// toString(): string {\n// const bytes = this.toUint8Array();\n// return Hex.fromHexInput(bytes).toString();\n// }\n// }\n"],"mappings":"kFAYO,IAAeA,EAAf,cAAiCC,CAAa,CAMnD,cAA2B,CACzB,OAAO,KAAK,WAAW,CACzB,CAQA,UAAmB,CACjB,IAAMC,EAAQ,KAAK,aAAa,EAChC,OAAOC,EAAI,aAAaD,CAAK,EAAE,SAAS,CAC1C,CACF","names":["Signature","Serializable","bytes","Hex"]}
@@ -1,2 +1,2 @@
1
- import{a as t,b as n,c as o,d as r}from"./chunk-FH27D7S3.mjs";import{a as s}from"./chunk-ALOYOMRE.mjs";import{b as i}from"./chunk-JNO7KPMG.mjs";var a=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await t({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await t({aptosConfig:this.config,options:{where:{creator_address:{_eq:i.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),o({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return r({aptosConfig:this.config,...e})}};export{a};
2
- //# sourceMappingURL=chunk-XOOYRVFK.mjs.map
1
+ import{a as t,b as n,c as o,d as r}from"./chunk-FQECACH3.mjs";import{a as s}from"./chunk-H3XZ3FZY.mjs";import{b as i}from"./chunk-Q4C4U6I4.mjs";var a=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await t({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await t({aptosConfig:this.config,options:{where:{creator_address:{_eq:i.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),o({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return r({aptosConfig:this.config,...e})}};export{a};
2
+ //# sourceMappingURL=chunk-X3SO2LDX.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/fungibleAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport {\n getCurrentFungibleAssetBalances,\n getFungibleAssetActivities,\n getFungibleAssetMetadata,\n transferFungibleAsset,\n} from \"../internal/fungibleAsset\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { Account } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * A class for querying and managing fungible asset-related operations on the Aptos blockchain.\n * @group FungibleAsset\n */\nexport class FungibleAsset {\n /**\n * Initializes a new instance of the Aptos class with the provided configuration.\n * This allows you to interact with the Aptos blockchain using the specified network settings.\n *\n * @param config - The configuration settings for connecting to the Aptos network.\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({ network: Network.TESTNET }); // Specify your own network if needed\n *\n * // Initialize the Aptos client with the configuration\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries all fungible asset metadata.\n *\n * @param args Optional parameters for the query.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options Optional configuration for pagination and filtering.\n *\n * @returns A list of fungible asset metadata.\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 * // Fetching fungible asset metadata\n * const fungibleAssets = await aptos.getFungibleAssetMetadata();\n * console.log(fungibleAssets);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n async getFungibleAssetMetadata(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n }): Promise<GetFungibleAssetMetadataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getFungibleAssetMetadata({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the fungible asset metadata for a specific asset type.\n * This function helps retrieve detailed information about a fungible asset based on its type.\n *\n * @param args - The parameters for the query.\n * @param args.assetType - The asset type of the fungible asset, e.g., \"0x1::aptos_coin::AptosCoin\" for Aptos Coin.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n *\n * @returns A fungible asset metadata item.\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 * // Retrieve fungible asset metadata by asset type\n * const fungibleAsset = await aptos.getFungibleAssetMetadataByAssetType({\n * assetType: \"0x1::aptos_coin::AptosCoin\" // replace with your asset type\n * });\n *\n * console.log(fungibleAsset);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n async getFungibleAssetMetadataByAssetType(args: {\n assetType: string;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetFungibleAssetMetadataResponse[0]> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n const data = await getFungibleAssetMetadata({\n aptosConfig: this.config,\n options: {\n where: {\n asset_type: { _eq: args.assetType },\n },\n },\n });\n\n return data[0];\n }\n\n /**\n * Retrieves fungible asset metadata based on the creator address.\n *\n * This function allows you to query metadata for a specific fungible asset created by a given address.\n *\n * @param args - The parameters for the query.\n * @param args.creatorAddress - The creator address of the fungible asset.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n *\n * @returns A fungible asset metadata item.\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 * // Retrieve fungible asset metadata by creator address\n * const fungibleAsset = await aptos.getFungibleAssetMetadataByCreatorAddress({\n * creatorAddress: \"0x123\", // replace with a real creator address\n * });\n *\n * console.log(fungibleAsset);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n async getFungibleAssetMetadataByCreatorAddress(args: {\n creatorAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetFungibleAssetMetadataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n const data = await getFungibleAssetMetadata({\n aptosConfig: this.config,\n options: {\n where: {\n creator_address: { _eq: AccountAddress.from(args.creatorAddress).toStringLong() },\n },\n },\n });\n\n return data;\n }\n\n /**\n * Queries all fungible asset activities and returns a list of their metadata.\n *\n * @param args Optional parameters for the query.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying.\n * @param args.options Optional configuration for pagination and filtering.\n * @returns A list of fungible asset metadata.\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 * // Fetching fungible asset activities\n * const fungibleAssetActivities = await aptos.getFungibleAssetActivities();\n * console.log(fungibleAssetActivities);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n async getFungibleAssetActivities(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n }): Promise<GetFungibleAssetActivitiesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getFungibleAssetActivities({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries all fungible asset balances.\n *\n * @param args Optional parameters for the query.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying.\n * @param args.options Optional configuration for pagination and filtering.\n *\n * @returns A list of fungible asset metadata.\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 * // Fetching current fungible asset balances\n * const fungibleAssetBalances = await aptos.getCurrentFungibleAssetBalances();\n *\n * console.log(fungibleAssetBalances);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n async getCurrentFungibleAssetBalances(args?: {\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetCurrentFungibleAssetBalancesResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args?.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getCurrentFungibleAssetBalances({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Transfer a specified amount of fungible asset from the sender's primary store to the recipient's primary store.\n * This method allows you to transfer any fungible asset, including fungible tokens.\n *\n * @param args - The arguments for the transfer operation.\n * @param args.sender - The sender account.\n * @param args.fungibleAssetMetadataAddress - The fungible asset account address. For example, if you’re transferring USDT,\n * this would be the USDT address.\n * @param args.recipient - The recipient account address.\n * @param args.amount - The number of assets to transfer.\n * @param args.options - Optional parameters for generating the transaction.\n *\n * @returns A SimpleTransaction that can be simulated or submitted to the chain.\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 * // Transfer fungible asset from sender to recipient\n * const transaction = await aptos.transferFungibleAsset({\n * sender: Account.generate(), // replace with a real sender account\n * fungibleAssetMetadataAddress: \"0x123\", // replace with a real fungible asset address\n * recipient: \"0x456\", // replace with a real recipient account\n * amount: 5\n * });\n *\n * console.log(transaction);\n * }\n * runExample().catch(console.error);\n * ```\n * @group FungibleAsset\n */\n async transferFungibleAsset(args: {\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferFungibleAsset({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"gJAkCO,IAAMA,EAAN,KAAoB,CAwBzB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CA2B3C,MAAM,yBAAyBC,EAGe,CAC5C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACME,EAAyB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CACvE,CA+BA,MAAM,oCAAoCA,EAGO,CAC/C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,GACY,MAAME,EAAyB,CAC1C,YAAa,KAAK,OAClB,QAAS,CACP,MAAO,CACL,WAAY,CAAE,IAAKF,EAAK,SAAU,CACpC,CACF,CACF,CAAC,GAEW,CAAC,CACf,CAgCA,MAAM,yCAAyCA,EAGD,CAC5C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACY,MAAME,EAAyB,CAC1C,YAAa,KAAK,OAClB,QAAS,CACP,MAAO,CACL,gBAAiB,CAAE,IAAKC,EAAe,KAAKH,EAAK,cAAc,EAAE,aAAa,CAAE,CAClF,CACF,CACF,CAAC,CAGH,CA0BA,MAAM,2BAA2BA,EAGe,CAC9C,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACMI,EAA2B,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CACzE,CA4BA,MAAM,gCAAgCA,EAGe,CACnD,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,GAAM,qBAC5B,wCACF,CAAC,EACMK,EAAgC,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAC9E,CAsCA,MAAM,sBAAsBA,EAMG,CAC7B,OAAOM,EAAsB,CAAE,YAAa,KAAK,OAAQ,GAAGN,CAAK,CAAC,CACpE,CACF","names":["FungibleAsset","config","args","waitForIndexerOnVersion","getFungibleAssetMetadata","AccountAddress","getFungibleAssetActivities","getCurrentFungibleAssetBalances","transferFungibleAsset"]}
@@ -1,2 +1,2 @@
1
- import{a as x}from"./chunk-AVZYJAXR.mjs";import{b}from"./chunk-MHN6XY4Z.mjs";import{a as U}from"./chunk-4O5XDQDO.mjs";import{a as d}from"./chunk-5B3SMBXQ.mjs";import{d as A,f as v,g as S,h as E,i as H,j as P}from"./chunk-OIOGOW6I.mjs";import{a as K}from"./chunk-AKIO3OIT.mjs";import{a as p}from"./chunk-AJ5JHBAE.mjs";import{b as o}from"./chunk-SPRNSFUV.mjs";import{ed25519 as y}from"@noble/curves/ed25519";var m=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function T(I){let e=I.toUint8Array().slice(32);for(let t=m.length-1;t>=0;t-=1){if(e[t]<m[t])return!0;if(e[t]>m[t])return!1}return!1}var n=class n extends b{constructor(e){super();let t=o.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;if(!T(i))return!1;let a=d(t),c=o.fromHexInput(a).toUint8Array(),u=i.toUint8Array(),l=this.key.toUint8Array();return y.verify(u,c,l)}authKey(){return K.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}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=32;var f=n,r=class r extends p{constructor(e,t){super();let i=x.parseHexInput(e,"ed25519",t);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKey=i}static generate(){let e=y.utils.randomPrivateKey();return new r(e,!1)}static fromDerivationPath(e,t){if(!v(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,P(t))}static fromDerivationPathInner(e,t,i=A){let{key:a,chainCode:c}=S(r.SLIP_0010_SEED,t),u=H(e).map(g=>parseInt(g,10)),{key:l}=u.reduce((g,w)=>E(g,w+i),{key:a,chainCode:c});return new r(l,!1)}publicKey(){let e=y.getPublicKey(this.signingKey.toUint8Array());return new f(e)}sign(e){let t=d(e),i=o.fromHexInput(t).toUint8Array(),a=y.sign(i,this.signingKey.toUint8Array());return new h(a)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.signingKey.toString()}toAIP80String(){return x.formatPrivateKey(this.signingKey.toString(),"ed25519")}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,r.SLIP_0010_SEED="ed25519 seed";var z=r,s=class s extends U{constructor(e){super();let t=o.fromHexInput(e);if(t.toUint8Array().length!==s.LENGTH)throw new Error(`Signature length should be ${s.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 h=s;export{T as a,f as b,z as c,h as d};
2
- //# sourceMappingURL=chunk-TTERI67T.mjs.map
1
+ import{b}from"./chunk-EMURYYVO.mjs";import{a as U}from"./chunk-WCMW2L3P.mjs";import{a as d}from"./chunk-DPW6ELCQ.mjs";import{d as A,f as v,g as S,h as E,i as H,j as P}from"./chunk-C3Q23D22.mjs";import{a as x}from"./chunk-ROT6S6BM.mjs";import{a as K}from"./chunk-FN4C3CKC.mjs";import{a as p}from"./chunk-EBMEXURY.mjs";import{b as o}from"./chunk-STY74NUA.mjs";import{ed25519 as y}from"@noble/curves/ed25519";var m=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function T(I){let e=I.toUint8Array().slice(32);for(let t=m.length-1;t>=0;t-=1){if(e[t]<m[t])return!0;if(e[t]>m[t])return!1}return!1}var n=class n extends b{constructor(e){super();let t=o.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;if(!T(i))return!1;let a=d(t),c=o.fromHexInput(a).toUint8Array(),u=i.toUint8Array(),l=this.key.toUint8Array();return y.verify(u,c,l)}authKey(){return K.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}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=32;var f=n,r=class r extends p{constructor(e,t){super();let i=x.parseHexInput(e,"ed25519",t);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKey=i}static generate(){let e=y.utils.randomPrivateKey();return new r(e,!1)}static fromDerivationPath(e,t){if(!v(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,P(t))}static fromDerivationPathInner(e,t,i=A){let{key:a,chainCode:c}=S(r.SLIP_0010_SEED,t),u=H(e).map(g=>parseInt(g,10)),{key:l}=u.reduce((g,w)=>E(g,w+i),{key:a,chainCode:c});return new r(l,!1)}publicKey(){let e=y.getPublicKey(this.signingKey.toUint8Array());return new f(e)}sign(e){let t=d(e),i=o.fromHexInput(t).toUint8Array(),a=y.sign(i,this.signingKey.toUint8Array());return new h(a)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toHexString()}toHexString(){return this.signingKey.toString()}toAIP80String(){return x.formatPrivateKey(this.signingKey.toString(),"ed25519")}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,r.SLIP_0010_SEED="ed25519 seed";var z=r,s=class s extends U{constructor(e){super();let t=o.fromHexInput(e);if(t.toUint8Array().length!==s.LENGTH)throw new Error(`Signature length should be ${s.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 h=s;export{T as a,f as b,z as c,h as d};
2
+ //# sourceMappingURL=chunk-XGF7UNEW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/ed25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { ed25519 } from \"@noble/curves/ed25519\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { HexInput, SigningScheme as AuthenticationKeyScheme, PrivateKeyVariants } from \"../../types\";\nimport { CKDPriv, deriveKey, HARDENED_OFFSET, isValidHardenedPath, mnemonicToSeed, splitPath } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * L is the value that greater than or equal to will produce a non-canonical signature, and must be rejected\n * @group Implementation\n * @category Serialization\n */\nconst L: number[] = [\n 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0x00, 0x00, 0x00,\n 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\n];\n\n/**\n * Checks if an ED25519 signature is non-canonical.\n * This function helps determine the validity of a signature by verifying its canonical form.\n *\n * @param signature - The signature to be checked for canonicality.\n * @returns A boolean indicating whether the signature is non-canonical.\n *\n * Comes from Aptos Core\n * https://github.com/aptos-labs/aptos-core/blob/main/crates/aptos-crypto/src/ed25519/ed25519_sigs.rs#L47-L85\n * @group Implementation\n * @category Serialization\n */\nexport function isCanonicalEd25519Signature(signature: Signature): boolean {\n const s = signature.toUint8Array().slice(32);\n for (let i = L.length - 1; i >= 0; i -= 1) {\n if (s[i] < L[i]) {\n return true;\n }\n if (s[i] > L[i]) {\n return false;\n }\n }\n // As this stage S == L which implies a non-canonical S.\n return false;\n}\n\n/**\n * Represents the public key of an Ed25519 key pair.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n *\n * Ed25519 scheme is represented in the SDK as `Legacy authentication key` and also\n * as `AnyPublicKey` that represents any `Unified authentication key`.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519PublicKey extends AccountPublicKey {\n /**\n * Length of an Ed25519 public key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * Bytes of the public key\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: Hex;\n\n /**\n * Creates an instance of the Ed25519Signature class from a hex input.\n * This constructor validates the length of the signature to ensure it meets the required specifications.\n *\n * @param hexInput - The hex input representing the Ed25519 signature.\n * @throws Error if the signature length is not equal to Ed25519Signature.LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Ed25519PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Ed25519PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a signed message using a public key.\n *\n * @param args - The arguments for verification.\n * @param args.message - A signed message as a Hex string or Uint8Array.\n * @param args.signature - The signature of the message.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n // Verify malleability\n if (!isCanonicalEd25519Signature(signature)) {\n return false;\n }\n\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const signatureBytes = signature.toUint8Array();\n const publicKeyBytes = this.key.toUint8Array();\n return ed25519.verify(signatureBytes, messageBytes, publicKeyBytes);\n }\n\n /**\n * Generates an authentication key from the public key using the Ed25519 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.Ed25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Convert the internal data representation to a Uint8Array.\n *\n * @returns Uint8Array representation of the data.\n * @group Implementation\n * @category Serialization\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 allows for the conversion of data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserialize bytes into an Ed25519Signature object.\n * This function is used to convert serialized byte data into a usable Ed25519Signature instance.\n *\n * @param deserializer - The deserializer instance used to read the byte data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Ed25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * Determine if the provided public key is an instance of Ed25519PublicKey.\n *\n * @param publicKey - The public key to check.\n * @returns True if the public key is an instance of Ed25519PublicKey, otherwise false.\n * @deprecated use `instanceof Ed25519PublicKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPublicKey(publicKey: AccountPublicKey): publicKey is Ed25519PublicKey {\n return publicKey instanceof Ed25519PublicKey;\n }\n\n /**\n * Determines if the provided public key is a valid Ed25519 public key.\n * This function checks for the presence of the \"key\" property and verifies that its data length matches the expected length\n * for Ed25519 public keys.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Ed25519 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Ed25519PublicKey {\n return \"key\" in publicKey && (publicKey.key as any)?.data?.length === Ed25519PublicKey.LENGTH;\n }\n}\n\n/**\n * Represents the private key of an Ed25519 key pair.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of an Ed25519 private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The Ed25519 key seed to use for BIP-32 compatibility\n * See more {@link https://github.com/satoshilabs/slips/blob/master/slip-0010.md}\n * @group Implementation\n * @category Serialization\n */\n static readonly SLIP_0010_SEED = \"ed25519 seed\";\n\n /**\n * The Ed25519 signing key\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly signingKey: 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 HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Ed25519, strict);\n if (privateKeyHex.toUint8Array().length !== Ed25519PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Ed25519PrivateKey.LENGTH}`);\n }\n\n // Create keyPair from Private key in Uint8Array format\n this.signingKey = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Ed25519PrivateKey A newly generated Ed25519 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Ed25519PrivateKey {\n const keyPair = ed25519.utils.randomPrivateKey();\n return new Ed25519PrivateKey(keyPair, false);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase using a specified BIP44 path.\n * To derive multiple keys from the same phrase, change the path\n *\n * IMPORTANT: Ed25519 supports hardened derivation only, as it lacks a key homomorphism, making non-hardened derivation impossible.\n *\n * @param path - The BIP44 path used for key derivation.\n * @param mnemonics - The mnemonic seed phrase from which the key will be derived.\n * @throws Error if the provided path is not a valid hardened path.\n * @group Implementation\n * @category Serialization\n */\n static fromDerivationPath(path: string, mnemonics: string): Ed25519PrivateKey {\n if (!isValidHardenedPath(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Ed25519PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * Derives a child private key from a given BIP44 path and seed.\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\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 * @param offset - The offset used for key derivation, defaults to HARDENED_OFFSET.\n * @returns An instance of Ed25519PrivateKey derived from the specified path and seed.\n * @group Implementation\n * @category Serialization\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array, offset = HARDENED_OFFSET): Ed25519PrivateKey {\n const { key, chainCode } = deriveKey(Ed25519PrivateKey.SLIP_0010_SEED, seed);\n\n const segments = splitPath(path).map((el) => parseInt(el, 10));\n\n // Derive the child key based on the path\n const { key: privateKey } = segments.reduce((parentKeys, segment) => CKDPriv(parentKeys, segment + offset), {\n key,\n chainCode,\n });\n return new Ed25519PrivateKey(privateKey, false);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Derive the Ed25519PublicKey for this private key.\n *\n * @returns Ed25519PublicKey - The derived public key corresponding to the private key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Ed25519PublicKey {\n const bytes = ed25519.getPublicKey(this.signingKey.toUint8Array());\n return new Ed25519PublicKey(bytes);\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a digital signature for the specified message, ensuring its authenticity and integrity.\n *\n * @param message - A message as a string or Uint8Array in HexInput format.\n * @returns A digital signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Ed25519Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign).toUint8Array();\n const signatureBytes = ed25519.sign(messageBytes, this.signingKey.toUint8Array());\n return new Ed25519Signature(signatureBytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.signingKey.toUint8Array();\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 * @group Implementation\n * @category Serialization\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.signingKey.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.signingKey.toString(), PrivateKeyVariants.Ed25519);\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): Ed25519PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519PrivateKey(bytes, false);\n }\n\n // endregion\n\n /**\n * Determines if the provided private key is an instance of Ed25519PrivateKey.\n *\n * @param privateKey - The private key to check.\n * @returns A boolean indicating whether the private key is an Ed25519PrivateKey.\n *\n * @deprecated Use `instanceof Ed25519PrivateKey` instead.\n * @group Implementation\n * @category Serialization\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Ed25519PrivateKey {\n return privateKey instanceof Ed25519PrivateKey;\n }\n}\n\n/**\n * Represents a signature of a message signed using an Ed25519 private key.\n * @group Implementation\n * @category Serialization\n */\nexport class Ed25519Signature extends Signature {\n /**\n * Length of an Ed25519 signature, which is 64 bytes.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly data: Hex;\n\n // region Constructors\n\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Ed25519Signature.LENGTH) {\n throw new Error(`Signature length should be ${Ed25519Signature.LENGTH}`);\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): Ed25519Signature {\n const bytes = deserializer.deserializeBytes();\n return new Ed25519Signature(bytes);\n }\n\n // endregion\n}\n"],"mappings":"sWAGA,OAAS,WAAAA,MAAe,wBAiBxB,IAAMC,EAAc,CAClB,IAAM,IAAM,IAAM,GAAM,GAAM,GAAM,GAAM,GAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,IAAM,GAAM,EAAM,EAAM,EAC5G,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM,EAAM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signature","s","i","_Ed25519PublicKey","AccountPublicKey","hexInput","hex","Hex","args","message","messageToVerify","convertSigningMessage","messageBytes","signatureBytes","publicKeyBytes","ed25519","AuthenticationKey","serializer","deserializer","bytes","publicKey","Ed25519PublicKey","_Ed25519PrivateKey","Serializable","strict","privateKeyHex","PrivateKey","keyPair","path","mnemonics","isValidHardenedPath","mnemonicToSeed","seed","offset","HARDENED_OFFSET","key","chainCode","deriveKey","segments","splitPath","el","privateKey","parentKeys","segment","CKDPriv","messageToSign","Ed25519Signature","Ed25519PrivateKey","_Ed25519Signature","Signature","data"]}
@@ -0,0 +1,2 @@
1
+ import{c as l}from"./chunk-AZWVCBK2.mjs";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-UYONA6PP.mjs";import{c as j}from"./chunk-P54RNN4V.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-G4O6FXCF.mjs";import{b as m}from"./chunk-Q4C4U6I4.mjs";import{a as T,c as I,d as f}from"./chunk-N4VVDQA5.mjs";import{a as A,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-ORMOQWWH.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.newBytes(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-XHPWHA6B.mjs.map