@aptos-labs/ts-sdk 1.33.1 → 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 (715) hide show
  1. package/README.md +11 -6
  2. package/dist/common/{accountAddress-BHsGaOsa.d.ts → accountAddress-Cf1amU98.d.ts} +279 -0
  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 +47 -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 -306
  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 +6 -1
  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 +9 -2
  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 +43 -1
  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-4DP3PEYK.mjs → chunk-32WLD3F3.mjs} +2 -2
  97. package/dist/esm/chunk-32WLD3F3.mjs.map +1 -0
  98. package/dist/esm/{chunk-FZDEGDUY.mjs → chunk-35DKMW7Q.mjs} +1 -1
  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-IBZKCBN5.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-JMPHD4BP.mjs → chunk-4ZJJINCW.mjs} +2 -2
  111. package/dist/esm/chunk-4ZJJINCW.mjs.map +1 -0
  112. package/dist/esm/{chunk-ZXVN3HXB.mjs → chunk-66AQ2MJ6.mjs} +2 -2
  113. package/dist/esm/chunk-66AQ2MJ6.mjs.map +1 -0
  114. package/dist/esm/{chunk-4XB3BB5Z.mjs → chunk-67BUAZ6O.mjs} +2 -2
  115. package/dist/esm/chunk-67BUAZ6O.mjs.map +1 -0
  116. package/dist/esm/{chunk-333QBK32.mjs → chunk-67ZANQ3R.mjs} +2 -2
  117. package/dist/esm/chunk-67ZANQ3R.mjs.map +1 -0
  118. package/dist/esm/{chunk-UFPYCROT.mjs → chunk-6IIAGMDR.mjs} +2 -2
  119. package/dist/esm/chunk-6IIAGMDR.mjs.map +1 -0
  120. package/dist/esm/{chunk-F2WY2DEY.mjs → chunk-6IPM5P4L.mjs} +2 -2
  121. package/dist/esm/chunk-6IPM5P4L.mjs.map +1 -0
  122. package/dist/esm/{chunk-IK2NYNKG.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-2KSMV5KD.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-5PVZ4N42.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-YD2BMHH7.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-EGV3HFE3.mjs → chunk-CDYLZDD2.mjs} +2 -2
  143. package/dist/esm/chunk-CDYLZDD2.mjs.map +1 -0
  144. package/dist/esm/{chunk-LA5HJILW.mjs → chunk-CGTHWGSJ.mjs} +2 -2
  145. package/dist/esm/chunk-CGTHWGSJ.mjs.map +1 -0
  146. package/dist/esm/{chunk-VWGB5BHW.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-SK3LIS4Z.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-YEWZAR76.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-G4KAHJXB.mjs → chunk-EBS4BKER.mjs} +2 -2
  163. package/dist/esm/chunk-EBS4BKER.mjs.map +1 -0
  164. package/dist/esm/{chunk-S5SQJRAV.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-2ESU5N3V.mjs → chunk-FNXO3URE.mjs} +2 -2
  177. package/dist/esm/chunk-FNXO3URE.mjs.map +1 -0
  178. package/dist/esm/{chunk-7V35JAAF.mjs → chunk-FQECACH3.mjs} +2 -2
  179. package/dist/esm/chunk-FQECACH3.mjs.map +1 -0
  180. package/dist/esm/{chunk-2QGJDHME.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-7N7FEBZA.mjs → chunk-G5ZWH5T3.mjs} +2 -2
  185. package/dist/esm/chunk-G5ZWH5T3.mjs.map +1 -0
  186. package/dist/esm/{chunk-UGIHQFID.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-33CVOPIN.mjs → chunk-H3XZ3FZY.mjs} +2 -2
  192. package/dist/esm/{chunk-33CVOPIN.mjs.map → chunk-H3XZ3FZY.mjs.map} +1 -1
  193. package/dist/esm/{chunk-7T26VA2W.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-LPVGVTWT.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-SNYYEVJA.mjs → chunk-K2CSACQY.mjs} +2 -2
  202. package/dist/esm/chunk-K2CSACQY.mjs.map +1 -0
  203. package/dist/esm/{chunk-NZ7M6NG2.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-PXMNAP2Q.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-GVNK3UMT.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-ZMMLM6ZJ.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-HMMNQFVM.mjs → chunk-NDUIXMIA.mjs} +2 -2
  221. package/dist/esm/chunk-NDUIXMIA.mjs.map +1 -0
  222. package/dist/esm/{chunk-U3T4ZT7B.mjs → chunk-NW2WUKWV.mjs} +2 -2
  223. package/dist/esm/chunk-NW2WUKWV.mjs.map +1 -0
  224. package/dist/esm/{chunk-XZN344G4.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-4MTSP4S2.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-XOLU6UP3.mjs → chunk-PHJRCZQ3.mjs} +2 -2
  233. package/dist/esm/chunk-PHJRCZQ3.mjs.map +1 -0
  234. package/dist/esm/{chunk-VIZHWYI5.mjs → chunk-PNDCGNVH.mjs} +2 -2
  235. package/dist/esm/chunk-PNDCGNVH.mjs.map +1 -0
  236. package/dist/esm/{chunk-5LGKGWLX.mjs → chunk-PTS3BTOU.mjs} +2 -2
  237. package/dist/esm/chunk-PTS3BTOU.mjs.map +1 -0
  238. package/dist/esm/{chunk-NK67FECB.mjs → chunk-PUNTBVRJ.mjs} +2 -2
  239. package/dist/esm/chunk-PUNTBVRJ.mjs.map +1 -0
  240. package/dist/esm/{chunk-DBTKJMLV.mjs → chunk-Q2C6ZY5N.mjs} +2 -2
  241. package/dist/esm/chunk-Q2C6ZY5N.mjs.map +1 -0
  242. package/dist/esm/{chunk-UJSTWN32.mjs → chunk-Q3VS6AEN.mjs} +2 -2
  243. package/dist/esm/{chunk-UJSTWN32.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-BUAHUVAD.mjs → chunk-ROT6S6BM.mjs} +2 -2
  252. package/dist/esm/chunk-ROT6S6BM.mjs.map +1 -0
  253. package/dist/esm/{chunk-RCA73RVB.mjs → chunk-SOLQ5VON.mjs} +2 -2
  254. package/dist/esm/chunk-SOLQ5VON.mjs.map +1 -0
  255. package/dist/esm/{chunk-L4SWQLAJ.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-LKKI2KAP.mjs → chunk-SZRZ3HIL.mjs} +2 -2
  260. package/dist/esm/chunk-SZRZ3HIL.mjs.map +1 -0
  261. package/dist/esm/{chunk-KCWRCWNT.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-2MN7DW2J.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-ALNQK276.mjs → chunk-UONSJQUV.mjs} +2 -2
  270. package/dist/esm/chunk-UONSJQUV.mjs.map +1 -0
  271. package/dist/esm/{chunk-N62NUAHT.mjs → chunk-UQ7D5CSM.mjs} +2 -2
  272. package/dist/esm/chunk-UQ7D5CSM.mjs.map +1 -0
  273. package/dist/esm/{chunk-BAEIZAP7.mjs → chunk-UYONA6PP.mjs} +2 -2
  274. package/dist/esm/chunk-UYONA6PP.mjs.map +1 -0
  275. package/dist/esm/{chunk-YJVZFYBX.mjs → chunk-VCIJX6R4.mjs} +2 -2
  276. package/dist/esm/chunk-VCIJX6R4.mjs.map +1 -0
  277. package/dist/esm/{chunk-CX6KECGV.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-PMGK5IHB.mjs → chunk-X3SO2LDX.mjs} +2 -2
  286. package/dist/esm/chunk-X3SO2LDX.mjs.map +1 -0
  287. package/dist/esm/{chunk-H3C3VTHS.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-2C27NY4D.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-ZMS3AOEZ.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-U6OCK6T4.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-WFK3XRQX.mjs → chunk-YPGI5HAA.mjs} +2 -2
  306. package/dist/esm/chunk-YPGI5HAA.mjs.map +1 -0
  307. package/dist/esm/{chunk-QI7OREBM.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 +27 -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 +51 -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 +47 -1
  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 +26 -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 +8 -0
  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 +49 -2
  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-2C27NY4D.mjs.map +0 -1
  594. package/dist/esm/chunk-2CJC43CV.mjs.map +0 -1
  595. package/dist/esm/chunk-2ESU5N3V.mjs.map +0 -1
  596. package/dist/esm/chunk-2KSMV5KD.mjs.map +0 -1
  597. package/dist/esm/chunk-2MN7DW2J.mjs.map +0 -1
  598. package/dist/esm/chunk-2QGJDHME.mjs.map +0 -1
  599. package/dist/esm/chunk-333QBK32.mjs.map +0 -1
  600. package/dist/esm/chunk-372SLYVR.mjs +0 -2
  601. package/dist/esm/chunk-372SLYVR.mjs.map +0 -1
  602. package/dist/esm/chunk-42H7WETG.mjs.map +0 -1
  603. package/dist/esm/chunk-46O23AOD.mjs +0 -2
  604. package/dist/esm/chunk-46O23AOD.mjs.map +0 -1
  605. package/dist/esm/chunk-4DI5SPSK.mjs +0 -2
  606. package/dist/esm/chunk-4DI5SPSK.mjs.map +0 -1
  607. package/dist/esm/chunk-4DP3PEYK.mjs.map +0 -1
  608. package/dist/esm/chunk-4MTSP4S2.mjs.map +0 -1
  609. package/dist/esm/chunk-4O5XDQDO.mjs +0 -2
  610. package/dist/esm/chunk-4O5XDQDO.mjs.map +0 -1
  611. package/dist/esm/chunk-4OV2A6PJ.mjs +0 -2
  612. package/dist/esm/chunk-4OV2A6PJ.mjs.map +0 -1
  613. package/dist/esm/chunk-4XB3BB5Z.mjs.map +0 -1
  614. package/dist/esm/chunk-5B3SMBXQ.mjs +0 -2
  615. package/dist/esm/chunk-5B3SMBXQ.mjs.map +0 -1
  616. package/dist/esm/chunk-5LGKGWLX.mjs.map +0 -1
  617. package/dist/esm/chunk-5PVZ4N42.mjs.map +0 -1
  618. package/dist/esm/chunk-6Q2O5G3J.mjs.map +0 -1
  619. package/dist/esm/chunk-6ZOVTYLJ.mjs.map +0 -1
  620. package/dist/esm/chunk-7N7FEBZA.mjs.map +0 -1
  621. package/dist/esm/chunk-7T26VA2W.mjs.map +0 -1
  622. package/dist/esm/chunk-7V35JAAF.mjs.map +0 -1
  623. package/dist/esm/chunk-ACVIE7IE.mjs.map +0 -1
  624. package/dist/esm/chunk-AJ5JHBAE.mjs.map +0 -1
  625. package/dist/esm/chunk-AKIO3OIT.mjs.map +0 -1
  626. package/dist/esm/chunk-ALNQK276.mjs.map +0 -1
  627. package/dist/esm/chunk-AOROYJ74.mjs.map +0 -1
  628. package/dist/esm/chunk-BAEIZAP7.mjs.map +0 -1
  629. package/dist/esm/chunk-BRV3RLKW.mjs.map +0 -1
  630. package/dist/esm/chunk-BUAHUVAD.mjs.map +0 -1
  631. package/dist/esm/chunk-C2HCRGQU.mjs +0 -2
  632. package/dist/esm/chunk-C2HCRGQU.mjs.map +0 -1
  633. package/dist/esm/chunk-CDEYH77E.mjs +0 -2
  634. package/dist/esm/chunk-CDEYH77E.mjs.map +0 -1
  635. package/dist/esm/chunk-CX6KECGV.mjs.map +0 -1
  636. package/dist/esm/chunk-D3OEQLUE.mjs +0 -2
  637. package/dist/esm/chunk-D3OEQLUE.mjs.map +0 -1
  638. package/dist/esm/chunk-DBTKJMLV.mjs.map +0 -1
  639. package/dist/esm/chunk-DC2IESER.mjs +0 -2
  640. package/dist/esm/chunk-DC2IESER.mjs.map +0 -1
  641. package/dist/esm/chunk-EGV3HFE3.mjs.map +0 -1
  642. package/dist/esm/chunk-ELXJ5A4B.mjs +0 -2
  643. package/dist/esm/chunk-ELXJ5A4B.mjs.map +0 -1
  644. package/dist/esm/chunk-F2WY2DEY.mjs.map +0 -1
  645. package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
  646. package/dist/esm/chunk-FZDEGDUY.mjs.map +0 -1
  647. package/dist/esm/chunk-G4KAHJXB.mjs.map +0 -1
  648. package/dist/esm/chunk-GAEAYY44.mjs +0 -1
  649. package/dist/esm/chunk-GMKKHGXK.mjs.map +0 -1
  650. package/dist/esm/chunk-GVNK3UMT.mjs.map +0 -1
  651. package/dist/esm/chunk-H3C3VTHS.mjs.map +0 -1
  652. package/dist/esm/chunk-HBIDHQ2M.mjs.map +0 -1
  653. package/dist/esm/chunk-HMMNQFVM.mjs.map +0 -1
  654. package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
  655. package/dist/esm/chunk-IBZKCBN5.mjs.map +0 -1
  656. package/dist/esm/chunk-ICMELYCL.mjs +0 -2
  657. package/dist/esm/chunk-ICMELYCL.mjs.map +0 -1
  658. package/dist/esm/chunk-IHGA5KAD.mjs.map +0 -1
  659. package/dist/esm/chunk-IK2NYNKG.mjs.map +0 -1
  660. package/dist/esm/chunk-J3E4UMBB.mjs +0 -2
  661. package/dist/esm/chunk-J3E4UMBB.mjs.map +0 -1
  662. package/dist/esm/chunk-J7PJSK3J.mjs.map +0 -1
  663. package/dist/esm/chunk-JMPHD4BP.mjs.map +0 -1
  664. package/dist/esm/chunk-JNO7KPMG.mjs.map +0 -1
  665. package/dist/esm/chunk-KCWRCWNT.mjs.map +0 -1
  666. package/dist/esm/chunk-L4SWQLAJ.mjs.map +0 -1
  667. package/dist/esm/chunk-LA5HJILW.mjs.map +0 -1
  668. package/dist/esm/chunk-LGTOOAQI.mjs.map +0 -1
  669. package/dist/esm/chunk-LKKI2KAP.mjs.map +0 -1
  670. package/dist/esm/chunk-LPVGVTWT.mjs.map +0 -1
  671. package/dist/esm/chunk-MHN6XY4Z.mjs +0 -2
  672. package/dist/esm/chunk-MHN6XY4Z.mjs.map +0 -1
  673. package/dist/esm/chunk-N62NUAHT.mjs.map +0 -1
  674. package/dist/esm/chunk-NK67FECB.mjs.map +0 -1
  675. package/dist/esm/chunk-OIOGOW6I.mjs.map +0 -1
  676. package/dist/esm/chunk-OPO5EYF7.mjs.map +0 -1
  677. package/dist/esm/chunk-P6KX7AS2.mjs +0 -2
  678. package/dist/esm/chunk-P6KX7AS2.mjs.map +0 -1
  679. package/dist/esm/chunk-PMGK5IHB.mjs.map +0 -1
  680. package/dist/esm/chunk-PXMNAP2Q.mjs.map +0 -1
  681. package/dist/esm/chunk-QI7OREBM.mjs.map +0 -1
  682. package/dist/esm/chunk-RCA73RVB.mjs.map +0 -1
  683. package/dist/esm/chunk-S5SQJRAV.mjs.map +0 -1
  684. package/dist/esm/chunk-SK3LIS4Z.mjs.map +0 -1
  685. package/dist/esm/chunk-SNYYEVJA.mjs.map +0 -1
  686. package/dist/esm/chunk-SPRNSFUV.mjs.map +0 -1
  687. package/dist/esm/chunk-T6ADNZE5.mjs.map +0 -1
  688. package/dist/esm/chunk-TCXYTPUR.mjs +0 -2
  689. package/dist/esm/chunk-TCXYTPUR.mjs.map +0 -1
  690. package/dist/esm/chunk-U3T4ZT7B.mjs.map +0 -1
  691. package/dist/esm/chunk-U6OCK6T4.mjs.map +0 -1
  692. package/dist/esm/chunk-UFPYCROT.mjs.map +0 -1
  693. package/dist/esm/chunk-UGIHQFID.mjs.map +0 -1
  694. package/dist/esm/chunk-UGTIALNW.mjs +0 -2
  695. package/dist/esm/chunk-V4FKFCBL.mjs.map +0 -1
  696. package/dist/esm/chunk-V5NDNR36.mjs +0 -2
  697. package/dist/esm/chunk-V5NDNR36.mjs.map +0 -1
  698. package/dist/esm/chunk-VIZHWYI5.mjs.map +0 -1
  699. package/dist/esm/chunk-VQZMI3EZ.mjs.map +0 -1
  700. package/dist/esm/chunk-VWGB5BHW.mjs.map +0 -1
  701. package/dist/esm/chunk-WFK3XRQX.mjs.map +0 -1
  702. package/dist/esm/chunk-XOLU6UP3.mjs.map +0 -1
  703. package/dist/esm/chunk-XZN344G4.mjs.map +0 -1
  704. package/dist/esm/chunk-YD2BMHH7.mjs +0 -2
  705. package/dist/esm/chunk-YEWZAR76.mjs.map +0 -1
  706. package/dist/esm/chunk-YJVZFYBX.mjs.map +0 -1
  707. package/dist/esm/chunk-ZMBXHMVQ.mjs.map +0 -1
  708. package/dist/esm/chunk-ZMMLM6ZJ.mjs.map +0 -1
  709. package/dist/esm/chunk-ZMS3AOEZ.mjs.map +0 -1
  710. package/dist/esm/chunk-ZXVN3HXB.mjs.map +0 -1
  711. /package/dist/esm/{chunk-FD6FGKYY.mjs.map → account/AccountUtils.mjs.map} +0 -0
  712. /package/dist/esm/{chunk-GAEAYY44.mjs.map → account/utils.mjs.map} +0 -0
  713. /package/dist/esm/{chunk-I5OYNCZS.mjs.map → chunk-GP4TLDVZ.mjs.map} +0 -0
  714. /package/dist/esm/{chunk-NZ7M6NG2.mjs.map → chunk-KFCLSJC3.mjs.map} +0 -0
  715. /package/dist/esm/{chunk-F45G3GP3.mjs.map → chunk-QHEKBHNU.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/authenticator/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Serializer, Deserializer, Serializable } from \"../../bcs\";\nimport { AnyPublicKey, AnySignature } from \"../../core/crypto\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"../../core/crypto/ed25519\";\nimport { MultiEd25519PublicKey, MultiEd25519Signature } from \"../../core/crypto/multiEd25519\";\nimport { MultiKey, MultiKeySignature } from \"../../core/crypto/multiKey\";\nimport { AccountAuthenticatorVariant } from \"../../types\";\n\n/**\n * Represents an account authenticator that can handle multiple authentication variants.\n * This class serves as a base for different types of account authenticators, allowing for serialization\n * and deserialization of various authenticator types.\n *\n * @extends Serializable\n * @group Implementation\n * @category Transactions\n */\nexport abstract class AccountAuthenticator extends Serializable {\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserializes an AccountAuthenticator from the provided deserializer.\n * This function helps in reconstructing the AccountAuthenticator object based on the variant index.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Transactions\n */\n static deserialize(deserializer: Deserializer): AccountAuthenticator {\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case AccountAuthenticatorVariant.Ed25519:\n return AccountAuthenticatorEd25519.load(deserializer);\n case AccountAuthenticatorVariant.MultiEd25519:\n return AccountAuthenticatorMultiEd25519.load(deserializer);\n case AccountAuthenticatorVariant.SingleKey:\n return AccountAuthenticatorSingleKey.load(deserializer);\n case AccountAuthenticatorVariant.MultiKey:\n return AccountAuthenticatorMultiKey.load(deserializer);\n case AccountAuthenticatorVariant.NoAccountAuthenticator:\n return AccountAuthenticatorNoAccountAuthenticator.load(deserializer);\n default:\n throw new Error(`Unknown variant index for AccountAuthenticator: ${index}`);\n }\n }\n\n /**\n * Determines if the current instance is an Ed25519 account authenticator.\n *\n * @returns {boolean} True if the instance is of type AccountAuthenticatorEd25519, otherwise false.\n * @group Implementation\n * @category Transactions\n */\n isEd25519(): this is AccountAuthenticatorEd25519 {\n return this instanceof AccountAuthenticatorEd25519;\n }\n\n /**\n * Determines if the current instance is of type AccountAuthenticatorMultiEd25519.\n *\n * @returns {boolean} True if the instance is a multi-signature Ed25519 account authenticator, otherwise false.\n * @group Implementation\n * @category Transactions\n */\n isMultiEd25519(): this is AccountAuthenticatorMultiEd25519 {\n return this instanceof AccountAuthenticatorMultiEd25519;\n }\n\n /**\n * Determines if the current instance is of the type AccountAuthenticatorSingleKey.\n *\n * @returns {boolean} True if the instance is an AccountAuthenticatorSingleKey, otherwise false.\n * @group Implementation\n * @category Transactions\n */\n isSingleKey(): this is AccountAuthenticatorSingleKey {\n return this instanceof AccountAuthenticatorSingleKey;\n }\n\n /**\n * Determine if the current instance is of type AccountAuthenticatorMultiKey.\n *\n * @returns {boolean} Returns true if the instance is an AccountAuthenticatorMultiKey, otherwise false.\n * @group Implementation\n * @category Transactions\n */\n isMultiKey(): this is AccountAuthenticatorMultiKey {\n return this instanceof AccountAuthenticatorMultiKey;\n }\n}\n\n/**\n * Represents an Ed25519 transaction authenticator for multi-signer transactions.\n * This class encapsulates the account's Ed25519 public key and signature.\n *\n * @param public_key - The Ed25519 public key associated with the account.\n * @param signature - The Ed25519 signature for the account.\n * @group Implementation\n * @category Transactions\n */\nexport class AccountAuthenticatorEd25519 extends AccountAuthenticator {\n public readonly public_key: Ed25519PublicKey;\n\n public readonly signature: Ed25519Signature;\n\n /**\n * Creates an instance of the class with the specified public keys and signatures.\n *\n * @param public_key The public key used for verification.\n * @param signature The signatures corresponding to the public keys.\n * @group Implementation\n * @category Transactions\n */\n constructor(public_key: Ed25519PublicKey, signature: Ed25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n /**\n * Serializes the account authenticator data into the provided serializer.\n * This function captures the multi-key variant, public keys, and signatures for serialization.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Transactions\n */\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.Ed25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n /**\n * Loads an instance of AccountAuthenticatorMultiKey from the provided deserializer.\n * This function helps in reconstructing the authenticator object using the deserialized public keys and signatures.\n *\n * @param deserializer - The deserializer used to extract the necessary data for loading the authenticator.\n * @group Implementation\n * @category Transactions\n */\n static load(deserializer: Deserializer): AccountAuthenticatorEd25519 {\n const public_key = Ed25519PublicKey.deserialize(deserializer);\n const signature = Ed25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents a transaction authenticator for Multi Ed25519, designed for multi-signer transactions.\n *\n * @param public_key - The MultiEd25519 public key of the account.\n * @param signature - The MultiEd25519 signature of the account.\n * @group Implementation\n * @category Transactions\n */\nexport class AccountAuthenticatorMultiEd25519 extends AccountAuthenticator {\n public readonly public_key: MultiEd25519PublicKey;\n\n public readonly signature: MultiEd25519Signature;\n\n constructor(public_key: MultiEd25519PublicKey, signature: MultiEd25519Signature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiEd25519);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiEd25519 {\n const public_key = MultiEd25519PublicKey.deserialize(deserializer);\n const signature = MultiEd25519Signature.deserialize(deserializer);\n return new AccountAuthenticatorMultiEd25519(public_key, signature);\n }\n}\n\n/**\n * Represents an account authenticator that utilizes a single key for signing.\n * This class is designed to handle authentication using a public key and its corresponding signature.\n *\n * @param public_key - The public key used for authentication.\n * @param signature - The signature associated with the public key.\n * @group Implementation\n * @category Transactions\n */\nexport class AccountAuthenticatorSingleKey extends AccountAuthenticator {\n public readonly public_key: AnyPublicKey;\n\n public readonly signature: AnySignature;\n\n constructor(public_key: AnyPublicKey, signature: AnySignature) {\n super();\n this.public_key = public_key;\n this.signature = signature;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.SingleKey);\n this.public_key.serialize(serializer);\n this.signature.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorSingleKey {\n const public_key = AnyPublicKey.deserialize(deserializer);\n const signature = AnySignature.deserialize(deserializer);\n return new AccountAuthenticatorSingleKey(public_key, signature);\n }\n}\n\n/**\n * Represents an account authenticator that supports multiple keys and signatures for multi-signature scenarios.\n *\n * @param public_keys - The public keys used for authentication.\n * @param signatures - The signatures corresponding to the public keys.\n * @group Implementation\n * @category Transactions\n */\nexport class AccountAuthenticatorMultiKey extends AccountAuthenticator {\n public readonly public_keys: MultiKey;\n\n public readonly signatures: MultiKeySignature;\n\n constructor(public_keys: MultiKey, signatures: MultiKeySignature) {\n super();\n this.public_keys = public_keys;\n this.signatures = signatures;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.MultiKey);\n this.public_keys.serialize(serializer);\n this.signatures.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): AccountAuthenticatorMultiKey {\n const public_keys = MultiKey.deserialize(deserializer);\n const signatures = MultiKeySignature.deserialize(deserializer);\n return new AccountAuthenticatorMultiKey(public_keys, signatures);\n }\n}\n\n/**\n * AccountAuthenticatorNoAccountAuthenticator for no account authenticator\n * It represents the absence of a public key for transaction simulation.\n * It allows skipping the public/auth key check during the simulation.\n */\nexport class AccountAuthenticatorNoAccountAuthenticator extends AccountAuthenticator {\n // eslint-disable-next-line class-methods-use-this\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(AccountAuthenticatorVariant.NoAccountAuthenticator);\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static load(deserializer: Deserializer): AccountAuthenticatorNoAccountAuthenticator {\n return new AccountAuthenticatorNoAccountAuthenticator();\n }\n}\n"],"mappings":"yOAqBO,IAAeA,EAAf,cAA4CC,CAAa,CAW9D,OAAO,YAAYC,EAAkD,CACnE,IAAMC,EAAQD,EAAa,wBAAwB,EACnD,OAAQC,EAAO,CACb,OACE,OAAOC,EAA4B,KAAKF,CAAY,EACtD,OACE,OAAOG,EAAiC,KAAKH,CAAY,EAC3D,OACE,OAAOI,EAA8B,KAAKJ,CAAY,EACxD,OACE,OAAOK,EAA6B,KAAKL,CAAY,EACvD,OACE,OAAOM,EAA2C,KAAKN,CAAY,EACrE,QACE,MAAM,IAAI,MAAM,mDAAmDC,CAAK,EAAE,CAC9E,CACF,CASA,WAAiD,CAC/C,OAAO,gBAAgBC,CACzB,CASA,gBAA2D,CACzD,OAAO,gBAAgBC,CACzB,CASA,aAAqD,CACnD,OAAO,gBAAgBC,CACzB,CASA,YAAmD,CACjD,OAAO,gBAAgBC,CACzB,CACF,EAWaH,EAAN,MAAMK,UAAoCT,CAAqB,CAapE,YAAYU,EAA8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C,CACpB,CAEA,UAAUX,EAA8B,CACtCA,EAAW,uBAA0D,EACrE,KAAK,YAAY,UAAUA,CAAU,EACrC,KAAK,WAAW,UAAUA,CAAU,CACtC,CAEA,OAAO,KAAKV,EAA0D,CACpE,IAAMoB,EAAcE,EAAS,YAAYtB,CAAY,EAC/CqB,EAAaE,EAAkB,YAAYvB,CAAY,EAC7D,OAAO,IAAImB,EAA6BC,EAAaC,CAAU,CACjE,CACF,EAOaf,EAAN,MAAMkB,UAAmD1B,CAAqB,CAEnF,UAAUY,EAA8B,CACtCA,EAAW,uBAAwE,CACrF,CAGA,OAAO,KAAKV,EAAwE,CAClF,OAAO,IAAIwB,CACb,CACF","names":["AccountAuthenticator","Serializable","deserializer","index","AccountAuthenticatorEd25519","AccountAuthenticatorMultiEd25519","AccountAuthenticatorSingleKey","AccountAuthenticatorMultiKey","AccountAuthenticatorNoAccountAuthenticator","_AccountAuthenticatorEd25519","public_key","signature","serializer","Ed25519PublicKey","Ed25519Signature","_AccountAuthenticatorMultiEd25519","MultiEd25519PublicKey","MultiEd25519Signature","_AccountAuthenticatorSingleKey","AnyPublicKey","AnySignature","_AccountAuthenticatorMultiKey","public_keys","signatures","MultiKey","MultiKeySignature","_AccountAuthenticatorNoAccountAuthenticator"]}
