@aptos-labs/ts-sdk 1.31.0 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (541) hide show
  1. package/README.md +1 -1
  2. package/dist/common/{accountAddress-DnSqjhSl.d.ts → accountAddress-6RqI8Aam.d.ts} +144 -63
  3. package/dist/common/chunk-F43XVDYJ.js +2 -0
  4. package/dist/common/chunk-F43XVDYJ.js.map +1 -0
  5. package/dist/common/cli/index.d.ts +1 -1
  6. package/dist/common/cli/index.js +1 -1
  7. package/dist/common/cli/index.js.map +1 -1
  8. package/dist/common/index.d.ts +542 -111
  9. package/dist/common/index.js +36 -29
  10. package/dist/common/index.js.map +1 -1
  11. package/dist/esm/{Ed25519Account-DpH9qAcg.d.mts → Ed25519Account-B3xHXAQe.d.mts} +2 -2
  12. package/dist/esm/account/AbstractKeylessAccount.d.mts +86 -14
  13. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +5 -4
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/Ed25519Account.d.mts +5 -4
  17. package/dist/esm/account/Ed25519Account.mjs +1 -1
  18. package/dist/esm/account/EphemeralKeyPair.d.mts +4 -3
  19. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  20. package/dist/esm/account/FederatedKeylessAccount.d.mts +57 -8
  21. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  22. package/dist/esm/account/KeylessAccount.d.mts +29 -11
  23. package/dist/esm/account/KeylessAccount.mjs +1 -1
  24. package/dist/esm/account/MultiKeyAccount.d.mts +23 -10
  25. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  26. package/dist/esm/account/SingleKeyAccount.d.mts +5 -4
  27. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  28. package/dist/esm/account/index.d.mts +6 -5
  29. package/dist/esm/account/index.mjs +1 -1
  30. package/dist/esm/api/account.d.mts +6 -5
  31. package/dist/esm/api/account.mjs +1 -1
  32. package/dist/esm/api/ans.d.mts +4 -3
  33. package/dist/esm/api/ans.mjs +1 -1
  34. package/dist/esm/api/aptos.d.mts +6 -4
  35. package/dist/esm/api/aptos.mjs +1 -1
  36. package/dist/esm/api/aptosConfig.d.mts +2 -1
  37. package/dist/esm/api/coin.d.mts +4 -3
  38. package/dist/esm/api/coin.mjs +1 -1
  39. package/dist/esm/api/digitalAsset.d.mts +6 -5
  40. package/dist/esm/api/digitalAsset.mjs +1 -1
  41. package/dist/esm/api/event.d.mts +4 -3
  42. package/dist/esm/api/event.mjs +1 -1
  43. package/dist/esm/api/faucet.d.mts +3 -2
  44. package/dist/esm/api/faucet.mjs +1 -1
  45. package/dist/esm/api/fungibleAsset.d.mts +6 -5
  46. package/dist/esm/api/fungibleAsset.mjs +1 -1
  47. package/dist/esm/api/general.d.mts +4 -3
  48. package/dist/esm/api/general.mjs +1 -1
  49. package/dist/esm/api/index.d.mts +6 -4
  50. package/dist/esm/api/index.mjs +1 -1
  51. package/dist/esm/api/keyless.d.mts +7 -6
  52. package/dist/esm/api/keyless.mjs +1 -1
  53. package/dist/esm/api/object.d.mts +4 -3
  54. package/dist/esm/api/object.mjs +1 -1
  55. package/dist/esm/api/staking.d.mts +4 -3
  56. package/dist/esm/api/staking.mjs +1 -1
  57. package/dist/esm/api/table.d.mts +4 -3
  58. package/dist/esm/api/table.mjs +1 -1
  59. package/dist/esm/api/transaction.d.mts +5 -3
  60. package/dist/esm/api/transaction.mjs +1 -1
  61. package/dist/esm/api/transactionSubmission/build.d.mts +69 -3
  62. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  63. package/dist/esm/api/transactionSubmission/management.d.mts +5 -4
  64. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  65. package/dist/esm/api/transactionSubmission/sign.d.mts +5 -4
  66. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  67. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  68. package/dist/esm/api/transactionSubmission/simulate.d.mts +4 -3
  69. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  70. package/dist/esm/api/transactionSubmission/submit.d.mts +4 -3
  71. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  72. package/dist/esm/api/utils.d.mts +3 -2
  73. package/dist/esm/api/utils.mjs +1 -1
  74. package/dist/esm/bcs/consts.d.mts +3 -2
  75. package/dist/esm/bcs/deserializer.d.mts +36 -27
  76. package/dist/esm/bcs/deserializer.mjs +1 -1
  77. package/dist/esm/bcs/index.d.mts +3 -2
  78. package/dist/esm/bcs/index.mjs +1 -1
  79. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +3 -2
  80. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  81. package/dist/esm/bcs/serializable/fixedBytes.d.mts +3 -2
  82. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  83. package/dist/esm/bcs/serializable/movePrimitives.d.mts +3 -2
  84. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  85. package/dist/esm/bcs/serializable/moveStructs.d.mts +12 -12
  86. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  87. package/dist/esm/bcs/serializer.d.mts +14 -13
  88. package/dist/esm/bcs/serializer.mjs +1 -1
  89. package/dist/esm/{chunk-4ZK3JNQT.mjs → chunk-2NHQQQZK.mjs} +2 -2
  90. package/dist/esm/{chunk-MSHZ4FWB.mjs → chunk-2QBCTW67.mjs} +2 -2
  91. package/dist/esm/{chunk-MSHZ4FWB.mjs.map → chunk-2QBCTW67.mjs.map} +1 -1
  92. package/dist/esm/{chunk-F2RY4YQ7.mjs → chunk-37Y54PJ5.mjs} +2 -2
  93. package/dist/esm/chunk-3DQVGPFE.mjs +2 -0
  94. package/dist/esm/chunk-3DQVGPFE.mjs.map +1 -0
  95. package/dist/esm/{chunk-OAEDFM7T.mjs → chunk-3XCYCFYI.mjs} +2 -2
  96. package/dist/esm/{chunk-6FLHGOKP.mjs → chunk-42H7WETG.mjs} +2 -2
  97. package/dist/esm/{chunk-AZ6LVQEG.mjs → chunk-46L6BAJG.mjs} +2 -2
  98. package/dist/esm/{chunk-KW4FVBDD.mjs → chunk-4DNCQM3S.mjs} +2 -2
  99. package/dist/esm/chunk-4O5XDQDO.mjs +2 -0
  100. package/dist/esm/chunk-4PBXTMN3.mjs +2 -0
  101. package/dist/esm/chunk-4PBXTMN3.mjs.map +1 -0
  102. package/dist/esm/chunk-4YEOOZ2N.mjs +4 -0
  103. package/dist/esm/{chunk-HM5HITUC.mjs.map → chunk-4YEOOZ2N.mjs.map} +1 -1
  104. package/dist/esm/{chunk-5N6KJ7KS.mjs → chunk-5AKSORBJ.mjs} +2 -2
  105. package/dist/esm/chunk-5B3SMBXQ.mjs +2 -0
  106. package/dist/esm/{chunk-UCRROMZN.mjs → chunk-5NJWJXSS.mjs} +2 -2
  107. package/dist/esm/{chunk-CL6EEMSL.mjs → chunk-6K4TOFCO.mjs} +2 -2
  108. package/dist/esm/{chunk-RNJHULIT.mjs → chunk-6LLGRGCN.mjs} +2 -2
  109. package/dist/esm/chunk-6LLGRGCN.mjs.map +1 -0
  110. package/dist/esm/{chunk-IAVI3H4V.mjs → chunk-6PJH53CK.mjs} +2 -2
  111. package/dist/esm/{chunk-PCLU4KLY.mjs → chunk-6ZOVTYLJ.mjs} +2 -2
  112. package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
  113. package/dist/esm/chunk-7WXDXBXK.mjs +2 -0
  114. package/dist/esm/{chunk-WV2VJQDS.mjs.map → chunk-7WXDXBXK.mjs.map} +1 -1
  115. package/dist/esm/{chunk-RAJTNQNL.mjs → chunk-AAATWCJT.mjs} +2 -2
  116. package/dist/esm/{chunk-NODYW7DM.mjs → chunk-ACVIE7IE.mjs} +2 -2
  117. package/dist/esm/chunk-AHWZA3GD.mjs +2 -0
  118. package/dist/esm/chunk-AHWZA3GD.mjs.map +1 -0
  119. package/dist/esm/{chunk-QQIVWB6G.mjs → chunk-AJ5JHBAE.mjs} +2 -2
  120. package/dist/esm/{chunk-QQIVWB6G.mjs.map → chunk-AJ5JHBAE.mjs.map} +1 -1
  121. package/dist/esm/{chunk-PRZ7AIGA.mjs → chunk-AKIO3OIT.mjs} +2 -2
  122. package/dist/esm/chunk-AMCJQIOT.mjs +2 -0
  123. package/dist/esm/{chunk-2CGJLPHP.mjs.map → chunk-AMCJQIOT.mjs.map} +1 -1
  124. package/dist/esm/{chunk-KRVLR3L4.mjs → chunk-AOROYJ74.mjs} +2 -2
  125. package/dist/esm/chunk-AVPQOD67.mjs +2 -0
  126. package/dist/esm/chunk-AVPQOD67.mjs.map +1 -0
  127. package/dist/esm/chunk-AVZYJAXR.mjs +2 -0
  128. package/dist/esm/chunk-AVZYJAXR.mjs.map +1 -0
  129. package/dist/esm/{chunk-6DMDYBV6.mjs → chunk-BLLHTGAP.mjs} +2 -2
  130. package/dist/esm/{chunk-JGNMNCQB.mjs → chunk-BRV3RLKW.mjs} +2 -2
  131. package/dist/esm/{chunk-7JK7UG4E.mjs → chunk-CA3Q2X6B.mjs} +2 -2
  132. package/dist/esm/chunk-D52UKPQF.mjs +2 -0
  133. package/dist/esm/chunk-D52UKPQF.mjs.map +1 -0
  134. package/dist/esm/{chunk-SOLWFAUY.mjs → chunk-DDVOBEJA.mjs} +2 -2
  135. package/dist/esm/chunk-DDVOBEJA.mjs.map +1 -0
  136. package/dist/esm/{chunk-RNRNGJDA.mjs → chunk-DP3YPGIK.mjs} +2 -2
  137. package/dist/esm/{chunk-KYJU5PWF.mjs → chunk-DSKAMBBL.mjs} +2 -2
  138. package/dist/esm/{chunk-L5J3V3HW.mjs → chunk-E2NYQVP3.mjs} +2 -2
  139. package/dist/esm/chunk-EEB7EZFO.mjs +2 -0
  140. package/dist/esm/chunk-EEB7EZFO.mjs.map +1 -0
  141. package/dist/esm/{chunk-4JXB6V5O.mjs → chunk-F2AIWA7L.mjs} +2 -2
  142. package/dist/esm/chunk-F45G3GP3.mjs +7 -0
  143. package/dist/esm/chunk-F45G3GP3.mjs.map +1 -0
  144. package/dist/esm/{chunk-WSZCPSV4.mjs → chunk-FXUI3SSD.mjs} +2 -2
  145. package/dist/esm/chunk-G2GN4LH5.mjs +2 -0
  146. package/dist/esm/chunk-G2GN4LH5.mjs.map +1 -0
  147. package/dist/esm/chunk-GBVRCWCD.mjs +2 -0
  148. package/dist/esm/chunk-GBVRCWCD.mjs.map +1 -0
  149. package/dist/esm/chunk-H457BI3I.mjs +2 -0
  150. package/dist/esm/chunk-H457BI3I.mjs.map +1 -0
  151. package/dist/esm/{chunk-A2AEFKXS.mjs → chunk-HEHVWRMO.mjs} +2 -2
  152. package/dist/esm/{chunk-UGL2GPGK.mjs → chunk-HFWFDS6Y.mjs} +2 -2
  153. package/dist/esm/{chunk-OXM4BVAY.mjs → chunk-HXXELLHN.mjs} +2 -2
  154. package/dist/esm/{chunk-RBJNSUSU.mjs → chunk-IBMZYDAR.mjs} +2 -2
  155. package/dist/esm/{chunk-AT2ZGTXQ.mjs → chunk-IDNDUJOK.mjs} +2 -2
  156. package/dist/esm/{chunk-3H5DGQKX.mjs → chunk-II654QZU.mjs} +2 -2
  157. package/dist/esm/{chunk-JNRMHDRA.mjs → chunk-JDNI5VIJ.mjs} +2 -2
  158. package/dist/esm/{chunk-73GCGRFW.mjs → chunk-JJUINAQE.mjs} +2 -2
  159. package/dist/esm/{chunk-VYMRIKUV.mjs → chunk-JLD7DLKM.mjs} +2 -2
  160. package/dist/esm/chunk-JNO7KPMG.mjs +4 -0
  161. package/dist/esm/chunk-JNO7KPMG.mjs.map +1 -0
  162. package/dist/esm/chunk-K4TJRYGQ.mjs +2 -0
  163. package/dist/esm/chunk-K4TJRYGQ.mjs.map +1 -0
  164. package/dist/esm/{chunk-XFJD6QIP.mjs → chunk-KA5FX53Q.mjs} +2 -2
  165. package/dist/esm/{chunk-2GEIHUHT.mjs → chunk-KT3DT5GV.mjs} +2 -2
  166. package/dist/esm/chunk-KT3DT5GV.mjs.map +1 -0
  167. package/dist/esm/chunk-KUL55M2H.mjs +2 -0
  168. package/dist/esm/chunk-KUL55M2H.mjs.map +1 -0
  169. package/dist/esm/{chunk-ZPIMARUG.mjs → chunk-L2QVUMBV.mjs} +2 -2
  170. package/dist/esm/chunk-L2SDI7PI.mjs +2 -0
  171. package/dist/esm/chunk-L2SDI7PI.mjs.map +1 -0
  172. package/dist/esm/chunk-L56DQ4N3.mjs +2 -0
  173. package/dist/esm/chunk-L56DQ4N3.mjs.map +1 -0
  174. package/dist/esm/{chunk-TPJLAYW6.mjs → chunk-LAAFLCDM.mjs} +2 -2
  175. package/dist/esm/{chunk-AGBA3Y7A.mjs → chunk-LGTOOAQI.mjs} +2 -2
  176. package/dist/esm/chunk-MHN6XY4Z.mjs +2 -0
  177. package/dist/esm/{chunk-JVTDP4KV.mjs → chunk-MOGPSSTD.mjs} +2 -2
  178. package/dist/esm/{chunk-WZCKSN2U.mjs → chunk-NARS3JDH.mjs} +2 -2
  179. package/dist/esm/{chunk-YZ5BCOGI.mjs → chunk-NHKAQRJB.mjs} +2 -2
  180. package/dist/esm/{chunk-PHP47DI4.mjs → chunk-OIOGOW6I.mjs} +1 -1
  181. package/dist/esm/{chunk-PHP47DI4.mjs.map → chunk-OIOGOW6I.mjs.map} +1 -1
  182. package/dist/esm/{chunk-T5BCTWGK.mjs → chunk-OJBMR5CT.mjs} +2 -2
  183. package/dist/esm/chunk-OJBMR5CT.mjs.map +1 -0
  184. package/dist/esm/{chunk-LDZPO76C.mjs → chunk-OKE3FXIP.mjs} +2 -2
  185. package/dist/esm/chunk-ONFKJ57C.mjs +2 -0
  186. package/dist/esm/chunk-ONFKJ57C.mjs.map +1 -0
  187. package/dist/esm/{chunk-ZINOJTLU.mjs → chunk-OPO5EYF7.mjs} +2 -2
  188. package/dist/esm/{chunk-BVVHGSWC.mjs → chunk-PW3ISXPN.mjs} +2 -2
  189. package/dist/esm/{chunk-CC7VOPYH.mjs → chunk-QQM47PHZ.mjs} +2 -2
  190. package/dist/esm/{chunk-EUGLLGYW.mjs → chunk-SBCLBDCP.mjs} +2 -2
  191. package/dist/esm/chunk-SPRNSFUV.mjs +2 -0
  192. package/dist/esm/chunk-SPRNSFUV.mjs.map +1 -0
  193. package/dist/esm/{chunk-EE7GDBA5.mjs → chunk-SU2WB34N.mjs} +2 -2
  194. package/dist/esm/{chunk-OTY3NO7Q.mjs → chunk-T6ADNZE5.mjs} +2 -2
  195. package/dist/esm/{chunk-IECDO22V.mjs → chunk-TM7OZT3W.mjs} +2 -2
  196. package/dist/esm/chunk-TM7OZT3W.mjs.map +1 -0
  197. package/dist/esm/chunk-UGTIALNW.mjs +2 -0
  198. package/dist/esm/chunk-UIRAXHDH.mjs +1 -0
  199. package/dist/esm/chunk-UZTJWOLS.mjs +2 -0
  200. package/dist/esm/chunk-V4FKFCBL.mjs +2 -0
  201. package/dist/esm/chunk-V4FKFCBL.mjs.map +1 -0
  202. package/dist/esm/{chunk-ZPQUCT22.mjs → chunk-VCY3JGZM.mjs} +2 -2
  203. package/dist/esm/{chunk-XOCRDV2V.mjs → chunk-VQZMI3EZ.mjs} +2 -2
  204. package/dist/esm/chunk-WGIYSLH6.mjs +2 -0
  205. package/dist/esm/chunk-WGIYSLH6.mjs.map +1 -0
  206. package/dist/esm/{chunk-2652SPOM.mjs → chunk-WKNX43KN.mjs} +2 -2
  207. package/dist/esm/chunk-WKNX43KN.mjs.map +1 -0
  208. package/dist/esm/chunk-WQF3IOXC.mjs +2 -0
  209. package/dist/esm/chunk-WQF3IOXC.mjs.map +1 -0
  210. package/dist/esm/{chunk-IFXUWUP2.mjs → chunk-WSFHH3BK.mjs} +2 -2
  211. package/dist/esm/{chunk-4LKLOUMG.mjs → chunk-X3JPX7T6.mjs} +2 -2
  212. package/dist/esm/{chunk-22ZSW5EN.mjs → chunk-XKOSS5KC.mjs} +2 -2
  213. package/dist/esm/{chunk-BG2TZI3H.mjs → chunk-XT5T5LAP.mjs} +2 -2
  214. package/dist/esm/chunk-XUP6VABV.mjs +2 -0
  215. package/dist/esm/chunk-XUP6VABV.mjs.map +1 -0
  216. package/dist/esm/{chunk-XQ7ONNII.mjs → chunk-YNT7JHMS.mjs} +2 -2
  217. package/dist/esm/{chunk-BOWPP6YG.mjs → chunk-YPBNYKOD.mjs} +2 -2
  218. package/dist/esm/{chunk-MK2QAHXC.mjs → chunk-YZ3YPLEU.mjs} +2 -2
  219. package/dist/esm/{chunk-OZN3OOJV.mjs → chunk-ZMBXHMVQ.mjs} +2 -2
  220. package/dist/esm/{chunk-XFY4O2S3.mjs → chunk-ZRWZIAF5.mjs} +2 -2
  221. package/dist/esm/cli/index.d.mts +3 -2
  222. package/dist/esm/cli/index.mjs +1 -1
  223. package/dist/esm/cli/localNode.mjs +1 -1
  224. package/dist/esm/cli/move.d.mts +2 -1
  225. package/dist/esm/client/core.d.mts +2 -2
  226. package/dist/esm/client/core.mjs +1 -1
  227. package/dist/esm/client/get.d.mts +2 -2
  228. package/dist/esm/client/get.mjs +1 -1
  229. package/dist/esm/client/index.d.mts +3 -3
  230. package/dist/esm/client/index.mjs +1 -1
  231. package/dist/esm/client/post.d.mts +2 -2
  232. package/dist/esm/client/post.mjs +1 -1
  233. package/dist/esm/core/account/index.d.mts +3 -2
  234. package/dist/esm/core/account/index.mjs +1 -1
  235. package/dist/esm/core/account/utils/address.d.mts +3 -2
  236. package/dist/esm/core/account/utils/address.mjs +1 -1
  237. package/dist/esm/core/account/utils/index.d.mts +3 -2
  238. package/dist/esm/core/account/utils/index.mjs +1 -1
  239. package/dist/esm/core/accountAddress.d.mts +20 -10
  240. package/dist/esm/core/accountAddress.mjs +1 -1
  241. package/dist/esm/core/authenticationKey.d.mts +4 -3
  242. package/dist/esm/core/authenticationKey.mjs +1 -1
  243. package/dist/esm/core/crypto/ed25519.d.mts +27 -12
  244. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  245. package/dist/esm/core/crypto/ephemeral.d.mts +4 -3
  246. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  247. package/dist/esm/core/crypto/federatedKeyless.d.mts +5 -4
  248. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  249. package/dist/esm/core/crypto/hdKey.d.mts +0 -1
  250. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  251. package/dist/esm/core/crypto/index.d.mts +5 -4
  252. package/dist/esm/core/crypto/index.mjs +1 -1
  253. package/dist/esm/core/crypto/keyless.d.mts +73 -11
  254. package/dist/esm/core/crypto/keyless.mjs +1 -1
  255. package/dist/esm/core/crypto/multiEd25519.d.mts +4 -3
  256. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  257. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  258. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  259. package/dist/esm/core/crypto/privateKey.d.mts +38 -10
  260. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  261. package/dist/esm/core/crypto/proof.d.mts +3 -2
  262. package/dist/esm/core/crypto/proof.mjs +1 -1
  263. package/dist/esm/core/crypto/publicKey.d.mts +4 -3
  264. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  265. package/dist/esm/core/crypto/secp256k1.d.mts +24 -9
  266. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  267. package/dist/esm/core/crypto/signature.d.mts +3 -2
  268. package/dist/esm/core/crypto/signature.mjs +1 -1
  269. package/dist/esm/core/crypto/singleKey.d.mts +4 -3
  270. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  271. package/dist/esm/core/crypto/utils.d.mts +3 -2
  272. package/dist/esm/core/crypto/utils.mjs +1 -1
  273. package/dist/esm/core/hex.d.mts +40 -3
  274. package/dist/esm/core/hex.mjs +1 -1
  275. package/dist/esm/core/index.d.mts +6 -5
  276. package/dist/esm/core/index.mjs +1 -1
  277. package/dist/esm/errors/index.d.mts +123 -0
  278. package/dist/esm/errors/index.mjs +2 -0
  279. package/dist/esm/index.d.mts +13 -11
  280. package/dist/esm/index.mjs +1 -1
  281. package/dist/esm/internal/account.d.mts +5 -4
  282. package/dist/esm/internal/account.mjs +1 -1
  283. package/dist/esm/internal/ans.d.mts +5 -4
  284. package/dist/esm/internal/ans.mjs +1 -1
  285. package/dist/esm/internal/coin.d.mts +3 -2
  286. package/dist/esm/internal/coin.mjs +1 -1
  287. package/dist/esm/internal/digitalAsset.d.mts +5 -4
  288. package/dist/esm/internal/digitalAsset.mjs +1 -1
  289. package/dist/esm/internal/event.d.mts +3 -2
  290. package/dist/esm/internal/event.mjs +1 -1
  291. package/dist/esm/internal/faucet.d.mts +2 -1
  292. package/dist/esm/internal/faucet.mjs +1 -1
  293. package/dist/esm/internal/fungibleAsset.d.mts +5 -4
  294. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  295. package/dist/esm/internal/general.d.mts +3 -2
  296. package/dist/esm/internal/general.mjs +1 -1
  297. package/dist/esm/internal/keyless.d.mts +10 -5
  298. package/dist/esm/internal/keyless.mjs +1 -1
  299. package/dist/esm/internal/object.d.mts +3 -2
  300. package/dist/esm/internal/object.mjs +1 -1
  301. package/dist/esm/internal/staking.d.mts +2 -1
  302. package/dist/esm/internal/staking.mjs +1 -1
  303. package/dist/esm/internal/table.d.mts +3 -2
  304. package/dist/esm/internal/table.mjs +1 -1
  305. package/dist/esm/internal/transaction.d.mts +2 -1
  306. package/dist/esm/internal/transaction.mjs +1 -1
  307. package/dist/esm/internal/transactionSubmission.d.mts +4 -3
  308. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  309. package/dist/esm/internal/view.d.mts +4 -3
  310. package/dist/esm/internal/view.mjs +1 -1
  311. package/dist/esm/{publicKey-_tPa99ea.d.mts → publicKey-BVXX1nVl.d.mts} +2 -2
  312. package/dist/esm/transactions/authenticator/account.d.mts +4 -3
  313. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  314. package/dist/esm/transactions/authenticator/index.d.mts +4 -3
  315. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  316. package/dist/esm/transactions/authenticator/transaction.d.mts +10 -4
  317. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  318. package/dist/esm/transactions/index.d.mts +7 -5
  319. package/dist/esm/transactions/index.mjs +1 -1
  320. package/dist/esm/transactions/instances/chainId.d.mts +3 -2
  321. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  322. package/dist/esm/transactions/instances/identifier.d.mts +3 -2
  323. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  324. package/dist/esm/transactions/instances/index.d.mts +4 -3
  325. package/dist/esm/transactions/instances/index.mjs +1 -1
  326. package/dist/esm/transactions/instances/moduleId.d.mts +3 -2
  327. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  328. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +3 -2
  329. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  330. package/dist/esm/transactions/instances/rawTransaction.d.mts +3 -2
  331. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  332. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +4 -3
  333. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  334. package/dist/esm/transactions/instances/signedTransaction.d.mts +4 -3
  335. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  336. package/dist/esm/transactions/instances/simpleTransaction.d.mts +3 -2
  337. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  338. package/dist/esm/transactions/instances/transactionArgument.d.mts +3 -2
  339. package/dist/esm/transactions/instances/transactionPayload.d.mts +3 -2
  340. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  341. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +5 -4
  342. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  343. package/dist/esm/transactions/management/index.d.mts +5 -4
  344. package/dist/esm/transactions/management/index.mjs +1 -1
  345. package/dist/esm/transactions/management/transactionWorker.d.mts +5 -4
  346. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  347. package/dist/esm/transactions/script-composer/index.d.mts +44 -0
  348. package/dist/esm/transactions/script-composer/index.mjs +2 -0
  349. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -2
  350. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  351. package/dist/esm/transactions/transactionBuilder/index.d.mts +5 -4
  352. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  353. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +26 -5
  354. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  355. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +4 -3
  356. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  357. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +4 -3
  358. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  359. package/dist/esm/transactions/typeTag/index.d.mts +3 -2
  360. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  361. package/dist/esm/transactions/typeTag/parser.d.mts +3 -2
  362. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  363. package/dist/esm/transactions/types.d.mts +12 -3
  364. package/dist/esm/types/index.d.mts +4 -1260
  365. package/dist/esm/types/index.mjs +1 -1
  366. package/dist/esm/types/keyless.d.mts +22 -1
  367. package/dist/esm/types/types.d.mts +1290 -0
  368. package/dist/esm/types/types.mjs +2 -0
  369. package/dist/esm/types/types.mjs.map +1 -0
  370. package/dist/esm/utils/helpers.d.mts +11 -3
  371. package/dist/esm/utils/helpers.mjs +1 -1
  372. package/dist/esm/utils/index.d.mts +3 -2
  373. package/dist/esm/utils/index.mjs +1 -1
  374. package/dist/esm/utils/normalizeBundle.d.mts +3 -2
  375. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  376. package/dist/esm/version.d.mts +1 -1
  377. package/dist/esm/version.mjs +1 -1
  378. package/package.json +2 -1
  379. package/src/account/AbstractKeylessAccount.ts +203 -10
  380. package/src/account/FederatedKeylessAccount.ts +83 -35
  381. package/src/account/KeylessAccount.ts +44 -37
  382. package/src/account/MultiKeyAccount.ts +18 -5
  383. package/src/api/keyless.ts +2 -2
  384. package/src/api/transactionSubmission/build.ts +82 -1
  385. package/src/bcs/deserializer.ts +53 -30
  386. package/src/bcs/serializable/moveStructs.ts +16 -17
  387. package/src/bcs/serializer.ts +22 -12
  388. package/src/client/core.ts +2 -2
  389. package/src/client/get.ts +1 -2
  390. package/src/client/index.ts +0 -1
  391. package/src/client/post.ts +1 -2
  392. package/src/core/accountAddress.ts +36 -9
  393. package/src/core/crypto/ed25519.ts +34 -14
  394. package/src/core/crypto/hdKey.ts +0 -1
  395. package/src/core/crypto/keyless.ts +245 -38
  396. package/src/core/crypto/privateKey.ts +81 -5
  397. package/src/core/crypto/secp256k1.ts +31 -11
  398. package/src/core/hex.ts +47 -0
  399. package/src/errors/index.ts +406 -0
  400. package/src/index.ts +1 -0
  401. package/src/internal/account.ts +6 -6
  402. package/src/internal/ans.ts +2 -1
  403. package/src/internal/keyless.ts +46 -18
  404. package/src/internal/transaction.ts +2 -1
  405. package/src/internal/transactionSubmission.ts +36 -18
  406. package/src/transactions/authenticator/transaction.ts +20 -0
  407. package/src/transactions/index.ts +1 -0
  408. package/src/transactions/script-composer/index.ts +76 -0
  409. package/src/transactions/transactionBuilder/remoteAbi.ts +55 -1
  410. package/src/transactions/types.ts +11 -0
  411. package/src/types/index.ts +2 -1483
  412. package/src/types/keyless.ts +19 -0
  413. package/src/types/types.ts +1512 -0
  414. package/src/utils/helpers.ts +10 -0
  415. package/src/version.ts +1 -1
  416. package/dist/common/chunk-7IYTZDXV.js +0 -2
  417. package/dist/common/chunk-7IYTZDXV.js.map +0 -1
  418. package/dist/esm/chunk-2652SPOM.mjs.map +0 -1
  419. package/dist/esm/chunk-2CGJLPHP.mjs +0 -2
  420. package/dist/esm/chunk-2GEIHUHT.mjs.map +0 -1
  421. package/dist/esm/chunk-4CDDWSKZ.mjs +0 -2
  422. package/dist/esm/chunk-4OV7QU2U.mjs +0 -2
  423. package/dist/esm/chunk-4VU2ABLU.mjs +0 -2
  424. package/dist/esm/chunk-4VU2ABLU.mjs.map +0 -1
  425. package/dist/esm/chunk-5S3Z7MT4.mjs +0 -2
  426. package/dist/esm/chunk-5S3Z7MT4.mjs.map +0 -1
  427. package/dist/esm/chunk-5SGSPCOY.mjs +0 -2
  428. package/dist/esm/chunk-5SGSPCOY.mjs.map +0 -1
  429. package/dist/esm/chunk-7XS45O6M.mjs +0 -2
  430. package/dist/esm/chunk-7XS45O6M.mjs.map +0 -1
  431. package/dist/esm/chunk-BAGUHYFD.mjs +0 -2
  432. package/dist/esm/chunk-BAGUHYFD.mjs.map +0 -1
  433. package/dist/esm/chunk-CDQGPCHU.mjs +0 -2
  434. package/dist/esm/chunk-CDQGPCHU.mjs.map +0 -1
  435. package/dist/esm/chunk-DMSHPWA5.mjs +0 -2
  436. package/dist/esm/chunk-DMSHPWA5.mjs.map +0 -1
  437. package/dist/esm/chunk-FTZGP6XW.mjs +0 -2
  438. package/dist/esm/chunk-FTZGP6XW.mjs.map +0 -1
  439. package/dist/esm/chunk-GLATLXF6.mjs +0 -2
  440. package/dist/esm/chunk-GLATLXF6.mjs.map +0 -1
  441. package/dist/esm/chunk-GQABU3RQ.mjs +0 -2
  442. package/dist/esm/chunk-GQABU3RQ.mjs.map +0 -1
  443. package/dist/esm/chunk-HM5HITUC.mjs +0 -4
  444. package/dist/esm/chunk-I5OYNCZS.mjs +0 -1
  445. package/dist/esm/chunk-IBLZ6MZU.mjs +0 -2
  446. package/dist/esm/chunk-IECDO22V.mjs.map +0 -1
  447. package/dist/esm/chunk-JN36BNWA.mjs +0 -2
  448. package/dist/esm/chunk-JN36BNWA.mjs.map +0 -1
  449. package/dist/esm/chunk-KFNDDPOW.mjs +0 -2
  450. package/dist/esm/chunk-KFNDDPOW.mjs.map +0 -1
  451. package/dist/esm/chunk-KIW54KWR.mjs +0 -2
  452. package/dist/esm/chunk-KM6UXNC7.mjs +0 -2
  453. package/dist/esm/chunk-KM6UXNC7.mjs.map +0 -1
  454. package/dist/esm/chunk-KUX6GQ2E.mjs +0 -1
  455. package/dist/esm/chunk-LEKBJ2EG.mjs +0 -2
  456. package/dist/esm/chunk-LEKBJ2EG.mjs.map +0 -1
  457. package/dist/esm/chunk-M22UGFQ5.mjs +0 -2
  458. package/dist/esm/chunk-M22UGFQ5.mjs.map +0 -1
  459. package/dist/esm/chunk-N2FKVZ4D.mjs +0 -1
  460. package/dist/esm/chunk-N47FTRYO.mjs +0 -2
  461. package/dist/esm/chunk-N47FTRYO.mjs.map +0 -1
  462. package/dist/esm/chunk-ONBFUPEC.mjs +0 -2
  463. package/dist/esm/chunk-P3J54CQG.mjs +0 -2
  464. package/dist/esm/chunk-P3J54CQG.mjs.map +0 -1
  465. package/dist/esm/chunk-RNJHULIT.mjs.map +0 -1
  466. package/dist/esm/chunk-SGQFWWLQ.mjs +0 -2
  467. package/dist/esm/chunk-SGQFWWLQ.mjs.map +0 -1
  468. package/dist/esm/chunk-SOLWFAUY.mjs.map +0 -1
  469. package/dist/esm/chunk-T5BCTWGK.mjs.map +0 -1
  470. package/dist/esm/chunk-WV2VJQDS.mjs +0 -2
  471. package/dist/esm/chunk-Y267I7DC.mjs +0 -2
  472. package/dist/esm/chunk-Y267I7DC.mjs.map +0 -1
  473. package/dist/esm/client/types.d.mts +0 -66
  474. package/dist/esm/client/types.mjs +0 -2
  475. package/src/client/types.ts +0 -138
  476. /package/dist/esm/{chunk-4ZK3JNQT.mjs.map → chunk-2NHQQQZK.mjs.map} +0 -0
  477. /package/dist/esm/{chunk-F2RY4YQ7.mjs.map → chunk-37Y54PJ5.mjs.map} +0 -0
  478. /package/dist/esm/{chunk-OAEDFM7T.mjs.map → chunk-3XCYCFYI.mjs.map} +0 -0
  479. /package/dist/esm/{chunk-6FLHGOKP.mjs.map → chunk-42H7WETG.mjs.map} +0 -0
  480. /package/dist/esm/{chunk-AZ6LVQEG.mjs.map → chunk-46L6BAJG.mjs.map} +0 -0
  481. /package/dist/esm/{chunk-KW4FVBDD.mjs.map → chunk-4DNCQM3S.mjs.map} +0 -0
  482. /package/dist/esm/{chunk-IBLZ6MZU.mjs.map → chunk-4O5XDQDO.mjs.map} +0 -0
  483. /package/dist/esm/{chunk-5N6KJ7KS.mjs.map → chunk-5AKSORBJ.mjs.map} +0 -0
  484. /package/dist/esm/{chunk-KIW54KWR.mjs.map → chunk-5B3SMBXQ.mjs.map} +0 -0
  485. /package/dist/esm/{chunk-UCRROMZN.mjs.map → chunk-5NJWJXSS.mjs.map} +0 -0
  486. /package/dist/esm/{chunk-CL6EEMSL.mjs.map → chunk-6K4TOFCO.mjs.map} +0 -0
  487. /package/dist/esm/{chunk-IAVI3H4V.mjs.map → chunk-6PJH53CK.mjs.map} +0 -0
  488. /package/dist/esm/{chunk-PCLU4KLY.mjs.map → chunk-6ZOVTYLJ.mjs.map} +0 -0
  489. /package/dist/esm/{chunk-I5OYNCZS.mjs.map → chunk-7ECCT6PK.mjs.map} +0 -0
  490. /package/dist/esm/{chunk-RAJTNQNL.mjs.map → chunk-AAATWCJT.mjs.map} +0 -0
  491. /package/dist/esm/{chunk-NODYW7DM.mjs.map → chunk-ACVIE7IE.mjs.map} +0 -0
  492. /package/dist/esm/{chunk-PRZ7AIGA.mjs.map → chunk-AKIO3OIT.mjs.map} +0 -0
  493. /package/dist/esm/{chunk-KRVLR3L4.mjs.map → chunk-AOROYJ74.mjs.map} +0 -0
  494. /package/dist/esm/{chunk-6DMDYBV6.mjs.map → chunk-BLLHTGAP.mjs.map} +0 -0
  495. /package/dist/esm/{chunk-JGNMNCQB.mjs.map → chunk-BRV3RLKW.mjs.map} +0 -0
  496. /package/dist/esm/{chunk-7JK7UG4E.mjs.map → chunk-CA3Q2X6B.mjs.map} +0 -0
  497. /package/dist/esm/{chunk-RNRNGJDA.mjs.map → chunk-DP3YPGIK.mjs.map} +0 -0
  498. /package/dist/esm/{chunk-KYJU5PWF.mjs.map → chunk-DSKAMBBL.mjs.map} +0 -0
  499. /package/dist/esm/{chunk-L5J3V3HW.mjs.map → chunk-E2NYQVP3.mjs.map} +0 -0
  500. /package/dist/esm/{chunk-4JXB6V5O.mjs.map → chunk-F2AIWA7L.mjs.map} +0 -0
  501. /package/dist/esm/{chunk-WSZCPSV4.mjs.map → chunk-FXUI3SSD.mjs.map} +0 -0
  502. /package/dist/esm/{chunk-A2AEFKXS.mjs.map → chunk-HEHVWRMO.mjs.map} +0 -0
  503. /package/dist/esm/{chunk-UGL2GPGK.mjs.map → chunk-HFWFDS6Y.mjs.map} +0 -0
  504. /package/dist/esm/{chunk-OXM4BVAY.mjs.map → chunk-HXXELLHN.mjs.map} +0 -0
  505. /package/dist/esm/{chunk-RBJNSUSU.mjs.map → chunk-IBMZYDAR.mjs.map} +0 -0
  506. /package/dist/esm/{chunk-AT2ZGTXQ.mjs.map → chunk-IDNDUJOK.mjs.map} +0 -0
  507. /package/dist/esm/{chunk-3H5DGQKX.mjs.map → chunk-II654QZU.mjs.map} +0 -0
  508. /package/dist/esm/{chunk-JNRMHDRA.mjs.map → chunk-JDNI5VIJ.mjs.map} +0 -0
  509. /package/dist/esm/{chunk-73GCGRFW.mjs.map → chunk-JJUINAQE.mjs.map} +0 -0
  510. /package/dist/esm/{chunk-VYMRIKUV.mjs.map → chunk-JLD7DLKM.mjs.map} +0 -0
  511. /package/dist/esm/{chunk-XFJD6QIP.mjs.map → chunk-KA5FX53Q.mjs.map} +0 -0
  512. /package/dist/esm/{chunk-ZPIMARUG.mjs.map → chunk-L2QVUMBV.mjs.map} +0 -0
  513. /package/dist/esm/{chunk-TPJLAYW6.mjs.map → chunk-LAAFLCDM.mjs.map} +0 -0
  514. /package/dist/esm/{chunk-AGBA3Y7A.mjs.map → chunk-LGTOOAQI.mjs.map} +0 -0
  515. /package/dist/esm/{chunk-4OV7QU2U.mjs.map → chunk-MHN6XY4Z.mjs.map} +0 -0
  516. /package/dist/esm/{chunk-JVTDP4KV.mjs.map → chunk-MOGPSSTD.mjs.map} +0 -0
  517. /package/dist/esm/{chunk-WZCKSN2U.mjs.map → chunk-NARS3JDH.mjs.map} +0 -0
  518. /package/dist/esm/{chunk-YZ5BCOGI.mjs.map → chunk-NHKAQRJB.mjs.map} +0 -0
  519. /package/dist/esm/{chunk-LDZPO76C.mjs.map → chunk-OKE3FXIP.mjs.map} +0 -0
  520. /package/dist/esm/{chunk-ZINOJTLU.mjs.map → chunk-OPO5EYF7.mjs.map} +0 -0
  521. /package/dist/esm/{chunk-BVVHGSWC.mjs.map → chunk-PW3ISXPN.mjs.map} +0 -0
  522. /package/dist/esm/{chunk-CC7VOPYH.mjs.map → chunk-QQM47PHZ.mjs.map} +0 -0
  523. /package/dist/esm/{chunk-EUGLLGYW.mjs.map → chunk-SBCLBDCP.mjs.map} +0 -0
  524. /package/dist/esm/{chunk-EE7GDBA5.mjs.map → chunk-SU2WB34N.mjs.map} +0 -0
  525. /package/dist/esm/{chunk-OTY3NO7Q.mjs.map → chunk-T6ADNZE5.mjs.map} +0 -0
  526. /package/dist/esm/{chunk-ONBFUPEC.mjs.map → chunk-UGTIALNW.mjs.map} +0 -0
  527. /package/dist/esm/{chunk-KUX6GQ2E.mjs.map → chunk-UIRAXHDH.mjs.map} +0 -0
  528. /package/dist/esm/{chunk-4CDDWSKZ.mjs.map → chunk-UZTJWOLS.mjs.map} +0 -0
  529. /package/dist/esm/{chunk-ZPQUCT22.mjs.map → chunk-VCY3JGZM.mjs.map} +0 -0
  530. /package/dist/esm/{chunk-XOCRDV2V.mjs.map → chunk-VQZMI3EZ.mjs.map} +0 -0
  531. /package/dist/esm/{chunk-IFXUWUP2.mjs.map → chunk-WSFHH3BK.mjs.map} +0 -0
  532. /package/dist/esm/{chunk-4LKLOUMG.mjs.map → chunk-X3JPX7T6.mjs.map} +0 -0
  533. /package/dist/esm/{chunk-22ZSW5EN.mjs.map → chunk-XKOSS5KC.mjs.map} +0 -0
  534. /package/dist/esm/{chunk-BG2TZI3H.mjs.map → chunk-XT5T5LAP.mjs.map} +0 -0
  535. /package/dist/esm/{chunk-XQ7ONNII.mjs.map → chunk-YNT7JHMS.mjs.map} +0 -0
  536. /package/dist/esm/{chunk-BOWPP6YG.mjs.map → chunk-YPBNYKOD.mjs.map} +0 -0
  537. /package/dist/esm/{chunk-MK2QAHXC.mjs.map → chunk-YZ3YPLEU.mjs.map} +0 -0
  538. /package/dist/esm/{chunk-OZN3OOJV.mjs.map → chunk-ZMBXHMVQ.mjs.map} +0 -0
  539. /package/dist/esm/{chunk-XFY4O2S3.mjs.map → chunk-ZRWZIAF5.mjs.map} +0 -0
  540. /package/dist/esm/{chunk-N2FKVZ4D.mjs.map → errors/index.mjs.map} +0 -0
  541. /package/dist/esm/{client/types.mjs.map → transactions/script-composer/index.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{a as u}from"./chunk-5S3Z7MT4.mjs";import{f as M}from"./chunk-DMSHPWA5.mjs";import{c as R}from"./chunk-KRVLR3L4.mjs";import{c as k}from"./chunk-BVVHGSWC.mjs";import{A as V,m as O,y as q,z as G}from"./chunk-VHNX2NUR.mjs";import{b as w,f as h,i as x,l as A,m as f,n as i,q as p,s as y}from"./chunk-OTY3NO7Q.mjs";import{b as c}from"./chunk-KM6UXNC7.mjs";import{a as _,c as d}from"./chunk-IECDO22V.mjs";import{a as T,e as D}from"./chunk-6FLHGOKP.mjs";import{d as E}from"./chunk-56CNRT2K.mjs";var C={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},l="0x4::token::Token";async function It(t){let{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()}};return(await k({aptosConfig:o,query:{query:V,variables:{where_condition:e}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Pt(t){let{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()},amount:{_gt:0}};return(await k({aptosConfig:o,query:{query:G,variables:{where_condition:e}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function bt(t){let{aptosConfig:o,ownerAddress:n,options:e}=t,r={owner_address:{_eq:c.from(n).toStringLong()},amount:{_gt:0}},s={query:G,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await k({aptosConfig:o,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function St(t){let{aptosConfig:o,digitalAssetAddress:n,options:e}=t,r={token_data_id:{_eq:c.from(n).toStringLong()}},s={query:q,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await k({aptosConfig:o,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var F={typeParameters:[],parameters:[new i(p()),new h,new i(p()),new i(p()),new w,new w,new w,new w,new w,new w,new w,new w,new w,new h,new h]};async function Dt(t){let{aptosConfig:o,options:n,creator:e}=t;return u({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new d(t.description),new D(t.maxSupply??E),new d(t.name),new d(t.uri),new T(t.mutableDescription??!0),new T(t.mutableRoyalty??!0),new T(t.mutableURI??!0),new T(t.mutableTokenDescription??!0),new T(t.mutableTokenName??!0),new T(t.mutableTokenProperties??!0),new T(t.mutableTokenURI??!0),new T(t.tokensBurnableByCreator??!0),new T(t.tokensFreezableByCreator??!0),new D(t.royaltyNumerator??0),new D(t.royaltyDenominator??1)],abi:F},options:n})}async function v(t){let{aptosConfig:o,options:n}=t,e=n?.where;n?.tokenStandard&&(e.token_standard={_eq:n?.tokenStandard??"v2"});let r={query:O,variables:{where_condition:e,offset:n?.offset,limit:n?.limit}};return(await k({aptosConfig:o,query:r,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ht(t){let{aptosConfig:o,creatorAddress:n,collectionName:e,options:r}=t,s=c.from(n),a={collection_name:{_eq:e},creator_address:{_eq:s.toStringLong()}};return r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard??"v2"}),v({aptosConfig:o,options:{...r,where:a}})}async function vt(t){let{aptosConfig:o,creatorAddress:n,options:e}=t,s={creator_address:{_eq:c.from(n).toStringLong()}};return e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard??"v2"}),v({aptosConfig:o,options:{...e,where:s}})}async function xt(t){let{aptosConfig:o,collectionId:n,options:e}=t,s={collection_id:{_eq:c.from(n).toStringLong()}};return e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard??"v2"}),v({aptosConfig:o,options:{...e,where:s}})}async function Gt(t){let{creatorAddress:o,collectionName:n,options:e,aptosConfig:r}=t,s=c.from(o),a={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return e?.tokenStandard&&(a.token_standard={_eq:e?.tokenStandard??"v2"}),(await v({aptosConfig:r,options:{where:a}})).collection_id}var N={typeParameters:[],parameters:[new i(p()),new i(p()),new i(p()),new i(p()),new f(new i(p())),new f(new i(p())),new f(f.u8())]};async function Bt(t){let{aptosConfig:o,options:n,creator:e,collection:r,description:s,name:a,uri:m,propertyKeys:g,propertyTypes:P,propertyValues:I}=t,b=P?.map(S=>C[S]);return u({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new d(r),new d(s),new d(a),new d(m),_.MoveString(g??[]),_.MoveString(b??[]),K(I??[],b??[])],abi:N},options:n})}var Q={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new x]};async function Et(t){let{aptosConfig:o,sender:n,digitalAssetAddress:e,recipient:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??l],functionArguments:[c.from(e),c.from(r)],abi:Q},options:a})}var Y={typeParameters:[],parameters:[new i(p()),new i(p()),new i(p()),new i(p()),new f(new i(p())),new f(new i(p())),new f(f.u8()),new x]};async function Ot(t){let{aptosConfig:o,account:n,collection:e,description:r,name:s,uri:a,recipient:m,propertyKeys:g,propertyTypes:P,propertyValues:I,options:b}=t;if(g?.length!==I?.length)throw new Error("Property keys and property values counts do not match");if(P?.length!==I?.length)throw new Error("Property types and property values counts do not match");let S=P?.map(U=>C[U]);return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[e,r,s,a,_.MoveString(g??[]),_.MoveString(S??[]),K(I??[],S??[]),m],abi:Y},options:b})}var L={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0)))]};async function qt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[r??l],functionArguments:[c.from(e)],abi:L},options:s})}var z={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0)))]};async function Vt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[r??l],functionArguments:[e],abi:z},options:s})}var j={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0)))]};async function Rt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[r??l],functionArguments:[e],abi:j},options:s})}var W={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Mt(t){let{aptosConfig:o,creator:n,description:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:W},options:a})}var X={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Kt(t){let{aptosConfig:o,creator:n,name:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:X},options:a})}var H={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Ut(t){let{aptosConfig:o,creator:n,uri:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:H},options:a})}var J={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p()),new i(p()),f.u8()]};async function Ft(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[m??l],functionArguments:[c.from(a),new d(e),new d(C[r]),_.U8(B(s,C[r]))],abi:J},options:g})}var Z={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Nt(t){let{aptosConfig:o,creator:n,propertyKey:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:Z},options:a})}var $={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p()),new i(p()),f.u8()]};async function Qt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[m??l],functionArguments:[c.from(a),new d(e),new d(C[r]),B(s,C[r])],abi:$},options:g})}var tt={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new i(y(new A(0))),new i(p()),new A(1)]};async function Yt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[m??l,C[r]],functionArguments:[c.from(a),new d(e),s],abi:tt},options:g})}var et={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new i(y(new A(0))),new i(p()),new A(1)]};async function Lt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[m??l,C[r]],functionArguments:[c.from(a),new d(e),s],abi:et},options:g})}function K(t,o){let n=new Array;return o.forEach((e,r)=>{n.push(B(t[r],e))}),n}function B(t,o){let n=R(o);return M(t,n,0,[]).bcsToBytes()}export{It as a,Pt as b,bt as c,St as d,Dt as e,v as f,ht as g,vt as h,xt as i,Gt as j,Bt as k,Et as l,Ot as m,qt as n,Vt as o,Rt as p,Mt as q,Kt as r,Ut as s,Ft as t,Nt as u,Qt as v,Yt as w,Lt as x};
