@aptos-labs/ts-sdk 1.29.0 → 1.30.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 (693) hide show
  1. package/README.md +2 -2
  2. package/dist/common/{accountAddress-DUCC2ffJ.d.ts → accountAddress-DnSqjhSl.d.ts} +700 -245
  3. package/dist/common/{chunk-HBPH2AD3.js → chunk-7IYTZDXV.js} +1 -1
  4. package/dist/common/chunk-7IYTZDXV.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +123 -126
  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 +5921 -1627
  9. package/dist/common/index.js +8 -8
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/Ed25519Account-DpH9qAcg.d.mts +470 -0
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +6 -5
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +2 -2
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +49 -14
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +42 -4
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +54 -34
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +2 -2
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +446 -161
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +369 -122
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +40 -7
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +102 -14
  37. package/dist/esm/api/aptosConfig.mjs +1 -1
  38. package/dist/esm/api/coin.d.mts +52 -15
  39. package/dist/esm/api/coin.mjs +1 -1
  40. package/dist/esm/api/digitalAsset.d.mts +710 -300
  41. package/dist/esm/api/digitalAsset.mjs +1 -1
  42. package/dist/esm/api/event.d.mts +129 -26
  43. package/dist/esm/api/event.mjs +1 -1
  44. package/dist/esm/api/faucet.d.mts +44 -7
  45. package/dist/esm/api/faucet.mjs +1 -1
  46. package/dist/esm/api/fungibleAsset.d.mts +152 -49
  47. package/dist/esm/api/fungibleAsset.mjs +1 -1
  48. package/dist/esm/api/general.d.mts +171 -55
  49. package/dist/esm/api/general.mjs +1 -1
  50. package/dist/esm/api/index.d.mts +2 -2
  51. package/dist/esm/api/index.mjs +1 -1
  52. package/dist/esm/api/keyless.d.mts +82 -11
  53. package/dist/esm/api/keyless.mjs +1 -1
  54. package/dist/esm/api/object.d.mts +51 -7
  55. package/dist/esm/api/object.mjs +1 -1
  56. package/dist/esm/api/staking.d.mts +86 -17
  57. package/dist/esm/api/staking.mjs +1 -1
  58. package/dist/esm/api/table.d.mts +118 -38
  59. package/dist/esm/api/table.mjs +1 -1
  60. package/dist/esm/api/transaction.d.mts +440 -109
  61. package/dist/esm/api/transaction.mjs +1 -1
  62. package/dist/esm/api/transactionSubmission/build.d.mts +99 -13
  63. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  64. package/dist/esm/api/transactionSubmission/helpers.d.mts +79 -0
  65. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  66. package/dist/esm/api/transactionSubmission/management.d.mts +111 -12
  67. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  68. package/dist/esm/api/transactionSubmission/sign.d.mts +97 -3
  69. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  71. package/dist/esm/api/transactionSubmission/simulate.d.mts +140 -15
  72. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/submit.d.mts +104 -13
  74. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  75. package/dist/esm/api/utils.d.mts +26 -3
  76. package/dist/esm/api/utils.mjs +1 -1
  77. package/dist/esm/bcs/consts.mjs +1 -1
  78. package/dist/esm/bcs/deserializer.d.mts +82 -32
  79. package/dist/esm/bcs/deserializer.mjs +1 -1
  80. package/dist/esm/bcs/index.mjs +1 -1
  81. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +25 -6
  82. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/fixedBytes.d.mts +51 -21
  84. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  85. package/dist/esm/bcs/serializable/movePrimitives.d.mts +79 -0
  86. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  87. package/dist/esm/bcs/serializable/moveStructs.d.mts +119 -32
  88. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  89. package/dist/esm/bcs/serializer.d.mts +111 -76
  90. package/dist/esm/bcs/serializer.mjs +1 -1
  91. package/dist/esm/{chunk-U6Z4FNB7.mjs → chunk-2CJC43CV.mjs} +1 -1
  92. package/dist/esm/chunk-2CJC43CV.mjs.map +1 -0
  93. package/dist/esm/{chunk-P2EIZ7WL.mjs → chunk-2I56E4T2.mjs} +2 -2
  94. package/dist/esm/chunk-2I56E4T2.mjs.map +1 -0
  95. package/dist/esm/{chunk-P3TAY5PP.mjs → chunk-2QRWGJJA.mjs} +2 -2
  96. package/dist/esm/chunk-2QRWGJJA.mjs.map +1 -0
  97. package/dist/esm/chunk-37UZKMJI.mjs +2 -0
  98. package/dist/esm/chunk-37UZKMJI.mjs.map +1 -0
  99. package/dist/esm/chunk-4CDDWSKZ.mjs +2 -0
  100. package/dist/esm/chunk-4CDDWSKZ.mjs.map +1 -0
  101. package/dist/esm/chunk-4OV7QU2U.mjs +2 -0
  102. package/dist/esm/chunk-4OV7QU2U.mjs.map +1 -0
  103. package/dist/esm/{chunk-SWNFKKRE.mjs → chunk-5AAFF2PV.mjs} +2 -2
  104. package/dist/esm/chunk-5AAFF2PV.mjs.map +1 -0
  105. package/dist/esm/chunk-5CCHECTE.mjs +2 -0
  106. package/dist/esm/chunk-5CCHECTE.mjs.map +1 -0
  107. package/dist/esm/{chunk-KUOB4DDE.mjs → chunk-5XXIIWG7.mjs} +2 -2
  108. package/dist/esm/chunk-5XXIIWG7.mjs.map +1 -0
  109. package/dist/esm/chunk-5ZBHIUWG.mjs +2 -0
  110. package/dist/esm/chunk-5ZBHIUWG.mjs.map +1 -0
  111. package/dist/esm/chunk-6AGTDRNM.mjs +2 -0
  112. package/dist/esm/chunk-6AGTDRNM.mjs.map +1 -0
  113. package/dist/esm/chunk-6FLHGOKP.mjs +2 -0
  114. package/dist/esm/chunk-6FLHGOKP.mjs.map +1 -0
  115. package/dist/esm/{chunk-LG7RJQ57.mjs → chunk-6Q2O5G3J.mjs} +1 -1
  116. package/dist/esm/chunk-6Q2O5G3J.mjs.map +1 -0
  117. package/dist/esm/chunk-7D3RY73L.mjs +2 -0
  118. package/dist/esm/chunk-7D3RY73L.mjs.map +1 -0
  119. package/dist/esm/{chunk-QBSU3L5Q.mjs → chunk-7PVIWKGT.mjs} +2 -2
  120. package/dist/esm/chunk-7PVIWKGT.mjs.map +1 -0
  121. package/dist/esm/chunk-7V6RL27I.mjs +2 -0
  122. package/dist/esm/chunk-7V6RL27I.mjs.map +1 -0
  123. package/dist/esm/{chunk-44GYWUSH.mjs → chunk-7XS45O6M.mjs} +1 -1
  124. package/dist/esm/chunk-7XS45O6M.mjs.map +1 -0
  125. package/dist/esm/{chunk-YUNDX5I7.mjs → chunk-AGBA3Y7A.mjs} +2 -2
  126. package/dist/esm/chunk-AGBA3Y7A.mjs.map +1 -0
  127. package/dist/esm/{chunk-OKAQO57B.mjs → chunk-BQXVHY7J.mjs} +2 -2
  128. package/dist/esm/chunk-BQXVHY7J.mjs.map +1 -0
  129. package/dist/esm/chunk-CRL4WGOH.mjs +2 -0
  130. package/dist/esm/chunk-CRL4WGOH.mjs.map +1 -0
  131. package/dist/esm/{chunk-APN6AV5Q.mjs → chunk-D3KBNFZR.mjs} +2 -2
  132. package/dist/esm/chunk-D3KBNFZR.mjs.map +1 -0
  133. package/dist/esm/{chunk-SCHZ67F3.mjs → chunk-D3OEQLUE.mjs} +1 -1
  134. package/dist/esm/{chunk-SCHZ67F3.mjs.map → chunk-D3OEQLUE.mjs.map} +1 -1
  135. package/dist/esm/{chunk-FZ5EYP3D.mjs → chunk-DCUVV3VY.mjs} +2 -2
  136. package/dist/esm/chunk-DCUVV3VY.mjs.map +1 -0
  137. package/dist/esm/{chunk-S2KDCIZN.mjs → chunk-DXQT55L3.mjs} +2 -2
  138. package/dist/esm/chunk-DXQT55L3.mjs.map +1 -0
  139. package/dist/esm/chunk-DZJXOL64.mjs +2 -0
  140. package/dist/esm/chunk-DZJXOL64.mjs.map +1 -0
  141. package/dist/esm/{chunk-Y2GWUE7C.mjs → chunk-EF2PUPUH.mjs} +2 -2
  142. package/dist/esm/chunk-EF2PUPUH.mjs.map +1 -0
  143. package/dist/esm/{chunk-J64ARI4E.mjs → chunk-EKZQ3EYX.mjs} +2 -2
  144. package/dist/esm/chunk-EKZQ3EYX.mjs.map +1 -0
  145. package/dist/esm/{chunk-F76N4MQO.mjs → chunk-EN2HDNFE.mjs} +2 -2
  146. package/dist/esm/chunk-EN2HDNFE.mjs.map +1 -0
  147. package/dist/esm/{chunk-L2QXU6F4.mjs → chunk-FO4F3OJJ.mjs} +2 -2
  148. package/dist/esm/chunk-FO4F3OJJ.mjs.map +1 -0
  149. package/dist/esm/{chunk-HKBBA653.mjs → chunk-FPF4KZ5M.mjs} +2 -2
  150. package/dist/esm/chunk-FPF4KZ5M.mjs.map +1 -0
  151. package/dist/esm/{chunk-OMV7445F.mjs → chunk-FY7TSOUU.mjs} +2 -2
  152. package/dist/esm/chunk-FY7TSOUU.mjs.map +1 -0
  153. package/dist/esm/{chunk-ELYS7CWV.mjs → chunk-GIQQF2PD.mjs} +2 -2
  154. package/dist/esm/chunk-GIQQF2PD.mjs.map +1 -0
  155. package/dist/esm/{chunk-SRPI2FFA.mjs → chunk-GMKKHGXK.mjs} +1 -1
  156. package/dist/esm/chunk-GMKKHGXK.mjs.map +1 -0
  157. package/dist/esm/chunk-GPZRGLU2.mjs +2 -0
  158. package/dist/esm/chunk-GPZRGLU2.mjs.map +1 -0
  159. package/dist/esm/{chunk-TDGQGILY.mjs → chunk-GQABU3RQ.mjs} +1 -1
  160. package/dist/esm/chunk-GQABU3RQ.mjs.map +1 -0
  161. package/dist/esm/{chunk-JH6VLTMS.mjs → chunk-HAMXSLWF.mjs} +2 -2
  162. package/dist/esm/chunk-HAMXSLWF.mjs.map +1 -0
  163. package/dist/esm/{chunk-AH44UPM4.mjs → chunk-HBIDHQ2M.mjs} +1 -1
  164. package/dist/esm/chunk-HBIDHQ2M.mjs.map +1 -0
  165. package/dist/esm/{chunk-QPB6EJVM.mjs → chunk-HCV3NGLS.mjs} +2 -2
  166. package/dist/esm/chunk-HCV3NGLS.mjs.map +1 -0
  167. package/dist/esm/{chunk-2BTTX2KO.mjs → chunk-HDTKBFRX.mjs} +2 -2
  168. package/dist/esm/chunk-HDTKBFRX.mjs.map +1 -0
  169. package/dist/esm/chunk-HGVZ7ULA.mjs +2 -0
  170. package/dist/esm/chunk-HGVZ7ULA.mjs.map +1 -0
  171. package/dist/esm/{chunk-6EMN3BOV.mjs → chunk-I2NMCLNW.mjs} +1 -1
  172. package/dist/esm/chunk-I2NMCLNW.mjs.map +1 -0
  173. package/dist/esm/chunk-IBLZ6MZU.mjs +2 -0
  174. package/dist/esm/chunk-IBLZ6MZU.mjs.map +1 -0
  175. package/dist/esm/chunk-IECDO22V.mjs +2 -0
  176. package/dist/esm/chunk-IECDO22V.mjs.map +1 -0
  177. package/dist/esm/{chunk-KUZ2YTJH.mjs → chunk-IFHQSZLK.mjs} +2 -2
  178. package/dist/esm/chunk-IFHQSZLK.mjs.map +1 -0
  179. package/dist/esm/{chunk-EXP5STXZ.mjs → chunk-J245N3XF.mjs} +1 -1
  180. package/dist/esm/chunk-J245N3XF.mjs.map +1 -0
  181. package/dist/esm/{chunk-7VKFXX5Q.mjs → chunk-JDYASF3E.mjs} +2 -2
  182. package/dist/esm/chunk-JDYASF3E.mjs.map +1 -0
  183. package/dist/esm/{chunk-H6YNXJNF.mjs → chunk-JGNMNCQB.mjs} +2 -2
  184. package/dist/esm/chunk-JGNMNCQB.mjs.map +1 -0
  185. package/dist/esm/{chunk-R76DHMGR.mjs → chunk-JNHFQTFC.mjs} +2 -2
  186. package/dist/esm/chunk-JNHFQTFC.mjs.map +1 -0
  187. package/dist/esm/{chunk-5PCNWXRN.mjs → chunk-JY3JJ55D.mjs} +2 -2
  188. package/dist/esm/chunk-JY3JJ55D.mjs.map +1 -0
  189. package/dist/esm/{chunk-3W2DHZXK.mjs → chunk-K6MZXKVV.mjs} +2 -2
  190. package/dist/esm/chunk-K6MZXKVV.mjs.map +1 -0
  191. package/dist/esm/{chunk-FVA2OPG4.mjs → chunk-KDMSOCZY.mjs} +1 -1
  192. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-KFNDDPOW.mjs} +2 -2
  193. package/dist/esm/chunk-KFNDDPOW.mjs.map +1 -0
  194. package/dist/esm/{chunk-4TB3AWQE.mjs → chunk-KFSVKIFO.mjs} +2 -2
  195. package/dist/esm/chunk-KFSVKIFO.mjs.map +1 -0
  196. package/dist/esm/chunk-KIW54KWR.mjs +2 -0
  197. package/dist/esm/{chunk-OHRL766V.mjs → chunk-KM6UXNC7.mjs} +2 -2
  198. package/dist/esm/chunk-KM6UXNC7.mjs.map +1 -0
  199. package/dist/esm/{chunk-NWOMSL6K.mjs → chunk-KRVLR3L4.mjs} +2 -2
  200. package/dist/esm/chunk-KRVLR3L4.mjs.map +1 -0
  201. package/dist/esm/{chunk-4HR32TSY.mjs → chunk-KSKQVOBA.mjs} +2 -2
  202. package/dist/esm/chunk-KSKQVOBA.mjs.map +1 -0
  203. package/dist/esm/{chunk-ZROQH5YL.mjs → chunk-KSUZS6EL.mjs} +2 -2
  204. package/dist/esm/chunk-L5I7F3NZ.mjs +2 -0
  205. package/dist/esm/chunk-L5I7F3NZ.mjs.map +1 -0
  206. package/dist/esm/{chunk-MAMPMCO7.mjs → chunk-LD5MUWGW.mjs} +2 -2
  207. package/dist/esm/chunk-LD5MUWGW.mjs.map +1 -0
  208. package/dist/esm/{chunk-UAL27G6B.mjs → chunk-LEKBJ2EG.mjs} +1 -1
  209. package/dist/esm/chunk-LEKBJ2EG.mjs.map +1 -0
  210. package/dist/esm/chunk-LZS7BQ2B.mjs +2 -0
  211. package/dist/esm/chunk-LZS7BQ2B.mjs.map +1 -0
  212. package/dist/esm/{chunk-53RB2PRH.mjs → chunk-N3OYD6VZ.mjs} +2 -2
  213. package/dist/esm/chunk-N3OYD6VZ.mjs.map +1 -0
  214. package/dist/esm/{chunk-KEYAPEAX.mjs → chunk-N47FTRYO.mjs} +1 -1
  215. package/dist/esm/chunk-N47FTRYO.mjs.map +1 -0
  216. package/dist/esm/{chunk-YDZBU2DJ.mjs → chunk-NODYW7DM.mjs} +2 -2
  217. package/dist/esm/chunk-NODYW7DM.mjs.map +1 -0
  218. package/dist/esm/{chunk-HVMFZF6P.mjs → chunk-NV6DHDM3.mjs} +2 -2
  219. package/dist/esm/chunk-NV6DHDM3.mjs.map +1 -0
  220. package/dist/esm/{chunk-YU3IYJRL.mjs → chunk-OLPI7QAH.mjs} +2 -2
  221. package/dist/esm/chunk-OLPI7QAH.mjs.map +1 -0
  222. package/dist/esm/chunk-ONBFUPEC.mjs +2 -0
  223. package/dist/esm/chunk-ONBFUPEC.mjs.map +1 -0
  224. package/dist/esm/{chunk-A42BPAD4.mjs → chunk-OS2EG6AE.mjs} +2 -2
  225. package/dist/esm/chunk-OS2EG6AE.mjs.map +1 -0
  226. package/dist/esm/chunk-OTY3NO7Q.mjs +2 -0
  227. package/dist/esm/chunk-OTY3NO7Q.mjs.map +1 -0
  228. package/dist/esm/{chunk-MNVUSJEK.mjs → chunk-OV5UQ75K.mjs} +2 -2
  229. package/dist/esm/chunk-OV5UQ75K.mjs.map +1 -0
  230. package/dist/esm/{chunk-P5V7OZNN.mjs → chunk-OZN3OOJV.mjs} +2 -2
  231. package/dist/esm/chunk-OZN3OOJV.mjs.map +1 -0
  232. package/dist/esm/{chunk-WRRQ7L5K.mjs → chunk-PCLU4KLY.mjs} +2 -2
  233. package/dist/esm/chunk-PCLU4KLY.mjs.map +1 -0
  234. package/dist/esm/{chunk-Q3TAEOH5.mjs → chunk-PGZWRY7A.mjs} +2 -2
  235. package/dist/esm/chunk-PGZWRY7A.mjs.map +1 -0
  236. package/dist/esm/{chunk-X34JJPW5.mjs → chunk-PHG2IWZW.mjs} +2 -2
  237. package/dist/esm/chunk-PHG2IWZW.mjs.map +1 -0
  238. package/dist/esm/{chunk-LR65XHSF.mjs → chunk-PHP47DI4.mjs} +2 -2
  239. package/dist/esm/chunk-PHP47DI4.mjs.map +1 -0
  240. package/dist/esm/chunk-PRZ7AIGA.mjs +2 -0
  241. package/dist/esm/chunk-PRZ7AIGA.mjs.map +1 -0
  242. package/dist/esm/{chunk-6UZ3VI5Y.mjs → chunk-QBP4XJT5.mjs} +2 -2
  243. package/dist/esm/chunk-QBP4XJT5.mjs.map +1 -0
  244. package/dist/esm/{chunk-5VD4MHB3.mjs → chunk-QBWGWHJK.mjs} +2 -2
  245. package/dist/esm/chunk-QBWGWHJK.mjs.map +1 -0
  246. package/dist/esm/chunk-QQIVWB6G.mjs +2 -0
  247. package/dist/esm/chunk-QQIVWB6G.mjs.map +1 -0
  248. package/dist/esm/{chunk-367OG3DB.mjs → chunk-QRTZYRH2.mjs} +2 -2
  249. package/dist/esm/chunk-QRTZYRH2.mjs.map +1 -0
  250. package/dist/esm/{chunk-2F7Z7RMW.mjs → chunk-R3Y6WH2U.mjs} +2 -2
  251. package/dist/esm/chunk-R3Y6WH2U.mjs.map +1 -0
  252. package/dist/esm/{chunk-S2W4D6NZ.mjs → chunk-RAXP3STS.mjs} +2 -2
  253. package/dist/esm/chunk-RAXP3STS.mjs.map +1 -0
  254. package/dist/esm/{chunk-F3M2UQA4.mjs → chunk-RNAKZVRN.mjs} +2 -2
  255. package/dist/esm/chunk-RNAKZVRN.mjs.map +1 -0
  256. package/dist/esm/{chunk-TQWGQLM6.mjs → chunk-RUDS7RSB.mjs} +2 -2
  257. package/dist/esm/chunk-RUDS7RSB.mjs.map +1 -0
  258. package/dist/esm/{chunk-GMBSQDPO.mjs → chunk-S3FVA55H.mjs} +2 -2
  259. package/dist/esm/chunk-S3FVA55H.mjs.map +1 -0
  260. package/dist/esm/{chunk-BSAHPS6E.mjs → chunk-TIZL5YVP.mjs} +2 -2
  261. package/dist/esm/chunk-TIZL5YVP.mjs.map +1 -0
  262. package/dist/esm/{chunk-SDWE6WMM.mjs → chunk-TRU3EK64.mjs} +2 -2
  263. package/dist/esm/chunk-TRU3EK64.mjs.map +1 -0
  264. package/dist/esm/chunk-UI3AKMZX.mjs +2 -0
  265. package/dist/esm/{chunk-UAEODDZS.mjs.map → chunk-UI3AKMZX.mjs.map} +1 -1
  266. package/dist/esm/{chunk-ADE6MVXC.mjs → chunk-UKAXCARD.mjs} +2 -2
  267. package/dist/esm/chunk-UKAXCARD.mjs.map +1 -0
  268. package/dist/esm/{chunk-NMD45OTM.mjs → chunk-V5NDNR36.mjs} +2 -2
  269. package/dist/esm/chunk-V5NDNR36.mjs.map +1 -0
  270. package/dist/esm/{chunk-O2BPA6TS.mjs → chunk-VQTEGTUQ.mjs} +2 -2
  271. package/dist/esm/chunk-VQTEGTUQ.mjs.map +1 -0
  272. package/dist/esm/{chunk-45IUUCAV.mjs → chunk-WIXNX7HY.mjs} +2 -2
  273. package/dist/esm/chunk-WIXNX7HY.mjs.map +1 -0
  274. package/dist/esm/{chunk-CRA2MFJC.mjs → chunk-WOOH5MMX.mjs} +2 -2
  275. package/dist/esm/chunk-WOOH5MMX.mjs.map +1 -0
  276. package/dist/esm/{chunk-GWSDIX6C.mjs → chunk-WSVOJSAC.mjs} +2 -2
  277. package/dist/esm/chunk-WSVOJSAC.mjs.map +1 -0
  278. package/dist/esm/{chunk-IR4SLC2M.mjs → chunk-WUCPTRXU.mjs} +2 -2
  279. package/dist/esm/chunk-WUCPTRXU.mjs.map +1 -0
  280. package/dist/esm/chunk-XHCALZ7X.mjs +2 -0
  281. package/dist/esm/chunk-XHCALZ7X.mjs.map +1 -0
  282. package/dist/esm/{chunk-WJRZWAIS.mjs → chunk-XIY2VORC.mjs} +2 -2
  283. package/dist/esm/chunk-XIY2VORC.mjs.map +1 -0
  284. package/dist/esm/chunk-XOCRDV2V.mjs +2 -0
  285. package/dist/esm/chunk-XOCRDV2V.mjs.map +1 -0
  286. package/dist/esm/{chunk-D3Q4BC3I.mjs → chunk-Z36WHOZV.mjs} +2 -2
  287. package/dist/esm/chunk-Z36WHOZV.mjs.map +1 -0
  288. package/dist/esm/{chunk-BOYYQAB4.mjs → chunk-ZINOJTLU.mjs} +2 -2
  289. package/dist/esm/chunk-ZINOJTLU.mjs.map +1 -0
  290. package/dist/esm/{chunk-RXE6NNOL.mjs → chunk-ZS3EWM5A.mjs} +2 -2
  291. package/dist/esm/chunk-ZS3EWM5A.mjs.map +1 -0
  292. package/dist/esm/{chunk-GDUAFXIQ.mjs → chunk-ZUTOMGB7.mjs} +2 -2
  293. package/dist/esm/chunk-ZUTOMGB7.mjs.map +1 -0
  294. package/dist/esm/cli/index.mjs +1 -1
  295. package/dist/esm/cli/localNode.d.mts +26 -10
  296. package/dist/esm/cli/localNode.mjs +1 -1
  297. package/dist/esm/cli/move.d.mts +104 -123
  298. package/dist/esm/cli/move.mjs +1 -1
  299. package/dist/esm/client/core.d.mts +21 -6
  300. package/dist/esm/client/core.mjs +1 -1
  301. package/dist/esm/client/get.d.mts +34 -6
  302. package/dist/esm/client/get.mjs +1 -1
  303. package/dist/esm/client/index.mjs +1 -1
  304. package/dist/esm/client/post.d.mts +63 -6
  305. package/dist/esm/client/post.mjs +1 -1
  306. package/dist/esm/client/types.d.mts +21 -8
  307. package/dist/esm/client/types.mjs +1 -1
  308. package/dist/esm/core/account/index.mjs +1 -1
  309. package/dist/esm/core/account/utils/address.d.mts +1 -1
  310. package/dist/esm/core/account/utils/address.mjs +1 -1
  311. package/dist/esm/core/account/utils/index.mjs +1 -1
  312. package/dist/esm/core/accountAddress.d.mts +63 -48
  313. package/dist/esm/core/accountAddress.mjs +1 -1
  314. package/dist/esm/core/authenticationKey.d.mts +1 -1
  315. package/dist/esm/core/authenticationKey.mjs +1 -1
  316. package/dist/esm/core/common.d.mts +6 -0
  317. package/dist/esm/core/common.mjs +1 -1
  318. package/dist/esm/core/crypto/ed25519.d.mts +77 -26
  319. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  320. package/dist/esm/core/crypto/ephemeral.d.mts +36 -14
  321. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  322. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -14
  323. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  324. package/dist/esm/core/crypto/hdKey.d.mts +9 -6
  325. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  326. package/dist/esm/core/crypto/index.d.mts +1 -1
  327. package/dist/esm/core/crypto/index.mjs +1 -1
  328. package/dist/esm/core/crypto/keyless.d.mts +126 -45
  329. package/dist/esm/core/crypto/keyless.mjs +1 -1
  330. package/dist/esm/core/crypto/multiEd25519.d.mts +45 -6
  331. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  332. package/dist/esm/core/crypto/multiKey.d.mts +58 -7
  333. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  334. package/dist/esm/core/crypto/poseidon.d.mts +35 -5
  335. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  336. package/dist/esm/core/crypto/privateKey.d.mts +10 -6
  337. package/dist/esm/core/crypto/proof.d.mts +2 -6
  338. package/dist/esm/core/crypto/proof.mjs +1 -1
  339. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  340. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  341. package/dist/esm/core/crypto/secp256k1.d.mts +72 -27
  342. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  343. package/dist/esm/core/crypto/signature.d.mts +5 -4
  344. package/dist/esm/core/crypto/signature.mjs +1 -1
  345. package/dist/esm/core/crypto/singleKey.d.mts +63 -5
  346. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  347. package/dist/esm/core/crypto/utils.mjs +1 -1
  348. package/dist/esm/core/hex.d.mts +27 -28
  349. package/dist/esm/core/hex.mjs +1 -1
  350. package/dist/esm/core/index.d.mts +1 -1
  351. package/dist/esm/core/index.mjs +1 -1
  352. package/dist/esm/index.d.mts +2 -2
  353. package/dist/esm/index.mjs +1 -1
  354. package/dist/esm/internal/account.d.mts +191 -12
  355. package/dist/esm/internal/account.mjs +1 -1
  356. package/dist/esm/internal/ans.d.mts +206 -14
  357. package/dist/esm/internal/ans.mjs +1 -1
  358. package/dist/esm/internal/coin.d.mts +13 -1
  359. package/dist/esm/internal/coin.mjs +1 -1
  360. package/dist/esm/internal/digitalAsset.d.mts +330 -2
  361. package/dist/esm/internal/digitalAsset.mjs +1 -1
  362. package/dist/esm/internal/event.d.mts +39 -0
  363. package/dist/esm/internal/event.mjs +1 -1
  364. package/dist/esm/internal/faucet.d.mts +14 -0
  365. package/dist/esm/internal/faucet.mjs +1 -1
  366. package/dist/esm/internal/fungibleAsset.d.mts +48 -2
  367. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  368. package/dist/esm/internal/general.d.mts +46 -0
  369. package/dist/esm/internal/general.mjs +1 -1
  370. package/dist/esm/internal/keyless.d.mts +38 -2
  371. package/dist/esm/internal/keyless.mjs +1 -1
  372. package/dist/esm/internal/object.d.mts +21 -0
  373. package/dist/esm/internal/object.mjs +1 -1
  374. package/dist/esm/internal/staking.d.mts +26 -0
  375. package/dist/esm/internal/staking.mjs +1 -1
  376. package/dist/esm/internal/table.d.mts +33 -1
  377. package/dist/esm/internal/table.mjs +1 -1
  378. package/dist/esm/internal/transaction.d.mts +107 -5
  379. package/dist/esm/internal/transaction.mjs +1 -1
  380. package/dist/esm/internal/transactionSubmission.d.mts +72 -29
  381. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  382. package/dist/esm/internal/view.d.mts +1 -1
  383. package/dist/esm/internal/view.mjs +1 -1
  384. package/dist/esm/publicKey-_tPa99ea.d.mts +151 -0
  385. package/dist/esm/transactions/authenticator/account.d.mts +66 -17
  386. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  387. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  388. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  389. package/dist/esm/transactions/authenticator/transaction.d.mts +53 -20
  390. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  391. package/dist/esm/transactions/index.d.mts +1 -1
  392. package/dist/esm/transactions/index.mjs +1 -1
  393. package/dist/esm/transactions/instances/chainId.d.mts +20 -1
  394. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  395. package/dist/esm/transactions/instances/identifier.d.mts +21 -3
  396. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  397. package/dist/esm/transactions/instances/index.d.mts +1 -1
  398. package/dist/esm/transactions/instances/index.mjs +1 -1
  399. package/dist/esm/transactions/instances/moduleId.d.mts +22 -8
  400. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  401. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +24 -8
  402. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  403. package/dist/esm/transactions/instances/rawTransaction.d.mts +31 -4
  404. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  405. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +25 -3
  406. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  407. package/dist/esm/transactions/instances/signedTransaction.d.mts +29 -7
  408. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  409. package/dist/esm/transactions/instances/simpleTransaction.d.mts +23 -8
  410. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  411. package/dist/esm/transactions/instances/transactionArgument.d.mts +23 -0
  412. package/dist/esm/transactions/instances/transactionPayload.d.mts +72 -26
  413. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  414. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +37 -11
  415. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  416. package/dist/esm/transactions/management/asyncQueue.d.mts +22 -19
  417. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  418. package/dist/esm/transactions/management/index.d.mts +2 -2
  419. package/dist/esm/transactions/management/index.mjs +1 -1
  420. package/dist/esm/transactions/management/transactionWorker.d.mts +67 -36
  421. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  422. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +74 -4
  423. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  424. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  425. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  426. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +45 -23
  427. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  428. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +20 -15
  429. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  430. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +101 -30
  431. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  432. package/dist/esm/transactions/typeTag/index.d.mts +244 -3
  433. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  434. package/dist/esm/transactions/typeTag/parser.d.mts +31 -2
  435. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  436. package/dist/esm/transactions/types.d.mts +82 -34
  437. package/dist/esm/types/generated/queries.mjs +1 -1
  438. package/dist/esm/types/generated/types.mjs +1 -1
  439. package/dist/esm/types/index.d.mts +320 -59
  440. package/dist/esm/types/index.mjs +1 -1
  441. package/dist/esm/types/indexer.d.mts +65 -2
  442. package/dist/esm/types/keyless.d.mts +18 -0
  443. package/dist/esm/utils/apiEndpoints.d.mts +3 -0
  444. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  445. package/dist/esm/utils/const.d.mts +2 -4
  446. package/dist/esm/utils/const.mjs +1 -1
  447. package/dist/esm/utils/helpers.d.mts +25 -10
  448. package/dist/esm/utils/helpers.mjs +1 -1
  449. package/dist/esm/utils/index.mjs +1 -1
  450. package/dist/esm/utils/memoize.d.mts +12 -10
  451. package/dist/esm/utils/memoize.mjs +1 -1
  452. package/dist/esm/utils/normalizeBundle.d.mts +11 -5
  453. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  454. package/dist/esm/version.d.mts +1 -1
  455. package/dist/esm/version.mjs +1 -1
  456. package/package.json +23 -22
  457. package/src/account/AbstractKeylessAccount.ts +7 -5
  458. package/src/account/Account.ts +88 -54
  459. package/src/account/Ed25519Account.ts +56 -21
  460. package/src/account/EphemeralKeyPair.ts +50 -15
  461. package/src/account/FederatedKeylessAccount.ts +4 -3
  462. package/src/account/KeylessAccount.ts +46 -3
  463. package/src/account/MultiKeyAccount.ts +56 -35
  464. package/src/account/SingleKeyAccount.ts +60 -28
  465. package/src/api/account.ts +443 -159
  466. package/src/api/ans.ts +367 -120
  467. package/src/api/aptos.ts +38 -5
  468. package/src/api/aptosConfig.ts +102 -14
  469. package/src/api/coin.ts +49 -12
  470. package/src/api/digitalAsset.ts +707 -296
  471. package/src/api/event.ts +128 -25
  472. package/src/api/faucet.ts +44 -7
  473. package/src/api/fungibleAsset.ts +149 -46
  474. package/src/api/general.ts +168 -52
  475. package/src/api/keyless.ts +117 -21
  476. package/src/api/object.ts +49 -5
  477. package/src/api/staking.ts +84 -15
  478. package/src/api/table.ts +117 -37
  479. package/src/api/transaction.ts +438 -107
  480. package/src/api/transactionSubmission/build.ts +98 -12
  481. package/src/api/transactionSubmission/helpers.ts +79 -0
  482. package/src/api/transactionSubmission/management.ts +110 -10
  483. package/src/api/transactionSubmission/sign.ts +96 -2
  484. package/src/api/transactionSubmission/simulate.ts +139 -14
  485. package/src/api/transactionSubmission/submit.ts +103 -12
  486. package/src/api/utils.ts +26 -3
  487. package/src/bcs/deserializer.ts +82 -32
  488. package/src/bcs/serializable/entryFunctionBytes.ts +27 -6
  489. package/src/bcs/serializable/fixedBytes.ts +55 -25
  490. package/src/bcs/serializable/movePrimitives.ts +91 -0
  491. package/src/bcs/serializable/moveStructs.ts +123 -35
  492. package/src/bcs/serializer.ts +131 -84
  493. package/src/cli/localNode.ts +46 -17
  494. package/src/cli/move.ts +119 -136
  495. package/src/client/core.ts +23 -8
  496. package/src/client/get.ts +34 -6
  497. package/src/client/post.ts +63 -6
  498. package/src/client/types.ts +40 -13
  499. package/src/core/account/utils/address.ts +1 -1
  500. package/src/core/accountAddress.ts +63 -50
  501. package/src/core/authenticationKey.ts +47 -20
  502. package/src/core/common.ts +6 -0
  503. package/src/core/crypto/ed25519.ts +76 -25
  504. package/src/core/crypto/ephemeral.ts +37 -21
  505. package/src/core/crypto/federatedKeyless.ts +1 -20
  506. package/src/core/crypto/hdKey.ts +10 -7
  507. package/src/core/crypto/keyless.ts +140 -63
  508. package/src/core/crypto/multiEd25519.ts +44 -5
  509. package/src/core/crypto/multiKey.ts +66 -19
  510. package/src/core/crypto/poseidon.ts +72 -5
  511. package/src/core/crypto/privateKey.ts +9 -5
  512. package/src/core/crypto/proof.ts +3 -12
  513. package/src/core/crypto/publicKey.ts +15 -5
  514. package/src/core/crypto/secp256k1.ts +76 -26
  515. package/src/core/crypto/signature.ts +7 -4
  516. package/src/core/crypto/singleKey.ts +62 -5
  517. package/src/core/hex.ts +27 -28
  518. package/src/internal/account.ts +248 -12
  519. package/src/internal/ans.ts +219 -15
  520. package/src/internal/coin.ts +12 -0
  521. package/src/internal/digitalAsset.ts +344 -3
  522. package/src/internal/event.ts +51 -0
  523. package/src/internal/faucet.ts +14 -0
  524. package/src/internal/fungibleAsset.ts +46 -0
  525. package/src/internal/general.ts +46 -0
  526. package/src/internal/keyless.ts +37 -1
  527. package/src/internal/object.ts +21 -0
  528. package/src/internal/queries/getTableItemsData.graphql +1 -1
  529. package/src/internal/queries/getTableItemsMetadata.graphql +1 -1
  530. package/src/internal/staking.ts +27 -1
  531. package/src/internal/table.ts +32 -0
  532. package/src/internal/transaction.ts +120 -7
  533. package/src/internal/transactionSubmission.ts +86 -30
  534. package/src/transactions/authenticator/account.ts +65 -16
  535. package/src/transactions/authenticator/transaction.ts +52 -19
  536. package/src/transactions/instances/chainId.ts +20 -1
  537. package/src/transactions/instances/identifier.ts +21 -3
  538. package/src/transactions/instances/moduleId.ts +22 -8
  539. package/src/transactions/instances/multiAgentTransaction.ts +26 -10
  540. package/src/transactions/instances/rawTransaction.ts +31 -4
  541. package/src/transactions/instances/rotationProofChallenge.ts +24 -2
  542. package/src/transactions/instances/signedTransaction.ts +28 -6
  543. package/src/transactions/instances/simpleTransaction.ts +26 -11
  544. package/src/transactions/instances/transactionArgument.ts +26 -0
  545. package/src/transactions/instances/transactionPayload.ts +73 -26
  546. package/src/transactions/management/accountSequenceNumber.ts +38 -11
  547. package/src/transactions/management/asyncQueue.ts +22 -19
  548. package/src/transactions/management/transactionWorker.ts +66 -40
  549. package/src/transactions/transactionBuilder/helpers.ts +130 -3
  550. package/src/transactions/transactionBuilder/remoteAbi.ts +71 -30
  551. package/src/transactions/transactionBuilder/signingMessage.ts +19 -14
  552. package/src/transactions/transactionBuilder/transactionBuilder.ts +166 -42
  553. package/src/transactions/typeTag/index.ts +264 -3
  554. package/src/transactions/typeTag/parser.ts +54 -20
  555. package/src/transactions/types.ts +81 -33
  556. package/src/types/index.ts +338 -61
  557. package/src/types/indexer.ts +82 -2
  558. package/src/types/keyless.ts +21 -0
  559. package/src/utils/apiEndpoints.ts +3 -0
  560. package/src/utils/const.ts +2 -4
  561. package/src/utils/helpers.ts +25 -10
  562. package/src/utils/memoize.ts +12 -10
  563. package/src/utils/normalizeBundle.ts +11 -5
  564. package/src/version.ts +1 -1
  565. package/dist/common/chunk-HBPH2AD3.js.map +0 -1
  566. package/dist/esm/Ed25519Account-B1VMJOY2.d.mts +0 -361
  567. package/dist/esm/chunk-2BTTX2KO.mjs.map +0 -1
  568. package/dist/esm/chunk-2F7Z7RMW.mjs.map +0 -1
  569. package/dist/esm/chunk-367OG3DB.mjs.map +0 -1
  570. package/dist/esm/chunk-3W2DHZXK.mjs.map +0 -1
  571. package/dist/esm/chunk-44GYWUSH.mjs.map +0 -1
  572. package/dist/esm/chunk-45IUUCAV.mjs.map +0 -1
  573. package/dist/esm/chunk-4HR32TSY.mjs.map +0 -1
  574. package/dist/esm/chunk-4TB3AWQE.mjs.map +0 -1
  575. package/dist/esm/chunk-53RB2PRH.mjs.map +0 -1
  576. package/dist/esm/chunk-5PCNWXRN.mjs.map +0 -1
  577. package/dist/esm/chunk-5VD4MHB3.mjs.map +0 -1
  578. package/dist/esm/chunk-6EMN3BOV.mjs.map +0 -1
  579. package/dist/esm/chunk-6UZ3VI5Y.mjs.map +0 -1
  580. package/dist/esm/chunk-76OH2Z4Q.mjs +0 -2
  581. package/dist/esm/chunk-76OH2Z4Q.mjs.map +0 -1
  582. package/dist/esm/chunk-7VKFXX5Q.mjs.map +0 -1
  583. package/dist/esm/chunk-A42BPAD4.mjs.map +0 -1
  584. package/dist/esm/chunk-A63SMUOU.mjs +0 -2
  585. package/dist/esm/chunk-A63SMUOU.mjs.map +0 -1
  586. package/dist/esm/chunk-ADE6MVXC.mjs.map +0 -1
  587. package/dist/esm/chunk-AH44UPM4.mjs.map +0 -1
  588. package/dist/esm/chunk-APN6AV5Q.mjs.map +0 -1
  589. package/dist/esm/chunk-B5NYEWNM.mjs +0 -2
  590. package/dist/esm/chunk-B5NYEWNM.mjs.map +0 -1
  591. package/dist/esm/chunk-BA4RBST6.mjs +0 -2
  592. package/dist/esm/chunk-BA4RBST6.mjs.map +0 -1
  593. package/dist/esm/chunk-BCUSI3N6.mjs.map +0 -1
  594. package/dist/esm/chunk-BOYYQAB4.mjs.map +0 -1
  595. package/dist/esm/chunk-BSAHPS6E.mjs.map +0 -1
  596. package/dist/esm/chunk-BSUYPXRD.mjs +0 -2
  597. package/dist/esm/chunk-BSUYPXRD.mjs.map +0 -1
  598. package/dist/esm/chunk-BWNTSJOC.mjs +0 -2
  599. package/dist/esm/chunk-BWNTSJOC.mjs.map +0 -1
  600. package/dist/esm/chunk-CB6H4VMZ.mjs +0 -2
  601. package/dist/esm/chunk-CB6H4VMZ.mjs.map +0 -1
  602. package/dist/esm/chunk-CRA2MFJC.mjs.map +0 -1
  603. package/dist/esm/chunk-D3Q4BC3I.mjs.map +0 -1
  604. package/dist/esm/chunk-E4O26ZJB.mjs +0 -2
  605. package/dist/esm/chunk-E4O26ZJB.mjs.map +0 -1
  606. package/dist/esm/chunk-ELYS7CWV.mjs.map +0 -1
  607. package/dist/esm/chunk-EXP5STXZ.mjs.map +0 -1
  608. package/dist/esm/chunk-F3M2UQA4.mjs.map +0 -1
  609. package/dist/esm/chunk-F63E4CR7.mjs +0 -2
  610. package/dist/esm/chunk-F63E4CR7.mjs.map +0 -1
  611. package/dist/esm/chunk-F76N4MQO.mjs.map +0 -1
  612. package/dist/esm/chunk-FZ5EYP3D.mjs.map +0 -1
  613. package/dist/esm/chunk-G5MGSV7Y.mjs +0 -2
  614. package/dist/esm/chunk-G5MGSV7Y.mjs.map +0 -1
  615. package/dist/esm/chunk-G5XLMQ5E.mjs +0 -2
  616. package/dist/esm/chunk-G5XLMQ5E.mjs.map +0 -1
  617. package/dist/esm/chunk-GDO6Q2FI.mjs +0 -2
  618. package/dist/esm/chunk-GDO6Q2FI.mjs.map +0 -1
  619. package/dist/esm/chunk-GDUAFXIQ.mjs.map +0 -1
  620. package/dist/esm/chunk-GMBSQDPO.mjs.map +0 -1
  621. package/dist/esm/chunk-GWSDIX6C.mjs.map +0 -1
  622. package/dist/esm/chunk-H6YNXJNF.mjs.map +0 -1
  623. package/dist/esm/chunk-HAT5S2XX.mjs +0 -2
  624. package/dist/esm/chunk-HAT5S2XX.mjs.map +0 -1
  625. package/dist/esm/chunk-HHGJXVAE.mjs +0 -2
  626. package/dist/esm/chunk-HHGJXVAE.mjs.map +0 -1
  627. package/dist/esm/chunk-HKBBA653.mjs.map +0 -1
  628. package/dist/esm/chunk-HVMFZF6P.mjs.map +0 -1
  629. package/dist/esm/chunk-IR4SLC2M.mjs.map +0 -1
  630. package/dist/esm/chunk-J64ARI4E.mjs.map +0 -1
  631. package/dist/esm/chunk-JH6VLTMS.mjs.map +0 -1
  632. package/dist/esm/chunk-KEYAPEAX.mjs.map +0 -1
  633. package/dist/esm/chunk-KUOB4DDE.mjs.map +0 -1
  634. package/dist/esm/chunk-KUZ2YTJH.mjs.map +0 -1
  635. package/dist/esm/chunk-L2QXU6F4.mjs.map +0 -1
  636. package/dist/esm/chunk-LG7RJQ57.mjs.map +0 -1
  637. package/dist/esm/chunk-LNEZEYYE.mjs +0 -2
  638. package/dist/esm/chunk-LNEZEYYE.mjs.map +0 -1
  639. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  640. package/dist/esm/chunk-MAMPMCO7.mjs.map +0 -1
  641. package/dist/esm/chunk-MDJ66AA3.mjs +0 -2
  642. package/dist/esm/chunk-MDJ66AA3.mjs.map +0 -1
  643. package/dist/esm/chunk-MLDQ2TY2.mjs +0 -2
  644. package/dist/esm/chunk-MLDQ2TY2.mjs.map +0 -1
  645. package/dist/esm/chunk-MNVUSJEK.mjs.map +0 -1
  646. package/dist/esm/chunk-MQGW234H.mjs +0 -2
  647. package/dist/esm/chunk-MQGW234H.mjs.map +0 -1
  648. package/dist/esm/chunk-NMD45OTM.mjs.map +0 -1
  649. package/dist/esm/chunk-NWOMSL6K.mjs.map +0 -1
  650. package/dist/esm/chunk-O2BPA6TS.mjs.map +0 -1
  651. package/dist/esm/chunk-OHRL766V.mjs.map +0 -1
  652. package/dist/esm/chunk-OKAQO57B.mjs.map +0 -1
  653. package/dist/esm/chunk-OMV7445F.mjs.map +0 -1
  654. package/dist/esm/chunk-P2EIZ7WL.mjs.map +0 -1
  655. package/dist/esm/chunk-P3TAY5PP.mjs.map +0 -1
  656. package/dist/esm/chunk-P5V7OZNN.mjs.map +0 -1
  657. package/dist/esm/chunk-Q3TAEOH5.mjs.map +0 -1
  658. package/dist/esm/chunk-Q4XR6QOZ.mjs +0 -2
  659. package/dist/esm/chunk-QBSU3L5Q.mjs.map +0 -1
  660. package/dist/esm/chunk-QPB6EJVM.mjs.map +0 -1
  661. package/dist/esm/chunk-R76DHMGR.mjs.map +0 -1
  662. package/dist/esm/chunk-RXE6NNOL.mjs.map +0 -1
  663. package/dist/esm/chunk-S2KDCIZN.mjs.map +0 -1
  664. package/dist/esm/chunk-S2W4D6NZ.mjs.map +0 -1
  665. package/dist/esm/chunk-SDWE6WMM.mjs.map +0 -1
  666. package/dist/esm/chunk-SRPI2FFA.mjs.map +0 -1
  667. package/dist/esm/chunk-STUXKQVZ.mjs +0 -2
  668. package/dist/esm/chunk-STUXKQVZ.mjs.map +0 -1
  669. package/dist/esm/chunk-SUJLWCRN.mjs +0 -2
  670. package/dist/esm/chunk-SUJLWCRN.mjs.map +0 -1
  671. package/dist/esm/chunk-SWNFKKRE.mjs.map +0 -1
  672. package/dist/esm/chunk-TDGQGILY.mjs.map +0 -1
  673. package/dist/esm/chunk-TQWGQLM6.mjs.map +0 -1
  674. package/dist/esm/chunk-U6Z4FNB7.mjs.map +0 -1
  675. package/dist/esm/chunk-UAEODDZS.mjs +0 -2
  676. package/dist/esm/chunk-UAL27G6B.mjs.map +0 -1
  677. package/dist/esm/chunk-WJRZWAIS.mjs.map +0 -1
  678. package/dist/esm/chunk-WRRQ7L5K.mjs.map +0 -1
  679. package/dist/esm/chunk-X34JJPW5.mjs.map +0 -1
  680. package/dist/esm/chunk-XMW65WCQ.mjs +0 -2
  681. package/dist/esm/chunk-XMW65WCQ.mjs.map +0 -1
  682. package/dist/esm/chunk-Y2GWUE7C.mjs.map +0 -1
  683. package/dist/esm/chunk-Y3BATGHX.mjs +0 -2
  684. package/dist/esm/chunk-Y3BATGHX.mjs.map +0 -1
  685. package/dist/esm/chunk-YDZBU2DJ.mjs.map +0 -1
  686. package/dist/esm/chunk-YPHH6CAO.mjs +0 -2
  687. package/dist/esm/chunk-YPHH6CAO.mjs.map +0 -1
  688. package/dist/esm/chunk-YU3IYJRL.mjs.map +0 -1
  689. package/dist/esm/chunk-YUNDX5I7.mjs.map +0 -1
  690. package/dist/esm/publicKey-B3XRNhHO.d.mts +0 -113
  691. /package/dist/esm/{chunk-FVA2OPG4.mjs.map → chunk-KDMSOCZY.mjs.map} +0 -0
  692. /package/dist/esm/{chunk-Q4XR6QOZ.mjs.map → chunk-KIW54KWR.mjs.map} +0 -0
  693. /package/dist/esm/{chunk-ZROQH5YL.mjs.map → chunk-KSUZS6EL.mjs.map} +0 -0