@@ -1,2 +1,2 @@
1
- import{i as s}from"./chunk-PXMNAP2Q.mjs";import{b as c}from"./chunk-MHN6XY4Z.mjs";import{a as d}from"./chunk-AKIO3OIT.mjs";import{b as i}from"./chunk-JNO7KPMG.mjs";import{b as n}from"./chunk-AJ5JHBAE.mjs";var u=class r extends c{constructor(e,t){super(),this.jwkAddress=i.from(e),this.keylessPublicKey=t}authKey(){let e=new n;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),d.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=i.deserialize(e),l=s.deserialize(e);return new r(t,l)}static isPublicKey(e){return e instanceof r}static create(e){return new r(e.jwkAddress,s.create(e))}static fromJwtAndPepper(e){return new r(e.jwkAddress,s.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof i&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof s}};export{u as a};
2
- //# sourceMappingURL=chunk-U3T4ZT7B.mjs.map
1
+ import{i as s}from"./chunk-KG23XFU2.mjs";import{b as c}from"./chunk-EMURYYVO.mjs";import{a as d}from"./chunk-FN4C3CKC.mjs";import{b as i}from"./chunk-Q4C4U6I4.mjs";import{b as n}from"./chunk-EBMEXURY.mjs";var u=class r extends c{constructor(e,t){super(),this.jwkAddress=i.from(e),this.keylessPublicKey=t}authKey(){let e=new n;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),d.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=i.deserialize(e),l=s.deserialize(e);return new r(t,l)}static isPublicKey(e){return e instanceof r}static create(e){return new r(e.jwkAddress,s.create(e))}static fromJwtAndPepper(e){return new r(e.jwkAddress,s.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof i&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof s}};export{u as a};
2
+ //# sourceMappingURL=chunk-NW2WUKWV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/federatedKeyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountPublicKey, PublicKey } from \"./publicKey\";\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { HexInput, AnyPublicKeyVariant, SigningScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountAddress, AccountAddressInput } from \"../accountAddress\";\nimport { KeylessPublicKey, KeylessSignature } from \"./keyless\";\n\n/**\n * Represents the FederatedKeylessPublicKey public key\n *\n * These keys use an on-chain address as a source of truth for the JWK used to verify signatures.\n *\n * FederatedKeylessPublicKey authentication key is represented in the SDK as `AnyPublicKey`.\n * @group Implementation\n * @category Serialization\n */\nexport class FederatedKeylessPublicKey extends AccountPublicKey {\n /**\n * The address that contains the JWK set to be used for verification.\n * @group Implementation\n * @category Serialization\n */\n readonly jwkAddress: AccountAddress;\n\n /**\n * The inner public key which contains the standard Keyless public key.\n * @group Implementation\n * @category Serialization\n */\n readonly keylessPublicKey: KeylessPublicKey;\n\n constructor(jwkAddress: AccountAddressInput, keylessPublicKey: KeylessPublicKey) {\n super();\n this.jwkAddress = AccountAddress.from(jwkAddress);\n this.keylessPublicKey = keylessPublicKey;\n }\n\n /**\n * Get the authentication key for the federated keyless public key\n *\n * @returns AuthenticationKey\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.FederatedKeyless);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: SigningScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n\n /**\n * Verifies a signed data with a public key\n *\n * @param args.message message\n * @param args.signature The signature\n * @returns true if the signature is valid\n * @group Implementation\n * @category Serialization\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this\n verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {\n throw new Error(\"Not yet implemented\");\n }\n\n serialize(serializer: Serializer): void {\n this.jwkAddress.serialize(serializer);\n this.keylessPublicKey.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): FederatedKeylessPublicKey {\n const jwkAddress = AccountAddress.deserialize(deserializer);\n const keylessPublicKey = KeylessPublicKey.deserialize(deserializer);\n return new FederatedKeylessPublicKey(jwkAddress, keylessPublicKey);\n }\n\n static isPublicKey(publicKey: PublicKey): publicKey is FederatedKeylessPublicKey {\n return publicKey instanceof FederatedKeylessPublicKey;\n }\n\n /**\n * Creates a FederatedKeylessPublicKey from the JWT components plus pepper\n *\n * @param args.iss the iss of the identity\n * @param args.uidKey the key to use to get the uidVal in the JWT token\n * @param args.uidVal the value of the uidKey in the JWT token\n * @param args.aud the client ID of the application\n * @param args.pepper The pepper used to maintain privacy of the account\n * @returns FederatedKeylessPublicKey\n * @group Implementation\n * @category Serialization\n */\n static create(args: {\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n jwkAddress: AccountAddressInput;\n }): FederatedKeylessPublicKey {\n return new FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.create(args));\n }\n\n static fromJwtAndPepper(args: {\n jwt: string;\n pepper: HexInput;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n }): FederatedKeylessPublicKey {\n return new FederatedKeylessPublicKey(args.jwkAddress, KeylessPublicKey.fromJwtAndPepper(args));\n }\n\n static isInstance(publicKey: PublicKey) {\n return (\n \"jwkAddress\" in publicKey &&\n publicKey.jwkAddress instanceof AccountAddress &&\n \"keylessPublicKey\" in publicKey &&\n publicKey.keylessPublicKey instanceof KeylessPublicKey\n );\n }\n}\n"],"mappings":"6MAmBO,IAAMA,EAAN,MAAMC,UAAkCC,CAAiB,CAe9D,YAAYC,EAAiCC,EAAoC,CAC/E,MAAM,EACN,KAAK,WAAaC,EAAe,KAAKF,CAAU,EAChD,KAAK,iBAAmBC,CAC1B,CASA,SAA6B,CAC3B,IAAME,EAAa,IAAIC,EACvB,OAAAD,EAAW,uBAA0D,EACrEA,EAAW,oBAAoB,KAAK,WAAW,CAAC,EACzCE,EAAkB,mBAAmB,CAC1C,SACA,MAAOF,EAAW,aAAa,CACjC,CAAC,CACH,CAYA,gBAAgBG,EAAmE,CACjF,MAAM,IAAI,MAAM,qBAAqB,CACvC,CAEA,UAAUH,EAA8B,CACtC,KAAK,WAAW,UAAUA,CAAU,EACpC,KAAK,iBAAiB,UAAUA,CAAU,CAC5C,CAEA,OAAO,YAAYI,EAAuD,CACxE,IAAMP,EAAaE,EAAe,YAAYK,CAAY,EACpDN,EAAmBO,EAAiB,YAAYD,CAAY,EAClE,OAAO,IAAIT,EAA0BE,EAAYC,CAAgB,CACnE,CAEA,OAAO,YAAYQ,EAA8D,CAC/E,OAAOA,aAAqBX,CAC9B,CAcA,OAAO,OAAOQ,EAOgB,CAC5B,OAAO,IAAIR,EAA0BQ,EAAK,WAAYE,EAAiB,OAAOF,CAAI,CAAC,CACrF,CAEA,OAAO,iBAAiBA,EAKM,CAC5B,OAAO,IAAIR,EAA0BQ,EAAK,WAAYE,EAAiB,iBAAiBF,CAAI,CAAC,CAC/F,CAEA,OAAO,WAAWG,EAAsB,CACtC,MACE,eAAgBA,GAChBA,EAAU,sBAAsBP,GAChC,qBAAsBO,GACtBA,EAAU,4BAA4BD,CAE1C,CACF","names":["FederatedKeylessPublicKey","_FederatedKeylessPublicKey","AccountPublicKey","jwkAddress","keylessPublicKey","AccountAddress","serializer","Serializer","AuthenticationKey","args","deserializer","KeylessPublicKey","publicKey"]}
@@ -1,2 +1,2 @@
1
- import{b as h,d as l}from"./chunk-H3C3VTHS.mjs";import{b as E}from"./chunk-MHN6XY4Z.mjs";import{a as p}from"./chunk-4O5XDQDO.mjs";import{a as g}from"./chunk-AKIO3OIT.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
2
- //# sourceMappingURL=chunk-XZN344G4.mjs.map
1
+ import{b as h,d as l}from"./chunk-XGF7UNEW.mjs";import{b as E}from"./chunk-EMURYYVO.mjs";import{a as p}from"./chunk-WCMW2L3P.mjs";import{a as g}from"./chunk-FN4C3CKC.mjs";var o=class o extends E{constructor(r){super();let{publicKeys:e,threshold:t}=r;if(e.length>o.MAX_KEYS||e.length<o.MIN_KEYS)throw new Error(`Must have between ${o.MIN_KEYS} and ${o.MAX_KEYS} public keys, inclusive`);if(t<o.MIN_THRESHOLD||t>e.length)throw new Error(`Threshold must be between ${o.MIN_THRESHOLD} and ${e.length}, inclusive`);this.publicKeys=e,this.threshold=t}verifySignature(r){let{message:e,signature:t}=r;if(!(t instanceof y))return!1;let s=[];for(let i=0;i<4;i+=1)for(let n=0;n<8;n+=1)if((t.bitmap[i]&1<<7-n)!==0){let u=i*8+n;s.push(u)}if(s.length!==t.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(s.length<this.threshold)throw new Error("Not enough signatures");for(let i=0;i<s.length;i+=1)if(!this.publicKeys[s[i]].verifySignature({message:e,signature:t.signatures[i]}))return!1;return!0}authKey(){return g.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let r=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((e,t)=>{r.set(e.toUint8Array(),t*h.LENGTH)}),r[this.publicKeys.length*h.LENGTH]=this.threshold,r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e[e.length-1],s=[];for(let i=0;i<e.length-1;i+=h.LENGTH){let n=i;s.push(new h(e.subarray(n,n+h.LENGTH)))}return new o({publicKeys:s,threshold:t})}};o.MAX_KEYS=32,o.MIN_KEYS=2,o.MIN_THRESHOLD=1;var d=o,a=class a extends p{constructor(r){super();let{signatures:e,bitmap:t}=r;if(e.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=e,!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}}toUint8Array(){let r=new Uint8Array(this.signatures.length*l.LENGTH+a.BITMAP_LEN);return this.signatures.forEach((e,t)=>{r.set(e.toUint8Array(),t*l.LENGTH)}),r.set(this.bitmap,this.signatures.length*l.LENGTH),r}serialize(r){r.serializeBytes(this.toUint8Array())}static deserialize(r){let e=r.deserializeBytes(),t=e.subarray(e.length-4),s=[];for(let i=0;i<e.length-t.length;i+=l.LENGTH){let n=i;s.push(new l(e.subarray(n,n+l.LENGTH)))}return new a({signatures:s,bitmap:t})}static createBitmap(r){let{bits:e}=r,t=128,s=new Uint8Array([0,0,0,0]),i=new Set;return e.forEach((n,c)=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(n))throw new Error("Duplicate bits detected.");if(c>0&&n<=e[c-1])throw new Error("The bits need to be sorted in ascending order.");i.add(n);let u=Math.floor(n/8),b=s[u];b|=t>>n%8,s[u]=b}),s}};a.MAX_SIGNATURES_SUPPORTED=32,a.BITMAP_LEN=4;var y=a;export{d as a,y as b};
2
+ //# sourceMappingURL=chunk-ODEDSSQL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { AccountPublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n *\n * A K-of-N multi-sig transaction requires at least K out of N authorized signers to sign the transaction\n * for it to be executed. This class encapsulates the logic for managing the public keys and the threshold\n * for valid signatures.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @group Implementation\n * @category Serialization\n */\nexport class MultiEd25519PublicKey extends AccountPublicKey {\n /**\n * Maximum number of public keys supported\n * @group Implementation\n * @category Serialization\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n * @group Implementation\n * @category Serialization\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n * @group Implementation\n * @category Serialization\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this LegacyMultiEd25519PublicKey\n * @group Implementation\n * @category Serialization\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n * @group Implementation\n * @category Serialization\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n * @param args - A wrapper to let you choose the param order.\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n super();\n const { publicKeys, threshold } = args;\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ` +\n `${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n // region AccountPublicKey\n\n /**\n * Verifies a multi-signature against a given message.\n * This function ensures that the provided signatures meet the required threshold and are valid for the given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The multi-signature containing multiple signatures and a bitmap indicating which signatures are valid.\n * @returns True if the signature is valid; otherwise, false.\n * @throws Error if the bitmap and signatures length mismatch or if there are not enough valid signatures.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof MultiEd25519Signature)) {\n return false;\n }\n\n const indices: number[] = [];\n for (let i = 0; i < 4; i += 1) {\n for (let j = 0; j < 8; j += 1) {\n // eslint-disable-next-line no-bitwise\n const bitIsSet = (signature.bitmap[i] & (1 << (7 - j))) !== 0;\n if (bitIsSet) {\n const index = i * 8 + j;\n indices.push(index);\n }\n }\n }\n\n if (indices.length !== signature.signatures.length) {\n throw new Error(\"Bitmap and signatures length mismatch\");\n }\n\n if (indices.length < this.threshold) {\n throw new Error(\"Not enough signatures\");\n }\n\n for (let i = 0; i < indices.length; i += 1) {\n const publicKey = this.publicKeys[indices[i]];\n if (!publicKey.verifySignature({ message, signature: signature.signatures[i] })) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Generates an authentication key based on the current instance's byte representation.\n * This function is essential for creating a secure authentication key that can be used for various 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.MultiEd25519,\n input: this.toUint8Array(),\n });\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n // endregion\n\n // region Serializable\n\n /**\n * Serializes the current instance into bytes using the provided serializer.\n * This allows for the conversion of the instance's data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer used to convert the instance into bytes.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a MultiEd25519Signature from the provided deserializer.\n * This function helps in reconstructing a MultiEd25519Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n\n // endregion\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n *\n * @see {@link https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n * @group Implementation\n * @category Serialization\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n * @group Implementation\n * @category Serialization\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n * @group Implementation\n * @category Serialization\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * The list of underlying Ed25519 signatures\n * @group Implementation\n * @category Serialization\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n * @group Implementation\n * @category Serialization\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right.\n * Alternatively, you can specify an array of bitmap positions.\n * Valid position should range between 0 and 31.\n * @see MultiEd25519Signature.createBitmap\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { signatures: Ed25519Signature[]; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n this.signatures = signatures;\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiEd25519Signature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n }\n\n // region AccountSignature\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\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): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH)));\n }\n return new MultiEd25519Signature({ signatures, bitmap });\n }\n\n // endregion\n\n /**\n * Helper method to create a bitmap out of the specified bit positions.\n * This function allows you to set specific bits in a 32-bit long bitmap based on the provided positions.\n *\n * @param args The arguments for creating the bitmap.\n * @param args.bits The bitmap positions that should be set. A position starts at index 0. Valid positions should range between 0 and 31.\n *\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32 bits long.\n * @group Implementation\n * @category Serialization\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, index) => {\n if (bit >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n if (index > 0 && bit <= bits[index - 1]) {\n throw new Error(\"The bits need to be sorted in ascending order.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n}\n"],"mappings":"2KAqBO,IAAMA,EAAN,MAAMA,UAA8BC,CAAiB,CAiD1D,YAAYC,EAA6D,CACvE,MAAM,EACN,GAAM,CAAE,WAAAC,EAAY,UAAAC,CAAU,EAAIF,EAGlC,GAAIC,EAAW,OAASH,EAAsB,UAAYG,EAAW,OAASH,EAAsB,SAClG,MAAM,IAAI,MACR,qBAAqBA,EAAsB,QAAQ,QAC9CA,EAAsB,QAAQ,yBACrC,EAIF,GAAII,EAAYJ,EAAsB,eAAiBI,EAAYD,EAAW,OAC5E,MAAM,IAAI,MACR,6BAA6BH,EAAsB,aAAa,QAAQG,EAAW,MAAM,aAC3F,EAGF,KAAK,WAAaA,EAClB,KAAK,UAAYC,CACnB,CAgBA,gBAAgBF,EAAoC,CAClD,GAAM,CAAE,QAAAG,EAAS,UAAAC,CAAU,EAAIJ,EAC/B,GAAI,EAAEI,aAAqBC,GACzB,MAAO,GAGT,IAAMC,EAAoB,CAAC,EAC3B,QAAS,EAAI,EAAG,EAAI,EAAG,GAAK,EAC1B,QAASC,EAAI,EAAGA,EAAI,EAAGA,GAAK,EAG1B,IADkBH,EAAU,OAAO,CAAC,EAAK,GAAM,EAAIG,KAAS,EAC9C,CACZ,IAAMC,EAAQ,EAAI,EAAID,EACtBD,EAAQ,KAAKE,CAAK,CACpB,CAIJ,GAAIF,EAAQ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EAGXyB,EAAiB,IACjBH,EAAS,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,CAAC,CAAC,EAGpCI,EAAc,IAAI,IAExB,OAAAF,EAAK,QAAQ,CAACG,EAAanB,IAAU,CACnC,GAAImB,GAAOR,EAAsB,yBAC/B,MAAM,IAAI,MAAM,uCAAuCA,EAAsB,yBAA2B,CAAC,GAAG,EAG9G,GAAIO,EAAY,IAAIC,CAAG,EACrB,MAAM,IAAI,MAAM,0BAA0B,EAG5C,GAAInB,EAAQ,GAAKmB,GAAOH,EAAKhB,EAAQ,CAAC,EACpC,MAAM,IAAI,MAAM,gDAAgD,EAGlEkB,EAAY,IAAIC,CAAG,EAEnB,IAAMC,EAAa,KAAK,MAAMD,EAAM,CAAC,EAEjCE,EAAOP,EAAOM,CAAU,EAG5BC,GAAQJ,GAAkBE,EAAM,EAEhCL,EAAOM,CAAU,EAAIC,CACvB,CAAC,EAEMP,CACT,CACF,EAnKaH,EAMJ,yBAA2B,GANvBA,EAaJ,WAAqB,EAbvB,IAAMd,EAANc","names":["_MultiEd25519PublicKey","AccountPublicKey","args","publicKeys","threshold","message","signature","MultiEd25519Signature","indices","j","index","AuthenticationKey","bytes","Ed25519PublicKey","k","i","serializer","deserializer","keys","begin","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte"]}
@@ -1,2 +1,2 @@
1
- import{a as s,c as d,e as t}from"./chunk-AJ5JHBAE.mjs";import{a as l,b as n,c as o,d as z,e as c,f as u}from"./chunk-56CNRT2K.mjs";var U=class i extends s{constructor(e){super(),d(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new a(e.deserializeU256())}static deserialize(e){return new i(e.deserializeBool())}},p=class i extends s{constructor(e){super(),t(e,0,l),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new i(e.deserializeU8())}},b=class i extends s{constructor(e){super(),t(e,0,n),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new i(e.deserializeU16())}},y=class i extends s{constructor(e){super(),t(e,0,o),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new i(e.deserializeU32())}},m=class i extends s{constructor(e){super(),t(e,BigInt(0),z),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new i(e.deserializeU64())}},B=class i extends s{constructor(e){super(),t(e,BigInt(0),c),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new i(e.deserializeU128())}},a=class i extends s{constructor(e){super(),t(e,BigInt(0),u),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new i(e.deserializeU256())}};export{U as a,p as b,b as c,y as d,m as e,B as f,a as g};
2
- //# sourceMappingURL=chunk-42H7WETG.mjs.map
1
+ import{a as s,c as d,e as t}from"./chunk-EBMEXURY.mjs";import{a as l,b as n,c as o,d as z,e as c,f as u}from"./chunk-56CNRT2K.mjs";var U=class i extends s{constructor(e){super(),d(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new a(e.deserializeU256())}static deserialize(e){return new i(e.deserializeBool())}},p=class i extends s{constructor(e){super(),t(e,0,l),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new i(e.deserializeU8())}},b=class i extends s{constructor(e){super(),t(e,0,n),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new i(e.deserializeU16())}},y=class i extends s{constructor(e){super(),t(e,0,o),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new i(e.deserializeU32())}},m=class i extends s{constructor(e){super(),t(e,BigInt(0),z),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new i(e.deserializeU64())}},B=class i extends s{constructor(e){super(),t(e,BigInt(0),c),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new i(e.deserializeU128())}},a=class i extends s{constructor(e){super(),t(e,BigInt(0),u),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new i(e.deserializeU256())}};export{U as a,p as b,b as c,y as d,m as e,B as f,a as g};
2
+ //# sourceMappingURL=chunk-ORMOQWWH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bcs/serializable/movePrimitives.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n MAX_U128_BIG_INT,\n MAX_U16_NUMBER,\n MAX_U32_NUMBER,\n MAX_U64_BIG_INT,\n MAX_U8_NUMBER,\n MAX_U256_BIG_INT,\n} from \"../consts\";\nimport { Deserializer } from \"../deserializer\";\nimport { Serializable, Serializer, ensureBoolean, validateNumberInRange } from \"../serializer\";\nimport { TransactionArgument } from \"../../transactions/instances/transactionArgument\";\nimport { AnyNumber, Uint16, Uint32, Uint8, ScriptTransactionArgumentVariants } from \"../../types\";\n\n/**\n * Represents a boolean value that can be serialized and deserialized.\n * This class extends the Serializable class and provides methods to serialize\n * the boolean value for different contexts, such as entry functions and script functions.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class Bool extends Serializable implements TransactionArgument {\n public readonly value: boolean;\n\n /**\n * Constructs a new instance with a specified value.\n * This ensures that the value is validated to be within the acceptable range.\n *\n * @param value - The number to be validated and assigned, which must be between 0 and MAX_U256_BIG_INT.\n * @group Implementation\n * @category BCS\n */\n constructor(value: boolean) {\n super();\n\n /**\n * Ensures that the provided value is of type boolean.\n * This function throws an error if the value is not a boolean, helping to enforce type safety in your code.\n *\n * @param value - The value to be checked for boolean type.\n * @throws {Error} Throws an error if the value is not a boolean.\n * @group Implementation\n * @category BCS\n */\n ensureBoolean(value);\n this.value = value;\n }\n\n /**\n * Serializes the value using the provided serializer.\n * This function is essential for converting the value 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 BCS\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBool(this.value);\n }\n\n /**\n * Serializes the current instance for use in an entry function by converting it to a byte sequence.\n * This allows the instance to be properly formatted for serialization in transactions.\n *\n * @param serializer - The serializer instance used to serialize the byte sequence.\n * @group Implementation\n * @category BCS\n */\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Serializes the current instance for use in a script function.\n * This allows for the conversion of the instance into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer used to perform the serialization.\n * @group Implementation\n * @category BCS\n */\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Bool);\n serializer.serialize(this);\n }\n\n /**\n * Deserializes a U256 value from the provided deserializer.\n *\n * @param deserializer - The deserializer instance used to read the U256 data.\n * @group Implementation\n * @category BCS\n */\n // eslint-disable-next-line class-methods-use-this\n deserialize(deserializer: Deserializer) {\n return new U256(deserializer.deserializeU256());\n }\n\n static deserialize(deserializer: Deserializer): Bool {\n return new Bool(deserializer.deserializeBool());\n }\n}\n\n/**\n * Represents an unsigned 8-bit integer (U8) value.\n * This class extends the Serializable class and provides methods for serialization and deserialization of U8 values.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U8 extends Serializable implements TransactionArgument {\n public readonly value: Uint8;\n\n constructor(value: Uint8) {\n super();\n validateNumberInRange(value, 0, MAX_U8_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU8(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U8 {\n return new U8(deserializer.deserializeU8());\n }\n}\n\n/**\n * Represents a 16-bit unsigned integer (U16) value.\n * This class extends the Serializable class and provides methods for serialization\n * and deserialization of the U16 value.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U16 extends Serializable implements TransactionArgument {\n public readonly value: Uint16;\n\n constructor(value: Uint16) {\n super();\n validateNumberInRange(value, 0, MAX_U16_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU16(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U16);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U16 {\n return new U16(deserializer.deserializeU16());\n }\n}\n\n/**\n * Represents a 32-bit unsigned integer (U32) that can be serialized and deserialized.\n * This class ensures that the value is within the valid range for a U32.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U32 extends Serializable implements TransactionArgument {\n public readonly value: Uint32;\n\n constructor(value: Uint32) {\n super();\n validateNumberInRange(value, 0, MAX_U32_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U32);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U32 {\n return new U32(deserializer.deserializeU32());\n }\n}\n\n/**\n * Represents a 64-bit unsigned integer (U64) and provides methods for serialization.\n *\n * This class ensures that the value is within the valid range for a U64 and provides\n * functionality to serialize the value for various use cases, including entry functions\n * and script functions.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U64 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, BigInt(0), MAX_U64_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU64(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U64);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U64 {\n return new U64(deserializer.deserializeU64());\n }\n}\n\n/**\n * Represents a 128-bit unsigned integer value.\n * This class provides methods for serialization and deserialization\n * of U128 values, ensuring that the values are within the valid range.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U128 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, BigInt(0), MAX_U128_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU128(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U128);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U128 {\n return new U128(deserializer.deserializeU128());\n }\n}\n\n/**\n * Represents a 256-bit unsigned integer (U256) that extends the Serializable class.\n * This class provides methods for serialization and deserialization of U256 values,\n * ensuring that the values are within the valid range.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U256 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, BigInt(0), MAX_U256_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU256(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U256);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U256 {\n return new U256(deserializer.deserializeU256());\n }\n}\n"],"mappings":"mIAyBO,IAAMA,EAAN,MAAMC,UAAaC,CAA4C,CAWpE,YAAYC,EAAgB,CAC1B,MAAM,EAWNC,EAAcD,CAAK,EACnB,KAAK,MAAQA,CACf,CAUA,UAAUE,EAA8B,CACtCA,EAAW,cAAc,KAAK,KAAK,CACrC,CAUA,0BAA0BA,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAUA,2BAA2BD,EAA8B,CACvDA,EAAW,uBAA4D,EACvEA,EAAW,UAAU,IAAI,CAC3B,CAUA,YAAYE,EAA4B,CACtC,OAAO,IAAIC,EAAKD,EAAa,gBAAgB,CAAC,CAChD,CAEA,OAAO,YAAYA,EAAkC,CACnD,OAAO,IAAIN,EAAKM,EAAa,gBAAgB,CAAC,CAChD,CACF,EAUaE,EAAN,MAAMC,UAAWR,CAA4C,CAGlE,YAAYC,EAAc,CACxB,MAAM,EACNQ,EAAsBR,EAAO,EAAGS,CAAa,EAC7C,KAAK,MAAQT,CACf,CAEA,UAAUE,EAA8B,CACtCA,EAAW,YAAY,KAAK,KAAK,CACnC,CAEA,0BAA0BA,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAEA,2BAA2BD,EAA8B,CACvDA,EAAW,uBAA0D,EACrEA,EAAW,UAAU,IAAI,CAC3B,CAEA,OAAO,YAAYE,EAAgC,CACjD,OAAO,IAAIG,EAAGH,EAAa,cAAc,CAAC,CAC5C,CACF,EAWaM,EAAN,MAAMC,UAAYZ,CAA4C,CAGnE,YAAYC,EAAe,CACzB,MAAM,EACNQ,EAAsBR,EAAO,E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AC9C,CACF,EAWae,EAAN,MAAMC,UAAarB,CAA4C,CAGpE,YAAYC,EAAkB,CAC5B,MAAM,EACNQ,EAAsBR,EAAO,OAAO,CAAC,EAAGqB,CAAgB,EACxD,KAAK,MAAQ,OAAOrB,CAAK,CAC3B,CAEA,UAAUE,EAA8B,CACtCA,EAAW,cAAc,KAAK,KAAK,CACrC,CAEA,0BAA0BA,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAEA,2BAA2BD,EAA8B,CACvDA,EAAW,uBAA4D,EACvEA,EAAW,UAAU,IAAI,CAC3B,CAEA,OAAO,YAAYE,EAAkC,CACnD,OAAO,IAAIgB,EAAKhB,EAAa,gBAAgB,CAAC,CAChD,CACF,EAWaC,EAAN,MAAMiB,UAAavB,CAA4C,CAGpE,YAAYC,EAAkB,CAC5B,MAAM,EACNQ,EAAsBR,EAAO,OAAO,CAAC,EAAGuB,CAAgB,EACxD,KAAK,MAAQ,OAAOvB,CAAK,CAC3B,CAEA,UAAUE,EAA8B,CACtCA,EAAW,cAAc,KAAK,KAAK,CACrC,CAEA,0BAA0BA,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAEA,2BAA2BD,EAA8B,CACvDA,EAAW,uBAA4D,EACvEA,EAAW,UAAU,IAAI,CAC3B,CAEA,OAAO,YAAYE,EAAkC,CACnD,OAAO,IAAIkB,EAAKlB,EAAa,gBAAgB,CAAC,CAChD,CACF","names":["Bool","_Bool","Serializable","value","ensureBoolean","serializer","bcsBytes","deserializer","U256","U8","_U8","validateNumberInRange","MAX_U8_NUMBER","U16","_U16","MAX_U16_NUMBER","U32","_U32","MAX_U32_NUMBER","U64","_U64","MAX_U64_BIG_INT","U128","_U128","MAX_U128_BIG_INT","_U256","MAX_U256_BIG_INT"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-4OV2A6PJ.mjs";import{a as e,c as n}from"./chunk-V4FKFCBL.mjs";var r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
2
- //# sourceMappingURL=chunk-4MTSP4S2.mjs.map
1
+ import{a as s}from"./chunk-P54RNN4V.mjs";import{a as e,c as n}from"./chunk-DAFSKSZ5.mjs";var r=class{constructor(t,i,o,a,c){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=i,this.maxWaitTime=o,this.maximumInFlight=a,this.sleepTime=c}async nextSequenceNumber(){for(;this.lock;)await e(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let i=n();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await e(this.sleepTime),n()-i>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(i){console.error("error in getting next sequence number for this account",i)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await s({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await e(this.sleepTime);this.lock=!0;try{await this.update();let t=n();for(;this.lastUncommintedNumber!==this.currentNumber;)n()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await e(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};export{r as a};
2
+ //# sourceMappingURL=chunk-P4VF7BN4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/management/accountSequenceNumber.ts"],"sourcesContent":["/**\n * A wrapper that handles and manages an account sequence number.\n *\n * Submit up to `maximumInFlight` transactions per account in parallel with a timeout of `sleepTime`\n * If local assumes `maximumInFlight` are in flight, determine the actual committed state from the network\n * If there are less than `maximumInFlight` due to some being committed, adjust the window\n * If `maximumInFlight` are in flight, wait `sleepTime` seconds before re-evaluating\n * If ever waiting more than `maxWaitTime` restart the sequence number to the current on-chain state\n *\n * Assumptions:\n * Accounts are expected to be managed by a single AccountSequenceNumber and not used otherwise.\n * They are initialized to the current on-chain state, so if there are already transactions in\n * flight, they may take some time to reset.\n * Accounts are automatically initialized if not explicitly\n *\n * Notes:\n * This is co-routine safe, that is many async tasks can be reading from this concurrently.\n * The state of an account cannot be used across multiple AccountSequenceNumber services.\n * The synchronize method will create a barrier that prevents additional nextSequenceNumber\n * calls until it is complete.\n * This only manages the distribution of sequence numbers it does not help handle transaction\n * failures.\n * If a transaction fails, you should call synchronize and wait for timeouts.\n * @group Implementation\n * @category Transactions\n */\n\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport { Account } from \"../../account\";\nimport { getInfo } from \"../../internal/account\";\nimport { nowInSeconds, sleep } from \"../../utils/helpers\";\n\n/**\n * Represents an account's sequence number management for transaction handling on the Aptos blockchain.\n * This class provides methods to retrieve the next available sequence number, synchronize with the on-chain sequence number,\n * and manage local sequence numbers while ensuring thread safety.\n *\n * @param aptosConfig - The configuration settings for Aptos.\n * @param account - The account associated with the sequence number.\n * @param maxWaitTime - The maximum time to wait for a transaction to commit.\n * @param maximumInFlight - The maximum number of transactions that can be in flight at once.\n * @param sleepTime - The time to wait before retrying to get the sequence number.\n * @group Implementation\n * @category Transactions\n */\nexport class AccountSequenceNumber {\n readonly aptosConfig: AptosConfig;\n\n readonly account: Account;\n\n // sequence number on chain\n // TODO: Change to Uncommitted\n lastUncommintedNumber: bigint | null = null;\n\n // local sequence number\n currentNumber: bigint | null = null;\n\n /**\n * We want to guarantee that we preserve ordering of workers to requests.\n *\n * `lock` is used to try to prevent multiple coroutines from accessing a shared resource at the same time,\n * which can result in race conditions and data inconsistency.\n * This code actually doesn't do it though, since we aren't giving out a slot, it is still somewhat a race condition.\n *\n * The ideal solution is likely that each thread grabs the next number from an incremental integer.\n * When they complete, they increment that number and that entity is able to enter the `lock`.\n * That would guarantee ordering.\n * @group Implementation\n * @category Transactions\n */\n lock = false;\n\n maxWaitTime: number;\n\n maximumInFlight: number;\n\n sleepTime: number;\n\n /**\n * Creates an instance of the class with the specified configuration and account details.\n * This constructor initializes the necessary parameters for managing Aptos transactions.\n *\n * @param aptosConfig - The configuration settings for Aptos.\n * @param account - The account associated with the Aptos transactions.\n * @param maxWaitTime - The maximum time to wait for a transaction to be processed, in milliseconds.\n * @param maximumInFlight - The maximum number of transactions that can be in flight at the same time.\n * @param sleepTime - The time to sleep between transaction checks, in milliseconds.\n * @group Implementation\n * @category Transactions\n */\n constructor(\n aptosConfig: AptosConfig,\n account: Account,\n maxWaitTime: number,\n maximumInFlight: number,\n sleepTime: number,\n ) {\n this.aptosConfig = aptosConfig;\n this.account = account;\n this.maxWaitTime = maxWaitTime;\n this.maximumInFlight = maximumInFlight;\n this.sleepTime = sleepTime;\n }\n\n /**\n * Returns the next available sequence number for this account.\n * This function ensures that the sequence number is updated and synchronized, handling potential delays in transaction commits.\n *\n * @returns {BigInt} The next available sequence number.\n * @group Implementation\n * @category Transactions\n */\n async nextSequenceNumber(): Promise<bigint | null> {\n /* eslint-disable no-await-in-loop */\n while (this.lock) {\n await sleep(this.sleepTime);\n }\n\n this.lock = true;\n let nextNumber = BigInt(0);\n try {\n if (this.lastUncommintedNumber === null || this.currentNumber === null) {\n await this.initialize();\n }\n\n if (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await this.update();\n\n const startTime = nowInSeconds();\n while (this.currentNumber! - this.lastUncommintedNumber! >= this.maximumInFlight) {\n await sleep(this.sleepTime);\n if (nowInSeconds() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`,\n );\n await this.initialize();\n } else {\n await this.update();\n }\n }\n }\n nextNumber = this.currentNumber!;\n this.currentNumber! += BigInt(1);\n } catch (e) {\n console.error(\"error in getting next sequence number for this account\", e);\n } finally {\n this.lock = false;\n }\n return nextNumber;\n }\n\n /**\n * Initializes this account with the sequence number on chain.\n *\n * @returns {Promise<void>} A promise that resolves when the account has been initialized.\n *\n * @throws {Error} Throws an error if the account information cannot be retrieved.\n * @group Implementation\n * @category Transactions\n */\n async initialize(): Promise<void> {\n const { sequence_number: sequenceNumber } = await getInfo({\n aptosConfig: this.aptosConfig,\n accountAddress: this.account.accountAddress,\n });\n this.currentNumber = BigInt(sequenceNumber);\n this.lastUncommintedNumber = BigInt(sequenceNumber);\n }\n\n /**\n * Updates this account's sequence number with the one on-chain.\n *\n * @returns The on-chain sequence number for this account.\n * @group Implementation\n * @category Transactions\n */\n async update(): Promise<bigint> {\n const { sequence_number: sequenceNumber } = await getInfo({\n aptosConfig: this.aptosConfig,\n accountAddress: this.account.accountAddress,\n });\n this.lastUncommintedNumber = BigInt(sequenceNumber);\n return this.lastUncommintedNumber;\n }\n\n /**\n * Synchronizes the local sequence number with the sequence number on-chain for the specified account.\n * This function polls the network until all submitted transactions have either been committed or until the maximum wait time has elapsed.\n *\n * @throws {Error} Throws an error if there is an issue synchronizing the account sequence number with the one on-chain.\n * @group Implementation\n * @category Transactions\n */\n async synchronize(): Promise<void> {\n if (this.lastUncommintedNumber === this.currentNumber) return;\n\n /* eslint-disable no-await-in-loop */\n while (this.lock) {\n await sleep(this.sleepTime);\n }\n\n this.lock = true;\n\n try {\n await this.update();\n const startTime = nowInSeconds();\n while (this.lastUncommintedNumber !== this.currentNumber) {\n if (nowInSeconds() - startTime > this.maxWaitTime) {\n /* eslint-disable no-console */\n console.warn(\n `Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`,\n );\n await this.initialize();\n } else {\n await sleep(this.sleepTime);\n await this.update();\n }\n }\n } catch (e) {\n console.error(\"error in synchronizing this account sequence number with the one on chain\", e);\n } finally {\n this.lock = false;\n }\n }\n}\n"],"mappings":"yFA6CO,IAAMA,EAAN,KAA4B,CA6CjC,YACEC,EACAC,EACAC,EACAC,EACAC,EACA,CA5CF,2BAAuC,KAGvC,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AAI,KAAK,wBAA0B,KAAK,cAGxC,MAAO,KAAK,MACV,MAAML,EAAM,KAAK,SAAS,EAG5B,KAAK,KAAO,GAEZ,GAAI,CACF,MAAM,KAAK,OAAO,EAClB,IAAME,EAAYC,EAAa,EAC/B,KAAO,KAAK,wBAA0B,KAAK,eACrCA,EAAa,EAAID,EAAY,KAAK,aAEpC,QAAQ,KACN,kEAAkE,KAAK,QAAQ,eAAe,SAAS,CAAC,EAC1G,EACA,MAAM,KAAK,WAAW,IAEtB,MAAMF,EAAM,KAAK,SAAS,EAC1B,MAAM,KAAK,OAAO,EAGxB,OAASI,EAAG,CACV,QAAQ,MAAM,4EAA6EA,CAAC,CAC9F,QAAE,CACA,KAAK,KAAO,EACd,EACF,CACF","names":["AccountSequenceNumber","aptosConfig","account","maxWaitTime","maximumInFlight","sleepTime","sleep","nextNumber","startTime","nowInSeconds","e","sequenceNumber","getInfo"]}
@@ -0,0 +1,2 @@
1
+ import{a as Q}from"./chunk-UQ7D5CSM.mjs";import{c as d}from"./chunk-A3NEASNH.mjs";import{d as v,e as q,f as O,g as P,i as S,j as M,k as G,u as K}from"./chunk-VHNX2NUR.mjs";import{a as p}from"./chunk-7HLNV3QL.mjs";import{a as b}from"./chunk-BI3BTSUB.mjs";import{a as k}from"./chunk-4ZJJINCW.mjs";import{b as _}from"./chunk-G5ZWH5T3.mjs";import{c as C}from"./chunk-XGF7UNEW.mjs";import{a as g}from"./chunk-FN4C3CKC.mjs";import{b as i}from"./chunk-Q4C4U6I4.mjs";import{a as T}from"./chunk-YOZBVVKL.mjs";import{b as A,d as w,e as y}from"./chunk-FKJ3GCBI.mjs";import{e as h}from"./chunk-QHEKBHNU.mjs";import{e as l}from"./chunk-RJ7F4JDV.mjs";async function x(e){let{aptosConfig:n,accountAddress:t}=e,{data:o}=await A({aptosConfig:n,originMethod:"getInfo",path:`accounts/${i.from(t).toString()}`});return o}async function oo(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return y({aptosConfig:n,originMethod:"getModules",path:`accounts/${i.from(t).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,offset:o?.offset,limit:o?.limit??1e3}})}async function eo(e){return e.options?.ledgerVersion!==void 0?I(e):T(async()=>I(e),`module-${e.accountAddress}-${e.moduleName}`,1e3*60*5)()}async function I(e){let{aptosConfig:n,accountAddress:t,moduleName:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getModule",path:`accounts/${i.from(t).toString()}/module/${o}`,params:{ledger_version:r?.ledgerVersion}});return s}async function to(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return w({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${i.from(t).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function no(e){let{aptosConfig:n,accountAddress:t,options:o}=e;return y({aptosConfig:n,originMethod:"getResources",path:`accounts/${i.from(t).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,offset:o?.offset,limit:o?.limit??999}})}async function L(e){let{aptosConfig:n,accountAddress:t,resourceType:o,options:r}=e,{data:s}=await A({aptosConfig:n,originMethod:"getResource",path:`accounts/${i.from(t).toString()}/resource/${o}`,params:{ledger_version:r?.ledgerVersion}});return s.data}async function B(e){let{aptosConfig:n,authenticationKey:t,options:o}=e,r=await L({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:s}}=r,c=i.from(t);try{let a=await Q({aptosConfig:n,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:o});return i.from(a)}catch(a){if(a instanceof h&&a.data.error_code==="table_item_not_found")return c;throw a}}async function ro(e){let{aptosConfig:n,accountAddress:t}=e,r={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:M,variables:{where_condition:r}},originMethod:"getAccountTokensCount"});return c.current_token_ownerships_v2_aggregate.aggregate?c.current_token_ownerships_v2_aggregate.aggregate.count:0}async function so(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(s.token_standard={_eq:o?.tokenStandard});let c={query:P,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function co(e){let{aptosConfig:n,accountAddress:t,collectionAddress:o,options:r}=e,s=i.from(t).toStringLong(),c=i.from(o).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard});let u={query:S,variables:{where_condition:a,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function io(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}};o?.tokenStandard&&(s.current_collection={token_standard:{_eq:o?.tokenStandard}});let c={query:O,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ao(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:G,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function uo(e){let{aptosConfig:n,accountAddress:t,coinType:o,faMetadataAddress:r}=e,s=o,c;if(o!==void 0&&r!==void 0)c=i.from(r).toStringLong();else if(o!==void 0&&r===void 0)o===l?c=i.A.toStringLong():c=b(i.A,o).toStringLong();else if(o===void 0&&r!==void 0){let m=i.from(r);c=m.toStringLong(),m===i.A&&(s=l)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=i.from(t).toStringLong(),u={asset_type:{_eq:c}};s!==void 0&&(u={asset_type:{_in:[s,c]}});let f=await D({aptosConfig:n,accountAddress:a,options:{where:u}});return f[0]?f[0].amount:0}async function D(e){let{aptosConfig:n,accountAddress:t,options:o}=e,r=i.from(t).toStringLong(),s={...o?.where,owner_address:{_eq:r}},c={query:q,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function go(e){let{aptosConfig:n,accountAddress:t}=e,o=i.from(t).toStringLong(),s=await d({aptosConfig:n,query:{query:v,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function Ao(e){let{aptosConfig:n,accountAddress:t,options:o}=e,s={owner_address:{_eq:i.from(t).toStringLong()}},c={query:K,variables:{where_condition:s,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function po(e){let{aptosConfig:n,privateKey:t}=e,o=new k(t.publicKey());if(t instanceof _){let s=g.fromPublicKey({publicKey:o}).derivedAddress();return p.fromPrivateKey({privateKey:t,address:s})}if(t instanceof C){let r=g.fromPublicKey({publicKey:o});if(await R({authKey:r,aptosConfig:n})){let u=r.derivedAddress();return p.fromPrivateKey({privateKey:t,address:u,legacy:!1})}let c=g.fromPublicKey({publicKey:o.publicKey});if(await R({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return p.fromPrivateKey({privateKey:t,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function R(e){let{aptosConfig:n,authKey:t}=e,o=await B({aptosConfig:n,authenticationKey:t.derivedAddress()});try{return await x({aptosConfig:n,accountAddress:o}),!0}catch(r){if(r.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{x as a,oo as b,eo as c,to as d,no as e,L as f,B as g,ro as h,so as i,co as j,io as k,ao as l,uo as m,D as n,go as o,Ao as p,po as q,R as r};
2
+ //# sourceMappingURL=chunk-P54RNN4V.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/account.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/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n * @group Implementation\n */\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosFullNode, paginateWithCursor, paginateWithObfuscatedCursor } from \"../client\";\nimport {\n AccountData,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Account } from \"../account\";\nimport { AnyPublicKey, Ed25519PublicKey, PrivateKey } from \"../core/crypto\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetObjectDataQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetObjectData,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n} from \"../types/generated/queries\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey, createObjectAddress } from \"../core\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { getTableItem } from \"./table\";\nimport { APTOS_COIN } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\n\n/**\n * Retrieves account information for a specified account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.accountAddress - The address of the account to retrieve information for.\n * @group Implementation\n */\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n const { aptosConfig, accountAddress } = args;\n const { data } = await getAptosFullNode<{}, AccountData>({\n aptosConfig,\n originMethod: \"getInfo\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}`,\n });\n return data;\n}\n\n/**\n * Retrieves the modules associated with a specified account address.\n *\n * @param args - The arguments for retrieving modules.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.accountAddress - The address of the account whose modules are to be retrieved.\n * @param args.options - Optional parameters for pagination and ledger version.\n * @param args.options.limit - The maximum number of modules to retrieve (default is 1000).\n * @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index.\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithObfuscatedCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n offset: options?.offset,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Queries for a move module given an account address and module name.\n * This function can help you retrieve the module's ABI and other relevant information.\n *\n * @param args - The arguments for retrieving the module.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The account address in hex-encoded 32 byte format.\n * @param args.moduleName - The name of the module to retrieve.\n * @param args.options - Optional parameters for the request.\n * @param args.options.ledgerVersion - Specifies the ledger version of transactions. By default, the latest version will be used.\n * @returns The move module.\n * @group Implementation\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled\n // by the developer directly\n if (args.options?.ledgerVersion !== undefined) {\n return getModuleInner(args);\n }\n\n return memoizeAsync(\n async () => getModuleInner(args),\n `module-${args.accountAddress}-${args.moduleName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\n/**\n * Retrieves the bytecode of a specified module from a given account address.\n *\n * @param args - The parameters for retrieving the module bytecode.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account from which to retrieve the module.\n * @param args.moduleName - The name of the module to retrieve.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nasync function getModuleInner(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n}): Promise<MoveModuleBytecode> {\n const { aptosConfig, accountAddress, moduleName, options } = args;\n\n const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({\n aptosConfig,\n originMethod: \"getModule\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data;\n}\n\n/**\n * Retrieves a list of transactions associated with a specific account address.\n * This function allows you to paginate through the transactions for better performance and usability.\n *\n * @param args - The arguments for retrieving transactions.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The account address for which to retrieve transactions.\n * @param args.options - Optional pagination parameters.\n * @param args.options.offset - The starting point for pagination.\n * @param args.options.limit - The maximum number of transactions to retrieve.\n * @group Implementation\n */\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\n/**\n * Retrieves a list of resources associated with a specific account address.\n *\n * @param args - The arguments for retrieving resources.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account to fetch resources for.\n * @param args.options - Optional pagination and ledger version parameters.\n * @param args.options.offset - The starting point for pagination. Note, this is obfuscated and is not an index.\n * @param args.options.limit - The maximum number of resources to retrieve (default is 999).\n * @param args.options.ledgerVersion - The specific ledger version to query.\n * @group Implementation\n */\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithObfuscatedCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n offset: options?.offset,\n limit: options?.limit ?? 999,\n },\n });\n}\n\n/**\n * Retrieves a specific resource of a given type for the specified account address.\n *\n * @param args - The arguments for retrieving the resource.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account from which to retrieve the resource.\n * @param args.resourceType - The type of the resource to retrieve, specified as a MoveStructId.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @group Implementation\n */\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\n/**\n * Retrieves the original account address associated with a given authentication key, which is useful for handling key rotations.\n *\n * @param args - The arguments for the lookup.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.authenticationKey - The authentication key for which to look up the original address.\n * @param args.options - Optional parameters for specifying the ledger version.\n * @returns The original account address or the provided authentication key address if not found.\n * @throws Throws an error if the lookup fails for reasons other than the address not being found.\n * @group Implementation\n */\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersionArg;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\n/**\n * Retrieves the count of tokens owned by a specific account address.\n *\n * @param args - The arguments for retrieving the account tokens count.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The address of the account for which to count the tokens.\n * @returns The count of tokens owned by the specified account.\n * @group Implementation\n */\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\n/**\n * Retrieves the tokens owned by a specified account address.\n *\n * @param args - The arguments for retrieving the account's tokens.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose tokens are being queried.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - The specific token standard to filter the results.\n * @param args.options.offset - The number of records to skip before starting to collect the result set.\n * @param args.options.limit - The maximum number of records to return.\n * @param args.options.orderBy - The criteria for ordering the results.\n * @returns A promise that resolves to the current token ownerships of the specified account.\n * @group Implementation\n */\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the tokens owned by a specific account from a particular collection address.\n *\n * @param args - The parameters required to fetch the owned tokens.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The address of the account whose tokens are being queried.\n * @param args.collectionAddress - The address of the collection from which tokens are being retrieved.\n * @param args.options - Optional parameters for filtering and pagination, including token standard, pagination arguments, and\n * order by options.\n * @group Implementation\n */\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\n/**\n * Retrieves the collections owned by a specified account along with the tokens in those collections.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose collections are being queried.\n * @param args.options - Optional parameters for filtering and pagination.\n * @param args.options.tokenStandard - An optional token standard to filter the collections.\n * @param args.options.offset - An optional offset for pagination.\n * @param args.options.limit - An optional limit for the number of results returned.\n * @param args.options.orderBy - An optional parameter to specify the order of the results.\n * @group Implementation\n */\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\n/**\n * Retrieves the count of transactions associated with a specified account.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.accountAddress - The address of the account for which to retrieve the transaction count.\n * @returns The number of transactions associated with the specified account.\n * @group Implementation\n */\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\n/**\n * Retrieves the amount of a specific coin held by an account.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The Aptos configuration object.\n * @param args.accountAddress - The address of the account to query.\n * @param args.coinType - Optional; the type of coin to check the amount for.\n * @param args.faMetadataAddress - Optional; the address of the fungible asset metadata.\n * @returns The amount of the specified coin held by the account, or 0 if none is found.\n * @throws Error if neither coinType nor faMetadataAddress is provided.\n * @group Implementation\n */\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType, faMetadataAddress } = args;\n\n let coinAssetType: string | undefined = coinType;\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, fungibleAssetAddress, or both must be provided\");\n }\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n // Search by fungible asset address, unless it has a coin it migrated from\n let where: any = { asset_type: { _eq: faAddress } };\n if (coinAssetType !== undefined) {\n where = { asset_type: { _in: [coinAssetType, faAddress] } };\n }\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where,\n },\n });\n\n // commonjs (aka cjs) doesn't handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\n/**\n * Retrieves the current fungible asset balances for a specified account.\n *\n * @param args - The arguments for retrieving account coins data.\n * @param args.aptosConfig - The configuration for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account for which to retrieve coin data.\n * @param args.options - Optional parameters for pagination and filtering the results.\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.orderBy - The criteria for ordering the results.\n * @param args.options.where - Conditions to filter the results based on the current fungible asset balances.\n * @group Implementation\n */\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\n/**\n * Retrieves the count of fungible asset coins held by a specified account.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for the Aptos network.\n * @param args.accountAddress - The address of the account for which to retrieve the coin count.\n * @throws Error if the count of account coins cannot be retrieved.\n * @group Implementation\n */\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\n/**\n * Retrieves the objects owned by a specified account.\n *\n * @param args - The parameters for the request.\n * @param args.aptosConfig - The configuration for the Aptos client.\n * @param args.accountAddress - The address of the account whose owned objects are to be retrieved.\n * @param args.options - Optional parameters for pagination and ordering of the results.\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.orderBy - The criteria to order the results by.\n * @returns A promise that resolves to the current objects owned by the specified account.\n * @group Implementation\n */\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n}): Promise<GetObjectDataQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetObjectData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetObjectDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * Derives an account from the provided private key and Aptos configuration.\n * This function helps in obtaining the account details associated with a given private key,\n * considering both unified and legacy authentication schemes.\n *\n * NOTE: There is a potential issue once the unified single signer scheme is adopted by the community.\n * Because one could create two accounts with the same private key with this new authenticator type,\n * we’ll need to determine the order in which we look up the accounts: first unified scheme and then legacy scheme,\n * or first legacy scheme and then unified scheme.\n *\n * @param args - The arguments for deriving the account.\n * @param args.aptosConfig - The Aptos configuration used for account lookup.\n * @param args.privateKey - The private key used to derive the account.\n * @throws Error if the account cannot be derived from the private key.\n * @group Implementation\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKey;\n}): Promise<Account> {\n const { aptosConfig, privateKey } = args;\n const publicKey = new AnyPublicKey(privateKey.publicKey());\n\n if (privateKey instanceof Secp256k1PrivateKey) {\n // private key is secp256k1, therefore we know it for sure uses a single signer key\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({\n publicKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKey({\n publicKey: publicKey.publicKey as Ed25519PublicKey,\n });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: true });\n }\n }\n // if we are here, it means we couldn't find an address with an\n // auth key that matches the provided private key\n throw new Error(`Can't derive account from private key ${privateKey}`);\n}\n\n/**\n * Checks if an account exists by verifying its information against the Aptos blockchain.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration for connecting to the Aptos blockchain.\n * @param args.authKey - The authentication key used to derive the account address.\n * @returns A promise that resolves to a boolean indicating whether the account exists.\n *\n * @throws Throws an Error if there is an issue while looking for account information.\n * @group Implementation\n */\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n try {\n await getInfo({\n aptosConfig,\n accountAddress,\n });\n return true;\n } catch (error: any) {\n // account not found\n if (error.status === 404) {\n return false;\n }\n throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);\n }\n}\n"],"mappings":"6nBAoEA,eAAsBA,EAAQC,EAGL,CACvB,GAAM,CAAE,YAAAC,EAAa,eAAAC,CAAe,EAAIF,EAClC,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAkC,CACvD,YAAAH,EACA,aAAc,UACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,EAClE,CAAC,EACD,OAAOC,CACT,CAcA,eAAsBG,GAAWN,EAIC,CAChC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,QAAAK,CAAQ,EAAIP,EACjD,OAAOQ,EAAuD,CAC5D,YAAAP,EACA,aAAc,aACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,WAChE,OAAQ,CACN,eAAgBK,GAAS,cACzB,OAAQA,GAAS,OACjB,MAAOA,GAAS,OAAS,GAC3B,CACF,CAAC,CACH,CAeA,eAAsBE,GAAUT,EAKA,CAG9B,OAAIA,EAAK,SAAS,gBAAkB,OAC3BU,EAAeV,CAAI,EAGrBW,EACL,SAAYD,EAAeV,CAAI,EAC/B,UAAUA,EAAK,cAAc,IAAIA,EAAK,UAAU,GAChD,IAAO,GAAK,CACd,EAAE,CACJ,CAaA,eAAeU,EAAeV,EAKE,CAC9B,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,WAAAU,EAAY,QAAAL,CAAQ,EAAIP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,2CAA2CrE,EAAe,SAAS,CAAC,EAAE,CACxF,CACF","names":["getInfo","args","aptosConfig","accountAddress","data","getAptosFullNode","AccountAddress","getModules","options","paginateWithObfuscatedCursor","getModule","getModuleInner","memoizeAsync","moduleName","getTransactions","paginateWithCursor","getResources","getResource","resourceType","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","getTableItem","err","AptosApiError","getAccountTokensCount","whereCondition","queryIndexer","GetAccountTokensCount","getAccountOwnedTokens","graphqlQuery","GetAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","GetAccountOwnedTokensFromCollection","getAccountCollectionsWithOwnedTokens","GetAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","GetAccountTransactionsCount","getAccountCoinAmount","coinType","faMetadataAddress","coinAssetType","faAddress","APTOS_COIN","createObjectAddress","addr","where","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetObjectData","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
@@ -1,2 +1,2 @@
1
- import{b as h}from"./chunk-333QBK32.mjs";import{a as y}from"./chunk-OPO5EYF7.mjs";import{b as n}from"./chunk-JNO7KPMG.mjs";import{a as _}from"./chunk-AJ5JHBAE.mjs";var t=class i extends _{constructor(e,s,a,r,c,d,l){super(),this.sender=e,this.sequence_number=s,this.payload=a,this.max_gas_amount=r,this.gas_unit_price=c,this.expiration_timestamp_secs=d,this.chain_id=l}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let s=n.deserialize(e),a=e.deserializeU64(),r=h.deserialize(e),c=e.deserializeU64(),d=e.deserializeU64(),l=e.deserializeU64(),m=y.deserialize(e);return new i(s,a,r,c,d,l,m)}},o=class extends _{static deserialize(e){let s=e.deserializeUleb128AsU32();switch(s){case 0:return u.load(e);case 1:return p.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${s}`)}}},u=class i extends o{constructor(e,s){super(),this.raw_txn=e,this.secondary_signer_addresses=s}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n);return new i(s,a)}},p=class i extends o{constructor(e,s,a){super(),this.raw_txn=e,this.secondary_signer_addresses=s,this.fee_payer_address=a}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n),r=n.deserialize(e);return new i(s,a,r)}};export{t as a,o as b,u as c,p as d};
2
- //# sourceMappingURL=chunk-XOLU6UP3.mjs.map
1
+ import{b as h}from"./chunk-67ZANQ3R.mjs";import{a as y}from"./chunk-XKUIMGKU.mjs";import{b as n}from"./chunk-Q4C4U6I4.mjs";import{a as _}from"./chunk-EBMEXURY.mjs";var t=class i extends _{constructor(e,s,a,r,c,d,l){super(),this.sender=e,this.sequence_number=s,this.payload=a,this.max_gas_amount=r,this.gas_unit_price=c,this.expiration_timestamp_secs=d,this.chain_id=l}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let s=n.deserialize(e),a=e.deserializeU64(),r=h.deserialize(e),c=e.deserializeU64(),d=e.deserializeU64(),l=e.deserializeU64(),m=y.deserialize(e);return new i(s,a,r,c,d,l,m)}},o=class extends _{static deserialize(e){let s=e.deserializeUleb128AsU32();switch(s){case 0:return u.load(e);case 1:return p.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${s}`)}}},u=class i extends o{constructor(e,s){super(),this.raw_txn=e,this.secondary_signer_addresses=s}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n);return new i(s,a)}},p=class i extends o{constructor(e,s,a){super(),this.raw_txn=e,this.secondary_signer_addresses=s,this.fee_payer_address=a}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let s=t.deserialize(e),a=e.deserializeVector(n),r=n.deserialize(e);return new i(s,a,r)}};export{t as a,o as b,u as c,p as d};
2
+ //# sourceMappingURL=chunk-PHJRCZQ3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/rawTransaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { ChainId } from \"./chainId\";\nimport { AccountAddress } from \"../../core\";\nimport { TransactionPayload } from \"./transactionPayload\";\nimport { TransactionVariants } from \"../../types\";\n\n/**\n * Represents a raw transaction that can be serialized and deserialized.\n * Raw transactions contain the metadata and payloads that can be submitted to the Aptos chain for execution.\n * They must be signed before the Aptos chain can execute them.\n * @group Implementation\n * @category Transactions\n */\nexport class RawTransaction extends Serializable {\n public readonly sender: AccountAddress;\n\n public readonly sequence_number: bigint;\n\n public readonly payload: TransactionPayload;\n\n public readonly max_gas_amount: bigint;\n\n public readonly gas_unit_price: bigint;\n\n public readonly expiration_timestamp_secs: bigint;\n\n public readonly chain_id: ChainId;\n\n /**\n * RawTransactions contain the metadata and payloads that can be submitted to Aptos chain for execution.\n * RawTransactions must be signed before Aptos chain can execute them.\n *\n * @param sender The sender Account Address\n * @param sequence_number Sequence number of this transaction. This must match the sequence number stored in\n * the sender's account at the time the transaction executes.\n * @param payload Instructions for the Aptos Blockchain, including publishing a module,\n * execute an entry function or execute a script payload.\n * @param max_gas_amount Maximum total gas to spend for this transaction. The account must have more\n * than this gas or the transaction will be discarded during validation.\n * @param gas_unit_price Price to be paid per gas unit.\n * @param expiration_timestamp_secs The blockchain timestamp at which the blockchain would discard this transaction.\n * @param chain_id The chain ID of the blockchain that this transaction is intended to be run on.\n * @group Implementation\n * @category Transactions\n */\n constructor(\n sender: AccountAddress,\n sequence_number: bigint,\n payload: TransactionPayload,\n max_gas_amount: bigint,\n gas_unit_price: bigint,\n expiration_timestamp_secs: bigint,\n chain_id: ChainId,\n ) {\n super();\n this.sender = sender;\n this.sequence_number = sequence_number;\n this.payload = payload;\n this.max_gas_amount = max_gas_amount;\n this.gas_unit_price = gas_unit_price;\n this.expiration_timestamp_secs = expiration_timestamp_secs;\n this.chain_id = chain_id;\n }\n\n /**\n * Serializes the transaction data, including the fee payer transaction type, raw transaction, secondary signer addresses,\n * and fee payer address.\n * This function is essential for preparing the transaction for transmission or storage in a serialized format.\n *\n * @param serializer - The serializer instance used to serialize the transaction data.\n * @group Implementation\n * @category Transactions\n */\n serialize(serializer: Serializer): void {\n this.sender.serialize(serializer);\n serializer.serializeU64(this.sequence_number);\n this.payload.serialize(serializer);\n serializer.serializeU64(this.max_gas_amount);\n serializer.serializeU64(this.gas_unit_price);\n serializer.serializeU64(this.expiration_timestamp_secs);\n this.chain_id.serialize(serializer);\n }\n\n /**\n * Deserialize a Raw Transaction With Data.\n * This function retrieves the appropriate raw transaction based on the variant index provided by the deserializer.\n *\n * @param deserializer - An instance of the Deserializer used to read the serialized data.\n * @group Implementation\n * @category Transactions\n */\n static deserialize(deserializer: Deserializer): RawTransaction {\n const sender = AccountAddress.deserialize(deserializer);\n const sequence_number = deserializer.deserializeU64();\n const payload = TransactionPayload.deserialize(deserializer);\n const max_gas_amount = deserializer.deserializeU64();\n const gas_unit_price = deserializer.deserializeU64();\n const expiration_timestamp_secs = deserializer.deserializeU64();\n const chain_id = ChainId.deserialize(deserializer);\n return new RawTransaction(\n sender,\n sequence_number,\n payload,\n max_gas_amount,\n gas_unit_price,\n expiration_timestamp_secs,\n chain_id,\n );\n }\n}\n\n/**\n * Represents a raw transaction with associated data that can be serialized and deserialized.\n *\n * @extends Serializable\n * @group Implementation\n * @category Transactions\n */\nexport abstract class RawTransactionWithData extends Serializable {\n /**\n * Serialize a Raw Transaction With Data\n * @group Implementation\n * @category Transactions\n */\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Deserialize a Raw Transaction With Data\n * @group Implementation\n * @category Transactions\n */\n static deserialize(deserializer: Deserializer): RawTransactionWithData {\n // index enum variant\n const index = deserializer.deserializeUleb128AsU32();\n switch (index) {\n case TransactionVariants.MultiAgentTransaction:\n return MultiAgentRawTransaction.load(deserializer);\n case TransactionVariants.FeePayerTransaction:\n return FeePayerRawTransaction.load(deserializer);\n default:\n throw new Error(`Unknown variant index for RawTransactionWithData: ${index}`);\n }\n }\n}\n\n/**\n * Represents a multi-agent transaction that can be serialized and deserialized.\n *\n * @extends RawTransactionWithData\n * @group Implementation\n * @category Transactions\n */\nexport class MultiAgentRawTransaction extends RawTransactionWithData {\n /**\n * The raw transaction\n * @group Implementation\n * @category Transactions\n */\n public readonly raw_txn: RawTransaction;\n\n /**\n * The secondary signers on this transaction\n * @group Implementation\n * @category Transactions\n */\n public readonly secondary_signer_addresses: Array<AccountAddress>;\n\n constructor(raw_txn: RawTransaction, secondary_signer_addresses: Array<AccountAddress>) {\n super();\n this.raw_txn = raw_txn;\n this.secondary_signer_addresses = secondary_signer_addresses;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionVariants.MultiAgentTransaction);\n this.raw_txn.serialize(serializer);\n serializer.serializeVector(this.secondary_signer_addresses);\n }\n\n /**\n * Deserializes a Fee Payer Raw Transaction from the provided deserializer.\n * This function allows you to reconstruct a Fee Payer Raw Transaction object, which includes the raw transaction data,\n * secondary signer addresses, and the fee payer address.\n *\n * @param deserializer - The deserializer used to read the raw transaction data.\n * @returns A FeePayerRawTransaction object constructed from the deserialized data.\n * @group Implementation\n * @category Transactions\n */\n static load(deserializer: Deserializer): MultiAgentRawTransaction {\n const rawTxn = RawTransaction.deserialize(deserializer);\n const secondarySignerAddresses = deserializer.deserializeVector(AccountAddress);\n\n return new MultiAgentRawTransaction(rawTxn, secondarySignerAddresses);\n }\n}\n\n/**\n * Represents a Fee Payer Transaction that can be serialized and deserialized.\n * @group Implementation\n * @category Transactions\n */\nexport class FeePayerRawTransaction extends RawTransactionWithData {\n /**\n * The raw transaction\n * @group Implementation\n * @category Transactions\n */\n public readonly raw_txn: RawTransaction;\n\n /**\n * The secondary signers on this transaction - optional and can be empty\n * @group Implementation\n * @category Transactions\n */\n public readonly secondary_signer_addresses: Array<AccountAddress>;\n\n /**\n * The fee payer account address\n * @group Implementation\n * @category Transactions\n */\n public readonly fee_payer_address: AccountAddress;\n\n constructor(\n raw_txn: RawTransaction,\n secondary_signer_addresses: Array<AccountAddress>,\n fee_payer_address: AccountAddress,\n ) {\n super();\n this.raw_txn = raw_txn;\n this.secondary_signer_addresses = secondary_signer_addresses;\n this.fee_payer_address = fee_payer_address;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(TransactionVariants.FeePayerTransaction);\n this.raw_txn.serialize(serializer);\n serializer.serializeVector(this.secondary_signer_addresses);\n this.fee_payer_address.serialize(serializer);\n }\n\n static load(deserializer: Deserializer): FeePayerRawTransaction {\n const rawTxn = RawTransaction.deserialize(deserializer);\n const secondarySignerAddresses = deserializer.deserializeVector(AccountAddress);\n const feePayerAddress = AccountAddress.deserialize(deserializer);\n\n return new FeePayerRawTransaction(rawTxn, secondarySignerAddresses, feePayerAddress);\n }\n}\n"],"mappings":"oKAmBO,IAAMA,EAAN,MAAMC,UAAuBC,CAAa,CAgC/C,YAC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A,EAAW,gBAAgB,KAAK,0BAA0B,CAC5D,CAYA,OAAO,KAAKC,EAAsD,CAChE,IAAMW,EAAStB,EAAe,YAAYW,CAAY,EAChDY,EAA2BZ,EAAa,kBAAkBC,CAAc,EAE9E,OAAO,IAAIO,EAAyBG,EAAQC,CAAwB,CACtE,CACF,EAOaL,EAAN,MAAMM,UAA+BT,CAAuB,CAsBjE,YACEK,EACAC,EACAI,EACA,CACA,MAAM,EACN,KAAK,QAAUL,EACf,KAAK,2BAA6BC,EAClC,KAAK,kBAAoBI,CAC3B,CAEA,UAAUf,EAA8B,CACtCA,EAAW,uBAA6D,EACxE,KAAK,QAAQ,UAAUA,CAAU,EACjCA,EAAW,gBAAgB,KAAK,0BAA0B,EAC1D,KAAK,kBAAkB,UAAUA,CAAU,CAC7C,CAEA,OAAO,KAAKC,EAAoD,CAC9D,IAAMW,EAAStB,EAAe,YAAYW,CAAY,EAChDY,EAA2BZ,EAAa,kBAAkBC,CAAc,EACxEc,EAAkBd,EAAe,YAAYD,CAAY,EAE/D,OAAO,IAAIa,EAAuBF,EAAQC,EAA0BG,CAAe,CACrF,CACF","names":["RawTransaction","_RawTransaction","Serializable","sender","sequence_number","payload","max_gas_amount","gas_unit_price","expiration_timestamp_secs","chain_id","serializer","deserializer","AccountAddress","TransactionPayload","ChainId","RawTransactionWithData","index","MultiAgentRawTransaction","FeePayerRawTransaction","_MultiAgentRawTransaction","raw_txn","secondary_signer_addresses","rawTxn","secondarySignerAddresses","_FeePayerRawTransaction","fee_payer_address","feePayerAddress"]}
@@ -1,2 +1,2 @@
1
- import{g as e}from"./chunk-WFK3XRQX.mjs";import{b as s}from"./chunk-JNO7KPMG.mjs";import{d as c}from"./chunk-LKKI2KAP.mjs";import{d as r}from"./chunk-J7PJSK3J.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||20,{data:d}=await c({aptosConfig:t,path:"fund",body:{address:s.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
2
- //# sourceMappingURL=chunk-VIZHWYI5.mjs.map
1
+ import{g as e}from"./chunk-YPGI5HAA.mjs";import{b as s}from"./chunk-Q4C4U6I4.mjs";import{d as c}from"./chunk-SZRZ3HIL.mjs";import{d as r}from"./chunk-RJ7F4JDV.mjs";async function x(a){let{aptosConfig:t,accountAddress:i,amount:p,options:n}=a,u=n?.timeoutSecs||20,{data:d}=await c({aptosConfig:t,path:"fund",body:{address:s.from(i).toString(),amount:p},originMethod:"fundAccount"}),m=d.txn_hashes[0],o=await e({aptosConfig:t,transactionHash:m,options:{timeoutSecs:u,checkSuccess:n?.checkSuccess}});if(o.type==="user_transaction")return o;throw new Error(`Unexpected transaction received for fund account: ${o.type}`)}export{x as a};
2
+ //# sourceMappingURL=chunk-PNDCGNVH.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/faucet.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/faucet}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n * @group Implementation\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosFaucet } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { TransactionResponseType, UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC } from \"../utils/const\";\nimport { waitForTransaction } from \"./transaction\";\n\n/**\n * Funds an account with a specified amount of tokens from the Aptos faucet.\n * This function is useful for quickly providing a new or existing account with tokens to facilitate transactions.\n *\n * Note that only devnet has a publicly accessible faucet. For testnet, you must use\n * the minting page at https://aptos.dev/network/faucet.\n *\n * @param args - The arguments for funding the account.\n * @param args.aptosConfig - The configuration settings for connecting to the Aptos network.\n * @param args.accountAddress - The address of the account to be funded.\n * @param args.amount - The amount of tokens to fund the account with.\n * @param args.options - Optional parameters for the transaction.\n * @param args.options.timeoutSecs - The maximum time to wait for the transaction to complete, in seconds.\n * @param args.options.checkSuccess - A flag indicating whether to check if the transaction was successful.\n *\n * @throws Error if the transaction does not return a user transaction type.\n * @group Implementation\n */\nexport async function fundAccount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n}): Promise<UserTransactionResponse> {\n const { aptosConfig, accountAddress, amount, options } = args;\n const timeout = options?.timeoutSecs || DEFAULT_TXN_TIMEOUT_SEC;\n const { data } = await postAptosFaucet<any, { txn_hashes: Array<string> }>({\n aptosConfig,\n path: \"fund\",\n body: {\n address: AccountAddress.from(accountAddress).toString(),\n amount,\n },\n originMethod: \"fundAccount\",\n });\n\n const txnHash = data.txn_hashes[0];\n\n const res = await waitForTransaction({\n aptosConfig,\n transactionHash: txnHash,\n options: {\n timeoutSecs: timeout,\n checkSuccess: options?.checkSuccess,\n },\n });\n\n // Response is always User transaction for a user submitted transaction\n if (res.type === TransactionResponseType.User) {\n return res;\n }\n\n throw new Error(`Unexpected transaction received for fund account: ${res.type}`);\n}\n"],"mappings":"oKAoCA,eAAsBA,EAAYC,EAKG,CACnC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,OAAAC,EAAQ,QAAAC,CAAQ,EAAIJ,EACnDK,EAAUD,GAAS,aAAe,GAClC,CAAE,KAAAE,CAAK,EAAI,MAAMC,EAAoD,CACzE,YAAAN,EACA,KAAM,OACN,KAAM,CACJ,QAASO,EAAe,KAAKN,CAAc,EAAE,SAAS,EACtD,OAAAC,CACF,EACA,aAAc,aAChB,CAAC,EAEKM,EAAUH,EAAK,WAAW,CAAC,EAE3BI,EAAM,MAAMC,EAAmB,CACnC,YAAAV,EACA,gBAAiBQ,EACjB,QAAS,CACP,YAAaJ,EACb,aAAcD,GAAS,YACzB,CACF,CAAC,EAGD,GAAIM,EAAI,OAAS,mBACf,OAAOA,EAGT,MAAM,IAAI,MAAM,qDAAqDA,EAAI,IAAI,EAAE,CACjF","names":["fundAccount","args","aptosConfig","accountAddress","amount","options","timeout","data","postAptosFaucet","AccountAddress","txnHash","res","waitForTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-IHGA5KAD.mjs";import{h as a}from"./chunk-SK3LIS4Z.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
- //# sourceMappingURL=chunk-5LGKGWLX.mjs.map
1
+ import{a as i}from"./chunk-W4BSN6SK.mjs";import{h as a}from"./chunk-CYMVZJHC.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
+ //# sourceMappingURL=chunk-PTS3BTOU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/submit.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { submitTransaction } from \"../../internal/transactionSubmission\";\nimport { AccountAuthenticator, AnyRawTransaction } from \"../../transactions\";\nimport { PendingTransactionResponse } from \"../../types\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { ValidateFeePayerDataOnSubmission } from \"./helpers\";\n\n/**\n * A class to handle all `Submit` transaction operations.\n * @group Implementation\n */\nexport class Submit {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows you to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n * @param config.faucetUrl - The URL of the faucet for obtaining test tokens.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // Use the TESTNET for testing\n * nodeUrl: \"https://testnet.aptos.dev\", // Specify the node URL\n * faucetUrl: \"https://faucet.testnet.aptos.dev\" // Specify the faucet URL\n * });\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 Implementation\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Submits a transaction to the Aptos blockchain using the provided transaction details and authenticators.\n * This function allows you to execute transactions securely by specifying the sender and optional fee payer authenticators.\n *\n * @param args - The arguments for submitting the transaction.\n * @param args.transaction - The raw transaction data to be submitted.\n * @param args.senderAuthenticator - The authenticator for the sender's account.\n * @param [args.feePayerAuthenticator] - The optional authenticator for the fee payer's account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Account } 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 sender = Account.generate(); // Generate a new sender account\n * const transaction = await aptos.transaction.build.simple({\n * sender: sender.accountAddress,\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [Account.generate().accountAddress, 100], // Replace with a real destination account\n * },\n * });\n *\n * // Submit the transaction\n * const response = await aptos.simple({\n * transaction,\n * senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator\n * });\n *\n * console.log(\"Transaction submitted:\", response);\n * }\n * runExample().catch(console.error);\n * ```\n * @group Implementation\n */\n @ValidateFeePayerDataOnSubmission\n async simple(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Submits a multi-agent transaction to the Aptos network, allowing multiple signers to authorize the transaction.\n * This function is useful for scenarios where a transaction requires approval from multiple accounts.\n *\n * @param args - The parameters for the multi-agent transaction.\n * @param args.transaction - The raw transaction to be submitted.\n * @param args.senderAuthenticator - The authenticator for the sender account.\n * @param args.additionalSignersAuthenticators - An array of authenticators for additional signers.\n * @param [args.feePayerAuthenticator] - An optional authenticator for the fee payer account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Account } 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 sender = Account.generate(); // Generate a new sender account\n * const additionalSigner1 = Account.generate(); // Generate an additional signer account\n * const additionalSigner2 = Account.generate(); // Generate another additional signer account\n *\n * const transaction = await aptos.transaction.build.simple({\n * sender: sender.accountAddress,\n * data: {\n * function: \"0x1::aptos_account::transfer\",\n * functionArguments: [additionalSigner1.accountAddress, 100],\n * },\n * });\n *\n * const response = await aptos.multiAgent({\n * transaction,\n * senderAuthenticator: sender.getAuthenticator(), // Use the sender's authenticator\n * additionalSignersAuthenticators: [\n * additionalSigner1.getAuthenticator(), // Use the first additional signer's authenticator\n * additionalSigner2.getAuthenticator(), // Use the second additional signer's authenticator\n * ],\n * });\n *\n * console.log(response); // Log the response from the transaction submission\n * }\n * runExample().catch(console.error);\n * ```\n * @group Implementation\n */\n @ValidateFeePayerDataOnSubmission\n async multiAgent(args: {\n transaction: AnyRawTransaction;\n senderAuthenticator: AccountAuthenticator;\n additionalSignersAuthenticators: Array<AccountAuthenticator>;\n feePayerAuthenticator?: AccountAuthenticator;\n }): Promise<PendingTransactionResponse> {\n return submitTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,KAAa,CAiClB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAyCA,MAAM,OAAOC,EAI2B,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CAgDA,MAAM,WAAWA,EAKuB,CACtC,OAAOC,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CAChE,CACF,EA9DQE,EAAA,CADLC,GA3EUL,EA4EL,sBAsDAI,EAAA,CADLC,GAjIUL,EAkIL","names":["Submit","config","args","submitTransaction","__decorateClass","ValidateFeePayerDataOnSubmission"]}
@@ -1,2 +1,2 @@
1
- import{a as c,b as g}from"./chunk-NZ7M6NG2.mjs";import{k as i,l as a}from"./chunk-WFK3XRQX.mjs";import{a as e,b as n,c as s,e as r,f as t}from"./chunk-2KSMV5KD.mjs";var p=class{constructor(o){this.config=o}async getLedgerInfo(){return e({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(o){return i({aptosConfig:this.config,...o})}async getBlockByHeight(o){return a({aptosConfig:this.config,...o})}async view(o){return c({aptosConfig:this.config,...o})}async viewJson(o){return g({aptosConfig:this.config,...o})}async getChainTopUserTransactions(o){return n({aptosConfig:this.config,...o})}async queryIndexer(o){return s({aptosConfig:this.config,...o})}async getIndexerLastSuccessVersion(){return r({aptosConfig:this.config})}async getProcessorStatus(o){return t({aptosConfig:this.config,processorType:o})}};export{p as a};
2
- //# sourceMappingURL=chunk-NK67FECB.mjs.map
1
+ import{a as c,b as g}from"./chunk-KFCLSJC3.mjs";import{k as i,l as a}from"./chunk-YPGI5HAA.mjs";import{a as e,b as n,c as s,e as r,f as t}from"./chunk-A3NEASNH.mjs";var p=class{constructor(o){this.config=o}async getLedgerInfo(){return e({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(o){return i({aptosConfig:this.config,...o})}async getBlockByHeight(o){return a({aptosConfig:this.config,...o})}async view(o){return c({aptosConfig:this.config,...o})}async viewJson(o){return g({aptosConfig:this.config,...o})}async getChainTopUserTransactions(o){return n({aptosConfig:this.config,...o})}async queryIndexer(o){return s({aptosConfig:this.config,...o})}async getIndexerLastSuccessVersion(){return r({aptosConfig:this.config})}async getProcessorStatus(o){return t({aptosConfig:this.config,processorType:o})}};export{p as a};
2
+ //# sourceMappingURL=chunk-PUNTBVRJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/general.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getChainTopUserTransactions,\n getIndexerLastSuccessVersion,\n getLedgerInfo,\n getProcessorStatus,\n queryIndexer,\n} from \"../internal/general\";\nimport { getBlockByHeight, getBlockByVersion } from \"../internal/transaction\";\nimport { view, viewJson } from \"../internal/view\";\nimport {\n AnyNumber,\n Block,\n GetChainTopUserTransactionsResponse,\n GetProcessorStatusResponse,\n GraphqlQuery,\n LedgerInfo,\n LedgerVersionArg,\n MoveValue,\n} from \"../types\";\nimport { ProcessorType } from \"../utils/const\";\nimport { InputViewFunctionData, InputViewFunctionJsonData } from \"../transactions\";\n\n/**\n * A class to query various Aptos-related information and perform operations on the Aptos blockchain.\n * @group General\n */\nexport class General {\n readonly config: AptosConfig;\n\n /**\n * Initializes a new instance of the Aptos client with the specified configuration.\n * This allows users to interact with the Aptos blockchain using the provided settings.\n *\n * @param config - The configuration settings for the Aptos client.\n * @param config.network - The network to connect to (e.g., TESTNET, MAINNET).\n * @param config.nodeUrl - The URL of the Aptos node to connect to.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Create a configuration for the Aptos client\n * const config = new AptosConfig({\n * network: Network.TESTNET, // specify the network\n * nodeUrl: \"https://testnet.aptos.dev\" // specify the node URL\n * });\n *\n * // Initialize the Aptos client 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 General\n */\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Queries for the Aptos ledger information.\n *\n * @returns The Aptos Ledger Info, which includes details such as chain ID, epoch, and ledger version.\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 the ledger information\n * const ledgerInfo = await aptos.getLedgerInfo();\n *\n * console.log(ledgerInfo);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getLedgerInfo(): Promise<LedgerInfo> {\n return getLedgerInfo({ aptosConfig: this.config });\n }\n\n /**\n * Retrieves the chain ID of the Aptos blockchain.\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 the chain ID\n * const chainId = await aptos.getChainId();\n * console.log(\"Chain ID:\", chainId);\n * }\n * runExample().catch(console.error);\n *\n * @returns The chain ID of the Aptos blockchain.\n * ```\n * @group General\n */\n async getChainId(): Promise<number> {\n const result = await this.getLedgerInfo();\n return result.chain_id;\n }\n\n /**\n * Retrieves block information by the specified ledger version.\n *\n * @param args - The arguments for retrieving the block.\n * @param args.ledgerVersion - The ledger version to lookup block information for.\n * @param args.options - Optional parameters for the request.\n * @param args.options.withTransactions - If set to true, include all transactions in the block.\n *\n * @returns Block information with optional transactions.\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 block information for a specific ledger version\n * const block = await aptos.getBlockByVersion({ ledgerVersion: 5 });\n * console.log(block);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getBlockByVersion(args: {\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n }): Promise<Block> {\n return getBlockByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieve a block by its height, allowing for the inclusion of transactions if specified.\n *\n * @param args - The parameters for the block retrieval.\n * @param args.blockHeight - The block height to look up, starting at 0.\n * @param args.options - Optional settings for the retrieval.\n * @param args.options.withTransactions - If set to true, includes all transactions in the block.\n *\n * @returns The block with optional transactions included.\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 the block at height 5, including transactions\n * const block = await aptos.getBlockByHeight({ blockHeight: 5, options: { withTransactions: true } });\n * console.log(block);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getBlockByHeight(args: { blockHeight: AnyNumber; options?: { withTransactions?: boolean } }): Promise<Block> {\n return getBlockByHeight({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example\n * const data = await aptos.view({\n * payload: {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress],\n * }\n * })\n *\n * @returns an array of Move values\n * @group General\n */\n async view<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return view<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a Move view function with JSON, this provides compatability with the old `aptos` package\n * @param args.payload Payload for the view function\n * @param args.options.ledgerVersion The ledger version to query, if not provided it will get the latest version\n *\n * @example\n * const data = await aptos.view({\n * payload: {\n * function: \"0x1::coin::balance\",\n * typeArguments: [\"0x1::aptos_coin::AptosCoin\"],\n * functionArguments: [accountAddress.toString()],\n * }\n * })\n *\n * @returns an array of Move values\n * @group General\n */\n async viewJson<T extends Array<MoveValue>>(args: {\n payload: InputViewFunctionJsonData;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return viewJson<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the top user transactions based on the specified limit.\n *\n * @param args - The arguments for querying top user transactions.\n * @param args.limit - The number of transactions to return.\n * @returns GetChainTopUserTransactionsResponse\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 * // Fetch the top user transactions with a limit of 5\n * const topUserTransactions = await aptos.getChainTopUserTransactions({ limit: 5 });\n *\n * console.log(topUserTransactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getChainTopUserTransactions(args: { limit: number }): Promise<GetChainTopUserTransactionsResponse> {\n return getChainTopUserTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves data from the Aptos Indexer using a GraphQL query.\n * This function allows you to execute complex queries to fetch specific data from the Aptos blockchain.\n *\n * @param args.query.query - A GraphQL query string.\n * @param args.query.variables - The variables for the query (optional).\n *\n * @return The provided T type.\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 * // Querying the Aptos Indexer for ledger information\n * const topUserTransactions = await aptos.queryIndexer({\n * query: `query MyQuery {\n * ledger_infos {\n * chain_id\n * }\n * }`\n * });\n *\n * console.log(topUserTransactions);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async queryIndexer<T extends {}>(args: { query: GraphqlQuery }): Promise<T> {\n return queryIndexer<T>({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for the last successful indexer version, providing insight into the ledger version the indexer is updated to, which\n * may lag behind the full nodes.\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 the last successful indexer version\n * const version = await aptos.getIndexerLastSuccessVersion();\n * console.log(`Last successful indexer version: ${version}`);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getIndexerLastSuccessVersion(): Promise<bigint> {\n return getIndexerLastSuccessVersion({ aptosConfig: this.config });\n }\n\n /**\n * Query the processor status for a specific processor type.\n *\n * @param processorType The processor type to query.\n * @returns The status of the specified processor type.\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 the processor status for the account transactions processor\n * const status = await aptos.getProcessorStatus(\"account_transactions_processor\");\n * console.log(status);\n * }\n * runExample().catch(console.error);\n * ```\n * @group General\n */\n async getProcessorStatus(processorType: ProcessorType): Promise<GetProcessorStatusResponse[0]> {\n return getProcessorStatus({ aptosConfig: this.config, processorType });\n }\n}\n"],"mappings":"qKA8BO,IAAMA,EAAN,KAAc,CA+BnB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAwBA,MAAM,eAAqC,CACzC,OAAOC,EAAc,CAAE,YAAa,KAAK,MAAO,CAAC,CACnD,CAuBA,MAAM,YAA8B,CAElC,OADe,MAAM,KAAK,cAAc,GAC1B,QAChB,CA4BA,MAAM,kBAAkBC,EAGL,CACjB,OAAOC,EAAkB,CACvB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CA4BA,MAAM,iBAAiBA,EAA4F,CACjH,OAAOE,EAAiB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAC/D,CAmBA,MAAM,KAAiCA,EAGxB,CACb,OAAOG,EAAQ,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CACtD,CAmBA,MAAM,SAAqCA,EAG5B,CACb,OAAOI,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC1D,CA0BA,MAAM,4BAA4BA,EAAuE,CACvG,OAAOK,EAA4B,CACjC,YAAa,KAAK,OAClB,GAAGL,CACL,CAAC,CACH,CAkCA,MAAM,aAA2BA,EAA2C,CAC1E,OAAOM,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGN,CACL,CAAC,CACH,CAsBA,MAAM,8BAAgD,CACpD,OAAOO,EAA6B,CAAE,YAAa,KAAK,MAAO,CAAC,CAClE,CAwBA,MAAM,mBAAmBC,EAAsE,CAC7F,OAAOC,EAAmB,CAAE,YAAa,KAAK,OAAQ,cAAAD,CAAc,CAAC,CACvE,CACF","names":["General","config","getLedgerInfo","args","getBlockByVersion","getBlockByHeight","view","viewJson","getChainTopUserTransactions","queryIndexer","getIndexerLastSuccessVersion","processorType","getProcessorStatus"]}
@@ -1,4 +1,4 @@
1
- import{a as d}from"./chunk-NZ7M6NG2.mjs";import{a as y,b as l,c as C,d as T,e as O,f as h,g as L,h as P,i as S,j as V,k as b,l as R,n as w,o as I,p as v,q as k}from"./chunk-4OV2A6PJ.mjs";import{a as o}from"./chunk-33CVOPIN.mjs";import{a as f}from"./chunk-6ZOVTYLJ.mjs";import{b as r}from"./chunk-JNO7KPMG.mjs";import{a as p}from"./chunk-HBIDHQ2M.mjs";import{h as g,i as m}from"./chunk-V4FKFCBL.mjs";import{e as u,f as A}from"./chunk-J7PJSK3J.mjs";var M=class{constructor(e){this.config=e}async getAccountInfo(e){return y({aptosConfig:this.config,...e})}async getAccountModules(e){return l({aptosConfig:this.config,...e})}async getAccountModule(e){return C({aptosConfig:this.config,...e})}async getAccountTransactions(e){return T({aptosConfig:this.config,...e})}async getAccountResources(e){return O({aptosConfig:this.config,...e})}async getAccountResource(e){return h({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return L({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),P({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),S({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),V({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),b({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),R({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),w({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),I({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:u,faMetadataAddress:A,...e})}async getAccountCoinAmount(e){let{accountAddress:a,coinType:s,faMetadataAddress:t,minimumLedgerVersion:N}=e;N&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
1
+ import{a as o}from"./chunk-H3XZ3FZY.mjs";import{a as d}from"./chunk-KFCLSJC3.mjs";import{a as y,b as l,c as C,d as T,e as O,f as h,g as L,h as P,i as S,j as V,k as b,l as R,n as w,o as I,p as v,q as k}from"./chunk-P54RNN4V.mjs";import{a as f}from"./chunk-BI3BTSUB.mjs";import{b as r}from"./chunk-Q4C4U6I4.mjs";import{a as p}from"./chunk-YOZBVVKL.mjs";import{h as g,i as m}from"./chunk-DAFSKSZ5.mjs";import{e as u,f as A}from"./chunk-RJ7F4JDV.mjs";var M=class{constructor(e){this.config=e}async getAccountInfo(e){return y({aptosConfig:this.config,...e})}async getAccountModules(e){return l({aptosConfig:this.config,...e})}async getAccountModule(e){return C({aptosConfig:this.config,...e})}async getAccountTransactions(e){return T({aptosConfig:this.config,...e})}async getAccountResources(e){return O({aptosConfig:this.config,...e})}async getAccountResource(e){return h({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return L({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),P({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),S({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),V({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),b({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),R({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),w({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),I({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:u,faMetadataAddress:A,...e})}async getAccountCoinAmount(e){let{accountAddress:a,coinType:s,faMetadataAddress:t,minimumLedgerVersion:N}=e;N&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
2
2
  compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
3
3
  will be removed in the near future`);let c=s;s===void 0&&t!==void 0&&(c=await p(async()=>{try{let n=(await d({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[t]}})).at(0);if(n.vec.length>0&&m(n.vec[0]))return g(n.vec[0])}catch{}},`coin-mapping-${t.toString()}`,1e3*60*5)());let i;if(s!==void 0&&t!==void 0)i=r.from(t).toStringLong();else if(s!==void 0&&t===void 0)s===u?i=r.A.toStringLong():i=f(r.A,s).toStringLong();else if(s===void 0&&t!==void 0){let n=r.from(t);i=n.toStringLong(),n===r.A&&(c=u)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(c!==void 0){let[n]=await d({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[c],functionArguments:[a]}});return parseInt(n,10)}let[E]=await d({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[a,i]}});return parseInt(E,10)}async getAccountOwnedObjects(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),v({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return k({aptosConfig:this.config,...e})}};export{M as a};
4
- //# sourceMappingURL=chunk-DBTKJMLV.mjs.map
4
+ //# sourceMappingURL=chunk-Q2C6ZY5N.mjs.map