@aptos-labs/ts-sdk 1.30.0 → 1.32.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 (549) hide show
  1. package/README.md +1 -1
  2. package/dist/common/{accountAddress-DnSqjhSl.d.ts → accountAddress-6RqI8Aam.d.ts} +144 -63
  3. package/dist/common/chunk-F43XVDYJ.js +2 -0
  4. package/dist/common/chunk-F43XVDYJ.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +1 -1
  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 +546 -112
  9. package/dist/common/index.js +37 -28
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/{Ed25519Account-DpH9qAcg.d.mts → Ed25519Account-B3xHXAQe.d.mts} +2 -2
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +86 -14
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +5 -4
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +5 -4
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +4 -3
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +57 -8
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +29 -11
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +23 -10
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +5 -4
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +6 -5
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +9 -6
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +4 -3
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +6 -4
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +2 -1
  37. package/dist/esm/api/coin.d.mts +6 -5
  38. package/dist/esm/api/coin.mjs +1 -1
  39. package/dist/esm/api/digitalAsset.d.mts +7 -6
  40. package/dist/esm/api/digitalAsset.mjs +1 -1
  41. package/dist/esm/api/event.d.mts +4 -3
  42. package/dist/esm/api/event.mjs +1 -1
  43. package/dist/esm/api/faucet.d.mts +3 -2
  44. package/dist/esm/api/faucet.mjs +1 -1
  45. package/dist/esm/api/fungibleAsset.d.mts +6 -5
  46. package/dist/esm/api/fungibleAsset.mjs +1 -1
  47. package/dist/esm/api/general.d.mts +6 -5
  48. package/dist/esm/api/general.mjs +1 -1
  49. package/dist/esm/api/index.d.mts +6 -4
  50. package/dist/esm/api/index.mjs +1 -1
  51. package/dist/esm/api/keyless.d.mts +11 -9
  52. package/dist/esm/api/keyless.mjs +1 -1
  53. package/dist/esm/api/object.d.mts +5 -4
  54. package/dist/esm/api/object.mjs +1 -1
  55. package/dist/esm/api/staking.d.mts +5 -4
  56. package/dist/esm/api/staking.mjs +1 -1
  57. package/dist/esm/api/table.d.mts +4 -3
  58. package/dist/esm/api/table.mjs +1 -1
  59. package/dist/esm/api/transaction.d.mts +5 -3
  60. package/dist/esm/api/transaction.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/build.d.mts +69 -3
  62. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/management.d.mts +5 -4
  64. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  65. package/dist/esm/api/transactionSubmission/sign.d.mts +5 -4
  66. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  67. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  68. package/dist/esm/api/transactionSubmission/simulate.d.mts +4 -3
  69. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/submit.d.mts +4 -3
  71. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  72. package/dist/esm/api/utils.d.mts +3 -2
  73. package/dist/esm/api/utils.mjs +1 -1
  74. package/dist/esm/bcs/consts.d.mts +3 -2
  75. package/dist/esm/bcs/deserializer.d.mts +36 -27
  76. package/dist/esm/bcs/deserializer.mjs +1 -1
  77. package/dist/esm/bcs/index.d.mts +3 -2
  78. package/dist/esm/bcs/index.mjs +1 -1
  79. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +3 -2
  80. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  81. package/dist/esm/bcs/serializable/fixedBytes.d.mts +3 -2
  82. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/movePrimitives.d.mts +3 -2
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  85. package/dist/esm/bcs/serializable/moveStructs.d.mts +12 -12
  86. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  87. package/dist/esm/bcs/serializer.d.mts +14 -13
  88. package/dist/esm/bcs/serializer.mjs +1 -1
  89. package/dist/esm/{chunk-OV5UQ75K.mjs → chunk-2NHQQQZK.mjs} +2 -2
  90. package/dist/esm/{chunk-EF2PUPUH.mjs → chunk-2QBCTW67.mjs} +2 -2
  91. package/dist/esm/chunk-2QBCTW67.mjs.map +1 -0
  92. package/dist/esm/{chunk-JY3JJ55D.mjs → chunk-37Y54PJ5.mjs} +2 -2
  93. package/dist/esm/chunk-3DQVGPFE.mjs +2 -0
  94. package/dist/esm/chunk-3DQVGPFE.mjs.map +1 -0
  95. package/dist/esm/{chunk-XHCALZ7X.mjs → chunk-3XCYCFYI.mjs} +2 -2
  96. package/dist/esm/{chunk-6FLHGOKP.mjs → chunk-42H7WETG.mjs} +2 -2
  97. package/dist/esm/{chunk-RNAKZVRN.mjs → chunk-46L6BAJG.mjs} +2 -2
  98. package/dist/esm/{chunk-EN2HDNFE.mjs → chunk-4DNCQM3S.mjs} +2 -2
  99. package/dist/esm/chunk-4O5XDQDO.mjs +2 -0
  100. package/dist/esm/chunk-4PBXTMN3.mjs +2 -0
  101. package/dist/esm/chunk-4PBXTMN3.mjs.map +1 -0
  102. package/dist/esm/chunk-4YEOOZ2N.mjs +4 -0
  103. package/dist/esm/{chunk-KFSVKIFO.mjs.map → chunk-4YEOOZ2N.mjs.map} +1 -1
  104. package/dist/esm/{chunk-D3KBNFZR.mjs → chunk-5AKSORBJ.mjs} +2 -2
  105. package/dist/esm/chunk-5B3SMBXQ.mjs +2 -0
  106. package/dist/esm/{chunk-EKZQ3EYX.mjs → chunk-5NJWJXSS.mjs} +2 -2
  107. package/dist/esm/{chunk-2QRWGJJA.mjs → chunk-6K4TOFCO.mjs} +2 -2
  108. package/dist/esm/{chunk-OLPI7QAH.mjs → chunk-6LLGRGCN.mjs} +2 -2
  109. package/dist/esm/chunk-6LLGRGCN.mjs.map +1 -0
  110. package/dist/esm/{chunk-R3Y6WH2U.mjs → chunk-6PJH53CK.mjs} +2 -2
  111. package/dist/esm/{chunk-PCLU4KLY.mjs → chunk-6ZOVTYLJ.mjs} +2 -2
  112. package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
  113. package/dist/esm/chunk-7WXDXBXK.mjs +2 -0
  114. package/dist/esm/{chunk-UKAXCARD.mjs.map → chunk-7WXDXBXK.mjs.map} +1 -1
  115. package/dist/esm/{chunk-JNHFQTFC.mjs → chunk-AAATWCJT.mjs} +2 -2
  116. package/dist/esm/{chunk-NODYW7DM.mjs → chunk-ACVIE7IE.mjs} +2 -2
  117. package/dist/esm/chunk-AHWZA3GD.mjs +2 -0
  118. package/dist/esm/chunk-AHWZA3GD.mjs.map +1 -0
  119. package/dist/esm/chunk-AITN3DO4.mjs +2 -0
  120. package/dist/esm/chunk-AITN3DO4.mjs.map +1 -0
  121. package/dist/esm/{chunk-QQIVWB6G.mjs → chunk-AJ5JHBAE.mjs} +2 -2
  122. package/dist/esm/{chunk-QQIVWB6G.mjs.map → chunk-AJ5JHBAE.mjs.map} +1 -1
  123. package/dist/esm/{chunk-PRZ7AIGA.mjs → chunk-AKIO3OIT.mjs} +2 -2
  124. package/dist/esm/chunk-AMCJQIOT.mjs +2 -0
  125. package/dist/esm/{chunk-UI3AKMZX.mjs.map → chunk-AMCJQIOT.mjs.map} +1 -1
  126. package/dist/esm/{chunk-KRVLR3L4.mjs → chunk-AOROYJ74.mjs} +2 -2
  127. package/dist/esm/chunk-AVPQOD67.mjs +2 -0
  128. package/dist/esm/chunk-AVPQOD67.mjs.map +1 -0
  129. package/dist/esm/chunk-AVZYJAXR.mjs +2 -0
  130. package/dist/esm/chunk-AVZYJAXR.mjs.map +1 -0
  131. package/dist/esm/{chunk-6AGTDRNM.mjs → chunk-BLLHTGAP.mjs} +2 -2
  132. package/dist/esm/{chunk-JGNMNCQB.mjs → chunk-BRV3RLKW.mjs} +2 -2
  133. package/dist/esm/{chunk-GIQQF2PD.mjs → chunk-CA3Q2X6B.mjs} +2 -2
  134. package/dist/esm/chunk-D52UKPQF.mjs +2 -0
  135. package/dist/esm/chunk-D52UKPQF.mjs.map +1 -0
  136. package/dist/esm/{chunk-FPF4KZ5M.mjs → chunk-DDVOBEJA.mjs} +2 -2
  137. package/dist/esm/chunk-DDVOBEJA.mjs.map +1 -0
  138. package/dist/esm/{chunk-QRTZYRH2.mjs → chunk-DP3YPGIK.mjs} +2 -2
  139. package/dist/esm/{chunk-DXQT55L3.mjs → chunk-DSKAMBBL.mjs} +2 -2
  140. package/dist/esm/{chunk-RAXP3STS.mjs → chunk-E2NYQVP3.mjs} +2 -2
  141. package/dist/esm/chunk-EEB7EZFO.mjs +2 -0
  142. package/dist/esm/chunk-EEB7EZFO.mjs.map +1 -0
  143. package/dist/esm/{chunk-WUCPTRXU.mjs → chunk-F2AIWA7L.mjs} +2 -2
  144. package/dist/esm/chunk-F45G3GP3.mjs +7 -0
  145. package/dist/esm/chunk-F45G3GP3.mjs.map +1 -0
  146. package/dist/esm/{chunk-VQTEGTUQ.mjs → chunk-FXUI3SSD.mjs} +2 -2
  147. package/dist/esm/chunk-G2GN4LH5.mjs +2 -0
  148. package/dist/esm/chunk-G2GN4LH5.mjs.map +1 -0
  149. package/dist/esm/chunk-GBVRCWCD.mjs +2 -0
  150. package/dist/esm/chunk-GBVRCWCD.mjs.map +1 -0
  151. package/dist/esm/chunk-H457BI3I.mjs +2 -0
  152. package/dist/esm/chunk-H457BI3I.mjs.map +1 -0
  153. package/dist/esm/{chunk-5AAFF2PV.mjs → chunk-HEHVWRMO.mjs} +2 -2
  154. package/dist/esm/{chunk-ZUTOMGB7.mjs → chunk-HFWFDS6Y.mjs} +2 -2
  155. package/dist/esm/{chunk-QBWGWHJK.mjs → chunk-HXXELLHN.mjs} +2 -2
  156. package/dist/esm/{chunk-LD5MUWGW.mjs → chunk-IBMZYDAR.mjs} +2 -2
  157. package/dist/esm/{chunk-QBP4XJT5.mjs → chunk-IDNDUJOK.mjs} +2 -2
  158. package/dist/esm/{chunk-HCV3NGLS.mjs → chunk-II654QZU.mjs} +2 -2
  159. package/dist/esm/{chunk-XIY2VORC.mjs → chunk-JDNI5VIJ.mjs} +2 -2
  160. package/dist/esm/{chunk-HAMXSLWF.mjs → chunk-JJUINAQE.mjs} +2 -2
  161. package/dist/esm/{chunk-K6MZXKVV.mjs → chunk-JLD7DLKM.mjs} +2 -2
  162. package/dist/esm/chunk-JNO7KPMG.mjs +4 -0
  163. package/dist/esm/chunk-JNO7KPMG.mjs.map +1 -0
  164. package/dist/esm/chunk-K4TJRYGQ.mjs +2 -0
  165. package/dist/esm/chunk-K4TJRYGQ.mjs.map +1 -0
  166. package/dist/esm/{chunk-NV6DHDM3.mjs → chunk-KA5FX53Q.mjs} +2 -2
  167. package/dist/esm/{chunk-CRL4WGOH.mjs → chunk-KT3DT5GV.mjs} +2 -2
  168. package/dist/esm/chunk-KT3DT5GV.mjs.map +1 -0
  169. package/dist/esm/chunk-KUL55M2H.mjs +2 -0
  170. package/dist/esm/chunk-KUL55M2H.mjs.map +1 -0
  171. package/dist/esm/{chunk-JDYASF3E.mjs → chunk-L2QVUMBV.mjs} +2 -2
  172. package/dist/esm/chunk-L2SDI7PI.mjs +2 -0
  173. package/dist/esm/chunk-L2SDI7PI.mjs.map +1 -0
  174. package/dist/esm/chunk-L56DQ4N3.mjs +2 -0
  175. package/dist/esm/chunk-L56DQ4N3.mjs.map +1 -0
  176. package/dist/esm/{chunk-S3FVA55H.mjs → chunk-LAAFLCDM.mjs} +2 -2
  177. package/dist/esm/{chunk-AGBA3Y7A.mjs → chunk-LGTOOAQI.mjs} +2 -2
  178. package/dist/esm/chunk-MHN6XY4Z.mjs +2 -0
  179. package/dist/esm/{chunk-PHG2IWZW.mjs → chunk-MOGPSSTD.mjs} +2 -2
  180. package/dist/esm/{chunk-KSKQVOBA.mjs → chunk-NARS3JDH.mjs} +2 -2
  181. package/dist/esm/{chunk-KSUZS6EL.mjs → chunk-NHKAQRJB.mjs} +2 -2
  182. package/dist/esm/{chunk-PHP47DI4.mjs → chunk-OIOGOW6I.mjs} +1 -1
  183. package/dist/esm/{chunk-PHP47DI4.mjs.map → chunk-OIOGOW6I.mjs.map} +1 -1
  184. package/dist/esm/{chunk-DCUVV3VY.mjs → chunk-OJBMR5CT.mjs} +2 -2
  185. package/dist/esm/chunk-OJBMR5CT.mjs.map +1 -0
  186. package/dist/esm/{chunk-TIZL5YVP.mjs → chunk-OKE3FXIP.mjs} +2 -2
  187. package/dist/esm/chunk-ONFKJ57C.mjs +2 -0
  188. package/dist/esm/chunk-ONFKJ57C.mjs.map +1 -0
  189. package/dist/esm/{chunk-ZINOJTLU.mjs → chunk-OPO5EYF7.mjs} +2 -2
  190. package/dist/esm/{chunk-HDTKBFRX.mjs → chunk-PW3ISXPN.mjs} +2 -2
  191. package/dist/esm/{chunk-WIXNX7HY.mjs → chunk-QQM47PHZ.mjs} +2 -2
  192. package/dist/esm/{chunk-5XXIIWG7.mjs → chunk-SBCLBDCP.mjs} +2 -2
  193. package/dist/esm/chunk-SPRNSFUV.mjs +2 -0
  194. package/dist/esm/chunk-SPRNSFUV.mjs.map +1 -0
  195. package/dist/esm/{chunk-Z36WHOZV.mjs → chunk-SU2WB34N.mjs} +2 -2
  196. package/dist/esm/{chunk-OTY3NO7Q.mjs → chunk-T6ADNZE5.mjs} +2 -2
  197. package/dist/esm/{chunk-IECDO22V.mjs → chunk-TM7OZT3W.mjs} +2 -2
  198. package/dist/esm/chunk-TM7OZT3W.mjs.map +1 -0
  199. package/dist/esm/chunk-UGTIALNW.mjs +2 -0
  200. package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
  201. package/dist/esm/chunk-UZTJWOLS.mjs +2 -0
  202. package/dist/esm/chunk-V4FKFCBL.mjs +2 -0
  203. package/dist/esm/chunk-V4FKFCBL.mjs.map +1 -0
  204. package/dist/esm/{chunk-7V6RL27I.mjs → chunk-VCY3JGZM.mjs} +2 -2
  205. package/dist/esm/{chunk-XOCRDV2V.mjs → chunk-VQZMI3EZ.mjs} +2 -2
  206. package/dist/esm/chunk-WGIYSLH6.mjs +2 -0
  207. package/dist/esm/chunk-WGIYSLH6.mjs.map +1 -0
  208. package/dist/esm/{chunk-WOOH5MMX.mjs → chunk-WKNX43KN.mjs} +2 -2
  209. package/dist/esm/chunk-WKNX43KN.mjs.map +1 -0
  210. package/dist/esm/chunk-WQF3IOXC.mjs +2 -0
  211. package/dist/esm/chunk-WQF3IOXC.mjs.map +1 -0
  212. package/dist/esm/{chunk-N3OYD6VZ.mjs → chunk-WSFHH3BK.mjs} +2 -2
  213. package/dist/esm/{chunk-7PVIWKGT.mjs → chunk-X3JPX7T6.mjs} +2 -2
  214. package/dist/esm/{chunk-HGVZ7ULA.mjs → chunk-XKOSS5KC.mjs} +2 -2
  215. package/dist/esm/{chunk-TRU3EK64.mjs → chunk-XT5T5LAP.mjs} +2 -2
  216. package/dist/esm/chunk-XUP6VABV.mjs +2 -0
  217. package/dist/esm/chunk-XUP6VABV.mjs.map +1 -0
  218. package/dist/esm/{chunk-FO4F3OJJ.mjs → chunk-YNT7JHMS.mjs} +2 -2
  219. package/dist/esm/{chunk-37UZKMJI.mjs → chunk-YPBNYKOD.mjs} +2 -2
  220. package/dist/esm/{chunk-IFHQSZLK.mjs → chunk-YZ3YPLEU.mjs} +2 -2
  221. package/dist/esm/{chunk-OZN3OOJV.mjs → chunk-ZMBXHMVQ.mjs} +2 -2
  222. package/dist/esm/{chunk-BQXVHY7J.mjs → chunk-ZRWZIAF5.mjs} +2 -2
  223. package/dist/esm/cli/index.d.mts +3 -2
  224. package/dist/esm/cli/index.mjs +1 -1
  225. package/dist/esm/cli/localNode.mjs +1 -1
  226. package/dist/esm/cli/move.d.mts +2 -1
  227. package/dist/esm/cli/move.mjs +1 -1
  228. package/dist/esm/client/core.d.mts +2 -2
  229. package/dist/esm/client/core.mjs +1 -1
  230. package/dist/esm/client/get.d.mts +2 -2
  231. package/dist/esm/client/get.mjs +1 -1
  232. package/dist/esm/client/index.d.mts +3 -3
  233. package/dist/esm/client/index.mjs +1 -1
  234. package/dist/esm/client/post.d.mts +2 -2
  235. package/dist/esm/client/post.mjs +1 -1
  236. package/dist/esm/core/account/index.d.mts +3 -2
  237. package/dist/esm/core/account/index.mjs +1 -1
  238. package/dist/esm/core/account/utils/address.d.mts +3 -2
  239. package/dist/esm/core/account/utils/address.mjs +1 -1
  240. package/dist/esm/core/account/utils/index.d.mts +3 -2
  241. package/dist/esm/core/account/utils/index.mjs +1 -1
  242. package/dist/esm/core/accountAddress.d.mts +20 -10
  243. package/dist/esm/core/accountAddress.mjs +1 -1
  244. package/dist/esm/core/authenticationKey.d.mts +4 -3
  245. package/dist/esm/core/authenticationKey.mjs +1 -1
  246. package/dist/esm/core/crypto/ed25519.d.mts +27 -12
  247. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  248. package/dist/esm/core/crypto/ephemeral.d.mts +4 -3
  249. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  250. package/dist/esm/core/crypto/federatedKeyless.d.mts +5 -4
  251. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  252. package/dist/esm/core/crypto/hdKey.d.mts +0 -1
  253. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  254. package/dist/esm/core/crypto/index.d.mts +5 -4
  255. package/dist/esm/core/crypto/index.mjs +1 -1
  256. package/dist/esm/core/crypto/keyless.d.mts +73 -11
  257. package/dist/esm/core/crypto/keyless.mjs +1 -1
  258. package/dist/esm/core/crypto/multiEd25519.d.mts +4 -3
  259. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  260. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  261. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  262. package/dist/esm/core/crypto/privateKey.d.mts +38 -10
  263. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  264. package/dist/esm/core/crypto/proof.d.mts +3 -2
  265. package/dist/esm/core/crypto/proof.mjs +1 -1
  266. package/dist/esm/core/crypto/publicKey.d.mts +4 -3
  267. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  268. package/dist/esm/core/crypto/secp256k1.d.mts +24 -9
  269. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  270. package/dist/esm/core/crypto/signature.d.mts +3 -2
  271. package/dist/esm/core/crypto/signature.mjs +1 -1
  272. package/dist/esm/core/crypto/singleKey.d.mts +4 -3
  273. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  274. package/dist/esm/core/crypto/utils.d.mts +3 -2
  275. package/dist/esm/core/crypto/utils.mjs +1 -1
  276. package/dist/esm/core/hex.d.mts +40 -3
  277. package/dist/esm/core/hex.mjs +1 -1
  278. package/dist/esm/core/index.d.mts +6 -5
  279. package/dist/esm/core/index.mjs +1 -1
  280. package/dist/esm/errors/index.d.mts +123 -0
  281. package/dist/esm/errors/index.mjs +2 -0
  282. package/dist/esm/index.d.mts +13 -11
  283. package/dist/esm/index.mjs +1 -1
  284. package/dist/esm/internal/account.d.mts +5 -4
  285. package/dist/esm/internal/account.mjs +1 -1
  286. package/dist/esm/internal/ans.d.mts +5 -4
  287. package/dist/esm/internal/ans.mjs +1 -1
  288. package/dist/esm/internal/coin.d.mts +3 -2
  289. package/dist/esm/internal/coin.mjs +1 -1
  290. package/dist/esm/internal/digitalAsset.d.mts +5 -4
  291. package/dist/esm/internal/digitalAsset.mjs +1 -1
  292. package/dist/esm/internal/event.d.mts +3 -2
  293. package/dist/esm/internal/event.mjs +1 -1
  294. package/dist/esm/internal/faucet.d.mts +2 -1
  295. package/dist/esm/internal/faucet.mjs +1 -1
  296. package/dist/esm/internal/fungibleAsset.d.mts +5 -4
  297. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  298. package/dist/esm/internal/general.d.mts +3 -2
  299. package/dist/esm/internal/general.mjs +1 -1
  300. package/dist/esm/internal/keyless.d.mts +13 -7
  301. package/dist/esm/internal/keyless.mjs +1 -1
  302. package/dist/esm/internal/object.d.mts +3 -2
  303. package/dist/esm/internal/object.mjs +1 -1
  304. package/dist/esm/internal/staking.d.mts +2 -1
  305. package/dist/esm/internal/staking.mjs +1 -1
  306. package/dist/esm/internal/table.d.mts +3 -2
  307. package/dist/esm/internal/table.mjs +1 -1
  308. package/dist/esm/internal/transaction.d.mts +2 -1
  309. package/dist/esm/internal/transaction.mjs +1 -1
  310. package/dist/esm/internal/transactionSubmission.d.mts +4 -3
  311. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  312. package/dist/esm/internal/view.d.mts +4 -3
  313. package/dist/esm/internal/view.mjs +1 -1
  314. package/dist/esm/{publicKey-_tPa99ea.d.mts → publicKey-BVXX1nVl.d.mts} +2 -2
  315. package/dist/esm/transactions/authenticator/account.d.mts +4 -3
  316. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  317. package/dist/esm/transactions/authenticator/index.d.mts +4 -3
  318. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  319. package/dist/esm/transactions/authenticator/transaction.d.mts +10 -4
  320. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  321. package/dist/esm/transactions/index.d.mts +7 -5
  322. package/dist/esm/transactions/index.mjs +1 -1
  323. package/dist/esm/transactions/instances/chainId.d.mts +3 -2
  324. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  325. package/dist/esm/transactions/instances/identifier.d.mts +3 -2
  326. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  327. package/dist/esm/transactions/instances/index.d.mts +4 -3
  328. package/dist/esm/transactions/instances/index.mjs +1 -1
  329. package/dist/esm/transactions/instances/moduleId.d.mts +3 -2
  330. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  331. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +3 -2
  332. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  333. package/dist/esm/transactions/instances/rawTransaction.d.mts +3 -2
  334. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  335. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +4 -3
  336. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  337. package/dist/esm/transactions/instances/signedTransaction.d.mts +4 -3
  338. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  339. package/dist/esm/transactions/instances/simpleTransaction.d.mts +3 -2
  340. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  341. package/dist/esm/transactions/instances/transactionArgument.d.mts +3 -2
  342. package/dist/esm/transactions/instances/transactionPayload.d.mts +3 -2
  343. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  344. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +5 -4
  345. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  346. package/dist/esm/transactions/management/index.d.mts +5 -4
  347. package/dist/esm/transactions/management/index.mjs +1 -1
  348. package/dist/esm/transactions/management/transactionWorker.d.mts +5 -4
  349. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  350. package/dist/esm/transactions/script-composer/index.d.mts +44 -0
  351. package/dist/esm/transactions/script-composer/index.mjs +2 -0
  352. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -2
  353. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  354. package/dist/esm/transactions/transactionBuilder/index.d.mts +5 -4
  355. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  356. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +26 -5
  357. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  358. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -3
  359. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  360. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +4 -3
  361. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  362. package/dist/esm/transactions/typeTag/index.d.mts +3 -2
  363. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  364. package/dist/esm/transactions/typeTag/parser.d.mts +3 -2
  365. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  366. package/dist/esm/transactions/types.d.mts +12 -3
  367. package/dist/esm/types/index.d.mts +4 -1260
  368. package/dist/esm/types/index.mjs +1 -1
  369. package/dist/esm/types/keyless.d.mts +22 -1
  370. package/dist/esm/types/types.d.mts +1290 -0
  371. package/dist/esm/types/types.mjs +2 -0
  372. package/dist/esm/types/types.mjs.map +1 -0
  373. package/dist/esm/utils/helpers.d.mts +11 -3
  374. package/dist/esm/utils/helpers.mjs +1 -1
  375. package/dist/esm/utils/index.d.mts +3 -2
  376. package/dist/esm/utils/index.mjs +1 -1
  377. package/dist/esm/utils/normalizeBundle.d.mts +3 -2
  378. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  379. package/dist/esm/version.d.mts +1 -1
  380. package/dist/esm/version.mjs +1 -1
  381. package/package.json +3 -2
  382. package/src/account/AbstractKeylessAccount.ts +203 -10
  383. package/src/account/FederatedKeylessAccount.ts +83 -35
  384. package/src/account/KeylessAccount.ts +44 -37
  385. package/src/account/MultiKeyAccount.ts +18 -5
  386. package/src/api/account.ts +12 -2
  387. package/src/api/keyless.ts +4 -3
  388. package/src/api/transactionSubmission/build.ts +82 -1
  389. package/src/bcs/deserializer.ts +53 -30
  390. package/src/bcs/serializable/moveStructs.ts +16 -17
  391. package/src/bcs/serializer.ts +22 -12
  392. package/src/cli/move.ts +20 -5
  393. package/src/client/core.ts +2 -2
  394. package/src/client/get.ts +1 -2
  395. package/src/client/index.ts +0 -1
  396. package/src/client/post.ts +1 -2
  397. package/src/core/accountAddress.ts +36 -9
  398. package/src/core/crypto/ed25519.ts +34 -14
  399. package/src/core/crypto/hdKey.ts +0 -1
  400. package/src/core/crypto/keyless.ts +245 -38
  401. package/src/core/crypto/privateKey.ts +81 -5
  402. package/src/core/crypto/secp256k1.ts +31 -11
  403. package/src/core/hex.ts +47 -0
  404. package/src/errors/index.ts +406 -0
  405. package/src/index.ts +1 -0
  406. package/src/internal/account.ts +6 -6
  407. package/src/internal/ans.ts +2 -1
  408. package/src/internal/keyless.ts +50 -20
  409. package/src/internal/transaction.ts +2 -1
  410. package/src/internal/transactionSubmission.ts +36 -18
  411. package/src/transactions/authenticator/transaction.ts +20 -0
  412. package/src/transactions/index.ts +1 -0
  413. package/src/transactions/script-composer/index.ts +76 -0
  414. package/src/transactions/transactionBuilder/remoteAbi.ts +55 -1
  415. package/src/transactions/types.ts +11 -0
  416. package/src/types/index.ts +2 -1483
  417. package/src/types/keyless.ts +19 -0
  418. package/src/types/types.ts +1512 -0
  419. package/src/utils/helpers.ts +10 -0
  420. package/src/version.ts +1 -1
  421. package/dist/common/chunk-7IYTZDXV.js +0 -2
  422. package/dist/common/chunk-7IYTZDXV.js.map +0 -1
  423. package/dist/esm/chunk-2I56E4T2.mjs +0 -2
  424. package/dist/esm/chunk-2I56E4T2.mjs.map +0 -1
  425. package/dist/esm/chunk-4CDDWSKZ.mjs +0 -2
  426. package/dist/esm/chunk-4OV7QU2U.mjs +0 -2
  427. package/dist/esm/chunk-5CCHECTE.mjs +0 -2
  428. package/dist/esm/chunk-5CCHECTE.mjs.map +0 -1
  429. package/dist/esm/chunk-5ZBHIUWG.mjs +0 -2
  430. package/dist/esm/chunk-5ZBHIUWG.mjs.map +0 -1
  431. package/dist/esm/chunk-7D3RY73L.mjs +0 -2
  432. package/dist/esm/chunk-7D3RY73L.mjs.map +0 -1
  433. package/dist/esm/chunk-7XS45O6M.mjs +0 -2
  434. package/dist/esm/chunk-7XS45O6M.mjs.map +0 -1
  435. package/dist/esm/chunk-CRL4WGOH.mjs.map +0 -1
  436. package/dist/esm/chunk-DCUVV3VY.mjs.map +0 -1
  437. package/dist/esm/chunk-DZJXOL64.mjs +0 -2
  438. package/dist/esm/chunk-DZJXOL64.mjs.map +0 -1
  439. package/dist/esm/chunk-EF2PUPUH.mjs.map +0 -1
  440. package/dist/esm/chunk-FPF4KZ5M.mjs.map +0 -1
  441. package/dist/esm/chunk-FY7TSOUU.mjs +0 -2
  442. package/dist/esm/chunk-FY7TSOUU.mjs.map +0 -1
  443. package/dist/esm/chunk-GPZRGLU2.mjs +0 -2
  444. package/dist/esm/chunk-GPZRGLU2.mjs.map +0 -1
  445. package/dist/esm/chunk-GQABU3RQ.mjs +0 -2
  446. package/dist/esm/chunk-GQABU3RQ.mjs.map +0 -1
  447. package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
  448. package/dist/esm/chunk-IBLZ6MZU.mjs +0 -2
  449. package/dist/esm/chunk-IECDO22V.mjs.map +0 -1
  450. package/dist/esm/chunk-KFNDDPOW.mjs +0 -2
  451. package/dist/esm/chunk-KFNDDPOW.mjs.map +0 -1
  452. package/dist/esm/chunk-KFSVKIFO.mjs +0 -2
  453. package/dist/esm/chunk-KIW54KWR.mjs +0 -2
  454. package/dist/esm/chunk-KM6UXNC7.mjs +0 -2
  455. package/dist/esm/chunk-KM6UXNC7.mjs.map +0 -1
  456. package/dist/esm/chunk-KUX6GQ2E.mjs +0 -1
  457. package/dist/esm/chunk-L5I7F3NZ.mjs +0 -2
  458. package/dist/esm/chunk-L5I7F3NZ.mjs.map +0 -1
  459. package/dist/esm/chunk-LEKBJ2EG.mjs +0 -2
  460. package/dist/esm/chunk-LEKBJ2EG.mjs.map +0 -1
  461. package/dist/esm/chunk-LZS7BQ2B.mjs +0 -2
  462. package/dist/esm/chunk-LZS7BQ2B.mjs.map +0 -1
  463. package/dist/esm/chunk-N2FKVZ4D.mjs +0 -1
  464. package/dist/esm/chunk-N47FTRYO.mjs +0 -2
  465. package/dist/esm/chunk-N47FTRYO.mjs.map +0 -1
  466. package/dist/esm/chunk-OLPI7QAH.mjs.map +0 -1
  467. package/dist/esm/chunk-ONBFUPEC.mjs +0 -2
  468. package/dist/esm/chunk-OS2EG6AE.mjs +0 -2
  469. package/dist/esm/chunk-OS2EG6AE.mjs.map +0 -1
  470. package/dist/esm/chunk-PGZWRY7A.mjs +0 -2
  471. package/dist/esm/chunk-PGZWRY7A.mjs.map +0 -1
  472. package/dist/esm/chunk-RUDS7RSB.mjs +0 -2
  473. package/dist/esm/chunk-RUDS7RSB.mjs.map +0 -1
  474. package/dist/esm/chunk-UI3AKMZX.mjs +0 -2
  475. package/dist/esm/chunk-UKAXCARD.mjs +0 -2
  476. package/dist/esm/chunk-WOOH5MMX.mjs.map +0 -1
  477. package/dist/esm/chunk-WSVOJSAC.mjs +0 -2
  478. package/dist/esm/chunk-WSVOJSAC.mjs.map +0 -1
  479. package/dist/esm/chunk-ZS3EWM5A.mjs +0 -2
  480. package/dist/esm/chunk-ZS3EWM5A.mjs.map +0 -1
  481. package/dist/esm/client/types.d.mts +0 -66
  482. package/dist/esm/client/types.mjs +0 -2
  483. package/src/client/types.ts +0 -138
  484. /package/dist/esm/{chunk-OV5UQ75K.mjs.map → chunk-2NHQQQZK.mjs.map} +0 -0
  485. /package/dist/esm/{chunk-JY3JJ55D.mjs.map → chunk-37Y54PJ5.mjs.map} +0 -0
  486. /package/dist/esm/{chunk-XHCALZ7X.mjs.map → chunk-3XCYCFYI.mjs.map} +0 -0
  487. /package/dist/esm/{chunk-6FLHGOKP.mjs.map → chunk-42H7WETG.mjs.map} +0 -0
  488. /package/dist/esm/{chunk-RNAKZVRN.mjs.map → chunk-46L6BAJG.mjs.map} +0 -0
  489. /package/dist/esm/{chunk-EN2HDNFE.mjs.map → chunk-4DNCQM3S.mjs.map} +0 -0
  490. /package/dist/esm/{chunk-IBLZ6MZU.mjs.map → chunk-4O5XDQDO.mjs.map} +0 -0
  491. /package/dist/esm/{chunk-D3KBNFZR.mjs.map → chunk-5AKSORBJ.mjs.map} +0 -0
  492. /package/dist/esm/{chunk-KIW54KWR.mjs.map → chunk-5B3SMBXQ.mjs.map} +0 -0
  493. /package/dist/esm/{chunk-EKZQ3EYX.mjs.map → chunk-5NJWJXSS.mjs.map} +0 -0
  494. /package/dist/esm/{chunk-2QRWGJJA.mjs.map → chunk-6K4TOFCO.mjs.map} +0 -0
  495. /package/dist/esm/{chunk-R3Y6WH2U.mjs.map → chunk-6PJH53CK.mjs.map} +0 -0
  496. /package/dist/esm/{chunk-PCLU4KLY.mjs.map → chunk-6ZOVTYLJ.mjs.map} +0 -0
  497. /package/dist/esm/{chunk-I5OYNCZS.mjs.map → chunk-7ECCT6PK.mjs.map} +0 -0
  498. /package/dist/esm/{chunk-JNHFQTFC.mjs.map → chunk-AAATWCJT.mjs.map} +0 -0
  499. /package/dist/esm/{chunk-NODYW7DM.mjs.map → chunk-ACVIE7IE.mjs.map} +0 -0
  500. /package/dist/esm/{chunk-PRZ7AIGA.mjs.map → chunk-AKIO3OIT.mjs.map} +0 -0
  501. /package/dist/esm/{chunk-KRVLR3L4.mjs.map → chunk-AOROYJ74.mjs.map} +0 -0
  502. /package/dist/esm/{chunk-6AGTDRNM.mjs.map → chunk-BLLHTGAP.mjs.map} +0 -0
  503. /package/dist/esm/{chunk-JGNMNCQB.mjs.map → chunk-BRV3RLKW.mjs.map} +0 -0
  504. /package/dist/esm/{chunk-GIQQF2PD.mjs.map → chunk-CA3Q2X6B.mjs.map} +0 -0
  505. /package/dist/esm/{chunk-QRTZYRH2.mjs.map → chunk-DP3YPGIK.mjs.map} +0 -0
  506. /package/dist/esm/{chunk-DXQT55L3.mjs.map → chunk-DSKAMBBL.mjs.map} +0 -0
  507. /package/dist/esm/{chunk-RAXP3STS.mjs.map → chunk-E2NYQVP3.mjs.map} +0 -0
  508. /package/dist/esm/{chunk-WUCPTRXU.mjs.map → chunk-F2AIWA7L.mjs.map} +0 -0
  509. /package/dist/esm/{chunk-VQTEGTUQ.mjs.map → chunk-FXUI3SSD.mjs.map} +0 -0
  510. /package/dist/esm/{chunk-5AAFF2PV.mjs.map → chunk-HEHVWRMO.mjs.map} +0 -0
  511. /package/dist/esm/{chunk-ZUTOMGB7.mjs.map → chunk-HFWFDS6Y.mjs.map} +0 -0
  512. /package/dist/esm/{chunk-QBWGWHJK.mjs.map → chunk-HXXELLHN.mjs.map} +0 -0
  513. /package/dist/esm/{chunk-LD5MUWGW.mjs.map → chunk-IBMZYDAR.mjs.map} +0 -0
  514. /package/dist/esm/{chunk-QBP4XJT5.mjs.map → chunk-IDNDUJOK.mjs.map} +0 -0
  515. /package/dist/esm/{chunk-HCV3NGLS.mjs.map → chunk-II654QZU.mjs.map} +0 -0
  516. /package/dist/esm/{chunk-XIY2VORC.mjs.map → chunk-JDNI5VIJ.mjs.map} +0 -0
  517. /package/dist/esm/{chunk-HAMXSLWF.mjs.map → chunk-JJUINAQE.mjs.map} +0 -0
  518. /package/dist/esm/{chunk-K6MZXKVV.mjs.map → chunk-JLD7DLKM.mjs.map} +0 -0
  519. /package/dist/esm/{chunk-NV6DHDM3.mjs.map → chunk-KA5FX53Q.mjs.map} +0 -0
  520. /package/dist/esm/{chunk-JDYASF3E.mjs.map → chunk-L2QVUMBV.mjs.map} +0 -0
  521. /package/dist/esm/{chunk-S3FVA55H.mjs.map → chunk-LAAFLCDM.mjs.map} +0 -0
  522. /package/dist/esm/{chunk-AGBA3Y7A.mjs.map → chunk-LGTOOAQI.mjs.map} +0 -0
  523. /package/dist/esm/{chunk-4OV7QU2U.mjs.map → chunk-MHN6XY4Z.mjs.map} +0 -0
  524. /package/dist/esm/{chunk-PHG2IWZW.mjs.map → chunk-MOGPSSTD.mjs.map} +0 -0
  525. /package/dist/esm/{chunk-KSKQVOBA.mjs.map → chunk-NARS3JDH.mjs.map} +0 -0
  526. /package/dist/esm/{chunk-KSUZS6EL.mjs.map → chunk-NHKAQRJB.mjs.map} +0 -0
  527. /package/dist/esm/{chunk-TIZL5YVP.mjs.map → chunk-OKE3FXIP.mjs.map} +0 -0
  528. /package/dist/esm/{chunk-ZINOJTLU.mjs.map → chunk-OPO5EYF7.mjs.map} +0 -0
  529. /package/dist/esm/{chunk-HDTKBFRX.mjs.map → chunk-PW3ISXPN.mjs.map} +0 -0
  530. /package/dist/esm/{chunk-WIXNX7HY.mjs.map → chunk-QQM47PHZ.mjs.map} +0 -0
  531. /package/dist/esm/{chunk-5XXIIWG7.mjs.map → chunk-SBCLBDCP.mjs.map} +0 -0
  532. /package/dist/esm/{chunk-Z36WHOZV.mjs.map → chunk-SU2WB34N.mjs.map} +0 -0
  533. /package/dist/esm/{chunk-OTY3NO7Q.mjs.map → chunk-T6ADNZE5.mjs.map} +0 -0
  534. /package/dist/esm/{chunk-ONBFUPEC.mjs.map → chunk-UGTIALNW.mjs.map} +0 -0
  535. /package/dist/esm/{chunk-KUX6GQ2E.mjs.map → chunk-UIRAXHDH.mjs.map} +0 -0
  536. /package/dist/esm/{chunk-4CDDWSKZ.mjs.map → chunk-UZTJWOLS.mjs.map} +0 -0
  537. /package/dist/esm/{chunk-7V6RL27I.mjs.map → chunk-VCY3JGZM.mjs.map} +0 -0
  538. /package/dist/esm/{chunk-XOCRDV2V.mjs.map → chunk-VQZMI3EZ.mjs.map} +0 -0
  539. /package/dist/esm/{chunk-N3OYD6VZ.mjs.map → chunk-WSFHH3BK.mjs.map} +0 -0
  540. /package/dist/esm/{chunk-7PVIWKGT.mjs.map → chunk-X3JPX7T6.mjs.map} +0 -0
  541. /package/dist/esm/{chunk-HGVZ7ULA.mjs.map → chunk-XKOSS5KC.mjs.map} +0 -0
  542. /package/dist/esm/{chunk-TRU3EK64.mjs.map → chunk-XT5T5LAP.mjs.map} +0 -0
  543. /package/dist/esm/{chunk-FO4F3OJJ.mjs.map → chunk-YNT7JHMS.mjs.map} +0 -0
  544. /package/dist/esm/{chunk-37UZKMJI.mjs.map → chunk-YPBNYKOD.mjs.map} +0 -0
  545. /package/dist/esm/{chunk-IFHQSZLK.mjs.map → chunk-YZ3YPLEU.mjs.map} +0 -0
  546. /package/dist/esm/{chunk-OZN3OOJV.mjs.map → chunk-ZMBXHMVQ.mjs.map} +0 -0
  547. /package/dist/esm/{chunk-BQXVHY7J.mjs.map → chunk-ZRWZIAF5.mjs.map} +0 -0
  548. /package/dist/esm/{chunk-N2FKVZ4D.mjs.map → errors/index.mjs.map} +0 -0
  549. /package/dist/esm/{client/types.mjs.map → transactions/script-composer/index.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/transaction.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/transaction}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * transaction namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosFullNode, paginateWithCursor } from \"../client\";\nimport { AptosApiError } from \"../errors\";\nimport {\n TransactionResponseType,\n type AnyNumber,\n type GasEstimation,\n type HexInput,\n type PaginationArgs,\n type TransactionResponse,\n WaitForTransactionOptions,\n CommittedTransactionResponse,\n Block,\n} from \"../types\";\nimport { DEFAULT_TXN_TIMEOUT_SEC, ProcessorType } from \"../utils/const\";\nimport { sleep } from \"../utils/helpers\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { getIndexerLastSuccessVersion, getProcessorStatus } from \"./general\";\n\n/**\n * Retrieve a list of transactions based on the specified options.\n *\n * @param {Object} args - The parameters for retrieving transactions.\n * @param {Object} args.aptosConfig - The configuration object for Aptos.\n * @param {Object} args.options - The options for pagination.\n * @param {number} args.options.offset - The number of transactions to skip before starting to collect the result set.\n * @param {number} args.options.limit - The maximum number of transactions to return.\n */\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: \"transactions\",\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\n/**\n * Retrieves the estimated gas price for transactions on the Aptos network.\n * This function helps users understand the current gas price, which is essential for transaction planning and cost estimation.\n *\n * @param args - The configuration parameters for the Aptos network.\n * @param args.aptosConfig - The configuration object containing network details.\n */\nexport async function getGasPriceEstimation(args: { aptosConfig: AptosConfig }) {\n const { aptosConfig } = args;\n\n return memoizeAsync(\n async () => {\n const { data } = await getAptosFullNode<{}, GasEstimation>({\n aptosConfig,\n originMethod: \"getGasPriceEstimation\",\n path: \"estimate_gas_price\",\n });\n return data;\n },\n `gas-price-${aptosConfig.network}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\n/**\n * Retrieves the transaction details associated with a specific ledger version.\n *\n * @param args - The arguments for the transaction retrieval.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.ledgerVersion - The ledger version for which to retrieve the transaction.\n * @returns The transaction details for the specified ledger version.\n */\nexport async function getTransactionByVersion(args: {\n aptosConfig: AptosConfig;\n ledgerVersion: AnyNumber;\n}): Promise<TransactionResponse> {\n const { aptosConfig, ledgerVersion } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n originMethod: \"getTransactionByVersion\",\n path: `transactions/by_version/${ledgerVersion}`,\n });\n return data;\n}\n\n/**\n * Retrieves transaction details using the specified transaction hash.\n *\n * @param args - The arguments for retrieving the transaction.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.transactionHash - The hash of the transaction to retrieve.\n * @returns A promise that resolves to the transaction details.\n */\nexport async function getTransactionByHash(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<TransactionResponse> {\n const { aptosConfig, transactionHash } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n path: `transactions/by_hash/${transactionHash}`,\n originMethod: \"getTransactionByHash\",\n });\n return data;\n}\n\n/**\n * Checks if a transaction is currently pending based on its hash.\n * This function helps determine the status of a transaction in the Aptos network.\n *\n * @param args - The arguments for checking the transaction status.\n * @param args.aptosConfig - The configuration settings for connecting to the Aptos network.\n * @param args.transactionHash - The hash of the transaction to check.\n * @returns A boolean indicating whether the transaction is pending.\n * @throws An error if the transaction cannot be retrieved due to reasons other than a 404 status.\n */\nexport async function isTransactionPending(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<boolean> {\n const { aptosConfig, transactionHash } = args;\n try {\n const transaction = await getTransactionByHash({ aptosConfig, transactionHash });\n return transaction.type === TransactionResponseType.Pending;\n } catch (e: any) {\n if (e?.status === 404) {\n return true;\n }\n throw e;\n }\n}\n\n/**\n * Waits for a transaction to be confirmed by its hash.\n * This function allows you to monitor the status of a transaction until it is finalized.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration settings for the Aptos client.\n * @param args.transactionHash - The hash of the transaction to wait for.\n */\nexport async function longWaitForTransaction(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n}): Promise<TransactionResponse> {\n const { aptosConfig, transactionHash } = args;\n const { data } = await getAptosFullNode<{}, TransactionResponse>({\n aptosConfig,\n path: `transactions/wait_by_hash/${transactionHash}`,\n originMethod: \"longWaitForTransaction\",\n });\n return data;\n}\n\n/**\n * Waits for a transaction to be confirmed on the blockchain and handles potential errors during the process.\n * This function allows you to monitor the status of a transaction until it is either confirmed or fails.\n *\n * @param args - The arguments for waiting for a transaction.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.transactionHash - The hash of the transaction to wait for.\n * @param args.options - Optional settings for waiting, including timeout and success check.\n * @param args.options.timeoutSecs - The maximum time to wait for the transaction in seconds. Defaults to a predefined value.\n * @param args.options.checkSuccess - A flag indicating whether to check the success status of the transaction. Defaults to true.\n * @returns A promise that resolves to the transaction response once the transaction is confirmed.\n * @throws WaitForTransactionError if the transaction times out or remains pending.\n * @throws FailedTransactionError if the transaction fails.\n */\nexport async function waitForTransaction(args: {\n aptosConfig: AptosConfig;\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n}): Promise<CommittedTransactionResponse> {\n const { aptosConfig, transactionHash, options } = args;\n const timeoutSecs = options?.timeoutSecs ?? DEFAULT_TXN_TIMEOUT_SEC;\n const checkSuccess = options?.checkSuccess ?? true;\n\n let isPending = true;\n let timeElapsed = 0;\n let lastTxn: TransactionResponse | undefined;\n let lastError: AptosApiError | undefined;\n let backoffIntervalMs = 200;\n const backoffMultiplier = 1.5;\n\n /**\n * Handles API errors by throwing the last error or a timeout error for a failed transaction.\n *\n * @param e - The error object that occurred during the API call.\n * @throws {Error} Throws the last error if it exists; otherwise, throws a WaitForTransactionError indicating a timeout.\n */\n function handleAPIError(e: any) {\n // In short, this means we will retry if it was an AptosApiError and the code was 404 or 5xx.\n const isAptosApiError = e instanceof AptosApiError;\n if (!isAptosApiError) {\n throw e; // This would be unexpected\n }\n lastError = e;\n const isRequestError = e.status !== 404 && e.status >= 400 && e.status < 500;\n if (isRequestError) {\n throw e;\n }\n }\n\n // check to see if the txn is already on the blockchain\n try {\n lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });\n isPending = lastTxn.type === TransactionResponseType.Pending;\n } catch (e) {\n handleAPIError(e);\n }\n\n // If the transaction is pending, we do a long wait once to avoid polling\n if (isPending) {\n const startTime = Date.now();\n try {\n lastTxn = await longWaitForTransaction({ aptosConfig, transactionHash });\n isPending = lastTxn.type === TransactionResponseType.Pending;\n } catch (e) {\n handleAPIError(e);\n }\n timeElapsed = (Date.now() - startTime) / 1000;\n }\n\n // Now we do polling to see if the transaction is still pending\n while (isPending) {\n if (timeElapsed >= timeoutSecs) {\n break;\n }\n try {\n // eslint-disable-next-line no-await-in-loop\n lastTxn = await getTransactionByHash({ aptosConfig, transactionHash });\n\n isPending = lastTxn.type === TransactionResponseType.Pending;\n\n if (!isPending) {\n break;\n }\n } catch (e) {\n handleAPIError(e);\n }\n // eslint-disable-next-line no-await-in-loop\n await sleep(backoffIntervalMs);\n timeElapsed += backoffIntervalMs / 1000; // Convert to seconds\n backoffIntervalMs *= backoffMultiplier;\n }\n\n // There is a chance that lastTxn is still undefined. Let's throw the last error otherwise a WaitForTransactionError\n if (lastTxn === undefined) {\n if (lastError) {\n throw lastError;\n } else {\n throw new WaitForTransactionError(\n `Fetching transaction ${transactionHash} failed and timed out after ${timeoutSecs} seconds`,\n lastTxn,\n );\n }\n }\n\n if (lastTxn.type === TransactionResponseType.Pending) {\n throw new WaitForTransactionError(\n `Transaction ${transactionHash} timed out in pending state after ${timeoutSecs} seconds`,\n lastTxn,\n );\n }\n if (!checkSuccess) {\n return lastTxn;\n }\n if (!lastTxn.success) {\n throw new FailedTransactionError(\n `Transaction ${transactionHash} failed with an error: ${lastTxn.vm_status}`,\n lastTxn,\n );\n }\n\n return lastTxn;\n}\n\n/**\n * Waits for the indexer to sync up to the specified ledger version. The timeout is 3 seconds.\n *\n * @param args - The arguments for the function.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.minimumLedgerVersion - The minimum ledger version that the indexer should sync to.\n * @param args.processorType - (Optional) The type of processor to check the last success version from.\n */\nexport async function waitForIndexer(args: {\n aptosConfig: AptosConfig;\n minimumLedgerVersion: AnyNumber;\n processorType?: ProcessorType;\n}): Promise<void> {\n const { aptosConfig, processorType } = args;\n const minimumLedgerVersion = BigInt(args.minimumLedgerVersion);\n const timeoutMilliseconds = 3000; // 3 seconds\n const startTime = new Date().getTime();\n let indexerVersion = BigInt(-1);\n\n while (indexerVersion < minimumLedgerVersion) {\n // check for timeout\n if (new Date().getTime() - startTime > timeoutMilliseconds) {\n throw new Error(\"waitForLastSuccessIndexerVersionSync timeout\");\n }\n\n if (processorType === undefined) {\n // Get the last success version from all processor\n // eslint-disable-next-line no-await-in-loop\n indexerVersion = await getIndexerLastSuccessVersion({ aptosConfig });\n } else {\n // Get the last success version from the specific processor\n // eslint-disable-next-line no-await-in-loop\n const processor = await getProcessorStatus({ aptosConfig, processorType });\n indexerVersion = processor.last_success_version;\n }\n\n if (indexerVersion >= minimumLedgerVersion) {\n // break out immediately if we are synced\n break;\n }\n\n // eslint-disable-next-line no-await-in-loop\n await sleep(200);\n }\n}\n\n/**\n * Represents an error that occurs when waiting for a transaction to complete.\n * This error is thrown by the `waitForTransaction` function when a transaction\n * times out or when the transaction response is undefined.\n *\n * @param message - A descriptive message for the error.\n * @param lastSubmittedTransaction - The last submitted transaction response, if available.\n */\nexport class WaitForTransactionError extends Error {\n public readonly lastSubmittedTransaction: TransactionResponse | undefined;\n\n /**\n * Constructs an instance of the class with a specified message and transaction response.\n *\n * @param message - The message associated with the transaction.\n * @param lastSubmittedTransaction - The transaction response object containing details about the transaction.\n */\n constructor(message: string, lastSubmittedTransaction: TransactionResponse | undefined) {\n super(message);\n this.lastSubmittedTransaction = lastSubmittedTransaction;\n }\n}\n\n/**\n * Represents an error that occurs when a transaction fails.\n * This error is thrown by the `waitForTransaction` function when the `checkSuccess` parameter is set to true.\n *\n * @param message - A description of the error.\n * @param transaction - The transaction response associated with the failure.\n */\nexport class FailedTransactionError extends Error {\n public readonly transaction: TransactionResponse;\n\n constructor(message: string, transaction: TransactionResponse) {\n super(message);\n this.transaction = transaction;\n }\n}\n\n/**\n * Retrieves a block from the Aptos blockchain by its ledger version.\n * This function allows you to obtain detailed information about a specific block, including its transactions if requested.\n *\n * @param args - The arguments for retrieving the block.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos node.\n * @param args.ledgerVersion - The ledger version of the block to retrieve.\n * @param args.options - Optional parameters for the request.\n * @param args.options.withTransactions - Indicates whether to include transactions in the block data.\n */\nexport async function getBlockByVersion(args: {\n aptosConfig: AptosConfig;\n ledgerVersion: AnyNumber;\n options?: { withTransactions?: boolean };\n}): Promise<Block> {\n const { aptosConfig, ledgerVersion, options } = args;\n const { data: block } = await getAptosFullNode<{}, Block>({\n aptosConfig,\n originMethod: \"getBlockByVersion\",\n path: `blocks/by_version/${ledgerVersion}`,\n params: { with_transactions: options?.withTransactions },\n });\n\n return fillBlockTransactions({ block, ...args });\n}\n\n/**\n * Retrieves a block from the Aptos blockchain by its height.\n *\n * @param args - The parameters for retrieving the block.\n * @param args.aptosConfig - The configuration object for connecting to the Aptos network.\n * @param args.blockHeight - The height of the block to retrieve.\n * @param args.options - Optional parameters for the request.\n * @param args.options.withTransactions - Indicates whether to include transactions in the block data.\n * @returns A promise that resolves to the block data, potentially including its transactions.\n */\nexport async function getBlockByHeight(args: {\n aptosConfig: AptosConfig;\n blockHeight: AnyNumber;\n options?: { withTransactions?: boolean };\n}): Promise<Block> {\n const { aptosConfig, blockHeight, options } = args;\n const { data: block } = await getAptosFullNode<{}, Block>({\n aptosConfig,\n originMethod: \"getBlockByHeight\",\n path: `blocks/by_height/${blockHeight}`,\n params: { with_transactions: options?.withTransactions },\n });\n return fillBlockTransactions({ block, ...args });\n}\n\n/**\n * Fills in the block with transactions if not enough were returned. This function ensures that the block contains all relevant\n * transactions by fetching any missing ones based on the specified options.\n * @param args - The arguments for filling the block transactions.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.block - The block object that will be filled with transactions.\n * @param args.options - Optional settings for fetching transactions.\n * @param args.options.withTransactions - Indicates whether to include transactions in the block.\n */\nasync function fillBlockTransactions(args: {\n aptosConfig: AptosConfig;\n block: Block;\n options?: { withTransactions?: boolean };\n}) {\n const { aptosConfig, block, options } = args;\n if (options?.withTransactions) {\n // Transactions should be filled, but this ensures it\n block.transactions = block.transactions ?? [];\n\n const lastTxn = block.transactions[block.transactions.length - 1];\n const firstVersion = BigInt(block.first_version);\n const lastVersion = BigInt(block.last_version);\n\n // Convert the transaction to the type\n const curVersion: string | undefined = (lastTxn as any)?.version;\n let latestVersion;\n\n // This time, if we don't have any transactions, we will try once with the start of the block\n if (curVersion === undefined) {\n latestVersion = firstVersion - 1n;\n } else {\n latestVersion = BigInt(curVersion);\n }\n\n // If we have all the transactions in the block, we can skip out, otherwise we need to fill the transactions\n if (latestVersion === lastVersion) {\n return block;\n }\n\n // For now, we will grab all the transactions in groups of 100, but we can make this more efficient by trying larger\n // amounts\n const fetchFutures = [];\n const pageSize = 100n;\n for (let i = latestVersion + 1n; i < lastVersion; i += BigInt(100)) {\n fetchFutures.push(\n getTransactions({\n aptosConfig,\n options: {\n offset: i,\n limit: Math.min(Number(pageSize), Number(lastVersion - i + 1n)),\n },\n }),\n );\n }\n\n // Combine all the futures\n const responses = await Promise.all(fetchFutures);\n for (const txns of responses) {\n block.transactions.push(...txns);\n }\n }\n\n return block;\n}\n"],"mappings":"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","names":["getTransactions","args","aptosConfig","options","paginateWithCursor","getGasPriceEstimation","memoizeAsync","data","getAptosFullNode","getTransactionByVersion","ledgerVersion","getTransactionByHash","transactionHash","isTransactionPending","e","longWaitForTransaction","waitForTransaction","timeoutSecs","checkSuccess","isPending","timeElapsed","lastTxn","lastError","backoffIntervalMs","backoffMultiplier","handleAPIError","AptosApiError","startTime","sleep","WaitForTransactionError","FailedTransactionError","waitForIndexer","processorType","minimumLedgerVersion","timeoutMilliseconds","indexerVersion","getIndexerLastSuccessVersion","getProcessorStatus","message","lastSubmittedTransaction","transaction","getBlockByVersion","block","fillBlockTransactions","getBlockByHeight","blockHeight","firstVersion","lastVersion","curVersion","latestVersion","fetchFutures","pageSize","i","responses","txns"]}