2
- //# sourceMappingURL=chunk-RNRNGJDA.mjs.map
1
+ import{a as u}from"./chunk-AHWZA3GD.mjs";import{h as M}from"./chunk-G2GN4LH5.mjs";import{c as R}from"./chunk-AOROYJ74.mjs";import{c as k}from"./chunk-PW3ISXPN.mjs";import{A as V,m as O,y as q,z as G}from"./chunk-VHNX2NUR.mjs";import{b as w,f as h,i as x,l as A,m as f,n as i,q as p,s as y}from"./chunk-T6ADNZE5.mjs";import{b as c}from"./chunk-JNO7KPMG.mjs";import{a as _,c as d}from"./chunk-TM7OZT3W.mjs";import{a as T,e as D}from"./chunk-42H7WETG.mjs";import{d as E}from"./chunk-56CNRT2K.mjs";var C={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},l="0x4::token::Token";async function It(t){let{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()}};return(await k({aptosConfig:o,query:{query:V,variables:{where_condition:e}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Pt(t){let{aptosConfig:o,digitalAssetAddress:n}=t,e={token_data_id:{_eq:c.from(n).toStringLong()},amount:{_gt:0}};return(await k({aptosConfig:o,query:{query:G,variables:{where_condition:e}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function bt(t){let{aptosConfig:o,ownerAddress:n,options:e}=t,r={owner_address:{_eq:c.from(n).toStringLong()},amount:{_gt:0}},s={query:G,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await k({aptosConfig:o,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function St(t){let{aptosConfig:o,digitalAssetAddress:n,options:e}=t,r={token_data_id:{_eq:c.from(n).toStringLong()}},s={query:q,variables:{where_condition:r,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await k({aptosConfig:o,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var F={typeParameters:[],parameters:[new i(p()),new h,new i(p()),new i(p()),new w,new w,new w,new w,new w,new w,new w,new w,new w,new h,new h]};async function Dt(t){let{aptosConfig:o,options:n,creator:e}=t;return u({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new d(t.description),new D(t.maxSupply??E),new d(t.name),new d(t.uri),new T(t.mutableDescription??!0),new T(t.mutableRoyalty??!0),new T(t.mutableURI??!0),new T(t.mutableTokenDescription??!0),new T(t.mutableTokenName??!0),new T(t.mutableTokenProperties??!0),new T(t.mutableTokenURI??!0),new T(t.tokensBurnableByCreator??!0),new T(t.tokensFreezableByCreator??!0),new D(t.royaltyNumerator??0),new D(t.royaltyDenominator??1)],abi:F},options:n})}async function v(t){let{aptosConfig:o,options:n}=t,e=n?.where;n?.tokenStandard&&(e.token_standard={_eq:n?.tokenStandard??"v2"});let r={query:O,variables:{where_condition:e,offset:n?.offset,limit:n?.limit}};return(await k({aptosConfig:o,query:r,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ht(t){let{aptosConfig:o,creatorAddress:n,collectionName:e,options:r}=t,s=c.from(n),a={collection_name:{_eq:e},creator_address:{_eq:s.toStringLong()}};return r?.tokenStandard&&(a.token_standard={_eq:r?.tokenStandard??"v2"}),v({aptosConfig:o,options:{...r,where:a}})}async function vt(t){let{aptosConfig:o,creatorAddress:n,options:e}=t,s={creator_address:{_eq:c.from(n).toStringLong()}};return e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard??"v2"}),v({aptosConfig:o,options:{...e,where:s}})}async function xt(t){let{aptosConfig:o,collectionId:n,options:e}=t,s={collection_id:{_eq:c.from(n).toStringLong()}};return e?.tokenStandard&&(s.token_standard={_eq:e?.tokenStandard??"v2"}),v({aptosConfig:o,options:{...e,where:s}})}async function Gt(t){let{creatorAddress:o,collectionName:n,options:e,aptosConfig:r}=t,s=c.from(o),a={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return e?.tokenStandard&&(a.token_standard={_eq:e?.tokenStandard??"v2"}),(await v({aptosConfig:r,options:{where:a}})).collection_id}var N={typeParameters:[],parameters:[new i(p()),new i(p()),new i(p()),new i(p()),new f(new i(p())),new f(new i(p())),new f(f.u8())]};async function Bt(t){let{aptosConfig:o,options:n,creator:e,collection:r,description:s,name:a,uri:m,propertyKeys:g,propertyTypes:P,propertyValues:I}=t,b=P?.map(S=>C[S]);return u({aptosConfig:o,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new d(r),new d(s),new d(a),new d(m),_.MoveString(g??[]),_.MoveString(b??[]),K(I??[],b??[])],abi:N},options:n})}var Q={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new x]};async function Et(t){let{aptosConfig:o,sender:n,digitalAssetAddress:e,recipient:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[s??l],functionArguments:[c.from(e),c.from(r)],abi:Q},options:a})}var Y={typeParameters:[],parameters:[new i(p()),new i(p()),new i(p()),new i(p()),new f(new i(p())),new f(new i(p())),new f(f.u8()),new x]};async function Ot(t){let{aptosConfig:o,account:n,collection:e,description:r,name:s,uri:a,recipient:m,propertyKeys:g,propertyTypes:P,propertyValues:I,options:b}=t;if(g?.length!==I?.length)throw new Error("Property keys and property values counts do not match");if(P?.length!==I?.length)throw new Error("Property types and property values counts do not match");let S=P?.map(U=>C[U]);return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[e,r,s,a,_.MoveString(g??[]),_.MoveString(S??[]),K(I??[],S??[]),m],abi:Y},options:b})}var L={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0)))]};async function qt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[r??l],functionArguments:[c.from(e)],abi:L},options:s})}var z={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0)))]};async function Vt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[r??l],functionArguments:[e],abi:z},options:s})}var j={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0)))]};async function Rt(t){let{aptosConfig:o,creator:n,digitalAssetAddress:e,digitalAssetType:r,options:s}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[r??l],functionArguments:[e],abi:j},options:s})}var W={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Mt(t){let{aptosConfig:o,creator:n,description:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:W},options:a})}var X={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Kt(t){let{aptosConfig:o,creator:n,name:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:X},options:a})}var H={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Ut(t){let{aptosConfig:o,creator:n,uri:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:H},options:a})}var J={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p()),new i(p()),f.u8()]};async function Ft(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[m??l],functionArguments:[c.from(a),new d(e),new d(C[r]),_.U8(B(s,C[r]))],abi:J},options:g})}var Z={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p())]};async function Nt(t){let{aptosConfig:o,creator:n,propertyKey:e,digitalAssetAddress:r,digitalAssetType:s,options:a}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[s??l],functionArguments:[c.from(r),new d(e)],abi:Z},options:a})}var $={typeParameters:[{constraints:["key"]}],parameters:[new i(y(new A(0))),new i(p()),new i(p()),f.u8()]};async function Qt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[m??l],functionArguments:[c.from(a),new d(e),new d(C[r]),B(s,C[r])],abi:$},options:g})}var tt={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new i(y(new A(0))),new i(p()),new A(1)]};async function Yt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[m??l,C[r]],functionArguments:[c.from(a),new d(e),s],abi:tt},options:g})}var et={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new i(y(new A(0))),new i(p()),new A(1)]};async function Lt(t){let{aptosConfig:o,creator:n,propertyKey:e,propertyType:r,propertyValue:s,digitalAssetAddress:a,digitalAssetType:m,options:g}=t;return u({aptosConfig:o,sender:n.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[m??l,C[r]],functionArguments:[c.from(a),new d(e),s],abi:et},options:g})}function K(t,o){let n=new Array;return o.forEach((e,r)=>{n.push(B(t[r],e))}),n}function B(t,o){let n=R(o);return M(t,n,0,[]).bcsToBytes()}export{It as a,Pt as b,bt as c,St as d,Dt as e,v as f,ht as g,vt as h,xt as i,Gt as j,Bt as k,Et as l,Ot as m,qt as n,Vt as o,Rt as p,Mt as q,Kt as r,Ut as s,Ft as t,Nt as u,Qt as v,Yt as w,Lt as x};
2
+ //# sourceMappingURL=chunk-DP3YPGIK.mjs.map
@@ -1,2 +1,2 @@
1
- import{c as d}from"./chunk-BVVHGSWC.mjs";import{p as c}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-KM6UXNC7.mjs";var a=300,g=t=>{if(t&&t.length>a)throw new Error(`Event type length exceeds the maximum length of ${a}`)};async function m(t){let{aptosConfig:o,eventType:e,options:n}=t,s={_or:[{account_address:{_eq:e.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:e}};return p({aptosConfig:o,options:{...n,where:s}})}async function f(t){let{accountAddress:o,aptosConfig:e,creationNumber:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},creation_number:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function _(t){let{accountAddress:o,aptosConfig:e,eventType:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},indexed_type:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function p(t){let{aptosConfig:o,options:e}=t;g(e?.where?.indexed_type?._eq);let n={query:c,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:o,query:n,originMethod:"getEvents"})).events}export{m as a,f as b,_ as c,p as d};
2
- //# sourceMappingURL=chunk-KYJU5PWF.mjs.map
1
+ import{c as d}from"./chunk-PW3ISXPN.mjs";import{p as c}from"./chunk-VHNX2NUR.mjs";import{b as i}from"./chunk-JNO7KPMG.mjs";var a=300,g=t=>{if(t&&t.length>a)throw new Error(`Event type length exceeds the maximum length of ${a}`)};async function m(t){let{aptosConfig:o,eventType:e,options:n}=t,s={_or:[{account_address:{_eq:e.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:e}};return p({aptosConfig:o,options:{...n,where:s}})}async function f(t){let{accountAddress:o,aptosConfig:e,creationNumber:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},creation_number:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function _(t){let{accountAddress:o,aptosConfig:e,eventType:n,options:s}=t,r={account_address:{_eq:i.from(o).toStringLong()},indexed_type:{_eq:n}};return p({aptosConfig:e,options:{...s,where:r}})}async function p(t){let{aptosConfig:o,options:e}=t;g(e?.where?.indexed_type?._eq);let n={query:c,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await d({aptosConfig:o,query:n,originMethod:"getEvents"})).events}export{m as a,f as b,_ as c,p as d};
2
+ //# sourceMappingURL=chunk-DSKAMBBL.mjs.map
@@ -1,2 +1,2 @@
1
- import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-SOLWFAUY.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
2
- //# sourceMappingURL=chunk-L5J3V3HW.mjs.map
1
+ import{h as e,i as s,j as t,k as o,l as r,m as i,n as a,o as m,p as c,q as g,r as u,s as p,t as d}from"./chunk-DDVOBEJA.mjs";var A=class{constructor(n){this.config=n}async getOwnerAddress(n){return e({aptosConfig:this.config,...n})}async getExpiration(n){return t({aptosConfig:this.config,...n})}async getTargetAddress(n){return i({aptosConfig:this.config,...n})}async setTargetAddress(n){return a({aptosConfig:this.config,...n})}async getPrimaryName(n){return o({aptosConfig:this.config,...n})}async setPrimaryName(n){return r({aptosConfig:this.config,...n})}async registerName(n){return s({aptosConfig:this.config,...n})}async renewDomain(n){return d({aptosConfig:this.config,...n})}async getName(n){return m({aptosConfig:this.config,...n})}async getAccountNames(n){return c({aptosConfig:this.config,...n})}async getAccountDomains(n){return g({aptosConfig:this.config,...n})}async getAccountSubdomains(n){return u({aptosConfig:this.config,...n})}async getDomainSubdomains(n){return p({aptosConfig:this.config,...n})}};export{A as a};
2
+ //# sourceMappingURL=chunk-E2NYQVP3.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as v}from"./chunk-AHWZA3GD.mjs";import{g}from"./chunk-K4TJRYGQ.mjs";import{a as C}from"./chunk-ONFKJ57C.mjs";import{a as l}from"./chunk-WGIYSLH6.mjs";import{a as S}from"./chunk-YPBNYKOD.mjs";import{i as x,l as k,m as E,n as b,q as m}from"./chunk-XUP6VABV.mjs";import{b as h}from"./chunk-3XCYCFYI.mjs";import{e as K,f as A}from"./chunk-WKNX43KN.mjs";import{d as w}from"./chunk-F45G3GP3.mjs";import{a as u}from"./chunk-TM7OZT3W.mjs";import{b as f}from"./chunk-SPRNSFUV.mjs";import{jwtDecode as F}from"jwt-decode";async function j(r){let{aptosConfig:s,jwt:a,ephemeralKeyPair:t,uidKey:p="sub",derivationPath:i}=r,e={jwt_b64:a,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,epk_blinder:f.fromHexInput(t.blinder).toStringWithoutPrefix(),uid_key:p,derivation_path:i},{data:n}=await K({aptosConfig:s,path:"fetch",body:e,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return f.fromHexInput(n.pepper).toUint8Array()}async function I(r){let{aptosConfig:s,jwt:a,ephemeralKeyPair:t,pepper:p=await j(r),uidKey:i="sub",maxExpHorizonSecs:e=(await m({aptosConfig:s})).maxExpHorizonSecs}=r;if(f.fromHexInput(p).toUint8Array().length!==l.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${l.PEPPER_LENGTH} bytes`);let n=F(a);if(typeof n.iat!="number")throw new Error("iat was not found");if(e<t.expiryDateSecs-n.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${e}`);let o={jwt_b64:a,epk:t.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:f.fromHexInput(t.blinder).toStringWithoutPrefix(),exp_date_secs:t.expiryDateSecs,exp_horizon_secs:e,pepper:f.fromHexInput(p).toStringWithoutPrefix(),uid_key:i},{data:c}=await A({aptosConfig:s,path:"prove",body:o,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),d=c.proof,y=new k({a:d.a,b:d.b,c:d.c});return new b({proof:new E(y,0),trainingWheelsSignature:h.fromHex(c.training_wheels_signature),expHorizonSecs:e})}async function ee(r){let{aptosConfig:s,jwt:a,jwkAddress:t,uidKey:p,proofFetchCallback:i,pepper:e=await j(r)}=r,{verificationKey:n,maxExpHorizonSecs:o}=await m({aptosConfig:s}),c=I({...r,pepper:e,maxExpHorizonSecs:o}),d=i?c:await c;if(t!==void 0){let _=S.fromJwtAndPepper({jwt:a,pepper:e,jwkAddress:t,uidKey:p}),H=await g({aptosConfig:s,authenticationKey:_.authKey().derivedAddress()});return C.create({...r,address:H,proof:d,pepper:e,proofFetchCallback:i,jwkAddress:t,verificationKey:n})}let y=x.fromJwtAndPepper({jwt:a,pepper:e,uidKey:p}),P=await g({aptosConfig:s,authenticationKey:y.authKey().derivedAddress()});return l.create({...r,address:P,proof:d,pepper:e,proofFetchCallback:i,verificationKey:n})}async function te(r){let{aptosConfig:s,sender:a,iss:t,options:p}=r,i=r.jwksUrl??(t.endsWith("/")?`${t}.well-known/jwks.json`:`${t}/.well-known/jwks.json`),e;try{if(e=await fetch(i),!e.ok)throw new Error(`${e.status} ${e.statusText}`)}catch(o){let c;throw o instanceof Error?c=`${o.message}`:c=`error unknown - ${o}`,w.fromErrorType({type:14,details:`Failed to fetch JWKS at ${i}: ${c}`})}let n=await e.json();return v({aptosConfig:s,sender:a.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[t,u.MoveString(n.keys.map(o=>o.kid)),u.MoveString(n.keys.map(o=>o.alg)),u.MoveString(n.keys.map(o=>o.e)),u.MoveString(n.keys.map(o=>o.n))]},options:p})}export{j as a,I as b,ee as c,te as d};
2
+ //# sourceMappingURL=chunk-EEB7EZFO.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/keyless.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/keyless}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * keyless namespace and without having a dependency cycle error.\n */\nimport { jwtDecode, JwtPayload } from \"jwt-decode\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n AccountAddressInput,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n KeylessPublicKey,\n MoveJWK,\n ZeroKnowledgeSig,\n ZkProof,\n getKeylessConfig,\n} from \"../core\";\nimport { HexInput, ZkpVariant } from \"../types\";\nimport { Account, EphemeralKeyPair, KeylessAccount, ProofFetchCallback } from \"../account\";\nimport { PepperFetchRequest, PepperFetchResponse, ProverRequest, ProverResponse } from \"../types/keyless\";\nimport { lookupOriginalAccountAddress } from \"./account\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { FederatedKeylessAccount } from \"../account/FederatedKeylessAccount\";\nimport { MoveVector } from \"../bcs\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { InputGenerateTransactionOptions, SimpleTransaction } from \"../transactions\";\nimport { KeylessError, KeylessErrorType } from \"../errors\";\n\n/**\n * Retrieves a pepper value based on the provided configuration and authentication details.\n *\n * @param args - The arguments required to fetch the pepper.\n * @param args.aptosConfig - The configuration object for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for the operation.\n * @param args.uidKey - An optional unique identifier key (defaults to \"sub\").\n * @param args.derivationPath - An optional derivation path for the key.\n * @returns A Uint8Array containing the fetched pepper value.\n */\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey = \"sub\", derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n derivation_path: derivationPath,\n };\n const { data } = await postAptosPepperService<PepperFetchRequest, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n return Hex.fromHexInput(data.pepper).toUint8Array();\n}\n\n/**\n * Generates a zero-knowledge proof based on the provided parameters.\n * This function is essential for creating a signed proof that can be used in various cryptographic operations.\n *\n * @param args - The parameters required to generate the proof.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for generating the proof.\n * @param args.pepper - An optional hex input used to enhance security (default is generated if not provided).\n * @param args.uidKey - An optional string that specifies the unique identifier key (defaults to \"sub\").\n * @throws Error if the pepper length is not valid or if the ephemeral key pair's lifespan exceeds the maximum allowed.\n */\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper?: HexInput;\n uidKey?: string;\n maxExpHorizonSecs?: number;\n}): Promise<ZeroKnowledgeSig> {\n const {\n aptosConfig,\n jwt,\n ephemeralKeyPair,\n pepper = await getPepper(args),\n uidKey = \"sub\",\n maxExpHorizonSecs = (await getKeylessConfig({ aptosConfig })).maxExpHorizonSecs,\n } = args;\n if (Hex.fromHexInput(pepper).toUint8Array().length !== KeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper needs to be ${KeylessAccount.PEPPER_LENGTH} bytes`);\n }\n const decodedJwt = jwtDecode<JwtPayload>(jwt);\n if (typeof decodedJwt.iat !== \"number\") {\n throw new Error(\"iat was not found\");\n }\n if (maxExpHorizonSecs < ephemeralKeyPair.expiryDateSecs - decodedJwt.iat) {\n throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${maxExpHorizonSecs}`);\n }\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.getPublicKey().bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: ephemeralKeyPair.expiryDateSecs,\n exp_horizon_secs: maxExpHorizonSecs,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n\n const { data } = await postAptosProvingService<ProverRequest, ProverResponse>({\n aptosConfig,\n path: \"prove\",\n body: json,\n originMethod: \"getProof\",\n overrides: { WITH_CREDENTIALS: false },\n });\n\n const proofPoints = data.proof;\n const groth16Zkp = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new ZeroKnowledgeSig({\n proof: new ZkProof(groth16Zkp, ZkpVariant.Groth16),\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n expHorizonSecs: maxExpHorizonSecs,\n });\n return signedProof;\n}\n\n/**\n * Derives a keyless account by fetching the necessary proof and looking up the original account address.\n * This function helps in creating a keyless account that can be used without managing private keys directly.\n *\n * @param args - The arguments required to derive the keyless account.\n * @param args.aptosConfig - The configuration settings for Aptos.\n * @param args.jwt - The JSON Web Token used for authentication.\n * @param args.ephemeralKeyPair - The ephemeral key pair used for cryptographic operations.\n * @param args.uidKey - An optional unique identifier key for the user.\n * @param args.pepper - An optional hexadecimal input used for additional security.\n * @param args.proofFetchCallback - An optional callback function to handle the proof fetch outcome.\n * @returns A keyless account object.\n */\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<FederatedKeylessAccount>;\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n jwkAddress?: AccountAddressInput;\n uidKey?: string;\n pepper?: HexInput;\n proofFetchCallback?: ProofFetchCallback;\n}): Promise<KeylessAccount | FederatedKeylessAccount> {\n const { aptosConfig, jwt, jwkAddress, uidKey, proofFetchCallback, pepper = await getPepper(args) } = args;\n const { verificationKey, maxExpHorizonSecs } = await getKeylessConfig({ aptosConfig });\n\n const proofPromise = getProof({ ...args, pepper, maxExpHorizonSecs });\n // If a callback is provided, pass in the proof as a promise to KeylessAccount.create. This will make the proof be fetched in the\n // background and the callback will handle the outcome of the fetch. This allows the developer to not have to block on the proof fetch\n // allowing for faster rendering of UX.\n //\n // If no callback is provided, the just await the proof fetch and continue synchronously.\n const proof = proofFetchCallback ? proofPromise : await proofPromise;\n\n // Look up the original address to handle key rotations and then instantiate the account.\n if (jwkAddress !== undefined) {\n const publicKey = FederatedKeylessPublicKey.fromJwtAndPepper({ jwt, pepper, jwkAddress, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n\n return FederatedKeylessAccount.create({\n ...args,\n address,\n proof,\n pepper,\n proofFetchCallback,\n jwkAddress,\n verificationKey,\n });\n }\n\n const publicKey = KeylessPublicKey.fromJwtAndPepper({ jwt, pepper, uidKey });\n const address = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: publicKey.authKey().derivedAddress(),\n });\n return KeylessAccount.create({ ...args, address, proof, pepper, proofFetchCallback, verificationKey });\n}\n\nexport interface JWKS {\n keys: MoveJWK[];\n}\n\nexport async function updateFederatedKeylessJwkSetTransaction(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n iss: string;\n jwksUrl?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, iss, options } = args;\n const jwksUrl = args.jwksUrl ?? (iss.endsWith(\"/\") ? `${iss}.well-known/jwks.json` : `${iss}/.well-known/jwks.json`);\n\n let response: Response;\n\n try {\n response = await fetch(jwksUrl);\n if (!response.ok) {\n throw new Error(`${response.status} ${response.statusText}`);\n }\n } catch (error) {\n let errorMessage: string;\n if (error instanceof Error) {\n errorMessage = `${error.message}`;\n } else {\n errorMessage = `error unknown - ${error}`;\n }\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.JWK_FETCH_FAILED_FEDERATED,\n details: `Failed to fetch JWKS at ${jwksUrl}: ${errorMessage}`,\n });\n }\n\n const jwks: JWKS = await response.json();\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::jwks::update_federated_jwk_set\",\n functionArguments: [\n iss,\n MoveVector.MoveString(jwks.keys.map((key) => key.kid)),\n MoveVector.MoveString(jwks.keys.map((key) => key.alg)),\n MoveVector.MoveString(jwks.keys.map((key) => key.e)),\n MoveVector.MoveString(jwks.keys.map((key) => key.n)),\n ],\n },\n options,\n });\n}\n"],"mappings":"ieASA,OAAS,aAAAA,MAA6B,aAoCtC,eAAsBC,EAAUC,EAMR,CACtB,GAAM,CAAE,YAAAC,EAAa,IAAAC,EAAK,iBAAAC,EAAkB,OAAAC,EAAS,MAAO,eAAAC,CAAe,EAAIL,EAEzEM,EAAO,CACX,QAASJ,EACT,IAAKC,EAAiB,aAAa,EAAE,SAAS,EAAE,sBAAsB,EACtE,cAAeA,EAAiB,eAChC,YAAaI,EAAI,aAAaJ,EAAiB,OAAO,EAAE,sBAAsB,EAC9E,QAASC,EACT,gBAAiBC,CACnB,EACM,CAAE,KAAAG,CAAK,EAAI,MAAMC,EAAgE,C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C,CAAQ,EAAIxC,EACxCyC,EAAUzC,EAAK,UAAYuC,EAAI,SAAS,GAAG,EAAI,GAAGA,CAAG,wBAA0B,GAAGA,CAAG,0BAEvFG,EAEJ,GAAI,CAEF,GADAA,EAAW,MAAM,MAAMD,CAAO,EAC1B,CAACC,EAAS,GACZ,MAAM,IAAI,MAAM,GAAGA,EAAS,MAAM,IAAIA,EAAS,UAAU,EAAE,CAE/D,OAASC,EAAO,CACd,IAAIC,EACJ,MAAID,aAAiB,MACnBC,EAAe,GAAGD,EAAM,OAAO,GAE/BC,EAAe,mBAAmBD,CAAK,GAEnCE,EAAa,cAAc,CAC/B,QACA,QAAS,2BAA2BJ,CAAO,KAAKG,CAAY,EAC9D,CAAC,CACH,CAEA,IAAME,EAAa,MAAMJ,EAAS,KAAK,EACvC,OAAOK,EAAoB,CACzB,YAAA9C,EACA,OAAQqC,EAAO,eACf,KAAM,CACJ,SAAU,sCACV,kBAAmB,CACjBC,EACAS,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,GAAG,CAAC,EACrDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,GAAG,CAAC,EACrDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,CAAC,CAAC,EACnDD,EAAW,WAAWF,EAAK,KAAK,IAAKG,GAAQA,EAAI,CAAC,CAAC,CACrD,CACF,EACA,QAAAT,CACF,CAAC,CACH","names":["jwtDecode","getPepper","args","aptosConfig","jwt","ephemeralKeyPair","uidKey","derivationPath","body","Hex","data","postAptosPepperService","getProof","pepper","maxExpHorizonSecs","getKeylessConfig","KeylessAccount","decodedJwt","jwtDecode","json","postAptosProvingService","proofPoints","groth16Zkp","Groth16Zkp","ZeroKnowledgeSig","ZkProof","EphemeralSignature","deriveKeylessAccount","jwkAddress","proofFetchCallback","verificationKey","proofPromise","proof","publicKey","FederatedKeylessPublicKey","address","lookupOriginalAccountAddress","FederatedKeylessAccount","KeylessPublicKey","updateFederatedKeylessJwkSetTransaction","sender","iss","options","jwksUrl","response","error","errorMessage","KeylessError","jwks","generateTransaction","MoveVector","key"]}
@@ -1,2 +1,2 @@
1
- import{a as l}from"./chunk-ZPQUCT22.mjs";import{a as o,b as c}from"./chunk-2CJC43CV.mjs";import{a as h,i as d}from"./chunk-5S3Z7MT4.mjs";import{g as u}from"./chunk-T5BCTWGK.mjs";import g from"eventemitter3";var m="fulfilled",f=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(f||{}),p=class extends g{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new l(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let a=d({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);let i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let r=i[s];n=e[s],r.status===m?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let a=[];a.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){let s=n[i];s.status===m?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[a,n]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{m as a,f as b,p as c};
2
- //# sourceMappingURL=chunk-4JXB6V5O.mjs.map
1
+ import{a as l}from"./chunk-VCY3JGZM.mjs";import{a as o,b as c}from"./chunk-2CJC43CV.mjs";import{a as h,i as d}from"./chunk-AHWZA3GD.mjs";import{g as u}from"./chunk-OJBMR5CT.mjs";import g from"eventemitter3";var m="fulfilled",f=(n=>(n.TransactionSent="transactionSent",n.TransactionSendFailed="transactionSendFailed",n.TransactionExecuted="transactionExecuted",n.TransactionExecutionFailed="transactionExecutionFailed",n.ExecutionFinish="executionFinish",n))(f||{}),p=class extends g{constructor(t,e,a=30,n=100,i=10){super();this.taskQueue=new o;this.transactionsQueue=new o;this.outstandingTransactions=new o;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new l(t,e,a,n,i)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let a=d({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([a,t])}}catch(t){if(t instanceof c)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[a,n]=await this.outstandingTransactions.dequeue();for(t.push(a),e.push(n);!this.outstandingTransactions.isEmpty();)[a,n]=await this.outstandingTransactions.dequeue(),t.push(a),e.push(n);let i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let r=i[s];n=e[s],r.status===m?(this.sentTransactions.push([r.value.hash,n,null]),this.emit("transactionSent",{message:`transaction hash ${r.value.hash} has been committed to chain`,transactionHash:r.value.hash}),await this.checkTransaction(r,n)):(this.sentTransactions.push([r.status,n,r.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${r.reason}`,error:r.reason}))}this.emit("executionFinish",{message:`execute ${i.length} transactions finished`})}}catch(t){if(t instanceof c)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let a=[];a.push(u({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let n=await Promise.allSettled(a);for(let i=0;i<n.length;i+=1){let s=n[i];s.status===m?(this.executedTransactions.push([s.value.hash,e,null]),this.emit("transactionExecuted",{message:`transaction hash ${s.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([s.status,e,s.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${s.reason}`,error:s.reason}))}}catch(a){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${a}`)}}async push(t,e){this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[a,n]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:a,options:{...n,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};export{m as a,f as b,p as c};
2
+ //# sourceMappingURL=chunk-F2AIWA7L.mjs.map
@@ -0,0 +1,7 @@
1
+ import{b as T}from"./chunk-V4FKFCBL.mjs";var N=(r=>(r[r.API_ERROR=0]="API_ERROR",r[r.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",r[r.SESSION_EXPIRED=2]="SESSION_EXPIRED",r[r.INVALID_STATE=3]="INVALID_STATE",r[r.UNKNOWN=4]="UNKNOWN",r))(N||{}),l=(s=>(s.REAUTHENTICATE="Re-authentiate to continue using your keyless account",s.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",s.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",s.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",s.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",s.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",s.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",s.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",s.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",s))(l||{}),u=(e=>(e[e.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",e[e.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",e[e.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",e[e.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",e[e.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",e[e.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",e[e.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",e[e.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",e[e.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",e[e.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",e[e.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",e[e.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",e[e.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",e[e.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",e[e.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",e[e.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",e[e.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",e[e.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",e[e.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",e[e.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",e[e.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",e[e.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",e[e.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",e[e.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",e[e.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",e[e.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",e[e.UNKNOWN=26]="UNKNOWN",e))(u||{}),A={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["An unknown error has occurred.",4,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},O=class i extends Error{constructor(o){let{innerError:E,category:t,resolutionTip:R,type:r,message:_=A[r][0],details:n}=o;super(_),this.name="KeylessError",this.innerError=E,this.category=t,this.resolutionTip=R,this.type=r,this.details=n,this.message=i.constructMessage(_,R,E,n)}static constructMessage(o,E,t,R){let r=`
2
+ Message: ${o}`;return R&&(r+=`
3
+ Details: ${R}`),t instanceof I?r+=`
4
+ AptosApiError: ${t.message}`:t!==void 0&&(r+=`
5
+ Error: ${T(t)}`),r+=`
6
+ KeylessErrorResolutionTip: ${E}`,r}static fromErrorType(o){let{error:E,type:t,details:R}=o,[r,_,n]=A[t];return new i({message:r,details:R,innerError:E,category:_,resolutionTip:n,type:t})}},I=class extends Error{constructor({apiType:o,aptosRequest:E,aptosResponse:t}){super(P({apiType:o,aptosRequest:E,aptosResponse:t})),this.name="AptosApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.data=t.data,this.request=E}};function P({apiType:i,aptosRequest:o,aptosResponse:E}){let t=E.headers?.traceparent?.split("-")[1],R=t?`(trace_id:${t}) `:"",r=`Request to [${i}]: ${o.method} ${E.url??o.url} ${R}failed with`;return i==="Indexer"&&E.data?.errors?.[0]?.message!=null?`${r}: ${E.data.errors[0].message}`:E.data?.message!=null&&E.data?.error_code!=null?`${r}: ${JSON.stringify(E.data)}`:`${r} status: ${E.statusText}(code:${E.status}) and response body: ${S(E.data)}`}var a=400;function S(i){let o=JSON.stringify(i);return o.length<=a?o:`truncated(original_size:${o.length}): ${o.slice(0,a/2)}...${o.slice(-a/2)}`}export{N as a,l as b,u as c,O as d,I as e};
7
+ //# sourceMappingURL=chunk-F45G3GP3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/errors/index.ts"],"sourcesContent":["import { AptosApiType } from \"../utils/const\";\nimport { getErrorMessage } from \"../utils/helpers\";\nimport { AptosRequest, AptosResponse } from \"../types\";\n\nexport enum KeylessErrorCategory {\n API_ERROR,\n EXTERNAL_API_ERROR,\n SESSION_EXPIRED,\n INVALID_STATE,\n UNKNOWN,\n}\n\nexport enum KeylessErrorResolutionTip {\n REAUTHENTICATE = \"Re-authentiate to continue using your keyless account\",\n // eslint-disable-next-line max-len\n REAUTHENTICATE_UNSURE = \"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support\",\n UPDATE_REQUEST_PARAMS = \"Update the invalid request parameters and reauthenticate.\",\n // eslint-disable-next-line max-len\n RATE_LIMIT_EXCEEDED = \"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.\",\n // eslint-disable-next-line max-len\n SERVER_ERROR = \"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n // eslint-disable-next-line max-len\n CALL_PRECHECK = \"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.\",\n REINSTANTIATE = \"Try instantiating the account again. Avoid manipulating the account object directly\",\n JOIN_SUPPORT_GROUP = \"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n UNKNOWN = \"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx\",\n}\n\nexport enum KeylessErrorType {\n EPHEMERAL_KEY_PAIR_EXPIRED,\n\n PROOF_NOT_FOUND,\n\n ASYNC_PROOF_FETCH_FAILED,\n\n INVALID_PROOF_VERIFICATION_FAILED,\n\n INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND,\n\n INVALID_JWT_SIG,\n\n INVALID_JWT_JWK_NOT_FOUND,\n\n INVALID_JWT_ISS_NOT_RECOGNIZED,\n\n INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED,\n\n INVALID_TW_SIG_VERIFICATION_FAILED,\n\n INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND,\n\n INVALID_EXPIRY_HORIZON,\n\n JWT_PARSING_ERROR,\n\n JWK_FETCH_FAILED,\n\n JWK_FETCH_FAILED_FEDERATED,\n\n RATE_LIMIT_EXCEEDED,\n\n PEPPER_SERVICE_INTERNAL_ERROR,\n\n PEPPER_SERVICE_BAD_REQUEST,\n\n PEPPER_SERVICE_OTHER,\n\n PROVER_SERVICE_INTERNAL_ERROR,\n\n PROVER_SERVICE_BAD_REQUEST,\n\n PROVER_SERVICE_OTHER,\n\n FULL_NODE_CONFIG_LOOKUP_ERROR,\n\n FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR,\n\n FULL_NODE_JWKS_LOOKUP_ERROR,\n\n FULL_NODE_OTHER,\n\n UNKNOWN,\n}\n\nconst KeylessErrors: { [key in KeylessErrorType]: [string, KeylessErrorCategory, KeylessErrorResolutionTip] } = {\n [KeylessErrorType.EPHEMERAL_KEY_PAIR_EXPIRED]: [\n \"The ephemeral keypair has expired.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.PROOF_NOT_FOUND]: [\n \"The required proof could not be found.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.CALL_PRECHECK,\n ],\n [KeylessErrorType.ASYNC_PROOF_FETCH_FAILED]: [\n \"The required proof failed to fetch.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_FAILED]: [\n \"The provided proof is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND]: [\n \"The verification key used to authenticate was updated.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_SIG]: [\n \"The JWK was found, but JWT failed verification\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_JWT_JWK_NOT_FOUND]: [\n \"The JWK required to verify the JWT could not be found. The JWK may have been rotated out.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_JWT_ISS_NOT_RECOGNIZED]: [\n \"The JWT issuer is not recognized.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED]: [\n \"The JWT issuer is not supported by the Federated Keyless \",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_VERIFICATION_FAILED]: [\n \"The training wheels signature is invalid.\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REAUTHENTICATE_UNSURE,\n ],\n [KeylessErrorType.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND]: [\n \"The public key used to verify the training wheels signature was not found.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.INVALID_EXPIRY_HORIZON]: [\n \"The expiry horizon is invalid.\",\n KeylessErrorCategory.SESSION_EXPIRED,\n KeylessErrorResolutionTip.REAUTHENTICATE,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED]: [\n \"Failed to fetch JWKS.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.JWK_FETCH_FAILED_FEDERATED]: [\n \"Failed to fetch JWKS for Federated Keyless provider.\",\n KeylessErrorCategory.EXTERNAL_API_ERROR,\n KeylessErrorResolutionTip.JOIN_SUPPORT_GROUP,\n ],\n [KeylessErrorType.RATE_LIMIT_EXCEEDED]: [\n \"Rate limit exceeded. Too many requests in a short period.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.RATE_LIMIT_EXCEEDED,\n ],\n [KeylessErrorType.PEPPER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PEPPER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PEPPER_SERVICE_OTHER]: [\n \"Unknown error from Pepper service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_INTERNAL_ERROR]: [\n \"Internal error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.PROVER_SERVICE_BAD_REQUEST]: [\n \"Bad request sent to Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.UPDATE_REQUEST_PARAMS,\n ],\n [KeylessErrorType.PROVER_SERVICE_OTHER]: [\n \"Unknown error from Prover service.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.JWT_PARSING_ERROR]: [\n \"Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support\",\n KeylessErrorCategory.INVALID_STATE,\n KeylessErrorResolutionTip.REINSTANTIATE,\n ],\n [KeylessErrorType.FULL_NODE_CONFIG_LOOKUP_ERROR]: [\n \"Error when looking up on-chain keyless configuration.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR]: [\n \"Error when looking up on-chain verification key.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_JWKS_LOOKUP_ERROR]: [\n \"Error when looking up on-chain JWKS.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.FULL_NODE_OTHER]: [\n \"Unknown error from full node.\",\n KeylessErrorCategory.API_ERROR,\n KeylessErrorResolutionTip.SERVER_ERROR,\n ],\n [KeylessErrorType.UNKNOWN]: [\n \"An unknown error has occurred.\",\n KeylessErrorCategory.UNKNOWN,\n KeylessErrorResolutionTip.UNKNOWN,\n ],\n};\n\nexport class KeylessError extends Error {\n readonly innerError?: unknown;\n\n readonly category: KeylessErrorCategory;\n\n readonly resolutionTip: KeylessErrorResolutionTip;\n\n readonly type: KeylessErrorType;\n\n readonly details?: string;\n\n /** @internal this constructor is for sdk internal use - do not instantiate outside of the SDK codebase */\n constructor(args: {\n innerError?: unknown;\n category: KeylessErrorCategory;\n resolutionTip: KeylessErrorResolutionTip;\n type: KeylessErrorType;\n message?: string;\n details?: string;\n }) {\n const { innerError, category, resolutionTip, type, message = KeylessErrors[type][0], details } = args;\n super(message);\n this.name = \"KeylessError\";\n this.innerError = innerError;\n this.category = category;\n this.resolutionTip = resolutionTip;\n this.type = type;\n this.details = details;\n this.message = KeylessError.constructMessage(message, resolutionTip, innerError, details);\n }\n\n static constructMessage(\n message: string,\n tip: KeylessErrorResolutionTip,\n innerError?: unknown,\n details?: string,\n ): string {\n let result = `\\nMessage: ${message}`;\n if (details) {\n result += `\\nDetails: ${details}`;\n }\n if (innerError instanceof AptosApiError) {\n result += `\\nAptosApiError: ${innerError.message}`;\n } else if (innerError !== undefined) {\n result += `\\nError: ${getErrorMessage(innerError)}`;\n }\n result += `\\nKeylessErrorResolutionTip: ${tip}`;\n return result;\n }\n\n /**\n * Static constructor that creates a KeylessError instance using the KeylessErrors constant\n * @param args.type The type of KeylessError\n * @param args.aptosApiError optional AptosApiError supplied for api errors\n * @param args.details optional details to include in the error message\n * @returns A new KeylessError instance\n */\n static fromErrorType(args: { type: KeylessErrorType; error?: unknown; details?: string }): KeylessError {\n const { error, type, details } = args;\n\n const [message, category, resolutionTip] = KeylessErrors[type];\n return new KeylessError({\n message,\n details,\n innerError: error,\n category,\n resolutionTip,\n type,\n });\n }\n}\n\n/**\n * Options for handling errors in the Aptos API.\n */\ntype AptosApiErrorOpts = {\n apiType: AptosApiType;\n aptosRequest: AptosRequest;\n aptosResponse: AptosResponse<any, any>;\n};\n\n/**\n * Represents an error returned from the Aptos API.\n * This class encapsulates the details of the error, including the request URL, response status, and additional data.\n *\n * @param name - The name of the error, which is always \"AptosApiError\".\n * @param url - The URL to which the request was made.\n * @param status - The HTTP response status code (e.g., 400).\n * @param statusText - The message associated with the response status.\n * @param data - The response data returned from the API.\n * @param request - The original AptosRequest that triggered the error.\n */\nexport class AptosApiError extends Error {\n readonly url: string;\n\n readonly status: number;\n\n readonly statusText: string;\n\n readonly data: any;\n\n readonly request: AptosRequest;\n\n /**\n * Constructs an instance of AptosApiError with relevant error details.\n *\n * @param opts - The options for creating the AptosApiError.\n * @param opts.apiType - The type of API that generated the error.\n * @param opts.aptosRequest - The request object that caused the error.\n * @param opts.aptosResponse - The response object containing error details.\n *\n * @internal This constructor is for SDK internal use - do not instantiate outside the SDK codebase.\n */\n constructor({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts) {\n super(deriveErrorMessage({ apiType, aptosRequest, aptosResponse }));\n\n this.name = \"AptosApiError\";\n this.url = aptosResponse.url;\n this.status = aptosResponse.status;\n this.statusText = aptosResponse.statusText;\n this.data = aptosResponse.data;\n this.request = aptosRequest;\n }\n}\n\n/**\n * Derives an error message from the Aptos API response, providing context for debugging.\n * This function helps in understanding the nature of the error encountered during an API request.\n *\n * @param {AptosApiErrorOpts} opts - The options for deriving the error message.\n * @param {AptosApiType} opts.apiType - The type of API being called.\n * @param {AptosRequest} opts.aptosRequest - The original request made to the Aptos API.\n * @param {AptosResponse} opts.aptosResponse - The response received from the Aptos API.\n */\nfunction deriveErrorMessage({ apiType, aptosRequest, aptosResponse }: AptosApiErrorOpts): string {\n // eslint-disable-next-line max-len\n // extract the W3C trace_id from the response headers if it exists. Some services set this in the response, and it's useful for debugging.\n // See https://www.w3.org/TR/trace-context/#relationship-between-the-headers .\n const traceId = aptosResponse.headers?.traceparent?.split(\"-\")[1];\n const traceIdString = traceId ? `(trace_id:${traceId}) ` : \"\";\n\n const errorPrelude: string = `Request to [${apiType}]: ${aptosRequest.method} ${\n aptosResponse.url ?? aptosRequest.url\n } ${traceIdString}failed with`;\n\n // handle graphql responses from indexer api and extract the error message of the first error\n if (apiType === AptosApiType.INDEXER && aptosResponse.data?.errors?.[0]?.message != null) {\n return `${errorPrelude}: ${aptosResponse.data.errors[0].message}`;\n }\n\n // Received well-known structured error response body - simply serialize and return it.\n // We don't need http status codes etc. in this case.\n if (aptosResponse.data?.message != null && aptosResponse.data?.error_code != null) {\n return `${errorPrelude}: ${JSON.stringify(aptosResponse.data)}`;\n }\n\n // This is the generic/catch-all case. We received some response from the API, but it doesn't appear to be a well-known structure.\n // We print http status codes and the response body (after some trimming),\n // in the hope that this gives enough context what went wrong without printing overly huge messages.\n return `${errorPrelude} status: ${aptosResponse.statusText}(code:${\n aptosResponse.status\n }) and response body: ${serializeAnyPayloadForErrorMessage(aptosResponse.data)}`;\n}\n\nconst SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH = 400;\n\n/**\n * This function accepts a payload of any type (probably an object) and serializes it to a string\n * Since we don't know the type or size of the payload, and we don't want to add a huge object in full to the error message\n * we limit the to the first 200 and last 200 characters of the serialized payload and put a \"...\" in the middle.\n * @param payload - The payload to serialize, which can be of any type.\n *\n * @returns A string representation of the serialized payload, potentially truncated.\n */\nfunction serializeAnyPayloadForErrorMessage(payload: any): string {\n const serializedPayload = JSON.stringify(payload);\n if (serializedPayload.length <= SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH) {\n return serializedPayload;\n }\n return `truncated(original_size:${serializedPayload.length}): ${serializedPayload.slice(\n 0,\n SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2,\n )}...${serializedPayload.slice(-SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH / 2)}`;\n}\n"],"mappings":"yCAIO,IAAKA,OACVA,IAAA,yBACAA,IAAA,2CACAA,IAAA,qCACAA,IAAA,iCACAA,IAAA,qBALUA,OAAA,IAQAC,OACVA,EAAA,eAAiB,wDAEjBA,EAAA,sBAAwB,4HACxBA,EAAA,sBAAwB,4DAExBA,EAAA,oBAAsB,iPAEtBA,EAAA,aAAe,+IAEfA,EAAA,cAAgB,mJAChBA,EAAA,cAAgB,uFAChBA,EAAA,mBAAqB,wEACrBA,EAAA,QAAU,uFAbAA,OAAA,IAgBAC,OACVA,IAAA,2DAEAA,IAAA,qCAEAA,IAAA,uDAEAA,IAAA,yEAEAA,IAAA,uFAEAA,IAAA,qCAEAA,IAAA,yDAEAA,IAAA,mEAEAA,IAAA,qFAEAA,IAAA,2EAEAA,IAAA,8EAEAA,IAAA,oDAEAA,IAAA,0CAEAA,IAAA,wCAEAA,IAAA,4DAEAA,IAAA,8CAEAA,IAAA,kEAEAA,IAAA,4DAEAA,IAAA,gDAEAA,IAAA,kEAEAA,IAAA,4DAEAA,IAAA,gDAEAA,IAAA,kEAEAA,IAAA,sFAEAA,IAAA,8DAEAA,IAAA,sCAEAA,IAAA,sBArDUA,OAAA,IAwDNC,EAA0G,CAC7G,EAA8C,CAC7C,qCACA,EACA,uDACF,EACC,EAAmC,CAClC,yCACA,EACA,kJACF,EACC,EAA4C,CAC3C,sCACA,EACA,2HACF,EACC,EAAqD,CACpD,iCACA,EACA,2HACF,EACC,EAA4D,CAC3D,yDACA,EACA,uDACF,EACC,EAAmC,CAClC,iDACA,EACA,2HACF,EACC,EAA6C,CAC5C,4FACA,EACA,uDACF,EACC,EAAkD,CACjD,oCACA,EACA,2DACF,EACC,EAA2D,CAC1D,4DACA,EACA,2HACF,EACC,EAAsD,CACrD,4CACA,EACA,2HACF,EACC,GAAuD,CACtD,6EACA,EACA,uDACF,EACC,GAA0C,CACzC,iCACA,EACA,uDACF,EACC,GAAoC,CACnC,wBACA,EACA,uEACF,EACC,GAA8C,CAC7C,uDACA,EACA,uEACF,EACC,GAAuC,CACtC,4DACA,EACA,gPACF,EACC,GAAiD,CAChD,sCACA,EACA,8IACF,EACC,GAA8C,CAC7C,sCACA,EACA,2DACF,EACC,GAAwC,CACvC,qCACA,EACA,8IACF,EACC,GAAiD,CAChD,sCACA,EACA,8IACF,EACC,GAA8C,CAC7C,sCACA,EACA,2DACF,EACC,GAAwC,CACvC,qCACA,EACA,8IACF,EACC,GAAqC,CACpC,oGACA,EACA,sFACF,EACC,GAAiD,CAChD,wDACA,EACA,8IACF,EACC,GAA2D,CAC1D,mDACA,EACA,8IACF,EACC,GAA+C,CAC9C,uCACA,EACA,8IACF,EACC,GAAmC,CAClC,gCACA,EACA,8IACF,EACC,GAA2B,CAC1B,iCACA,EACA,sFACF,CACF,EAEaC,EAAN,MAAMC,UAAqB,KAAM,CAYtC,YAAYC,EAOT,CACD,GAAM,CAAE,WAAAC,EAAY,SAAAC,EAAU,cAAAC,EAAe,KAAAC,EAAM,QAAAC,EAAUR,EAAcO,CAAI,EAAE,CAAC,EAAG,QAAAE,CAAQ,EAAIN,EACjG,MAAMK,CAAO,EACb,KAAK,KAAO,eACZ,KAAK,WAAaJ,EAClB,KAAK,SAAWC,EAChB,KAAK,cAAgBC,EACrB,KAAK,KAAOC,EACZ,KAAK,QAAUE,EACf,KAAK,QAAUP,EAAa,iBAAiBM,EAASF,EAAeF,EAAYK,CAAO,CAC1F,CAEA,OAAO,iBACLD,EACAE,EACAN,EACAK,EACQ,CACR,IAAIE,EAAS;AAAA,W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M,SAAW,MAAQA,EAAc,MAAM,YAAc,KACpE,GAAGI,CAAY,KAAK,KAAK,UAAUJ,EAAc,IAAI,CAAC,GAMxD,GAAGI,CAAY,YAAYJ,EAAc,UAAU,SACxDA,EAAc,MAChB,wBAAwBK,EAAmCL,EAAc,IAAI,CAAC,EAChF,CAEA,IAAMM,EAAwC,IAU9C,SAASD,EAAmCE,EAAsB,CAChE,IAAMC,EAAoB,KAAK,UAAUD,CAAO,EAChD,OAAIC,EAAkB,QAAUF,EACvBE,EAEF,2BAA2BA,EAAkB,MAAM,MAAMA,EAAkB,MAChF,EACAF,EAAwC,CAC1C,CAAC,MAAME,EAAkB,MAAM,CAACF,EAAwC,CAAC,CAAC,EAC5E","names":["KeylessErrorCategory","KeylessErrorResolutionTip","KeylessErrorType","KeylessErrors","KeylessError","_KeylessError","args","innerError","category","resolutionTip","type","message","details","tip","result","AptosApiError","getErrorMessage","error","apiType","aptosRequest","aptosResponse","deriveErrorMessage","traceId","traceIdString","errorPrelude","serializeAnyPayloadForErrorMessage","SERIALIZED_PAYLOAD_TRIM_TO_MAX_LENGTH","payload","serializedPayload"]}
@@ -1,2 +1,2 @@
1
- import{c as T,d as c}from"./chunk-4LKLOUMG.mjs";import{g as A,h as a}from"./chunk-J245N3XF.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
2
- //# sourceMappingURL=chunk-WSZCPSV4.mjs.map
1
+ import{c as T,d as c}from"./chunk-X3JPX7T6.mjs";import{g as A,h as a}from"./chunk-J245N3XF.mjs";import{sha3_256 as y}from"@noble/hashes/sha3";function d(e){return e.feePayerAddress?new c(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress):e.secondarySignerAddresses?new T(e.rawTransaction,e.secondarySignerAddresses):e.rawTransaction}function n(e,r){let i=y.create();if(!r.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${r}`);i.update(r);let s=i.digest(),o=e,t=new Uint8Array(s.length+o.length);return t.set(s),t.set(o,s.length),t}function u(e){return n(e.bcsToBytes(),`APTOS::${e.constructor.name}`)}function S(e){let r=d(e);return e.feePayerAddress?n(r.bcsToBytes(),a):e.secondarySignerAddresses?n(r.bcsToBytes(),a):n(r.bcsToBytes(),A)}export{d as a,n as b,u as c,S as d};
2
+ //# sourceMappingURL=chunk-FXUI3SSD.mjs.map
@@ -0,0 +1,2 @@
1
+ import{c as l}from"./chunk-AOROYJ74.mjs";import{a as k,b as y,d as g,e as w,f as z,g as D,h as L,i as d,j as R,l as X,m as q,n as H,o as J,p as K,q as Q,s as i,t as W}from"./chunk-WSFHH3BK.mjs";import{c as j}from"./chunk-K4TJRYGQ.mjs";import{b as C,c as x,d as a,e as M,f as _,g as O,h as V,i as G,n as P}from"./chunk-T6ADNZE5.mjs";import{b as m}from"./chunk-JNO7KPMG.mjs";import{a as T,c as I,d as f}from"./chunk-TM7OZT3W.mjs";import{a as A,b as E,c as v,d as b,e as F,f as $,g as S}from"./chunk-42H7WETG.mjs";import{a as p}from"./chunk-L56DQ4N3.mjs";var Y=new TextEncoder;function yn(n){return n?.map(e=>y(e)?l(e):e)??[]}async function B(n,e,t,u){let r=await j({aptosConfig:u,accountAddress:n,moduleName:e});if(r.abi)return r.abi.exposed_functions.find(s=>s.name===t)}async function Tn(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let s=[];for(let c=0;c<r.params.length;c+=1)s.push(l(r.params[c],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s}}async function ln(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!r.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let s=W(r),c=[];for(let o=s;o<r.params.length;o+=1)c.push(l(r.params[o],{allowGenerics:!0}));return{signers:s,typeParameters:r.generic_type_params,parameters:c}}async function An(n,e,t,u){let r=await B(n,e,t,u);if(!r)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!r.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let s=[];for(let o=0;o<r.params.length;o+=1)s.push(l(r.params[o],{allowGenerics:!0}));let c=[];for(let o=0;o<r.return.length;o+=1)c.push(l(r.return[o],{allowGenerics:!0}));return{typeParameters:r.generic_type_params,parameters:s,returnTypes:c}}function gn(n,e,t,u,r){return n instanceof p?n:p.new_bytes(Z(e,t,n,u,r).bcsToBytes())}function Z(n,e,t,u,r){if(u>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let s=e.parameters[u];return U(t,s,u,r)}function U(n,e,t,u){return D(n)?(h(e,n,t),n):N(n,e,t,u)}function N(n,e,t,u){if(e.isBool()){if(k(n))return new A(n);if(y(n)){if(n==="true")return new A(!0);if(n==="false")return new A(!1)}i("boolean",t)}if(e.isAddress()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isU8()){let r=g(n);if(r!==void 0)return new E(r);i("number | string",t)}if(e.isU16()){let r=g(n);if(r!==void 0)return new v(r);i("number | string",t)}if(e.isU32()){let r=g(n);if(r!==void 0)return new b(r);i("number | string",t)}if(e.isU64()){if(w(n))return new F(BigInt(n));i("bigint | number | string",t)}if(e.isU128()){if(w(n))return new $(BigInt(n));i("bigint | number | string",t)}if(e.isU256()){if(w(n))return new S(BigInt(n));i("bigint | number | string",t)}if(e.isGeneric()){let r=e.value;if(r<0||r>=u.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return U(n,u[r],t,u)}if(e.isVector()){if(e.value.isU8()){if(y(n))return T.U8(Y.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(r=>U(r,e.value,t,u)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(y(n))return new I(n);i("string",t)}if(e.isObject()){if(y(n))return m.fromString(n);i("string | AccountAddress",t)}if(e.isOption()){if(z(n)){let r=e.value.typeArgs[0];return r instanceof C?new f(null):r instanceof G?new f(null):r instanceof x?new f(null):r instanceof a?new f(null):r instanceof M?new f(null):r instanceof _?new f(null):r instanceof O?new f(null):r instanceof V?new f(null):new f(null)}return new f(U(n,e.value.typeArgs[0],t,u))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function h(n,e,t){if(n.isBool()){if(L(e))return;i("Bool",t)}if(n.isAddress()){if(d(e))return;i("AccountAddress",t)}if(n.isU8()){if(X(e))return;i("U8",t)}if(n.isU16()){if(q(e))return;i("U16",t)}if(n.isU32()){if(H(e))return;i("U32",t)}if(n.isU64()){if(J(e))return;i("U64",t)}if(n.isU128()){if(K(e))return;i("U128",t)}if(n.isU256()){if(Q(e))return;i("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&h(n.value,e.values[0],t);return}i("MoveVector",t)}if(n instanceof P){if(n.isString()){if(R(e))return;i("MoveString",t)}if(n.isObject()){if(d(e))return;i("AccountAddress",t)}if(n.isOption()){if(e instanceof f){e.value!==void 0&&h(n.value.typeArgs[0],e.value,t);return}i("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}export{yn as a,B as b,Tn as c,ln as d,An as e,gn as f,Z as g,U as h};
2
+ //# sourceMappingURL=chunk-G2GN4LH5.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/transactionBuilder/remoteAbi.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { parseTypeTag } from \"../typeTag/parser\";\nimport {\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n} from \"../typeTag\";\nimport { AptosConfig } from \"../../api/aptosConfig\";\nimport {\n EntryFunctionArgumentTypes,\n SimpleEntryFunctionArgumentTypes,\n EntryFunctionABI,\n ViewFunctionABI,\n FunctionABI,\n TypeArgument,\n} from \"../types\";\nimport { Bool, MoveOption, MoveString, MoveVector, U128, U16, U256, U32, U64, U8 } from \"../../bcs\";\nimport { AccountAddress } from \"../../core\";\nimport { getModule } from \"../../internal/account\";\nimport {\n findFirstNonSignerArg,\n isBcsAddress,\n isBcsBool,\n isBcsString,\n isBcsU128,\n isBcsU16,\n isBcsU256,\n isBcsU32,\n isBcsU64,\n isBcsU8,\n isBool,\n isEncodedEntryFunctionArgument,\n isLargeNumber,\n isEmptyOption,\n isString,\n throwTypeMismatch,\n convertNumber,\n} from \"./helpers\";\nimport { CallArgument, MoveFunction } from \"../../types\";\n\nconst TEXT_ENCODER = new TextEncoder();\n\n/**\n * Convert type arguments to only type tags, allowing for string representations of type tags.\n *\n * @param typeArguments - An optional array of type arguments that may include string representations.\n * @returns An array of TypeTag objects derived from the provided type arguments.\n */\nexport function standardizeTypeTags(typeArguments?: Array<TypeArgument>): Array<TypeTag> {\n return (\n typeArguments?.map((typeArg: TypeArgument): TypeTag => {\n // Convert to TypeTag if it's a string representation\n if (isString(typeArg)) {\n return parseTypeTag(typeArg);\n }\n return typeArg;\n }) ?? []\n );\n}\n\n/**\n * Fetches the ABI of a specified function from the on-chain module ABI. This function allows you to access the details of a\n * specific function within a module.\n *\n * @param moduleAddress - The address of the module from which to fetch the function ABI.\n * @param moduleName - The name of the module containing the function.\n * @param functionName - The name of the function whose ABI is to be fetched.\n * @param aptosConfig - The configuration settings for Aptos.\n */\nexport async function fetchFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<MoveFunction | undefined> {\n // This fetch from the API is currently cached\n const module = await getModule({ aptosConfig, accountAddress: moduleAddress, moduleName });\n\n if (module.abi) {\n return module.abi.exposed_functions.find((func) => func.name === functionName);\n }\n\n return undefined;\n}\n\n/**\n * Fetches a function ABI from the on-chain module ABI. It doesn't validate whether it's a view or entry function.\n * @param moduleAddress\n * @param moduleName\n * @param functionName\n * @param aptosConfig\n */\nexport async function fetchMoveFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<FunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n if (!functionAbi) {\n throw new Error(`Could not find function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for an entry function from the specified module address.\n * This function validates if the ABI corresponds to an entry function and retrieves its parameters.\n *\n * @param moduleAddress - The address of the module containing the entry function.\n * @param moduleName - The name of the module containing the entry function.\n * @param functionName - The name of the entry function to fetch the ABI for.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the number of signers, type parameters, and function parameters.\n * @throws Error if the ABI cannot be found or if the function is not an entry function.\n */\nexport async function fetchEntryFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<EntryFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find entry function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-entry functions also can't be used\n if (!functionAbi.is_entry) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an entry function`);\n }\n\n // Remove the signer arguments\n const numSigners = findFirstNonSignerArg(functionAbi);\n const params: TypeTag[] = [];\n for (let i = numSigners; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n return {\n signers: numSigners,\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n };\n}\n\n/**\n * Fetches the ABI for a view function from the specified module address.\n * This function ensures that the ABI is valid and retrieves the type parameters, parameters, and return types for the view function.\n *\n * @param moduleAddress - The address of the module containing the view function.\n * @param moduleName - The name of the module containing the view function.\n * @param functionName - The name of the view function for which to fetch the ABI.\n * @param aptosConfig - The configuration settings for Aptos.\n * @returns An object containing the type parameters, parameters, and return types of the view function.\n * @throws Error if the ABI cannot be found or if the function is not a view function.\n */\nexport async function fetchViewFunctionAbi(\n moduleAddress: string,\n moduleName: string,\n functionName: string,\n aptosConfig: AptosConfig,\n): Promise<ViewFunctionABI> {\n const functionAbi = await fetchFunctionAbi(moduleAddress, moduleName, functionName, aptosConfig);\n\n // If there's no ABI, then the function is invalid\n if (!functionAbi) {\n throw new Error(`Could not find view function ABI for '${moduleAddress}::${moduleName}::${functionName}'`);\n }\n\n // Non-view functions can't be used\n if (!functionAbi.is_view) {\n throw new Error(`'${moduleAddress}::${moduleName}::${functionName}' is not an view function`);\n }\n\n // Type tag parameters for the function\n const params: TypeTag[] = [];\n for (let i = 0; i < functionAbi.params.length; i += 1) {\n params.push(parseTypeTag(functionAbi.params[i], { allowGenerics: true }));\n }\n\n // The return types of the view function\n const returnTypes: TypeTag[] = [];\n for (let i = 0; i < functionAbi.return.length; i += 1) {\n returnTypes.push(parseTypeTag(functionAbi.return[i], { allowGenerics: true }));\n }\n\n return {\n typeParameters: functionAbi.generic_type_params,\n parameters: params,\n returnTypes,\n };\n}\n\n/**\n * Converts a entry function argument into CallArgument, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param argument - The argument to be converted, which can be of various types. If the argument is already\n * CallArgument returned from TransactionComposer it would be returned immediately.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertCallArgument(\n argument: CallArgument | EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n functionName: string,\n functionAbi: FunctionABI,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): CallArgument {\n if (argument instanceof CallArgument) {\n return argument;\n }\n return CallArgument.new_bytes(\n convertArgument(functionName, functionAbi, argument, position, genericTypeParams).bcsToBytes(),\n );\n}\n\n/**\n * Converts a non-BCS encoded argument into BCS encoded, if necessary.\n * This function checks the provided argument against the expected parameter type and converts it accordingly.\n *\n * @param functionName - The name of the function for which the argument is being converted.\n * @param functionAbi - The ABI (Application Binary Interface) of the function, which defines its parameters.\n * @param arg - The argument to be converted, which can be of various types.\n * @param position - The index of the argument in the function's parameter list.\n * @param genericTypeParams - An array of type tags for any generic type parameters.\n */\nexport function convertArgument(\n functionName: string,\n functionAbi: FunctionABI,\n arg: EntryFunctionArgumentTypes | SimpleEntryFunctionArgumentTypes,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // Ensure not too many arguments\n if (position >= functionAbi.parameters.length) {\n throw new Error(`Too many arguments for '${functionName}', expected ${functionAbi.parameters.length}`);\n }\n\n const param = functionAbi.parameters[position];\n return checkOrConvertArgument(arg, param, position, genericTypeParams);\n}\n\n/**\n * Checks if the provided argument is BCS encoded and converts it if necessary, ensuring type compatibility with the ABI.\n * This function helps in validating and converting arguments for entry functions based on their expected types.\n *\n * @param arg - The argument to check or convert, which can be either a simple or entry function argument type.\n * @param param - The expected type tag for the argument.\n * @param position - The position of the argument in the function call.\n * @param genericTypeParams - An array of generic type parameters that may be used for conversion.\n */\nexport function checkOrConvertArgument(\n arg: SimpleEntryFunctionArgumentTypes | EntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n) {\n // If the argument is bcs encoded, we can just use it directly\n if (isEncodedEntryFunctionArgument(arg)) {\n // Ensure the type matches the ABI\n\n /**\n * Checks the type of the provided argument against the expected type.\n * This function helps validate that the argument conforms to the specified type requirements.\n *\n * @param typeArgs - The expected type arguments.\n * @param arg - The argument to be checked.\n * @param position - The position of the argument in the context of the check.\n */\n checkType(param, arg, position);\n return arg;\n }\n\n // If it is not BCS encoded, we will need to convert it with the ABI\n return parseArg(arg, param, position, genericTypeParams);\n}\n\n/**\n * Parses a non-BCS encoded argument into a BCS encoded argument recursively.\n * This function helps convert various types of input arguments into their corresponding BCS encoded formats based on the\n * specified parameter type.\n *\n * @param arg - The argument to be parsed, which can be of various types.\n * @param param - The type tag that defines the expected type of the argument.\n * @param position - The position of the argument in the function call, used for error reporting.\n * @param genericTypeParams - An array of type tags for generic type parameters, used when the parameter type is generic.\n */\nfunction parseArg(\n arg: SimpleEntryFunctionArgumentTypes,\n param: TypeTag,\n position: number,\n genericTypeParams: Array<TypeTag>,\n): EntryFunctionArgumentTypes {\n if (param.isBool()) {\n if (isBool(arg)) {\n return new Bool(arg);\n }\n if (isString(arg)) {\n if (arg === \"true\") return new Bool(true);\n if (arg === \"false\") return new Bool(false);\n }\n\n /**\n * Throws a type mismatch error for the specified move option.\n *\n * @param moveOption - The name of the move option that caused the type mismatch.\n * @param position - The position where the error occurred.\n */\n throwTypeMismatch(\"boolean\", position);\n }\n // TODO: support uint8array?\n if (param.isAddress()) {\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n if (param.isU8()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U8(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU16()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U16(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU32()) {\n const num = convertNumber(arg);\n if (num !== undefined) {\n return new U32(num);\n }\n throwTypeMismatch(\"number | string\", position);\n }\n if (param.isU64()) {\n if (isLargeNumber(arg)) {\n return new U64(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU128()) {\n if (isLargeNumber(arg)) {\n return new U128(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n if (param.isU256()) {\n if (isLargeNumber(arg)) {\n return new U256(BigInt(arg));\n }\n throwTypeMismatch(\"bigint | number | string\", position);\n }\n\n // Generic needs to use the subtype\n if (param.isGeneric()) {\n const genericIndex = param.value;\n if (genericIndex < 0 || genericIndex >= genericTypeParams.length) {\n throw new Error(`Generic argument ${param.toString()} is invalid for argument ${position}`);\n }\n\n return checkOrConvertArgument(arg, genericTypeParams[genericIndex], position, genericTypeParams);\n }\n\n // We have to special case some vectors for Vector<u8>\n if (param.isVector()) {\n // Check special case for Vector<u8>\n if (param.value.isU8()) {\n // We don't allow vector<u8>, but we convert strings to UTF8 Uint8Array\n // This is legacy behavior from the original SDK\n if (isString(arg)) {\n return MoveVector.U8(TEXT_ENCODER.encode(arg));\n }\n if (arg instanceof Uint8Array) {\n return MoveVector.U8(arg);\n }\n if (arg instanceof ArrayBuffer) {\n return MoveVector.U8(new Uint8Array(arg));\n }\n }\n\n // TODO: Support Uint16Array, Uint32Array, BigUint64Array?\n\n if (Array.isArray(arg)) {\n return new MoveVector(arg.map((item) => checkOrConvertArgument(item, param.value, position, genericTypeParams)));\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n }\n\n // Handle structs as they're more complex\n if (param.isStruct()) {\n if (param.isString()) {\n if (isString(arg)) {\n return new MoveString(arg);\n }\n throwTypeMismatch(\"string\", position);\n }\n if (param.isObject()) {\n // The inner type of Object doesn't matter, since it's just syntactic sugar\n if (isString(arg)) {\n return AccountAddress.fromString(arg);\n }\n throwTypeMismatch(\"string | AccountAddress\", position);\n }\n\n if (param.isOption()) {\n if (isEmptyOption(arg)) {\n // Here we attempt to reconstruct the underlying type\n // Note, for some reason the `isBool` etc. does not work with the compiler\n const innerParam = param.value.typeArgs[0];\n if (innerParam instanceof TypeTagBool) {\n return new MoveOption<Bool>(null);\n }\n if (innerParam instanceof TypeTagAddress) {\n return new MoveOption<AccountAddress>(null);\n }\n if (innerParam instanceof TypeTagU8) {\n return new MoveOption<U8>(null);\n }\n if (innerParam instanceof TypeTagU16) {\n return new MoveOption<U16>(null);\n }\n if (innerParam instanceof TypeTagU32) {\n return new MoveOption<U32>(null);\n }\n if (innerParam instanceof TypeTagU64) {\n return new MoveOption<U64>(null);\n }\n if (innerParam instanceof TypeTagU128) {\n return new MoveOption<U128>(null);\n }\n if (innerParam instanceof TypeTagU256) {\n return new MoveOption<U256>(null);\n }\n\n // In all other cases, we will use a placeholder, it doesn't actually matter what the type is, but it will be obvious\n // Note: This is a placeholder U8 type, and does not match the actual type, as that can't be dynamically grabbed\n return new MoveOption<MoveString>(null);\n }\n\n return new MoveOption(checkOrConvertArgument(arg, param.value.typeArgs[0], position, genericTypeParams));\n }\n\n throw new Error(`Unsupported struct input type for argument ${position}, type '${param.toString()}'`);\n }\n\n throw new Error(`Type mismatch for argument ${position}, type '${param.toString()}'`);\n}\n\n/**\n * Checks that the type of the BCS encoded argument matches the ABI\n * @param param\n * @param arg\n * @param position\n */\nfunction checkType(param: TypeTag, arg: EntryFunctionArgumentTypes, position: number) {\n if (param.isBool()) {\n if (isBcsBool(arg)) {\n return;\n }\n throwTypeMismatch(\"Bool\", position);\n }\n if (param.isAddress()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isU8()) {\n if (isBcsU8(arg)) {\n return;\n }\n throwTypeMismatch(\"U8\", position);\n }\n if (param.isU16()) {\n if (isBcsU16(arg)) {\n return;\n }\n throwTypeMismatch(\"U16\", position);\n }\n if (param.isU32()) {\n if (isBcsU32(arg)) {\n return;\n }\n throwTypeMismatch(\"U32\", position);\n }\n if (param.isU64()) {\n if (isBcsU64(arg)) {\n return;\n }\n throwTypeMismatch(\"U64\", position);\n }\n if (param.isU128()) {\n if (isBcsU128(arg)) {\n return;\n }\n throwTypeMismatch(\"U128\", position);\n }\n if (param.isU256()) {\n if (isBcsU256(arg)) {\n return;\n }\n throwTypeMismatch(\"U256\", position);\n }\n if (param.isVector()) {\n if (arg instanceof MoveVector) {\n // If there's anything in it, check that the inner types match\n // Note that since it's typed, the first item should be the same as the rest\n if (arg.values.length > 0) {\n checkType(param.value, arg.values[0], position);\n }\n\n return;\n }\n throwTypeMismatch(\"MoveVector\", position);\n }\n\n // Handle structs as they're more complex\n if (param instanceof TypeTagStruct) {\n if (param.isString()) {\n if (isBcsString(arg)) {\n return;\n }\n throwTypeMismatch(\"MoveString\", position);\n }\n if (param.isObject()) {\n if (isBcsAddress(arg)) {\n return;\n }\n throwTypeMismatch(\"AccountAddress\", position);\n }\n if (param.isOption()) {\n if (arg instanceof MoveOption) {\n // If there's a value, we can check the inner type (otherwise it doesn't really matter)\n if (arg.value !== undefined) {\n checkType(param.value.typeArgs[0], arg.value, position);\n }\n return;\n }\n throwTypeMismatch(\"MoveOption\", position);\n }\n }\n\n throw new Error(`Type mismatch for argument ${position}, expected '${param.toString()}'`);\n}\n"],"mappings":"wiBAiDA,IAAMA,EAAe,IAAI,YAQlB,SAASC,GAAoBC,EAAqD,CACvF,OACEA,GAAe,IAAKC,GAEdC,EAASD,CAAO,EACXE,EAAaF,CAAO,EAEtBA,CACR,GAAK,CAAC,CAEX,CAWA,eAAsBG,EACpBC,EACAC,EACAC,EACAC,EACmC,CAEnC,IAA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ACA,GAAIK,EAAM,MAAM,EAAG,CACjB,GAAIsC,EAASvC,CAAG,EACd,OAEFQ,EAAkB,MAAOZ,CAAQ,CACnC,CACA,GAAIK,EAAM,OAAO,EAAG,CAClB,GAAIuC,EAAUxC,CAAG,EACf,OAEFQ,EAAkB,OAAQZ,CAAQ,CACpC,CACA,GAAIK,EAAM,OAAO,EAAG,CAClB,GAAIwC,EAAUzC,CAAG,EACf,OAEFQ,EAAkB,OAAQZ,CAAQ,CACpC,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAeoB,EAAY,CAGzBpB,EAAI,OAAO,OAAS,GACtBI,EAAUH,EAAM,MAAOD,EAAI,OAAO,CAAC,EAAGJ,CAAQ,EAGhD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CAGA,GAAIK,aAAiByC,EAAe,CAClC,GAAIzC,EAAM,SAAS,EAAG,CACpB,GAAI0C,EAAY3C,CAAG,EACjB,OAEFQ,EAAkB,aAAcZ,CAAQ,CAC1C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAIkC,EAAanC,CAAG,EAClB,OAEFQ,EAAkB,iBAAkBZ,CAAQ,CAC9C,CACA,GAAIK,EAAM,SAAS,EAAG,CACpB,GAAID,aAAe0B,EAAY,CAEzB1B,EAAI,QAAU,QAChBI,EAAUH,EAAM,MAAM,SAAS,CAAC,EAAGD,EAAI,MAAOJ,CAAQ,EAExD,MACF,CACAY,EAAkB,aAAcZ,CAAQ,CAC1C,CACF,CAEA,MAAM,IAAI,MAAM,8BAA8BA,CAAQ,eAAeK,EAAM,SAAS,CAAC,GAAG,CAC1F","names":["TEXT_ENCODER","standardizeTypeTags","typeArguments","typeArg","isString","parseTypeTag","fetchFunctionAbi","moduleAddress","moduleName","functionName","aptosConfig","module","getModule","func","fetchMoveFunctionAbi","functionAbi","params","i","fetchEntryFunctionAbi","numSigners","findFirstNonSignerArg","fetchViewFunctionAbi","returnTypes","convertCallArgument","argument","position","genericTypeParams","CallArgument","convertArgument","arg","param","checkOrConvertArgument","isEncodedEntryFunctionArgument","checkType","parseArg","isBool","Bool","throwTypeMismatch","AccountAddress","num","convertNumber","U8","U16","U32","isLargeNumber","U64","U128","U256","genericIndex","MoveVector","item","MoveString","isEmptyOption","innerParam","TypeTagBool","MoveOption","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","isBcsBool","isBcsAddress","isBcsU8","isBcsU16","isBcsU32","isBcsU64","isBcsU128","isBcsU256","TypeTagStruct","isBcsString"]}
@@ -0,0 +1,2 @@
1
+ import{b as g}from"./chunk-H457BI3I.mjs";import{e as a}from"./chunk-YZ3YPLEU.mjs";import{a as m,b as u}from"./chunk-BLLHTGAP.mjs";import{b as y}from"./chunk-JNO7KPMG.mjs";var p=class l{constructor(e){let{multiKey:s,signers:i,address:r}=e;this.publicKey=s,this.signingScheme=3,this.accountAddress=r?y.from(r):this.publicKey.authKey().derivedAddress();let t=[];for(let n of i)t.push(this.publicKey.getIndex(n.publicKey));let c=i.map((n,o)=>[n,t[o]]);c.sort((n,o)=>n[1]-o[1]),this.signers=c.map(n=>n[0]),this.signerIndicies=c.map(n=>n[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:t})}static fromPublicKeysAndSigners(e){let{publicKeys:s,signaturesRequired:i,signers:r}=e,t=new m({publicKeys:s,signaturesRequired:i});return new l({multiKey:t,signers:r})}static isMultiKeySigner(e){return e instanceof l}signWithAuthenticator(e){return new a(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new a(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let s=this.signers.filter(i=>i instanceof g).map(async i=>i.waitForProofFetch());await Promise.all(s)}async checkKeylessAccountValidity(e){let i=this.signers.filter(r=>r instanceof g).map(r=>r.checkKeylessAccountValidity(e));await Promise.all(i)}sign(e){let s=[];for(let i of this.signers)s.push(i.sign(e));return new u({signatures:s,bitmap:this.signaturesBitmap})}signTransaction(e){let s=[];for(let i of this.signers)s.push(i.signTransaction(e));return new u({signatures:s,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:s,signature:i}=e;if(!this.signerIndicies.every((t,c)=>c===0||t>=this.signerIndicies[c-1]))return!1;for(let t=0;t<i.signatures.length;t+=1){let c=i.signatures[t];if(!this.publicKey.publicKeys[this.signerIndicies[t]].verifySignature({message:s,signature:c}))return!1}return!0}};export{p as a};
2
+ //# sourceMappingURL=chunk-GBVRCWCD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/MultiKeyAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./Account\";\nimport { MultiKey, MultiKeySignature, PublicKey } from \"../core/crypto\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAuthenticatorMultiKey } from \"../transactions/authenticator/account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { AbstractKeylessAccount, KeylessSigner } from \"./AbstractKeylessAccount\";\nimport { AptosConfig } from \"../api/aptosConfig\";\n\n/**\n * Arguments required to verify a multi-key signature against a given message.\n *\n * @param message - The original message that was signed.\n * @param signature - The multi-key signature to be verified.\n */\nexport interface VerifyMultiKeySignatureArgs {\n message: HexInput;\n signature: MultiKeySignature;\n}\n\n/**\n * Signer implementation for the MultiKey authentication scheme.\n *\n * This account utilizes an M of N signing scheme, where M and N are specified in the {@link MultiKey}.\n * It signs messages using an array of M accounts, each corresponding to a public key in the {@link MultiKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class MultiKeyAccount implements Account, KeylessSigner {\n /**\n * Public key associated with the account\n */\n readonly publicKey: MultiKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The signers used to sign messages. These signers should correspond to public keys in the\n * MultiKeyAccount's public key. The number of signers should be equal or greater\n * than this.publicKey.signaturesRequired\n */\n readonly signers: Account[];\n\n /**\n * An array of indices where for signer[i], signerIndicies[i] is the index of the corresponding public key in\n * publicKey.publicKeys. Used to derive the right public key to use for verification.\n */\n // TODO: Rename Indicies to Indices\n readonly signerIndicies: number[];\n\n readonly signaturesBitmap: Uint8Array;\n\n /**\n * Constructs a MultiKeyAccount instance, which requires multiple signatures for transactions.\n *\n * @param args - The arguments for creating a MultiKeyAccount.\n * @param args.multiKey - The multikey of the account consisting of N public keys and a number M representing the required signatures.\n * @param args.signers - An array of M signers that will be used to sign the transaction.\n * @param args.address - An optional account address input. If not provided, the derived address from the public key will be used.\n */\n constructor(args: { multiKey: MultiKey; signers: Account[]; address?: AccountAddressInput }) {\n const { multiKey, signers, address } = args;\n\n this.publicKey = multiKey;\n this.signingScheme = SigningScheme.MultiKey;\n\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n\n // Get the index of each respective signer in the bitmap\n const bitPositions: number[] = [];\n for (const signer of signers) {\n bitPositions.push(this.publicKey.getIndex(signer.publicKey));\n }\n // Zip signers and bit positions and sort signers by bit positions in order\n // to ensure the signature is signed in ascending order according to the bitmap.\n // Authentication on chain will fail otherwise.\n const signersAndBitPosition: [Account, number][] = signers.map((signer, index) => [signer, bitPositions[index]]);\n signersAndBitPosition.sort((a, b) => a[1] - b[1]);\n this.signers = signersAndBitPosition.map((value) => value[0]);\n this.signerIndicies = signersAndBitPosition.map((value) => value[1]);\n this.signaturesBitmap = this.publicKey.createBitmap({ bits: bitPositions });\n }\n\n /**\n * Static constructor to create a MultiKeyAccount using the provided public keys and signers.\n *\n * @param args - The arguments for creating a MultiKeyAccount.\n * @param args.publicKeys - The N public keys of the MultiKeyAccount.\n * @param args.signaturesRequired - The number of signatures required to authorize a transaction.\n * @param args.signers - An array of M signers that will be used to sign the transaction.\n * @returns MultiKeyAccount - The newly created MultiKeyAccount.\n */\n static fromPublicKeysAndSigners(args: {\n publicKeys: PublicKey[];\n signaturesRequired: number;\n signers: Account[];\n }): MultiKeyAccount {\n const { publicKeys, signaturesRequired, signers } = args;\n const multiKey = new MultiKey({ publicKeys, signaturesRequired });\n return new MultiKeyAccount({ multiKey, signers });\n }\n\n /**\n * Determines if the provided account is a multi-key account.\n *\n * @param account - The account to check.\n * @returns A boolean indicating whether the account is a multi-key account.\n */\n static isMultiKeySigner(account: Account): account is MultiKeyAccount {\n return account instanceof MultiKeyAccount;\n }\n\n /**\n * Sign a message using the account's signers 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 AccountAuthenticatorMultiKey that includes the signature and the public key.\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.sign(message));\n }\n\n /**\n * Sign a transaction using the account's signers, returning an AccountAuthenticator that contains the signature and the\n * account's public key.\n * @param transaction - The raw transaction to be signed.\n * @returns An AccountAuthenticatorMultiKey containing the signature of the transaction along with the account's public key.\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorMultiKey {\n return new AccountAuthenticatorMultiKey(this.publicKey, this.signTransaction(transaction));\n }\n\n /**\n * Waits for any proofs on KeylessAccount signers to be fetched. This ensures that signing with the KeylessAccount does not\n * fail due to missing proofs.\n * @return {Promise<void>} A promise that resolves when all proofs have been fetched.\n */\n async waitForProofFetch(): Promise<void> {\n const keylessSigners = this.signers.filter(\n (signer) => signer instanceof AbstractKeylessAccount,\n ) as AbstractKeylessAccount[];\n const promises = keylessSigners.map(async (signer) => signer.waitForProofFetch());\n await Promise.all(promises);\n }\n\n /**\n * Validates that the Keyless Account can be used to sign transactions.\n * @return\n */\n async checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise<void> {\n const keylessSigners = this.signers.filter(\n (signer) => signer instanceof AbstractKeylessAccount,\n ) as AbstractKeylessAccount[];\n const promises = keylessSigners.map((signer) => signer.checkKeylessAccountValidity(aptosConfig));\n await Promise.all(promises);\n }\n\n /**\n * Sign the given message using the MultiKeyAccount's signers\n * @param message in HexInput format\n * @returns MultiKeySignature\n */\n sign(data: HexInput): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.sign(data));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Sign the given transaction using the MultiKeyAccount's signers.\n * This function aggregates signatures from all signers associated with the MultiKeyAccount.\n *\n * @param transaction - The transaction to be signed.\n * @returns MultiKeySignature - An object containing the aggregated signatures and a bitmap of the signatures.\n */\n signTransaction(transaction: AnyRawTransaction): MultiKeySignature {\n const signatures = [];\n for (const signer of this.signers) {\n signatures.push(signer.signTransaction(transaction));\n }\n return new MultiKeySignature({ signatures, bitmap: this.signaturesBitmap });\n }\n\n /**\n * Verify the given message and signature with the public keys.\n *\n * This function checks if the provided signatures are valid for the given message using the corresponding public keys.\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 MultiKeySignature containing multiple signatures.\n * @returns A boolean indicating whether the signatures are valid for the message.\n */\n verifySignature(args: VerifyMultiKeySignatureArgs): boolean {\n const { message, signature } = args;\n const isSignerIndicesSorted = this.signerIndicies.every(\n (value, i) => i === 0 || value >= this.signerIndicies[i - 1],\n );\n if (!isSignerIndicesSorted) {\n return false;\n }\n for (let i = 0; i < signature.signatures.length; i += 1) {\n const singleSignature = signature.signatures[i];\n const publicKey = this.publicKey.publicKeys[this.signerIndicies[i]];\n if (!publicKey.verifySignature({ message, signature: singleSignature })) {\n return false;\n }\n }\n return true;\n }\n}\n"],"mappings":"2KA+BO,IAAMA,EAAN,MAAMC,CAAkD,CAwC7D,YAAYC,EAAiF,CAC3F,GAAM,CAAE,SAAAC,EAAU,QAAAC,EAAS,QAAAC,CAAQ,EAAIH,EAEvC,KAAK,UAAYC,EACjB,KAAK,cAAgB,EAErB,KAAK,eAAiBE,EAAUC,EAAe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AAK,QAAQ,OACjCb,GAAWA,aAAkBc,CAChC,EACgC,IAAKd,GAAWA,EAAO,4BAA4Be,CAAW,CAAC,EAC/F,MAAM,QAAQ,IAAIF,CAAQ,CAC5B,CAOA,KAAKG,EAAmC,CACtC,IAAMC,EAAa,CAAC,EACpB,QAAWjB,KAAU,KAAK,QACxBiB,EAAW,KAAKjB,EAAO,KAAKgB,CAAI,CAAC,EAEnC,OAAO,IAAIE,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CASA,gBAAgBL,EAAmD,CACjE,IAAMK,EAAa,CAAC,EACpB,QAAWjB,KAAU,KAAK,QACxBiB,EAAW,KAAKjB,EAAO,gBAAgBY,CAAW,CAAC,EAErD,OAAO,IAAIM,EAAkB,CAAE,WAAAD,EAAY,OAAQ,KAAK,gBAAiB,CAAC,CAC5E,CAYA,gBAAgBvB,EAA4C,CAC1D,GAAM,CAAE,QAAAgB,EAAS,UAAAS,CAAU,EAAIzB,EAI/B,GAAI,CAH0B,KAAK,eAAe,MAChD,CAACW,EAAOe,IAAMA,IAAM,GAAKf,GAAS,KAAK,eAAee,EAAI,CAAC,CAC7D,EAEE,MAAO,GAET,QAASA,EAAI,EAAGA,EAAID,EAAU,WAAW,OAAQC,GAAK,EAAG,CACvD,IAAMC,EAAkBF,EAAU,WAAWC,CAAC,EAE9C,GAAI,CADc,KAAK,UAAU,WAAW,KAAK,eAAeA,CAAC,CAAC,EACnD,gBAAgB,CAAE,QAAAV,EAAS,UAAWW,CAAgB,CAAC,EACpE,MAAO,EAEX,CACA,MAAO,EACT,CACF","names":["MultiKeyAccount","_MultiKeyAccount","args","multiKey","signers","address","AccountAddress","bitPositions","signer","signersAndBitPosition","index","a","b","value","publicKeys","signaturesRequired","MultiKey","account","message","AccountAuthenticatorMultiKey","transaction","promises","AbstractKeylessAccount","aptosConfig","data","signatures","MultiKeySignature","signature","i","singleSignature"]}
@@ -0,0 +1,2 @@
1
+ import{a as O,b as _}from"./chunk-FXUI3SSD.mjs";import{d as E}from"./chunk-YZ3YPLEU.mjs";import{a as R}from"./chunk-7WXDXBXK.mjs";import{a as P,b as w}from"./chunk-LAAFLCDM.mjs";import{a as I}from"./chunk-YPBNYKOD.mjs";import{i as T,j as b,k as x,n as g,q as v,s as k}from"./chunk-XUP6VABV.mjs";import{b as m}from"./chunk-JNO7KPMG.mjs";import{d as r}from"./chunk-F45G3GP3.mjs";import{a as K}from"./chunk-AJ5JHBAE.mjs";import{b as h}from"./chunk-SPRNSFUV.mjs";import{e as F}from"./chunk-V4FKFCBL.mjs";import C from"eventemitter3";import{jwtDecode as D}from"jwt-decode";function se(f){return f!=null&&typeof f.checkKeylessAccountValidity=="function"}var p=class p extends K{constructor(e){super();let{address:i,ephemeralKeyPair:t,publicKey:o,uidKey:y,uidVal:n,aud:c,pepper:s,proof:a,proofFetchCallback:l,jwt:d,verificationKeyHash:u}=e;if(this.ephemeralKeyPair=t,this.publicKey=o,this.accountAddress=i?m.from(i):this.publicKey.authKey().derivedAddress(),this.uidKey=y,this.uidVal=n,this.aud=c,this.jwt=d,this.emitter=new C,this.proofOrPromise=a,a instanceof g)this.proof=a;else{if(l===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async N=>{await l(N),this.emitter.removeAllListeners()}),this.init(a)}this.signingScheme=2;let S=h.fromHexInput(s).toUint8Array();if(S.length!==p.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${p.PEPPER_LENGTH}`);if(this.pepper=S,u!==void 0){if(h.hexInputToUint8Array(u).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=h.hexInputToUint8Array(u)}}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(i){i instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:i.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(this.accountAddress.serialize(e),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),e.serializeOption(this.verificationKeyHash,32)}static partialDeserialize(e){let i=m.deserialize(e),t=e.deserializeStr(),o=e.deserializeStr(),y=e.deserializeFixedBytes(31),n=R.deserialize(e),c=g.deserialize(e),s=e.deserializeOption("fixedBytes",32);return{address:i,jwt:t,uidKey:o,pepper:y,ephemeralKeyPair:n,proof:c,verificationKeyHash:s}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let i=new w(this.sign(e)),t=new P(this.publicKey);return new E(t,i)}signTransactionWithAuthenticator(e){let i=new w(this.signTransaction(e)),t=new P(this.publicKey);return new E(t,i)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(e){if(this.isExpired())throw r.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw r.fromErrorType({type:2});let i=D(this.jwt,{header:!0});if(i.kid===void 0)throw r.fromErrorType({type:12,details:"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen."});if(this.verificationKeyHash!==void 0){let{verificationKey:t}=await v({aptosConfig:e});if(h.hexInputToString(t.hash())!==h.hexInputToString(this.verificationKeyHash))throw r.fromErrorType({type:4})}else console.warn("[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.");await p.fetchJWK({aptosConfig:e,publicKey:this.publicKey,kid:i.kid})}sign(e){let{expiryDateSecs:i}=this.ephemeralKeyPair;if(this.isExpired())throw r.fromErrorType({type:0});if(this.proof===void 0)throw r.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let t=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new b({jwtHeader:F(this.jwt.split(".")[0]),ephemeralCertificate:new x(this.proof,0),expiryDateSecs:i,ephemeralPublicKey:t,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw r.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let i=O(e),o=new A(i,this.proof.proof).hash();return this.sign(o)}verifySignature(e){let{message:i,signature:t}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:i,signature:t.ephemeralSignature}))}static async fetchJWK(e){let{aptosConfig:i,publicKey:t,kid:o}=e,y=t instanceof T?t:t.keylessPublicKey,{iss:n}=y,c,s=t instanceof I?t.jwkAddress:void 0;try{c=await k({aptosConfig:i,jwkAddr:s})}catch(d){throw r.fromErrorType({type:24,error:d,details:`Failed to fetch ${s?"Federated":"Patched"}JWKs ${s?`for address ${s}`:"0x1"}`})}let a=c.get(n);if(a===void 0)throw r.fromErrorType({type:7,details:`JWKs for issuer ${n} not found.`});let l=a.find(d=>d.kid===o);if(l===void 0)throw r.fromErrorType({type:6,details:`JWK with kid '${o}' for issuer '${n}' not found.`});return l}};p.PEPPER_LENGTH=31;var H=p,A=class extends K{constructor(i,t){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=i,this.proof=t}serialize(i){i.serializeFixedBytes(this.transaction.bcsToBytes()),i.serializeOption(this.proof)}hash(){return _(this.bcsToBytes(),this.domainSeparator)}};export{se as a,H as b,A as c};
2
+ //# sourceMappingURL=chunk-H457BI3I.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/AbstractKeylessAccount.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport EventEmitter from \"eventemitter3\";\nimport { jwtDecode } from \"jwt-decode\";\nimport { EphemeralCertificateVariant, HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress } from \"../core/accountAddress\";\nimport {\n AnyPublicKey,\n AnySignature,\n KeylessPublicKey,\n KeylessSignature,\n EphemeralCertificate,\n ZeroKnowledgeSig,\n ZkProof,\n getKeylessJWKs,\n MoveJWK,\n getKeylessConfig,\n} from \"../core/crypto\";\n\nimport { EphemeralKeyPair } from \"./EphemeralKeyPair\";\nimport { Hex } from \"../core/hex\";\nimport { AccountAuthenticatorSingleKey } from \"../transactions/authenticator/account\";\nimport { Deserializer, Serializable, Serializer } from \"../bcs\";\nimport { deriveTransactionType, generateSigningMessage } from \"../transactions/transactionBuilder/signingMessage\";\nimport { AnyRawTransaction, AnyRawTransactionInstance } from \"../transactions/types\";\nimport { base64UrlDecode } from \"../utils/helpers\";\nimport { FederatedKeylessPublicKey } from \"../core/crypto/federatedKeyless\";\nimport { Account } from \"./Account\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { KeylessError, KeylessErrorType } from \"../errors\";\n\n/**\n * An interface which defines if an Account utilizes Keyless signing.\n */\nexport interface KeylessSigner extends Account {\n checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise<void>;\n}\n\nexport function isKeylessSigner(obj: any): obj is KeylessSigner {\n return obj !== null && obj !== undefined && typeof obj.checkKeylessAccountValidity === \"function\";\n}\n\n/**\n * Account implementation for the Keyless authentication scheme. This abstract class is used for standard Keyless Accounts\n * and Federated Keyless Accounts.\n */\nexport abstract class AbstractKeylessAccount extends Serializable implements KeylessSigner {\n static readonly PEPPER_LENGTH: number = 31;\n\n /**\n * The KeylessPublicKey associated with the account\n */\n readonly publicKey: KeylessPublicKey | FederatedKeylessPublicKey;\n\n /**\n * The EphemeralKeyPair used to generate sign.\n */\n readonly ephemeralKeyPair: EphemeralKeyPair;\n\n /**\n * The claim on the JWT to identify a user. This is typically 'sub' or 'email'.\n */\n readonly uidKey: string;\n\n /**\n * The value of the uidKey claim on the JWT. This intended to be a stable user identifier.\n */\n readonly uidVal: string;\n\n /**\n * The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's\n * OIDC registration with the identity provider.\n */\n readonly aud: string;\n\n /**\n * A value contains 31 bytes of entropy that preserves privacy of the account. Typically fetched from a pepper provider.\n */\n readonly pepper: Uint8Array;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * The zero knowledge signature (if ready) which contains the proof used to validate the EphemeralKeyPair.\n */\n proof: ZeroKnowledgeSig | undefined;\n\n /**\n * The proof of the EphemeralKeyPair or a promise that provides the proof. This is used to allow for awaiting on\n * fetching the proof.\n */\n readonly proofOrPromise: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * The JWT token used to derive the account\n */\n readonly jwt: string;\n\n /**\n * The hash of the verification key used to verify the proof. This is optional and can be used to check verifying key\n * rotations which may invalidate the proof.\n */\n readonly verificationKeyHash?: Uint8Array;\n\n /**\n * An event emitter used to assist in handling asynchronous proof fetching.\n */\n private readonly emitter: EventEmitter<ProofFetchEvents>;\n\n /**\n * Use the static generator `create(...)` instead.\n * Creates an instance of the KeylessAccount with an optional proof.\n *\n * @param args - The parameters for creating a KeylessAccount.\n * @param args.address - Optional account address associated with the KeylessAccount.\n * @param args.publicKey - A KeylessPublicKey or FederatedKeylessPublicKey.\n * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation.\n * @param args.iss - A JWT issuer.\n * @param args.uidKey - The claim on the JWT to identify a user. This is typically 'sub' or 'email'.\n * @param args.uidVal - The unique id for this user, intended to be a stable user identifier.\n * @param args.aud - The value of the 'aud' claim on the JWT, also known as client ID. This is the identifier for the dApp's\n * OIDC registration with the identity provider.\n * @param args.pepper - A hexadecimal input used for additional security.\n * @param args.proof - A Zero Knowledge Signature or a promise that resolves to one.\n * @param args.proofFetchCallback - Optional callback function for fetching proof.\n * @param args.jwt - A JSON Web Token used for authentication.\n * @param args.verificationKeyHash Optional 32-byte verification key hash as hex input used to check proof validity.\n */\n protected constructor(args: {\n address?: AccountAddress;\n publicKey: KeylessPublicKey | FederatedKeylessPublicKey;\n ephemeralKeyPair: EphemeralKeyPair;\n iss: string;\n uidKey: string;\n uidVal: string;\n aud: string;\n pepper: HexInput;\n proof: ZeroKnowledgeSig | Promise<ZeroKnowledgeSig>;\n proofFetchCallback?: ProofFetchCallback;\n jwt: string;\n verificationKeyHash?: HexInput;\n }) {\n super();\n const {\n address,\n ephemeralKeyPair,\n publicKey,\n uidKey,\n uidVal,\n aud,\n pepper,\n proof,\n proofFetchCallback,\n jwt,\n verificationKeyHash,\n } = args;\n this.ephemeralKeyPair = ephemeralKeyPair;\n this.publicKey = publicKey;\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n this.uidKey = uidKey;\n this.uidVal = uidVal;\n this.aud = aud;\n this.jwt = jwt;\n this.emitter = new EventEmitter<ProofFetchEvents>();\n this.proofOrPromise = proof;\n if (proof instanceof ZeroKnowledgeSig) {\n this.proof = proof;\n } else {\n if (proofFetchCallback === undefined) {\n throw new Error(\"Must provide callback for async proof fetch\");\n }\n this.emitter.on(\"proofFetchFinish\", async (status) => {\n await proofFetchCallback(status);\n this.emitter.removeAllListeners();\n });\n // Note, this is purposely not awaited to be non-blocking. The caller should await on the proofFetchCallback.\n this.init(proof);\n }\n this.signingScheme = SigningScheme.SingleKey;\n const pepperBytes = Hex.fromHexInput(pepper).toUint8Array();\n if (pepperBytes.length !== AbstractKeylessAccount.PEPPER_LENGTH) {\n throw new Error(`Pepper length in bytes should be ${AbstractKeylessAccount.PEPPER_LENGTH}`);\n }\n this.pepper = pepperBytes;\n if (verificationKeyHash !== undefined) {\n if (Hex.hexInputToUint8Array(verificationKeyHash).length !== 32) {\n throw new Error(\"verificationKeyHash must be 32 bytes\");\n }\n this.verificationKeyHash = Hex.hexInputToUint8Array(verificationKeyHash);\n }\n }\n\n /**\n * This initializes the asynchronous proof fetch.\n * @return Emits whether the proof succeeds or fails, but has no return.\n */\n async init(promise: Promise<ZeroKnowledgeSig>) {\n try {\n this.proof = await promise;\n this.emitter.emit(\"proofFetchFinish\", { status: \"Success\" });\n } catch (error) {\n if (error instanceof Error) {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: error.toString() });\n } else {\n this.emitter.emit(\"proofFetchFinish\", { status: \"Failed\", error: \"Unknown\" });\n }\n }\n }\n\n /**\n * Serializes the jwt data into a format suitable for transmission or storage.\n * This function ensures that both the jwt data and the proof are properly serialized.\n *\n * @param serializer - The serializer instance used to convert the jwt data into bytes.\n */\n serialize(serializer: Serializer): void {\n this.accountAddress.serialize(serializer);\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 serializer.serializeOption(this.verificationKeyHash, 32);\n }\n\n static partialDeserialize(deserializer: Deserializer): {\n address: AccountAddress;\n jwt: string;\n uidKey: string;\n pepper: Uint8Array;\n ephemeralKeyPair: EphemeralKeyPair;\n proof: ZeroKnowledgeSig;\n verificationKeyHash?: Uint8Array;\n } {\n const address = AccountAddress.deserialize(deserializer);\n const jwt = deserializer.deserializeStr();\n const uidKey = deserializer.deserializeStr();\n const pepper = deserializer.deserializeFixedBytes(31);\n const ephemeralKeyPair = EphemeralKeyPair.deserialize(deserializer);\n const proof = ZeroKnowledgeSig.deserialize(deserializer);\n const verificationKeyHash = deserializer.deserializeOption(\"fixedBytes\", 32);\n\n return { address, jwt, uidKey, pepper, ephemeralKeyPair, proof, verificationKeyHash };\n }\n\n /**\n * Checks if the proof is expired. If so the account must be re-derived with a new EphemeralKeyPair\n * and JWT token.\n * @return boolean\n */\n isExpired(): boolean {\n return this.ephemeralKeyPair.isExpired();\n }\n\n /**\n * Sign a message using Keyless.\n * @param message the message to sign, as binary input\n * @return the AccountAuthenticator containing the signature, together with the account's public key\n */\n signWithAuthenticator(message: HexInput): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.sign(message));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Sign a transaction using Keyless.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature of the transaction, together with the account's public key\n */\n signTransactionWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticatorSingleKey {\n const signature = new AnySignature(this.signTransaction(transaction));\n const publicKey = new AnyPublicKey(this.publicKey);\n return new AccountAuthenticatorSingleKey(publicKey, signature);\n }\n\n /**\n * Waits for asynchronous proof fetching to finish.\n * @return\n */\n async waitForProofFetch() {\n if (this.proofOrPromise instanceof Promise) {\n await this.proofOrPromise;\n }\n }\n\n /**\n * Validates that the Keyless Account can be used to sign transactions.\n * @return\n */\n async checkKeylessAccountValidity(aptosConfig: AptosConfig): Promise<void> {\n if (this.isExpired()) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.EPHEMERAL_KEY_PAIR_EXPIRED,\n });\n }\n await this.waitForProofFetch();\n if (this.proof === undefined) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.ASYNC_PROOF_FETCH_FAILED,\n });\n }\n const header = jwtDecode(this.jwt, { header: true });\n if (header.kid === undefined) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.JWT_PARSING_ERROR,\n details: \"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen.\",\n });\n }\n if (this.verificationKeyHash !== undefined) {\n const { verificationKey } = await getKeylessConfig({ aptosConfig });\n if (Hex.hexInputToString(verificationKey.hash()) !== Hex.hexInputToString(this.verificationKeyHash)) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND,\n });\n }\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n \"[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.\",\n );\n }\n await AbstractKeylessAccount.fetchJWK({ aptosConfig, publicKey: this.publicKey, kid: header.kid });\n }\n\n /**\n * Sign the given message using Keyless.\n * @param message in HexInput format\n * @returns Signature\n */\n sign(message: HexInput): KeylessSignature {\n const { expiryDateSecs } = this.ephemeralKeyPair;\n if (this.isExpired()) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.EPHEMERAL_KEY_PAIR_EXPIRED,\n });\n }\n if (this.proof === undefined) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.PROOF_NOT_FOUND,\n details: \"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing.\",\n });\n }\n const ephemeralPublicKey = this.ephemeralKeyPair.getPublicKey();\n const ephemeralSignature = this.ephemeralKeyPair.sign(message);\n\n return new KeylessSignature({\n jwtHeader: base64UrlDecode(this.jwt.split(\".\")[0]),\n ephemeralCertificate: new EphemeralCertificate(this.proof, EphemeralCertificateVariant.ZkProof),\n expiryDateSecs,\n ephemeralPublicKey,\n ephemeralSignature,\n });\n }\n\n /**\n * Sign the given transaction with Keyless.\n * Signs the transaction and proof to guard against proof malleability.\n * @param transaction the transaction to be signed\n * @returns KeylessSignature\n */\n signTransaction(transaction: AnyRawTransaction): KeylessSignature {\n if (this.proof === undefined) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.PROOF_NOT_FOUND,\n details: \"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing.\",\n });\n }\n const raw = deriveTransactionType(transaction);\n const txnAndProof = new TransactionAndProof(raw, this.proof.proof);\n const signMess = txnAndProof.hash();\n return this.sign(signMess);\n }\n\n /**\n * Note - This function is currently incomplete and should only be used to verify ownership of the KeylessAccount\n *\n * Verifies a signature given the message.\n *\n * TODO: Groth16 proof verification\n *\n * @param args.message the message that was signed.\n * @param args.signature the KeylessSignature to verify\n * @returns boolean\n */\n verifySignature(args: { message: HexInput; signature: KeylessSignature }): boolean {\n const { message, signature } = args;\n if (this.isExpired()) {\n return false;\n }\n if (!this.ephemeralKeyPair.getPublicKey().verifySignature({ message, signature: signature.ephemeralSignature })) {\n return false;\n }\n return true;\n }\n\n /**\n * Fetches the JWK from the issuer's well-known JWKS endpoint.\n *\n * @param args.publicKey The keyless public key to query\n * @param args.kid The kid of the JWK to fetch\n * @returns A JWK matching the `kid` in the JWT header.\n * @throws {KeylessError} If the JWK cannot be fetched\n */\n static async fetchJWK(args: {\n aptosConfig: AptosConfig;\n publicKey: KeylessPublicKey | FederatedKeylessPublicKey;\n kid: string;\n }): Promise<MoveJWK> {\n const { aptosConfig, publicKey, kid } = args;\n const keylessPubKey = publicKey instanceof KeylessPublicKey ? publicKey : publicKey.keylessPublicKey;\n const { iss } = keylessPubKey;\n\n let allJWKs: Map<string, MoveJWK[]>;\n const jwkAddr = publicKey instanceof FederatedKeylessPublicKey ? publicKey.jwkAddress : undefined;\n try {\n allJWKs = await getKeylessJWKs({ aptosConfig, jwkAddr });\n } catch (error) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.FULL_NODE_JWKS_LOOKUP_ERROR,\n error,\n details: `Failed to fetch ${jwkAddr ? \"Federated\" : \"Patched\"}JWKs ${jwkAddr ? `for address ${jwkAddr}` : \"0x1\"}`,\n });\n }\n\n // Find the corresponding JWK set by `iss`\n const jwksForIssuer = allJWKs.get(iss);\n\n if (jwksForIssuer === undefined) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.INVALID_JWT_ISS_NOT_RECOGNIZED,\n details: `JWKs for issuer ${iss} not found.`,\n });\n }\n\n // Find the corresponding JWK by `kid`\n const jwk = jwksForIssuer.find((key) => key.kid === kid);\n\n if (jwk === undefined) {\n throw KeylessError.fromErrorType({\n type: KeylessErrorType.INVALID_JWT_JWK_NOT_FOUND,\n details: `JWK with kid '${kid}' for issuer '${iss}' not found.`,\n });\n }\n\n return jwk;\n }\n}\n\n/**\n * A container class to hold a transaction and a proof. It implements CryptoHashable which is used to create\n * the signing message for Keyless transactions. We sign over the proof to ensure non-malleability.\n */\nexport class TransactionAndProof extends Serializable {\n /**\n * The transaction to sign.\n */\n transaction: AnyRawTransactionInstance;\n\n /**\n * The zero knowledge proof used in signing the transaction.\n */\n proof?: ZkProof;\n\n /**\n * The domain separator prefix used when hashing.\n */\n readonly domainSeparator = \"APTOS::TransactionAndProof\";\n\n constructor(transaction: AnyRawTransactionInstance, proof?: ZkProof) {\n super();\n this.transaction = transaction;\n this.proof = proof;\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.serializeFixedBytes(this.transaction.bcsToBytes());\n serializer.serializeOption(this.proof);\n }\n\n /**\n * Hashes the bcs serialized from of the class. This is the typescript corollary to the BCSCryptoHash macro in aptos-core.\n *\n * @returns Uint8Array\n */\n hash(): Uint8Array {\n return generateSigningMessage(this.bcsToBytes(), this.domainSeparator);\n }\n}\n\nexport type ProofFetchSuccess = {\n status: \"Success\";\n};\n\nexport type ProofFetchFailure = {\n status: \"Failed\";\n error: string;\n};\n\nexport type ProofFetchStatus = ProofFetchSuccess | ProofFetchFailure;\n\nexport type ProofFetchCallback = (status: ProofFetchStatus) => Promise<void>;\n\nexport interface ProofFetchEvents {\n proofFetchFinish: (status: ProofFetchStatus) => void;\n}\n"],"mappings":"ofAGA,OAAOA,MAAkB,gBACzB,OAAS,aAAAC,MAAiB,aAmCnB,SAASC,GAAgBC,EAAgC,CAC9D,OAAOA,GAAQ,MAA6B,OAAOA,EAAI,6BAAgC,UACzF,CAMO,IAAeC,EAAf,MAAeA,UAA+BC,CAAsC,CA0F/E,YAAYC,EAanB,CACD,MAAM,EACN,GAAM,CACJ,QAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,OAAAC,EACA,OAAAC,EACA,IAAAC,EACA,OAAAC,EACA,MAAAC,EACA,mBAAAC,EACA,IAAAC,EACA,oBAAAC,CACF,EAAIX,EAUJ,GATA,KAAK,iBAAmBE,EACxB,KAAK,UAAYC,EACjB,KAAK,eAAiBF,EAAUW,EAAe,KAAKX,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,EACvG,KAAK,OAASG,EACd,KAAK,OAASC,EACd,KAAK,IAAMC,EACX,KAAK,IAAMI,EACX,KAA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CACvE,CACF","names":["EventEmitter","jwtDecode","isKeylessSigner","obj","_AbstractKeylessAccount","Serializable","args","address","ephemeralKeyPair","publicKey","uidKey","uidVal","aud","pepper","proof","proofFetchCallback","jwt","verificationKeyHash","AccountAddress","EventEmitter","ZeroKnowledgeSig","status","pepperBytes","Hex","promise","error","serializer","deserializer","EphemeralKeyPair","message","signature","AnySignature","AnyPublicKey","AccountAuthenticatorSingleKey","transaction","aptosConfig","KeylessError","header","jwtDecode","verificationKey","getKeylessConfig","expiryDateSecs","ephemeralPublicKey","ephemeralSignature","KeylessSignature","base64UrlDecode","EphemeralCertificate","raw","deriveTransactionType","signMess","TransactionAndProof","kid","keylessPubKey","KeylessPublicKey","iss","allJWKs","jwkAddr","FederatedKeylessPublicKey","getKeylessJWKs","jwksForIssuer","jwk","key","AbstractKeylessAccount","generateSigningMessage"]}
@@ -1,2 +1,2 @@
1
- import{b as o}from"./chunk-KM6UXNC7.mjs";import{a as u,c as r}from"./chunk-IECDO22V.mjs";import{e as t}from"./chunk-6FLHGOKP.mjs";import{a as i}from"./chunk-QQIVWB6G.mjs";var c=class extends i{constructor(e){super();this.accountAddress=o.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new t(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=u.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
- //# sourceMappingURL=chunk-A2AEFKXS.mjs.map
1
+ import{b as o}from"./chunk-JNO7KPMG.mjs";import{a as u,c as r}from"./chunk-TM7OZT3W.mjs";import{e as t}from"./chunk-42H7WETG.mjs";import{a as i}from"./chunk-AJ5JHBAE.mjs";var c=class extends i{constructor(e){super();this.accountAddress=o.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new t(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=u.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
+ //# sourceMappingURL=chunk-HEHVWRMO.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as o}from"./chunk-KW4FVBDD.mjs";import{a as r}from"./chunk-BG2TZI3H.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
2
- //# sourceMappingURL=chunk-UGL2GPGK.mjs.map
1
+ import{b as o}from"./chunk-4DNCQM3S.mjs";import{a as r}from"./chunk-XT5T5LAP.mjs";var t=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await r({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),o({aptosConfig:this.config,...e})}};export{t as a};
2
+ //# sourceMappingURL=chunk-HFWFDS6Y.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-5S3Z7MT4.mjs";import{f as t,i as o}from"./chunk-OTY3NO7Q.mjs";import{e as n}from"./chunk-J245N3XF.mjs";var u={typeParameters:[{constraints:[]}],parameters:[new o,new t]};async function y(e){let{aptosConfig:i,sender:s,recipient:c,amount:p,coinType:a,options:m}=e;return r({aptosConfig:i,sender:s,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[a??n],functionArguments:[c,p],abi:u},options:m})}export{y as a};
2
- //# sourceMappingURL=chunk-OXM4BVAY.mjs.map
1
+ import{a as r}from"./chunk-AHWZA3GD.mjs";import{f as t,i as o}from"./chunk-T6ADNZE5.mjs";import{e as n}from"./chunk-J245N3XF.mjs";var u={typeParameters:[{constraints:[]}],parameters:[new o,new t]};async function y(e){let{aptosConfig:i,sender:s,recipient:c,amount:p,coinType:a,options:m}=e;return r({aptosConfig:i,sender:s,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[a??n],functionArguments:[c,p],abi:u},options:m})}export{y as a};
2
+ //# sourceMappingURL=chunk-HXXELLHN.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-4LKLOUMG.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-RBJNSUSU.mjs.map
1
+ import{a as n}from"./chunk-X3JPX7T6.mjs";import{b as i}from"./chunk-JNO7KPMG.mjs";import{a as d}from"./chunk-AJ5JHBAE.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-IBMZYDAR.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-5S3Z7MT4.mjs";import{c as p}from"./chunk-KRVLR3L4.mjs";import{c as o}from"./chunk-BVVHGSWC.mjs";import{n as u,q as g,r as A}from"./chunk-VHNX2NUR.mjs";import{f as a,i as r}from"./chunk-OTY3NO7Q.mjs";async function G(t){let{aptosConfig:s,options:e}=t,n={query:A,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function h(t){let{aptosConfig:s,options:e}=t,n={query:g,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function M(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var b={typeParameters:[{constraints:[]}],parameters:[p("0x1::object::Object"),new r,new a]};async function x(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:l,options:f}=t;return c({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,l],abi:b},options:f})}export{G as a,h as b,M as c,x as d};
2
- //# sourceMappingURL=chunk-AT2ZGTXQ.mjs.map
1
+ import{a as c}from"./chunk-AHWZA3GD.mjs";import{c as p}from"./chunk-AOROYJ74.mjs";import{c as o}from"./chunk-PW3ISXPN.mjs";import{n as u,q as g,r as A}from"./chunk-VHNX2NUR.mjs";import{f as a,i as r}from"./chunk-T6ADNZE5.mjs";async function G(t){let{aptosConfig:s,options:e}=t,n={query:A,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function h(t){let{aptosConfig:s,options:e}=t,n={query:g,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function M(t){let{aptosConfig:s,options:e}=t,n={query:u,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await o({aptosConfig:s,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var b={typeParameters:[{constraints:[]}],parameters:[p("0x1::object::Object"),new r,new a]};async function x(t){let{aptosConfig:s,sender:e,fungibleAssetMetadataAddress:n,recipient:i,amount:l,options:f}=t;return c({aptosConfig:s,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,i,l],abi:b},options:f})}export{G as a,h as b,M as c,x as d};
2
+ //# sourceMappingURL=chunk-IDNDUJOK.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as c}from"./chunk-WZCKSN2U.mjs";import{a as n}from"./chunk-VYMRIKUV.mjs";import{c as i}from"./chunk-P3J54CQG.mjs";var o=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?n.generate():c.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:a=!0}=e;return t instanceof i&&a?new n({privateKey:t,address:r}):new c({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:a,legacy:s=!0}=e;return t===0&&s?n.fromDerivationPath({mnemonic:r,path:a}):c.fromDerivationPath({scheme:t,mnemonic:r,path:a})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};export{o as a};
2
- //# sourceMappingURL=chunk-3H5DGQKX.mjs.map
1
+ import{a as c}from"./chunk-NARS3JDH.mjs";import{a as n}from"./chunk-JLD7DLKM.mjs";import{c as i}from"./chunk-L2SDI7PI.mjs";var o=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?n.generate():c.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:a=!0}=e;return t instanceof i&&a?new n({privateKey:t,address:r}):new c({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:a,legacy:s=!0}=e;return t===0&&s?n.fromDerivationPath({mnemonic:r,path:a}):c.fromDerivationPath({scheme:t,mnemonic:r,path:a})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};export{o as a};
2
+ //# sourceMappingURL=chunk-II654QZU.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as o,b as r,c as s}from"./chunk-EE7GDBA5.mjs";import{a as t}from"./chunk-BG2TZI3H.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
2
- //# sourceMappingURL=chunk-JNRMHDRA.mjs.map
1
+ import{a as t}from"./chunk-XT5T5LAP.mjs";import{a as o,b as r,c as s}from"./chunk-SU2WB34N.mjs";var a=class{constructor(e){this.config=e}async getTableItem(e){return o({aptosConfig:this.config,...e})}async getTableItemsData(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),r({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await t({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),s({aptosConfig:this.config,...e})}};export{a};
2
+ //# sourceMappingURL=chunk-JDNI5VIJ.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-I2NMCLNW.mjs";import{g as r}from"./chunk-5S3Z7MT4.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
2
- //# sourceMappingURL=chunk-73GCGRFW.mjs.map
1
+ import{b as s}from"./chunk-I2NMCLNW.mjs";import{g as r}from"./chunk-AHWZA3GD.mjs";import{a as o}from"./chunk-KDMSOCZY.mjs";var i=class{constructor(n){this.config=n}async simple(n){return r({aptosConfig:this.config,...n})}async multiAgent(n){return r({aptosConfig:this.config,...n})}};o([s],i.prototype,"simple",1),o([s],i.prototype,"multiAgent",1);export{i as a};
2
+ //# sourceMappingURL=chunk-JJUINAQE.mjs.map
@@ -1,2 +1,2 @@
1
- import{d as s}from"./chunk-WSZCPSV4.mjs";import{b as i}from"./chunk-MK2QAHXC.mjs";import{c as n}from"./chunk-P3J54CQG.mjs";import{b as o}from"./chunk-KM6UXNC7.mjs";var c=class a{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?o.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=n.generate();return new a({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,u=n.fromDerivationPath(e,r);return new a({privateKey:u})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new i(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new i(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(s(t))}};export{c as a};
2
- //# sourceMappingURL=chunk-VYMRIKUV.mjs.map
1
+ import{d as s}from"./chunk-FXUI3SSD.mjs";import{b as i}from"./chunk-YZ3YPLEU.mjs";import{c as n}from"./chunk-L2SDI7PI.mjs";import{b as o}from"./chunk-JNO7KPMG.mjs";var c=class a{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?o.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=n.generate();return new a({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,u=n.fromDerivationPath(e,r);return new a({privateKey:u})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new i(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new i(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(s(t))}};export{c as a};
2
+ //# sourceMappingURL=chunk-JLD7DLKM.mjs.map
@@ -0,0 +1,4 @@
1
+ import{a as d}from"./chunk-AJ5JHBAE.mjs";import{a as i}from"./chunk-6Q2O5G3J.mjs";import{bytesToHex as c,hexToBytes as h}from"@noble/hashes/utils";var u=(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.INVALID_PADDING_STRICTNESS="INVALID_PADDING_STRICTNESS",s))(u||{}),e=class e extends d{constructor(t){if(super(),t.length!==e.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=c(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return c(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let r=this.bcsToBytes();t.serializeBytes(r)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let r=t.deserializeFixedBytes(e.LENGTH);return new e(r)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");let r=e.fromString(t);if(t.length!==e.LONG_STRING_LENGTH+2)if(r.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 r}static fromString(t,{maxMissingChars:r=4}={}){let n=t;if(t.startsWith("0x")&&(n=t.slice(2)),n.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");if(r>63||r<0)throw new i(`maxMissingChars must be between or equal to 0 and 63. Received ${r}`,"INVALID_PADDING_STRICTNESS");let a;try{a=h(n.padStart(64,"0"))}catch(g){throw new i(`Hex characters are invalid: ${g?.message}`,"invalid_hex_chars")}let o=new e(a);if(n.length<64-r&&!o.isSpecial())throw new i(`Hex string is too short, must be ${64-r} to 64 chars long, excluding the leading 0x. You may need to fix
2
+ the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
3
+ Received ${t}`,"too_short");return o}static from(t,{maxMissingChars:r=4}={}){return typeof t=="string"?e.fromString(t,{maxMissingChars:r}):t instanceof Uint8Array?new e(t):t}static fromStrict(t){return typeof t=="string"?e.fromStringStrict(t):t instanceof Uint8Array?new e(t):t}static isValid(t){try{return t.strict?e.fromStrict(t.input):e.from(t.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((r,n)=>r===t.data[n])}};e.LENGTH=32,e.LONG_STRING_LENGTH=64,e.ZERO=e.from("0x0"),e.ONE=e.from("0x1"),e.TWO=e.from("0x2"),e.THREE=e.from("0x3"),e.FOUR=e.from("0x4"),e.A=e.from("0xA");var l=e;export{u as a,l as b};
4
+ //# sourceMappingURL=chunk-JNO7KPMG.mjs.map