@@ -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 // 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"],"mappings":"oCAGA,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,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","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","_Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","other","value","index"]}
@@ -1,2 +1,2 @@
1
- import{a as d}from"./chunk-ZROQH5YL.mjs";import{a as y,b as C,c as l,d as T,e as O,f as P,g as h,h as S,i as L,j as R,k as V,l as I,m as b,n as w,o as v,p as M}from"./chunk-STUXKQVZ.mjs";import{a as o}from"./chunk-SDWE6WMM.mjs";import{a as f}from"./chunk-WRRQ7L5K.mjs";import{b as r}from"./chunk-OHRL766V.mjs";import{a as p}from"./chunk-AH44UPM4.mjs";import{e as u,f as A}from"./chunk-EXP5STXZ.mjs";import{g,h as m}from"./chunk-UAL27G6B.mjs";var N=class{constructor(e){this.config=e}async getAccountInfo(e){return y({aptosConfig:this.config,...e})}async getAccountModules(e){return C({aptosConfig:this.config,...e})}async getAccountModule(e){return l({aptosConfig:this.config,...e})}async getAccountTransactions(e){return T({aptosConfig:this.config,...e})}async getAccountResources(e){return O({aptosConfig:this.config,...e})}async getAccountResource(e){return P({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return h({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),S({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),L({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),R({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),V({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),I({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),b({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),w({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:u,faMetadataAddress:A,...e})}async getAccountCoinAmount(e){let{accountAddress:a,coinType:s,faMetadataAddress:t}=e,c=s;s===void 0&&t!==void 0&&(c=await p(async()=>{try{let n=(await d({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[t]}})).at(0);if(n.vec.length>0&&m(n.vec[0]))return g(n.vec[0])}catch{}},`coin-mapping-${t.toString()}`,1e3*60*5)());let i;if(s!==void 0&&t!==void 0)i=r.from(t).toStringLong();else if(s!==void 0&&t===void 0)s===u?i=r.A.toStringLong():i=f(r.A,s).toStringLong();else if(s===void 0&&t!==void 0){let n=r.from(t);i=n.toStringLong(),n===r.A&&(c=u)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(c!==void 0){let[n]=await d({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[c],functionArguments:[a]}});return parseInt(n,10)}let[k]=await d({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[a,i]}});return parseInt(k,10)}async getAccountOwnedObjects(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),v({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return M({aptosConfig:this.config,...e})}};export{N as a};
2
- //# sourceMappingURL=chunk-4TB3AWQE.mjs.map
1
+ import{a as d}from"./chunk-KSUZS6EL.mjs";import{a as o}from"./chunk-TRU3EK64.mjs";import{a as y,b as C,c as l,d as T,e as O,f as P,g as h,h as S,i as L,j as R,k as V,l as I,n as b,o as w,p as v,q as M}from"./chunk-7D3RY73L.mjs";import{a as f}from"./chunk-PCLU4KLY.mjs";import{a as p}from"./chunk-HBIDHQ2M.mjs";import{g,h as m}from"./chunk-LEKBJ2EG.mjs";import{b as r}from"./chunk-KM6UXNC7.mjs";import{e as u,f as A}from"./chunk-J245N3XF.mjs";var N=class{constructor(e){this.config=e}async getAccountInfo(e){return y({aptosConfig:this.config,...e})}async getAccountModules(e){return C({aptosConfig:this.config,...e})}async getAccountModule(e){return l({aptosConfig:this.config,...e})}async getAccountTransactions(e){return T({aptosConfig:this.config,...e})}async getAccountResources(e){return O({aptosConfig:this.config,...e})}async getAccountResource(e){return P({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return h({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),S({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),L({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),R({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),V({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),I({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),b({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),w({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:u,faMetadataAddress:A,...e})}async getAccountCoinAmount(e){let{accountAddress:a,coinType:s,faMetadataAddress:t}=e,c=s;s===void 0&&t!==void 0&&(c=await p(async()=>{try{let n=(await d({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[t]}})).at(0);if(n.vec.length>0&&m(n.vec[0]))return g(n.vec[0])}catch{}},`coin-mapping-${t.toString()}`,1e3*60*5)());let i;if(s!==void 0&&t!==void 0)i=r.from(t).toStringLong();else if(s!==void 0&&t===void 0)s===u?i=r.A.toStringLong():i=f(r.A,s).toStringLong();else if(s===void 0&&t!==void 0){let n=r.from(t);i=n.toStringLong(),n===r.A&&(c=u)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(c!==void 0){let[n]=await d({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[c],functionArguments:[a]}});return parseInt(n,10)}let[k]=await d({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[a,i]}});return parseInt(k,10)}async getAccountOwnedObjects(e){return await o({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),v({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return M({aptosConfig:this.config,...e})}};export{N as a};
2
+ //# sourceMappingURL=chunk-KFSVKIFO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account as AccountModule } from \"../account\";\nimport { AccountAddress, PrivateKey, AccountAddressInput, createObjectAddress } from \"../core\";\nimport {\n AccountData,\n AnyNumber,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n GetObjectDataQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n MoveValue,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\n} from \"../types\";\nimport {\n deriveAccountFromPrivateKey,\n getAccountCoinsCount,\n getAccountCoinsData,\n getAccountCollectionsWithOwnedTokens,\n getAccountOwnedObjects,\n getAccountOwnedTokens,\n getAccountOwnedTokensFromCollectionAddress,\n getAccountTokensCount,\n getAccountTransactionsCount,\n getInfo,\n getModule,\n getModules,\n getResource,\n getResources,\n getTransactions,\n lookupOriginalAccountAddress,\n} from \"../internal/account\";\nimport { APTOS_COIN, APTOS_FA, ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\nimport { view } from \"../internal/view\";\nimport { isEncodedStruct, parseEncodedStruct } from \"../utils\";\nimport { memoizeAsync } from \"../utils/memoize\";\n\n/**\n * A class to query all `Account` related queries on Aptos.\n */\nexport class Account {\n /**\n * Creates an instance of the Aptos client with the provided configuration.\n *\n * @param config - The configuration settings for the Aptos client.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * async function runExample() {\n * // Initialize the Aptos client with testnet configuration\n * const config = new AptosConfig({ network: Network.TESTNET }); // specify your own network if needed\n * const aptos = new Aptos(config);\n *\n * console.log(\"Aptos client initialized:\", aptos);\n * }\n * runExample().catch(console.error);\n * ```\n */\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries the current state for an Aptos account given its account address.\n *\n * @param args - The arguments for retrieving account information.\n * @param args.accountAddress - The Aptos account address to query.\n * @returns The account data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Retrieve account information for a specific address\n * const accountInfo = await aptos.getAccountInfo({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(accountInfo);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountInfo(args: { accountAddress: AccountAddressInput }): Promise<AccountData> {\n return getInfo({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for all modules in an account given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query modules for.\n * @param args.options.offset - The number of modules to start returning results from.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it retrieves the latest version.\n *\n * @returns - The account modules associated with the specified address.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account modules for a specific account\n * const accountModules = await aptos.getAccountModules({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first module\n * limit: 10, // limiting to 10 modules\n * },\n * });\n *\n * console.log(accountModules);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountModules(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveModuleBytecode[]> {\n return getModules({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries for a specific account module given an account address and module name.\n *\n * @param args.accountAddress - The Aptos account address.\n * @param args.moduleName - The name of the module.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n *\n * @returns The account module associated with the specified account address and module name.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account module for a specific account address and module name\n * const module = await aptos.getAccountModule({\n * accountAddress: \"0x1\", // replace with a real account address\n * moduleName: \"MyModule\" // specify the module name\n * });\n *\n * console.log(module);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountModule(args: {\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersionArg;\n }): Promise<MoveModuleBytecode> {\n return getModule({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries account transactions given an account address.\n * This function may call the API multiple times to auto paginate and retrieve all account transactions.\n *\n * @param args.accountAddress - The Aptos account address to query transactions for.\n * @param args.options - Optional pagination arguments.\n * @param args.options.offset - The number of transactions to start returning results from.\n * @param args.options.limit - The maximum number of results to return.\n *\n * @returns The account transactions.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetch transactions for a specific account\n * const transactions = await aptos.getAccountTransactions({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * offset: 0, // starting from the first transaction\n * limit: 10, // limiting to 10 transactions\n * },\n * });\n *\n * console.log(transactions);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountTransactions(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all account resources given an account address.\n * This function may call the API multiple times to auto paginate through results.\n *\n * @param args.accountAddress - The Aptos account address to query resources for.\n * @param args.options.offset - The number of resources to start returning results from.\n * @param args.options.limit - The maximum number of results to return.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Account resources.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching account resources for a specific account address\n * const resources = await aptos.getAccountResources({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(resources);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountResources(args: {\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersionArg;\n }): Promise<MoveResource[]> {\n return getResources({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a specific account resource given an account address and resource type.\n *\n * @template T - The typed output of the resource.\n * @param args.accountAddress - The Aptos account address to query.\n * @param args.resourceType - The string representation of an on-chain Move struct type, e.g., \"0x1::aptos_coin::AptosCoin\".\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns The account resource of the specified type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the account resource for a specific account address and resource type\n * const resource = await aptos.getAccountResource({\n * accountAddress: \"0x1\", // replace with a real account address\n * resourceType: \"0x1::aptos_coin::AptosCoin\"\n * });\n *\n * console.log(resource);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountResource<T extends {} = any>(args: {\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersionArg;\n }): Promise<T> {\n return getResource<T>({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Looks up the account address for a given authentication key, handling both rotated and non-rotated keys.\n *\n * @param args.authenticationKey - The authentication key for which to look up the account address.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.ledgerVersion - The ledger version to query; if not provided, it will get the latest version.\n * @returns Promise<AccountAddress> - The account address associated with the authentication key.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Look up the original account address for a given authentication key\n * const accountAddress = await aptos.lookupOriginalAccountAddress({\n * authenticationKey: \"0x1\", // replace with a real authentication key\n * });\n *\n * console.log(\"Original Account Address:\", accountAddress);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async lookupOriginalAccountAddress(args: {\n authenticationKey: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: LedgerVersionArg;\n }): Promise<AccountAddress> {\n return lookupOriginalAccountAddress({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries the current count of tokens owned by a specified account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address to query the token count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns The current count of tokens owned by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of tokens owned by the account\n * const tokensCount = await aptos.getAccountTokensCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(`Tokens Count: ${tokensCount}`);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountTokensCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTokensCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the tokens currently owned by a specified account, including NFTs and fungible tokens.\n * If desired, you can filter the results by a specific token standard.\n *\n * @param args.accountAddress The account address for which to retrieve owned tokens.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard Optional filter for the NFT standard to query for.\n * @param args.options.offset Optional number to start returning results from.\n * @param args.options.limit Optional number of results to return.\n * @param args.options.orderBy Optional order to sort the tokens by.\n * @returns An array of tokens with their respective data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the tokens owned by a specific account\n * const accountOwnedTokens = await aptos.getAccountOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify how many tokens to return\n * orderBy: \"created_at\", // specify the order of the results\n * },\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\n }): Promise<GetAccountOwnedTokensQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries all current tokens of a specific collection that an account owns by the collection address.\n * This query returns all tokens (v1 and v2 standards) an account owns, including NFTs, fungible, soulbound, etc.\n * If you want to get only the token from a specific standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the tokens for.\n * @param args.collectionAddress - The address of the collection being queried.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to, before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number token to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Tokens array with the token data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get tokens owned by a specific account in a specific collection\n * const accountOwnedTokens = await aptos.getAccountOwnedTokensFromCollectionAddress({\n * accountAddress: \"0x1\", // replace with a real account address\n * collectionAddress: \"0x2\", // replace with a real collection address\n * });\n *\n * console.log(accountOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountOwnedTokensFromCollectionAddress(args: {\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\n }): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountOwnedTokensFromCollectionAddress({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries for all collections that an account currently has tokens for, including NFTs, fungible tokens, and soulbound tokens.\n * If you want to filter by a specific token standard, you can pass an optional tokenStandard parameter.\n *\n * @param args.accountAddress - The account address we want to get the collections for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.tokenStandard - The NFT standard to query for.\n * @param args.options.offset - The number of the collection to start returning results from.\n * @param args.options.limit - The number of results to return.\n * @param args.options.orderBy - The order to sort the tokens by.\n * @returns Collections array with the collections data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get account collections with owned tokens for a specific account\n * const accountCollectionsWithOwnedTokens = await aptos.getAccountCollectionsWithOwnedTokens({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * tokenStandard: \"NFT\", // specify the token standard if needed\n * limit: 10, // specify the number of results to return\n * },\n * });\n *\n * console.log(accountCollectionsWithOwnedTokens);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountCollectionsWithOwnedTokens(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n }): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getAccountCollectionsWithOwnedTokens({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries the current count of transactions submitted by an account.\n *\n * @param args - The parameters for the query.\n * @param args.accountAddress - The account address we want to get the total count for.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @returns Current count of transactions made by an account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the count of transactions for a specific account\n * const accountTransactionsCount = await aptos.getAccountTransactionsCount({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // specify your own minimum ledger version if needed\n * });\n *\n * console.log(accountTransactionsCount);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountTransactionsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.ACCOUNT_TRANSACTION_PROCESSOR,\n });\n return getAccountTransactionsCount({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the coins data for a specified account.\n *\n * @param args.accountAddress - The account address for which to retrieve the coin's data.\n * @param args.minimumLedgerVersion - Optional ledger version to sync up to before querying.\n * @param args.options.offset - Optional. The number of coins to start returning results from.\n * @param args.options.limit - Optional. The number of results to return.\n * @param args.options.orderBy - Optional. The order to sort the coins by.\n * @param args.options.where - Optional. Filter the results by specific criteria.\n * @returns An array containing the coins data for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Fetching coins data for a specific account\n * const accountCoinsData = await aptos.getAccountCoinsData({\n * accountAddress: \"0x1\", // replace with a real account address\n * options: {\n * limit: 10, // specify the number of results to return\n * orderBy: { asset_type: \"asc\" }, // specify the order of results\n * },\n * });\n *\n * console.log(accountCoinsData);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountCoinsData(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs &\n OrderByArg<GetAccountCoinsDataResponse[0]> &\n WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n }): Promise<GetAccountCoinsDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsData({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Retrieves the current count of an account's coins aggregated across all types.\n *\n * @param args The parameters for the account coins count query.\n * @param args.accountAddress The account address we want to get the total count for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current count of the aggregated coins for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Getting the account coins count for a specific account\n * const accountCoinsCount = await aptos.getAccountCoinsCount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account Coins Count:\", accountCoinsCount);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountCoinsCount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.FUNGIBLE_ASSET_PROCESSOR,\n });\n return getAccountCoinsCount({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Retrieves the current amount of APT for a specified account.\n *\n * @param args The arguments for the account query.\n * @param args.accountAddress The account address for which to retrieve the APT amount.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current amount of APT for the specified account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the APT amount for a specific account\n * const accountAPTAmount = await aptos.getAccountAPTAmount({ accountAddress: \"0x1\" }); // replace with a real account address\n * console.log(\"Account APT Amount:\", accountAPTAmount);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountAPTAmount(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n return this.getAccountCoinAmount({ coinType: APTOS_COIN, faMetadataAddress: APTOS_FA, ...args });\n }\n\n /**\n * Queries the current amount of a specified coin held by an account.\n *\n * @param args The parameters for querying the account's coin amount.\n * @param args.accountAddress The account address to query for the coin amount.\n * @param args.coinType The coin type to query. Note: If not provided, it may be automatically populated if `faMetadataAddress`\n * is specified.\n * @param args.faMetadataAddress The fungible asset metadata address to query. Note: If not provided, it may be automatically\n * populated if `coinType` is specified.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @returns The current amount of the specified coin held by the account.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Query the account's coin amount for a specific coin type\n * const accountCoinAmount = await aptos.getAccountCoinAmount({\n * accountAddress: \"0x1\", // replace with a real account address\n * coinType: \"0x1::aptos_coin::AptosCoin\" // specify the coin type\n * });\n *\n * console.log(`Account coin amount: ${accountCoinAmount}`);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountCoinAmount(args: {\n accountAddress: AccountAddressInput;\n coinType?: MoveStructId;\n faMetadataAddress?: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<number> {\n const { accountAddress, coinType, faMetadataAddress } = args;\n\n // Attempt to populate the CoinType field if the FA address is provided.\n // We cannot do this internally due to dependency cycles issue.\n let coinAssetType: MoveStructId | undefined = coinType;\n if (coinType === undefined && faMetadataAddress !== undefined) {\n coinAssetType = await memoizeAsync(\n async () => {\n try {\n const pairedCoinTypeStruct = (\n await view({\n aptosConfig: this.config,\n payload: { function: \"0x1::coin::paired_coin\", functionArguments: [faMetadataAddress] },\n })\n ).at(0) as { vec: MoveValue[] };\n\n // Check if the Option has a value, and if so, parse the struct\n if (pairedCoinTypeStruct.vec.length > 0 && isEncodedStruct(pairedCoinTypeStruct.vec[0])) {\n return parseEncodedStruct(pairedCoinTypeStruct.vec[0]) as MoveStructId;\n }\n } catch (error) {\n /* No paired coin type found */\n }\n return undefined;\n },\n `coin-mapping-${faMetadataAddress.toString()}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n }\n\n let faAddress: string;\n\n if (coinType !== undefined && faMetadataAddress !== undefined) {\n faAddress = AccountAddress.from(faMetadataAddress).toStringLong();\n } else if (coinType !== undefined && faMetadataAddress === undefined) {\n // TODO Move to a separate function as defined in the AIP for coin migration\n if (coinType === APTOS_COIN) {\n faAddress = AccountAddress.A.toStringLong();\n } else {\n faAddress = createObjectAddress(AccountAddress.A, coinType).toStringLong();\n }\n } else if (coinType === undefined && faMetadataAddress !== undefined) {\n const addr = AccountAddress.from(faMetadataAddress);\n faAddress = addr.toStringLong();\n if (addr === AccountAddress.A) {\n coinAssetType = APTOS_COIN;\n }\n // The paired CoinType should be populated outside of this function in another\n // async call. We cannot do this internally due to dependency cycles issue.\n } else {\n throw new Error(\"Either coinType, faMetadataAddress, or both must be provided\");\n }\n\n // When there is a coin mapping, use that first, otherwise use the fungible asset address\n // TODO: This function's signature at the top, returns number, but it could be greater than can be represented\n if (coinAssetType !== undefined) {\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::coin::balance\",\n typeArguments: [coinAssetType],\n functionArguments: [accountAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n const [balanceStr] = await view<[string]>({\n aptosConfig: this.config,\n payload: {\n function: \"0x1::primary_fungible_store::balance\",\n typeArguments: [\"0x1::object::ObjectCore\"],\n functionArguments: [accountAddress, faAddress],\n },\n });\n return parseInt(balanceStr, 10);\n }\n\n /**\n * Queries an account's owned objects.\n *\n * @param args.accountAddress The account address we want to get the objects for.\n * @param args.minimumLedgerVersion Optional ledger version to sync up to before querying.\n * @param args.options.offset The starting position to start returning results from.\n * @param args.options.limit The number of results to return.\n * @param args.options.orderBy The order to sort the objects by.\n * @returns Objects array with the object data.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Get the objects owned by the specified account\n * const accountOwnedObjects = await aptos.getAccountOwnedObjects({\n * accountAddress: \"0x1\", // replace with a real account address\n * minimumLedgerVersion: 1, // optional, specify if needed\n * options: {\n * offset: 0, // optional, specify if needed\n * limit: 10, // optional, specify if needed\n * orderBy: \"created_at\", // optional, specify if needed\n * },\n * });\n *\n * console.log(accountOwnedObjects);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async getAccountOwnedObjects(args: {\n accountAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetObjectDataQueryResponse[0]>;\n }): Promise<GetObjectDataQueryResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.DEFAULT,\n });\n return getAccountOwnedObjects({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Derives an account by providing a private key. This function resolves the provided private key type and derives the public\n * key from it.\n *\n * If the privateKey is a Secp256k1 type, it derives the account using the derived public key and auth key using the SingleKey\n * scheme locally.\n * If the privateKey is an ED25519 type, it looks up the authentication key on chain to determine whether it is a Legacy ED25519\n * key or a Unified ED25519 key, and then derives the account based on that.\n *\n * @param args - The arguments for deriving the account.\n * @param args.privateKey - An account private key.\n * @returns The derived Account type.\n *\n * @example\n * ```typescript\n * import { Aptos, AptosConfig, Network, Ed25519PrivateKey } from \"@aptos-labs/ts-sdk\";\n *\n * const config = new AptosConfig({ network: Network.TESTNET });\n * const aptos = new Aptos(config);\n *\n * async function runExample() {\n * // Deriving an account from a private key\n * const account = await aptos.deriveAccountFromPrivateKey({\n * privateKey: new Ed25519PrivateKey(\"0x123\") // replace with a real private key\n * });\n *\n * console.log(account);\n * }\n * runExample().catch(console.error);\n * ```\n */\n async deriveAccountFromPrivateKey(args: { privateKey: PrivateKey }): Promise<AccountModule> {\n return deriveAccountFromPrivateKey({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"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","names":["Account","config","args","getInfo","getModules","getModule","getTransactions","getResources","getResource","lookupOriginalAccountAddress","waitForIndexerOnVersion","getAccountTokensCount","getAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","getAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","getAccountCoinsData","getAccountCoinsCount","APTOS_COIN","APTOS_FA","accountAddress","coinType","faMetadataAddress","coinAssetType","memoizeAsync","pairedCoinTypeStruct","view","isEncodedStruct","parseEncodedStruct","faAddress","AccountAddress","createObjectAddress","addr","balanceStr","getAccountOwnedObjects","deriveAccountFromPrivateKey"]}
@@ -0,0 +1,2 @@
1
+ import{b as t}from"./chunk-KFNDDPOW.mjs";var o=n=>typeof n=="string"?t.isValid(n).valid?n:new TextEncoder().encode(n):n;export{o as a};
2
+ //# sourceMappingURL=chunk-KIW54KWR.mjs.map
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-A63SMUOU.mjs";import{a as i}from"./chunk-LG7RJQ57.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var g=(s=>(s.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",s.INVALID_HEX_CHARS="invalid_hex_chars",s.TOO_SHORT="too_short",s.TOO_LONG="too_long",s.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",s.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",s.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",s))(g||{}),r=class r extends a{constructor(t){if(super(),t.length!==r.LENGTH)throw new i("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=o(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return o(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let e=this.bcsToBytes();t.serializeBytes(e)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r(e)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");let e=r.fromString(t);if(t.length!==r.LONG_STRING_LENGTH+2)if(e.isSpecial()){if(t.length!==3)throw new i(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new i(`The given hex string ${t} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return e}static fromString(t){let e=t;if(t.startsWith("0x")&&(e=t.slice(2)),e.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(e.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let n;try{n=l(e.padStart(64,"0"))}catch(c){throw new i(`Hex characters are invalid: ${c?.message}`,"invalid_hex_chars")}return new r(n)}static from(t){return typeof t=="string"?r.fromString(t):t instanceof Uint8Array?new r(t):t}static fromStrict(t){return typeof t=="string"?r.fromStringStrict(t):t instanceof Uint8Array?new r(t):t}static isValid(t){try{return t.strict?r.fromStrict(t.input):r.from(t.input),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};r.LENGTH=32,r.LONG_STRING_LENGTH=64,r.ZERO=r.from("0x0"),r.ONE=r.from("0x1"),r.TWO=r.from("0x2"),r.THREE=r.from("0x3"),r.FOUR=r.from("0x4"),r.A=r.from("0xA");var d=r;export{g as a,d as b};
2
- //# sourceMappingURL=chunk-OHRL766V.mjs.map
1
+ import{a}from"./chunk-QQIVWB6G.mjs";import{a as i}from"./chunk-6Q2O5G3J.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var g=(s=>(s.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",s.INVALID_HEX_CHARS="invalid_hex_chars",s.TOO_SHORT="too_short",s.TOO_LONG="too_long",s.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",s.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",s.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",s))(g||{}),r=class r extends a{constructor(t){if(super(),t.length!==r.LENGTH)throw new i("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=o(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return o(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let e=this.bcsToBytes();t.serializeBytes(e)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r(e)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");let e=r.fromString(t);if(t.length!==r.LONG_STRING_LENGTH+2)if(e.isSpecial()){if(t.length!==3)throw new i(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new i(`The given hex string ${t} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return e}static fromString(t){let e=t;if(t.startsWith("0x")&&(e=t.slice(2)),e.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(e.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let n;try{n=l(e.padStart(64,"0"))}catch(c){throw new i(`Hex characters are invalid: ${c?.message}`,"invalid_hex_chars")}return new r(n)}static from(t){return typeof t=="string"?r.fromString(t):t instanceof Uint8Array?new r(t):t}static fromStrict(t){return typeof t=="string"?r.fromStringStrict(t):t instanceof Uint8Array?new r(t):t}static isValid(t){try{return t.strict?r.fromStrict(t.input):r.from(t.input),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};r.LENGTH=32,r.LONG_STRING_LENGTH=64,r.ZERO=r.from("0x0"),r.ONE=r.from("0x1"),r.TWO=r.from("0x2"),r.THREE=r.from("0x3"),r.FOUR=r.from("0x4"),r.A=r.from("0xA");var d=r;export{g as a,d as b};
2
+ //# sourceMappingURL=chunk-KM6UXNC7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * Provides reasons for an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\n/**\n * The input for an account address, which can be either a hexadecimal string or a standard account address.\n */\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n static A: AccountAddress = AccountAddress.from(\"0xA\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * This function ensures that the input data is exactly 32 bytes long, which is required for a valid account address.\n *\n * @param input A Uint8Array representing an account address.\n * @throws ParsingError if the input length is not equal to 32 bytes.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Determines if the address is classified as special, which is defined as 0x0 to 0xf inclusive.\n * In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined, see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false otherwise.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n * This representation returns special addresses in SHORT form (0xf)\n * and other addresses in LONG form (0x + 64 characters).\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * Return the AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n *\n * NOTE: Prefer to use `toString` where possible.\n *\n * @returns AccountAddress as a string without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * Convert the account address to a string in LONG format, which is always 0x followed by 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * Returns the account address as a string in LONG form without a leading 0x.\n * This function will include leading zeroes and will produce a string of 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns {string} The account address in LONG form.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the inner data as a Uint8Array.\n * 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 * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n /**\n * Serializes the current instance into a byte sequence suitable for entry functions.\n * This allows for the proper encoding of data when interacting with entry functions in the blockchain.\n *\n * @param serializer - The serializer instance used to convert the data into bytes.\n */\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Serializes the current instance for use in a script function by encoding it into a byte sequence.\n * This process involves serializing the variant index and the instance data, making it suitable for transmission.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * This function allows you to convert a byte representation of an AccountAddress into an instance of AccountAddress.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * @param input - A hex string representing an account address.\n *\n * @throws {ParsingError} If the hex string does not start with 0x or is not in a valid format.\n *\n * @note This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.\n *\n * @see AIP-40 documentation for more details on address formats:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input - A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n *\n * @throws ParsingError if the hex string is too short, too long, or contains invalid characters.\n */\n static fromString(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from various input types.\n * This function accepts a string, Uint8Array, or an existing AccountAddress instance and returns the corresponding\n * AccountAddress.\n *\n * @param input - The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array,\n * or an existing AccountAddress.\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromString(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n\n /**\n * Create an AccountAddress from various input types, including strings, Uint8Array, and AccountAddress instances.\n *\n * @param input - The input to convert into an AccountAddress, which can be a string, a Uint8Array, or an AccountAddress.\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromStringStrict(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided input is a valid AccountAddress.\n *\n * @param args - The arguments for validation.\n * @param args.input - A hex string representing an account address.\n * @param args.strict - If true, use strict parsing behavior; if false, use relaxed parsing behavior.\n *\n * @returns An object indicating whether the address is valid. If valid, valid = true; if not, valid = false with additional details.\n * If the address is invalid, invalidReason will explain why it is invalid, and invalidReasonMessage will provide the error message.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\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 AccountAddresses are equal based on their underlying byte data.\n *\n * @param other - The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): 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"],"mappings":"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","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
@@ -1,2 +1,2 @@
1
- import{b as y,c as f,d as x,e as v,f as A,g as C,h as U,i as b,j as I,k as M,l as P,m as E,n as G,o as N}from"./chunk-SUJLWCRN.mjs";import{a as l}from"./chunk-YUNDX5I7.mjs";import{b as w}from"./chunk-OHRL766V.mjs";function V(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function W(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e){return!!e.match(/^&.+$/)}function k(e){switch(e){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function L(e,i){let c=i;for(;c<e.length;c+=1){let s=e[c];if(!W(s))break}return c}var R=(a=>(a.InvalidTypeTag="unknown type",a.UnexpectedGenericType="unexpected generic type",a.UnexpectedTypeArgumentClose="unexpected '>'",a.UnexpectedWhitespaceCharacter="unexpected whitespace character",a.UnexpectedComma="unexpected ','",a.TypeArgumentCountMismatch="type argument count doesn't match expected amount",a.MissingTypeArgumentClose="no matching '>' for '<'",a.MissingTypeArgument="no type argument before ','",a.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",a.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",a.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",a.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",a.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",a.InvalidAddress="struct address must be valid",a))(R||{}),t=class extends Error{constructor(i,c){super(`Failed to parse typeTag '${i}', ${c}`)}};function j(e,i){let c=i?.allowGenerics??!1,s=[],u=[],n=[],o=0,r="",T=1;for(;o<e.length;){let d=e[o];if(d==="<")s.push({savedExpectedTypes:T,savedStr:r,savedTypes:n}),r="",n=[],T=1;else if(d===">"){if(r!==""){let a=g(r,u,c);n.push(a)}let p=s.pop();if(p===void 0)throw new t(e,"unexpected '>'");if(T!==n.length)throw new t(e,"type argument count doesn't match expected amount");let{savedStr:m,savedTypes:h,savedExpectedTypes:_}=p;u=n,n=h,r=m,T=_}else if(d===","){if(s.length===0)throw new t(e,"unexpected ','");if(r.length===0)throw new t(e,"no type argument before ','");let p=g(r,u,c);u=[],n.push(p),r="",T+=1}else if(W(d)){let p=!1;if(r.length!==0){let h=g(r,u,c);u=[],n.push(h),r="",p=!0}o=L(e,o);let m=e[o];if(o<e.length&&p&&m!==","&&m!==">")throw new t(e,"unexpected whitespace character");continue}else r+=d;o+=1}if(s.length>0)throw new t(e,"no matching '>' for '<'");switch(n.length){case 0:return g(r,u,c);case 1:if(r==="")return n[0];throw new t(e,"unexpected ','");default:throw new t(e,"unexpected whitespace character")}}function g(e,i,c){let s=e.trim(),u=s.toLowerCase();if(k(u)&&i.length>0)throw new t(e,"primitive types not expected to have type arguments");switch(s.toLowerCase()){case"signer":return new I;case"bool":return new y;case"address":return new b;case"u8":return new f;case"u16":return new x;case"u32":return new v;case"u64":return new A;case"u128":return new C;case"u256":return new U;case"vector":if(i.length!==1)throw new t(e,"vector type expected to have exactly one type argument");return new E(i[0]);default:if(F(s)){let r=s.substring(1);return new M(g(r,i,c))}if($(s)){if(c)return new P(Number(s.split("T")[1]));throw new t(e,"unexpected generic type")}if(!s.match(/:/))throw new t(e,"unknown type");let n=s.split("::");if(n.length!==3)throw new t(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let o;try{o=w.fromString(n[0])}catch{throw new t(e,"struct address must be valid")}if(!V(n[1]))throw new t(e,"module name must only contain alphanumeric or '_' characters");if(!V(n[2]))throw new t(e,"struct name must only contain alphanumeric or '_' characters");return new G(new N(o,new l(n[1]),new l(n[2]),i))}}export{R as a,t as b,j as c};
2
- //# sourceMappingURL=chunk-NWOMSL6K.mjs.map
1
+ import{b as y,c as f,d as x,e as v,f as A,g as C,h as U,i as b,j as I,k as M,l as P,m as E,n as G,o as N}from"./chunk-OTY3NO7Q.mjs";import{a as l}from"./chunk-AGBA3Y7A.mjs";import{b as w}from"./chunk-KM6UXNC7.mjs";function V(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function W(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e){return!!e.match(/^&.+$/)}function k(e){switch(e){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function L(e,i){let c=i;for(;c<e.length;c+=1){let s=e[c];if(!W(s))break}return c}var R=(a=>(a.InvalidTypeTag="unknown type",a.UnexpectedGenericType="unexpected generic type",a.UnexpectedTypeArgumentClose="unexpected '>'",a.UnexpectedWhitespaceCharacter="unexpected whitespace character",a.UnexpectedComma="unexpected ','",a.TypeArgumentCountMismatch="type argument count doesn't match expected amount",a.MissingTypeArgumentClose="no matching '>' for '<'",a.MissingTypeArgument="no type argument before ','",a.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",a.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",a.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",a.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",a.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",a.InvalidAddress="struct address must be valid",a))(R||{}),t=class extends Error{constructor(i,c){super(`Failed to parse typeTag '${i}', ${c}`)}};function j(e,i){let c=i?.allowGenerics??!1,s=[],u=[],n=[],o=0,r="",T=1;for(;o<e.length;){let d=e[o];if(d==="<")s.push({savedExpectedTypes:T,savedStr:r,savedTypes:n}),r="",n=[],T=1;else if(d===">"){if(r!==""){let a=g(r,u,c);n.push(a)}let p=s.pop();if(p===void 0)throw new t(e,"unexpected '>'");if(T!==n.length)throw new t(e,"type argument count doesn't match expected amount");let{savedStr:m,savedTypes:h,savedExpectedTypes:_}=p;u=n,n=h,r=m,T=_}else if(d===","){if(s.length===0)throw new t(e,"unexpected ','");if(r.length===0)throw new t(e,"no type argument before ','");let p=g(r,u,c);u=[],n.push(p),r="",T+=1}else if(W(d)){let p=!1;if(r.length!==0){let h=g(r,u,c);u=[],n.push(h),r="",p=!0}o=L(e,o);let m=e[o];if(o<e.length&&p&&m!==","&&m!==">")throw new t(e,"unexpected whitespace character");continue}else r+=d;o+=1}if(s.length>0)throw new t(e,"no matching '>' for '<'");switch(n.length){case 0:return g(r,u,c);case 1:if(r==="")return n[0];throw new t(e,"unexpected ','");default:throw new t(e,"unexpected whitespace character")}}function g(e,i,c){let s=e.trim(),u=s.toLowerCase();if(k(u)&&i.length>0)throw new t(e,"primitive types not expected to have type arguments");switch(s.toLowerCase()){case"signer":return new I;case"bool":return new y;case"address":return new b;case"u8":return new f;case"u16":return new x;case"u32":return new v;case"u64":return new A;case"u128":return new C;case"u256":return new U;case"vector":if(i.length!==1)throw new t(e,"vector type expected to have exactly one type argument");return new E(i[0]);default:if(F(s)){let r=s.substring(1);return new M(g(r,i,c))}if($(s)){if(c)return new P(Number(s.split("T")[1]));throw new t(e,"unexpected generic type")}if(!s.match(/:/))throw new t(e,"unknown type");let n=s.split("::");if(n.length!==3)throw new t(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let o;try{o=w.fromString(n[0])}catch{throw new t(e,"struct address must be valid")}if(!V(n[1]))throw new t(e,"module name must only contain alphanumeric or '_' characters");if(!V(n[2]))throw new t(e,"struct name must only contain alphanumeric or '_' characters");return new G(new N(o,new l(n[1]),new l(n[2]),i))}}export{R as a,t as b,j as c};
2
+ //# sourceMappingURL=chunk-KRVLR3L4.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/typeTag/parser.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n StructTag,\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagGeneric,\n TypeTagReference,\n TypeTagSigner,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n TypeTagVector,\n} from \".\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"../instances/identifier\";\n\n/**\n * Determines if the provided string is a valid Move identifier, which can only contain alphanumeric characters and underscores.\n * @param str - The string to validate as a Move identifier.\n */\nfunction isValidIdentifier(str: string) {\n return !!str.match(/^[_a-zA-Z0-9]+$/);\n}\n\n/**\n * Determines if the provided character is a whitespace character. This function only works for single characters.\n * @param char - The character to check for whitespace.\n */\nfunction isValidWhitespaceCharacter(char: string) {\n return !!char.match(/\\s/);\n}\n\n/**\n * Determines if a given string represents a generic type from the ABI, specifically in the format T0, T1, etc.\n * @param str - The string to evaluate for generic type format.\n */\nfunction isGeneric(str: string) {\n return !!str.match(/^T[0-9]+$/);\n}\n\n/**\n * Determines if the provided string is a reference type, which is indicated by starting with an ampersand (&).\n * @param str - The string to evaluate for reference type.\n */\nfunction isRef(str: string) {\n return !!str.match(/^&.+$/);\n}\n\n/**\n * Determines if the provided string represents a primitive type.\n * @param str - The string to evaluate as a potential primitive type.\n * @returns A boolean indicating whether the string is a primitive type.\n */\nfunction isPrimitive(str: string) {\n switch (str) {\n case \"signer\":\n case \"address\":\n case \"bool\":\n case \"u8\":\n case \"u16\":\n case \"u32\":\n case \"u64\":\n case \"u128\":\n case \"u256\":\n return true;\n default:\n return false;\n }\n}\n\n/**\n * Consumes all whitespace characters in a string starting from a specified position.\n *\n * @param tagStr - The string from which to consume whitespace.\n * @param pos - The position in the string to start consuming whitespace from.\n * @returns The new position in the string after consuming whitespace.\n */\nfunction consumeWhitespace(tagStr: string, pos: number) {\n let i = pos;\n for (; i < tagStr.length; i += 1) {\n const innerChar = tagStr[i];\n\n if (!isValidWhitespaceCharacter(innerChar)) {\n // If it's not colons, and it's an invalid character, we will stop here\n break;\n }\n }\n return i;\n}\n\n/**\n * State for TypeTag parsing, maintained on a stack to track the current parsing state.\n */\ntype TypeTagState = {\n savedExpectedTypes: number;\n savedStr: string;\n savedTypes: Array<TypeTag>;\n};\n\n/**\n * Error types related to parsing type tags, indicating various issues encountered during the parsing process.\n */\nexport enum TypeTagParserErrorType {\n InvalidTypeTag = \"unknown type\",\n UnexpectedGenericType = \"unexpected generic type\",\n UnexpectedTypeArgumentClose = \"unexpected '>'\",\n UnexpectedWhitespaceCharacter = \"unexpected whitespace character\",\n UnexpectedComma = \"unexpected ','\",\n TypeArgumentCountMismatch = \"type argument count doesn't match expected amount\",\n MissingTypeArgumentClose = \"no matching '>' for '<'\",\n MissingTypeArgument = \"no type argument before ','\",\n UnexpectedPrimitiveTypeArguments = \"primitive types not expected to have type arguments\",\n UnexpectedVectorTypeArgumentCount = \"vector type expected to have exactly one type argument\",\n UnexpectedStructFormat = \"unexpected struct format, must be of the form 0xaddress::module_name::struct_name\",\n InvalidModuleNameCharacter = \"module name must only contain alphanumeric or '_' characters\",\n InvalidStructNameCharacter = \"struct name must only contain alphanumeric or '_' characters\",\n InvalidAddress = \"struct address must be valid\",\n}\n\n/**\n * Represents an error that occurs during the parsing of a type tag.\n * This error extends the built-in Error class and provides additional context\n * regarding the specific type tag that failed to parse and the reason for the failure.\n *\n * @param typeTagStr - The type tag string that failed to be parsed.\n * @param invalidReason - The reason why the type tag string is considered invalid.\n */\nexport class TypeTagParserError extends Error {\n /**\n * Constructs an error indicating a failure to parse a type tag.\n * This error provides details about the specific type tag that could not be parsed and the reason for the failure.\n *\n * @param typeTagStr - The string representation of the type tag that failed to parse.\n * @param invalidReason - The reason why the type tag is considered invalid.\n */\n constructor(typeTagStr: string, invalidReason: TypeTagParserErrorType) {\n super(`Failed to parse typeTag '${typeTagStr}', ${invalidReason}`);\n }\n}\n\n/**\n * Parses a type string into a structured representation of type tags, accommodating various formats including generics and\n * nested types.\n *\n * This function can help you accurately interpret type strings, which can include simple types, standalone structs, and complex\n * nested generics.\n * It supports multiple generics, spacing within generics, and nested generics of varying depths.\n * All types are made of a few parts they're either:\n * 1. A simple type e.g. u8\n * 2. A standalone struct e.g. 0x1::account::Account\n * 3. A nested struct e.g. 0x1::coin::Coin<0x1234::coin::MyCoin>\n *\n * There are a few more special cases that need to be handled, however.\n * 1. Multiple generics e.g. 0x1::pair::Pair<u8, u16>\n * 2. Spacing in the generics e.g. 0x1::pair::Pair< u8 , u16>\n * 3. Nested generics of different depths e.g. 0x1::pair::Pair<0x1::coin::Coin<0x1234::coin::MyCoin>, u8>\n * 4. Generics for types in ABIs are filled in with placeholders e.g. T1, T2, T3\n * @param typeStr - The string representation of the type to be parsed.\n * @param options - Optional settings for parsing behavior.\n * @param options.allowGenerics - A flag indicating whether to allow generics in the parsing process.\n * @returns The parsed type tag representation.\n * @throws TypeTagParserError if the type string is malformed or does not conform to expected formats.\n */\nexport function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolean }) {\n const allowGenerics = options?.allowGenerics ?? false;\n\n const saved: Array<TypeTagState> = [];\n // This represents the internal types for a type tag e.g. '0x1::coin::Coin<innerTypes>'\n let innerTypes: Array<TypeTag> = [];\n // This represents the current parsed types in a comma list e.g. 'u8, u8'\n let curTypes: Array<TypeTag> = [];\n // This represents the current character index\n let cur: number = 0;\n // This represents the current working string as a type or struct name\n let currentStr: string = \"\";\n let expectedTypes: number = 1;\n\n // Iterate through each character, and handle the border conditions\n while (cur < typeStr.length) {\n const char = typeStr[cur];\n\n if (char === \"<\") {\n // Start of a type argument, push current state onto a stack\n saved.push({\n savedExpectedTypes: expectedTypes,\n savedStr: currentStr,\n savedTypes: curTypes,\n });\n\n // Clear current state\n currentStr = \"\";\n curTypes = [];\n expectedTypes = 1;\n } else if (char === \">\") {\n // Process last type, if there is no type string, then don't parse it\n if (currentStr !== \"\") {\n const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n curTypes.push(newType);\n }\n\n // Pop off stack outer type, if there's nothing left, there were too many '>'\n const savedPop = saved.pop();\n if (savedPop === undefined) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedTypeArgumentClose);\n }\n\n // If the expected types don't match the number of commas, then we also fail\n if (expectedTypes !== curTypes.length) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.TypeArgumentCountMismatch);\n }\n\n // Add in the new created type, shifting the current types to the inner types\n const { savedStr, savedTypes, savedExpectedTypes } = savedPop;\n innerTypes = curTypes;\n curTypes = savedTypes;\n currentStr = savedStr;\n expectedTypes = savedExpectedTypes;\n } else if (char === \",\") {\n // Comma means we need to start parsing a new tag, push the previous one to the curTypes\n\n // No top level commas (not in a type <> are allowed)\n if (saved.length === 0) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedComma);\n }\n // If there was no actual value before the comma, then it's missing a type argument\n if (currentStr.length === 0) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.MissingTypeArgument);\n }\n\n // Process characters before as a type\n const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n\n // parse type tag and push it on the types\n innerTypes = [];\n curTypes.push(newType);\n currentStr = \"\";\n expectedTypes += 1;\n } else if (isValidWhitespaceCharacter(char)) {\n // This means we should save what we have and everything else should skip until the next\n let parsedTypeTag = false;\n if (currentStr.length !== 0) {\n const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n\n // parse type tag and push it on the types\n innerTypes = [];\n curTypes.push(newType);\n currentStr = \"\";\n parsedTypeTag = true;\n }\n\n // Skip ahead on any more whitespace\n cur = consumeWhitespace(typeStr, cur);\n\n // The next space MUST be a comma, or a closing > if there was something parsed before\n // e.g. `u8 u8` is invalid but `u8, u8` is valid\n const nextChar = typeStr[cur];\n if (cur < typeStr.length && parsedTypeTag && nextChar !== \",\" && nextChar !== \">\") {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedWhitespaceCharacter);\n }\n\n // eslint-disable-next-line no-continue\n continue;\n } else {\n // Any other characters just append to the current string\n currentStr += char;\n }\n\n cur += 1;\n }\n\n // This prevents a missing '>' on type arguments\n if (saved.length > 0) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.MissingTypeArgumentClose);\n }\n\n // This prevents 'u8, u8' as an input\n switch (curTypes.length) {\n case 0:\n return parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n case 1:\n if (currentStr === \"\") {\n return curTypes[0];\n }\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedComma);\n default:\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedWhitespaceCharacter);\n }\n}\n\n/**\n * Parses a type tag with internal types associated, allowing for the inclusion of generics if specified. This function helps in\n * constructing the appropriate type tags based on the provided string representation and associated types.\n *\n * @param str - The string representation of the type tag to parse.\n * @param types - An array of TypeTag instances that represent internal types associated with the type tag.\n * @param allowGenerics - A boolean indicating whether generics are allowed in the parsing of the type tag.\n */\nfunction parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: boolean): TypeTag {\n const trimmedStr = str.trim();\n const lowerCaseTrimmed = trimmedStr.toLowerCase();\n if (isPrimitive(lowerCaseTrimmed)) {\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n }\n\n switch (trimmedStr.toLowerCase()) {\n case \"signer\":\n return new TypeTagSigner();\n case \"bool\":\n return new TypeTagBool();\n case \"address\":\n return new TypeTagAddress();\n case \"u8\":\n return new TypeTagU8();\n case \"u16\":\n return new TypeTagU16();\n case \"u32\":\n return new TypeTagU32();\n case \"u64\":\n return new TypeTagU64();\n case \"u128\":\n return new TypeTagU128();\n case \"u256\":\n return new TypeTagU256();\n case \"vector\":\n if (types.length !== 1) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedVectorTypeArgumentCount);\n }\n return new TypeTagVector(types[0]);\n default:\n // Reference will have to handle the inner type\n if (isRef(trimmedStr)) {\n const actualType = trimmedStr.substring(1);\n return new TypeTagReference(parseTypeTagInner(actualType, types, allowGenerics));\n }\n\n // Generics are always expected to be T0 or T1\n if (isGeneric(trimmedStr)) {\n if (allowGenerics) {\n return new TypeTagGeneric(Number(trimmedStr.split(\"T\")[1]));\n }\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedGenericType);\n }\n\n // If the value doesn't contain a colon, then we'll assume it isn't trying to be a struct\n if (!trimmedStr.match(/:/)) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidTypeTag);\n }\n\n // Parse for a struct tag\n // eslint-disable-next-line no-case-declarations\n const structParts = trimmedStr.split(\"::\");\n if (structParts.length !== 3) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);\n }\n\n // Validate struct address\n // eslint-disable-next-line no-case-declarations\n let address: AccountAddress;\n try {\n address = AccountAddress.fromString(structParts[0]);\n } catch (error: any) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidAddress);\n }\n\n // Validate identifier characters\n if (!isValidIdentifier(structParts[1])) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidModuleNameCharacter);\n }\n if (!isValidIdentifier(structParts[2])) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidStructNameCharacter);\n }\n\n return new TypeTagStruct(\n new StructTag(address, new Identifier(structParts[1]), new Identifier(structParts[2]), types),\n );\n }\n}\n"],"mappings":"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","names":["isValidIdentifier","str","isValidWhitespaceCharacter","char","isGeneric","isRef","isPrimitive","consumeWhitespace","tagStr","pos","i","innerChar","TypeTagParserErrorType","TypeTagParserError","typeTagStr","invalidReason","parseTypeTag","typeStr","options","allowGenerics","saved","innerTypes","curTypes","cur","currentStr","expectedTypes","newType","parseTypeTagInner","savedPop","savedStr","savedTypes","savedExpectedTypes","parsedTypeTag","nextChar","types","trimmedStr","lowerCaseTrimmed","TypeTagSigner","TypeTagBool","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","TypeTagVector","actualType","TypeTagReference","TypeTagGeneric","structParts","address","AccountAddress","TypeTagStruct","StructTag","Identifier"]}
@@ -1,2 +1,2 @@
1
- import{d as p}from"./chunk-O2BPA6TS.mjs";import{d as s}from"./chunk-KUZ2YTJH.mjs";import{a as u,b as y}from"./chunk-GMBSQDPO.mjs";import{b as a}from"./chunk-GDO6Q2FI.mjs";import{c as i}from"./chunk-GWSDIX6C.mjs";import{b as g}from"./chunk-OHRL766V.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
2
- //# sourceMappingURL=chunk-4HR32TSY.mjs.map
1
+ import{d as p}from"./chunk-VQTEGTUQ.mjs";import{d as s}from"./chunk-IFHQSZLK.mjs";import{a as u,b as y}from"./chunk-S3FVA55H.mjs";import{b as a}from"./chunk-DZJXOL64.mjs";import{c as i}from"./chunk-WSVOJSAC.mjs";import{b as g}from"./chunk-KM6UXNC7.mjs";var h=class c{constructor(e){this.signingScheme=2;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=new u(r.publicKey()),this.accountAddress=t?g.from(t):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:r=0}=e,t;switch(r){case 0:t=i.generate();break;case 2:t=a.generate();break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:t})}static fromDerivationPath(e){let{scheme:r=0,path:t,mnemonic:o}=e,n;switch(r){case 0:n=i.fromDerivationPath(t,o);break;case 2:n=a.fromDerivationPath(t,o);break;default:throw new Error(`Unsupported signature scheme ${r}`)}return new c({privateKey:n})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new s(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new s(this.publicKey,this.signTransaction(e))}sign(e){return new y(this.privateKey.sign(e))}signTransaction(e){return this.sign(p(e))}};export{h as a};
2
+ //# sourceMappingURL=chunk-KSKQVOBA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/SingleKeyAccount.ts"],"sourcesContent":["import { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { type HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { AnyPublicKey, AnySignature, Ed25519PrivateKey, PrivateKey, Secp256k1PrivateKey } from \"../core/crypto\";\nimport type { Account } from \"./Account\";\nimport { generateSigningMessageForTransaction } from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\n/**\n * Arguments required to create a single key signer.\n *\n * @param privateKey - The private key used for signing.\n * @param address - Optional account address associated with the signer.\n */\nexport interface SingleKeySignerConstructorArgs {\n privateKey: PrivateKey;\n address?: AccountAddressInput;\n}\n\n/**\n * Arguments for generating a single key signer.\n *\n * @param scheme - The signing scheme to be used.\n */\nexport interface SingleKeySignerGenerateArgs {\n scheme?: SigningSchemeInput;\n}\n\n/**\n * The arguments for generating a single key signer from a specified derivation path.\n */\nexport type SingleKeySignerFromDerivationPathArgs = SingleKeySignerGenerateArgs & {\n path: string;\n mnemonic: string;\n};\n\n/**\n * Arguments required to verify a single key signature for a given message.\n *\n * @param message - The message to be verified, represented in hexadecimal format.\n * @param signature - The signature that corresponds to the message.\n */\nexport interface VerifySingleKeySignatureArgs {\n message: HexInput;\n signature: AnySignature;\n}\n\n/**\n * Signer implementation for the SingleKey authentication scheme.\n * This class extends a SingleKeyAccount by adding signing capabilities through a valid private key.\n * Currently, the only supported signature schemes are Ed25519 and Secp256k1.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class SingleKeyAccount implements Account {\n /**\n * Private key associated with the account\n */\n readonly privateKey: PrivateKey;\n\n readonly publicKey: AnyPublicKey;\n\n readonly accountAddress: AccountAddress;\n\n readonly signingScheme = SigningScheme.SingleKey;\n\n /**\n * Creates an instance of the SingleKeySigner using the provided private key and address.\n * This allows for signing transactions and messages with the specified private key.\n *\n * @param args - The constructor arguments for initializing the SingleKeySigner.\n * @param args.privateKey - The private key used for signing.\n * @param args.address - The optional account address; if not provided, it will derive the address from the public key.\n */\n constructor(args: SingleKeySignerConstructorArgs) {\n const { privateKey, address } = args;\n this.privateKey = privateKey;\n this.publicKey = new AnyPublicKey(privateKey.publicKey());\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n }\n\n /**\n * Derives an account from a randomly generated private key based on the specified signing scheme.\n * The default generation scheme is Ed25519, but it can also support Secp256k1Ecdsa.\n *\n * @param args - The arguments for generating the account.\n * @param args.scheme - The signing scheme to use for generating the private key. Defaults to SigningSchemeInput.Ed25519.\n * @returns An account with the generated private key based on the specified signing scheme.\n * @throws Error if an unsupported signature scheme is provided.\n */\n static generate(args: SingleKeySignerGenerateArgs = {}) {\n const { scheme = SigningSchemeInput.Ed25519 } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.generate();\n break;\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.generate();\n break;\n default:\n throw new Error(`Unsupported signature scheme ${scheme}`);\n }\n return new SingleKeyAccount({ privateKey });\n }\n\n /**\n * Derives an account using a specified BIP44 path and mnemonic seed phrase, defaulting to the Ed25519 signature scheme.\n * This function allows you to create a single key account based on the provided derivation path and mnemonic.\n *\n * @param args - The arguments for deriving the account.\n * @param args.scheme - The signature scheme to derive the private key with. Defaults to Ed25519.\n * @param args.path - The BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519, or non-hardened path\n * (e.g. m/44'/637'/0'/0/0) for secp256k1.\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic - The mnemonic seed phrase of the account.\n */\n static fromDerivationPath(args: SingleKeySignerFromDerivationPathArgs) {\n const { scheme = SigningSchemeInput.Ed25519, path, mnemonic } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n default:\n throw new Error(`Unsupported signature scheme ${scheme}`);\n }\n return new SingleKeyAccount({ privateKey });\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The raw message data in HexInput format.\n * @param args.signature - The signed message signature.\n * @returns A boolean indicating whether the signature is valid.\n */\n verifySignature(args: VerifySingleKeySignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n\n /**\n * Sign a message using the account's private key and return an AccountAuthenticator containing the signature along with the\n * account's public key.\n * @param message - The signing message, represented as binary input in hexadecimal format.\n * @returns An instance of AccountAuthenticatorSingleKey containing the signature and the public key.\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n return new AccountAuthenticatorSingleKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's private key.\n * This function returns an AccountAuthenticator that contains the signature of the transaction along with the account's public key.\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticatorSingleKey containing the signature of the transaction and the account's public key.\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n return new AccountAuthenticatorSingleKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Sign the given message using the account's private key.\n * @param message - The message to be signed in HexInput format.\n * @returns A new AnySignature containing the signature of the message.\n */\n sign(message: HexInput): AnySignature {\n return new AnySignature(this.privateKey.sign(message));\n }\n\n /**\n * Sign the given transaction using the account's private key.\n * This function generates a signing message for the transaction and then signs it.\n *\n * @param transaction - The transaction to be signed.\n * @returns Signature - The resulting signature for the signed transaction.\n */\n signTransaction(transaction: AnyRawTransaction): AnySignature {\n return this.sign(generateSigningMessageForTransaction(transaction));\n }\n\n // endregion\n}\n"],"mappings":"6PAsDO,IAAMA,EAAN,MAAMC,CAAoC,CAoB/C,YAAYC,EAAsC,CAVlD,KAAS,cAAgB,EAWvB,GAAM,CAAE,WAAAC,EAAY,QAAAC,CAAQ,EAAIF,EAChC,KAAK,WAAaC,EAClB,KAAK,UAAY,IAAIE,EAAaF,EAAW,UAAU,CAAC,EACxD,KAAK,eAAiBC,EAAUE,EAAe,KAAKF,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,CACzG,CAWA,OAAO,SAASF,EAAoC,CAAC,EAAG,CACtD,GAAM,CAAE,OAAAK,GAAoC,EAAIL,EAC5CC,EACJ,OAAQI,EAAQ,CACd,OACEJ,EAAaK,EAAkB,SAAS,EACxC,MACF,OACEL,EAAaM,EAAoB,SAAS,EAC1C,MACF,QACE,MAAM,IAAI,MAAM,gCAAgCF,CAAM,EAAE,CAC5D,CACA,OAAO,IAAIN,EAAiB,CAAE,WAAAE,CAAW,CAAC,CAC5C,CAaA,OAAO,mBAAmBD,EAA6C,CACrE,GAAM,CAAE,OAAAK,IAAqC,KAAAG,EAAM,SAAAC,CAAS,EAAIT,EAC5DC,EACJ,OAAQI,EAAQ,CACd,OACEJ,EAAaK,EAAkB,mBAAmBE,EAAMC,CAAQ,EAChE,MACF,OACER,EAAaM,EAAoB,mBAAmBC,EAAMC,CAAQ,EAClE,MACF,QACE,MAAM,IAAI,MAAM,gCAAgCJ,CAAM,EAAE,CAC5D,CACA,OAAO,IAAIN,EAAiB,CAAE,WAAAE,CAAW,CAAC,CAC5C,CAUA,gBAAgBD,EAA6C,CAC3D,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CAQA,sBAAsBU,EAAkD,CACtE,OAAO,IAAIC,EAA8B,KAAK,UAAW,KAAK,KAAKD,CAAO,CAAC,CAC7E,CAQA,iCAAiCE,EAA+D,CAC9F,OAAO,IAAID,EAA8B,KAAK,UAAW,KAAK,gBAAgBC,CAAW,CAAC,CAC5F,CAOA,KAAKF,EAAiC,CACpC,OAAO,IAAIG,EAAa,KAAK,WAAW,KAAKH,CAAO,CAAC,CACvD,CASA,gBAAgBE,EAA8C,CAC5D,OAAO,KAAK,KAAKE,EAAqCF,CAAW,CAAC,CACpE,CAGF","names":["SingleKeyAccount","_SingleKeyAccount","args","privateKey","address","AnyPublicKey","AccountAddress","scheme","Ed25519PrivateKey","Secp256k1PrivateKey","path","mnemonic","message","AccountAuthenticatorSingleKey","transaction","AnySignature","generateSigningMessageForTransaction"]}
@@ -1,2 +1,2 @@
1
- import{c as p}from"./chunk-MDJ66AA3.mjs";import{b as a}from"./chunk-CRA2MFJC.mjs";import{b as s}from"./chunk-A63SMUOU.mjs";async function F(n){let{aptosConfig:e,payload:o,options:t}=n,i=await p({...o,aptosConfig:e}),r=new s;i.serialize(r);let u=r.toUint8Array(),{data:d}=await a({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:t?.ledgerVersion},body:u});return d}async function M(n){let{aptosConfig:e,payload:o,options:t}=n,{data:i}=await a({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:t?.ledgerVersion},body:{function:o.function,type_arguments:o.typeArguments??[],arguments:o.functionArguments??[]}});return i}export{F as a,M as b};
2
- //# sourceMappingURL=chunk-ZROQH5YL.mjs.map
1
+ import{c as p}from"./chunk-HGVZ7ULA.mjs";import{b as a}from"./chunk-WOOH5MMX.mjs";import{b as s}from"./chunk-QQIVWB6G.mjs";async function F(n){let{aptosConfig:e,payload:o,options:t}=n,i=await p({...o,aptosConfig:e}),r=new s;i.serialize(r);let u=r.toUint8Array(),{data:d}=await a({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:t?.ledgerVersion},body:u});return d}async function M(n){let{aptosConfig:e,payload:o,options:t}=n,{data:i}=await a({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:t?.ledgerVersion},body:{function:o.function,type_arguments:o.typeArguments??[],arguments:o.functionArguments??[]}});return i}export{F as a,M as b};
2
+ //# sourceMappingURL=chunk-KSUZS6EL.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as y}from"./chunk-5ZBHIUWG.mjs";import{a as u}from"./chunk-UKAXCARD.mjs";import{i as c,n as d}from"./chunk-5CCHECTE.mjs";import{a as p}from"./chunk-N47FTRYO.mjs";import{jwtDecode as h}from"jwt-decode";var f=class i extends y{constructor(e){let r=c.create(e);super({publicKey:r,...e}),this.publicKey=r}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),s=e.deserializeStr(),o=e.deserializeFixedBytes(31),a=u.deserialize(e),n=d.deserialize(e);return i.create({proof:n,pepper:o,uidKey:s,jwt:r,ephemeralKeyPair:a})}static fromBytes(e){return i.deserialize(new p(e))}static create(e){let{address:r,proof:s,jwt:o,ephemeralKeyPair:a,pepper:n,uidKey:l="sub",proofFetchCallback:K}=e,t=h(o);if(typeof t.iss!="string")throw new Error("iss was not found");if(typeof t.aud!="string")throw new Error("aud was not found or an array of values");let m=t[l];return new i({address:r,proof:s,ephemeralKeyPair:a,iss:t.iss,uidKey:l,uidVal:m,aud:t.aud,pepper:n,jwt:o,proofFetchCallback:K})}};export{f as a};
2
+ //# sourceMappingURL=chunk-L5I7F3NZ.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 { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { HexInput } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport { KeylessPublicKey, ZeroKnowledgeSig } from \"../core/crypto\";\n\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Deserializer, Serializer } from \"../bcs\";\nimport { AbstractKeylessAccount, ProofFetchCallback } from \"./AbstractKeylessAccount\";\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 *\n * @static\n * @readonly PEPPER_LENGTH - The length of the pepper used for privacy preservation.\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 * Creates an instance of the transaction with an optional proof.\n *\n * @param args.proof - An optional ZkProof associated with the transaction.\n */\n // TODO: Document rest of parameters\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 }) {\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 serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.ephemeralKeyPair.serialize(serializer);\n if (this.proof === undefined) {\n throw new Error(\"Cannot serialize - proof undefined\");\n }\n this.proof.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 jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n return KeylessAccount.create({\n proof,\n pepper,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n static fromBytes(bytes: Uint8Array): KeylessAccount {\n return KeylessAccount.deserialize(new Deserializer(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 *\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 }): KeylessAccount {\n const { address, proof, jwt, ephemeralKeyPair, pepper, uidKey = \"sub\", proofFetchCallback } = args;\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n if (typeof jwtPayload.iss !== \"string\") {\n throw new Error(\"iss was not found\");\n }\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const uidVal = jwtPayload[uidKey];\n return new KeylessAccount({\n address,\n proof,\n ephemeralKeyPair,\n iss: jwtPayload.iss,\n uidKey,\n uidVal,\n aud: jwtPayload.aud,\n pepper,\n jwt,\n proofFetchCallback,\n });\n }\n}\n"],"mappings":"2KAGA,OAAqB,aAAAA,MAAiB,aAsB/B,IAAMC,EAAN,MAAMC,UAAuBC,CAAuB,CAcjD,YAAYC,EAWjB,CACD,IAAMC,EAAYC,EAAiB,OAAOF,CAAI,EAC9C,MAAM,CAAE,UAAAC,EAAW,GAAGD,CAAK,CAAC,EAC5B,KAAK,UAAYC,CACnB,CAQA,UAAUE,EAA8B,CAKtC,GAJAA,EAAW,aAAa,KAAK,GAAG,EAChCA,EAAW,aAAa,KAAK,MAAM,EACnCA,EAAW,oBAAoB,KAAK,MAAM,EAC1C,KAAK,iBAAiB,UAAUA,CAAU,EACtC,KAAK,QAAU,OACjB,MAAM,IAAI,MAAM,oCAAoC,EAEtD,KAAK,MAAM,UAAUA,CAAU,CACjC,CASA,OAAO,YAAYC,EAA4C,CAC7D,IAAMC,EAAMD,EAAa,eAAe,EAClCE,EAASF,EAAa,eAAe,EACrCG,EAASH,EAAa,sBAAsB,EAAE,EAC9CI,EAAmBC,EAAiB,YAAYL,CAAY,EAC5DM,EAAQC,EAAiB,YAAYP,CAAY,EACvD,OAAON,EAAe,OAAO,CAC3B,MAAAY,EACA,OAAAH,EACA,OAAAD,EACA,IAAAD,EACA,iBAAAG,CACF,CAAC,CACH,CAEA,OAAO,UAAUI,EAAmC,CAClD,OAAOd,EAAe,YAAY,IAAIe,EAAaD,CAAK,CAAC,CAC3D,CAeA,OAAO,OAAOZ,EAQK,CACjB,GAAM,CAAE,QAAAc,EAAS,MAAAJ,EAAO,IAAAL,EAAK,iBAAAG,EAAkB,OAAAD,EAAQ,OAAAD,EAAS,MAAO,mBAAAS,CAAmB,EAAIf,EAExFgB,EAAaC,EAAkDZ,CAAG,EACxE,GAAI,OAAOW,EAAW,KAAQ,SAC5B,MAAM,IAAI,MAAM,mBAAmB,EAErC,GAAI,OAAOA,EAAW,KAAQ,SAC5B,MAAM,IAAI,MAAM,yCAAyC,EAE3D,IAAME,EAASF,EAAWV,CAAM,EAChC,OAAO,IAAIR,EAAe,CACxB,QAAAgB,EACA,MAAAJ,EACA,iBAAAF,EACA,IAAKQ,EAAW,IAChB,OAAAV,EACA,OAAAY,EACA,IAAKF,EAAW,IAChB,OAAAT,EACA,IAAAF,EACA,mBAAAU,CACF,CAAC,CACH,CACF","names":["jwtDecode","KeylessAccount","_KeylessAccount","AbstractKeylessAccount","args","publicKey","KeylessPublicKey","serializer","deserializer","jwt","uidKey","pepper","ephemeralKeyPair","EphemeralKeyPair","proof","ZeroKnowledgeSig","bytes","Deserializer","address","proofFetchCallback","jwtPayload","jwtDecode","uidVal"]}
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-QBSU3L5Q.mjs";import{b as i}from"./chunk-OHRL766V.mjs";import{a as d}from"./chunk-A63SMUOU.mjs";var o=class t extends d{constructor(e,s,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=s}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let s=n.deserialize(e),r=e.deserializeVector(i),c=e.deserializeBool(),a;return c&&(a=i.deserialize(e)),new t(s,r,a)}};export{o as a};
2
- //# sourceMappingURL=chunk-MAMPMCO7.mjs.map
1
+ import{a as n}from"./chunk-7PVIWKGT.mjs";import{b as i}from"./chunk-KM6UXNC7.mjs";import{a as d}from"./chunk-QQIVWB6G.mjs";var o=class t extends d{constructor(e,s,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=s}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let s=n.deserialize(e),r=e.deserializeVector(i),c=e.deserializeBool(),a;return c&&(a=i.deserialize(e)),new t(s,r,a)}};export{o as a};
2
+ //# sourceMappingURL=chunk-LD5MUWGW.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/multiAgentTransaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable @typescript-eslint/naming-convention */\n\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { AccountAddress } from \"../../core\";\nimport { RawTransaction } from \"./rawTransaction\";\n\n/**\n * Represents a multi-agent transaction that can be serialized and deserialized.\n * This transaction includes a raw transaction, optional fee payer address, and multiple secondary signer addresses.\n *\n * @param rawTransaction The raw transaction to be executed.\n * @param secondarySignerAddresses An array of secondary signer addresses involved in the transaction.\n * @param feePayerAddress An optional account address that sponsors the transaction's gas fees.\n */\nexport class MultiAgentTransaction extends Serializable {\n public rawTransaction: RawTransaction;\n\n public feePayerAddress?: AccountAddress | undefined;\n\n public secondarySignerAddresses: AccountAddress[];\n\n /**\n * Represents a MultiAgentTransaction that can be submitted to the Aptos chain for execution.\n * This class encapsulates the raw transaction data, the secondary signer addresses, and an optional fee payer address.\n *\n * @param rawTransaction The raw transaction data.\n * @param secondarySignerAddresses An array of secondary signer addresses.\n * @param feePayerAddress An optional account address that sponsors the gas fees.\n */\n constructor(\n rawTransaction: RawTransaction,\n secondarySignerAddresses: AccountAddress[],\n feePayerAddress?: AccountAddress,\n ) {\n super();\n this.rawTransaction = rawTransaction;\n this.feePayerAddress = feePayerAddress;\n this.secondarySignerAddresses = secondarySignerAddresses;\n }\n\n /**\n * Serializes the transaction data, including the raw transaction, secondary signer addresses, and fee payer address.\n * This function is essential for preparing the transaction for transmission or storage in a serialized format.\n *\n * @param serializer - The serializer instance used to serialize the transaction data.\n */\n serialize(serializer: Serializer): void {\n this.rawTransaction.serialize(serializer);\n\n serializer.serializeVector<AccountAddress>(this.secondarySignerAddresses);\n\n if (this.feePayerAddress === undefined) {\n serializer.serializeBool(false);\n } else {\n serializer.serializeBool(true);\n this.feePayerAddress.serialize(serializer);\n }\n }\n\n /**\n * Deserializes a MultiAgentTransaction from the provided deserializer.\n * This function allows you to reconstruct a MultiAgentTransaction object from its serialized form, including any secondary\n * signer addresses and the fee payer address if present.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n */\n static deserialize(deserializer: Deserializer): MultiAgentTransaction {\n const rawTransaction = RawTransaction.deserialize(deserializer);\n\n const secondarySignerAddresses = deserializer.deserializeVector(AccountAddress);\n\n const feePayerPresent = deserializer.deserializeBool();\n let feePayerAddress;\n if (feePayerPresent) {\n feePayerAddress = AccountAddress.deserialize(deserializer);\n }\n\n return new MultiAgentTransaction(rawTransaction, secondarySignerAddresses, feePayerAddress);\n }\n}\n"],"mappings":"2HAkBO,IAAMA,EAAN,MAAMC,UAA8BC,CAAa,CAetD,YACEC,EACAC,EACAC,EACA,CACA,MAAM,EACN,KAAK,eAAiBF,EACtB,KAAK,gBAAkBE,EACvB,KAAK,yBAA2BD,CAClC,CAQA,UAAUE,EAA8B,CACtC,KAAK,eAAe,UAAUA,CAAU,EAExCA,EAAW,gBAAgC,KAAK,wBAAwB,EAEpE,KAAK,kBAAoB,OAC3BA,EAAW,cAAc,EAAK,GAE9BA,EAAW,cAAc,EAAI,EAC7B,KAAK,gBAAgB,UAAUA,CAAU,EAE7C,CASA,OAAO,YAAYC,EAAmD,CACpE,IAAMJ,EAAiBK,EAAe,YAAYD,CAAY,EAExDH,EAA2BG,EAAa,kBAAkBE,CAAc,EAExEC,EAAkBH,EAAa,gBAAgB,EACjDF,EACJ,OAAIK,IACFL,EAAkBI,EAAe,YAAYF,CAAY,GAGpD,IAAIN,EAAsBE,EAAgBC,EAA0BC,CAAe,CAC5F,CACF","names":["MultiAgentTransaction","_MultiAgentTransaction","Serializable","rawTransaction","secondarySignerAddresses","feePayerAddress","serializer","deserializer","RawTransaction","AccountAddress","feePayerPresent"]}
@@ -1,2 +1,2 @@
1
1
  import{decode as c}from"js-base64";async function m(e){return new Promise(n=>{setTimeout(n,e)})}var u=()=>Math.floor(Date.now()/1e3);function i(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 g=(e,n)=>e*10**n,p=(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}`},f=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{m as a,u as b,i as c,l as d,g as e,p as f,_ as g,f as h};
2
- //# sourceMappingURL=chunk-UAL27G6B.mjs.map
2
+ //# sourceMappingURL=chunk-LEKBJ2EG.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\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,CAEO,IAAME,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,OADsBV,EAAOW,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","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"]}
@@ -0,0 +1,2 @@
1
+ import{a as w}from"./chunk-5ZBHIUWG.mjs";import{a as f}from"./chunk-UKAXCARD.mjs";import{a as y}from"./chunk-37UZKMJI.mjs";import{n as u}from"./chunk-5CCHECTE.mjs";import{a as l}from"./chunk-N47FTRYO.mjs";import{b as c}from"./chunk-KM6UXNC7.mjs";import{jwtDecode as A}from"jwt-decode";var K=class o extends w{constructor(e){let r=y.create(e);super({publicKey:r,...e}),this.publicKey=r}serialize(e){if(this.proof===void 0)throw new Error("Cannot serialize - proof undefined");e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.publicKey.jwkAddress.serialize(e),this.ephemeralKeyPair.serialize(e),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=c.deserialize(e),d=f.deserialize(e),n=u.deserialize(e);return o.create({proof:n,pepper:s,jwkAddress:a,uidKey:i,jwt:r,ephemeralKeyPair:d})}static fromBytes(e){return o.deserialize(new l(e))}static create(e){let{address:r,proof:i,jwt:s,ephemeralKeyPair:a,pepper:d,jwkAddress:n,uidKey:p="sub",proofFetchCallback:m}=e,t=A(s);if(typeof t.iss!="string")throw new Error("iss was not found");if(typeof t.aud!="string")throw new Error("aud was not found or an array of values");let h=t[p];return new o({address:r,proof:i,ephemeralKeyPair:a,iss:t.iss,uidKey:p,uidVal:h,aud:t.aud,pepper:d,jwkAddress:c.from(n),jwt:s,proofFetchCallback:m})}};export{K as a};
2
+ //# sourceMappingURL=chunk-LZS7BQ2B.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 { JwtPayload, jwtDecode } from \"jwt-decode\";\nimport { HexInput } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { 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\";\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 JWT, proof, EphemeralKeyPair and the\n * address the 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 // Use the static constructor 'create' instead.\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 }) {\n const publicKey = FederatedKeylessPublicKey.create(args);\n super({ publicKey, ...args });\n this.publicKey = publicKey;\n }\n\n serialize(serializer: Serializer): void {\n if (this.proof === undefined) {\n throw new Error(\"Cannot serialize - proof undefined\");\n }\n serializer.serializeStr(this.jwt);\n serializer.serializeStr(this.uidKey);\n serializer.serializeFixedBytes(this.pepper);\n this.publicKey.jwkAddress.serialize(serializer);\n this.ephemeralKeyPair.serialize(serializer);\n this.proof.serialize(serializer);\n }\n\n static deserialize(deserializer: Deserializer): FederatedKeylessAccount {\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const jwkAddress = AccountAddress.deserialize(deserializer);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n return FederatedKeylessAccount.create({\n proof,\n pepper,\n jwkAddress,\n uidKey,\n jwt,\n ephemeralKeyPair,\n });\n }\n\n static fromBytes(bytes: Uint8Array): FederatedKeylessAccount {\n return FederatedKeylessAccount.deserialize(new Deserializer(bytes));\n }\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 }): FederatedKeylessAccount {\n const { address, proof, jwt, ephemeralKeyPair, pepper, jwkAddress, uidKey = \"sub\", proofFetchCallback } = args;\n\n const jwtPayload = jwtDecode<JwtPayload & { [key: string]: string }>(jwt);\n if (typeof jwtPayload.iss !== \"string\") {\n throw new Error(\"iss was not found\");\n }\n if (typeof jwtPayload.aud !== \"string\") {\n throw new Error(\"aud was not found or an array of values\");\n }\n const uidVal = jwtPayload[uidKey];\n return new FederatedKeylessAccount({\n address,\n proof,\n ephemeralKeyPair,\n iss: jwtPayload.iss,\n uidKey,\n uidVal,\n aud: jwtPayload.aud,\n pepper,\n jwkAddress: AccountAddress.from(jwkAddress),\n jwt,\n proofFetchCallback,\n });\n }\n}\n"],"mappings":"sPAGA,OAAqB,aAAAA,MAAiB,aAqB/B,IAAMC,EAAN,MAAMC,UAAgCC,CAAuB,CAO1D,YAAYC,EAYjB,CACD,IAAMC,EAAYC,EAA0B,OAAOF,CAAI,EACvD,MAAM,CAAE,UAAAC,EAAW,GAAGD,CAAK,CAAC,EAC5B,KAAK,UAAYC,CACnB,CAEA,UAAUE,EAA8B,CACtC,GAAI,KAAK,QAAU,OACjB,MAAM,IAAI,MAAM,oCAAoC,EAEtDA,EAAW,aAAa,KAAK,GAAG,EAChCA,EAAW,aAAa,KAAK,MAAM,EACnCA,EAAW,oBAAoB,KAAK,MAAM,EAC1C,KAAK,UAAU,WAAW,UAAUA,CAAU,EAC9C,KAAK,iBAAiB,UAAUA,CAAU,EAC1C,KAAK,MAAM,UAAUA,CAAU,CACjC,CAEA,OAAO,YAAYC,EAAqD,CACtE,IAAMC,EAAMD,EAAa,eAAe,EAClCE,EAASF,EAAa,eAAe,EACrCG,EAASH,EAAa,sBAAsB,EAAE,EAC9CI,EAAaC,EAAe,YAAYL,CAAY,EACpDM,EAAmBC,EAAiB,YAAYP,CAAY,EAC5DQ,EAAQC,EAAiB,YAAYT,CAAY,EACvD,OAAON,EAAwB,OAAO,CACpC,MAAAc,EACA,OAAAL,EACA,WAAAC,EACA,OAAAF,EACA,IAAAD,EACA,iBAAAK,CACF,CAAC,CACH,CAEA,OAAO,UAAUI,EAA4C,CAC3D,OAAOhB,EAAwB,YAAY,IAAIiB,EAAaD,CAAK,CAAC,CACpE,CAEA,OAAO,OAAOd,EASc,CAC1B,GAAM,CAAE,QAAAgB,EAAS,MAAAJ,EAAO,IAAAP,EAAK,iBAAAK,EAAkB,OAAAH,EAAQ,WAAAC,EAAY,OAAAF,EAAS,MAAO,mBAAAW,CAAmB,EAAIjB,EAEpGkB,EAAaC,EAAkDd,CAAG,EACxE,GAAI,OAAOa,EAAW,KAAQ,SAC5B,MAAM,IAAI,MAAM,mBAAmB,EAErC,GAAI,OAAOA,EAAW,KAAQ,SAC5B,MAAM,IAAI,MAAM,yCAAyC,EAE3D,IAAME,EAASF,EAAWZ,CAAM,EAChC,OAAO,IAAIR,EAAwB,CACjC,QAAAkB,EACA,MAAAJ,EACA,iBAAAF,EACA,IAAKQ,EAAW,IAChB,OAAAZ,EACA,OAAAc,EACA,IAAKF,EAAW,IAChB,OAAAX,EACA,WAAYE,EAAe,KAAKD,CAAU,EAC1C,IAAAH,EACA,mBAAAY,CACF,CAAC,CACH,CACF","names":["jwtDecode","FederatedKeylessAccount","_FederatedKeylessAccount","AbstractKeylessAccount","args","publicKey","FederatedKeylessPublicKey","serializer","deserializer","jwt","uidKey","pepper","jwkAddress","AccountAddress","ephemeralKeyPair","EphemeralKeyPair","proof","ZeroKnowledgeSig","bytes","Deserializer","address","proofFetchCallback","jwtPayload","jwtDecode","uidVal"]}
@@ -1,2 +1,2 @@
1
- import{b as g}from"./chunk-OHRL766V.mjs";import{a as y,c as a,d as f}from"./chunk-LNEZEYYE.mjs";import{a as i,b as o,c as u,d as s,e as c,f as p,g as m}from"./chunk-YPHH6CAO.mjs";import{a as r}from"./chunk-H6YNXJNF.mjs";function D(n){return typeof n=="boolean"}function l(n){return typeof n=="string"}function d(n){return typeof n=="number"}function P(n){if(d(n))return n;if(l(n)&&n!=="")return Number.parseInt(n,10)}function w(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function G(n){return n==null}function $(n){return T(n)||B(n)||U(n)||b(n)||I(n)||v(n)||h(n)||E(n)||x(n)||S(n)||n instanceof y||n instanceof f}function T(n){return n instanceof i}function E(n){return n instanceof g}function x(n){return n instanceof a}function S(n){return n instanceof r}function B(n){return n instanceof o}function U(n){return n instanceof u}function b(n){return n instanceof s}function I(n){return n instanceof c}function v(n){return n instanceof p}function h(n){return n instanceof m}function O(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],A=t[2];return{moduleAddress:e,moduleName:F,functionName:A}}export{D as a,l as b,d as c,P as d,w as e,G as f,$ as g,T as h,E as i,x as j,S as k,B as l,U as m,b as n,I as o,v as p,h as q,O as r,R as s,W as t,L as u};
2
- //# sourceMappingURL=chunk-53RB2PRH.mjs.map
1
+ import{a as y,c as a,d as f}from"./chunk-IECDO22V.mjs";import{a as r}from"./chunk-JGNMNCQB.mjs";import{a as i,b as o,c as u,d as s,e as c,f as p,g as m}from"./chunk-6FLHGOKP.mjs";import{b as g}from"./chunk-KM6UXNC7.mjs";function D(n){return typeof n=="boolean"}function l(n){return typeof n=="string"}function d(n){return typeof n=="number"}function P(n){if(d(n))return n;if(l(n)&&n!=="")return Number.parseInt(n,10)}function w(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function G(n){return n==null}function $(n){return T(n)||B(n)||U(n)||b(n)||I(n)||v(n)||h(n)||E(n)||x(n)||S(n)||n instanceof y||n instanceof f}function T(n){return n instanceof i}function E(n){return n instanceof g}function x(n){return n instanceof a}function S(n){return n instanceof r}function B(n){return n instanceof o}function U(n){return n instanceof u}function b(n){return n instanceof s}function I(n){return n instanceof c}function v(n){return n instanceof p}function h(n){return n instanceof m}function O(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],A=t[2];return{moduleAddress:e,moduleName:F,functionName:A}}export{D as a,l as b,d as c,P as d,w as e,G as f,$ as g,T as h,E as i,x as j,S as k,B as l,U as m,b as n,I as o,v as p,h as q,O as r,R as s,W as t,L as u};
2
+ //# sourceMappingURL=chunk-N3OYD6VZ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/helpers.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n EntryFunctionArgumentTypes,\n InputGenerateTransactionPayloadData,\n InputGenerateTransactionPayloadDataWithRemoteABI,\n InputScriptData,\n SimpleEntryFunctionArgumentTypes,\n} from \"../types\";\nimport { Bool, FixedBytes, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { MoveFunction, MoveFunctionId } from \"../../types\";\n\n/**\n * Determines if the provided argument is of type boolean.\n * This can help in validating input types before processing them further.\n *\n * @param arg - The argument to check, which can be of various types.\n * @returns A boolean indicating whether the argument is a boolean.\n */\nexport function isBool(arg: SimpleEntryFunctionArgumentTypes): arg is boolean {\n return typeof arg === \"boolean\";\n}\n\n/**\n * Checks if the provided argument is of type string.\n *\n * @param arg - The value to be checked for string type.\n * @returns A boolean indicating whether the argument is a string.\n */\nexport function isString(arg: any): arg is string {\n return typeof arg === \"string\";\n}\n\n/**\n * Determines if the provided argument is of type number.\n *\n * @param arg - The argument to check, which can be of various types.\n * @returns A boolean indicating whether the argument is a number.\n */\nexport function isNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number {\n return typeof arg === \"number\";\n}\n\n/**\n * Converts a number or a string representation of a number into a number type.\n * This function is useful for ensuring that the input is in a consistent numeric format,\n * which can help prevent type mismatches in further processing.\n *\n * @param arg - The input value to be converted. This can be a number, a string representing a number, or any other type.\n * @returns Returns the converted number if the input is valid; otherwise, it returns undefined.\n */\nexport function convertNumber(arg: SimpleEntryFunctionArgumentTypes): number | undefined {\n if (isNumber(arg)) {\n return arg;\n }\n if (isString(arg) && arg !== \"\") {\n return Number.parseInt(arg, 10);\n }\n\n return undefined;\n}\n\n/**\n * Determines if the provided argument is a large number, which can be a number, bigint, or string representation of a number.\n *\n * @param arg - The argument to check, which can be of type number, bigint, or string.\n */\nexport function isLargeNumber(arg: SimpleEntryFunctionArgumentTypes): arg is number | bigint | string {\n return typeof arg === \"number\" || typeof arg === \"bigint\" || typeof arg === \"string\";\n}\n\n/**\n * Checks if the provided argument is empty, meaning it is either null or undefined.\n *\n * @param arg - The argument to check for emptiness.\n * @returns A boolean indicating whether the argument is empty.\n */\nexport function isEmptyOption(arg: SimpleEntryFunctionArgumentTypes): arg is null | undefined {\n return arg === null || arg === undefined;\n}\n\n/**\n * Determines if the provided argument is a valid encoded entry function argument type.\n * This function helps validate that the argument conforms to the expected types for entry function parameters.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\nexport function isEncodedEntryFunctionArgument(\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n): arg is EntryFunctionArgumentTypes {\n return (\n /**\n * Determines if the provided argument is an instance of the Bool class.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsBool(arg) ||\n /**\n * Determines if the provided argument is an instance of U8.\n * This function helps validate the type of the argument passed to ensure it is a U8 type.\n *\n * @param arg - The argument to be checked, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsU8(arg) ||\n /**\n * Determines if the provided argument is an instance of U16.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsU16(arg) ||\n /**\n * Determines if the provided argument is an instance of U32.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @returns A boolean indicating whether the argument is a U32 instance.\n */\n isBcsU32(arg) ||\n /**\n * Determine if the provided argument is an instance of U64.\n * This function helps validate that the argument conforms to the expected U64 type.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsU64(arg) ||\n /**\n * Determines if the provided argument is an instance of U128.\n * This function helps validate the type of the argument passed to ensure it is a U128 type.\n *\n * @param arg - The argument to be checked, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsU128(arg) ||\n /**\n * Determines if the provided argument is an instance of U256.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n * @returns A boolean indicating whether the argument is a U256 instance.\n */\n isBcsU256(arg) ||\n /**\n * Determines if the provided argument is an instance of AccountAddress.\n * This function helps validate whether a given input corresponds to a valid BCS address type.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsAddress(arg) ||\n /**\n * Determine if the provided argument is an instance of MoveString.\n *\n * @param arg - The argument to check, which can be of types EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsString(arg) ||\n /**\n * Determine if the provided argument is an instance of FixedBytes.\n * This function helps to validate the type of the argument being passed.\n *\n * @param arg - The argument to check, which can be of type EntryFunctionArgumentTypes or SimpleEntryFunctionArgumentTypes.\n */\n isBcsFixedBytes(arg) ||\n arg instanceof MoveVector ||\n arg instanceof MoveOption\n );\n}\n\nexport function isBcsBool(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is Bool {\n return arg instanceof Bool;\n}\n\nexport function isBcsAddress(\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n): arg is AccountAddress {\n return arg instanceof AccountAddress;\n}\n\nexport function isBcsString(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is MoveString {\n return arg instanceof MoveString;\n}\n\nexport function isBcsFixedBytes(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is FixedBytes {\n return arg instanceof FixedBytes;\n}\n\nexport function isBcsU8(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U8 {\n return arg instanceof U8;\n}\n\nexport function isBcsU16(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U16 {\n return arg instanceof U16;\n}\n\nexport function isBcsU32(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U32 {\n return arg instanceof U32;\n}\n\nexport function isBcsU64(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U64 {\n return arg instanceof U64;\n}\n\nexport function isBcsU128(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U128 {\n return arg instanceof U128;\n}\n\nexport function isBcsU256(arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes): arg is U256 {\n return arg instanceof U256;\n}\n\n/**\n * Determines if the provided argument contains script data input by checking for the presence of bytecode.\n *\n * @param arg - The input data to be checked, which can either be a payload with remote ABI or a standard payload.\n * @param arg.bytecode - The bytecode of the script, present if the input is script data.\n * @param arg.function - The function associated with the transaction, which is relevant for standard payloads.\n * @param arg.args - The arguments for the function, applicable in the context of standard payloads.\n */\nexport function isScriptDataInput(\n arg: InputGenerateTransactionPayloadDataWithRemoteABI | InputGenerateTransactionPayloadData,\n): arg is InputScriptData {\n return \"bytecode\" in arg;\n}\n\n/**\n * Throws an error indicating a type mismatch for a specified argument position.\n * This function helps in debugging by providing clear feedback on expected types.\n *\n * @param expectedType - The type that was expected for the argument.\n * @param position - The position of the argument that caused the type mismatch.\n */\nexport function throwTypeMismatch(expectedType: string, position: number) {\n throw new Error(`Type mismatch for argument ${position}, expected '${expectedType}'`);\n}\n\n/**\n * Finds the index of the first non-signer argument in the function ABI parameters.\n *\n * A function is often defined with a `signer` or `&signer` arguments at the start, which are filled in\n * by signatures and not by the caller. This function helps identify the position of the first argument that\n * can be provided by the caller, allowing for easier handling of function parameters.\n *\n * @param functionAbi - The ABI of the function to analyze.\n * @returns The index of the first non-signer argument, or the length of the parameters array if none are found.\n */\nexport function findFirstNonSignerArg(functionAbi: MoveFunction): number {\n const index = functionAbi.params.findIndex((param) => param !== \"signer\" && param !== \"&signer\");\n if (index < 0) {\n return functionAbi.params.length;\n }\n return index;\n}\n\n/**\n * Splits a function identifier into its constituent parts: module address, module name, and function name.\n * This function helps in validating and extracting details from a function identifier string.\n *\n * @param functionArg - The function identifier string in the format \"moduleAddress::moduleName::functionName\".\n * @returns An object containing the module address, module name, and function name.\n * @throws Error if the function identifier does not contain exactly three parts.\n */\nexport function getFunctionParts(functionArg: MoveFunctionId) {\n const funcNameParts = functionArg.split(\"::\");\n if (funcNameParts.length !== 3) {\n throw new Error(`Invalid function ${functionArg}`);\n }\n const moduleAddress = funcNameParts[0];\n const moduleName = funcNameParts[1];\n const functionName = funcNameParts[2];\n return { moduleAddress, moduleName, functionName };\n}\n"],"mappings":"4NAqBO,SAASA,EAAOC,EAAuD,CAC5E,OAAO,OAAOA,GAAQ,SACxB,CAQO,SAASC,EAASD,EAAyB,CAChD,OAAO,OAAOA,GAAQ,QACxB,CAQO,SAASE,EAASF,EAAsD,CAC7E,OAAO,OAAOA,GAAQ,QACxB,CAUO,SAASG,EAAcH,EAA2D,CACvF,GAAIE,EAASF,CAAG,EACd,OAAOA,EAET,GAAIC,EAASD,CAAG,GAAKA,IAAQ,GAC3B,OAAO,OAAO,SAASA,EAAK,EAAE,CAIlC,CAOO,SAASI,EAAcJ,EAAwE,CACpG,OAAO,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,UAAY,OAAOA,GAAQ,QAC9E,CAQO,SAASK,EAAcL,EAAgE,CAC5F,OAAOA,GAAQ,IACjB,CAQO,SAASM,EACdN,EACmC,CACnC,OAMEO,EAAUP,CAAG,GAObQ,EAAQR,CAAG,GAMXS,EAAST,CAAG,GAOZU,EAASV,CAAG,GAOZW,EAASX,CAAG,GAOZY,EAAUZ,CAAG,GAOba,EAAUb,CAAG,GAObc,EAAad,CAAG,GAMhBe,EAAYf,CAAG,GAOfgB,EAAgBhB,CAAG,GACnBA,aAAeiB,GACfjB,aAAekB,CAEnB,CAEO,SAASX,EAAUP,EAAiF,CACzG,OAAOA,aAAemB,CACxB,CAEO,SAASL,EACdd,EACuB,CACvB,OAAOA,aAAeoB,CACxB,CAEO,SAASL,EAAYf,EAAuF,CACjH,OAAOA,aAAeqB,CACxB,CAEO,SAASL,EAAgBhB,EAAuF,CACrH,OAAOA,aAAesB,CACxB,CAEO,SAASd,EAAQR,EAA+E,CACrG,OAAOA,aAAeuB,CACxB,CAEO,SAASd,EAAST,EAAgF,CACvG,OAAOA,aAAewB,CACxB,CAEO,SAASd,EAASV,EAAgF,CACvG,OAAOA,aAAeyB,CACxB,CAEO,SAASd,EAASX,EAAgF,CACvG,OAAOA,aAAe0B,CACxB,CAEO,SAASd,EAAUZ,EAAiF,CACzG,OAAOA,aAAe2B,CACxB,CAEO,SAASd,EAAUb,EAAiF,CACzG,OAAOA,aAAe4B,CACxB,CAUO,SAASC,EACd7B,EACwB,CACxB,MAAO,aAAcA,CACvB,CASO,SAAS8B,EAAkBC,EAAsBC,EAAkB,CACxE,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeD,CAAY,GAAG,CACtF,CAYO,SAASE,EAAsBC,EAAmC,CACvE,IAAMC,EAAQD,EAAY,OAAO,UAAWE,GAAUA,IAAU,UAAYA,IAAU,SAAS,EAC/F,OAAID,EAAQ,EACHD,EAAY,OAAO,OAErBC,CACT,CAUO,SAASE,EAAiBC,EAA6B,CAC5D,IAAMC,EAAgBD,EAAY,MAAM,IAAI,EAC5C,GAAIC,EAAc,SAAW,EAC3B,MAAM,IAAI,MAAM,oBAAoBD,CAAW,EAAE,EAEnD,IAAME,EAAgBD,EAAc,CAAC,EAC/BE,EAAaF,EAAc,CAAC,EAC5BG,EAAeH,EAAc,CAAC,EACpC,MAAO,CAAE,cAAAC,EAAe,WAAAC,EAAY,aAAAC,CAAa,CACnD","names":["isBool","arg","isString","isNumber","convertNumber","isLargeNumber","isEmptyOption","isEncodedEntryFunctionArgument","isBcsBool","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","isBcsAddress","isBcsString","isBcsFixedBytes","MoveVector","MoveOption","Bool","AccountAddress","MoveString","FixedBytes","U8","U16","U32","U64","U128","U256","isScriptDataInput","throwTypeMismatch","expectedType","position","findFirstNonSignerArg","functionAbi","index","param","getFunctionParts","functionArg","funcNameParts","moduleAddress","moduleName","functionName"]}
@@ -1,2 +1,2 @@
1
1
  import{c as r}from"./chunk-56CNRT2K.mjs";var n=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let i=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,i}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),i=this.deserializeU32();return BigInt(BigInt(i)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),i=this.deserializeU64();return BigInt(i<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),i=this.deserializeU128();return BigInt(i<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),i=0;for(;e<r;){let t=this.deserializeU8();if(e|=BigInt(t&127)<<BigInt(i),!(t&128))break;i+=7}if(e>r)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let i=this.deserializeUleb128AsU32(),t=new Array;for(let s=0;s<i;s+=1)t.push(this.deserialize(e));return t}};export{n as a};
2
- //# sourceMappingURL=chunk-KEYAPEAX.mjs.map
2
+ //# sourceMappingURL=chunk-N47FTRYO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bcs/deserializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/* eslint-disable no-bitwise */\nimport { MAX_U32_NUMBER } from \"./consts\";\nimport { Uint8, Uint16, Uint32, Uint64, Uint128, Uint256 } from \"../types\";\n\n/**\n * This interface exists to define Deserializable<T> inputs for functions that\n * deserialize a byte buffer into a type T.\n * It is not intended to be implemented or extended, because Typescript has no support\n * for static methods in interfaces.\n *\n * @template T - The type that this will deserialize into.\n */\nexport interface Deserializable<T> {\n /**\n * Deserializes the buffered bytes into an instance of the specified class type.\n * This function provides an alternative syntax for deserialization, allowing users to call\n * `deserializer.deserialize(MyClass)` instead of `MyClass.deserialize(deserializer)`.\n *\n * @param deserializer - The deserializer instance with the buffered bytes.\n * @returns The deserialized value of class type T.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * ```\n */\n deserialize(deserializer: Deserializer): T;\n}\n\n/**\n * A class that provides methods for deserializing various data types from a byte buffer.\n * It supports deserialization of primitive types, strings, and complex objects using a BCS (Binary Common Serialization) layout.\n */\nexport class Deserializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n /**\n * Creates a new instance of the class with a copy of the provided data buffer.\n * This prevents outside mutation of the buffer.\n *\n * @param data - The data to be copied into the internal buffer as a Uint8Array.\n */\n constructor(data: Uint8Array) {\n // copies data to prevent outside mutation of buffer.\n this.buffer = new ArrayBuffer(data.length);\n new Uint8Array(this.buffer).set(data, 0);\n this.offset = 0;\n }\n\n /**\n * Reads a specified number of bytes from the buffer and advances the offset.\n *\n * @param length - The number of bytes to read from the buffer.\n * @throws Throws an error if the read operation exceeds the buffer's length.\n */\n private read(length: number): ArrayBuffer {\n if (this.offset + length > this.buffer.byteLength) {\n throw new Error(\"Reached to the end of buffer\");\n }\n\n const bytes = this.buffer.slice(this.offset, this.offset + length);\n this.offset += length;\n return bytes;\n }\n\n /**\n * Returns the number of bytes remaining in the buffer.\n *\n * This information is useful to determine if there's more data to be read.\n *\n * @returns The number of bytes remaining in the buffer.\n */\n remaining(): number {\n return this.buffer.byteLength - this.offset;\n }\n\n /**\n * Deserializes a UTF-8 encoded string from a byte array. It first reads the length of the string in bytes,\n * followed by the actual byte content, and decodes it into a string.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeStr() === \"1234abcd\");\n * ```\n */\n deserializeStr(): string {\n const value = this.deserializeBytes();\n const textDecoder = new TextDecoder();\n return textDecoder.decode(value);\n }\n\n /**\n * Deserializes an optional string.\n *\n * The BCS layout for Optional<String> is 0 if none, else 1 followed by the string length and string content.\n * @returns The deserialized string if it exists, otherwise undefined.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00]));\n * assert(deserializer.deserializeOptionStr() === undefined);\n * const deserializer = new Deserializer(new Uint8Array([1, 8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * assert(deserializer.deserializeOptionStr() === \"1234abcd\");\n * ```\n */\n deserializeOptionStr(): string | undefined {\n const exists = this.deserializeBool();\n return exists ? this.deserializeStr() : undefined;\n }\n\n /**\n * Deserializes an optional deserializable class.\n *\n * BCS layout for Optional<T>: 0 if none, else 1 | BCS representation of class.\n *\n * @example\n * const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n *\n * const deserializer = new Deserializer(new Uint8Array([0]));\n * const value = deserializer.deserializeOption(MyClass); // where MyClass has a `deserialize` function\n * // value is undefined\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns The deserialized value of class type T or undefined if no value exists.\n */\n deserializeOption<T>(cls: Deserializable<T>): T | undefined {\n const exists = this.deserializeBool();\n return exists ? this.deserialize(cls) : undefined;\n }\n\n /**\n * Deserializes an array of bytes.\n *\n * The BCS layout for \"bytes\" consists of a bytes_length followed by the bytes themselves, where bytes_length is a u32 integer\n * encoded as a uleb128 integer, indicating the length of the bytes array.\n *\n * @returns {Uint8Array} The deserialized array of bytes.\n */\n deserializeBytes(): Uint8Array {\n const len = this.deserializeUleb128AsU32();\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes an array of bytes of a specified length.\n *\n * @param len - The number of bytes to read from the source.\n */\n deserializeFixedBytes(len: number): Uint8Array {\n return new Uint8Array(this.read(len));\n }\n\n /**\n * Deserializes a boolean value from a byte stream.\n *\n * The BCS layout for a boolean uses one byte, where \"0x01\" represents true and \"0x00\" represents false.\n * An error is thrown if the byte value is not valid.\n *\n * @returns The deserialized boolean value.\n * @throws Throws an error if the boolean value is invalid.\n */\n deserializeBool(): boolean {\n const bool = new Uint8Array(this.read(1))[0];\n if (bool !== 1 && bool !== 0) {\n throw new Error(\"Invalid boolean value\");\n }\n return bool === 1;\n }\n\n /**\n * Deserializes a uint8 number from the binary data.\n *\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n *\n * @returns {number} The deserialized uint8 number.\n */\n deserializeU8(): Uint8 {\n return new DataView(this.read(1)).getUint8(0);\n }\n\n /**\n * Deserializes a uint16 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint16\": Two bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x34, 0x12]));\n * assert(deserializer.deserializeU16() === 4660);\n * ```\n */\n deserializeU16(): Uint16 {\n return new DataView(this.read(2)).getUint16(0, true);\n }\n\n /**\n * Deserializes a uint32 number from a binary format in little-endian representation.\n *\n * BCS layout for \"uint32\": Four bytes.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU32() === 305419896);\n * ```\n */\n deserializeU32(): Uint32 {\n return new DataView(this.read(4)).getUint32(0, true);\n }\n\n /**\n * Deserializes a uint64 number.\n *\n * This function combines two 32-bit values to return a 64-bit unsigned integer in little-endian representation.\n * @example\n * ```typescript\n * const deserializer = new Deserializer(new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * assert(deserializer.deserializeU64() === 1311768467750121216);\n * ```\n */\n deserializeU64(): Uint64 {\n const low = this.deserializeU32();\n const high = this.deserializeU32();\n\n // combine the two 32-bit values and return (little endian)\n return BigInt((BigInt(high) << BigInt(32)) | BigInt(low));\n }\n\n /**\n * Deserializes a uint128 number from its binary representation.\n * This function combines two 64-bit values to return a single uint128 value in little-endian format.\n *\n * @returns {BigInt} The deserialized uint128 number.\n */\n deserializeU128(): Uint128 {\n const low = this.deserializeU64();\n const high = this.deserializeU64();\n\n // combine the two 64-bit values and return (little endian)\n return BigInt((high << BigInt(64)) | low);\n }\n\n /**\n * Deserializes a uint256 number from its binary representation.\n *\n * The BCS layout for \"uint256\" consists of thirty-two bytes in little-endian format.\n *\n * @returns {BigInt} The deserialized uint256 number.\n */\n deserializeU256(): Uint256 {\n const low = this.deserializeU128();\n const high = this.deserializeU128();\n\n // combine the two 128-bit values and return (little endian)\n return BigInt((high << BigInt(128)) | low);\n }\n\n /**\n * Deserializes a uleb128 encoded uint32 number.\n *\n * This function is used for interpreting lengths of variable-length sequences and tags of enum values in BCS encoding.\n *\n * @throws {Error} Throws an error if the parsed value exceeds the maximum uint32 number.\n * @returns {number} The deserialized uint32 value.\n */\n deserializeUleb128AsU32(): Uint32 {\n let value: bigint = BigInt(0);\n let shift = 0;\n\n while (value < MAX_U32_NUMBER) {\n const byte = this.deserializeU8();\n value |= BigInt(byte & 0x7f) << BigInt(shift);\n\n if ((byte & 0x80) === 0) {\n break;\n }\n shift += 7;\n }\n\n if (value > MAX_U32_NUMBER) {\n throw new Error(\"Overflow while parsing uleb128-encoded uint32 value\");\n }\n\n return Number(value);\n }\n\n /**\n * Helper function that primarily exists to support alternative syntax for deserialization.\n * That is, if we have a `const deserializer: new Deserializer(...)`, instead of having to use\n * `MyClass.deserialize(deserializer)`, we can call `deserializer.deserialize(MyClass)`.\n *\n * @example const deserializer = new Deserializer(new Uint8Array([1, 2, 3]));\n * const value = deserializer.deserialize(MyClass); // where MyClass has a `deserialize` function\n * // value is now an instance of MyClass\n * // equivalent to `const value = MyClass.deserialize(deserializer)`\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n *\n * @returns the deserialized value of class type T\n */\n deserialize<T>(cls: Deserializable<T>): T {\n // NOTE: `deserialize` in `cls.deserialize(this)` here is a static method defined in `cls`,\n // It is separate from the `deserialize` instance method defined here in Deserializer.\n return cls.deserialize(this);\n }\n\n /**\n * Deserializes an array of BCS Deserializable values given an existing Deserializer instance with a loaded byte buffer.\n *\n * @param cls The BCS-deserializable class to deserialize the buffered bytes into.\n * @returns An array of deserialized values of type T.\n * @example\n * // serialize a vector of addresses\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n *\n * // deserialize the bytes into an array of addresses\n * const deserializer = new Deserializer(serializedBytes);\n * const deserializedAddresses = deserializer.deserializeVector(AccountAddress);\n * // deserializedAddresses is now an array of AccountAddress instances\n */\n deserializeVector<T>(cls: Deserializable<T>): Array<T> {\n const length = this.deserializeUleb128AsU32();\n const vector = new Array<T>();\n for (let i = 0; i < length; i += 1) {\n vector.push(this.deserialize(cls));\n }\n return vector;\n }\n}\n"],"mappings":"yCAsCO,IAAMA,EAAN,KAAmB,CAWxB,YAAYC,EAAkB,CAE5B,KAAK,OAAS,IAAI,YAAYA,EAAK,MAAM,EACzC,IAAI,WAAW,KAAK,MAAM,EAAE,IAAIA,EAAM,CAAC,EACvC,KAAK,OAAS,CAChB,CAQQ,KAAKC,EAA6B,CACxC,GAAI,KAAK,OAASA,EAAS,KAAK,OAAO,WACrC,MAAM,IAAI,MAAM,8BAA8B,EAGhD,IAAMC,EAAQ,KAAK,OAAO,MAAM,KAAK,OAAQ,KAAK,OAASD,CAAM,EACjE,YAAK,QAAUA,EACRC,CACT,CASA,WAAoB,CAClB,OAAO,KAAK,OAAO,WAAa,KAAK,MACvC,CAeA,gBAAyB,CACvB,IAAMC,EAAQ,KAAK,iBAAiB,EAEpC,OADoB,IAAI,YAAY,EACjB,OAAOA,CAAK,CACjC,CAeA,sBAA2C,CAEzC,OADe,KAAK,gBAAgB,EACpB,KAAK,eAAe,EAAI,MAC1C,CAoBA,kBAAqBC,EAAuC,CAE1D,OADe,KAAK,gBAAgB,EACpB,KAAK,YAAYA,CAAG,EAAI,MAC1C,CAUA,kBAA+B,CAC7B,IAAMC,EAAM,KAAK,wBAAwB,EACzC,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAOA,sBAAsBA,EAAyB,CAC7C,OAAO,IAAI,WAAW,KAAK,KAAKA,CAAG,CAAC,CACtC,CAWA,iBAA2B,CACzB,IAAMC,EAAO,IAAI,WAAW,KAAK,KAAK,CAAC,CAAC,EAAE,CAAC,EAC3C,GAAIA,IAAS,GAAKA,IAAS,EACzB,MAAM,IAAI,MAAM,uBAAuB,EAEzC,OAAOA,IAAS,CAClB,CASA,eAAuB,CACrB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAC9C,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,OAAO,IAAI,SAAS,KAAK,KAAK,CAAC,CAAC,EAAE,UAAU,EAAG,EAAI,CACrD,CAYA,gBAAyB,CACvB,IAAMC,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQ,OAAOA,CAAI,GAAK,OAAO,EAAE,EAAK,OAAOD,CAAG,CAAC,CAC1D,CAQA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,eAAe,EAC1BC,EAAO,KAAK,eAAe,EAGjC,OAAO,OAAQA,GAAQ,OAAO,EAAE,EAAKD,CAAG,CAC1C,CASA,iBAA2B,CACzB,IAAMA,EAAM,KAAK,gBAAgB,EAC3BC,EAAO,KAAK,gBAAgB,EAGlC,OAAO,OAAQA,GAAQ,OAAO,GAAG,EAAKD,CAAG,CAC3C,CAUA,yBAAkC,CAChC,IAAIJ,EAAgB,OAAO,CAAC,EACxBM,EAAQ,EAEZ,KAAON,EAAQO,GAAgB,CAC7B,IAAMC,EAAO,KAAK,cAAc,EAGhC,GAFAR,GAAS,OAAOQ,EAAO,GAAI,GAAK,OAAOF,CAAK,EAEvC,EAAAE,EAAO,KACV,MAEFF,GAAS,CACX,CAEA,GAAIN,EAAQO,EACV,MAAM,IAAI,MAAM,qDAAqD,EAGvE,OAAO,OAAOP,CAAK,CACrB,CAeA,YAAeC,EAA2B,CAGxC,OAAOA,EAAI,YAAY,IAAI,CAC7B,CAwBA,kBAAqBA,EAAkC,CACrD,IAAMH,EAAS,KAAK,wBAAwB,EACtCW,EAAS,IAAI,MACnB,QAASC,EAAI,EAAGA,EAAIZ,EAAQY,GAAK,EAC/BD,EAAO,KAAK,KAAK,YAAYR,CAAG,CAAC,EAEnC,OAAOQ,CACT,CACF","names":["Deserializer","data","length","bytes","value","cls","len","bool","low","high","shift","MAX_U32_NUMBER","byte","vector","i"]}
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-YUNDX5I7.mjs";import{b as i}from"./chunk-OHRL766V.mjs";import{a as d}from"./chunk-A63SMUOU.mjs";var o=class t extends d{constructor(e,r){super(),this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new t(i.fromString(r[0]),new s(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=i.deserialize(e),n=s.deserialize(e);return new t(r,n)}};export{o as a};
2
- //# sourceMappingURL=chunk-YDZBU2DJ.mjs.map
1
+ import{a as s}from"./chunk-AGBA3Y7A.mjs";import{b as i}from"./chunk-KM6UXNC7.mjs";import{a as d}from"./chunk-QQIVWB6G.mjs";var o=class t extends d{constructor(e,r){super(),this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new t(i.fromString(r[0]),new s(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=i.deserialize(e),n=s.deserialize(e);return new t(r,n)}};export{o as a};
2
+ //# sourceMappingURL=chunk-NODYW7DM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/instances/moduleId.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Serializable, Serializer } from \"../../bcs/serializer\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"./identifier\";\nimport { MoveModuleId } from \"../../types\";\n\n/**\n * Represents a ModuleId that can be serialized and deserialized.\n * A ModuleId consists of a module address (e.g., \"0x1\") and a module name (e.g., \"coin\").\n */\nexport class ModuleId extends Serializable {\n public readonly address: AccountAddress;\n\n public readonly name: Identifier;\n\n /**\n * Initializes a new instance of the module with the specified account address and name.\n *\n * @param address - The account address, e.g., \"0x1\".\n * @param name - The module name under the specified address, e.g., \"coin\".\n */\n constructor(address: AccountAddress, name: Identifier) {\n super();\n this.address = address;\n this.name = name;\n }\n\n /**\n * Converts a string literal in the format \"account_address::module_name\" to a ModuleId.\n * @param moduleId - A string literal representing the module identifier.\n * @throws Error if the provided moduleId is not in the correct format.\n * @returns ModuleId - The corresponding ModuleId object.\n */\n static fromStr(moduleId: MoveModuleId): ModuleId {\n const parts = moduleId.split(\"::\");\n if (parts.length !== 2) {\n throw new Error(\"Invalid module id.\");\n }\n return new ModuleId(AccountAddress.fromString(parts[0]), new Identifier(parts[1]));\n }\n\n /**\n * Serializes the address and name properties using the provided serializer.\n * This function is essential for converting the object's data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n */\n serialize(serializer: Serializer): void {\n this.address.serialize(serializer);\n this.name.serialize(serializer);\n }\n\n /**\n * Deserializes a ModuleId from the provided deserializer.\n * This function retrieves the account address and identifier to construct a ModuleId instance.\n *\n * @param deserializer - The deserializer instance used to read the data.\n */\n static deserialize(deserializer: Deserializer): ModuleId {\n const address = AccountAddress.deserialize(deserializer);\n const name = Identifier.deserialize(deserializer);\n return new ModuleId(address, name);\n }\n}\n"],"mappings":"2HAaO,IAAMA,EAAN,MAAMC,UAAiBC,CAAa,CAWzC,YAAYC,EAAyBC,EAAkB,CACrD,MAAM,EACN,KAAK,QAAUD,EACf,KAAK,KAAOC,CACd,CAQA,OAAO,QAAQC,EAAkC,CAC/C,IAAMC,EAAQD,EAAS,MAAM,IAAI,EACjC,GAAIC,EAAM,SAAW,EACnB,MAAM,IAAI,MAAM,oBAAoB,EAEtC,OAAO,IAAIL,EAASM,EAAe,WAAWD,EAAM,CAAC,CAAC,EAAG,IAAIE,EAAWF,EAAM,CAAC,CAAC,CAAC,CACnF,CAQA,UAAUG,EAA8B,CACtC,KAAK,QAAQ,UAAUA,CAAU,EACjC,KAAK,KAAK,UAAUA,CAAU,CAChC,CAQA,OAAO,YAAYC,EAAsC,CACvD,IAAMP,EAAUI,EAAe,YAAYG,CAAY,EACjDN,EAAOI,EAAW,YAAYE,CAAY,EAChD,OAAO,IAAIT,EAASE,EAASC,CAAI,CACnC,CACF","names":["ModuleId","_ModuleId","Serializable","address","name","moduleId","parts","AccountAddress","Identifier","serializer","deserializer"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-6EMN3BOV.mjs";import{h as a}from"./chunk-P2EIZ7WL.mjs";import{a as o}from"./chunk-FVA2OPG4.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
- //# sourceMappingURL=chunk-HVMFZF6P.mjs.map
1
+ import{a as i}from"./chunk-I2NMCLNW.mjs";import{h as a}from"./chunk-2I56E4T2.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var n=class{constructor(t){this.config=t}async simple(t){return a({aptosConfig:this.config,...t})}async multiAgent(t){return a({aptosConfig:this.config,...t})}};o([i],n.prototype,"simple",1),o([i],n.prototype,"multiAgent",1);export{n as a};
2
+ //# sourceMappingURL=chunk-NV6DHDM3.mjs.map