@@ -1,2 +1,2 @@
1
- import{a as t,b as n,c as o,d as r}from"./chunk-QBP4XJT5.mjs";import{a as s}from"./chunk-TRU3EK64.mjs";import{b as i}from"./chunk-KM6UXNC7.mjs";var a=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await t({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await t({aptosConfig:this.config,options:{where:{creator_address:{_eq:i.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),o({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return r({aptosConfig:this.config,...e})}};export{a};
2
- //# sourceMappingURL=chunk-TIZL5YVP.mjs.map
1
+ import{a as t,b as n,c as o,d as r}from"./chunk-IDNDUJOK.mjs";import{a as s}from"./chunk-XT5T5LAP.mjs";import{b as i}from"./chunk-JNO7KPMG.mjs";var a=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),t({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await t({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await t({aptosConfig:this.config,options:{where:{creator_address:{_eq:i.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),n({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await s({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),o({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return r({aptosConfig:this.config,...e})}};export{a};
2
+ //# sourceMappingURL=chunk-OKE3FXIP.mjs.map
@@ -0,0 +1,2 @@
1
+ import{b as f}from"./chunk-H457BI3I.mjs";import{a as h}from"./chunk-YPBNYKOD.mjs";import{r as y}from"./chunk-XUP6VABV.mjs";import{b as K}from"./chunk-JNO7KPMG.mjs";import{b as A}from"./chunk-SPRNSFUV.mjs";import{a as m}from"./chunk-D52UKPQF.mjs";var w=class d extends f{constructor(e){let r=h.create(e);super({publicKey:r,...e}),this.publicKey=r}serialize(e){super.serialize(e),this.publicKey.jwkAddress.serialize(e)}static deserialize(e){let{address:r,proof:c,ephemeralKeyPair:i,jwt:s,uidKey:t,pepper:n,verificationKeyHash:o}=f.partialDeserialize(e),l=K.deserialize(e),{iss:a,aud:p,uidVal:u}=y({jwt:s,uidKey:t});return new d({address:r,proof:c,ephemeralKeyPair:i,iss:a,uidKey:t,uidVal:u,aud:p,pepper:n,jwt:s,verificationKeyHash:o,jwkAddress:l})}static fromBytes(e){return d.deserialize(new m(A.hexInputToUint8Array(e)))}static create(e){let{address:r,proof:c,jwt:i,ephemeralKeyPair:s,pepper:t,jwkAddress:n,uidKey:o="sub",proofFetchCallback:l,verificationKey:a}=e,{iss:p,aud:u,uidVal:g}=y({jwt:i,uidKey:o});return new d({address:r,proof:c,ephemeralKeyPair:s,iss:p,uidKey:o,uidVal:g,aud:u,pepper:t,jwkAddress:K.from(n),jwt:i,proofFetchCallback:l,verificationKeyHash:a?a.hash():void 0})}};export{w as a};
2
+ //# sourceMappingURL=chunk-ONFKJ57C.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/FederatedKeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { HexInput } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { getIssAudAndUidVal, Groth16VerificationKey, ZeroKnowledgeSig } from \"../core/crypto\";\n\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Deserializer, Serializer } from \"../bcs\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { AbstractKeylessAccount, ProofFetchCallback } from \"./AbstractKeylessAccount\";\nimport { Hex } from \"../core\";\n\n/**\n * Account implementation for the FederatedKeyless authentication scheme.\n *\n * Used to represent a FederatedKeyless based account and sign transactions with it.\n *\n * Use `FederatedKeylessAccount.create()` to instantiate a KeylessAccount with a JSON Web Token (JWT), proof, EphemeralKeyPair and the\n * address the JSON Web Key Set (JWKS) are installed that will be used to verify the JWT.\n *\n * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,\n * EphemeralKeyPair, and corresponding proof.\n */\nexport class FederatedKeylessAccount extends AbstractKeylessAccount {\n /**\n * The FederatedKeylessPublicKey associated with the account\n */\n readonly publicKey: FederatedKeylessPublicKey;\n\n /**\n * Use the static generator `FederatedKeylessAccount.create(...)` instead.\n * Creates a KeylessAccount instance using the provided parameters.\n * This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT.\n *\n * @param args - The parameters for creating a KeylessAccount.\n * @param args.address - Optional account address associated with the KeylessAccount.\n * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.\n * @param args.jwt - A JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.\n * @param args.jwkAddress - The address which stores the JSON Web Key Set (JWKS) used to verify the JWT.\n * @param args.uidKey - Optional key for user identification, defaults to \"sub\".\n * @param args.proofFetchCallback - Optional callback function for fetching proof.\n */\n private constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n jwkAddress: AccountAddress;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n verificationKeyHash?: HexInput;\n }) {\n const publicKey = FederatedKeylessPublicKey.create(args);\n super({ publicKey, ...args });\n this.publicKey = publicKey;\n }\n\n /**\n * Serializes the transaction data into a format suitable for transmission or storage.\n * This function ensures that both the transaction bytes and the proof are properly serialized.\n *\n * @param serializer - The serializer instance used to convert the transaction data into bytes.\n */\n serialize(serializer: Serializer): void {\n super.serialize(serializer);\n this.publicKey.jwkAddress.serialize(serializer);\n }\n\n /**\n * Deserializes the provided deserializer to create a KeylessAccount instance.\n * This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer.\n *\n * @param deserializer - The deserializer instance used to retrieve the serialized data.\n * @returns A KeylessAccount instance created from the deserialized data.\n */\n static deserialize(deserializer: Deserializer): FederatedKeylessAccount {\n const { address, proof, ephemeralKeyPair, jwt, uidKey, pepper, verificationKeyHash } =\n AbstractKeylessAccount.partialDeserialize(deserializer);\n const jwkAddress = AccountAddress.deserialize(deserializer);\n const { iss, aud, uidVal } = getIssAudAndUidVal({ jwt, uidKey });\n return new FederatedKeylessAccount({\n address,\n proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n verificationKeyHash,\n jwkAddress,\n });\n }\n\n /**\n * Deserialize bytes using this account's information.\n *\n * @param bytes The bytes being interpreted.\n * @returns\n */\n static fromBytes(bytes: HexInput): FederatedKeylessAccount {\n return FederatedKeylessAccount.deserialize(new Deserializer(Hex.hexInputToUint8Array(bytes)));\n }\n\n /**\n * Creates a KeylessAccount instance using the provided parameters.\n * This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT.\n * This is used instead of the KeylessAccount constructor.\n *\n * @param args - The parameters for creating a KeylessAccount.\n * @param args.address - Optional account address associated with the KeylessAccount.\n * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.\n * @param args.jwt - A JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.\n * @param args.jwkAddress - The address which stores the JSON Web Key Set (JWKS) used to verify the JWT.\n * @param args.uidKey - Optional key for user identification, defaults to \"sub\".\n * @param args.proofFetchCallback - Optional callback function for fetching proof.\n */\n static create(args: {\n address?: AccountAddress;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n verificationKey?: Groth16VerificationKey;\n }): FederatedKeylessAccount {\n const {\n address,\n proof,\n jwt,\n ephemeralKeyPair,\n pepper,\n jwkAddress,\n uidKey = \"sub\",\n proofFetchCallback,\n verificationKey,\n } = args;\n\n const { iss, aud, uidVal } = getIssAudAndUidVal({ jwt, uidKey });\n return new FederatedKeylessAccount({\n address,\n proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwkAddress: AccountAddress.from(jwkAddress),\n jwt,\n proofFetchCallback,\n verificationKeyHash: verificationKey ? verificationKey.hash() : undefined,\n });\n }\n}\n"],"mappings":"sPAwBO,IAAMA,EAAN,MAAMC,UAAgCC,CAAuB,CAoB1D,YAAYC,EAajB,CACD,IAAMC,EAAYC,EAA0B,OAAOF,CAAI,EACvD,MAAM,CAAE,UAAAC,EAAW,GAAGD,CAAK,CAAC,EAC5B,KAAK,UAAYC,CACnB,CAQA,UAAUE,EAA8B,CACtC,MAAM,UAAUA,CAAU,EAC1B,KAAK,UAAU,WAAW,UAAUA,CAAU,CAChD,CASA,OAAO,YAAYC,EAAqD,CACtE,GAAM,CAAE,QAAAC,EAAS,MAAAC,EAAO,iBAAAC,EAAkB,IAAAC,EAAK,OAAAC,EAAQ,OAAAC,EAAQ,oBAAAC,CAAoB,EACjFZ,EAAuB,mBAAmBK,CAAY,EAClDQ,EAAaC,EAAe,YAAYT,CAAY,EACpD,CAAE,IAAAU,EAAK,IAAAC,EAAK,OAAAC,CAAO,EAAIC,EAAmB,CAAE,IAAAT,EAAK,OAAAC,CAAO,CAAC,EAC/D,OAAO,IAAIX,EAAwB,CACjC,QAAAO,EACA,MAAAC,EACA,iBAAAC,EACA,IAAAO,EACA,OAAAL,EACA,OAAAO,EACA,IAAAD,EACA,OAAAL,EACA,IAAAF,EACA,oBAAAG,EACA,WAAAC,CACF,CAAC,CACH,CAQA,OAAO,UAAUM,EAA0C,CACzD,OAAOpB,EAAwB,YAAY,IAAIqB,EAAaC,EAAI,qBAAqBF,CAAK,CAAC,CAAC,CAC9F,CAgBA,OAAO,OAAOlB,EAUc,CAC1B,GAAM,CACJ,QAAAK,EACA,MAAAC,EACA,IAAAE,EACA,iBAAAD,EACA,OAAAG,EACA,WAAAE,EACA,OAAAH,EAAS,MACT,mBAAAY,EACA,gBAAAC,CACF,EAAItB,EAEE,CAAE,IAAAc,EAAK,IAAAC,EAAK,OAAAC,CAAO,EAAIC,EAAmB,CAAE,IAAAT,EAAK,OAAAC,CAAO,CAAC,EAC/D,OAAO,IAAIX,EAAwB,CACjC,QAAAO,EACA,MAAAC,EACA,iBAAAC,EACA,IAAAO,EACA,OAAAL,EACA,OAAAO,EACA,IAAAD,EACA,OAAAL,EACA,WAAYG,EAAe,KAAKD,CAAU,EAC1C,IAAAJ,EACA,mBAAAa,EACA,oBAAqBC,EAAkBA,EAAgB,KAAK,EAAI,MAClE,CAAC,CACH,CACF","names":["FederatedKeylessAccount","_FederatedKeylessAccount","AbstractKeylessAccount","args","publicKey","FederatedKeylessPublicKey","serializer","deserializer","address","proof","ephemeralKeyPair","jwt","uidKey","pepper","verificationKeyHash","jwkAddress","AccountAddress","iss","aud","uidVal","getIssAudAndUidVal","bytes","Deserializer","Hex","proofFetchCallback","verificationKey"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-QQIVWB6G.mjs";var r=class a extends i{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
2
- //# sourceMappingURL=chunk-ZINOJTLU.mjs.map
1
+ import{a as i}from"./chunk-AJ5JHBAE.mjs";var r=class a extends i{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let s=e.deserializeU8();return new a(s)}};export{r as a};
2
+ //# sourceMappingURL=chunk-OPO5EYF7.mjs.map
@@ -1,2 +1,2 @@
1
- import{l as c,v as n}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-OLPI7QAH.mjs";import{c as p}from"./chunk-WOOH5MMX.mjs";async function d(o){let{aptosConfig:s}=o,{data:e}=await i({aptosConfig:s,originMethod:"getLedgerInfo",path:""});return e}async function C(o){let{aptosConfig:s,limit:e}=o;return(await a({aptosConfig:s,query:{query:c,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function a(o){let{aptosConfig:s,query:e,originMethod:t}=o,{data:r}=await p({aptosConfig:s,originMethod:t??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function u(o){let{aptosConfig:s}=o;return(await a({aptosConfig:s,query:{query:n},originMethod:"getProcessorStatuses"})).processor_status}async function h(o){let s=await u({aptosConfig:o.aptosConfig});return BigInt(s[0].last_success_version)}async function T(o){let{aptosConfig:s,processorType:e}=o;return(await a({aptosConfig:s,query:{query:n,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{d as a,C as b,a as c,u as d,h as e,T as f};
2
- //# sourceMappingURL=chunk-HDTKBFRX.mjs.map
1
+ import{l as c,v as n}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-6LLGRGCN.mjs";import{c as p}from"./chunk-WKNX43KN.mjs";async function d(o){let{aptosConfig:s}=o,{data:e}=await i({aptosConfig:s,originMethod:"getLedgerInfo",path:""});return e}async function C(o){let{aptosConfig:s,limit:e}=o;return(await a({aptosConfig:s,query:{query:c,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function a(o){let{aptosConfig:s,query:e,originMethod:t}=o,{data:r}=await p({aptosConfig:s,originMethod:t??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function u(o){let{aptosConfig:s}=o;return(await a({aptosConfig:s,query:{query:n},originMethod:"getProcessorStatuses"})).processor_status}async function h(o){let s=await u({aptosConfig:o.aptosConfig});return BigInt(s[0].last_success_version)}async function T(o){let{aptosConfig:s,processorType:e}=o;return(await a({aptosConfig:s,query:{query:n,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{d as a,C as b,a as c,u as d,h as e,T as f};
2
+ //# sourceMappingURL=chunk-PW3ISXPN.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as h,d as l}from"./chunk-WSVOJSAC.mjs";import{b as E}from"./chunk-4OV7QU2U.mjs";import{a as p}from"./chunk-IBLZ6MZU.mjs";import{a as g}from"./chunk-PRZ7AIGA.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-WIXNX7HY.mjs.map
1
+ import{b as h,d as l}from"./chunk-L2SDI7PI.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-QQM47PHZ.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i,b as o,c as a,d as c,e as p,f as d,g,h as u,i as A,j as y,k as m,l,m as T,n as f,o as C,p as I,q as O,r as P,s as D,t as V,u as S,v as h,w as R,x as G}from"./chunk-QRTZYRH2.mjs";import{a as e}from"./chunk-TRU3EK64.mjs";import{b as s}from"./chunk-KM6UXNC7.mjs";var L=class{constructor(t){this.config=t}async getCollectionData(t){await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:N,collectionName:_,options:n}=t,w=s.from(N),r={collection_name:{_eq:_},creator_address:{_eq:w.toStringLong()}};return n?.tokenStandard&&(r.token_standard={_eq:n?.tokenStandard??"v2"}),d({aptosConfig:this.config,options:{where:r}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),u({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),A({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),y({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),o({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return p({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return m({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return l({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return T({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return f({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return C({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return I({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return O({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return P({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return D({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return V({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return S({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return h({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return R({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return G({aptosConfig:this.config,...t})}};export{L as a};
2
- //# sourceMappingURL=chunk-5XXIIWG7.mjs.map
1
+ import{a as i,b as o,c as a,d as c,e as p,f as d,g,h as u,i as A,j as y,k as m,l,m as T,n as f,o as C,p as I,q as O,r as P,s as D,t as V,u as S,v as h,w as R,x as G}from"./chunk-DP3YPGIK.mjs";import{a as e}from"./chunk-XT5T5LAP.mjs";import{b as s}from"./chunk-JNO7KPMG.mjs";var L=class{constructor(t){this.config=t}async getCollectionData(t){await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:N,collectionName:_,options:n}=t,w=s.from(N),r={collection_name:{_eq:_},creator_address:{_eq:w.toStringLong()}};return n?.tokenStandard&&(r.token_standard={_eq:n?.tokenStandard??"v2"}),d({aptosConfig:this.config,options:{where:r}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),g({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),u({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),A({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),y({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),o({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return p({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return m({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return l({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return T({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return f({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return C({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return I({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return O({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return P({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return D({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return V({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return S({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return h({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return R({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return G({aptosConfig:this.config,...t})}};export{L as a};
2
+ //# sourceMappingURL=chunk-SBCLBDCP.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as i}from"./chunk-6Q2O5G3J.mjs";import{bytesToHex as o,hexToBytes as s}from"@noble/hashes/utils";var u=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(u||{}),a=class e{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return o(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let r=t;if(r.startsWith("0x")&&(r=r.slice(2)),r.length===0)throw new i("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(r.length%2!==0)throw new i("Hex string must be an even number of hex characters.","invalid_length");try{return new e(s(r))}catch(n){throw new i(`Hex string contains invalid hex characters: ${n?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new e(t):e.fromHexString(t)}static hexInputToUint8Array(t){return t instanceof Uint8Array?t:e.fromHexString(t).toUint8Array()}static hexInputToString(t){return e.fromHexInput(t).toString()}static hexInputToStringWithoutPrefix(t){return e.fromHexInput(t).toStringWithoutPrefix()}static isValid(t){try{return e.fromHexString(t),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((r,n)=>r===t.data[n])}},l=e=>new TextDecoder().decode(a.fromHexInput(e).toUint8Array());export{u as a,a as b,l as c};
2
+ //# sourceMappingURL=chunk-SPRNSFUV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/hex.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * Provides reasons for parsing failures related to hexadecimal values.\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses; use AccountAddress instead.\n * When accepting hex data as input to a function, prefer to accept HexInput and\n *\n * A helper class for working with hex data. Hex data, when represented as a string,\n * generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Example usage:\n * ```typescript\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * Other ways to chain the functions together:\n * - `Hex.fromHexString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data - The Uint8Array containing the data to initialize the Hex instance.\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data as a Uint8Array. The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Converts a hex string into a Hex instance, allowing for both prefixed and non-prefixed formats.\n *\n * @param str - A hex string, with or without the 0x prefix.\n *\n * @throws ParsingError - If the hex string is too short, has an odd number of characters, or contains invalid hex characters.\n *\n * @returns Hex - The resulting Hex instance created from the provided string.\n */\n static fromHexString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (error: any) {\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error?.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Hex instance.\n * This function is useful for transforming hexadecimal representations into a structured Hex object for further manipulation.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Hex instance created from the provided hexInput.\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n return Hex.fromHexString(hexInput);\n }\n\n /**\n * Converts an instance of HexInput, which can be a string or a Uint8Array, into a Uint8Array.\n *\n * @param hexInput - A HexInput which can be a string or Uint8Array.\n * @returns A Uint8Array created from the provided hexInput.\n */\n static hexInputToUint8Array(hexInput: HexInput): Uint8Array {\n if (hexInput instanceof Uint8Array) return hexInput;\n return Hex.fromHexString(hexInput).toUint8Array();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string with '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string with '0x' prefix (e.g., \"0x1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToString(\"1234\") // returns \"0x1234\"\n * Hex.hexInputToString(\"0x1234\") // returns \"0x1234\"\n * Hex.hexInputToString(new Uint8Array([0x12, 0x34])) // returns \"0x1234\"\n * ```\n */\n static hexInputToString(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toString();\n }\n\n /**\n * Converts a HexInput (string or Uint8Array) to a hex string without '0x' prefix.\n *\n * @param hexInput - The input to convert, either a hex string (with/without '0x' prefix) or Uint8Array\n * @returns A hex string without '0x' prefix (e.g., \"1234\")\n *\n * @example\n * ```typescript\n * Hex.hexInputToStringWithoutPrefix(\"1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(\"0x1234\") // returns \"1234\"\n * Hex.hexInputToStringWithoutPrefix(new Uint8Array([0x12, 0x34])) // returns \"1234\"\n * ```\n */\n static hexInputToStringWithoutPrefix(hexInput: HexInput): string {\n return Hex.fromHexInput(hexInput).toStringWithoutPrefix();\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided string is a valid hexadecimal representation.\n *\n * @param str - A hex string representing byte data.\n *\n * @returns An object containing:\n * - valid: A boolean indicating whether the string is valid.\n * - invalidReason: The reason for invalidity if the string is not valid.\n * - invalidReasonMessage: A message explaining why the string is invalid.\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromHexString(str);\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Determine if two Hex instances are equal by comparing their underlying byte data.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n */\n equals(other: Hex): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n\nexport const hexToAsciiString = (hex: string) => new TextDecoder().decode(Hex.fromHexInput(hex).toUint8Array());\n"],"mappings":"yCAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAOhC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBAHVA,OAAA,IA8BCC,EAAN,MAAMC,CAAI,CAQf,YAAYC,EAAkB,CAC5B,KAAK,KAAOA,CACd,CAWA,cAA2B,CACzB,OAAO,KAAK,IACd,CAOA,uBAAgC,CAC9B,OAAOC,EAAW,KAAK,IAAI,CAC7B,CAOA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAeA,OAAO,cAAcC,EAAkB,CACrC,IAAIC,EAAQD,EAMZ,GAJIC,EAAM,WAAW,IAAI,IACvBA,EAAQA,EAAM,MAAM,CAAC,GAGnBA,EAAM,SAAW,EACnB,MAAM,IAAIC,EACR,4FACA,WACF,EAGF,GAAID,EAAM,OAAS,IAAM,EACvB,MAAM,IAAIC,EAAa,uDAAwD,gBAA+B,EAGhH,GAAI,CACF,OAAO,IAAIL,EAAIM,EAAWF,CAAK,CAAC,CAClC,OAASG,EAAY,CACnB,MAAM,IAAIF,EACR,+CAA+CE,GAAO,OAAO,GAC7D,mBACF,CACF,CACF,CASA,OAAO,aAAaC,EAAyB,CAC3C,OAAIA,aAAoB,WAAmB,IAAIR,EAAIQ,CAAQ,EACpDR,EAAI,cAAcQ,CAAQ,CACnC,CAQA,OAAO,qBAAqBA,EAAgC,CAC1D,OAAIA,aAAoB,WAAmBA,EACpCR,EAAI,cAAcQ,CAAQ,EAAE,aAAa,CAClD,CAeA,OAAO,iBAAiBA,EAA4B,CAClD,OAAOR,EAAI,aAAaQ,CAAQ,EAAE,SAAS,CAC7C,CAeA,OAAO,8BAA8BA,EAA4B,CAC/D,OAAOR,EAAI,aAAaQ,CAAQ,EAAE,sBAAsB,CAC1D,CAgBA,OAAO,QAAQL,EAA8C,CAC3D,GAAI,CACF,OAAAH,EAAI,cAAcG,CAAG,EACd,CAAE,MAAO,EAAK,CACvB,OAASI,EAAY,CACnB,MAAO,CACL,MAAO,GACP,cAAeA,GAAO,cACtB,qBAAsBA,GAAO,OAC/B,CACF,CACF,CAQA,OAAOE,EAAqB,CAC1B,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF,EAEaC,EAAoBC,GAAgB,IAAI,YAAY,EAAE,OAAOd,EAAI,aAAac,CAAG,EAAE,aAAa,CAAC","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","_Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","other","value","index","hexToAsciiString","hex"]}
@@ -1,2 +1,2 @@
1
- import{c as s}from"./chunk-HDTKBFRX.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-WOOH5MMX.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
- //# sourceMappingURL=chunk-Z36WHOZV.mjs.map
1
+ import{c as s}from"./chunk-PW3ISXPN.mjs";import{w as i,x as m}from"./chunk-VHNX2NUR.mjs";import{b as n}from"./chunk-WKNX43KN.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
+ //# sourceMappingURL=chunk-SU2WB34N.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-AGBA3Y7A.mjs";import{b as a}from"./chunk-KM6UXNC7.mjs";import{a as v}from"./chunk-QQIVWB6G.mjs";var t=class i extends v{deserialize(e){let r=a.deserialize(e),s=n.deserialize(e),l=n.deserialize(e),b=e.deserializeVector(i);return new o(r,s,l,b)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return u.load(e);case 1:return c.load(e);case 2:return p.load(e);case 3:return z.load(e);case 4:return T.load(e);case 5:return S.load(e);case 6:return f.load(e);case 7:return y.load(e);case 8:return d.load(e);case 9:return g.load(e);case 10:return h.load(e);case 255:return U.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${r}`)}}isBool(){return this instanceof u}isAddress(){return this instanceof T}isGeneric(){return this instanceof U}isSigner(){return this instanceof S}isVector(){return this instanceof f}isStruct(){return this instanceof y}isU8(){return this instanceof c}isU16(){return this instanceof d}isU32(){return this instanceof g}isU64(){return this instanceof p}isU128(){return this instanceof z}isU256(){return this instanceof h}isPrimitive(){return this instanceof S||this instanceof T||this instanceof u||this instanceof c||this instanceof d||this instanceof g||this instanceof p||this instanceof z||this instanceof h}},u=class i extends t{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new i}},c=class i extends t{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new i}},d=class i extends t{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new i}},g=class i extends t{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new i}},p=class i extends t{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new i}},z=class i extends t{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new i}},h=class i extends t{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new i}},T=class i extends t{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new i}},S=class i extends t{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new i}},x=class i extends t{constructor(r){super();this.value=r}toString(){return`&${this.value.toString()}`}serialize(r){r.serializeU32AsUleb128(254)}static load(r){let s=t.deserialize(r);return new i(s)}},U=class i extends t{constructor(r){super();this.value=r;if(r<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(r){r.serializeU32AsUleb128(255),r.serializeU32(this.value)}static load(r){let s=r.deserializeU32();return new i(s)}},f=class i extends t{constructor(r){super();this.value=r}toString(){return`vector<${this.value.toString()}>`}static u8(){return new i(new c)}serialize(r){r.serializeU32AsUleb128(6),this.value.serialize(r)}static load(r){let s=t.deserialize(r);return new i(s)}},y=class i extends t{constructor(r){super();this.value=r}toString(){let r="";return this.value.typeArgs.length>0&&(r=`<${this.value.typeArgs.map(s=>s.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${r}`}serialize(r){r.serializeU32AsUleb128(7),this.value.serialize(r)}static load(r){let s=o.deserialize(r);return new i(s)}isTypeTag(r,s,l){return this.value.moduleName.identifier===s&&this.value.name.identifier===l&&this.value.address.equals(r)}isString(){return this.isTypeTag(a.ONE,"string","String")}isOption(){return this.isTypeTag(a.ONE,"option","Option")}isObject(){return this.isTypeTag(a.ONE,"object","Object")}},o=class i extends v{constructor(e,r,s,l){super(),this.address=e,this.moduleName=r,this.name=s,this.typeArgs=l}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=a.deserialize(e),s=n.deserialize(e),l=n.deserialize(e),b=e.deserializeVector(t);return new i(r,s,l,b)}};function O(){return new o(a.ONE,new n("aptos_coin"),new n("AptosCoin"),[])}function E(){return new o(a.ONE,new n("string"),new n("String"),[])}function V(i){return new o(a.ONE,new n("option"),new n("Option"),[i])}function j(i){return new o(a.ONE,new n("object"),new n("Object"),[i])}export{t as a,u as b,c,d,g as e,p as f,z as g,h,T as i,S as j,x as k,U as l,f as m,y as n,o,O as p,E as q,V as r,j as s};
2
- //# sourceMappingURL=chunk-OTY3NO7Q.mjs.map
1
+ import{a as n}from"./chunk-LGTOOAQI.mjs";import{b as a}from"./chunk-JNO7KPMG.mjs";import{a as v}from"./chunk-AJ5JHBAE.mjs";var t=class i extends v{deserialize(e){let r=a.deserialize(e),s=n.deserialize(e),l=n.deserialize(e),b=e.deserializeVector(i);return new o(r,s,l,b)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return u.load(e);case 1:return c.load(e);case 2:return p.load(e);case 3:return z.load(e);case 4:return T.load(e);case 5:return S.load(e);case 6:return f.load(e);case 7:return y.load(e);case 8:return d.load(e);case 9:return g.load(e);case 10:return h.load(e);case 255:return U.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${r}`)}}isBool(){return this instanceof u}isAddress(){return this instanceof T}isGeneric(){return this instanceof U}isSigner(){return this instanceof S}isVector(){return this instanceof f}isStruct(){return this instanceof y}isU8(){return this instanceof c}isU16(){return this instanceof d}isU32(){return this instanceof g}isU64(){return this instanceof p}isU128(){return this instanceof z}isU256(){return this instanceof h}isPrimitive(){return this instanceof S||this instanceof T||this instanceof u||this instanceof c||this instanceof d||this instanceof g||this instanceof p||this instanceof z||this instanceof h}},u=class i extends t{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new i}},c=class i extends t{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new i}},d=class i extends t{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new i}},g=class i extends t{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new i}},p=class i extends t{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new i}},z=class i extends t{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new i}},h=class i extends t{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new i}},T=class i extends t{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new i}},S=class i extends t{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new i}},x=class i extends t{constructor(r){super();this.value=r}toString(){return`&${this.value.toString()}`}serialize(r){r.serializeU32AsUleb128(254)}static load(r){let s=t.deserialize(r);return new i(s)}},U=class i extends t{constructor(r){super();this.value=r;if(r<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(r){r.serializeU32AsUleb128(255),r.serializeU32(this.value)}static load(r){let s=r.deserializeU32();return new i(s)}},f=class i extends t{constructor(r){super();this.value=r}toString(){return`vector<${this.value.toString()}>`}static u8(){return new i(new c)}serialize(r){r.serializeU32AsUleb128(6),this.value.serialize(r)}static load(r){let s=t.deserialize(r);return new i(s)}},y=class i extends t{constructor(r){super();this.value=r}toString(){let r="";return this.value.typeArgs.length>0&&(r=`<${this.value.typeArgs.map(s=>s.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${r}`}serialize(r){r.serializeU32AsUleb128(7),this.value.serialize(r)}static load(r){let s=o.deserialize(r);return new i(s)}isTypeTag(r,s,l){return this.value.moduleName.identifier===s&&this.value.name.identifier===l&&this.value.address.equals(r)}isString(){return this.isTypeTag(a.ONE,"string","String")}isOption(){return this.isTypeTag(a.ONE,"option","Option")}isObject(){return this.isTypeTag(a.ONE,"object","Object")}},o=class i extends v{constructor(e,r,s,l){super(),this.address=e,this.moduleName=r,this.name=s,this.typeArgs=l}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=a.deserialize(e),s=n.deserialize(e),l=n.deserialize(e),b=e.deserializeVector(t);return new i(r,s,l,b)}};function O(){return new o(a.ONE,new n("aptos_coin"),new n("AptosCoin"),[])}function E(){return new o(a.ONE,new n("string"),new n("String"),[])}function V(i){return new o(a.ONE,new n("option"),new n("Option"),[i])}function j(i){return new o(a.ONE,new n("object"),new n("Object"),[i])}export{t as a,u as b,c,d,g as e,p as f,z as g,h,T as i,S as j,x as k,U as l,f as m,y as n,o,O as p,E as q,V as r,j as s};
2
+ //# sourceMappingURL=chunk-T6ADNZE5.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as c,b as o,c as d,d as z,e as m,f as U,g as y}from"./chunk-6FLHGOKP.mjs";import{a as b}from"./chunk-N47FTRYO.mjs";import{a as s}from"./chunk-QQIVWB6G.mjs";import{b as u}from"./chunk-KFNDDPOW.mjs";var t=class i extends s{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof o)){new p(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&e.length===0)r=[];else if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let n=u.fromHexInput(e);r=Array.from(n.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new i(r.map(n=>new o(n)))}static U16(e){return new i(e.map(r=>new d(r)))}static U32(e){return new i(e.map(r=>new z(r)))}static U64(e){return new i(e.map(r=>new m(r)))}static U128(e){return new i(e.map(r=>new U(r)))}static U256(e){return new i(e.map(r=>new y(r)))}static Bool(e){return new i(e.map(r=>new c(r)))}static MoveString(e){return new i(e.map(r=>new a(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let n=e.deserializeUleb128AsU32(),l=new Array;for(let w=0;w<n;w+=1)l.push(r.deserialize(e));return new i(l)}},p=class i extends s{constructor(e){super(),this.value=u.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new i(e.deserializeBytes())}toMoveVector(e){let r=new b(this.bcsToBytes());r.deserializeUleb128AsU32();let n=r.deserializeVector(e);return new t(n)}},a=class i extends s{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let n=new TextEncoder().encode(this.value);t.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new i(e.deserializeStr())}},A=class i extends s{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new t([e]):this.vec=new t([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new i(e!=null?new o(e):void 0)}static U16(e){return new i(e!=null?new d(e):void 0)}static U32(e){return new i(e!=null?new z(e):void 0)}static U64(e){return new i(e!=null?new m(e):void 0)}static U128(e){return new i(e!=null?new U(e):void 0)}static U256(e){return new i(e!=null?new y(e):void 0)}static Bool(e){return new i(e!=null?new c(e):void 0)}static MoveString(e){return new i(e!=null?new a(e):void 0)}static deserialize(e,r){let n=t.deserialize(e,r);return new i(n.values[0])}};export{t as a,p as b,a as c,A as d};
2
- //# sourceMappingURL=chunk-IECDO22V.mjs.map
1
+ import{a as c,b as o,c as d,d as z,e as m,f as U,g as y}from"./chunk-42H7WETG.mjs";import{a as s}from"./chunk-AJ5JHBAE.mjs";import{b as u}from"./chunk-SPRNSFUV.mjs";import{a as b}from"./chunk-D52UKPQF.mjs";var t=class i extends s{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof o)){new p(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&e.length===0)r=[];else if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let n=u.fromHexInput(e);r=Array.from(n.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new i(r.map(n=>new o(n)))}static U16(e){return new i(e.map(r=>new d(r)))}static U32(e){return new i(e.map(r=>new z(r)))}static U64(e){return new i(e.map(r=>new m(r)))}static U128(e){return new i(e.map(r=>new U(r)))}static U256(e){return new i(e.map(r=>new y(r)))}static Bool(e){return new i(e.map(r=>new c(r)))}static MoveString(e){return new i(e.map(r=>new a(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let n=e.deserializeUleb128AsU32(),l=new Array;for(let w=0;w<n;w+=1)l.push(r.deserialize(e));return new i(l)}},p=class i extends s{constructor(e){super(),this.value=u.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new i(e.deserializeBytes())}toMoveVector(e){let r=new b(this.bcsToBytes());r.deserializeUleb128AsU32();let n=r.deserializeVector(e);return new t(n)}},a=class i extends s{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let n=new TextEncoder().encode(this.value);t.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new i(e.deserializeStr())}},A=class i extends s{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new t([e]):this.vec=new t([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new i(e!=null?new o(e):void 0)}static U16(e){return new i(e!=null?new d(e):void 0)}static U32(e){return new i(e!=null?new z(e):void 0)}static U64(e){return new i(e!=null?new m(e):void 0)}static U128(e){return new i(e!=null?new U(e):void 0)}static U256(e){return new i(e!=null?new y(e):void 0)}static Bool(e){return new i(e!=null?new c(e):void 0)}static MoveString(e){return new i(e!=null?new a(e):void 0)}static deserialize(e,r){let n=t.deserialize(e,r);return new i(n.values[0])}};export{t as a,p as b,a as c,A as d};
2
+ //# sourceMappingURL=chunk-TM7OZT3W.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bcs/serializable/moveStructs.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Bool, U128, U16, U256, U32, U64, U8 } from \"./movePrimitives\";\nimport { Serializable, Serializer } from \"../serializer\";\nimport { Deserializable, Deserializer } from \"../deserializer\";\nimport { AnyNumber, HexInput, ScriptTransactionArgumentVariants } from \"../../types\";\nimport { Hex } from \"../../core/hex\";\nimport { EntryFunctionArgument, TransactionArgument } from \"../../transactions/instances/transactionArgument\";\n\n/**\n * This class is the Aptos Typescript SDK representation of a Move `vector<T>`,\n * where `T` represents either a primitive type (`bool`, `u8`, `u64`, ...)\n * or a BCS-serializable struct itself.\n *\n * It is a BCS-serializable, array-like type that contains an array of values of type `T`,\n * where `T` is a class that implements `Serializable`.\n *\n * The purpose of this class is to facilitate easy construction of BCS-serializable\n * Move `vector<T>` types.\n *\n * @example\n * // in Move: `vector<u8> [1, 2, 3, 4];`\n * const vecOfU8s = new MoveVector<U8>([new U8(1), new U8(2), new U8(3), new U8(4)]);\n * // in Move: `std::bcs::to_bytes(vector<u8> [1, 2, 3, 4]);`\n * const bcsBytes = vecOfU8s.toUint8Array();\n *\n * // vector<vector<u8>> [ vector<u8> [1], vector<u8> [1, 2, 3, 4], vector<u8> [5, 6, 7, 8] ];\n * const vecOfVecs = new MoveVector<MoveVector<U8>>([\n * new MoveVector<U8>([new U8(1)]),\n * MoveVector.U8([1, 2, 3, 4]),\n * MoveVector.U8([5, 6, 7, 8]),\n * ]);\n *\n * // vector<Option<u8>> [ std::option::some<u8>(1), std::option::some<u8>(2) ];\n * const vecOfOptionU8s = new MoveVector<MoveOption<U8>>([\n * MoveOption.U8(1),\n * MoveOption.U8(2),\n * ]);\n *\n * // vector<MoveString> [ std::string::utf8(b\"hello\"), std::string::utf8(b\"world\") ];\n * const vecOfStrings = new MoveVector([new MoveString(\"hello\"), new MoveString(\"world\")]);\n * const vecOfStrings2 = MoveVector.MoveString([\"hello\", \"world\"]);\n *\n * @param values an Array<T> of values where T is a class that implements Serializable\n * @returns a `MoveVector<T>` with the values `values`\n */\nexport class MoveVector<T extends Serializable & EntryFunctionArgument>\n extends Serializable\n implements TransactionArgument\n{\n public values: Array<T>;\n\n /**\n * Initializes a new instance of the class with an optional value.\n * This constructor sets up the internal vector based on the provided value.\n *\n * @param values - The initial value to be stored in the vector, or null to initialize an empty vector.\n */\n constructor(values: Array<T>) {\n super();\n this.values = values;\n }\n\n /**\n * Serializes the current instance into a byte sequence suitable for entry functions.\n * This allows the data to be properly formatted for transmission or storage.\n *\n * @param serializer - The serializer instance used to serialize the byte sequence.\n */\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * NOTE: This function will only work when the inner values in the `MoveVector` are `U8`s.\n * @param serializer\n */\n\n /**\n * Serialize the string as a fixed byte string without the length prefix for use in a script function.\n * @param serializer - The serializer used to convert the byte vector into a format suitable for a script function.\n */\n serializeForScriptFunction(serializer: Serializer): void {\n // This checks if the type of a non-empty vector is of type other than U8. If so, we use the Serialized\n // transaction argument type to serialize the argument.\n if (this.values[0] !== undefined && !(this.values[0] instanceof U8)) {\n const serialized = new Serialized(this.bcsToBytes());\n serialized.serializeForScriptFunction(serializer);\n return;\n }\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8Vector);\n serializer.serialize(this);\n }\n\n /**\n * Factory method to generate a MoveVector<U8> from a `number` or `undefined`.\n *\n * This method allows you to create a MoveVector that encapsulates a U8 value, enabling you to handle optional U8 values\n * effectively.\n *\n * @param values - The values used to fill the MoveVector. If `values` is undefined or null, the resulting MoveVector's\n * `.isSome()` method will return false.\n * @returns A MoveVector<U8> with an inner value `value`.\n *\n * @example\n * ```typescript\n * const v = MoveVector.U8([1, 2, 3, 4]);\n * ```\n */\n static U8(values: Array<number> | HexInput): MoveVector<U8> {\n let numbers: Array<number>;\n\n if (Array.isArray(values) && values.length === 0) {\n // Handle empty array, since it won't have a \"first value\"\n numbers = [];\n } else if (Array.isArray(values) && typeof values[0] === \"number\") {\n numbers = values;\n } else if (typeof values === \"string\") {\n const hex = Hex.fromHexInput(values);\n numbers = Array.from(hex.toUint8Array());\n } else if (values instanceof Uint8Array) {\n numbers = Array.from(values);\n } else {\n throw new Error(\"Invalid input type, must be an number[], Uint8Array, or hex string\");\n }\n\n return new MoveVector<U8>(numbers.map((v) => new U8(v)));\n }\n\n /**\n * Factory method to generate a MoveOption<U16> from a `number` or `null`.\n *\n * This method allows you to create a MoveVector that can either hold a U16 value or be empty.\n *\n * @param values - The value used to fill the MoveVector. If `value` is null or undefined, the resulting MoveVector's\n * `.isSome()` method will return false.\n * @returns A MoveVector<U16> with an inner value `value`.\n * @example\n * ```typescript\n * const v = MoveVector.U16([1, 2, 3, 4]);\n * ```\n\n */\n static U16(values: Array<number>): MoveVector<U16> {\n return new MoveVector<U16>(values.map((v) => new U16(v)));\n }\n\n /**\n * Factory method to generate a MoveVector<U32> from a `number` or `null`.\n *\n * This method allows you to create a MoveVector that can either hold a U32 value or be empty.\n *\n * @param values - The value used to fill the MoveVector. If `value` is null or undefined,\n * the resulting MoveVector's .isSome() method will return false.\n * @returns A MoveVector<U32> with an inner value `value`.\n *\n * @example\n * ```\n * const v = MoveVector.U32([1, 2, 3, 4]);\n * ```\n\n */\n static U32(values: Array<number>): MoveVector<U32> {\n return new MoveVector<U32>(values.map((v) => new U32(v)));\n }\n\n /**\n * Factory method to generate a MoveVector<U64> from a number, bigint, or null/undefined.\n * This allows for the creation of an optional U64 value that can be checked for presence.\n *\n * @param values - The value used to fill the MoveVector. If `value` is undefined or null, the resulting MoveVector's\n * `.isSome()` method will return false.\n * @returns A MoveVector<U64> with an inner value `value`.\n *\n * @example\n * ```typescript\n * const v = MoveVector.U64([1, 2, 3, 4]);\n * ```\n */\n static U64(values: Array<AnyNumber>): MoveVector<U64> {\n return new MoveVector<U64>(values.map((v) => new U64(v)));\n }\n\n /**\n * Factory method to generate a MoveVector<U128> from a number, bigint, or undefined.\n *\n * @param values - The value used to fill the MoveVector. If `value` is undefined, the resulting MoveVector's `.isSome()`\n * method will return false.\n * @returns A MoveVector<U128> with an inner value `value`.\n *\n * @example\n * ```typescript\n * const v = MoveVector.U128([1, 2, 3, 4]);\n * ```\n */\n static U128(values: Array<AnyNumber>): MoveVector<U128> {\n return new MoveVector<U128>(values.map((v) => new U128(v)));\n }\n\n /**\n * Factory method to generate a MoveVector<U256> from a number, bigint, or null/undefined.\n * This allows for the creation of an optional U256 value, enabling checks for presence or absence of a value.\n *\n * @param values - The value used to fill the MoveVector. If `value` is undefined or null,\n * the resulting MoveVector's .isSome() method will return false.\n * @returns A MoveVector<U256> with an inner value `value`.\n *\n * @example\n * ```typescript\n * const v = MoveVector.U256([1, 2, 3, 4]);\n * ```\n */\n static U256(values: Array<AnyNumber>): MoveVector<U256> {\n return new MoveVector<U256>(values.map((v) => new U256(v)));\n }\n\n /**\n * Factory method to generate a MoveVector<Bool> from a `boolean` or `undefined`.\n * This method allows you to create an optional boolean value that can be used in various contexts where a boolean may or may\n * not be present.\n *\n * @param values - The value used to fill the MoveVector. If `value` is undefined, the resulting MoveVector's .isSome() method\n * will return false.\n * @returns A MoveVector<Bool> with an inner value `value`.\n *\n * @example\n * * const v = MoveVector.Bool([true, false, true, false]);\n */\n static Bool(values: Array<boolean>): MoveVector<Bool> {\n return new MoveVector<Bool>(values.map((v) => new Bool(v)));\n }\n\n /**\n * Factory method to generate a MoveVector<MoveString> from a `string` or `undefined`.\n * This function creates a MoveVector that encapsulates a MoveString if the provided value is not null or undefined.\n *\n * @param values - The value used to fill the MoveVector. If `value` is undefined, the resulting MoveVector's .isSome() method\n * will return false.\n * @returns A MoveVector<MoveString> with an inner value `value`.\n *\n * @example\n * const v = MoveVector.MoveString([\"hello\", \"world\"]);\n */\n static MoveString(values: Array<string>): MoveVector<MoveString> {\n return new MoveVector<MoveString>(values.map((v) => new MoveString(v)));\n }\n\n /**\n * Serializes the current object using the provided serializer.\n * This function will serialize the value if it is present.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void;\n serialize(serializer: Serializer): void {\n serializer.serializeVector(this.values);\n }\n\n /**\n * Deserialize a MoveVector of type T, specifically where T is a Serializable and Deserializable type.\n *\n * NOTE: This only works with a depth of one. Generics will not work.\n *\n * NOTE: This will not work with types that aren't of the Serializable class.\n *\n * If you're looking for a more flexible deserialization function, you can use the deserializeVector function\n * in the Deserializer class.\n *\n * @example\n * const vec = MoveVector.deserialize(deserializer, U64);\n * @param deserializer the Deserializer instance to use, with bytes loaded into it already.\n * @param cls the class to typecast the input values to, must be a Serializable and Deserializable type.\n * @returns a MoveVector of the corresponding class T\n *\n */\n static deserialize<T extends Serializable & EntryFunctionArgument>(\n deserializer: Deserializer,\n cls: Deserializable<T>,\n ): MoveVector<T> {\n const length = deserializer.deserializeUleb128AsU32();\n const values = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n values.push(cls.deserialize(deserializer));\n }\n return new MoveVector(values);\n }\n}\n\n/**\n * Represents a serialized data structure that encapsulates a byte array.\n * This class extends the Serializable class and provides methods for serialization\n * and deserialization of byte data, as well as converting to a MoveVector.\n *\n * @extends Serializable\n */\nexport class Serialized extends Serializable implements TransactionArgument {\n public readonly value: Uint8Array;\n\n constructor(value: HexInput) {\n super();\n this.value = Hex.fromHexInput(value).toUint8Array();\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n this.serialize(serializer);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Serialized);\n this.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): Serialized {\n return new Serialized(deserializer.deserializeBytes());\n }\n\n /**\n * Deserialize the bytecode into a MoveVector of the specified type.\n * This function allows you to convert serialized data into a usable MoveVector format.\n *\n * @param cls - The class type of the elements in the MoveVector.\n */\n toMoveVector<T extends Serializable & EntryFunctionArgument>(cls: Deserializable<T>): MoveVector<T> {\n const deserializer = new Deserializer(this.bcsToBytes());\n deserializer.deserializeUleb128AsU32();\n const vec = deserializer.deserializeVector(cls);\n return new MoveVector(vec);\n }\n}\n\n/**\n * Represents a string value that can be serialized and deserialized.\n * This class extends the Serializable base class and provides methods\n * for serializing the string in different contexts, such as for entry\n * functions and script functions.\n *\n * @extends Serializable\n */\nexport class MoveString extends Serializable implements TransactionArgument {\n public value: string;\n\n constructor(value: string) {\n super();\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeStr(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 // Serialize the string as a fixed byte string, i.e., without the length prefix\n const textEncoder = new TextEncoder();\n const fixedStringBytes = textEncoder.encode(this.value);\n // Put those bytes into a vector<u8> and serialize it as a script function argument\n const vectorU8 = MoveVector.U8(fixedStringBytes);\n vectorU8.serializeForScriptFunction(serializer);\n }\n\n static deserialize(deserializer: Deserializer): MoveString {\n return new MoveString(deserializer.deserializeStr());\n }\n}\n\nexport class MoveOption<T extends Serializable & EntryFunctionArgument>\n extends Serializable\n implements EntryFunctionArgument\n{\n private vec: MoveVector<T>;\n\n public readonly value?: T;\n\n constructor(value?: T | null) {\n super();\n if (typeof value !== \"undefined\" && value !== null) {\n this.vec = new MoveVector([value]);\n } else {\n this.vec = new MoveVector([]);\n }\n\n [this.value] = this.vec.values;\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Retrieves the inner value of the MoveOption.\n *\n * This method is inspired by Rust's `Option<T>.unwrap()`, where attempting to unwrap a `None` value results in a panic.\n * This method will throw an error if the value is not present.\n *\n * @example\n * const option = new MoveOption<Bool>(new Bool(true));\n * const value = option.unwrap(); // Returns the Bool instance\n *\n * @throws {Error} Throws an error if the MoveOption does not contain a value.\n *\n * @returns {T} The contained value if present.\n */\n unwrap(): T {\n if (!this.isSome()) {\n throw new Error(\"Called unwrap on a MoveOption with no value\");\n } else {\n return this.vec.values[0];\n }\n }\n\n /**\n * Check if the MoveOption has a value.\n *\n * @returns {boolean} Returns true if there is exactly one value in the MoveOption.\n */\n isSome(): boolean {\n return this.vec.values.length === 1;\n }\n\n serialize(serializer: Serializer): void {\n // serialize 0 or 1\n // if 1, serialize the value\n this.vec.serialize(serializer);\n }\n\n /**\n * Factory method to generate a MoveOption<U8> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U8(1).isSome() === true;\n * MoveOption.U8().isSome() === false;\n * MoveOption.U8(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U8> with an inner value `value`\n */\n static U8(value?: number | null): MoveOption<U8> {\n return new MoveOption<U8>(value !== null && value !== undefined ? new U8(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U16> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U16(1).isSome() === true;\n * MoveOption.U16().isSome() === false;\n * MoveOption.U16(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U16> with an inner value `value`\n */\n static U16(value?: number | null): MoveOption<U16> {\n return new MoveOption<U16>(value !== null && value !== undefined ? new U16(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U32> from a `number` or `undefined`.\n *\n * @example\n * MoveOption.U32(1).isSome() === true;\n * MoveOption.U32().isSome() === false;\n * MoveOption.U32(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U32> with an inner value `value`\n */\n static U32(value?: number | null): MoveOption<U32> {\n return new MoveOption<U32>(value !== null && value !== undefined ? new U32(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U64> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U64(1).isSome() === true;\n * MoveOption.U64().isSome() === false;\n * MoveOption.U64(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U64> with an inner value `value`\n */\n static U64(value?: AnyNumber | null): MoveOption<U64> {\n return new MoveOption<U64>(value !== null && value !== undefined ? new U64(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U128> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U128(1).isSome() === true;\n * MoveOption.U128().isSome() === false;\n * MoveOption.U128(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U128> with an inner value `value`\n */\n static U128(value?: AnyNumber | null): MoveOption<U128> {\n return new MoveOption<U128>(value !== null && value !== undefined ? new U128(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<U256> from a `number` or a `bigint` or `undefined`.\n *\n * @example\n * MoveOption.U256(1).isSome() === true;\n * MoveOption.U256().isSome() === false;\n * MoveOption.U256(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<U256> with an inner value `value`\n */\n static U256(value?: AnyNumber | null): MoveOption<U256> {\n return new MoveOption<U256>(value !== null && value !== undefined ? new U256(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<Bool> from a `boolean` or `undefined`.\n *\n * @example\n * MoveOption.Bool(true).isSome() === true;\n * MoveOption.Bool().isSome() === false;\n * MoveOption.Bool(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<Bool> with an inner value `value`\n */\n static Bool(value?: boolean | null): MoveOption<Bool> {\n return new MoveOption<Bool>(value !== null && value !== undefined ? new Bool(value) : undefined);\n }\n\n /**\n * Factory method to generate a MoveOption<MoveString> from a `string` or `undefined`.\n *\n * @example\n * MoveOption.MoveString(\"hello\").isSome() === true;\n * MoveOption.MoveString(\"\").isSome() === true;\n * MoveOption.MoveString().isSome() === false;\n * MoveOption.MoveString(undefined).isSome() === false;\n * @param value the value used to fill the MoveOption. If `value` is undefined\n * the resulting MoveOption's .isSome() method will return false.\n * @returns a MoveOption<MoveString> with an inner value `value`\n */\n static MoveString(value?: string | null): MoveOption<MoveString> {\n return new MoveOption<MoveString>(value !== null && value !== undefined ? new MoveString(value) : undefined);\n }\n\n static deserialize<U extends Serializable & EntryFunctionArgument>(\n deserializer: Deserializer,\n cls: Deserializable<U>,\n ): MoveOption<U> {\n const vector = MoveVector.deserialize(deserializer, cls);\n return new MoveOption(vector.values[0]);\n }\n}\n"],"mappings":"8MA+CO,IAAMA,EAAN,MAAMC,UACHC,CAEV,CASE,YAAYC,EAAkB,CAC5B,MAAM,EACN,KAAK,OAASA,CAChB,CAQA,0BAA0BC,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAWA,2BAA2BD,EAA8B,CAGvD,GAAI,KAAK,OAAO,CAAC,IAAM,QAAa,EAAE,KAAK,OAAO,CAAC,YAAaE,GAAK,CAChD,IAAIC,EAAW,KAAK,WAAW,CAAC,EACxC,2BAA2BH,CAAU,EAChD,MACF,CACAA,EAAW,uBAAgE,EAC3EA,EAAW,UAAU,IAAI,CAC3B,CAiBA,OAAO,GAAGD,EAAkD,CAC1D,IAAIK,EAEJ,GAAI,MAAM,QAAQL,CAAM,GAAKA,EAAO,SAAW,EAE7CK,EAAU,CAAC,UACF,MAAM,QAAQL,CAAM,GAAK,OAAOA,EAAO,CAAC,GAAM,SACvDK,EAAUL,UACD,OAAOA,GAAW,SAAU,CACrC,IAAMM,EAAMC,EAAI,aAAaP,CAAM,EACnCK,EAAU,MAAM,KAAKC,EAAI,aAAa,CAAC,CACzC,SAAWN,aAAkB,WAC3BK,EAAU,MAAM,KAAKL,CAAM,MAE3B,OAAM,IAAI,MAAM,oEAAoE,EAGtF,OAAO,IAAIF,EAAeO,EAAQ,IAAKG,GAAM,IAAIL,EAAGK,CAAC,CAAC,CAAC,CACzD,CAgBA,OAAO,IAAIR,EAAwC,CACjD,OAAO,IAAIF,EAAgBE,EAAO,IAAKQ,GAAM,IAAIC,EAAID,CAAC,CAAC,CAAC,CAC1D,CAiBA,OAAO,IAAIR,EAAwC,CACjD,OAAO,IAAIF,EAAgBE,EAAO,IAAKQ,GAAM,IAAIE,EAAIF,CAAC,CAAC,CAAC,CAC1D,CAeA,OAAO,IAAIR,EAA2C,CACpD,OAAO,IAAIF,EAAgBE,EAAO,IAAKQ,GAAM,IAAIG,EAAIH,CAAC,CAAC,CAAC,CAC1D,CAcA,OAAO,KAAKR,EAA4C,CACtD,OAAO,IAAIF,EAAiBE,EAAO,IAAKQ,GAAM,IAAII,EAAKJ,CAAC,CAAC,CAAC,CAC5D,CAeA,OAAO,KAAKR,EAA4C,CACtD,OAAO,IAAIF,EAAiBE,EAAO,IAAKQ,GAAM,IAAIK,EAAKL,CAAC,CAAC,CAAC,CAC5D,CAcA,OAAO,KAAKR,EAA0C,CACpD,OAAO,IAAIF,EAAiBE,EAAO,IAAKQ,GAAM,IAAIM,EAAKN,CAAC,CAAC,CAAC,CAC5D,CAaA,OAAO,WAAWR,EAA+C,CAC/D,OAAO,IAAIF,EAAuBE,EAAO,IAAKQ,GAAM,IAAIO,EAAWP,CAAC,CAAC,CAAC,CACxE,CASA,UAAUP,EAA8B,CACtCA,EAAW,gBAAgB,KAAK,MAAM,CACxC,CAmBA,OAAO,YACLe,EACAC,EACe,CACf,IAAMC,EAASF,EAAa,wBAAwB,EAC9ChB,EAAS,IAAI,MACnB,QAASmB,EAAI,EAAGA,EAAID,EAAQC,GAAK,EAC/BnB,EAAO,KAAKiB,EAAI,YAAYD,CAAY,CAAC,EAE3C,OAAO,IAAIlB,EAAWE,CAAM,CAC9B,CACF,EASaI,EAAN,MAAMgB,UAAmBrB,CAA4C,CAG1E,YAAYsB,EAAiB,CAC3B,MAAM,EACN,KAAK,MAAQd,EAAI,aAAac,CAAK,EAAE,aAAa,CACpD,CAEA,UAAUpB,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,CACtC,CAEA,0BAA0BA,EAA8B,CACtD,KAAK,UAAUA,CAAU,CAC3B,CAEA,2BAA2BA,EAA8B,CACvDA,EAAW,uBAAkE,EAC7E,KAAK,UAAUA,CAAU,CAC3B,CAEA,OAAO,YAAYe,EAAwC,CACzD,OAAO,IAAII,EAAWJ,EAAa,iBAAiB,CAAC,CACvD,CAQA,aAA6DC,EAAuC,CAClG,IAAMD,EAAe,IAAIM,EAAa,KAAK,WAAW,CAAC,EACvDN,EAAa,wBAAwB,EACrC,IAAMO,EAAMP,EAAa,kBAAkBC,CAAG,EAC9C,OAAO,IAAIpB,EAAW0B,CAAG,CAC3B,CACF,EAUaR,EAAN,MAAMS,UAAmBzB,CAA4C,CAG1E,YAAYsB,EAAe,CACzB,MAAM,EACN,KAAK,MAAQA,CACf,CAEA,UAAUpB,EAA8B,CACtCA,EAAW,aAAa,KAAK,KAAK,CACpC,CAEA,0BAA0BA,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAEA,2BAA2BD,EAA8B,CAGvD,IAAMwB,EADc,IAAI,YAAY,EACC,OAAO,KAAK,KAAK,EAErC5B,EAAW,GAAG4B,CAAgB,EACtC,2BAA2BxB,CAAU,CAChD,CAEA,OAAO,YAAYe,EAAwC,CACzD,OAAO,IAAIQ,EAAWR,EAAa,eAAe,CAAC,CACrD,CACF,EAEaU,EAAN,MAAMC,UACH5B,CAEV,CAKE,YAAYsB,EAAkB,CAC5B,MAAM,EACF,OAAOA,EAAU,KAAeA,IAAU,KAC5C,KAAK,IAAM,IAAIxB,EAAW,CAACwB,CAAK,CAAC,EAEjC,KAAK,IAAM,IAAIxB,EAAW,CAAC,CAAC,EAG9B,CAAC,KAAK,KAAK,EAAI,KAAK,IAAI,MAC1B,CAEA,0BAA0BI,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD,EAAW,eAAeC,CAAQ,CACpC,CAgBA,QAAY,CACV,GAAK,KAAK,OAAO,EAGf,OAAO,KAAK,IAAI,OAAO,CAAC,EAFxB,MAAM,IAAI,MAAM,6CAA6C,CAIjE,CAOA,QAAkB,CAChB,OAAO,KAAK,IAAI,OAAO,SAAW,CACpC,CAEA,UAAUD,EAA8B,CAGtC,KAAK,IAAI,UAAUA,CAAU,CAC/B,CAaA,OAAO,GAAGoB,EAAuC,CAC/C,OAAO,IAAIM,EAAeN,GAAU,KAA8B,IAAIlB,EAAGkB,CAAK,EAAI,MAAS,CAC7F,CAaA,OAAO,IAAIA,EAAwC,CACjD,OAAO,IAAIM,EAAgBN,GAAU,KAA8B,IAAIZ,EAAIY,CAAK,EAAI,MAAS,CAC/F,CAaA,OAAO,IAAIA,EAAwC,CACjD,OAAO,IAAIM,EAAgBN,GAAU,KAA8B,IAAIX,EAAIW,CAAK,EAAI,MAAS,CAC/F,CAaA,OAAO,IAAIA,EAA2C,CACpD,OAAO,IAAIM,EAAgBN,GAAU,KAA8B,IAAIV,EAAIU,CAAK,EAAI,MAAS,CAC/F,CAaA,OAAO,KAAKA,EAA4C,CACtD,OAAO,IAAIM,EAAiBN,GAAU,KAA8B,IAAIT,EAAKS,CAAK,EAAI,MAAS,CACjG,CAaA,OAAO,KAAKA,EAA4C,CACtD,OAAO,IAAIM,EAAiBN,GAAU,KAA8B,IAAIR,EAAKQ,CAAK,EAAI,MAAS,CACjG,CAaA,OAAO,KAAKA,EAA0C,CACpD,OAAO,IAAIM,EAAiBN,GAAU,KAA8B,IAAIP,EAAKO,CAAK,EAAI,MAAS,CACjG,CAcA,OAAO,WAAWA,EAA+C,CAC/D,OAAO,IAAIM,EAAuBN,GAAU,KAA8B,IAAIN,EAAWM,CAAK,EAAI,MAAS,CAC7G,CAEA,OAAO,YACLL,EACAC,EACe,CACf,IAAMW,EAAS/B,EAAW,YAAYmB,EAAcC,CAAG,EACvD,OAAO,IAAIU,EAAWC,EAAO,OAAO,CAAC,CAAC,CACxC,CACF","names":["MoveVector","_MoveVector","Serializable","values","serializer","bcsBytes","U8","Serialized","numbers","hex","Hex","v","U16","U32","U64","U128","U256","Bool","MoveString","deserializer","cls","length","i","_Serialized","value","Deserializer","vec","_MoveString","fixedStringBytes","MoveOption","_MoveOption","vector"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-AJ5JHBAE.mjs";var e=class extends a{};export{e as a};
2
+ //# sourceMappingURL=chunk-UGTIALNW.mjs.map
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-UIRAXHDH.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as e}from"./chunk-D52UKPQF.mjs";function t(i,r){let l=r.bcsToBytes(),a=new e(l);return i.deserialize(a)}export{t as a};
2
+ //# sourceMappingURL=chunk-UZTJWOLS.mjs.map
@@ -0,0 +1,2 @@
1
+ import{decode as c}from"js-base64";async function u(e){return new Promise(n=>{setTimeout(n,e)})}function d(e){return e instanceof Error?e.message:String(e)}var m=()=>Math.floor(Date.now()/1e3);function g(e){let n=new Date(e*1e3);return n.setMinutes(0),n.setSeconds(0),n.setMilliseconds(0),Math.floor(n.getTime()/1e3)}function l(e){let n=e.replace(/-/g,"+").replace(/_/g,"/"),t=n+"==".substring(0,(3-n.length%3)%3);return c(t)}var p=(e,n)=>e*10**n,f=(e,n)=>e/10**n,r=e=>{let n="";for(let t=2;t<e.length;t+=2)n+=String.fromCharCode(parseInt(e.substring(t,t+2),16));return n},_=e=>{let{account_address:n,module_name:t,struct_name:o}=e,s=r(t),a=r(o);return`${n}::${s}::${a}`},S=e=>typeof e=="object"&&!Array.isArray(e)&&e!==null&&"account_address"in e&&"module_name"in e&&"struct_name"in e&&typeof e.account_address=="string"&&typeof e.module_name=="string"&&typeof e.struct_name=="string";export{u as a,d as b,m as c,g as d,l as e,p as f,f as g,_ as h,S as i};
2
+ //# sourceMappingURL=chunk-V4FKFCBL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { decode } from \"js-base64\";\nimport { MoveStructId } from \"../types\";\n\n/**\n * Sleep for the specified amount of time in milliseconds.\n * This function can be used to introduce delays in asynchronous operations.\n *\n * @param timeMs - The time in milliseconds to sleep.\n */\nexport async function sleep(timeMs: number): Promise<null> {\n return new Promise((resolve) => {\n setTimeout(resolve, timeMs);\n });\n}\n\n/**\n * Get the error message from an unknown error.\n *\n * @param error The error to get the message from\n * @returns The error message\n */\nexport function getErrorMessage(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n\nexport const nowInSeconds = () => Math.floor(Date.now() / 1000);\n\n/**\n * Floors the given timestamp to the nearest whole hour.\n * This function is useful for normalizing timestamps to hourly intervals.\n *\n * @param timestampInSeconds - The timestamp in seconds to be floored.\n */\nexport function floorToWholeHour(timestampInSeconds: number): number {\n const date = new Date(timestampInSeconds * 1000);\n // Reset minutes and seconds to zero\n date.setMinutes(0);\n date.setSeconds(0);\n date.setMilliseconds(0);\n return Math.floor(date.getTime() / 1000);\n}\n\n/**\n * Decodes a base64 URL-encoded string into its original form.\n * This function is useful for converting base64 URL-encoded data back to a readable format.\n *\n * @param base64Url - The base64 URL-encoded string to decode.\n * @returns The decoded string.\n */\nexport function base64UrlDecode(base64Url: string): string {\n // Replace base64url-specific characters\n const base64 = base64Url.replace(/-/g, \"+\").replace(/_/g, \"/\");\n // Pad the string with '=' characters if needed\n const paddedBase64 = base64 + \"==\".substring(0, (3 - (base64.length % 3)) % 3);\n const decodedString = decode(paddedBase64);\n return decodedString;\n}\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * a human-readable amount format to the smallest unit format\n * @example\n * human-readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human-readable format\n * @param decimal The token decimal\n * @returns The value in the smallest units\n */\nexport const convertAmountFromHumanReadableToOnChain = (value: number, decimal: number) => value * 10 ** decimal;\n\n/**\n * Amount is represented in the smallest unit format on chain, this function converts\n * the smallest unit format to a human-readable amount format\n * @example\n * human-readable amount format: 500\n * on chain amount format when decimal is 8: 50000000000\n *\n * @param value The value in human-readable format\n * @param decimal The token decimal\n * @returns The value in the smallest units\n */\nexport const convertAmountFromOnChainToHumanReadable = (value: number, decimal: number) => value / 10 ** decimal;\n\n/**\n * Convert a hex string to an ascii string with the `0x` prefix.\n *\n * `0x6170746f735f636f696e` --> `aptos_coin`\n *\n * @param hex The hex string to convert (e.g. `0x6170746f735f636f696e`)\n * @returns The ascii string\n */\nconst hexToAscii = (hex: string) => {\n let str = \"\";\n for (let n = 2; n < hex.length; n += 2) {\n str += String.fromCharCode(parseInt(hex.substring(n, n + 2), 16));\n }\n return str;\n};\n\n/**\n * Convert an encoded struct to a MoveStructId.\n *\n * @example\n * const structObj = {\n * account_address: \"0x1\",\n * module_name: \"0x6170746f735f636f696e\",\n * struct_name: \"0x4170746f73436f696e\",\n * };\n * // structId is \"0x1::aptos_coin::AptosCoin\"\n * const structId = parseEncodedStruct(structObj);\n *\n * @param structObj The struct with account_address, module_name, and struct_name properties\n * @returns The MoveStructId\n */\nexport const parseEncodedStruct = (structObj: {\n account_address: string;\n module_name: string;\n struct_name: string;\n}): MoveStructId => {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n const { account_address, module_name, struct_name } = structObj;\n const moduleName = hexToAscii(module_name);\n const structName = hexToAscii(struct_name);\n return `${account_address}::${moduleName}::${structName}`;\n};\n\n/**\n * Determines whether the given object is an encoded struct type with the following properties:\n * - account_address: string\n * - module_name: string\n * - struct_name: string\n *\n * @param structObj The object to check\n * @returns Whether the object is an encoded struct type\n */\nexport const isEncodedStruct = (\n structObj: any,\n): structObj is {\n account_address: string;\n module_name: string;\n struct_name: string;\n} =>\n typeof structObj === \"object\" &&\n !Array.isArray(structObj) &&\n structObj !== null &&\n \"account_address\" in structObj &&\n \"module_name\" in structObj &&\n \"struct_name\" in structObj &&\n typeof structObj.account_address === \"string\" &&\n typeof structObj.module_name === \"string\" &&\n typeof structObj.struct_name === \"string\";\n"],"mappings":"AAGA,OAAS,UAAAA,MAAc,YASvB,eAAsBC,EAAMC,EAA+B,CACzD,OAAO,IAAI,QAASC,GAAY,CAC9B,WAAWA,EAASD,CAAM,CAC5B,CAAC,CACH,CAQO,SAASE,EAAgBC,EAAwB,CACtD,OAAOA,aAAiB,MAAQA,EAAM,QAAU,OAAOA,CAAK,CAC9D,CAEO,IAAMC,EAAe,IAAM,KAAK,MAAM,KAAK,IAAI,EAAI,GAAI,EAQvD,SAASC,EAAiBC,EAAoC,CACnE,IAAMC,EAAO,IAAI,KAAKD,EAAqB,GAAI,EAE/C,OAAAC,EAAK,WAAW,CAAC,EACjBA,EAAK,WAAW,CAAC,EACjBA,EAAK,gBAAgB,CAAC,EACf,KAAK,MAAMA,EAAK,QAAQ,EAAI,GAAI,CACzC,CASO,SAASC,EAAgBC,EAA2B,CAEzD,IAAMC,EAASD,EAAU,QAAQ,KAAM,GAAG,EAAE,QAAQ,KAAM,GAAG,EAEvDE,EAAeD,EAAS,KAAK,UAAU,GAAI,EAAKA,EAAO,OAAS,GAAM,CAAC,EAE7E,OADsBZ,EAAOa,CAAY,CAE3C,CAaO,IAAMC,EAA0C,CAACC,EAAeC,IAAoBD,EAAQ,IAAMC,EAa5FC,EAA0C,CAACF,EAAeC,IAAoBD,EAAQ,IAAMC,EAUnGE,EAAcC,GAAgB,CAClC,IAAIC,EAAM,GACV,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,GAAK,EACnCD,GAAO,OAAO,aAAa,SAASD,EAAI,UAAUE,EAAGA,EAAI,CAAC,EAAG,EAAE,CAAC,EAElE,OAAOD,CACT,EAiBaE,EAAsBC,GAIf,CAElB,GAAM,CAAE,gBAAAC,EAAiB,YAAAC,EAAa,YAAAC,CAAY,EAAIH,EAChDI,EAAaT,EAAWO,CAAW,EACnCG,EAAaV,EAAWQ,CAAW,EACzC,MAAO,GAAGF,CAAe,KAAKG,CAAU,KAAKC,CAAU,EACzD,EAWaC,EACXN,GAMA,OAAOA,GAAc,UACrB,CAAC,MAAM,QAAQA,CAAS,GACxBA,IAAc,MACd,oBAAqBA,GACrB,gBAAiBA,GACjB,gBAAiBA,GACjB,OAAOA,EAAU,iBAAoB,UACrC,OAAOA,EAAU,aAAgB,UACjC,OAAOA,EAAU,aAAgB","names":["decode","sleep","timeMs","resolve","getErrorMessage","error","nowInSeconds","floorToWholeHour","timestampInSeconds","date","base64UrlDecode","base64Url","base64","paddedBase64","convertAmountFromHumanReadableToOnChain","value","decimal","convertAmountFromOnChainToHumanReadable","hexToAscii","hex","str","n","parseEncodedStruct","structObj","account_address","module_name","struct_name","moduleName","structName","isEncodedStruct"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-7D3RY73L.mjs";import{a as e,b as n}from"./chunk-LEKBJ2EG.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-7V6RL27I.mjs.map
1
+ import{a as s}from"./chunk-K4TJRYGQ.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-VCY3JGZM.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-LEKBJ2EG.mjs";import{spawn as n}from"child_process";import l from"tree-kill";import{platform as h}from"os";var c=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,s)=>{this.process?.pid&&l(this.process.pid,o=>{o?s(o):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let t="npx",s=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],o=h(),r;o==="win32"?r=n(t,s,{shell:!0}):r=n(t,s),this.process=r,r.stderr?.on("data",e=>{let a=e.toString();console.log(a)}),r.stdout?.on("data",e=>{let a=e.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),s=Date.now()/1e3,o=s;for(;!t&&s+this.MAXIMUM_WAIT_TIME_SEC>o;)await i(1e3),t=await this.checkIfProcessIsUp(),o=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}};export{c as a};
2
- //# sourceMappingURL=chunk-XOCRDV2V.mjs.map
1
+ import{a as i}from"./chunk-V4FKFCBL.mjs";import{spawn as n}from"child_process";import l from"tree-kill";import{platform as h}from"os";var c=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,s)=>{this.process?.pid&&l(this.process.pid,o=>{o?s(o):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let t="npx",s=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],o=h(),r;o==="win32"?r=n(t,s,{shell:!0}):r=n(t,s),this.process=r,r.stderr?.on("data",e=>{let a=e.toString();console.log(a)}),r.stdout?.on("data",e=>{let a=e.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),s=Date.now()/1e3,o=s;for(;!t&&s+this.MAXIMUM_WAIT_TIME_SEC>o;)await i(1e3),t=await this.checkIfProcessIsUp(),o=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}};export{c as a};
2
+ //# sourceMappingURL=chunk-VQZMI3EZ.mjs.map
@@ -0,0 +1,2 @@
1
+ import{b as K}from"./chunk-H457BI3I.mjs";import{i as m,r as u}from"./chunk-XUP6VABV.mjs";import{b as f}from"./chunk-SPRNSFUV.mjs";import{a as y}from"./chunk-D52UKPQF.mjs";var h=class c extends K{constructor(e){let r=m.create(e);super({publicKey:r,...e}),this.publicKey=r}serialize(e){super.serialize(e)}static deserialize(e){let{address:r,proof:l,ephemeralKeyPair:i,jwt:o,uidKey:t,pepper:s,verificationKeyHash:n}=K.partialDeserialize(e),{iss:a,aud:p,uidVal:d}=u({jwt:o,uidKey:t});return new c({address:r,proof:l,ephemeralKeyPair:i,iss:a,uidKey:t,uidVal:d,aud:p,pepper:s,jwt:o,verificationKeyHash:n})}static fromBytes(e){return c.deserialize(new y(f.hexInputToUint8Array(e)))}static create(e){let{address:r,proof:l,jwt:i,ephemeralKeyPair:o,pepper:t,uidKey:s="sub",proofFetchCallback:n,verificationKey:a}=e,{iss:p,aud:d,uidVal:g}=u({jwt:i,uidKey:s});return new c({address:r,proof:l,ephemeralKeyPair:o,iss:p,uidKey:s,uidVal:g,aud:d,pepper:t,jwt:i,proofFetchCallback:n,verificationKeyHash:a?a.hash():void 0})}};export{h as a};
2
+ //# sourceMappingURL=chunk-WGIYSLH6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/KeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { HexInput } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport { getIssAudAndUidVal, Groth16VerificationKey, KeylessPublicKey, ZeroKnowledgeSig } from \"../core/crypto\";\n\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Deserializer, Serializer } from \"../bcs\";\nimport { AbstractKeylessAccount, ProofFetchCallback } from \"./AbstractKeylessAccount\";\nimport { Hex } from \"../core/hex\";\n\n/**\n * Account implementation for the Keyless authentication scheme.\n *\n * Used to represent a Keyless based account and sign transactions with it.\n *\n * Use `KeylessAccount.create()` to instantiate a KeylessAccount with a JWT, proof and EphemeralKeyPair.\n *\n * When the proof expires or the JWT becomes invalid, the KeylessAccount must be instantiated again with a new JWT,\n * EphemeralKeyPair, and corresponding proof.\n */\nexport class KeylessAccount extends AbstractKeylessAccount {\n /**\n * The KeylessPublicKey associated with the account\n */\n readonly publicKey: KeylessPublicKey;\n\n // Use the static constructor 'create' instead.\n\n /**\n * Use the static generator `create(...)` instead.\n * Creates an instance of the KeylessAccount with an optional proof.\n *\n * @param args - The parameters for creating a KeylessAccount.\n * @param args.address - Optional account address associated with the KeylessAccount.\n * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.\n * @param args.iss - A JWT issuer.\n * @param args.uidKey - The claim on the JWT to identify a user. This is typically 'sub' or 'email'.\n * @param args.uidVal - The unique id for this user, intended to be a stable user identifier.\n * @param args.aud - The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's\n * OIDC registration with the identity provider.\n * @param args.pepper - A hexadecimal input used for additional security.\n * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.\n * @param args.proofFetchCallback - Optional callback function for fetching proof.\n * @param args.jwt - A JSON Web Token used for authentication.\n */\n private constructor(args: {\n address?: AccountAddress;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n verificationKeyHash?: HexInput;\n }) {\n const publicKey = KeylessPublicKey.create(args);\n super({ publicKey, ...args });\n this.publicKey = publicKey;\n }\n\n /**\n * Serializes the transaction data into a format suitable for transmission or storage.\n * This function ensures that both the transaction bytes and the proof are properly serialized.\n *\n * @param serializer - The serializer instance used to convert the transaction data into bytes.\n */\n serialize(serializer: Serializer): void {\n super.serialize(serializer);\n }\n\n /**\n * Deserializes the provided deserializer to create a KeylessAccount instance.\n * This function extracts necessary components such as the JWT, UID key, pepper, ephemeral key pair, and proof from the deserializer.\n *\n * @param deserializer - The deserializer instance used to retrieve the serialized data.\n * @returns A KeylessAccount instance created from the deserialized data.\n */\n static deserialize(deserializer: Deserializer): KeylessAccount {\n const { address, proof, ephemeralKeyPair, jwt, uidKey, pepper, verificationKeyHash } =\n AbstractKeylessAccount.partialDeserialize(deserializer);\n const { iss, aud, uidVal } = getIssAudAndUidVal({ jwt, uidKey });\n return new KeylessAccount({\n address,\n proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n verificationKeyHash,\n });\n }\n\n /**\n * Deserialize bytes using this account's information.\n *\n * @param bytes The bytes being interpreted.\n * @returns\n */\n static fromBytes(bytes: HexInput): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(Hex.hexInputToUint8Array(bytes)));\n }\n\n /**\n * Creates a KeylessAccount instance using the provided parameters.\n * This function allows you to set up a KeylessAccount with specific attributes such as address, proof, and JWT.\n * This is used instead of the KeylessAccount constructor.\n *\n * @param args - The parameters for creating a KeylessAccount.\n * @param args.address - Optional account address associated with the KeylessAccount.\n * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.\n * @param args.jwt - A JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.\n * @param args.pepper - A hexadecimal input used for additional security.\n * @param args.uidKey - Optional key for user identification, defaults to \"sub\".\n * @param args.proofFetchCallback - Optional callback function for fetching proof.\n */\n static create(args: {\n address?: AccountAddress;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n proofFetchCallback?: ProofFetchCallback;\n verificationKey?: Groth16VerificationKey;\n }): KeylessAccount {\n const { address, proof, jwt, ephemeralKeyPair, pepper, uidKey = \"sub\", proofFetchCallback, verificationKey } = args;\n\n const { iss, aud, uidVal } = getIssAudAndUidVal({ jwt, uidKey });\n return new KeylessAccount({\n address,\n proof,\n ephemeralKeyPair,\n iss,\n uidKey,\n uidVal,\n aud,\n pepper,\n jwt,\n proofFetchCallback,\n verificationKeyHash: verificationKey ? verificationKey.hash() : undefined,\n });\n }\n}\n"],"mappings":"2KAsBO,IAAMA,EAAN,MAAMC,UAAuBC,CAAuB,CAyBjD,YAAYC,EAYjB,CACD,IAAMC,EAAYC,EAAiB,OAAOF,CAAI,EAC9C,MAAM,CAAE,UAAAC,EAAW,GAAGD,CAAK,CAAC,EAC5B,KAAK,UAAYC,CACnB,CAQA,UAAUE,EAA8B,CACtC,MAAM,UAAUA,CAAU,CAC5B,CASA,OAAO,YAAYC,EAA4C,CAC7D,GAAM,CAAE,QAAAC,EAAS,MAAAC,EAAO,iBAAAC,EAAkB,IAAAC,EAAK,OAAAC,EAAQ,OAAAC,EAAQ,oBAAAC,CAAoB,EACjFZ,EAAuB,mBAAmBK,CAAY,EAClD,CAAE,IAAAQ,EAAK,IAAAC,EAAK,OAAAC,CAAO,EAAIC,EAAmB,CAAE,IAAAP,EAAK,OAAAC,CAAO,CAAC,EAC/D,OAAO,IAAIX,EAAe,CACxB,QAAAO,EACA,MAAAC,EACA,iBAAAC,EACA,IAAAK,EACA,OAAAH,EACA,OAAAK,EACA,IAAAD,EACA,OAAAH,EACA,IAAAF,EACA,oBAAAG,CACF,CAAC,CACH,CAQA,OAAO,UAAUK,EAAiC,CAChD,OAAOlB,EAAe,YAAY,IAAImB,EAAaC,EAAI,qBAAqBF,CAAK,CAAC,CAAC,CACrF,CAgBA,OAAO,OAAOhB,EASK,CACjB,GAAM,CAAE,QAAAK,EAAS,MAAAC,EAAO,IAAAE,EAAK,iBAAAD,EAAkB,OAAAG,EAAQ,OAAAD,EAAS,MAAO,mBAAAU,EAAoB,gBAAAC,CAAgB,EAAIpB,EAEzG,CAAE,IAAAY,EAAK,IAAAC,EAAK,OAAAC,CAAO,EAAIC,EAAmB,CAAE,IAAAP,EAAK,OAAAC,CAAO,CAAC,EAC/D,OAAO,IAAIX,EAAe,CACxB,QAAAO,EACA,MAAAC,EACA,iBAAAC,EACA,IAAAK,EACA,OAAAH,EACA,OAAAK,EACA,IAAAD,EACA,OAAAH,EACA,IAAAF,EACA,mBAAAW,EACA,oBAAqBC,EAAkBA,EAAgB,KAAK,EAAI,MAClE,CAAC,CACH,CACF","names":["KeylessAccount","_KeylessAccount","AbstractKeylessAccount","args","publicKey","KeylessPublicKey","serializer","deserializer","address","proof","ephemeralKeyPair","jwt","uidKey","pepper","verificationKeyHash","iss","aud","uidVal","getIssAudAndUidVal","bytes","Deserializer","Hex","proofFetchCallback","verificationKey"]}
@@ -1,2 +1,2 @@
1
- import{b as p}from"./chunk-CRL4WGOH.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
2
- //# sourceMappingURL=chunk-WOOH5MMX.mjs.map
1
+ import{b as p}from"./chunk-KT3DT5GV.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function E(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function a(e){return o({...e,type:"Pepper"})}async function m(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,E as d,a as e,m as f};
2
+ //# sourceMappingURL=chunk-WKNX43KN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse, AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Options for making a POST request, including the API client configuration.\n */\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\n/**\n * Options for posting a request to Aptos, excluding the type field.\n */\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Executes a POST request to the specified URL with the provided options.\n *\n * @param options - The options for the POST request.\n * @param options.type - The type of the request.\n * @param options.originMethod - The original method that initiated the request.\n * @param options.path - The path for the request.\n * @param options.body - The body content to be sent with the request.\n * @param options.acceptType - The type of response expected from the server.\n * @param options.contentType - The content type of the request body.\n * @param options.params - Additional parameters to include in the request.\n * @param options.aptosConfig - Configuration settings for the Aptos request.\n * @param options.overrides - Any overrides for the default request behavior.\n * @returns The response from the POST request.\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\n/**\n * Sends a request to the Aptos full node using the specified options.\n * This function allows you to interact with the Aptos blockchain by sending requests to the full node.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - Configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - Client-specific configuration settings.\n * @param options.aptosConfig.fullnodeConfig - Full node-specific configuration settings.\n * @param options.overrides - Additional overrides for the request.\n */\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos indexer with the specified options.\n * This function allows you to interact with the Aptos indexer and customize the request using various configurations.\n *\n * @param options - The options for the request to the Aptos indexer.\n * @param options.aptosConfig - Configuration settings specific to the Aptos client and indexer.\n * @param options.aptosConfig.clientConfig - The client configuration settings.\n * @param options.aptosConfig.indexerConfig - The indexer configuration settings.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n */\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos faucet to obtain test tokens.\n * This function modifies the provided configuration to ensure that the API_KEY is not included in the request.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - The configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - The client-specific configuration settings.\n * @param options.aptosConfig.clientConfig.HEADERS - Optional headers to include in the request.\n * @param options.aptosConfig.faucetConfig - The configuration settings specific to the faucet.\n * @param options.overrides - Additional overrides for the request configuration.\n */\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Makes a post request to the pepper service.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to which the request is sent.\n * @param options.headers - The headers to include in the request.\n * @param options.body - The body of the request.\n * @returns A promise that resolves to the response from the pepper service.\n */\nexport async function postAptosPepperService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/**\n * Sends a request to the Aptos proving service with the specified options.\n *\n * @param options - The options for the request to the Aptos proving service.\n * @param options.type - The type of the request, which should be set to AptosApiType.PROVER.\n * @param options.data - The data to be included in the request.\n */\nexport async function postAptosProvingService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PROVER });\n}\n"],"mappings":"yCAsEA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAC9FU,EAAMF,EAAY,cAAcP,CAAI,EAE1C,OAAOU,EACL,CACE,IAAAD,EACA,OAAQ,OACR,aAAAR,EACA,KAAAC,EACA,KAAAC,EACA,YAAAE,EACA,WAAAD,EACA,OAAAE,EACA,UAAAE,CACF,EACAD,EACAR,EAAQ,IACV,CACF,CAYA,eAAsBY,EACpBZ,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,eACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAaA,eAAsBK,EACpBb,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,eACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,cACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,eAAe,OAAQ,CACzF,CACF,CAAC,CACH,CAaA,eAAsBM,EACpBd,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAGlBe,EAAsB,CAC1B,GAAGP,EACH,aAAc,CAAE,GAAGA,EAAY,YAAa,CAC9C,EAEA,cAAOO,GAAqB,cAAc,QAEnChB,EAAe,CACpB,GAAGC,EACH,cACA,UAAW,CACT,GAAGe,EAAoB,aACvB,GAAGA,EAAoB,aACvB,GAAGf,EAAQ,UACX,QAAS,CAAE,GAAGe,EAAoB,cAAc,QAAS,GAAGA,EAAoB,cAAc,OAAQ,CACxG,CACF,CAAC,CACH,CAWA,eAAsBC,EACpBhB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE,CASA,eAAsBiB,EACpBjB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE","names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig","postAptosPepperService","postAptosProvingService"]}
@@ -0,0 +1,2 @@
1
+ var g=(e=>(e.JSON="application/json",e.BCS="application/x-bcs",e.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",e.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",e))(g||{}),d=(t=>(t[t.Bool=0]="Bool",t[t.U8=1]="U8",t[t.U64=2]="U64",t[t.U128=3]="U128",t[t.Address=4]="Address",t[t.Signer=5]="Signer",t[t.Vector=6]="Vector",t[t.Struct=7]="Struct",t[t.U16=8]="U16",t[t.U32=9]="U32",t[t.U256=10]="U256",t[t.Reference=254]="Reference",t[t.Generic=255]="Generic",t))(d||{}),u=(r=>(r[r.U8=0]="U8",r[r.U64=1]="U64",r[r.U128=2]="U128",r[r.Address=3]="Address",r[r.U8Vector=4]="U8Vector",r[r.Bool=5]="Bool",r[r.U16=6]="U16",r[r.U32=7]="U32",r[r.U256=8]="U256",r[r.Serialized=9]="Serialized",r))(u||{}),y=(o=>(o[o.Script=0]="Script",o[o.EntryFunction=2]="EntryFunction",o[o.Multisig=3]="Multisig",o))(y||{}),c=(i=>(i[i.MultiAgentTransaction=0]="MultiAgentTransaction",i[i.FeePayerTransaction=1]="FeePayerTransaction",i))(c||{}),l=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(l||{}),_=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(_||{}),x=(i=>(i.Ed25519="ed25519",i.Secp256k1="secp256k1",i))(x||{}),h=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e[e.Keyless=3]="Keyless",e[e.FederatedKeyless=4]="FederatedKeyless",e))(h||{}),v=(o=>(o[o.Ed25519=0]="Ed25519",o[o.Secp256k1=1]="Secp256k1",o[o.Keyless=3]="Keyless",o))(v||{}),R=(p=>(p[p.Ed25519=0]="Ed25519",p))(R||{}),M=(p=>(p[p.Ed25519=0]="Ed25519",p))(M||{}),m=(p=>(p[p.ZkProof=0]="ZkProof",p))(m||{}),b=(p=>(p[p.Groth16=0]="Groth16",p))(b||{}),k=(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(k||{});function W(n){return n.type==="pending_transaction"}function F(n){return n.type==="user_transaction"}function I(n){return n.type==="genesis_transaction"}function B(n){return n.type==="block_metadata_transaction"}function A(n){return n.type==="state_checkpoint_transaction"}function G(n){return n.type==="validator_transaction"}function O(n){return n.type==="block_epilogue_transaction"}function P(n){return"signature"in n&&n.signature==="ed25519_signature"}function D(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function N(n){return n.type==="multi_agent_signature"}function q(n){return n.type==="fee_payer_signature"}function H(n){return n.type==="multi_ed25519_signature"}var S=(o=>(o.PRIVATE="private",o.PUBLIC="public",o.FRIEND="friend",o))(S||{}),f=(e=>(e.STORE="store",e.DROP="drop",e.KEY="key",e.COPY="copy",e))(f||{}),C=(i=>(i.VALIDATOR="validator",i.FULL_NODE="full_node",i))(C||{}),T=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(T||{}),E=(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",i))(E||{}),U=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(U||{});export{g as a,d as b,u as c,y as d,c as e,l as f,_ as g,x as h,h as i,v as j,R as k,M as l,m,b as n,k as o,W as p,F as q,I as r,B as s,A as t,G as u,O as v,P as w,D as x,N as y,q as z,H as A,S as B,f as C,C as D,T as E,E as F,U as G};
2
+ //# sourceMappingURL=chunk-WQF3IOXC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/types.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Network } from \"../utils/apiEndpoints\";\nimport { OrderBy, TokenStandard } from \"./indexer\";\n\n/**\n * Different MIME types used for data interchange in transactions and responses.\n */\nexport enum MimeType {\n /**\n * JSON representation, used for transaction submission and accept type JSON output\n */\n JSON = \"application/json\",\n /**\n * BCS representation, used for accept type BCS output\n */\n BCS = \"application/x-bcs\",\n /**\n * BCS representation, used for transaction submission in BCS input\n */\n BCS_SIGNED_TRANSACTION = \"application/x.aptos.signed_transaction+bcs\",\n BCS_VIEW_FUNCTION = \"application/x.aptos.view_function+bcs\",\n}\n\n/**\n * Hexadecimal data input for functions, supporting both string and Uint8Array formats.\n */\nexport type HexInput = string | Uint8Array;\n\n/**\n * Variants of type tags used in the system, encompassing various data types and structures.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/language_storage.rs#L27}\n */\nexport enum TypeTagVariants {\n Bool = 0,\n U8 = 1,\n U64 = 2,\n U128 = 3,\n Address = 4,\n Signer = 5,\n Vector = 6,\n Struct = 7,\n U16 = 8,\n U32 = 9,\n U256 = 10,\n Reference = 254, // This is specifically a placeholder and does not represent a real type\n Generic = 255, // This is specifically a placeholder and does not represent a real type\n}\n\n/**\n * Variants of script transaction arguments used in Rust, encompassing various data types for transaction processing.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/third_party/move/move-core/types/src/transaction_argument.rs#L11}\n */\nexport enum ScriptTransactionArgumentVariants {\n U8 = 0,\n U64 = 1,\n U128 = 2,\n Address = 3,\n U8Vector = 4,\n Bool = 5,\n U16 = 6,\n U32 = 7,\n U256 = 8,\n Serialized = 9,\n}\n\n/**\n * The payload for various transaction types in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L478}\n */\nexport enum TransactionPayloadVariants {\n Script = 0,\n EntryFunction = 2,\n Multisig = 3,\n}\n\n/**\n * Variants of transactions used in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/mod.rs#L440}\n */\nexport enum TransactionVariants {\n MultiAgentTransaction = 0,\n FeePayerTransaction = 1,\n}\n\n/**\n * Variants of transaction authenticators used in the system.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L44}\n */\nexport enum TransactionAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n MultiAgent = 2,\n FeePayer = 3,\n SingleSender = 4,\n}\n\n/**\n * Variants of account authenticators used in transactions.\n * {@link https://github.com/aptos-labs/aptos-core/blob/main/types/src/transaction/authenticator.rs#L414}\n */\nexport enum AccountAuthenticatorVariant {\n Ed25519 = 0,\n MultiEd25519 = 1,\n SingleKey = 2,\n MultiKey = 3,\n}\n\n/**\n * Variants of private keys that can comply with the AIP-80 standard.\n * {@link https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md}\n */\nexport enum PrivateKeyVariants {\n Ed25519 = \"ed25519\",\n Secp256k1 = \"secp256k1\",\n}\n\n/**\n * Variants of public keys used in cryptographic operations.\n */\nexport enum AnyPublicKeyVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n FederatedKeyless = 4,\n}\n\n/**\n * Variants of signature types used for cryptographic operations.\n */\nexport enum AnySignatureVariant {\n Ed25519 = 0,\n Secp256k1 = 1,\n Keyless = 3,\n}\n\n/**\n * Variants of ephemeral public keys used in cryptographic operations.\n */\nexport enum EphemeralPublicKeyVariant {\n Ed25519 = 0,\n}\n\n/**\n * Variants of ephemeral signatures used for secure communication.\n */\nexport enum EphemeralSignatureVariant {\n Ed25519 = 0,\n}\n\n/**\n * Variants of ephemeral certificates used in secure transactions.\n */\nexport enum EphemeralCertificateVariant {\n ZkProof = 0,\n}\n\n/**\n * Variants of zero-knowledge proofs used in cryptographic operations.\n */\nexport enum ZkpVariant {\n Groth16 = 0,\n}\n\n/**\n * BCS types\n */\nexport type Uint8 = number;\n\n/**\n * A 16-bit unsigned integer.\n */\nexport type Uint16 = number;\n\n/**\n * A 32-bit unsigned integer.\n */\nexport type Uint32 = number;\n\n/**\n * A 64-bit unsigned integer value.\n */\nexport type Uint64 = bigint;\n\n/**\n * A 128-bit unsigned integer used for precise arithmetic operations.\n */\nexport type Uint128 = bigint;\n\n/**\n * A 256-bit unsigned integer used for precise numerical calculations.\n */\nexport type Uint256 = bigint;\n\n/**\n * A number or a bigint value.\n */\nexport type AnyNumber = number | bigint;\n\n/**\n * Configuration options for initializing the SDK, allowing customization of its behavior and interaction with the Aptos network.\n */\nexport type AptosSettings = {\n readonly network?: Network;\n\n readonly fullnode?: string;\n\n readonly faucet?: string;\n\n readonly indexer?: string;\n\n readonly pepper?: string;\n\n readonly prover?: string;\n\n readonly clientConfig?: ClientConfig;\n\n readonly client?: Client;\n\n readonly fullnodeConfig?: FullNodeConfig;\n\n readonly indexerConfig?: IndexerConfig;\n\n readonly faucetConfig?: FaucetConfig;\n};\n\n/**\n * Defines the parameters for paginating query results, including the starting position and maximum number of items to return.\n * @param offset Specifies the starting position of the query result. Default is 0.\n * @param limit Specifies the maximum number of items to return. Default is 25.\n */\nexport interface PaginationArgs {\n offset?: AnyNumber;\n limit?: number;\n}\n\n/**\n * Represents the arguments for specifying a token standard.\n *\n * @param tokenStandard - Optional standard of the token.\n */\nexport interface TokenStandardArg {\n tokenStandard?: TokenStandard;\n}\n\nexport interface OrderByArg<T extends {}> {\n orderBy?: OrderBy<T>;\n}\n\nexport interface WhereArg<T extends {}> {\n where?: T;\n}\n\n/**\n * QUERY TYPES\n */\n\n/**\n * A configuration object for requests to the server, including API key, extra headers, and cookie handling options.\n */\nexport type ClientConfig = ClientHeadersType & {\n WITH_CREDENTIALS?: boolean;\n API_KEY?: string;\n};\n\n/**\n * A configuration object for a Fullnode, allowing for the inclusion of extra headers in requests.\n */\nexport type FullNodeConfig = ClientHeadersType;\n\n/**\n * An Indexer configuration object for sending requests with additional headers.\n */\nexport type IndexerConfig = ClientHeadersType;\n\n/**\n * A configuration object for a faucet, including optional authentication and headers for requests.\n */\nexport type FaucetConfig = ClientHeadersType & {\n AUTH_TOKEN?: string;\n};\n\n/**\n * General type definition for client headers.\n */\nexport type ClientHeadersType = {\n HEADERS?: Record<string, string | number | boolean>;\n};\n\n/**\n * Represents a client for making requests to a service provider.\n *\n * @param Req - The type of the request payload.\n * @param Res - The type of the response payload.\n */\nexport interface ClientRequest<Req> {\n url: string;\n method: \"GET\" | \"POST\";\n originMethod?: string;\n body?: Req;\n contentType?: string;\n params?: any;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n headers?: Record<string, any>;\n}\n\nexport interface ClientResponse<Res> {\n status: number;\n statusText: string;\n data: Res;\n config?: any;\n request?: any;\n response?: any;\n headers?: any;\n}\n\nexport interface Client {\n /**\n * Sends a request to the specified URL with the given options.\n *\n * @param requestOptions - The options for the request.\n * @param requestOptions.url - The URL to send the request to.\n * @param requestOptions.method - The HTTP method to use, either \"GET\" or \"POST\".\n * @param requestOptions.path - An optional path to append to the URL.\n * @param requestOptions.body - The body of the request, applicable for POST requests.\n * @param requestOptions.contentType - The content type of the request body.\n * @param requestOptions.acceptType - The expected content type of the response.\n * @param requestOptions.params - Optional parameters to include in the request.\n * @param requestOptions.originMethod - An optional method to specify the origin of the request.\n * @param requestOptions.overrides - Optional configuration overrides for the request.\n */\n provider<Req, Res>(requestOptions: ClientRequest<Req>): Promise<ClientResponse<Res>>;\n}\n\n/**\n * The API request type\n *\n * @param url - the url to make the request to, i.e. https://fullnode.devnet.aptoslabs.com/v1\n * @param method - the request method \"GET\" | \"POST\"\n * @param endpoint (optional) - the endpoint to make the request to, i.e. transactions\n * @param body (optional) - the body of the request\n * @param contentType (optional) - the content type to set the `content-type` header to,\n * by default is set to `application/json`\n * @param params (optional) - query params to add to the request\n * @param originMethod (optional) - the local method the request came from\n * @param overrides (optional) - a `ClientConfig` object type to override request data\n */\nexport type AptosRequest = {\n url: string;\n method: \"GET\" | \"POST\";\n path?: string;\n body?: any;\n contentType?: string;\n acceptType?: string;\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n originMethod?: string;\n overrides?: ClientConfig & FullNodeConfig & IndexerConfig & FaucetConfig;\n};\n\n/**\n * The API response type\n *\n * @param status - the response status. i.e. 200\n * @param statusText - the response message\n * @param data the response data\n * @param url the url the request was made to\n * @param headers the response headers\n * @param config (optional) - the request object\n * @param request (optional) - the request object\n */\nexport interface AptosResponse<Req, Res> {\n status: number;\n statusText: string;\n data: Res;\n url: string;\n headers: any;\n config?: any;\n request?: Req;\n}\n\n/**\n * The ledger version of transactions, defaulting to the latest version if not specified.\n */\nexport type LedgerVersionArg = {\n ledgerVersion?: AnyNumber;\n};\n\n/**\n * RESPONSE TYPES\n */\n\n/**\n * The output of the estimate gas API, including the deprioritized estimate for the gas unit price.\n */\nexport type GasEstimation = {\n /**\n * The deprioritized estimate for the gas unit price\n */\n deprioritized_gas_estimate?: number;\n /**\n * The current estimate for the gas unit price\n */\n gas_estimate: number;\n /**\n * The prioritized estimate for the gas unit price\n */\n prioritized_gas_estimate?: number;\n};\n\nexport type MoveResource<T = {}> = {\n type: MoveStructId;\n data: T;\n};\n\n/**\n * The data associated with an account, including its sequence number.\n */\nexport type AccountData = {\n sequence_number: string;\n authentication_key: string;\n};\n\n/**\n * A Move module containing an address.\n */\nexport type MoveModuleBytecode = {\n bytecode: string;\n abi?: MoveModule;\n};\n\n/**\n * TRANSACTION TYPES\n */\n\n/**\n * Different types of transaction responses that can occur in the system.\n */\nexport enum TransactionResponseType {\n Pending = \"pending_transaction\",\n User = \"user_transaction\",\n Genesis = \"genesis_transaction\",\n BlockMetadata = \"block_metadata_transaction\",\n StateCheckpoint = \"state_checkpoint_transaction\",\n Validator = \"validator_transaction\",\n BlockEpilogue = \"block_epilogue_transaction\",\n}\n\n/**\n * The response for a transaction, which can be either pending or committed.\n */\nexport type TransactionResponse = PendingTransactionResponse | CommittedTransactionResponse;\n\n/**\n * The response for a committed transaction, which can be one of several transaction types.\n */\nexport type CommittedTransactionResponse =\n | UserTransactionResponse\n | GenesisTransactionResponse\n | BlockMetadataTransactionResponse\n | StateCheckpointTransactionResponse\n | ValidatorTransactionResponse\n | BlockEpilogueTransactionResponse;\n\n/**\n * Determine if the given transaction response is currently pending.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is pending.\n */\nexport function isPendingTransactionResponse(response: TransactionResponse): response is PendingTransactionResponse {\n return response.type === TransactionResponseType.Pending;\n}\n\n/**\n * Determines if the given transaction response is a user transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is of type User.\n */\nexport function isUserTransactionResponse(response: TransactionResponse): response is UserTransactionResponse {\n return response.type === TransactionResponseType.User;\n}\n\n/**\n * Determines if the given transaction response is a Genesis transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction is a Genesis transaction.\n */\nexport function isGenesisTransactionResponse(response: TransactionResponse): response is GenesisTransactionResponse {\n return response.type === TransactionResponseType.Genesis;\n}\n\n/**\n * Determine if the given transaction response is of type BlockMetadata.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the response is a BlockMetadata transaction.\n */\nexport function isBlockMetadataTransactionResponse(\n response: TransactionResponse,\n): response is BlockMetadataTransactionResponse {\n return response.type === TransactionResponseType.BlockMetadata;\n}\n\n/**\n * Determines if the provided transaction response is a state checkpoint transaction.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction response is of type StateCheckpoint.\n */\nexport function isStateCheckpointTransactionResponse(\n response: TransactionResponse,\n): response is StateCheckpointTransactionResponse {\n return response.type === TransactionResponseType.StateCheckpoint;\n}\n\n/**\n * Determine if the given transaction response is of type Validator.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the transaction response is a Validator type.\n */\nexport function isValidatorTransactionResponse(\n response: TransactionResponse,\n): response is ValidatorTransactionResponse {\n return response.type === TransactionResponseType.Validator;\n}\n\n/**\n * Determines if the given transaction response is of the type Block Epilogue.\n *\n * @param response - The transaction response to evaluate.\n * @returns A boolean indicating whether the response is a Block Epilogue transaction.\n */\nexport function isBlockEpilogueTransactionResponse(\n response: TransactionResponse,\n): response is BlockEpilogueTransactionResponse {\n return response.type === TransactionResponseType.BlockEpilogue;\n}\n\n/**\n * The response for a pending transaction, indicating that the transaction is still being processed.\n */\nexport type PendingTransactionResponse = {\n type: TransactionResponseType.Pending;\n hash: string;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n};\n\n/**\n * The response structure for a user transaction.\n */\nexport type UserTransactionResponse = {\n type: TransactionResponseType.User;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n sender: string;\n sequence_number: string;\n max_gas_amount: string;\n gas_unit_price: string;\n expiration_timestamp_secs: string;\n payload: TransactionPayloadResponse;\n signature?: TransactionSignature;\n /**\n * Events generated by the transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * The response for a genesis transaction, indicating the type of transaction.\n */\nexport type GenesisTransactionResponse = {\n type: TransactionResponseType.Genesis;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash?: string;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n payload: GenesisPayload;\n /**\n * Events emitted during genesis\n */\n events: Array<Event>;\n};\n\n/**\n * The structure representing a blockchain block with its height.\n */\nexport type BlockMetadataTransactionResponse = {\n type: TransactionResponseType.BlockMetadata;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n id: string;\n epoch: string;\n round: string;\n /**\n * The events emitted at the block creation\n */\n events: Array<Event>;\n /**\n * Previous block votes\n */\n previous_block_votes_bitvec: Array<number>;\n proposer: string;\n /**\n * The indices of the proposers who failed to propose\n */\n failed_proposer_indices: Array<number>;\n timestamp: string;\n};\n\n/**\n * The response for a state checkpoint transaction, indicating the type of transaction.\n */\nexport type StateCheckpointTransactionResponse = {\n type: TransactionResponseType.StateCheckpoint;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n};\n\n/**\n * The response for a validator transaction, indicating the type of transaction.\n */\nexport type ValidatorTransactionResponse = {\n type: TransactionResponseType.Validator;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n /**\n * The events emitted by the validator transaction\n */\n events: Array<Event>;\n timestamp: string;\n};\n\n/**\n * Describes the gas state of the block, indicating whether the block gas limit has been reached.\n */\nexport type BlockEndInfo = {\n block_gas_limit_reached: boolean;\n block_output_limit_reached: boolean;\n block_effective_block_gas_units: number;\n block_approx_output_size: number;\n};\n\n/**\n * A transaction executed at the end of a block that tracks data from the entire block.\n */\nexport type BlockEpilogueTransactionResponse = {\n type: TransactionResponseType.BlockEpilogue;\n version: string;\n hash: string;\n state_change_hash: string;\n event_root_hash: string;\n state_checkpoint_hash: string | null;\n gas_used: string;\n /**\n * Whether the transaction was successful\n */\n success: boolean;\n /**\n * The VM status of the transaction, can tell useful information in a failure\n */\n vm_status: string;\n accumulator_root_hash: string;\n /**\n * Final state of resources changed by the transaction\n */\n changes: Array<WriteSetChange>;\n timestamp: string;\n block_end_info: BlockEndInfo | null;\n};\n\n/**\n * WRITESET CHANGE TYPES\n */\n\n/**\n * A union type that encompasses both script and direct write sets for data operations.\n */\nexport type WriteSetChange =\n | WriteSetChangeDeleteModule\n | WriteSetChangeDeleteResource\n | WriteSetChangeDeleteTableItem\n | WriteSetChangeWriteModule\n | WriteSetChangeWriteResource\n | WriteSetChangeWriteTableItem;\n\n/**\n * The structure for a module deletion change in a write set.\n */\nexport type WriteSetChangeDeleteModule = {\n type: string;\n address: string;\n /**\n * State key hash\n */\n state_key_hash: string;\n module: MoveModuleId;\n};\n\n/**\n * The payload for a resource deletion in a write set change.\n */\nexport type WriteSetChangeDeleteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n resource: string;\n};\n\n/**\n * The payload for a write set change that deletes a table item.\n */\nexport type WriteSetChangeDeleteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n data?: DeletedTableData;\n};\n\n/**\n * The structure for a write module change in a write set.\n */\nexport type WriteSetChangeWriteModule = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveModuleBytecode;\n};\n\n/**\n * The resource associated with a write set change, identified by its type.\n */\nexport type WriteSetChangeWriteResource = {\n type: string;\n address: string;\n state_key_hash: string;\n data: MoveResource;\n};\n\n/**\n * The structure for a write operation on a table in a write set change.\n */\nexport type WriteSetChangeWriteTableItem = {\n type: string;\n state_key_hash: string;\n handle: string;\n key: string;\n value: string;\n data?: DecodedTableData;\n};\n\n/**\n * The decoded data for a table, including its key in JSON format.\n */\nexport type DecodedTableData = {\n /**\n * Key of table in JSON\n */\n key: any;\n /**\n * Type of key\n */\n key_type: string;\n /**\n * Value of table in JSON\n */\n value: any;\n /**\n * Type of value\n */\n value_type: string;\n};\n\n/**\n * Data for a deleted table entry.\n */\nexport type DeletedTableData = {\n /**\n * Deleted key\n */\n key: any;\n /**\n * Deleted key type\n */\n key_type: string;\n};\n\n/**\n * The payload for a transaction response, which can be an entry function, script, or multisig payload.\n */\nexport type TransactionPayloadResponse = EntryFunctionPayloadResponse | ScriptPayloadResponse | MultisigPayloadResponse;\n\n/**\n * The response payload for an entry function, containing the type of the entry.\n */\nexport type EntryFunctionPayloadResponse = {\n type: string;\n function: MoveFunctionId;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\n/**\n * The payload for a script response, containing the type of the script.\n */\nexport type ScriptPayloadResponse = {\n type: string;\n code: MoveScriptBytecode;\n /**\n * Type arguments of the function\n */\n type_arguments: Array<string>;\n /**\n * Arguments of the function\n */\n arguments: Array<any>;\n};\n\n/**\n * The response payload for a multisig transaction, containing the type of the transaction.\n */\nexport type MultisigPayloadResponse = {\n type: string;\n multisig_address: string;\n transaction_payload?: EntryFunctionPayloadResponse;\n};\n\n/**\n * The payload for the genesis block containing the type of the payload.\n */\nexport type GenesisPayload = {\n type: string;\n write_set: WriteSet;\n};\n\n/**\n * The bytecode for a Move script.\n */\nexport type MoveScriptBytecode = {\n bytecode: string;\n abi?: MoveFunction;\n};\n\n/**\n * JSON representations of transaction signatures returned from the node API.\n */\nexport type TransactionSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature\n | TransactionMultiAgentSignature\n | TransactionFeePayerSignature;\n\n/**\n * Determine if the provided signature is an Ed25519 signature.\n * This function checks for the presence of the \"signature\" property\n * and verifies that its value is \"ed25519_signature\".\n *\n * @param signature - The transaction signature to be checked.\n * @returns A boolean indicating whether the signature is an Ed25519 signature.\n */\nexport function isEd25519Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"ed25519_signature\";\n}\n\n/**\n * Determine if the provided signature is a valid secp256k1 ECDSA signature.\n *\n * @param signature - The transaction signature to validate.\n * @returns A boolean indicating whether the signature is a secp256k1 ECDSA signature.\n */\nexport function isSecp256k1Signature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return \"signature\" in signature && signature.signature === \"secp256k1_ecdsa_signature\";\n}\n\n/**\n * Determine if the provided transaction signature is a multi-agent signature.\n *\n * @param signature - The transaction signature to evaluate.\n * @returns A boolean indicating whether the signature is a multi-agent signature.\n */\nexport function isMultiAgentSignature(signature: TransactionSignature): signature is TransactionMultiAgentSignature {\n return signature.type === \"multi_agent_signature\";\n}\n\n/**\n * Determine if the provided signature is a fee payer signature.\n *\n * @param signature - The transaction signature to evaluate.\n * @returns A boolean indicating whether the signature is a fee payer signature.\n */\nexport function isFeePayerSignature(signature: TransactionSignature): signature is TransactionFeePayerSignature {\n return signature.type === \"fee_payer_signature\";\n}\n\n/**\n * Determine if the provided signature is of type \"multi_ed25519_signature\".\n *\n * @param signature - The transaction signature to check.\n * @returns A boolean indicating whether the signature is a multi-ed25519 signature.\n */\nexport function isMultiEd25519Signature(\n signature: TransactionSignature,\n): signature is TransactionMultiEd25519Signature {\n return signature.type === \"multi_ed25519_signature\";\n}\n\n/**\n * The signature for a transaction using the Ed25519 algorithm.\n */\nexport type TransactionEd25519Signature = {\n type: string;\n public_key: string;\n signature: \"ed25519_signature\";\n};\n\n/**\n * The structure for a Secp256k1 signature in a transaction.\n */\nexport type TransactionSecp256k1Signature = {\n type: string;\n public_key: string;\n signature: \"secp256k1_ecdsa_signature\";\n};\n\n/**\n * The structure for a multi-signature transaction using Ed25519.\n */\nexport type TransactionMultiEd25519Signature = {\n type: \"multi_ed25519_signature\";\n /**\n * The public keys for the Ed25519 signature\n */\n public_keys: Array<string>;\n /**\n * Signature associated with the public keys in the same order\n */\n signatures: Array<string>;\n /**\n * The number of signatures required for a successful transaction\n */\n threshold: number;\n bitmap: string;\n};\n\n/**\n * The structure for a multi-agent signature in a transaction.\n */\nexport type TransactionMultiAgentSignature = {\n type: \"multi_agent_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n};\n\n/**\n * The signature of the fee payer in a transaction.\n */\nexport type TransactionFeePayerSignature = {\n type: \"fee_payer_signature\";\n sender: AccountSignature;\n /**\n * The other involved parties' addresses\n */\n secondary_signer_addresses: Array<string>;\n /**\n * The associated signatures, in the same order as the secondary addresses\n */\n secondary_signers: Array<AccountSignature>;\n fee_payer_address: string;\n fee_payer_signer: AccountSignature;\n};\n\n/**\n * The union of all single account signatures, including Ed25519, Secp256k1, and MultiEd25519 signatures.\n */\nexport type AccountSignature =\n | TransactionEd25519Signature\n | TransactionSecp256k1Signature\n | TransactionMultiEd25519Signature;\n\nexport type WriteSet = ScriptWriteSet | DirectWriteSet;\n\n/**\n * The set of properties for writing scripts, including the type of script.\n */\nexport type ScriptWriteSet = {\n type: string;\n execute_as: string;\n script: ScriptPayloadResponse;\n};\n\n/**\n * The set of direct write operations, identified by a type string.\n */\nexport type DirectWriteSet = {\n type: string;\n changes: Array<WriteSetChange>;\n events: Array<Event>;\n};\n\n/**\n * The structure for an event's unique identifier, including its creation number.\n */\n\n/**\n * The structure for an event, identified by a unique GUID.\n */\nexport type EventGuid = {\n creation_number: string;\n account_address: string;\n};\n\nexport type Event = {\n guid: EventGuid;\n sequence_number: string;\n type: string;\n /**\n * The JSON representation of the event\n */\n data: any;\n};\n\n/**\n * A number representing a Move uint8 type.\n */\nexport type MoveUint8Type = number;\n\n/**\n * A 16-bit unsigned integer used in the Move programming language.\n */\nexport type MoveUint16Type = number;\n\n/**\n * A 32-bit unsigned integer type used in Move programming.\n */\nexport type MoveUint32Type = number;\n\n/**\n * A string representation of a 64-bit unsigned integer used in Move programming.\n */\nexport type MoveUint64Type = string;\n\n/**\n * A string representing a 128-bit unsigned integer in the Move programming language.\n */\nexport type MoveUint128Type = string;\n\n/**\n * A string representation of a 256-bit unsigned integer used in Move programming.\n */\nexport type MoveUint256Type = string;\n\n/**\n * A string representing a Move address.\n */\nexport type MoveAddressType = string;\n\n/**\n * The type for identifying objects to be moved within the system.\n */\nexport type MoveObjectType = string;\n\n/**\n * The type for move options, which can be a MoveType, null, or undefined.\n */\nexport type MoveOptionType = MoveType | null | undefined;\n\n/**\n * A structure representing a move with a name.\n */\nexport type MoveStructId = `${string}::${string}::${string}`;\n\n/**\n * The move function containing its name. Same as MoveStructId since it reads weird to take a StructId for a Function.\n */\nexport type MoveFunctionId = MoveStructId;\n\n// TODO: Add support for looking up ABI to add proper typing\nexport type MoveStructType = {};\n\n/**\n * A union type that encompasses various data types used in Move, including primitive types, address types, object types, and\n * arrays of MoveType.\n */\nexport type MoveType =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructType\n | Array<MoveType>;\n\n/**\n * Possible Move values acceptable by move functions (entry, view)\n *\n * Map of a Move value to the corresponding TypeScript value\n *\n * `Bool -> boolean`\n *\n * `u8, u16, u32 -> number`\n *\n * `u64, u128, u256 -> string`\n *\n * `String -> string`\n *\n * `Address -> 0x${string}`\n *\n * `Struct - 0x${string}::${string}::${string}`\n *\n * `Object -> 0x${string}`\n *\n * `Vector -> Array<MoveValue>`\n *\n * `Option -> MoveValue | null | undefined`\n */\nexport type MoveValue =\n | boolean\n | string\n | MoveUint8Type\n | MoveUint16Type\n | MoveUint32Type\n | MoveUint64Type\n | MoveUint128Type\n | MoveUint256Type\n | MoveAddressType\n | MoveObjectType\n | MoveStructId\n | MoveOptionType\n | Array<MoveValue>;\n\n/**\n * A string representation of a Move module, formatted as `module_name::function_name`.\n * Module names are case-sensitive.\n */\nexport type MoveModuleId = `${string}::${string}`;\n\n/**\n * Specifies the visibility levels for move functions, controlling access permissions.\n */\nexport enum MoveFunctionVisibility {\n PRIVATE = \"private\",\n PUBLIC = \"public\",\n FRIEND = \"friend\",\n}\n\n/**\n * Abilities related to moving items within the system.\n */\nexport enum MoveAbility {\n STORE = \"store\",\n DROP = \"drop\",\n KEY = \"key\",\n COPY = \"copy\",\n}\n\n/**\n * Move abilities associated with the generic type parameter of a function.\n */\nexport type MoveFunctionGenericTypeParam = {\n constraints: Array<MoveAbility>;\n};\n\n/**\n * A field in a Move struct, identified by its name.\n */\nexport type MoveStructField = {\n name: string;\n type: string;\n};\n\n/**\n * A Move module\n */\nexport type MoveModule = {\n address: string;\n name: string;\n /**\n * Friends of the module\n */\n friends: Array<MoveModuleId>;\n /**\n * Public functions of the module\n */\n exposed_functions: Array<MoveFunction>;\n /**\n * Structs of the module\n */\n structs: Array<MoveStruct>;\n};\n\n/**\n * A move struct\n */\nexport type MoveStruct = {\n name: string;\n /**\n * Whether the struct is a native struct of Move\n */\n is_native: boolean;\n /**\n * Whether the struct is a module event (aka v2 event). This will be false for v1\n * events because the value is derived from the #[event] attribute on the struct in\n * the Move source code. This attribute is only relevant for v2 events.\n */\n is_event: boolean;\n /**\n * Abilities associated with the struct\n */\n abilities: Array<MoveAbility>;\n /**\n * Generic types associated with the struct\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Fields associated with the struct\n */\n fields: Array<MoveStructField>;\n};\n\n/**\n * Move function\n */\nexport type MoveFunction = {\n name: string;\n visibility: MoveFunctionVisibility;\n /**\n * Whether the function can be called as an entry function directly in a transaction\n */\n is_entry: boolean;\n /**\n * Whether the function is a view function or not\n */\n is_view: boolean;\n /**\n * Generic type params associated with the Move function\n */\n generic_type_params: Array<MoveFunctionGenericTypeParam>;\n /**\n * Parameters associated with the move function\n */\n params: Array<string>;\n /**\n * Return type of the function\n */\n return: Array<string>;\n};\n\n/**\n * Roles that can be assigned within the system, indicating different levels of access and functionality.\n */\nexport enum RoleType {\n VALIDATOR = \"validator\",\n FULL_NODE = \"full_node\",\n}\n\n/**\n * Information about the current blockchain ledger, including its chain ID.\n */\nexport type LedgerInfo = {\n /**\n * Chain ID of the current chain\n */\n chain_id: number;\n epoch: string;\n ledger_version: string;\n oldest_ledger_version: string;\n ledger_timestamp: string;\n node_role: RoleType;\n oldest_block_height: string;\n block_height: string;\n /**\n * Git hash of the build of the API endpoint. Can be used to determine the exact\n * software version used by the API endpoint.\n */\n git_hash?: string;\n};\n\n/**\n * A Block type\n */\nexport type Block = {\n block_height: string;\n block_hash: string;\n block_timestamp: string;\n first_version: string;\n last_version: string;\n /**\n * The transactions in the block in sequential order\n */\n transactions?: Array<TransactionResponse>;\n};\n\n// REQUEST TYPES\n\n/**\n * The request payload for the GetTableItem API.\n */\nexport type TableItemRequest = {\n key_type: MoveValue;\n value_type: MoveValue;\n /**\n * The value of the table item's key\n */\n key: any;\n};\n\n/**\n * A list of supported Authentication Key schemes in Aptos, consisting of combinations of signing schemes and derive schemes.\n */\nexport type AuthenticationKeyScheme = SigningScheme | DeriveScheme;\n\n/**\n * Different schemes for signing keys used in cryptographic operations.\n */\nexport enum SigningScheme {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For MultiEd25519PublicKey\n */\n MultiEd25519 = 1,\n /**\n * For SingleKey ecdsa\n */\n SingleKey = 2,\n\n MultiKey = 3,\n}\n\n/**\n * Specifies the signing schemes available for cryptographic operations.\n */\nexport enum SigningSchemeInput {\n /**\n * For Ed25519PublicKey\n */\n Ed25519 = 0,\n /**\n * For Secp256k1Ecdsa\n */\n Secp256k1Ecdsa = 2,\n}\n\n/**\n * Specifies the schemes for deriving account addresses from various data sources.\n */\nexport enum DeriveScheme {\n /**\n * Derives an address using an AUID, used for objects\n */\n DeriveAuid = 251,\n /**\n * Derives an address from another object address\n */\n DeriveObjectAddressFromObject = 252,\n /**\n * Derives an address from a GUID, used for objects\n */\n DeriveObjectAddressFromGuid = 253,\n /**\n * Derives an address from seed bytes, used for named objects\n */\n DeriveObjectAddressFromSeed = 254,\n /**\n * Derives an address from seed bytes, used for resource accounts\n */\n DeriveResourceAccountAddress = 255,\n}\n\n/**\n * Options for configuring the behavior of the waitForTransaction() function.\n */\nexport type WaitForTransactionOptions = {\n timeoutSecs?: number;\n checkSuccess?: boolean;\n // Default behavior is to wait for the indexer. Set this to false to disable waiting.\n waitForIndexer?: boolean;\n};\n\n/**\n * Input type to generate an account using the Ed25519 signing scheme.\n */\nexport type GenerateAccountWithEd25519 = {\n scheme: SigningSchemeInput.Ed25519;\n legacy: boolean;\n};\n\n/**\n * Input type to generate an account with a Single Signer using Secp256k1.\n */\nexport type GenerateAccountWithSingleSignerSecp256k1Key = {\n scheme: SigningSchemeInput.Secp256k1Ecdsa;\n legacy?: false;\n};\n\nexport type GenerateAccount = GenerateAccountWithEd25519 | GenerateAccountWithSingleSignerSecp256k1Key;\n"],"mappings":"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","names":["MimeType","TypeTagVariants","ScriptTransactionArgumentVariants","TransactionPayloadVariants","TransactionVariants","TransactionAuthenticatorVariant","AccountAuthenticatorVariant","PrivateKeyVariants","AnyPublicKeyVariant","AnySignatureVariant","EphemeralPublicKeyVariant","EphemeralSignatureVariant","EphemeralCertificateVariant","ZkpVariant","TransactionResponseType","isPendingTransactionResponse","response","isUserTransactionResponse","isGenesisTransactionResponse","isBlockMetadataTransactionResponse","isStateCheckpointTransactionResponse","isValidatorTransactionResponse","isBlockEpilogueTransactionResponse","isEd25519Signature","signature","isSecp256k1Signature","isMultiAgentSignature","isFeePayerSignature","isMultiEd25519Signature","MoveFunctionVisibility","MoveAbility","RoleType","SigningScheme","SigningSchemeInput","DeriveScheme"]}