@aptos-labs/ts-sdk 1.13.0 → 1.13.1-zeta.2

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 (473) hide show
  1. package/dist/common/index.d.ts +1774 -1351
  2. package/dist/common/index.js +26 -26
  3. package/dist/common/index.js.map +1 -1
  4. package/dist/esm/{Ed25519Account--qjfup2u.d.mts → Ed25519Account-8gJF5t3F.d.mts} +10 -12
  5. package/dist/esm/account/Account.d.mts +34 -0
  6. package/dist/esm/account/Account.mjs +2 -0
  7. package/dist/esm/account/Ed25519Account.d.mts +34 -0
  8. package/dist/esm/account/Ed25519Account.mjs +2 -0
  9. package/dist/esm/account/EphemeralKeyPair.d.mts +44 -0
  10. package/dist/esm/account/EphemeralKeyPair.mjs +2 -0
  11. package/dist/esm/account/KeylessAccount.d.mts +87 -0
  12. package/dist/esm/account/KeylessAccount.mjs +2 -0
  13. package/dist/esm/account/MultiKeyAccount.d.mts +99 -0
  14. package/dist/esm/account/MultiKeyAccount.mjs +2 -0
  15. package/dist/esm/account/SingleKeyAccount.d.mts +34 -0
  16. package/dist/esm/account/SingleKeyAccount.mjs +2 -0
  17. package/dist/esm/account/index.d.mts +39 -0
  18. package/dist/esm/account/index.mjs +2 -0
  19. package/dist/esm/api/account.d.mts +14 -2
  20. package/dist/esm/api/account.mjs +1 -1
  21. package/dist/esm/api/ans.d.mts +2 -2
  22. package/dist/esm/api/ans.mjs +1 -1
  23. package/dist/esm/api/aptos.d.mts +14 -8
  24. package/dist/esm/api/aptos.mjs +1 -1
  25. package/dist/esm/api/aptosConfig.d.mts +20 -0
  26. package/dist/esm/api/aptosConfig.mjs +1 -1
  27. package/dist/esm/api/coin.d.mts +7 -7
  28. package/dist/esm/api/coin.mjs +1 -1
  29. package/dist/esm/api/digitalAsset.d.mts +3 -3
  30. package/dist/esm/api/digitalAsset.mjs +1 -1
  31. package/dist/esm/api/event.d.mts +1 -1
  32. package/dist/esm/api/event.mjs +1 -1
  33. package/dist/esm/api/faucet.mjs +1 -1
  34. package/dist/esm/api/fungibleAsset.d.mts +6 -6
  35. package/dist/esm/api/fungibleAsset.mjs +1 -1
  36. package/dist/esm/api/general.d.mts +9 -9
  37. package/dist/esm/api/general.mjs +1 -1
  38. package/dist/esm/api/index.d.mts +13 -8
  39. package/dist/esm/api/index.mjs +1 -1
  40. package/dist/esm/api/keyless.d.mts +66 -0
  41. package/dist/esm/api/keyless.mjs +2 -0
  42. package/dist/esm/api/keyless.mjs.map +1 -0
  43. package/dist/esm/api/staking.d.mts +2 -2
  44. package/dist/esm/api/staking.mjs +1 -1
  45. package/dist/esm/api/transaction.d.mts +1 -1
  46. package/dist/esm/api/transaction.mjs +1 -1
  47. package/dist/esm/api/transactionSubmission/build.d.mts +2 -2
  48. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  49. package/dist/esm/api/transactionSubmission/management.d.mts +8 -8
  50. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  51. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
  52. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  53. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  54. package/dist/esm/api/transactionSubmission/simulate.d.mts +6 -6
  55. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  56. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  57. package/dist/esm/api/utils.mjs +1 -1
  58. package/dist/esm/bcs/index.mjs +1 -1
  59. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  60. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  61. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  62. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  63. package/dist/esm/bcs/serializer.d.mts +2 -0
  64. package/dist/esm/bcs/serializer.mjs +1 -1
  65. package/dist/esm/{chunk-FS3NSGBF.mjs → chunk-35ZI4WOQ.mjs} +2 -2
  66. package/dist/esm/{chunk-ONDQ4MK7.mjs → chunk-3FL3NLZ6.mjs} +2 -2
  67. package/dist/esm/chunk-42ZSGMQO.mjs +2 -0
  68. package/dist/esm/chunk-42ZSGMQO.mjs.map +1 -0
  69. package/dist/esm/chunk-4VKZBIH7.mjs +2 -0
  70. package/dist/esm/chunk-4VKZBIH7.mjs.map +1 -0
  71. package/dist/esm/{chunk-52C73T26.mjs → chunk-52DBSOFA.mjs} +2 -2
  72. package/dist/esm/{chunk-52C73T26.mjs.map → chunk-52DBSOFA.mjs.map} +1 -1
  73. package/dist/esm/{chunk-HB6T27S2.mjs → chunk-55BHW3A6.mjs} +2 -2
  74. package/dist/esm/{chunk-QW3VNZJ7.mjs → chunk-55W7VV7Z.mjs} +2 -2
  75. package/dist/esm/chunk-5GIWRESN.mjs +2 -0
  76. package/dist/esm/chunk-5NKRMZEX.mjs +2 -0
  77. package/dist/esm/chunk-5NKRMZEX.mjs.map +1 -0
  78. package/dist/esm/{chunk-KUOIRTNL.mjs → chunk-5TNUDFLP.mjs} +2 -2
  79. package/dist/esm/{chunk-IS3OLRMB.mjs → chunk-6FEGU4XJ.mjs} +2 -2
  80. package/dist/esm/chunk-7BT2KH4T.mjs +2 -0
  81. package/dist/esm/chunk-7BT2KH4T.mjs.map +1 -0
  82. package/dist/esm/{chunk-6CBPMYW5.mjs → chunk-7CVJJZBP.mjs} +2 -2
  83. package/dist/esm/{chunk-TBMAJ6AW.mjs → chunk-7EQOLMEJ.mjs} +2 -2
  84. package/dist/esm/{chunk-7PYFGGHM.mjs → chunk-7GO6HWMQ.mjs} +2 -2
  85. package/dist/esm/chunk-7GO6HWMQ.mjs.map +1 -0
  86. package/dist/esm/chunk-7URCUZPH.mjs +2 -0
  87. package/dist/esm/chunk-7URCUZPH.mjs.map +1 -0
  88. package/dist/esm/chunk-7Z6DYLCA.mjs +1 -0
  89. package/dist/esm/chunk-7Z6DYLCA.mjs.map +1 -0
  90. package/dist/esm/chunk-AKW2HAKU.mjs +2 -0
  91. package/dist/esm/chunk-AKW2HAKU.mjs.map +1 -0
  92. package/dist/esm/chunk-AQ4I7VVB.mjs +1 -0
  93. package/dist/esm/chunk-AQ4I7VVB.mjs.map +1 -0
  94. package/dist/esm/chunk-AULJLLO5.mjs +2 -0
  95. package/dist/esm/{chunk-TLKV4NHK.mjs.map → chunk-AULJLLO5.mjs.map} +1 -1
  96. package/dist/esm/chunk-BIRZ55IO.mjs +2 -0
  97. package/dist/esm/chunk-BIRZ55IO.mjs.map +1 -0
  98. package/dist/esm/{chunk-XYLYHSEI.mjs → chunk-BM43VTGD.mjs} +2 -2
  99. package/dist/esm/chunk-BM43VTGD.mjs.map +1 -0
  100. package/dist/esm/{chunk-3F6EYD5O.mjs → chunk-BTEW6JF2.mjs} +2 -2
  101. package/dist/esm/chunk-BTEW6JF2.mjs.map +1 -0
  102. package/dist/esm/chunk-CFGG43FJ.mjs +2 -0
  103. package/dist/esm/{chunk-7CAEMK4R.mjs → chunk-CKMU5DQN.mjs} +2 -2
  104. package/dist/esm/{chunk-L4Q2XTHT.mjs → chunk-ED6PYTNG.mjs} +2 -2
  105. package/dist/esm/{chunk-QVKMFPAV.mjs → chunk-EESTYBZ5.mjs} +2 -2
  106. package/dist/esm/{chunk-TBFLWWV4.mjs → chunk-EGFL5FCU.mjs} +2 -2
  107. package/dist/esm/chunk-F2OCQQAA.mjs +2 -0
  108. package/dist/esm/chunk-FLYEALDB.mjs +2 -0
  109. package/dist/esm/chunk-FLYEALDB.mjs.map +1 -0
  110. package/dist/esm/{chunk-Y5M5DD64.mjs → chunk-GSOKKQQ7.mjs} +2 -2
  111. package/dist/esm/{chunk-WFZDFFBM.mjs → chunk-HZC6A3QL.mjs} +2 -2
  112. package/dist/esm/chunk-IMGPWY3W.mjs +2 -0
  113. package/dist/esm/{chunk-WEZXFWPR.mjs.map → chunk-IMGPWY3W.mjs.map} +1 -1
  114. package/dist/esm/{chunk-U43IJHQN.mjs → chunk-IVBYTTN7.mjs} +2 -2
  115. package/dist/esm/{chunk-G2QII3AT.mjs → chunk-IXA3IGQT.mjs} +2 -2
  116. package/dist/esm/chunk-IXA3IGQT.mjs.map +1 -0
  117. package/dist/esm/{chunk-IA6XM7QE.mjs → chunk-JIX5F3BC.mjs} +2 -2
  118. package/dist/esm/chunk-JIX5F3BC.mjs.map +1 -0
  119. package/dist/esm/chunk-JTFH6ACV.mjs +2 -0
  120. package/dist/esm/chunk-JTFH6ACV.mjs.map +1 -0
  121. package/dist/esm/chunk-JXCZTOYC.mjs +1 -0
  122. package/dist/esm/chunk-JXCZTOYC.mjs.map +1 -0
  123. package/dist/esm/{chunk-NPFNYP75.mjs → chunk-JYFKKB34.mjs} +2 -2
  124. package/dist/esm/chunk-JZ7UTFTR.mjs +2 -0
  125. package/dist/esm/{chunk-YWQLLV2R.mjs.map → chunk-JZ7UTFTR.mjs.map} +1 -1
  126. package/dist/esm/chunk-K7ESGXR3.mjs +2 -0
  127. package/dist/esm/chunk-K7ESGXR3.mjs.map +1 -0
  128. package/dist/esm/chunk-KMPAYC5Z.mjs +2 -0
  129. package/dist/esm/chunk-KMPAYC5Z.mjs.map +1 -0
  130. package/dist/esm/{chunk-R5QUBEH6.mjs → chunk-KX5ESZO7.mjs} +2 -2
  131. package/dist/esm/{chunk-H4UVHJ3M.mjs → chunk-LODRH4QJ.mjs} +2 -2
  132. package/dist/esm/chunk-LODRH4QJ.mjs.map +1 -0
  133. package/dist/esm/chunk-LXDHLUP4.mjs +2 -0
  134. package/dist/esm/chunk-LXDHLUP4.mjs.map +1 -0
  135. package/dist/esm/{chunk-ZKNM27TR.mjs → chunk-M3PUC5JD.mjs} +2 -2
  136. package/dist/esm/chunk-M3PUC5JD.mjs.map +1 -0
  137. package/dist/esm/chunk-MCSLNNV3.mjs +2 -0
  138. package/dist/esm/chunk-MCSLNNV3.mjs.map +1 -0
  139. package/dist/esm/{chunk-BWFJHFBQ.mjs → chunk-MRCVSUJQ.mjs} +2 -2
  140. package/dist/esm/{chunk-I7YI22IW.mjs → chunk-MUZPVCQF.mjs} +2 -2
  141. package/dist/esm/{chunk-OKCU4GHN.mjs → chunk-N37BFHNS.mjs} +2 -2
  142. package/dist/esm/chunk-ND5A52N4.mjs +2 -0
  143. package/dist/esm/chunk-ND5A52N4.mjs.map +1 -0
  144. package/dist/esm/{chunk-2M6OT6DU.mjs → chunk-NG3IWN2V.mjs} +2 -2
  145. package/dist/esm/{chunk-VBTJVPAM.mjs → chunk-NVN6BTXK.mjs} +2 -2
  146. package/dist/esm/{chunk-KVIVMWN5.mjs → chunk-O63GDJY4.mjs} +2 -2
  147. package/dist/esm/chunk-OKRUEVF3.mjs +2 -0
  148. package/dist/esm/chunk-OKRUEVF3.mjs.map +1 -0
  149. package/dist/esm/chunk-P6EM7SA6.mjs +2 -0
  150. package/dist/esm/chunk-P6EM7SA6.mjs.map +1 -0
  151. package/dist/esm/chunk-PLB5ERQA.mjs +2 -0
  152. package/dist/esm/chunk-PLB5ERQA.mjs.map +1 -0
  153. package/dist/esm/{chunk-TR2YS7DT.mjs → chunk-PWPUAWER.mjs} +2 -2
  154. package/dist/esm/{chunk-HXN2WRUX.mjs → chunk-PYFNAWZ5.mjs} +2 -2
  155. package/dist/esm/{chunk-DMKUAQB7.mjs → chunk-Q225PZMV.mjs} +2 -2
  156. package/dist/esm/chunk-Q2Y6S77E.mjs +2 -0
  157. package/dist/esm/{chunk-A7MSW6OL.mjs → chunk-QUJQWJB7.mjs} +2 -2
  158. package/dist/esm/{chunk-TGLSJGFO.mjs → chunk-RBDX3YWC.mjs} +2 -2
  159. package/dist/esm/chunk-RFSO3JRG.mjs +1 -0
  160. package/dist/esm/chunk-RFSO3JRG.mjs.map +1 -0
  161. package/dist/esm/{chunk-DSTKXJMA.mjs → chunk-RM7D2ITN.mjs} +2 -2
  162. package/dist/esm/chunk-S5HG2QUD.mjs +2 -0
  163. package/dist/esm/chunk-S5HG2QUD.mjs.map +1 -0
  164. package/dist/esm/chunk-S5YUB2BI.mjs +2 -0
  165. package/dist/esm/chunk-S5YUB2BI.mjs.map +1 -0
  166. package/dist/esm/{chunk-SDUIZ3FY.mjs → chunk-SI3UTR5R.mjs} +2 -2
  167. package/dist/esm/chunk-SI3UTR5R.mjs.map +1 -0
  168. package/dist/esm/chunk-T7TIIAWK.mjs +2 -0
  169. package/dist/esm/{chunk-KOAUBVO6.mjs.map → chunk-T7TIIAWK.mjs.map} +1 -1
  170. package/dist/esm/chunk-U24GVATE.mjs +2 -0
  171. package/dist/esm/chunk-U24GVATE.mjs.map +1 -0
  172. package/dist/esm/{chunk-IOSQVDZI.mjs → chunk-U7EZI5D5.mjs} +2 -2
  173. package/dist/esm/{chunk-V4YBGBCN.mjs → chunk-UPVELRIE.mjs} +2 -2
  174. package/dist/esm/{chunk-ZYYK3UXP.mjs → chunk-UZHVGPGH.mjs} +2 -2
  175. package/dist/esm/chunk-V76TXXWZ.mjs +2 -0
  176. package/dist/esm/chunk-V76TXXWZ.mjs.map +1 -0
  177. package/dist/esm/chunk-V7CRIOJF.mjs +2 -0
  178. package/dist/esm/chunk-V7CRIOJF.mjs.map +1 -0
  179. package/dist/esm/{chunk-647IOEXV.mjs → chunk-V7E4HC3Y.mjs} +2 -2
  180. package/dist/esm/chunk-VMR46ALO.mjs +2 -0
  181. package/dist/esm/chunk-VMR46ALO.mjs.map +1 -0
  182. package/dist/esm/{chunk-QIAHBEEW.mjs → chunk-VVJEWB26.mjs} +2 -2
  183. package/dist/esm/{chunk-RHBCVCOS.mjs → chunk-WZCUABDL.mjs} +2 -2
  184. package/dist/esm/{chunk-MIEV7J74.mjs → chunk-XFI6MEYQ.mjs} +2 -2
  185. package/dist/esm/chunk-XFI6MEYQ.mjs.map +1 -0
  186. package/dist/esm/{chunk-UML2VQZT.mjs → chunk-XI4LX4EC.mjs} +2 -2
  187. package/dist/esm/chunk-XLTRVMUO.mjs +2 -0
  188. package/dist/esm/chunk-XLTRVMUO.mjs.map +1 -0
  189. package/dist/esm/chunk-Y4VKIX2V.mjs +2 -0
  190. package/dist/esm/chunk-Y4VKIX2V.mjs.map +1 -0
  191. package/dist/esm/chunk-YE5B2S5L.mjs +2 -0
  192. package/dist/esm/chunk-YE5B2S5L.mjs.map +1 -0
  193. package/dist/esm/chunk-Z5GI2A3I.mjs +2 -0
  194. package/dist/esm/chunk-Z5GI2A3I.mjs.map +1 -0
  195. package/dist/esm/chunk-ZSZCPOHE.mjs +2 -0
  196. package/dist/esm/chunk-ZSZCPOHE.mjs.map +1 -0
  197. package/dist/esm/client/core.mjs +1 -1
  198. package/dist/esm/client/get.d.mts +2 -1
  199. package/dist/esm/client/get.mjs +1 -1
  200. package/dist/esm/client/index.d.mts +2 -2
  201. package/dist/esm/client/index.mjs +1 -1
  202. package/dist/esm/client/post.d.mts +3 -1
  203. package/dist/esm/client/post.mjs +1 -1
  204. package/dist/esm/core/account/index.d.mts +5 -14
  205. package/dist/esm/core/account/index.mjs +1 -1
  206. package/dist/esm/core/account/utils/address.mjs +1 -1
  207. package/dist/esm/core/account/utils/index.mjs +1 -1
  208. package/dist/esm/core/accountAddress.mjs +1 -1
  209. package/dist/esm/core/authenticationKey.mjs +1 -1
  210. package/dist/esm/core/crypto/ed25519.d.mts +0 -10
  211. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  212. package/dist/esm/core/crypto/ephemeral.d.mts +77 -0
  213. package/dist/esm/core/crypto/ephemeral.mjs +2 -0
  214. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -0
  215. package/dist/esm/core/crypto/hdKey.d.mts +15 -1
  216. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  217. package/dist/esm/core/crypto/index.d.mts +7 -5
  218. package/dist/esm/core/crypto/index.mjs +1 -1
  219. package/dist/esm/core/crypto/keyless.d.mts +217 -0
  220. package/dist/esm/core/crypto/keyless.mjs +2 -0
  221. package/dist/esm/core/crypto/keyless.mjs.map +1 -0
  222. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  223. package/dist/esm/core/crypto/multiKey.d.mts +4 -3
  224. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  225. package/dist/esm/core/crypto/poseidon.d.mts +7 -0
  226. package/dist/esm/core/crypto/poseidon.mjs +2 -0
  227. package/dist/esm/core/crypto/poseidon.mjs.map +1 -0
  228. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  229. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  230. package/dist/esm/core/crypto/signature.mjs +1 -1
  231. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  232. package/dist/esm/core/index.d.mts +6 -7
  233. package/dist/esm/core/index.mjs +1 -1
  234. package/dist/esm/index.d.mts +15 -9
  235. package/dist/esm/index.mjs +1 -1
  236. package/dist/esm/internal/account.d.mts +14 -2
  237. package/dist/esm/internal/account.mjs +1 -1
  238. package/dist/esm/internal/ans.d.mts +1 -1
  239. package/dist/esm/internal/ans.mjs +1 -1
  240. package/dist/esm/internal/coin.d.mts +7 -7
  241. package/dist/esm/internal/coin.mjs +1 -1
  242. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  243. package/dist/esm/internal/digitalAsset.mjs +1 -1
  244. package/dist/esm/internal/event.d.mts +2 -2
  245. package/dist/esm/internal/event.mjs +1 -1
  246. package/dist/esm/internal/faucet.d.mts +1 -1
  247. package/dist/esm/internal/faucet.mjs +1 -1
  248. package/dist/esm/internal/fungibleAsset.d.mts +6 -6
  249. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  250. package/dist/esm/internal/general.mjs +1 -1
  251. package/dist/esm/internal/keyless.d.mts +66 -0
  252. package/dist/esm/internal/keyless.mjs +2 -0
  253. package/dist/esm/internal/keyless.mjs.map +1 -0
  254. package/dist/esm/internal/staking.d.mts +3 -3
  255. package/dist/esm/internal/staking.mjs +1 -1
  256. package/dist/esm/internal/transaction.mjs +1 -1
  257. package/dist/esm/internal/transactionSubmission.d.mts +5 -5
  258. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  259. package/dist/esm/internal/view.d.mts +7 -7
  260. package/dist/esm/internal/view.mjs +1 -1
  261. package/dist/esm/transactions/authenticator/account.d.mts +3 -4
  262. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  263. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  264. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  265. package/dist/esm/transactions/index.d.mts +2 -2
  266. package/dist/esm/transactions/index.mjs +1 -1
  267. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  268. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  269. package/dist/esm/transactions/instances/index.mjs +1 -1
  270. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  271. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  272. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  273. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  274. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  275. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  276. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  277. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  278. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  279. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +13 -1
  280. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  281. package/dist/esm/transactions/management/index.d.mts +2 -2
  282. package/dist/esm/transactions/management/index.mjs +1 -1
  283. package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
  284. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  285. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +9 -9
  286. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  287. package/dist/esm/transactions/transactionBuilder/index.d.mts +9 -9
  288. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  289. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +6 -6
  290. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  291. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +47 -0
  292. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +2 -0
  293. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -0
  294. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -28
  295. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  296. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  297. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  298. package/dist/esm/transactions/types.d.mts +6 -6
  299. package/dist/esm/types/index.d.mts +17 -3
  300. package/dist/esm/types/index.mjs +1 -1
  301. package/dist/esm/types/keyless.d.mts +14 -0
  302. package/dist/esm/types/keyless.mjs +1 -0
  303. package/dist/esm/types/keyless.mjs.map +1 -0
  304. package/dist/esm/utils/apiEndpoints.d.mts +3 -1
  305. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  306. package/dist/esm/utils/const.d.mts +3 -1
  307. package/dist/esm/utils/const.mjs +1 -1
  308. package/dist/esm/utils/index.d.mts +1 -1
  309. package/dist/esm/utils/index.mjs +1 -1
  310. package/dist/esm/version.d.mts +1 -1
  311. package/dist/esm/version.mjs +1 -1
  312. package/package.json +7 -2
  313. package/src/{core/account → account}/Account.ts +12 -16
  314. package/src/{core/account → account}/Ed25519Account.ts +13 -7
  315. package/src/account/EphemeralKeyPair.ts +107 -0
  316. package/src/account/KeylessAccount.ts +250 -0
  317. package/src/account/MultiKeyAccount.ts +119 -0
  318. package/src/{core/account → account}/SingleKeyAccount.ts +13 -8
  319. package/src/account/index.ts +6 -0
  320. package/src/api/account.ts +2 -1
  321. package/src/api/ans.ts +2 -1
  322. package/src/api/aptos.ts +6 -0
  323. package/src/api/aptosConfig.ts +46 -1
  324. package/src/api/digitalAsset.ts +2 -1
  325. package/src/api/fungibleAsset.ts +2 -1
  326. package/src/api/keyless.ts +35 -0
  327. package/src/api/transaction.ts +2 -1
  328. package/src/api/transactionSubmission/management.ts +1 -1
  329. package/src/api/transactionSubmission/sign.ts +1 -1
  330. package/src/bcs/serializer.ts +18 -0
  331. package/src/client/core.ts +8 -0
  332. package/src/client/get.ts +6 -0
  333. package/src/client/post.ts +12 -0
  334. package/src/core/account/index.ts +1 -3
  335. package/src/core/crypto/ed25519.ts +4 -24
  336. package/src/core/crypto/ephemeral.ts +149 -0
  337. package/src/core/crypto/hdKey.ts +31 -0
  338. package/src/core/crypto/index.ts +2 -0
  339. package/src/core/crypto/keyless.ts +508 -0
  340. package/src/core/crypto/multiKey.ts +21 -11
  341. package/src/core/crypto/poseidon.ts +134 -0
  342. package/src/core/crypto/singleKey.ts +11 -0
  343. package/src/core/index.ts +0 -1
  344. package/src/index.ts +1 -0
  345. package/src/internal/account.ts +1 -1
  346. package/src/internal/ans.ts +2 -1
  347. package/src/internal/digitalAsset.ts +2 -1
  348. package/src/internal/fungibleAsset.ts +2 -1
  349. package/src/internal/keyless.ts +189 -0
  350. package/src/internal/transactionSubmission.ts +11 -8
  351. package/src/transactions/authenticator/account.ts +6 -11
  352. package/src/transactions/management/accountSequenceNumber.ts +1 -1
  353. package/src/transactions/management/transactionWorker.ts +8 -2
  354. package/src/transactions/transactionBuilder/index.ts +1 -0
  355. package/src/transactions/transactionBuilder/signingMessage.ts +70 -0
  356. package/src/transactions/transactionBuilder/transactionBuilder.ts +51 -117
  357. package/src/types/index.ts +19 -0
  358. package/src/types/keyless.ts +6 -0
  359. package/src/utils/apiEndpoints.ts +15 -0
  360. package/src/utils/const.ts +2 -0
  361. package/src/version.ts +1 -1
  362. package/dist/esm/chunk-3CLYWZYZ.mjs +0 -2
  363. package/dist/esm/chunk-3F6EYD5O.mjs.map +0 -1
  364. package/dist/esm/chunk-54BANKLA.mjs +0 -2
  365. package/dist/esm/chunk-54BANKLA.mjs.map +0 -1
  366. package/dist/esm/chunk-5AQEETAC.mjs +0 -2
  367. package/dist/esm/chunk-5AQEETAC.mjs.map +0 -1
  368. package/dist/esm/chunk-63AIRYJX.mjs +0 -2
  369. package/dist/esm/chunk-7PYFGGHM.mjs.map +0 -1
  370. package/dist/esm/chunk-AP7UZTPZ.mjs +0 -2
  371. package/dist/esm/chunk-AP7UZTPZ.mjs.map +0 -1
  372. package/dist/esm/chunk-BMKDEIRL.mjs +0 -2
  373. package/dist/esm/chunk-BMKDEIRL.mjs.map +0 -1
  374. package/dist/esm/chunk-BSEQPVD6.mjs +0 -2
  375. package/dist/esm/chunk-BSEQPVD6.mjs.map +0 -1
  376. package/dist/esm/chunk-C67BKZND.mjs +0 -2
  377. package/dist/esm/chunk-C67BKZND.mjs.map +0 -1
  378. package/dist/esm/chunk-CYNQRMO5.mjs +0 -2
  379. package/dist/esm/chunk-CYNQRMO5.mjs.map +0 -1
  380. package/dist/esm/chunk-E7FWVXGX.mjs +0 -1
  381. package/dist/esm/chunk-G2QII3AT.mjs.map +0 -1
  382. package/dist/esm/chunk-GMVVQD72.mjs +0 -2
  383. package/dist/esm/chunk-GMVVQD72.mjs.map +0 -1
  384. package/dist/esm/chunk-GXVUN32G.mjs +0 -2
  385. package/dist/esm/chunk-GXVUN32G.mjs.map +0 -1
  386. package/dist/esm/chunk-H4UVHJ3M.mjs.map +0 -1
  387. package/dist/esm/chunk-IA6XM7QE.mjs.map +0 -1
  388. package/dist/esm/chunk-KL6VJ3UK.mjs +0 -2
  389. package/dist/esm/chunk-KL6VJ3UK.mjs.map +0 -1
  390. package/dist/esm/chunk-KOAUBVO6.mjs +0 -2
  391. package/dist/esm/chunk-LR65XHSF.mjs +0 -2
  392. package/dist/esm/chunk-LR65XHSF.mjs.map +0 -1
  393. package/dist/esm/chunk-MIEV7J74.mjs.map +0 -1
  394. package/dist/esm/chunk-MLWIHWNH.mjs +0 -1
  395. package/dist/esm/chunk-OWW6SIDP.mjs +0 -2
  396. package/dist/esm/chunk-OWW6SIDP.mjs.map +0 -1
  397. package/dist/esm/chunk-QK4P26SH.mjs +0 -2
  398. package/dist/esm/chunk-QTSECE7R.mjs +0 -2
  399. package/dist/esm/chunk-QTSECE7R.mjs.map +0 -1
  400. package/dist/esm/chunk-R7G3CLRI.mjs +0 -1
  401. package/dist/esm/chunk-RAYJRFIG.mjs +0 -2
  402. package/dist/esm/chunk-RAYJRFIG.mjs.map +0 -1
  403. package/dist/esm/chunk-SDUIZ3FY.mjs.map +0 -1
  404. package/dist/esm/chunk-TLKV4NHK.mjs +0 -2
  405. package/dist/esm/chunk-UVSRX4SV.mjs +0 -1
  406. package/dist/esm/chunk-V6SPPOWX.mjs +0 -2
  407. package/dist/esm/chunk-VM3EJYJU.mjs +0 -2
  408. package/dist/esm/chunk-VM3EJYJU.mjs.map +0 -1
  409. package/dist/esm/chunk-VX6LTXGB.mjs +0 -2
  410. package/dist/esm/chunk-VX6LTXGB.mjs.map +0 -1
  411. package/dist/esm/chunk-WEZXFWPR.mjs +0 -2
  412. package/dist/esm/chunk-XYLYHSEI.mjs.map +0 -1
  413. package/dist/esm/chunk-Y2VA7F5D.mjs +0 -2
  414. package/dist/esm/chunk-Y2VA7F5D.mjs.map +0 -1
  415. package/dist/esm/chunk-YWQLLV2R.mjs +0 -2
  416. package/dist/esm/chunk-ZEXZ4CX5.mjs +0 -2
  417. package/dist/esm/chunk-ZEXZ4CX5.mjs.map +0 -1
  418. package/dist/esm/chunk-ZKNM27TR.mjs.map +0 -1
  419. package/dist/esm/chunk-ZPNCA4C7.mjs +0 -2
  420. package/dist/esm/chunk-ZPNCA4C7.mjs.map +0 -1
  421. package/dist/esm/core/account/Account.d.mts +0 -20
  422. package/dist/esm/core/account/Account.mjs +0 -2
  423. package/dist/esm/core/account/Ed25519Account.d.mts +0 -20
  424. package/dist/esm/core/account/Ed25519Account.mjs +0 -2
  425. package/dist/esm/core/account/SingleKeyAccount.d.mts +0 -20
  426. package/dist/esm/core/account/SingleKeyAccount.mjs +0 -2
  427. /package/dist/esm/{core/account → account}/Account.mjs.map +0 -0
  428. /package/dist/esm/{core/account → account}/Ed25519Account.mjs.map +0 -0
  429. /package/dist/esm/{chunk-E7FWVXGX.mjs.map → account/EphemeralKeyPair.mjs.map} +0 -0
  430. /package/dist/esm/{chunk-MLWIHWNH.mjs.map → account/KeylessAccount.mjs.map} +0 -0
  431. /package/dist/esm/{chunk-R7G3CLRI.mjs.map → account/MultiKeyAccount.mjs.map} +0 -0
  432. /package/dist/esm/{core/account → account}/SingleKeyAccount.mjs.map +0 -0
  433. /package/dist/esm/{chunk-UVSRX4SV.mjs.map → account/index.mjs.map} +0 -0
  434. /package/dist/esm/{chunk-FS3NSGBF.mjs.map → chunk-35ZI4WOQ.mjs.map} +0 -0
  435. /package/dist/esm/{chunk-ONDQ4MK7.mjs.map → chunk-3FL3NLZ6.mjs.map} +0 -0
  436. /package/dist/esm/{chunk-HB6T27S2.mjs.map → chunk-55BHW3A6.mjs.map} +0 -0
  437. /package/dist/esm/{chunk-QW3VNZJ7.mjs.map → chunk-55W7VV7Z.mjs.map} +0 -0
  438. /package/dist/esm/{chunk-V6SPPOWX.mjs.map → chunk-5GIWRESN.mjs.map} +0 -0
  439. /package/dist/esm/{chunk-KUOIRTNL.mjs.map → chunk-5TNUDFLP.mjs.map} +0 -0
  440. /package/dist/esm/{chunk-IS3OLRMB.mjs.map → chunk-6FEGU4XJ.mjs.map} +0 -0
  441. /package/dist/esm/{chunk-6CBPMYW5.mjs.map → chunk-7CVJJZBP.mjs.map} +0 -0
  442. /package/dist/esm/{chunk-TBMAJ6AW.mjs.map → chunk-7EQOLMEJ.mjs.map} +0 -0
  443. /package/dist/esm/{chunk-63AIRYJX.mjs.map → chunk-CFGG43FJ.mjs.map} +0 -0
  444. /package/dist/esm/{chunk-7CAEMK4R.mjs.map → chunk-CKMU5DQN.mjs.map} +0 -0
  445. /package/dist/esm/{chunk-L4Q2XTHT.mjs.map → chunk-ED6PYTNG.mjs.map} +0 -0
  446. /package/dist/esm/{chunk-QVKMFPAV.mjs.map → chunk-EESTYBZ5.mjs.map} +0 -0
  447. /package/dist/esm/{chunk-TBFLWWV4.mjs.map → chunk-EGFL5FCU.mjs.map} +0 -0
  448. /package/dist/esm/{chunk-3CLYWZYZ.mjs.map → chunk-F2OCQQAA.mjs.map} +0 -0
  449. /package/dist/esm/{chunk-Y5M5DD64.mjs.map → chunk-GSOKKQQ7.mjs.map} +0 -0
  450. /package/dist/esm/{chunk-WFZDFFBM.mjs.map → chunk-HZC6A3QL.mjs.map} +0 -0
  451. /package/dist/esm/{chunk-U43IJHQN.mjs.map → chunk-IVBYTTN7.mjs.map} +0 -0
  452. /package/dist/esm/{chunk-NPFNYP75.mjs.map → chunk-JYFKKB34.mjs.map} +0 -0
  453. /package/dist/esm/{chunk-R5QUBEH6.mjs.map → chunk-KX5ESZO7.mjs.map} +0 -0
  454. /package/dist/esm/{chunk-BWFJHFBQ.mjs.map → chunk-MRCVSUJQ.mjs.map} +0 -0
  455. /package/dist/esm/{chunk-I7YI22IW.mjs.map → chunk-MUZPVCQF.mjs.map} +0 -0
  456. /package/dist/esm/{chunk-OKCU4GHN.mjs.map → chunk-N37BFHNS.mjs.map} +0 -0
  457. /package/dist/esm/{chunk-2M6OT6DU.mjs.map → chunk-NG3IWN2V.mjs.map} +0 -0
  458. /package/dist/esm/{chunk-VBTJVPAM.mjs.map → chunk-NVN6BTXK.mjs.map} +0 -0
  459. /package/dist/esm/{chunk-KVIVMWN5.mjs.map → chunk-O63GDJY4.mjs.map} +0 -0
  460. /package/dist/esm/{chunk-TR2YS7DT.mjs.map → chunk-PWPUAWER.mjs.map} +0 -0
  461. /package/dist/esm/{chunk-HXN2WRUX.mjs.map → chunk-PYFNAWZ5.mjs.map} +0 -0
  462. /package/dist/esm/{chunk-DMKUAQB7.mjs.map → chunk-Q225PZMV.mjs.map} +0 -0
  463. /package/dist/esm/{chunk-QK4P26SH.mjs.map → chunk-Q2Y6S77E.mjs.map} +0 -0
  464. /package/dist/esm/{chunk-A7MSW6OL.mjs.map → chunk-QUJQWJB7.mjs.map} +0 -0
  465. /package/dist/esm/{chunk-TGLSJGFO.mjs.map → chunk-RBDX3YWC.mjs.map} +0 -0
  466. /package/dist/esm/{chunk-DSTKXJMA.mjs.map → chunk-RM7D2ITN.mjs.map} +0 -0
  467. /package/dist/esm/{chunk-IOSQVDZI.mjs.map → chunk-U7EZI5D5.mjs.map} +0 -0
  468. /package/dist/esm/{chunk-V4YBGBCN.mjs.map → chunk-UPVELRIE.mjs.map} +0 -0
  469. /package/dist/esm/{chunk-ZYYK3UXP.mjs.map → chunk-UZHVGPGH.mjs.map} +0 -0
  470. /package/dist/esm/{chunk-647IOEXV.mjs.map → chunk-V7E4HC3Y.mjs.map} +0 -0
  471. /package/dist/esm/{chunk-QIAHBEEW.mjs.map → chunk-VVJEWB26.mjs.map} +0 -0
  472. /package/dist/esm/{chunk-RHBCVCOS.mjs.map → chunk-WZCUABDL.mjs.map} +0 -0
  473. /package/dist/esm/{chunk-UML2VQZT.mjs.map → chunk-XI4LX4EC.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/poseidon.ts"],"sourcesContent":["/* eslint-disable no-bitwise */\nimport {\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n} from \"poseidon-lite\";\n\nconst numInputsToPoseidonFunc = [\n poseidon1,\n poseidon2,\n poseidon3,\n poseidon4,\n poseidon5,\n poseidon6,\n poseidon7,\n poseidon8,\n poseidon9,\n poseidon10,\n poseidon11,\n poseidon12,\n poseidon13,\n poseidon14,\n poseidon15,\n poseidon16,\n];\n\nconst BYTES_PACKED_PER_SCALAR = 31;\nconst MAX_NUM_INPUT_SCALARS = 16;\nconst MAX_NUM_INPUT_BYTES = (MAX_NUM_INPUT_SCALARS - 1) * BYTES_PACKED_PER_SCALAR;\n\n// hashes an ASCII string to a field element\nexport function hashASCIIStrToField(str: string, maxSizeBytes: number) {\n const textEncoder = new TextEncoder();\n const strBytes = textEncoder.encode(str);\n return hashBytesWithLen(strBytes, maxSizeBytes);\n}\n\nfunction hashBytesWithLen(bytes: Uint8Array, maxSizeBytes: number) {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Inputted bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const packed = padAndPackBytesWithLen(bytes, maxSizeBytes);\n return poseidonHash(packed);\n}\n\nfunction padAndPackBytesNoLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n const paddedStrBytes = padUint8ArrayWithZeros(bytes, maxSizeBytes);\n return packBytes(paddedStrBytes);\n}\n\nexport function padAndPackBytesWithLen(bytes: Uint8Array, maxSizeBytes: number): bigint[] {\n if (bytes.length > maxSizeBytes) {\n throw new Error(`Input bytes of length ${bytes} is longer than ${maxSizeBytes}`);\n }\n return padAndPackBytesNoLen(bytes, maxSizeBytes).concat([BigInt(bytes.length)]);\n}\n\nfunction packBytes(bytes: Uint8Array): bigint[] {\n if (bytes.length > MAX_NUM_INPUT_BYTES) {\n throw new Error(`Can't pack more than ${MAX_NUM_INPUT_BYTES}. Was given ${bytes.length} bytes`);\n }\n return chunkUint8Array(bytes, BYTES_PACKED_PER_SCALAR).map((chunk) => bytesToBigIntLE(chunk));\n}\n\nfunction chunkUint8Array(array: Uint8Array, chunkSize: number): Uint8Array[] {\n const result: Uint8Array[] = [];\n for (let i = 0; i < array.length; i += chunkSize) {\n result.push(array.subarray(i, i + chunkSize));\n }\n return result;\n}\n\nexport function bytesToBigIntLE(bytes: Uint8Array): bigint {\n let result = BigInt(0);\n for (let i = bytes.length - 1; i >= 0; i -= 1) {\n result = (result << BigInt(8)) | BigInt(bytes[i]);\n }\n return result;\n}\n\nexport function bigIntToBytesLE(value: bigint, length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n for (let i = 0; i < length; i += 1) {\n bytes[i] = Number(value & BigInt(0xff));\n // eslint-disable-next-line no-param-reassign\n value >>= BigInt(8);\n }\n return bytes;\n}\n\n// From chatGPT\nfunction padUint8ArrayWithZeros(inputArray: Uint8Array, paddedSize: number): Uint8Array {\n if (paddedSize < inputArray.length) {\n throw new Error(\"Padded size must be greater than or equal to the input array size.\");\n }\n\n // Create a new Uint8Array with the padded size\n const paddedArray = new Uint8Array(paddedSize);\n\n // Copy the content of the input array to the new array\n paddedArray.set(inputArray);\n\n // Fill the remaining space with zeros\n for (let i = inputArray.length; i < paddedSize; i += 1) {\n paddedArray[i] = 0;\n }\n\n return paddedArray;\n}\n\nexport function poseidonHash(inputs: (number | bigint | string)[]): bigint {\n const poseidonFixedHash = numInputsToPoseidonFunc[inputs.length - 1];\n\n if (poseidonFixedHash) {\n return poseidonFixedHash(inputs);\n }\n throw new Error(`Unable to hash input of length ${inputs.length}`);\n}\n"],"mappings":"AACA,OACE,aAAAA,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,aAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,EACA,cAAAC,MACK,gBAEP,IAAMC,EAA0B,CAC9BhB,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CACF,EAEME,EAA0B,GAC1BC,EAAwB,GACxBC,GAAuBD,EAAwB,GAAKD,EAGnD,SAASG,EAAoBC,EAAaC,EAAsB,CAErE,IAAMC,EADc,IAAI,YAAY,EACP,OAAOF,CAAG,EACvC,OAAOG,EAAiBD,EAAUD,CAAY,CAChD,CAEA,SAASE,EAAiBC,EAAmBH,EAAsB,CACjE,GAAIG,EAAM,OAASH,EACjB,MAAM,IAAI,MAAM,4BAA4BG,CAAK,mBAAmBH,CAAY,EAAE,EAEpF,IAAMI,EAASC,EAAuBF,EAAOH,CAAY,EACzD,OAAOM,EAAaF,CAAM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OAAO,CAAC,EAEpB,OAAOhB,CACT,CAGA,SAASM,EAAuBY,EAAwBC,EAAgC,CACtF,GAAIA,EAAaD,EAAW,OAC1B,MAAM,IAAI,MAAM,oEAAoE,EAItF,IAAME,EAAc,IAAI,WAAWD,CAAU,EAG7CC,EAAY,IAAIF,CAAU,EAG1B,QAASJ,EAAII,EAAW,OAAQJ,EAAIK,EAAYL,GAAK,EACnDM,EAAYN,CAAC,EAAI,EAGnB,OAAOM,CACT,CAEO,SAASjB,EAAakB,EAA8C,CACzE,IAAMC,EAAoB/B,EAAwB8B,EAAO,OAAS,CAAC,EAEnE,GAAIC,EACF,OAAOA,EAAkBD,CAAM,EAEjC,MAAM,IAAI,MAAM,kCAAkCA,EAAO,MAAM,EAAE,CACnE","names":["poseidon1","poseidon2","poseidon3","poseidon4","poseidon5","poseidon6","poseidon7","poseidon8","poseidon9","poseidon10","poseidon11","poseidon12","poseidon13","poseidon14","poseidon15","poseidon16","numInputsToPoseidonFunc","BYTES_PACKED_PER_SCALAR","MAX_NUM_INPUT_SCALARS","MAX_NUM_INPUT_BYTES","hashASCIIStrToField","str","maxSizeBytes","strBytes","hashBytesWithLen","bytes","packed","padAndPackBytesWithLen","poseidonHash","padAndPackBytesNoLen","paddedStrBytes","padUint8ArrayWithZeros","packBytes","chunkUint8Array","chunk","bytesToBigIntLE","array","chunkSize","result","i","bigIntToBytesLE","value","length","inputArray","paddedSize","paddedArray","inputs","poseidonFixedHash"]}
@@ -1,2 +1,2 @@
1
- import{m as g,v as a}from"./chunk-S4SEFF4K.mjs";import{b as n}from"./chunk-GXVUN32G.mjs";import{b as p,c}from"./chunk-YWQLLV2R.mjs";async function h(o){let{aptosConfig:t}=o,{data:e}=await n({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function l(o){let{aptosConfig:t,ledgerVersion:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function C(o){let{aptosConfig:t,blockHeight:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function m(o){let{aptosConfig:t,handle:e,data:s,options:r}=o;return(await p({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:s})).data}async function T(o){let{aptosConfig:t,limit:e}=o;return(await i({aptosConfig:t,query:{query:g,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function i(o){let{aptosConfig:t,query:e,originMethod:s}=o,{data:r}=await c({aptosConfig:t,originMethod:s??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(o){let{aptosConfig:t}=o;return(await i({aptosConfig:t,query:{query:a},originMethod:"getProcessorStatuses"})).processor_status}async function q(o){let t=await f({aptosConfig:o.aptosConfig});return BigInt(t[0].last_success_version)}async function b(o){let{aptosConfig:t,processorType:e}=o;return(await i({aptosConfig:t,query:{query:a,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{h as a,l as b,C as c,m as d,T as e,i as f,f as g,q as h,b as i};
2
- //# sourceMappingURL=chunk-Y5M5DD64.mjs.map
1
+ import{m as g,v as a}from"./chunk-S4SEFF4K.mjs";import{b as n}from"./chunk-42ZSGMQO.mjs";import{b as p,c}from"./chunk-JZ7UTFTR.mjs";async function h(o){let{aptosConfig:t}=o,{data:e}=await n({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function l(o){let{aptosConfig:t,ledgerVersion:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function C(o){let{aptosConfig:t,blockHeight:e,options:s}=o,{data:r}=await n({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:s?.withTransactions}});return r}async function m(o){let{aptosConfig:t,handle:e,data:s,options:r}=o;return(await p({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:s})).data}async function T(o){let{aptosConfig:t,limit:e}=o;return(await i({aptosConfig:t,query:{query:g,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function i(o){let{aptosConfig:t,query:e,originMethod:s}=o,{data:r}=await c({aptosConfig:t,originMethod:s??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(o){let{aptosConfig:t}=o;return(await i({aptosConfig:t,query:{query:a},originMethod:"getProcessorStatuses"})).processor_status}async function q(o){let t=await f({aptosConfig:o.aptosConfig});return BigInt(t[0].last_success_version)}async function b(o){let{aptosConfig:t,processorType:e}=o;return(await i({aptosConfig:t,query:{query:a,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{h as a,l as b,C as c,m as d,T as e,i as f,f as g,q as h,b as i};
2
+ //# sourceMappingURL=chunk-GSOKKQQ7.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-52C73T26.mjs";import{b as r}from"./chunk-AOCNYMMX.mjs";var t=class extends e{toString(){let n=this.toUint8Array();return r.fromHexInput(n).toString()}},a=class extends t{};export{t as a,a as b};
2
- //# sourceMappingURL=chunk-WFZDFFBM.mjs.map
1
+ import{a as e}from"./chunk-52DBSOFA.mjs";import{b as r}from"./chunk-AOCNYMMX.mjs";var t=class extends e{toString(){let n=this.toUint8Array();return r.fromHexInput(n).toString()}},a=class extends t{};export{t as a,a as b};
2
+ //# sourceMappingURL=chunk-HZC6A3QL.mjs.map
@@ -0,0 +1,2 @@
1
+ var t="1.13.1-zeta.2";export{t as a};
2
+ //# sourceMappingURL=chunk-IMGPWY3W.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.13.0\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
1
+ {"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"1.13.1-zeta.2\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
@@ -1,2 +1,2 @@
1
- import{b as l,c as f,d as x,e as v,f as U,g as A,h as P,i as C,j as y,k as E,l as b,m as I,n as G,o as M}from"./chunk-DMKUAQB7.mjs";import{a as d}from"./chunk-DSTKXJMA.mjs";import{b as w}from"./chunk-IOSQVDZI.mjs";function N(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function V(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e,n){let i=n;for(;i<e.length;i+=1){let c=e[i];if(!V(c))break}return i}var S=(t=>(t.InvalidTypeTag="unknown type",t.UnexpectedGenericType="unexpected generic type",t.UnexpectedTypeArgumentClose="unexpected '>'",t.UnexpectedWhitespaceCharacter="unexpected whitespace character",t.UnexpectedComma="unexpected ','",t.TypeArgumentCountMismatch="type argument count doesn't match expected amount",t.MissingTypeArgumentClose="no matching '>' for '<'",t.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",t.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",t.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",t.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",t.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",t))(S||{}),r=class extends Error{constructor(n,i){super(`Failed to parse typeTag '${n}', ${i}`)}};function Z(e,n){let i=n?.allowGenerics??!1,c=[],o=[],p=[],T=0,a="",u=1;for(;T<e.length;){let g=e[T];if(g==="<")c.push({savedExpectedTypes:u,savedStr:a,savedTypes:p}),a="",p=[],u=1;else if(g===">"){if(a!==""){let _=m(a,o,i);p.push(_)}let s=c.pop();if(s===void 0)throw new r(e,"unexpected '>'");if(u!==p.length)throw new r(e,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:t,savedExpectedTypes:W}=s;o=p,p=t,a=h,u=W}else if(g===","){if(a.length!==0){let s=m(a,o,i);o=[],p.push(s),a="",u+=1}}else if(V(g)){let s=!1;if(a.length!==0){let t=m(a,o,i);o=[],p.push(t),a="",s=!0}T=F(e,T);let h=e[T];if(T<e.length&&s&&h!==","&&h!==">")throw new r(e,"unexpected whitespace character");continue}else a+=g;T+=1}if(c.length>0)throw new r(e,"no matching '>' for '<'");switch(p.length){case 0:return m(a,o,i);case 1:if(a==="")return p[0];throw new r(e,"unexpected ','");default:throw new r(e,"unexpected whitespace character")}}function m(e,n,i){switch(e){case"&signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new E(new y);case"signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new y;case"bool":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new l;case"address":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new C;case"u8":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new f;case"u16":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new x;case"u32":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new v;case"u64":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new U;case"u128":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new A;case"u256":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new P;case"vector":if(n.length!==1)throw new r(e,"vector type expected to have exactly one type argument");return new I(n[0]);default:if($(e)){if(i)return new b(Number(e.split("T")[1]));throw new r(e,"unexpected generic type")}if(!e.match(/:/))throw new r(e,"unknown type");let c=e.split("::");if(c.length!==3)throw new r(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!N(c[1]))throw new r(e,"module name must only contain alphanumeric or '_' characters");if(!N(c[2]))throw new r(e,"struct name must only contain alphanumeric or '_' characters");return new G(new M(w.fromString(c[0]),new d(c[1]),new d(c[2]),n))}}export{S as a,r as b,Z as c};
2
- //# sourceMappingURL=chunk-U43IJHQN.mjs.map
1
+ import{b as l,c as f,d as x,e as v,f as U,g as A,h as P,i as C,j as y,k as E,l as b,m as I,n as G,o as M}from"./chunk-Q225PZMV.mjs";import{a as d}from"./chunk-RM7D2ITN.mjs";import{b as w}from"./chunk-U7EZI5D5.mjs";function N(e){return!!e.match(/^[_a-zA-Z0-9]+$/)}function V(e){return!!e.match(/\s/)}function $(e){return!!e.match(/^T[0-9]+$/)}function F(e,n){let i=n;for(;i<e.length;i+=1){let c=e[i];if(!V(c))break}return i}var S=(t=>(t.InvalidTypeTag="unknown type",t.UnexpectedGenericType="unexpected generic type",t.UnexpectedTypeArgumentClose="unexpected '>'",t.UnexpectedWhitespaceCharacter="unexpected whitespace character",t.UnexpectedComma="unexpected ','",t.TypeArgumentCountMismatch="type argument count doesn't match expected amount",t.MissingTypeArgumentClose="no matching '>' for '<'",t.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",t.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",t.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",t.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",t.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",t))(S||{}),r=class extends Error{constructor(n,i){super(`Failed to parse typeTag '${n}', ${i}`)}};function Z(e,n){let i=n?.allowGenerics??!1,c=[],o=[],p=[],T=0,a="",u=1;for(;T<e.length;){let g=e[T];if(g==="<")c.push({savedExpectedTypes:u,savedStr:a,savedTypes:p}),a="",p=[],u=1;else if(g===">"){if(a!==""){let _=m(a,o,i);p.push(_)}let s=c.pop();if(s===void 0)throw new r(e,"unexpected '>'");if(u!==p.length)throw new r(e,"type argument count doesn't match expected amount");let{savedStr:h,savedTypes:t,savedExpectedTypes:W}=s;o=p,p=t,a=h,u=W}else if(g===","){if(a.length!==0){let s=m(a,o,i);o=[],p.push(s),a="",u+=1}}else if(V(g)){let s=!1;if(a.length!==0){let t=m(a,o,i);o=[],p.push(t),a="",s=!0}T=F(e,T);let h=e[T];if(T<e.length&&s&&h!==","&&h!==">")throw new r(e,"unexpected whitespace character");continue}else a+=g;T+=1}if(c.length>0)throw new r(e,"no matching '>' for '<'");switch(p.length){case 0:return m(a,o,i);case 1:if(a==="")return p[0];throw new r(e,"unexpected ','");default:throw new r(e,"unexpected whitespace character")}}function m(e,n,i){switch(e){case"&signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new E(new y);case"signer":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new y;case"bool":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new l;case"address":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new C;case"u8":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new f;case"u16":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new x;case"u32":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new v;case"u64":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new U;case"u128":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new A;case"u256":if(n.length>0)throw new r(e,"primitive types not expected to have type arguments");return new P;case"vector":if(n.length!==1)throw new r(e,"vector type expected to have exactly one type argument");return new I(n[0]);default:if($(e)){if(i)return new b(Number(e.split("T")[1]));throw new r(e,"unexpected generic type")}if(!e.match(/:/))throw new r(e,"unknown type");let c=e.split("::");if(c.length!==3)throw new r(e,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!N(c[1]))throw new r(e,"module name must only contain alphanumeric or '_' characters");if(!N(c[2]))throw new r(e,"struct name must only contain alphanumeric or '_' characters");return new G(new M(w.fromString(c[0]),new d(c[1]),new d(c[2]),n))}}export{S as a,r as b,Z as c};
2
+ //# sourceMappingURL=chunk-IVBYTTN7.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-ZPNCA4C7.mjs";import{a as c}from"./chunk-AP7UZTPZ.mjs";import{b as i}from"./chunk-Y2VA7F5D.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-G2QII3AT.mjs.map
1
+ import{a as n}from"./chunk-JTFH6ACV.mjs";import{a as c}from"./chunk-AKW2HAKU.mjs";import{b as i}from"./chunk-ZSZCPOHE.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-IXA3IGQT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/Account.ts"],"sourcesContent":["import type { AccountAuthenticator } from \"../transactions/authenticator/account\";\nimport { HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport type { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { AuthenticationKey } from \"../core/authenticationKey\";\nimport { AccountPublicKey, Ed25519PrivateKey, PrivateKey, Signature, VerifySignatureArgs } from \"../core/crypto\";\nimport { Ed25519Account } from \"./Ed25519Account\";\nimport { SingleKeyAccount } from \"./SingleKeyAccount\";\nimport { AnyRawTransaction } from \"../transactions/types\";\n\n/**\n * Arguments for creating an `Ed25519Account` from an `Ed25519PrivateKey`.\n * This is the default input type when passing an `Ed25519PrivateKey`.\n * In order to use the SingleKey authentication scheme, `legacy` needs to be explicitly set to false.\n */\nexport interface CreateEd25519AccountFromPrivateKeyArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n legacy?: true;\n}\n\n/**\n * Arguments for creating an `SingleKeyAccount` from an `Ed25519PrivateKey`.\n * The `legacy` argument needs to be explicitly set to false in order to\n * use the `SingleKey` authentication scheme.\n */\nexport interface CreateEd25519SingleKeyAccountFromPrivateKeyArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n legacy: false;\n}\n\n/**\n * Arguments for creating an `SingleKeyAccount` from any supported private key\n * that is not an `Ed25519PrivateKey`.\n * The `legacy` argument defaults to false and cannot be explicitly set to true.\n */\nexport interface CreateSingleKeyAccountFromPrivateKeyArgs {\n privateKey: Exclude<PrivateKey, Ed25519PrivateKey>;\n address?: AccountAddressInput;\n legacy?: false;\n}\n\n/**\n * Arguments for creating an opaque `Account` from any supported private key.\n * This is used when the private key type is not known at compilation time.\n */\nexport interface CreateAccountFromPrivateKeyArgs {\n privateKey: PrivateKey;\n address?: AccountAddressInput;\n legacy?: boolean;\n}\n\n/**\n * Arguments for generating an `Ed25519Account`.\n * This is the input type used by default.\n */\nexport interface GenerateEd25519AccountArgs {\n scheme?: SigningSchemeInput.Ed25519;\n legacy?: true;\n}\n\n/**\n * Arguments for generating an `SingleKeyAccount` with ah underlying `Ed25519PrivateKey`.\n * The `legacy` argument needs to be explicitly set to false,\n * otherwise an `Ed25519Account` will be returned instead.\n */\nexport interface GenerateEd25519SingleKeyAccountArgs {\n scheme?: SigningSchemeInput.Ed25519;\n legacy: false;\n}\n\n/**\n * Arguments for generating an `SingleKeyAccount` with any supported private key\n * that is not an `Ed25519PrivateKey`.\n * The `legacy` argument defaults to false and cannot be explicitly set to true.\n */\nexport interface GenerateSingleKeyAccountArgs {\n scheme: Exclude<SigningSchemeInput, SigningSchemeInput.Ed25519>;\n legacy?: false;\n}\n\n/**\n * Arguments for generating an opaque `Account`.\n * This is used when the input signature scheme is not known at compilation time.\n */\nexport interface GenerateAccountArgs {\n scheme?: SigningSchemeInput;\n legacy?: boolean;\n}\n\n/**\n * Arguments for deriving a private key from a mnemonic phrase and a BIP44 path.\n */\nexport interface PrivateKeyFromDerivationPathArgs {\n path: string;\n mnemonic: string;\n}\n\n/**\n * Interface for a generic Aptos account.\n *\n * The interface is defined as abstract class to provide a single entrypoint for account generation,\n * either through `Account.generate()` or `Account.fromDerivationPath`.\n * Despite this being an abstract class, it should be treated as an interface and enforced using\n * the `implements` keyword.\n *\n * Note: Generating an account instance does not create the account on-chain.\n */\nexport abstract class Account {\n /**\n * Public key associated with the account\n */\n abstract readonly publicKey: AccountPublicKey;\n\n /**\n * Account address associated with the account\n */\n abstract readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n abstract signingScheme: SigningScheme;\n\n /**\n * Derives an account from a randomly generated private key.\n * @param args.scheme The signature scheme to use, to generate the private key\n * @param args.legacy Whether to use a legacy authentication scheme, when applicable\n * @returns An account compatible with the provided signature scheme\n */\n static generate(args?: GenerateEd25519AccountArgs): Ed25519Account;\n static generate(args: GenerateEd25519SingleKeyAccountArgs): SingleKeyAccount;\n static generate(args: GenerateSingleKeyAccountArgs): SingleKeyAccount;\n static generate(args: GenerateAccountArgs): Account;\n static generate(args: GenerateAccountArgs = {}) {\n const { scheme = SigningSchemeInput.Ed25519, legacy = true } = args;\n if (scheme === SigningSchemeInput.Ed25519 && legacy) {\n return Ed25519Account.generate();\n }\n return SingleKeyAccount.generate({ scheme });\n }\n\n /**\n * Creates an account from the provided private key.\n *\n * @param args.privateKey a valid private key\n * @param args.address the account's address. If not provided, it will be derived from the public key.\n * @param args.legacy Whether to use a legacy authentication scheme, when applicable\n */\n static fromPrivateKey(args: CreateEd25519AccountFromPrivateKeyArgs): Ed25519Account;\n static fromPrivateKey(args: CreateEd25519SingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;\n static fromPrivateKey(args: CreateSingleKeyAccountFromPrivateKeyArgs): SingleKeyAccount;\n static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs): Account;\n static fromPrivateKey(args: CreateAccountFromPrivateKeyArgs) {\n const { privateKey, address, legacy = true } = args;\n if (privateKey instanceof Ed25519PrivateKey && legacy) {\n return new Ed25519Account({\n privateKey,\n address,\n });\n }\n return new SingleKeyAccount({ privateKey, address });\n }\n\n /**\n * @deprecated use `fromPrivateKey` instead.\n * Instantiates an account given a private key and a specified account address.\n * This is primarily used to instantiate an `Account` that has had its authentication key rotated.\n *\n * @param args.privateKey PrivateKey - the underlying private key for the account\n * @param args.address AccountAddress - The account address the `Account` will sign for\n * @param args.legacy optional. If set to false, the keypair generated is a Unified keypair. Defaults\n * to generating a Legacy Ed25519 keypair\n *\n * @returns Account\n */\n static fromPrivateKeyAndAddress(args: CreateAccountFromPrivateKeyArgs) {\n return this.fromPrivateKey(args);\n }\n\n /**\n * Derives an account with bip44 path and mnemonics\n *\n * @param args.scheme The signature scheme to derive the private key with\n * @param args.path the BIP44 derive hardened path (e.g. m/44'/637'/0'/0'/0') for Ed25519,\n * or non-hardened path (e.g. m/44'/637'/0'/0/0) for secp256k1\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic the mnemonic seed phrase of the account\n */\n static fromDerivationPath(args: GenerateEd25519AccountArgs & PrivateKeyFromDerivationPathArgs): Ed25519Account;\n static fromDerivationPath(\n args: GenerateEd25519SingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs,\n ): SingleKeyAccount;\n static fromDerivationPath(args: GenerateSingleKeyAccountArgs & PrivateKeyFromDerivationPathArgs): SingleKeyAccount;\n static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs): Account;\n static fromDerivationPath(args: GenerateAccountArgs & PrivateKeyFromDerivationPathArgs) {\n const { scheme = SigningSchemeInput.Ed25519, mnemonic, path, legacy = true } = args;\n if (scheme === SigningSchemeInput.Ed25519 && legacy) {\n return Ed25519Account.fromDerivationPath({ mnemonic, path });\n }\n return SingleKeyAccount.fromDerivationPath({ scheme, mnemonic, path });\n }\n\n /**\n * @deprecated use `publicKey.authKey()` instead.\n * This key enables account owners to rotate their private key(s)\n * associated with the account without changing the address that hosts their account.\n * See here for more info: {@link https://aptos.dev/concepts/accounts#single-signer-authentication}\n *\n * @param args.publicKey PublicKey - public key of the account\n * @returns The authentication key for the associated account\n */\n static authKey(args: { publicKey: AccountPublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return publicKey.authKey();\n }\n\n /**\n * Sign a transaction using the available signing capabilities.\n * @param transaction the raw transaction\n * @return the AccountAuthenticator containing the signature og the transaction, together with the account's public key\n */\n abstract signWithAuthenticator(transaction: AnyRawTransaction): AccountAuthenticator;\n\n /**\n * Sign the given message with the private key.\n * @param message in HexInput format\n * @returns AccountSignature\n */\n abstract sign(message: HexInput): Signature;\n\n abstract signTransaction(transaction: AnyRawTransaction): Signature;\n\n /**\n * @param args.message raw message data in HexInput format\n * @param args.signature signed message signature\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n}\n"],"mappings":"2HA4GO,IAAeA,EAAf,KAAuB,CA0B5B,OAAO,SAASC,EAA4B,CAAC,EAAG,CAC9C,GAAM,CAAE,OAAAC,IAAqC,OAAAC,EAAS,EAAK,EAAIF,EAC/D,OAAIC,IAAW,GAA8BC,EACpCC,EAAe,SAAS,EAE1BC,EAAiB,SAAS,CAAE,OAAAH,CAAO,CAAC,CAC7C,CAaA,OAAO,eAAeD,EAAuC,CAC3D,GAAM,CAAE,WAAAK,EAAY,QAAAC,EAAS,OAAAJ,EAAS,EAAK,EAAIF,EAC/C,OAAIK,aAAsBE,GAAqBL,EACtC,IAAIC,EAAe,CACxB,WAAAE,EACA,QAAAC,CACF,CAAC,EAEI,IAAIF,EAAiB,CAAE,WAAAC,EAAY,QAAAC,CAAQ,CAAC,CACrD,CAcA,OAAO,yBAAyBN,EAAuC,CACrE,OAAO,KAAK,eAAeA,CAAI,CACjC,CAiBA,OAAO,mBAAmBA,EAA8D,CACtF,GAAM,CAAE,OAAAC,IAAqC,SAAAO,EAAU,KAAAC,EAAM,OAAAP,EAAS,EAAK,EAAIF,EAC/E,OAAIC,IAAW,GAA8BC,EACpCC,EAAe,mBAAmB,CAAE,SAAAK,EAAU,KAAAC,CAAK,CAAC,EAEtDL,EAAiB,mBAAmB,CAAE,OAAAH,EAAQ,SAAAO,EAAU,KAAAC,CAAK,CAAC,CACvE,CAWA,OAAO,QAAQT,EAA0D,CACvE,GAAM,CAAE,UAAAU,CAAU,EAAIV,EACtB,OAAOU,EAAU,QAAQ,CAC3B,CAsBA,gBAAgBV,EAAoC,CAClD,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CACF","names":["Account","args","scheme","legacy","Ed25519Account","SingleKeyAccount","privateKey","address","Ed25519PrivateKey","mnemonic","path","publicKey"]}
@@ -1,2 +1,2 @@
1
- import{a as e}from"./chunk-QW3VNZJ7.mjs";import{a as n,b as s,c as r,d as i,e as o,f as a,g as c,h as p,i as d,j as g,k as u,l as A,m as y,n as l,o as m,p as T,q as f,r as I,s as C,t as O,u as P,v as D}from"./chunk-VM3EJYJU.mjs";var V=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),p({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),n({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),s({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),r({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return o({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return d({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return u({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return A({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return y({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return T({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return f({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return I({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return D({aptosConfig:this.config,...t})}};export{V as a};
2
- //# sourceMappingURL=chunk-IA6XM7QE.mjs.map
1
+ import{a as n,b as s,c as r,d as i,e as o,f as a,g as c,h as p,i as d,j as g,k as u,l as A,m as y,n as l,o as m,p as T,q as f,r as I,s as C,t as O,u as P,v as D}from"./chunk-7BT2KH4T.mjs";import{a as e}from"./chunk-55W7VV7Z.mjs";var V=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),p({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),n({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),s({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),r({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return o({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return d({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return u({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return A({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return y({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return T({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return f({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return I({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return D({aptosConfig:this.config,...t})}};export{V as a};
2
+ //# sourceMappingURL=chunk-JIX5F3BC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/digitalAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AnyNumber,\n GetCollectionDataResponse,\n GetCurrentTokenOwnershipResponse,\n GetOwnedTokensResponse,\n GetTokenActivityResponse,\n GetTokenDataResponse,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n} from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { Account } from \"../account\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport {\n addDigitalAssetPropertyTransaction,\n addDigitalAssetTypedPropertyTransaction,\n burnDigitalAssetTransaction,\n CreateCollectionOptions,\n createCollectionTransaction,\n freezeDigitalAssetTransferTransaction,\n getCollectionData,\n getCollectionDataByCollectionId,\n getCollectionId,\n getCurrentDigitalAssetOwnership,\n getDigitalAssetActivity,\n getDigitalAssetData,\n getOwnedDigitalAssets,\n mintDigitalAssetTransaction,\n mintSoulBoundTransaction,\n PropertyType,\n PropertyValue,\n removeDigitalAssetPropertyTransaction,\n setDigitalAssetDescriptionTransaction,\n setDigitalAssetNameTransaction,\n setDigitalAssetURITransaction,\n transferDigitalAssetTransaction,\n unfreezeDigitalAssetTransferTransaction,\n updateDigitalAssetPropertyTransaction,\n updateDigitalAssetTypedPropertyTransaction,\n} from \"../internal/digitalAsset\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * A class to query all `DigitalAsset` related queries on Aptos.\n */\nexport class DigitalAsset {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries data of a specific collection by the collection creator address and the collection name.\n *\n * If, for some reason, a creator account has 2 collections with the same name in v1 and v2,\n * can pass an optional `tokenStandard` parameter to query a specific standard\n *\n * @example\n * const collection = await aptos.getCollectionData({creatorAddress:\"0x123\",collectionName:\"myCollection\"})\n *\n * @param args.creatorAddress the address of the collection's creator\n * @param args.collectionName the name of the collection\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard the token standard to query\n * @returns GetCollectionDataResponse response type\n */\n async getCollectionData(args: {\n creatorAddress: AccountAddressInput;\n collectionName: string;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg;\n }): Promise<GetCollectionDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCollectionData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries data of a specific collection by the collection ID.\n *\n * @example\n * const collection = await aptos.getCollectionDataByCollectionId({collectionId:\"0x123\"})\n *\n * @param args.collectionId the ID of the collection, it's the same thing as the address of the collection object\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns GetCollectionDataResponse response type\n */\n async getCollectionDataByCollectionId(args: {\n collectionId: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetCollectionDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCollectionDataByCollectionId({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a collection's ID.\n *\n * This is the same as the collection's object address in V2, but V1 does\n * not use objects, and does not have an address\n *\n * @example\n * const collection = await aptos.getCollectionId({creatorAddress:\"0x123\",collectionName:\"myCollection\"})\n *\n * @param args.creatorAddress the address of the collection's creator\n * @param args.collectionName the name of the collection\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard the token standard to query\n * @returns the collection id\n */\n async getCollectionId(args: {\n creatorAddress: AccountAddressInput;\n collectionName: string;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg;\n }): Promise<string> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCollectionId({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets digital asset data given the address of a digital asset.\n *\n * @example\n * const digitalAsset = await aptos.getDigitalAssetData({digitalAssetAddress:\"0x123\"})\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns GetTokenDataResponse containing relevant data to the digital asset.\n */\n async getDigitalAssetData(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetTokenDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getDigitalAssetData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets digital asset ownership data given the address of a digital asset.\n *\n * @example\n * const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({digitalAssetAddress:\"0x123\"})\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.\n */\n async getCurrentDigitalAssetOwnership(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetCurrentTokenOwnershipResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCurrentDigitalAssetOwnership({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets the digital assets that the given address owns.\n *\n * @example\n * const digitalAssets = await aptos.getOwnedDigitalAssets({ownerAddress:\"0x123\"})\n *\n * @param args.ownerAddress The address of the owner\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddresss.\n */\n async getOwnedDigitalAssets(args: {\n ownerAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetOwnedTokensResponse[0]>;\n }): Promise<GetOwnedTokensResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getOwnedDigitalAssets({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets the activity data given the address of a digital asset.\n *\n * @example\n * const digitalAssetActivity = await aptos.getDigitalAssetActivity({digitalAssetAddress:\"0x123\"})\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetTokenActivityResponse containing relevant activity data to the digital asset.\n */\n async getDigitalAssetActivity(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;\n }): Promise<GetTokenActivityResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getDigitalAssetActivity({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Creates a new collection within the specified account\n *\n * @example\n * const transaction = await aptos.createCollectionTransaction({\n * creator: alice,\n * description: \"collectionDescription\",\n * name: \"collectionName\",\n * uri: \"collection-uri.com\",\n * });\n *\n * @param args.creator the account of the collection's creator\n * @param args.description the description of the collection\n * @param args.name the name of the collection\n * @param args.uri the URI to additional info about the collection\n *\n * The parameters below are optional.\n * @param args.maxSupply controls the max supply of the digital assets - defaults MAX_U64_BIG_INT\n * @param args.mutableDescription controls mutability of the collection's description - defaults true\n * @param args.mutableRoyalty controls mutability of the collection's description - defaults true\n * @param args.mutableUri controls mutability of the collection's URI - defaults true\n * @param args.mutableTokenDescription controls mutability of the digital asset's description - defaults true\n * @param args.mutableTokenName controls mutability of the digital asset's name - defaults true\n * @param args.mutableTokenProperties controls mutability of digital asset's properties - defaults true\n * @param args.mutableTokenUri controls mutability of the digital asset's URI - defaults true\n * @param args.tokensBurnableByCreator controls whether digital assets can be burnable by the creator - defaults true\n * @param args.tokensFreezableByCreator controls whether digital assets can be frozen by the creator - defaults true\n * @param args.royaltyNumerator the numerator of the royalty to be paid to the creator when\n * a digital asset is transferred - defaults 0\n * @param args.royaltyDenominator the denominator of the royalty to be paid to the creator\n * when a digital asset is transferred - defaults 1\n *\n * @returns A SimpleTransaction that when submitted will create the collection.\n */\n async createCollectionTransaction(\n args: {\n creator: Account;\n description: string;\n name: string;\n uri: string;\n options?: InputGenerateTransactionOptions;\n } & CreateCollectionOptions,\n ): Promise<SimpleTransaction> {\n return createCollectionTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Create a transaction to mint a digital asset into the creators account within an existing collection.\n *\n * @example\n * const transaction = await aptos.mintDigitalAssetTransaction({\n * creator: alice,\n * description: \"collectionDescription\",\n * collection: \"collectionName\",\n * name: \"digitalAssetName\",\n * uri: \"digital-asset-uri.com\",\n * });\n *\n * @param args.creator the creator of the collection\n * @param args.collection the name of the collection the digital asset belongs to\n * @param args.description the description of the digital asset\n * @param args.name the name of the digital asset\n * @param args.uri the URI to additional info about the digital asset\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async mintDigitalAssetTransaction(args: {\n creator: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return mintDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Transfer a digital asset (non fungible digital asset) ownership.\n *\n * We can transfer a digital asset only when the digital asset is not frozen\n * (i.e. owner transfer is not disabled such as for soul bound digital assets)\n *\n * @example\n * const transaction = await aptos.transferDigitalAssetTransaction({\n * sender: alice,\n * digitalAssetAddress: \"0x123\",\n * recipient: \"0x456\",\n * });\n *\n * @param args.sender The sender account of the current digital asset owner\n * @param args.digitalAssetAddress The digital asset address\n * @param args.recipient The recipient account address\n * @param args.digitalAssetType optional. The digital asset type, default to \"0x4::token::Token\"\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async transferDigitalAssetTransaction(args: {\n sender: Account;\n digitalAssetAddress: AccountAddressInput;\n recipient: AccountAddress;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Mint a soul bound digital asset into a recipient's account\n *\n * @example\n * const transaction = await aptos.mintSoulBoundTransaction({\n * account: alice,\n * collection: \"collectionName\",\n * description: \"collectionDescription\",\n * name: \"digitalAssetName\",\n * uri: \"digital-asset-uri.com\",\n * recipient: \"0x123\"\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.collection The collection name that the digital asset belongs to\n * @param args.description The digital asset description\n * @param args.name The digital asset name\n * @param args.uri The digital asset URL\n * @param args.recipient The account address where the digital asset will be created\n * @param args.propertyKeys The property keys for storing on-chain properties\n * @param args.propertyTypes The type of property values\n * @param args.propertyValues The property values to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async mintSoulBoundTransaction(args: {\n account: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n recipient: AccountAddressInput;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return mintSoulBoundTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Burn a digital asset by its creator\n *\n * @example\n * const transaction = await aptos.burnDigitalAssetTransaction({\n * creator: alice,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async burnDigitalAssetTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return burnDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Freeze digital asset transfer ability\n *\n * @example\n * const transaction = await aptos.freezeDigitalAssetTransaferTransaction({\n * creator: alice,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async freezeDigitalAssetTransaferTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return freezeDigitalAssetTransferTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Unfreeze digital asset transfer ability\n *\n * @example\n * const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({\n * creator: alice,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async unfreezeDigitalAssetTransaferTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return unfreezeDigitalAssetTransferTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset description\n *\n * @example\n * const transaction = await aptos.setDigitalAssetDescriptionTransaction({\n * creator: alice,\n * description: \"digitalAssetDescription\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.description The digital asset description\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetDescriptionTransaction(args: {\n creator: Account;\n description: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetDescriptionTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset name\n *\n * @example\n * const transaction = await aptos.setDigitalAssetNameTransaction({\n * creator: alice,\n * name: \"digitalAssetName\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.name The digital asset name\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetNameTransaction(args: {\n creator: Account;\n name: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetNameTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset name\n *\n * @example\n * const transaction = await aptos.setDigitalAssetURITransaction({\n * creator: alice,\n * uri: \"digital-asset-uri.com\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.uri The digital asset uri\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetURITransaction(args: {\n creator: Account;\n uri: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetURITransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Add a digital asset property\n *\n * @example\n * const transaction = await aptos.addDigitalAssetPropertyTransaction({\n * creator: alice,\n * propertyKey: \"newKey\",\n * propertyType: \"BOOLEAN\",\n * propertyValue: true,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async addDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return addDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Remove a digital asset property\n *\n * @example\n * const transaction = await aptos.removeDigitalAssetPropertyTransaction({\n * creator: alice,\n * propertyKey: \"newKey\",\n * propertyType: \"BOOLEAN\",\n * propertyValue: true,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async removeDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return removeDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Update a digital asset property\n *\n * @example\n * const transaction = await aptos.updateDigitalAssetPropertyTransaction({\n * creator: alice,\n * propertyKey: \"newKey\",\n * propertyType: \"BOOLEAN\",\n * propertyValue: false,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async updateDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return updateDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Add a typed digital asset property\n *\n * @example\n * const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({\n * creator: alice,\n * propertyKey: \"typedKey\",\n * propertyType: \"STRING\",\n * propertyValue: \"hello\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async addDigitalAssetTypedPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return addDigitalAssetTypedPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Update a typed digital asset property\n *\n * @example\n * const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({\n * creator: alice,\n * propertyKey: \"typedKey\",\n * propertyType: \"U8\",\n * propertyValue: 2,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async updateDigitalAssetTypedPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return updateDigitalAssetTypedPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"qOAqDO,IAAMA,EAAN,KAAmB,CACxB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAiB3C,MAAM,kBAAkBC,EAKe,CACrC,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,kCACF,CAAC,EACME,EAAkB,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,CAChE,CAYA,MAAM,gCAAgCA,EAGC,CACrC,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,kCACF,CAAC,EACMG,EAAgC,CAAE,YAAa,KAAK,OAAQ,GAAGH,CAAK,CAAC,CAC9E,CAiBA,MAAM,gBAAgBA,EAKF,CAClB,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,kCACF,CAAC,EACMI,EAAgB,CAAE,YAAa,KAAK,OAAQ,GAAGJ,CAAK,CAAC,CAC9D,CAYA,MAAM,oBAAoBA,EAGQ,CAChC,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,kCACF,CAAC,EACMK,EAAoB,CAAE,YAAa,KAAK,OAAQ,GAAGL,CAAK,CAAC,CAClE,CAaA,MAAM,gCAAgCA,EAGQ,CAC5C,aAAMC,E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B,EAAsC,CAAE,YAAa,KAAK,OAAQ,GAAGhB,CAAK,CAAC,CACpF,CAkBA,MAAM,+BAA+BA,EAMlC,CACD,OAAOiB,EAA+B,CAAE,YAAa,KAAK,OAAQ,GAAGjB,CAAK,CAAC,CAC7E,CAkBA,MAAM,8BAA8BA,EAMjC,CACD,OAAOkB,EAA8B,CAAE,YAAa,KAAK,OAAQ,GAAGlB,CAAK,CAAC,CAC5E,CAsBA,MAAM,mCAAmCA,EAQtC,CACD,OAAOmB,EAAmC,CAAE,YAAa,KAAK,OAAQ,GAAGnB,CAAK,CAAC,CACjF,CAsBA,MAAM,sCAAsCA,EAQzC,CACD,OAAOoB,EAAsC,CAAE,YAAa,KAAK,OAAQ,GAAGpB,CAAK,CAAC,CACpF,CAsBA,MAAM,sCAAsCA,EAQzC,CACD,OAAOqB,EAAsC,CAAE,YAAa,KAAK,OAAQ,GAAGrB,CAAK,CAAC,CACpF,CAsBA,MAAM,wCAAwCA,EAQ3C,CACD,OAAOsB,EAAwC,CAAE,YAAa,KAAK,OAAQ,GAAGtB,CAAK,CAAC,CACtF,CAsBA,MAAM,2CAA2CA,EAQ9C,CACD,OAAOuB,EAA2C,CAAE,YAAa,KAAK,OAAQ,GAAGvB,CAAK,CAAC,CACzF,CACF","names":["DigitalAsset","config","args","waitForIndexerOnVersion","getCollectionData","getCollectionDataByCollectionId","getCollectionId","getDigitalAssetData","getCurrentDigitalAssetOwnership","getOwnedDigitalAssets","getDigitalAssetActivity","createCollectionTransaction","mintDigitalAssetTransaction","transferDigitalAssetTransaction","mintSoulBoundTransaction","burnDigitalAssetTransaction","freezeDigitalAssetTransferTransaction","unfreezeDigitalAssetTransferTransaction","setDigitalAssetDescriptionTransaction","setDigitalAssetNameTransaction","setDigitalAssetURITransaction","addDigitalAssetPropertyTransaction","removeDigitalAssetPropertyTransaction","updateDigitalAssetPropertyTransaction","addDigitalAssetTypedPropertyTransaction","updateDigitalAssetTypedPropertyTransaction"]}
@@ -0,0 +1,2 @@
1
+ import{d as i}from"./chunk-S5YUB2BI.mjs";import{b as o}from"./chunk-Z5GI2A3I.mjs";import{b as n}from"./chunk-ZSZCPOHE.mjs";import{b as a}from"./chunk-U7EZI5D5.mjs";var c=class s{constructor(e){this.signingScheme=0;let{privateKey:r,address:t}=e;this.privateKey=r,this.publicKey=r.publicKey(),this.accountAddress=t?a.from(t):this.publicKey.authKey().derivedAddress()}static generate(){let e=n.generate();return new s({privateKey:e})}static fromDerivationPath(e){let{path:r,mnemonic:t}=e,u=n.fromDerivationPath(r,t);return new s({privateKey:u})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){let r=this.privateKey.sign(i(e));return new o(this.publicKey,r)}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(i(e))}};export{c as a};
2
+ //# sourceMappingURL=chunk-JTFH6ACV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/account/Ed25519Account.ts"],"sourcesContent":["import { AccountAuthenticatorEd25519 } from \"../transactions/authenticator/account\";\nimport { HexInput, SigningScheme } from \"../types\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Ed25519PrivateKey, Ed25519PublicKey, Ed25519Signature } from \"../core/crypto\";\nimport type { Account } from \"./Account\";\nimport { AnyRawTransaction } from \"../transactions/types\";\nimport { generateSigningMessageForTransaction } from \"../transactions/transactionBuilder/signingMessage\";\n\nexport interface Ed25519SignerConstructorArgs {\n privateKey: Ed25519PrivateKey;\n address?: AccountAddressInput;\n}\n\nexport interface Ed25519SignerFromDerivationPathArgs {\n path: string;\n mnemonic: string;\n}\n\nexport interface VerifyEd25519SignatureArgs {\n message: HexInput;\n signature: Ed25519Signature;\n}\n\n/**\n * Signer implementation for the Ed25519 authentication scheme.\n * This extends an {@link Ed25519Account} by adding signing capabilities through an {@link Ed25519PrivateKey}.\n *\n * Note: Generating a signer instance does not create the account on-chain.\n */\nexport class Ed25519Account implements Account {\n /**\n * Private key associated with the account\n */\n readonly privateKey: Ed25519PrivateKey;\n\n readonly publicKey: Ed25519PublicKey;\n\n readonly accountAddress: AccountAddress;\n\n readonly signingScheme = SigningScheme.Ed25519;\n\n // region Constructors\n\n constructor(args: Ed25519SignerConstructorArgs) {\n const { privateKey, address } = args;\n this.privateKey = privateKey;\n this.publicKey = privateKey.publicKey();\n this.accountAddress = address ? AccountAddress.from(address) : this.publicKey.authKey().derivedAddress();\n }\n\n /**\n * Derives a signer from a randomly generated private key\n */\n static generate() {\n const privateKey = Ed25519PrivateKey.generate();\n return new Ed25519Account({ privateKey });\n }\n\n /**\n * Derives an account with bip44 path and mnemonics\n *\n * @param args.path the BIP44 derive hardened path e.g. m/44'/637'/0'/0'/0'\n * Detailed description: {@link https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki}\n * @param args.mnemonic the mnemonic seed phrase of the account\n */\n static fromDerivationPath(args: Ed25519SignerFromDerivationPathArgs) {\n const { path, mnemonic } = args;\n const privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n return new Ed25519Account({ privateKey });\n }\n\n // endregion\n\n // region Account\n\n verifySignature(args: VerifyEd25519SignatureArgs): boolean {\n return this.publicKey.verifySignature(args);\n }\n\n signWithAuthenticator(transaction: AnyRawTransaction) {\n const signature = this.privateKey.sign(generateSigningMessageForTransaction(transaction));\n return new AccountAuthenticatorEd25519(this.publicKey, signature);\n }\n\n sign(message: HexInput) {\n return this.privateKey.sign(message);\n }\n\n signTransaction(transaction: AnyRawTransaction) {\n return this.sign(generateSigningMessageForTransaction(transaction));\n }\n\n // endregion\n}\n"],"mappings":"oKA6BO,IAAMA,EAAN,MAAMC,CAAkC,CAc7C,YAAYC,EAAoC,CAJhD,KAAS,cAAgB,EAKvB,GAAM,CAAE,WAAAC,EAAY,QAAAC,CAAQ,EAAIF,EAChC,KAAK,WAAaC,EAClB,KAAK,UAAYA,EAAW,UAAU,EACtC,KAAK,eAAiBC,EAAUC,EAAe,KAAKD,CAAO,EAAI,KAAK,UAAU,QAAQ,EAAE,eAAe,CACzG,CAKA,OAAO,UAAW,CAChB,IAAMD,EAAaG,EAAkB,SAAS,EAC9C,OAAO,IAAIL,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CASA,OAAO,mBAAmBD,EAA2C,CACnE,GAAM,CAAE,KAAAK,EAAM,SAAAC,CAAS,EAAIN,EACrBC,EAAaG,EAAkB,mBAAmBC,EAAMC,CAAQ,EACtE,OAAO,IAAIP,EAAe,CAAE,WAAAE,CAAW,CAAC,CAC1C,CAMA,gBAAgBD,EAA2C,CACzD,OAAO,KAAK,UAAU,gBAAgBA,CAAI,CAC5C,CAEA,sBAAsBO,EAAgC,CACpD,IAAMC,EAAY,KAAK,WAAW,KAAKC,EAAqCF,CAAW,CAAC,EACxF,OAAO,IAAIG,EAA4B,KAAK,UAAWF,CAAS,CAClE,CAEA,KAAKG,EAAmB,CACtB,OAAO,KAAK,WAAW,KAAKA,CAAO,CACrC,CAEA,gBAAgBJ,EAAgC,CAC9C,OAAO,KAAK,KAAKE,EAAqCF,CAAW,CAAC,CACpE,CAGF","names":["Ed25519Account","_Ed25519Account","args","privateKey","address","AccountAddress","Ed25519PrivateKey","path","mnemonic","transaction","signature","generateSigningMessageForTransaction","AccountAuthenticatorEd25519","message"]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-JXCZTOYC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-IOSQVDZI.mjs";import{a as o}from"./chunk-52C73T26.mjs";import{b as n}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
2
- //# sourceMappingURL=chunk-NPFNYP75.mjs.map
1
+ import{b as s}from"./chunk-U7EZI5D5.mjs";import{a as o}from"./chunk-52DBSOFA.mjs";import{b as n}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
2
+ //# sourceMappingURL=chunk-JYFKKB34.mjs.map
@@ -0,0 +1,2 @@
1
+ import{b as p}from"./chunk-AULJLLO5.mjs";async function o(e){let{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:n,overrides:A}=e,d=n.getRequestUrl(t);return p({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},n,e.type)}async function q(e){let{aptosConfig:t}=e;return o({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function C(e){let{aptosConfig:t}=e;return o({...e,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function m(e){let{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,o({...e,type:"Faucet",overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function E(e){return o({...e,type:"Pepper"})}async function a(e){return o({...e,type:"Prover"})}export{o as a,q as b,C as c,m as d,E as e,a as f};
2
+ //# sourceMappingURL=chunk-JZ7UTFTR.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Main function to do a Post request\n *\n * @param options PostRequestOptions\n * @returns\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n"],"mappings":"yCAwDA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAC9FU,EAAMF,EAAY,cAAcP,CAAI,EAE1C,OAAOU,EACL,CACE,IAAAD,EACA,OAAQ,OACR,aAAAR,EACA,KAAAC,EACA,KAAAC,EACA,YAAAE,EACA,WAAAD,EACA,OAAAE,EACA,UAAAE,CACF,EACAD,EACAR,EAAQ,IACV,CACF,CAEA,eAAsBY,EACpBZ,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,eACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAEA,eAAsBK,EACpBb,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,eACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,cACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,eAAe,OAAQ,CACzF,CACF,CAAC,CACH,CAEA,eAAsBM,EACpBd,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAGlBe,EAAsB,CAC1B,GAAGP,EACH,aAAc,CAAE,GAAGA,EAAY,YAAa,CAC9C,EAEA,cAAOO,GAAqB,cAAc,QAEnChB,EAAe,CACpB,GAAGC,EACH,cACA,UAAW,CACT,GAAGe,EAAoB,aACvB,GAAGA,EAAoB,aACvB,GAAGf,EAAQ,UACX,QAAS,CAAE,GAAGe,EAAoB,cAAc,QAAS,GAAGA,EAAoB,cAAc,OAAQ,CACxG,CACF,CAAC,CACH","names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig"]}
1
+ {"version":3,"sources":["../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse } from \"./types\";\nimport { AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n */\n type: AptosApiType;\n /**\n * The name of the API method\n */\n originMethod: string;\n /**\n * The URL path to the API method\n */\n path: string;\n /**\n * The content type of the request body\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n */\n overrides?: ClientConfig;\n};\n\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Main function to do a Post request\n *\n * @param options PostRequestOptions\n * @returns\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n\nexport async function postAptosPepperService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\nexport async function postAptosProvingService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PROVER });\n}\n"],"mappings":"yCAwDA,eAAsBA,EACpBC,EACkC,CAClC,GAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAC9FU,EAAMF,EAAY,cAAcP,CAAI,EAE1C,OAAOU,EACL,CACE,IAAAD,EACA,OAAQ,OACR,aAAAR,EACA,KAAAC,EACA,KAAAC,EACA,YAAAE,EACA,WAAAD,EACA,OAAAE,EACA,UAAAE,CACF,EACAD,EACAR,EAAQ,IACV,CACF,CAEA,eAAsBY,EACpBZ,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,gBACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,eACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAEA,eAAsBK,EACpBb,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,eACA,UAAW,CACT,GAAGQ,EAAY,aACf,GAAGA,EAAY,cACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,eAAe,OAAQ,CACzF,CACF,CAAC,CACH,CAEA,eAAsBM,EACpBd,EACkC,CAClC,GAAM,CAAE,YAAAQ,CAAY,EAAIR,EAGlBe,EAAsB,CAC1B,GAAGP,EACH,aAAc,CAAE,GAAGA,EAAY,YAAa,CAC9C,EAEA,cAAOO,GAAqB,cAAc,QAEnChB,EAAe,CACpB,GAAGC,EACH,cACA,UAAW,CACT,GAAGe,EAAoB,aACvB,GAAGA,EAAoB,aACvB,GAAGf,EAAQ,UACX,QAAS,CAAE,GAAGe,EAAoB,cAAc,QAAS,GAAGA,EAAoB,cAAc,OAAQ,CACxG,CACF,CAAC,CACH,CAEA,eAAsBC,EACpBhB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE,CAEA,eAAsBiB,EACpBjB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,aAA0B,CAAC,CACjE","names":["post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","aptosRequest","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig","postAptosPepperService","postAptosProvingService"]}
@@ -0,0 +1,2 @@
1
+ import{a as c}from"./chunk-V76TXXWZ.mjs";import{c as p}from"./chunk-IVBYTTN7.mjs";import{f as o}from"./chunk-GSOKKQQ7.mjs";import{o as u,r as g,s as A}from"./chunk-S4SEFF4K.mjs";import{f as a,i as r}from"./chunk-Q225PZMV.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:[],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-K7ESGXR3.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/fungibleAsset.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/fungible_asset}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * fungible_asset namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport {\n AnyNumber,\n GetCurrentFungibleAssetBalancesResponse,\n GetFungibleAssetActivitiesResponse,\n GetFungibleAssetMetadataResponse,\n PaginationArgs,\n WhereArg,\n} from \"../types\";\nimport { queryIndexer } from \"./general\";\nimport {\n GetCurrentFungibleAssetBalances,\n GetFungibleAssetActivities,\n GetFungibleAssetMetadata,\n} from \"../types/generated/queries\";\nimport {\n GetCurrentFungibleAssetBalancesQuery,\n GetFungibleAssetActivitiesQuery,\n GetFungibleAssetMetadataQuery,\n} from \"../types/generated/operations\";\nimport {\n CurrentFungibleAssetBalancesBoolExp,\n FungibleAssetActivitiesBoolExp,\n FungibleAssetMetadataBoolExp,\n} from \"../types/generated/types\";\nimport { AccountAddressInput } from \"../core\";\nimport { Account } from \"../account\";\nimport {\n EntryFunctionABI,\n InputGenerateTransactionOptions,\n parseTypeTag,\n TypeTagAddress,\n TypeTagU64,\n} from \"../transactions\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport async function getFungibleAssetMetadata(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetMetadataBoolExp>;\n}): Promise<GetFungibleAssetMetadataResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetMetadata,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetMetadataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetMetadata\",\n });\n\n return data.fungible_asset_metadata;\n}\n\nexport async function getFungibleAssetActivities(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<FungibleAssetActivitiesBoolExp>;\n}): Promise<GetFungibleAssetActivitiesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetFungibleAssetActivities,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetFungibleAssetActivitiesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getFungibleAssetActivities\",\n });\n\n return data.fungible_asset_activities;\n}\n\nexport async function getCurrentFungibleAssetBalances(args: {\n aptosConfig: AptosConfig;\n options?: PaginationArgs & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\n}): Promise<GetCurrentFungibleAssetBalancesResponse> {\n const { aptosConfig, options } = args;\n\n const graphqlQuery = {\n query: GetCurrentFungibleAssetBalances,\n variables: {\n where_condition: options?.where,\n limit: options?.limit,\n offset: options?.offset,\n },\n };\n\n const data = await queryIndexer<GetCurrentFungibleAssetBalancesQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getCurrentFungibleAssetBalances\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nconst faTransferAbi: EntryFunctionABI = {\n typeParameters: [],\n parameters: [parseTypeTag(\"0x1::object::Object\"), new TypeTagAddress(), new TypeTagU64()],\n};\n\nexport async function transferFungibleAsset(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n fungibleAssetMetadataAddress: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, fungibleAssetMetadataAddress, recipient, amount, options } = args;\n return generateTransaction({\n aptosConfig,\n sender: sender.accountAddress,\n data: {\n function: \"0x1::primary_fungible_store::transfer\",\n typeArguments: [\"0x1::fungible_asset::Metadata\"],\n functionArguments: [fungibleAssetMetadataAddress, recipient, amount],\n abi: faTransferAbi,\n },\n options,\n });\n}\n"],"mappings":"kOA+CA,eAAsBA,EAAyBC,EAGD,CAC5C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOC,EACP,UAAW,CACT,gBAAiBF,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA4C,CAC7D,YAAAJ,EACA,MAAOE,EACP,aAAc,0BAChB,CAAC,GAEW,uBACd,CAEA,eAAsBG,EAA2BN,EAGD,CAC9C,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOI,EACP,UAAW,CACT,gBAAiBL,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAA8C,CAC/D,YAAAJ,EACA,MAAOE,EACP,aAAc,4BAChB,CAAC,GAEW,yBACd,CAEA,eAAsBK,EAAgCR,EAGD,CACnD,GAAM,CAAE,YAAAC,EAAa,QAAAC,CAAQ,EAAIF,EAE3BG,EAAe,CACnB,MAAOM,EACP,UAAW,CACT,gBAAiBP,GAAS,MAC1B,MAAOA,GAAS,MAChB,OAAQA,GAAS,MACnB,CACF,EAQA,OANa,MAAMG,EAAmD,CACpE,YAAAJ,EACA,MAAOE,EACP,aAAc,iCAChB,CAAC,GAEW,+BACd,CAEA,IAAMO,EAAkC,CACtC,eAAgB,CAAC,EACjB,WAAY,CAACC,EAAa,qBAAqB,EAAG,IAAIC,EAAkB,IAAIC,CAAY,CAC1F,EAEA,eAAsBC,EAAsBd,EAOb,CAC7B,GAAM,CAAE,YAAAC,EAAa,OAAAc,EAAQ,6BAAAC,EAA8B,UAAAC,EAAW,OAAAC,EAAQ,QAAAhB,CAAQ,EAAIF,EAC1F,OAAOmB,EAAoB,CACzB,YAAAlB,EACA,OAAQc,EAAO,eACf,KAAM,CACJ,SAAU,wCACV,cAAe,CAAC,+BAA+B,EAC/C,kBAAmB,CAACC,EAA8BC,EAAWC,CAAM,EACnE,IAAKR,CACP,EACA,QAAAR,CACF,CAAC,CACH","names":["getFungibleAssetMetadata","args","aptosConfig","options","graphqlQuery","GetFungibleAssetMetadata","queryIndexer","getFungibleAssetActivities","GetFungibleAssetActivities","getCurrentFungibleAssetBalances","GetCurrentFungibleAssetBalances","faTransferAbi","parseTypeTag","TypeTagAddress","TypeTagU64","transferFungibleAsset","sender","fungibleAssetMetadataAddress","recipient","amount","generateTransaction"]}
@@ -0,0 +1,2 @@
1
+ import{a as u,b as l}from"./chunk-5NKRMZEX.mjs";import{b as g}from"./chunk-HZC6A3QL.mjs";import{a as f}from"./chunk-KX5ESZO7.mjs";import{a as m}from"./chunk-JYFKKB34.mjs";function p(y){let o=y;return o-=o>>1&1431655765,o=(o&858993459)+(o>>2&858993459),(o+(o>>4)&252645135)*16843009>>24}var d=class y extends g{constructor(e){super();let{publicKeys:i,signaturesRequired:t}=e;if(t<1)throw new Error("The number of required signatures needs to be greater than 0");if(i.length<t)throw new Error(`Provided ${i.length} public keys is smaller than the ${t} required signatures`);this.publicKeys=i.map(r=>r instanceof u?r:new u(r)),this.signaturesRequired=t}verifySignature(e){throw new Error("not implemented")}authKey(){return m.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let i=e.deserializeVector(u),t=e.deserializeU8();return new y({publicKeys:i,signaturesRequired:t})}createBitmap(e){let{bits:i}=e,t=128,r=new Uint8Array([0,0,0,0]),s=new Set;return i.forEach((n,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(n))throw new Error(`Duplicate bit ${n} detected.`);s.add(n);let h=Math.floor(n/8),b=r[h];b|=t>>n%8,r[h]=b}),r}getIndex(e){let i=e instanceof u?e:new u(e),t=this.publicKeys.findIndex(r=>r.toString()===i.toString());if(t!==-1)return t;throw new Error("Public key not found in MultiKey")}},a=class a extends f{constructor(e){super();let{signatures:i,bitmap:t}=e;if(i.length>a.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${a.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=i.map(s=>s instanceof l?s:new l(s)),!(t instanceof Uint8Array))this.bitmap=a.createBitmap({bits:t});else{if(t.length!==a.BITMAP_LEN)throw new Error(`"bitmap" length should be ${a.BITMAP_LEN}`);this.bitmap=t}let r=this.bitmap.reduce((s,n)=>s+p(n),0);if(r!==this.signatures.length)throw new Error(`Expecting ${r} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:i}=e,t=128,r=new Uint8Array([0,0,0,0]),s=new Set;return i.forEach(n=>{if(n>=a.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${a.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(n))throw new Error("Duplicate bits detected.");s.add(n);let c=Math.floor(n/8),h=r[c];h|=t>>n%8,r[c]=h}),r}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let i=e.deserializeBytes(),t=i.reduce((s,n)=>s+p(n),0),r=[];for(let s=0;s<t;s+=1){let n=l.deserialize(e);r.push(n)}return new a({signatures:r,bitmap:i})}};a.BITMAP_LEN=4,a.MAX_SIGNATURES_SUPPORTED=a.BITMAP_LEN*8;var A=a;export{d as a,A as b};
2
+ //# sourceMappingURL=chunk-KMPAYC5Z.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/multiKey.ts"],"sourcesContent":["import { SigningScheme as AuthenticationKeyScheme } from \"../../types\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { AccountPublicKey, PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { AnyPublicKey, AnySignature } from \"./singleKey\";\n\n/* eslint-disable no-bitwise */\n\nfunction bitCount(byte: number) {\n let n = byte;\n n -= (n >> 1) & 0x55555555;\n n = (n & 0x33333333) + ((n >> 2) & 0x33333333);\n return (((n + (n >> 4)) & 0xf0f0f0f) * 0x1010101) >> 24;\n}\n\n/* eslint-enable no-bitwise */\n\n/**\n * Represents the public key of a multi-agent account.\n *\n * The public keys of each individual agent can be any type of public key supported by Aptos.\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentication keys.\n */\nexport class MultiKey extends AccountPublicKey {\n /**\n * List of any public keys\n */\n public readonly publicKeys: AnyPublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n */\n public readonly signaturesRequired: number;\n\n // region Constructors\n\n constructor(args: { publicKeys: Array<PublicKey>; signaturesRequired: number }) {\n super();\n const { publicKeys, signaturesRequired } = args;\n\n // Validate number of public keys is greater than signature required\n if (signaturesRequired < 1) {\n throw new Error(\"The number of required signatures needs to be greater than 0\");\n }\n\n // Validate number of public keys is greater than signature required\n if (publicKeys.length < signaturesRequired) {\n throw new Error(\n `Provided ${publicKeys.length} public keys is smaller than the ${signaturesRequired} required signatures`,\n );\n }\n\n // Make sure that all keys are normalized to the SingleKey authentication scheme\n this.publicKeys = publicKeys.map((publicKey) =>\n publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey),\n );\n\n this.signaturesRequired = signaturesRequired;\n }\n\n // endregion\n\n // region AccountPublicKey\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n verifySignature(args: VerifySignatureArgs): boolean {\n throw new Error(\"not implemented\");\n }\n\n authKey(): AuthenticationKey {\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.MultiKey,\n input: this.toUint8Array(),\n });\n }\n\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeVector(this.publicKeys);\n serializer.serializeU8(this.signaturesRequired);\n }\n\n static deserialize(deserializer: Deserializer): MultiKey {\n const keys = deserializer.deserializeVector(AnyPublicKey);\n const signaturesRequired = deserializer.deserializeU8();\n\n return new MultiKey({ publicKeys: keys, signaturesRequired });\n }\n\n // endregion\n\n /**\n * Create a bitmap that holds the mapping from the original public keys\n * to the signatures passed in\n *\n * @param args.bits array of the index mapping to the matching public keys\n * @returns Uint8array bit map\n */\n createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number, idx: number) => {\n if (idx + 1 > this.publicKeys.length) {\n throw new Error(`Signature index ${idx + 1} is out of public keys range, ${this.publicKeys.length}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(`Duplicate bit ${bit} detected.`);\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n getIndex(publicKey: PublicKey): number {\n const anyPublicKey = publicKey instanceof AnyPublicKey ? publicKey : new AnyPublicKey(publicKey);\n const index = this.publicKeys.findIndex((pk) => pk.toString() === anyPublicKey.toString());\n\n if (index !== -1) {\n return index;\n }\n throw new Error(\"Public key not found in MultiKey\");\n }\n}\n\nexport class MultiSignature extends Signature {\n /**\n * Number of bytes in the bitmap representing who signed the transaction (32-bits)\n */\n static BITMAP_LEN: number = 4;\n\n /**\n * Maximum number of Ed25519 signatures supported\n */\n static MAX_SIGNATURES_SUPPORTED = MultiSignature.BITMAP_LEN * 8;\n\n /**\n * The list of underlying Ed25519 signatures\n */\n public readonly signatures: AnySignature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n */\n public readonly bitmap: Uint8Array;\n\n /**\n * Signature for a K-of-N multi-sig transaction.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/#multisignature-transactions | Creating a Signed Transaction}\n *\n * @param args.signatures A list of signatures\n * @param args.bitmap 4 bytes, at most 32 signatures are supported. If Nth bit value is `1`, the Nth\n * signature should be provided in `signatures`. Bits are read from left to right\n */\n constructor(args: { signatures: Array<Signature | AnySignature>; bitmap: Uint8Array | number[] }) {\n super();\n const { signatures, bitmap } = args;\n\n if (signatures.length > MultiSignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`The number of signatures cannot be greater than ${MultiSignature.MAX_SIGNATURES_SUPPORTED}`);\n }\n\n // Make sure that all signatures are normalized to the SingleKey authentication scheme\n this.signatures = signatures.map((signature) =>\n signature instanceof AnySignature ? signature : new AnySignature(signature),\n );\n\n if (!(bitmap instanceof Uint8Array)) {\n this.bitmap = MultiSignature.createBitmap({ bits: bitmap });\n } else if (bitmap.length !== MultiSignature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiSignature.BITMAP_LEN}`);\n } else {\n this.bitmap = bitmap;\n }\n\n const nSignatures = this.bitmap.reduce((acc, byte) => acc + bitCount(byte), 0);\n if (nSignatures !== this.signatures.length) {\n throw new Error(`Expecting ${nSignatures} signatures from the bitmap, but got ${this.signatures.length}`);\n }\n }\n\n /**\n * Helper method to create a bitmap out of the specified bit positions\n * @param args.bits The bitmap positions that should be set. A position starts at index 0.\n * Valid position should range between 0 and 31.\n * @example\n * Here's an example of valid `bits`\n * ```\n * [0, 2, 31]\n * ```\n * `[0, 2, 31]` means the 1st, 3rd and 32nd bits should be set in the bitmap.\n * The result bitmap should be 0b1010000000000000000000000000001\n *\n * @returns bitmap that is 32bit long\n */\n static createBitmap(args: { bits: number[] }): Uint8Array {\n const { bits } = args;\n // Bits are read from left to right. e.g. 0b10000000 represents the first bit is set in one byte.\n // The decimal value of 0b10000000 is 128.\n const firstBitInByte = 128;\n const bitmap = new Uint8Array([0, 0, 0, 0]);\n\n // Check if duplicates exist in bits\n const dupCheckSet = new Set();\n\n bits.forEach((bit: number) => {\n if (bit >= MultiSignature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiSignature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n dupCheckSet.add(bit);\n\n const byteOffset = Math.floor(bit / 8);\n\n let byte = bitmap[byteOffset];\n\n // eslint-disable-next-line no-bitwise\n byte |= firstBitInByte >> bit % 8;\n\n bitmap[byteOffset] = byte;\n });\n\n return bitmap;\n }\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.bcsToBytes();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n // Note: we should not need to serialize the vector length, as it can be derived from the bitmap\n serializer.serializeVector(this.signatures);\n serializer.serializeBytes(this.bitmap);\n }\n\n static deserialize(deserializer: Deserializer): MultiSignature {\n const bitmap = deserializer.deserializeBytes();\n const nSignatures = bitmap.reduce((acc, byte) => acc + bitCount(byte), 0);\n const signatures: AnySignature[] = [];\n for (let i = 0; i < nSignatures; i += 1) {\n const signature = AnySignature.deserialize(deserializer);\n signatures.push(signature);\n }\n return new MultiSignature({ signatures, bitmap });\n }\n\n // endregion\n}\n"],"mappings":"2KAUA,SAASA,EAASC,EAAc,CAC9B,IAAIC,EAAID,EACR,OAAAC,GAAMA,GAAK,EAAK,WAChBA,GAAKA,EAAI,YAAgBA,GAAK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AM,CAAE,KAAAS,CAAK,EAAIT,EAGXU,EAAiB,IACjBC,EAAS,IAAI,WAAW,CAAC,EAAG,EAAG,EAAG,CAAC,CAAC,EAGpCC,EAAc,IAAI,IAExB,OAAAH,EAAK,QAASI,GAAgB,CAC5B,GAAIA,GAAOM,EAAe,yBACxB,MAAM,IAAI,MAAM,uCAAuCA,EAAe,yBAA2B,CAAC,GAAG,EAGvG,GAAIP,EAAY,IAAIC,CAAG,EACrB,MAAM,IAAI,MAAM,0BAA0B,EAG5CD,EAAY,IAAIC,CAAG,EAEnB,IAAME,EAAa,KAAK,MAAMF,EAAM,CAAC,EAEjClB,EAAOgB,EAAOI,CAAU,EAG5BpB,GAAQe,GAAkBG,EAAM,EAEhCF,EAAOI,CAAU,EAAIpB,CACvB,CAAC,EAEMgB,CACT,CAIA,cAA2B,CACzB,OAAO,KAAK,WAAW,CACzB,CAMA,UAAUL,EAA8B,CAEtCA,EAAW,gBAAgB,KAAK,UAAU,EAC1CA,EAAW,eAAe,KAAK,MAAM,CACvC,CAEA,OAAO,YAAYC,EAA4C,CAC7D,IAAMI,EAASJ,EAAa,iBAAiB,EACvCiB,EAAcb,EAAO,OAAO,CAACc,EAAK9B,IAAS8B,EAAM/B,EAASC,CAAI,EAAG,CAAC,EAClE0B,EAA6B,CAAC,EACpC,QAASK,EAAI,EAAGA,EAAIF,EAAaE,GAAK,EAAG,CACvC,IAAMJ,EAAYC,EAAa,YAAYhB,CAAY,EACvDc,EAAW,KAAKC,CAAS,CAC3B,CACA,OAAO,IAAIH,EAAe,CAAE,WAAAE,EAAY,OAAAV,CAAO,CAAC,CAClD,CAGF,EAxIaQ,EAIJ,WAAqB,EAJjBA,EASJ,yBAA2BA,EAAe,WAAa,EATzD,IAAMQ,EAANR","names":["bitCount","byte","n","MultiKey","_MultiKey","AccountPublicKey","args","publicKeys","signaturesRequired","publicKey","AnyPublicKey","AuthenticationKey","serializer","deserializer","keys","bits","firstBitInByte","bitmap","dupCheckSet","bit","idx","byteOffset","anyPublicKey","index","pk","_MultiSignature","Signature","signatures","signature","AnySignature","nSignatures","acc","i","MultiSignature"]}
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-52C73T26.mjs";import{b as t}from"./chunk-AOCNYMMX.mjs";var o=class extends r{toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
- //# sourceMappingURL=chunk-R5QUBEH6.mjs.map
1
+ import{a as r}from"./chunk-52DBSOFA.mjs";import{b as t}from"./chunk-AOCNYMMX.mjs";var o=class extends r{toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
+ //# sourceMappingURL=chunk-KX5ESZO7.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-QK4P26SH.mjs";import{a as m}from"./chunk-KL6VJ3UK.mjs";import{f as A}from"./chunk-Y5M5DD64.mjs";import{t as f}from"./chunk-S4SEFF4K.mjs";import{b as w}from"./chunk-IOSQVDZI.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function E(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[n,t,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!E(n))throw new Error(`${n} is not valid. ${T}`);if(t&&!E(t))throw new Error(`${t} is not valid. ${T}`);return{domainName:t||n,subdomainName:t?n:void 0}}var V="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",G="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",P={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:G,custom:null,devnet:null,randomnet:null};function d(e){let n=P[e.network];if(!n)throw new Error(`The ANS contract is not deployed to ${e.network}`);return n}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function j(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function Y(e){let{aptosConfig:n,expiration:t,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(n),{domainName:N,subdomainName:l}=c(o),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(l&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!l)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let h=t.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let D=h*31536e3;return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[N,D,s,i]},options:a})}if(!l)throw new Error(`${t.policy} requires a subdomain to be provided.`);let _=await I({aptosConfig:n,name:N});if(!_)throw new Error("The domain does not exist");let x=t.policy==="subdomain:independent"?t.expirationDate:_;if(x>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[N,l,Math.round(x/1e3),t.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function I(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t);try{let i=await g({aptosConfig:n,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function K(e){let{aptosConfig:n,address:t}=e,o=d(n),r=await g({aptosConfig:n,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(t).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function W(e){let{aptosConfig:n,sender:t,name:o,options:r}=e,s=d(n);if(!o)return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function F(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function H(e){let{aptosConfig:n,sender:t,name:o,address:r,options:s}=e,i=d(n),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function J(e){let{aptosConfig:n,name:t}=e,{domainName:o,subdomainName:r=""}=c(t),a=(await A({aptosConfig:n,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=y(a)),a}async function X(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountNames",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(y)}async function Z(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountDomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(y)}async function ee(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function ne(e){let{aptosConfig:n,options:t,domain:o}=e;return(await A({aptosConfig:n,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(y)}async function C(e){let{aptosConfig:n}=e,t=d(n),[o]=await g({aptosConfig:n,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function te(e){let{aptosConfig:n,sender:t,name:o,years:r=1,options:s}=e,i=d(n),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function y(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,E as b,c,V as d,G as e,j as f,Y as g,I as h,K as i,W as j,F as k,H as l,J as m,X as n,Z as o,ee as p,ne as q,te as r};
2
- //# sourceMappingURL=chunk-H4UVHJ3M.mjs.map
1
+ import{a as g}from"./chunk-Q2Y6S77E.mjs";import{a as m}from"./chunk-V76TXXWZ.mjs";import{f as A}from"./chunk-GSOKKQQ7.mjs";import{t as f}from"./chunk-S4SEFF4K.mjs";import{b as w}from"./chunk-U7EZI5D5.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function E(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[n,t,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!E(n))throw new Error(`${n} is not valid. ${T}`);if(t&&!E(t))throw new Error(`${t} is not valid. ${T}`);return{domainName:t||n,subdomainName:t?n:void 0}}var z="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",G="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",P={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:G,custom:null,devnet:null,randomnet:null};function d(e){let n=P[e.network];if(!n)throw new Error(`The ANS contract is not deployed to ${e.network}`);return n}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function V(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function j(e){let{aptosConfig:n,expiration:t,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(n),{domainName:N,subdomainName:l}=c(o),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(l&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!l)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let h=t.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let D=h*31536e3;return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[N,D,s,i]},options:a})}if(!l)throw new Error(`${t.policy} requires a subdomain to be provided.`);let _=await I({aptosConfig:n,name:N});if(!_)throw new Error("The domain does not exist");let x=t.policy==="subdomain:independent"?t.expirationDate:_;if(x>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[N,l,Math.round(x/1e3),t.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function I(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t);try{let i=await g({aptosConfig:n,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function Y(e){let{aptosConfig:n,address:t}=e,o=d(n),r=await g({aptosConfig:n,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(t).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function K(e){let{aptosConfig:n,sender:t,name:o,options:r}=e,s=d(n);if(!o)return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function W(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function F(e){let{aptosConfig:n,sender:t,name:o,address:r,options:s}=e,i=d(n),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function H(e){let{aptosConfig:n,name:t}=e,{domainName:o,subdomainName:r=""}=c(t),a=(await A({aptosConfig:n,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=y(a)),a}async function J(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountNames",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(y)}async function X(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountDomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(y)}async function Z(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function ee(e){let{aptosConfig:n,options:t,domain:o}=e;return(await A({aptosConfig:n,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(y)}async function C(e){let{aptosConfig:n}=e,t=d(n),[o]=await g({aptosConfig:n,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function ne(e){let{aptosConfig:n,sender:t,name:o,years:r=1,options:s}=e,i=d(n),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function y(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,E as b,c,z as d,G as e,V as f,j as g,I as h,Y as i,K as j,W as k,F as l,H as m,J as n,X as o,Z as p,ee as q,ne as r};
2
+ //# sourceMappingURL=chunk-LODRH4QJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/ans.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/name}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * name namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { Account } from \"../account\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { GetANSNameResponse, MoveAddressType, OrderByArg, PaginationArgs, WhereArg } from \"../types\";\nimport { GetNamesQuery } from \"../types/generated/operations\";\nimport { GetNames } from \"../types/generated/queries\";\nimport { CurrentAptosNamesBoolExp } from \"../types/generated/types\";\nimport { Network } from \"../utils/apiEndpoints\";\nimport { queryIndexer } from \"./general\";\nimport { view } from \"./view\";\nimport { generateTransaction } from \"./transactionSubmission\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport const VALIDATION_RULES_DESCRIPTION = [\n \"A name must be between 3 and 63 characters long,\",\n \"and can only contain lowercase a-z, 0-9, and hyphens.\",\n \"A name may not start or end with a hyphen.\",\n].join(\" \");\n\n/**\n *\n * @param fragment A fragment of a name, either the domain or subdomain\n * @returns boolean indicating if the fragment is a valid fragment\n */\nexport function isValidANSSegment(fragment: string): boolean {\n if (!fragment) return false;\n if (fragment.length < 3) return false;\n if (fragment.length > 63) return false;\n // only lowercase a-z and 0-9 are allowed, along with -. a domain may not start or end with a hyphen\n if (!/^[a-z\\d][a-z\\d-]{1,61}[a-z\\d]$/.test(fragment)) return false;\n return true;\n}\n\n/**\n * Checks if an ANS name is valid or not\n *\n * @param name A string of the domain name, can include or exclude the .apt suffix\n */\nexport function isValidANSName(name: string): { domainName: string; subdomainName?: string } {\n const [first, second, ...rest] = name.replace(/\\.apt$/, \"\").split(\".\");\n\n if (rest.length > 0) {\n throw new Error(`${name} is invalid. A name can only have two parts, a domain and a subdomain separated by a \".\"`);\n }\n\n if (!isValidANSSegment(first)) {\n throw new Error(`${first} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n if (second && !isValidANSSegment(second)) {\n throw new Error(`${second} is not valid. ${VALIDATION_RULES_DESCRIPTION}`);\n }\n\n return {\n domainName: second || first,\n subdomainName: second ? first : undefined,\n };\n}\n\nexport const LOCAL_ANS_ACCOUNT_PK =\n process.env.ANS_TEST_ACCOUNT_PRIVATE_KEY ?? \"0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221\";\nexport const LOCAL_ANS_ACCOUNT_ADDRESS =\n process.env.ANS_TEST_ACCOUNT_ADDRESS ?? \"0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82\";\n\nconst NetworkToAnsContract: Record<Network, string | null> = {\n [Network.TESTNET]: \"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c\",\n [Network.MAINNET]: \"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c\",\n [Network.LOCAL]: LOCAL_ANS_ACCOUNT_ADDRESS,\n [Network.CUSTOM]: null,\n [Network.DEVNET]: null,\n [Network.RANDOMNET]: null,\n};\n\nfunction getRouterAddress(aptosConfig: AptosConfig): string {\n const address = NetworkToAnsContract[aptosConfig.network];\n if (!address) throw new Error(`The ANS contract is not deployed to ${aptosConfig.network}`);\n return address;\n}\n\nconst unwrapOption = <T>(option: any): T | undefined => {\n if (!!option && typeof option === \"object\" && \"vec\" in option && Array.isArray(option.vec)) {\n return option.vec[0];\n }\n\n return undefined;\n};\n\nexport async function getOwnerAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_owner_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const owner = unwrapOption<MoveAddressType>(res[0]);\n\n return owner ? AccountAddress.from(owner) : undefined;\n}\n\nexport interface RegisterNameParameters {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n expiration:\n | { policy: \"domain\"; years?: 1 }\n | { policy: \"subdomain:follow-domain\" }\n | { policy: \"subdomain:independent\"; expirationDate: number };\n transferable?: boolean;\n toAddress?: AccountAddressInput;\n targetAddress?: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}\n\nexport async function registerName(args: RegisterNameParameters): Promise<SimpleTransaction> {\n const { aptosConfig, expiration, name, sender, targetAddress, toAddress, options, transferable } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const hasSubdomainPolicy =\n expiration.policy === \"subdomain:independent\" || expiration.policy === \"subdomain:follow-domain\";\n\n if (subdomainName && !hasSubdomainPolicy) {\n throw new Error(\n \"Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'\",\n );\n }\n\n if (hasSubdomainPolicy && !subdomainName) {\n throw new Error(`Policy is set to ${expiration.policy} but no subdomain was provided`);\n }\n\n if (expiration.policy === \"domain\") {\n const years = expiration.years ?? 1;\n if (years !== 1) {\n throw new Error(\"For now, names can only be registered for 1 year at a time\");\n }\n\n const secondsInYear = 31536000;\n const registrationDuration = years * secondsInYear;\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_domain`,\n functionArguments: [domainName, registrationDuration, targetAddress, toAddress],\n },\n options,\n });\n\n return transaction;\n }\n\n // We are a subdomain\n if (!subdomainName) {\n throw new Error(`${expiration.policy} requires a subdomain to be provided.`);\n }\n\n const tldExpiration = await getExpiration({ aptosConfig, name: domainName });\n if (!tldExpiration) {\n throw new Error(\"The domain does not exist\");\n }\n\n const expirationDateInMillisecondsSinceEpoch =\n expiration.policy === \"subdomain:independent\" ? expiration.expirationDate : tldExpiration;\n\n if (expirationDateInMillisecondsSinceEpoch > tldExpiration) {\n throw new Error(\"The subdomain expiration time cannot be greater than the domain expiration time\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::register_subdomain`,\n functionArguments: [\n domainName,\n subdomainName,\n Math.round(expirationDateInMillisecondsSinceEpoch / 1000),\n expiration.policy === \"subdomain:follow-domain\" ? 1 : 0,\n !!transferable,\n targetAddress,\n toAddress,\n ],\n },\n options,\n });\n\n return transaction;\n}\n\nexport async function getExpiration(args: { aptosConfig: AptosConfig; name: string }): Promise<number | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n try {\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_expiration`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n // Normalize expiration time from epoch seconds to epoch milliseconds\n return Number(res[0]) * 1000;\n } catch (e) {\n return undefined;\n }\n}\n\nexport async function getPrimaryName(args: {\n aptosConfig: AptosConfig;\n address: AccountAddressInput;\n}): Promise<string | undefined> {\n const { aptosConfig, address } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_primary_name`,\n functionArguments: [AccountAddress.from(address).toString()],\n },\n });\n\n const domainName = unwrapOption<MoveAddressType>(res[1]);\n const subdomainName = unwrapOption<MoveAddressType>(res[0]);\n\n if (!domainName) return undefined;\n\n return [subdomainName, domainName].filter(Boolean).join(\".\");\n}\n\nexport async function setPrimaryName(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name?: string;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n if (!name) {\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::clear_primary_name`,\n functionArguments: [],\n },\n options,\n });\n\n return transaction;\n }\n\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_primary_name`,\n functionArguments: [domainName, subdomainName],\n },\n options,\n });\n\n return transaction;\n}\n\nexport async function getTargetAddress(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<AccountAddress | undefined> {\n const { aptosConfig, name } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const res = await view({\n aptosConfig,\n payload: {\n function: `${routerAddress}::router::get_target_addr`,\n functionArguments: [domainName, subdomainName],\n },\n });\n\n const target = unwrapOption<MoveAddressType>(res[0]);\n return target ? AccountAddress.from(target) : undefined;\n}\n\nexport async function setTargetAddress(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n address: AccountAddressInput;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, address, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const { domainName, subdomainName } = isValidANSName(name);\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::set_target_addr`,\n functionArguments: [domainName, subdomainName, address],\n },\n options,\n });\n\n return transaction;\n}\n\nexport async function getName(args: {\n aptosConfig: AptosConfig;\n name: string;\n}): Promise<GetANSNameResponse[0] | undefined> {\n const { aptosConfig, name } = args;\n const { domainName, subdomainName = \"\" } = isValidANSName(name);\n\n const where: CurrentAptosNamesBoolExp = {\n domain: { _eq: domainName },\n subdomain: { _eq: subdomainName },\n is_active: { _eq: true },\n };\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n query: {\n query: GetNames,\n variables: {\n where_condition: where,\n limit: 1,\n },\n },\n originMethod: \"getName\",\n });\n\n // Convert the expiration_timestamp from an ISO string to milliseconds since epoch\n let res = data.current_aptos_names[0];\n if (res) {\n res = sanitizeANSName(res);\n }\n\n return res;\n}\n\ninterface QueryNamesOptions {\n options?: PaginationArgs & OrderByArg<GetANSNameResponse[0]> & WhereArg<CurrentAptosNamesBoolExp>;\n}\n\nexport interface GetAccountNamesArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\nexport async function getAccountNames(\n args: { aptosConfig: AptosConfig } & GetAccountNamesArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountNames\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\nexport interface GetAccountDomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\nexport async function getAccountDomains(\n args: { aptosConfig: AptosConfig } & GetAccountDomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountDomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _eq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\nexport interface GetAccountSubdomainsArgs extends QueryNamesOptions {\n accountAddress: AccountAddressInput;\n}\n\nexport async function getAccountSubdomains(\n args: { aptosConfig: AptosConfig } & GetAccountSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, accountAddress } = args;\n\n const expirationDate = await getANSExpirationDate({ aptosConfig });\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getAccountSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n owner_address: { _eq: accountAddress.toString() },\n expiration_timestamp: { _gte: expirationDate },\n subdomain: { _neq: \"\" },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\nexport interface GetDomainSubdomainsArgs extends QueryNamesOptions {\n domain: string;\n}\n\nexport async function getDomainSubdomains(\n args: { aptosConfig: AptosConfig } & GetDomainSubdomainsArgs,\n): Promise<GetANSNameResponse> {\n const { aptosConfig, options, domain } = args;\n\n const data = await queryIndexer<GetNamesQuery>({\n aptosConfig,\n originMethod: \"getDomainSubdomains\",\n query: {\n query: GetNames,\n variables: {\n limit: options?.limit,\n offset: options?.offset,\n order_by: options?.orderBy,\n where_condition: {\n ...(args.options?.where ?? {}),\n domain: { _eq: domain },\n subdomain: { _neq: \"\" },\n is_active: { _eq: true },\n },\n },\n },\n });\n\n return data.current_aptos_names.map(sanitizeANSName);\n}\n\n/**\n * This function returns the expiration date in which a name is fully expired as\n * defined by the contract. The grace period allows for names to be past\n * expiration for a certain amount of time before they are released to the\n * public. The names will not function as normal, but the owner can renew\n * without others taking ownership of the name. At the time of writing, the\n * contract specified 30 days.\n *\n * @param args.aptosConfig an AptosConfig object\n * @returns\n */\nasync function getANSExpirationDate(args: { aptosConfig: AptosConfig }): Promise<string> {\n const { aptosConfig } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n\n const [gracePeriodInSeconds] = await view<[number]>({\n aptosConfig,\n payload: {\n function: `${routerAddress}::config::reregistration_grace_sec`,\n functionArguments: [],\n },\n });\n\n const gracePeriodInDays = gracePeriodInSeconds / 60 / 60 / 24;\n const now = () => new Date();\n return new Date(now().setDate(now().getDate() - gracePeriodInDays)).toISOString();\n}\n\nexport async function renewDomain(args: {\n aptosConfig: AptosConfig;\n sender: Account;\n name: string;\n years?: 1;\n options?: InputGenerateTransactionOptions;\n}): Promise<SimpleTransaction> {\n const { aptosConfig, sender, name, years = 1, options } = args;\n const routerAddress = getRouterAddress(aptosConfig);\n const renewalDuration = years * 31536000;\n const { domainName, subdomainName } = isValidANSName(name);\n\n if (subdomainName) {\n throw new Error(\"Subdomains cannot be renewed\");\n }\n\n if (years !== 1) {\n throw new Error(\"Currently, only 1 year renewals are supported\");\n }\n\n const transaction = await generateTransaction({\n aptosConfig,\n sender: sender.accountAddress.toString(),\n data: {\n function: `${routerAddress}::router::renew_domain`,\n functionArguments: [domainName, renewalDuration],\n },\n options,\n });\n\n return transaction;\n}\n\n/**\n * The indexer returns ISO strings for expiration, however the contract works in\n * epoch milliseconds. This function converts the ISO string to epoch\n * milliseconds. In the future, if other properties need sanitization, this can\n * be extended.\n */\nfunction sanitizeANSName(name: GetANSNameResponse[0]): GetANSNameResponse[0] {\n return {\n ...name,\n expiration_timestamp: new Date(name.expiration_timestamp).getTime(),\n };\n}\n"],"mappings":"6MAwBO,IAAMA,EAA+B,CAC1C,mDACA,wDACA,4CACF,EAAE,KAAK,GAAG,EAOH,SAASC,EAAkBC,EAA2B,CAK3D,MAJI,GAACA,GACDA,EAAS,OAAS,GAClBA,EAAS,OAAS,IAElB,CAAC,iCAAiC,KAAKA,CAAQ,EAErD,CAOO,SAASC,EAAeC,EAA8D,CAC3F,G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AE,YAAAL,CAAY,EAAIK,EAClBC,EAAgBP,EAAiBC,CAAW,EAE5C,CAAC4C,CAAoB,EAAI,MAAMlC,EAAe,CAClD,YAAAV,EACA,QAAS,CACP,SAAU,GAAGM,CAAa,qCAC1B,kBAAmB,CAAC,CACtB,CACF,CAAC,EAEKuC,EAAoBD,EAAuB,GAAK,GAAK,GACrDE,EAAM,IAAM,IAAI,KACtB,OAAO,IAAI,KAAKA,EAAI,EAAE,QAAQA,EAAI,EAAE,QAAQ,EAAID,CAAiB,CAAC,EAAE,YAAY,CAClF,CAEA,eAAsBE,GAAY1C,EAMH,CAC7B,GAAM,CAAE,YAAAL,EAAa,OAAAe,EAAQ,KAAAvB,EAAM,MAAA6B,EAAQ,EAAG,QAAAH,CAAQ,EAAIb,EACpDC,EAAgBP,EAAiBC,CAAW,EAC5CgD,EAAkB3B,EAAQ,QAC1B,CAAE,WAAAd,EAAY,cAAAC,CAAc,EAAIjB,EAAeC,CAAI,EAEzD,GAAIgB,EACF,MAAM,IAAI,MAAM,8BAA8B,EAGhD,GAAIa,IAAU,EACZ,MAAM,IAAI,MAAM,+CAA+C,EAajE,OAVoB,MAAME,EAAoB,CAC5C,YAAAvB,EACA,OAAQe,EAAO,eAAe,SAAS,EACvC,KAAM,CACJ,SAAU,GAAGT,CAAa,yBAC1B,kBAAmB,CAACC,EAAYyC,CAAe,CACjD,EACA,QAAA9B,CACF,CAAC,CAGH,CAQA,SAASiB,EAAgB3C,EAAoD,CAC3E,MAAO,CACL,GAAGA,EACH,qBAAsB,IAAI,KAAKA,EAAK,oBAAoB,EAAE,QAAQ,CACpE,CACF","names":["VALIDATION_RULES_DESCRIPTION","isValidANSSegment","fragment","isValidANSName","name","first","second","rest","LOCAL_ANS_ACCOUNT_PK","LOCAL_ANS_ACCOUNT_ADDRESS","NetworkToAnsContract","getRouterAddress","aptosConfig","address","unwrapOption","option","getOwnerAddress","args","routerAddress","domainName","subdomainName","res","view","owner","AccountAddress","registerName","expiration","sender","targetAddress","toAddress","options","transferable","hasSubdomainPolicy","years","registrationDuration","generateTransaction","tldExpiration","getExpiration","expirationDateInMillisecondsSinceEpoch","getPrimaryName","setPrimaryName","getTargetAddress","target","setTargetAddress","getName","queryIndexer","GetNames","sanitizeANSName","getAccountNames","accountAddress","expirationDate","getANSExpirationDate","getAccountDomains","getAccountSubdomains","getDomainSubdomains","domain","gracePeriodInSeconds","gracePeriodInDays","now","renewDomain","renewalDuration"]}
@@ -0,0 +1,2 @@
1
+ import{c as E}from"./chunk-42ZSGMQO.mjs";import{e as x,f as K}from"./chunk-JZ7UTFTR.mjs";import{a as g}from"./chunk-BIRZ55IO.mjs";import{a as m,l as h,m as A}from"./chunk-7URCUZPH.mjs";import{b as S}from"./chunk-VMR46ALO.mjs";import{c as d}from"./chunk-S5HG2QUD.mjs";import{b as l}from"./chunk-52DBSOFA.mjs";import{b as a}from"./chunk-AOCNYMMX.mjs";import{jwtDecode as b}from"jwt-decode";import{bls12_381 as p}from"@noble/curves/bls12-381";var v="APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST";function w(e){return new TextEncoder().encode(e)}var I=p.G2.hashToCurve(w("APTOS_KEYLESS_PEPPER_PINKAS_VUF_SECRET_KEY_BASE"),{DST:v}).toAffine();function j(e){let{jwt:i,uidKey:t}=e,r=b(i),o=new l;o.serializeStr(r.iss),o.serializeStr(r.aud),o.serializeStr(r[t||"sub"]),o.serializeStr(t||"sub");let s=o.toUint8Array(),n=p.G1.hashToCurve(s,{DST:"APTOS_PEPPER_SERVICE_BLS12381_VUF_DST"}).toAffine();return p.G1.ProjectivePoint.fromAffine(n)}async function C(e){let{aptosConfig:i,pepperInput:t,pepperBase:r}=e,{data:o}=await E({aptosConfig:i,path:"vrf-pub-key",originMethod:"getPepper"}),s=p.G2.ProjectivePoint.fromHex(o.vrf_public_key_hex_string);return p.verifyShortSignature(r,t,s)}async function F(e){let{aptosConfig:i,jwt:t,ephemeralKeyPair:r,uidKey:o,verify:s}=e,{derivationPath:n}=e,f={jwt_b64:t,epk:r.publicKey.bcsToHex().toStringWithoutPrefix(),exp_date_secs:Number(r.expiryDateSecs),epk_blinder:a.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:o},{data:c}=await x({aptosConfig:i,path:"fetch",body:f,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}}),P=a.fromHexInput(c.signature).toUint8Array();if(s&&!C({aptosConfig:i,pepperBase:P,pepperInput:j(e)}))throw new Error("Unable to verify");let u=p.pairing(p.G1.ProjectivePoint.fromHex(P),p.G2.ProjectivePoint.fromAffine(I));return n===void 0&&(n=d),g.fromDerivationPath(n,p.fields.Fp12.toBytes(u)).slice(0,31)}async function H(e){let{aptosConfig:i,jwt:t,ephemeralKeyPair:r,pepper:o,uidKey:s,extraFieldKey:n}=e,f=b(t),c;if(n){let T=f[n];c=`"${n}":"${T}",`}let P={jwt_b64:t,epk:r.publicKey.bcsToHex().toStringWithoutPrefix(),epk_blinder:a.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:Number(r.expiryDateSecs),exp_horizon_secs:m,pepper:a.fromHexInput(o).toStringWithoutPrefix(),extra_field:n,uid_key:s||"sub"},{data:u}=await K({aptosConfig:i,path:"prove",body:P,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),y=u.proof,_=new h({a:y.a,b:y.b,c:y.c});return new A({proof:_,extraField:c,trainingWheelsSignature:S.fromHex(u.training_wheels_signature)})}async function O(e){let{fetchProofAsync:i}=e,{pepper:t}=e;if(t===void 0)t=await F(e);else if(a.fromHexInput(t).toUint8Array().length!==31)throw new Error("Pepper needs to be 31 bytes");let r=H({...e,pepper:t}),o=i?r:await r;return g.fromJWTAndProof({...e,proofFetcherOrData:o,pepper:t})}export{F as a,H as b,O as c};
2
+ //# sourceMappingURL=chunk-LXDHLUP4.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/oidb}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * faucet namespace and without having a dependency cycle error.\n */\nimport { jwtDecode } from \"jwt-decode\";\nimport { bls12_381 as bls } from \"@noble/curves/bls12-381\";\nimport { ProjPointType } from \"@noble/curves/abstract/weierstrass\";\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { getAptosPepperService, postAptosPepperService, postAptosProvingService } from \"../client\";\nimport {\n APTOS_BIP44_DEFAULT_DERIVATION_PATH,\n EPK_HORIZON_SECS,\n EphemeralSignature,\n Groth16Zkp,\n Hex,\n SignedGroth16Signature,\n} from \"../core\";\nimport { HexInput } from \"../types\";\nimport { Serializer } from \"../bcs\";\nimport { EphemeralKeyPair, KeylessAccount } from \"../account\";\nimport { PepperFetchResponse, ProverResponse } from \"../types/keyless\";\n\nconst APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST = \"APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST\";\n\nfunction stringToUint8Array(str: string): Uint8Array {\n const encoder = new TextEncoder();\n return encoder.encode(str);\n}\n\nconst PINKAS_VUF_SECRET_KEY_BASE_AFFINE = bls.G2.hashToCurve(\n stringToUint8Array(\"APTOS_KEYLESS_PEPPER_PINKAS_VUF_SECRET_KEY_BASE\"),\n { DST: APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST },\n).toAffine();\n\nfunction getPepperInput(args: { jwt: string; uidKey?: string }): ProjPointType<bigint> {\n const { jwt, uidKey } = args;\n const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);\n const serializer = new Serializer();\n serializer.serializeStr(jwtPayload.iss);\n serializer.serializeStr(jwtPayload.aud);\n serializer.serializeStr(jwtPayload[uidKey || \"sub\"]);\n serializer.serializeStr(uidKey || \"sub\");\n const serial = serializer.toUint8Array();\n const msg = bls.G1.hashToCurve(serial, { DST: \"APTOS_PEPPER_SERVICE_BLS12381_VUF_DST\" }).toAffine();\n const pp = bls.G1.ProjectivePoint.fromAffine(msg);\n return pp;\n}\n\nasync function verifyPepperBase(args: {\n aptosConfig: AptosConfig;\n pepperInput: ProjPointType<bigint>;\n pepperBase: Uint8Array;\n}): Promise<boolean> {\n const { aptosConfig, pepperInput, pepperBase } = args;\n const { data: pubKeyResponse } = await getAptosPepperService<any, { vrf_public_key_hex_string: string }>({\n aptosConfig,\n path: \"vrf-pub-key\",\n originMethod: \"getPepper\",\n });\n const publicKeyFromService = bls.G2.ProjectivePoint.fromHex(pubKeyResponse.vrf_public_key_hex_string);\n return bls.verifyShortSignature(pepperBase, pepperInput, publicKeyFromService);\n}\n\nexport async function getPepper(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n derivationPath?: string;\n verify?: boolean;\n}): Promise<Uint8Array> {\n const { aptosConfig, jwt, ephemeralKeyPair, uidKey, verify } = args;\n let { derivationPath } = args;\n\n const body = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.publicKey.bcsToHex().toStringWithoutPrefix(),\n exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n uid_key: uidKey,\n };\n // console.log(JSON.stringify(body));\n const { data } = await postAptosPepperService<any, PepperFetchResponse>({\n aptosConfig,\n path: \"fetch\",\n body,\n originMethod: \"getPepper\",\n overrides: { WITH_CREDENTIALS: false },\n });\n const pepperBase = Hex.fromHexInput(data.signature).toUint8Array();\n\n if (verify) {\n const pepperVerified = verifyPepperBase({ aptosConfig, pepperBase, pepperInput: getPepperInput(args) });\n if (!pepperVerified) {\n throw new Error(\"Unable to verify\");\n }\n }\n // This takes the BLS VUF H(m)^sk and transforms it into a Pinkas VUF e(H(m), g_3^sk), where g_3 is the base of the secret key (computed pseudo-randomly via hash-to-curve).\n // This gives us the freedom of either decentralizing the pepper service as a BLS-based MPC or on top of the validators, by reusing the Pinkas WVUF-based randomness infrastructure.\n const newPepperBase = bls.pairing(\n bls.G1.ProjectivePoint.fromHex(pepperBase),\n bls.G2.ProjectivePoint.fromAffine(PINKAS_VUF_SECRET_KEY_BASE_AFFINE),\n );\n\n if (derivationPath === undefined) {\n derivationPath = APTOS_BIP44_DEFAULT_DERIVATION_PATH;\n }\n const pepper = KeylessAccount.fromDerivationPath(derivationPath, bls.fields.Fp12.toBytes(newPepperBase));\n return pepper.slice(0, 31);\n}\n\nexport async function getProof(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n pepper: HexInput;\n uidKey?: string;\n extraFieldKey?: string;\n}): Promise<SignedGroth16Signature> {\n const { aptosConfig, jwt, ephemeralKeyPair, pepper, uidKey, extraFieldKey } = args;\n const jwtPayload = jwtDecode<{ [key: string]: string }>(jwt);\n let extraField;\n if (extraFieldKey) {\n const extraFieldVal = jwtPayload[extraFieldKey];\n extraField = `\"${extraFieldKey}\":\"${extraFieldVal}\",`;\n }\n const json = {\n jwt_b64: jwt,\n epk: ephemeralKeyPair.publicKey.bcsToHex().toStringWithoutPrefix(),\n epk_blinder: Hex.fromHexInput(ephemeralKeyPair.blinder).toStringWithoutPrefix(),\n exp_date_secs: Number(ephemeralKeyPair.expiryDateSecs),\n exp_horizon_secs: EPK_HORIZON_SECS,\n pepper: Hex.fromHexInput(pepper).toStringWithoutPrefix(),\n extra_field: extraFieldKey,\n uid_key: uidKey || \"sub\",\n };\n\n const { data } = await postAptosProvingService<any, 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 proof = new Groth16Zkp({\n a: proofPoints.a,\n b: proofPoints.b,\n c: proofPoints.c,\n });\n\n const signedProof = new SignedGroth16Signature({\n proof,\n extraField,\n trainingWheelsSignature: EphemeralSignature.fromHex(data.training_wheels_signature),\n });\n return signedProof;\n}\n\nexport async function deriveKeylessAccount(args: {\n aptosConfig: AptosConfig;\n jwt: string;\n ephemeralKeyPair: EphemeralKeyPair;\n uidKey?: string;\n pepper?: HexInput;\n extraFieldKey?: string;\n fetchProofAsync?: boolean;\n}): Promise<KeylessAccount> {\n const { fetchProofAsync } = args;\n let { pepper } = args;\n if (pepper === undefined) {\n pepper = await getPepper(args);\n } else if (Hex.fromHexInput(pepper).toUint8Array().length !== 31) {\n throw new Error(\"Pepper needs to be 31 bytes\");\n }\n\n const proofPromise = getProof({ ...args, pepper });\n const proof = fetchProofAsync ? proofPromise : await proofPromise;\n\n const keylessAccount = KeylessAccount.fromJWTAndProof({ ...args, proofFetcherOrData: proof, pepper });\n\n return keylessAccount;\n}\n"],"mappings":"6VASA,OAAS,aAAAA,MAAiB,aAC1B,OAAS,aAAaC,MAAW,0BAiBjC,IAAMC,EAAsC,sCAE5C,SAASC,EAAmBC,EAAyB,CAEnD,OADgB,IAAI,YAAY,EACjB,OAAOA,CAAG,CAC3B,CAEA,IAAMC,EAAoCC,EAAI,GAAG,YAC/CH,EAAmB,iDAAiD,EACpE,CAAE,IAAKD,CAAoC,CAC7C,EAAE,SAAS,EAEX,SAASK,EAAeC,EAA+D,CACrF,GAAM,CAAE,IAAAC,EAAK,OAAAC,CAAO,EAAIF,EAClBG,EAAaC,EAAqCH,CAAG,EACrDI,EAAa,IAAIC,EACvBD,EAAW,aAAaF,EAAW,GAAG,EACtCE,EAAW,aAAaF,EAAW,GAAG,EACtCE,EAAW,aAAaF,EAAWD,GAAU,KAAK,CAAC,EACnDG,EAAW,aAAaH,GAAU,KAAK,EACvC,IAAMK,EAASF,EAAW,aAAa,EACjCG,EAAMV,EAAI,GAAG,YAAYS,EAAQ,CAAE,IAAK,uCAAwC,CAAC,EAAE,SAAS,EAElG,OADWT,EAAI,GAAG,gBAAgB,WAAWU,CAAG,CAElD,CAEA,eAAeC,EAAiBT,EAIX,CACnB,GAAM,CAAE,YAAAU,EAAa,YAAAC,EAAa,WAAAC,CAAW,EAAIZ,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,mBAAoBoC,EAAO,OAAAR,CAAO,CAAC,CAGtG","names":["jwtDecode","bls","APTOS_KEYLESS_PEPPER_PINKAS_VUF_DST","stringToUint8Array","str","PINKAS_VUF_SECRET_KEY_BASE_AFFINE","bls","getPepperInput","args","jwt","uidKey","jwtPayload","jwtDecode","serializer","Serializer","serial","msg","verifyPepperBase","aptosConfig","pepperInput","pepperBase","pubKeyResponse","getAptosPepperService","publicKeyFromService","getPepper","ephemeralKeyPair","verify","derivationPath","body","Hex","data","postAptosPepperService","newPepperBase","APTOS_BIP44_DEFAULT_DERIVATION_PATH","KeylessAccount","getProof","pepper","extraFieldKey","extraField","extraFieldVal","json","EPK_HORIZON_SECS","postAptosProvingService","proofPoints","proof","Groth16Zkp","SignedGroth16Signature","EphemeralSignature","deriveKeylessAccount","fetchProofAsync","proofPromise"]}
@@ -1,2 +1,2 @@
1
- import{c as a}from"./chunk-XYLYHSEI.mjs";import e from"eventemitter3";var i=class extends e{constructor(t){super();this.config=t}start(t){let{sender:n}=t;this.account=n,this.transactionWorker=new a(this.config,n),this.transactionWorker.start(),this.registerToEvents()}push(t){let{data:n,options:o}=t;for(let r of n)this.transactionWorker.push(r,o)}registerToEvents(){this.transactionWorker.on("transactionSent",async t=>{this.emit("transactionSent",t)}),this.transactionWorker.on("transactionSendFailed",async t=>{this.emit("transactionSendFailed",t)}),this.transactionWorker.on("transactionExecuted",async t=>{this.emit("transactionExecuted",t)}),this.transactionWorker.on("transactionExecutionFailed",async t=>{this.emit("transactionExecutionFailed",t)}),this.transactionWorker.on("executionFinish",async t=>{this.emit("executionFinish",t)})}forSingleAccount(t){try{let{sender:n,data:o,options:r}=t;this.start({sender:n}),this.push({data:o,options:r})}catch(n){throw new Error(`failed to submit transactions with error: ${n}`)}}};export{i as a};
2
- //# sourceMappingURL=chunk-ZKNM27TR.mjs.map
1
+ import{c as a}from"./chunk-BM43VTGD.mjs";import e from"eventemitter3";var i=class extends e{constructor(t){super();this.config=t}start(t){let{sender:n}=t;this.account=n,this.transactionWorker=new a(this.config,n),this.transactionWorker.start(),this.registerToEvents()}push(t){let{data:n,options:o}=t;for(let r of n)this.transactionWorker.push(r,o)}registerToEvents(){this.transactionWorker.on("transactionSent",async t=>{this.emit("transactionSent",t)}),this.transactionWorker.on("transactionSendFailed",async t=>{this.emit("transactionSendFailed",t)}),this.transactionWorker.on("transactionExecuted",async t=>{this.emit("transactionExecuted",t)}),this.transactionWorker.on("transactionExecutionFailed",async t=>{this.emit("transactionExecutionFailed",t)}),this.transactionWorker.on("executionFinish",async t=>{this.emit("executionFinish",t)})}forSingleAccount(t){try{let{sender:n,data:o,options:r}=t;this.start({sender:n}),this.push({data:o,options:r})}catch(n){throw new Error(`failed to submit transactions with error: ${n}`)}}};export{i as a};
2
+ //# sourceMappingURL=chunk-M3PUC5JD.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transactionSubmission/management.ts"],"sourcesContent":["import EventEmitter from \"eventemitter3\";\nimport { TransactionWorkerEvents, TransactionWorker, TransactionWorkerEventsEnum } from \"../../transactions/management\";\nimport { InputGenerateTransactionPayloadData, InputGenerateTransactionOptions } from \"../../transactions\";\nimport { AptosConfig } from \"../aptosConfig\";\nimport { Account } from \"../../account\";\n\nexport class TransactionManagement extends EventEmitter<TransactionWorkerEvents> {\n account!: Account;\n\n transactionWorker!: TransactionWorker;\n\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n super();\n this.config = config;\n }\n\n /**\n * Internal function to start the transaction worker and\n * listen to worker events\n *\n * @param args.sender The sender account to sign and submit the transaction\n */\n private start(args: { sender: Account }): void {\n const { sender } = args;\n this.account = sender;\n this.transactionWorker = new TransactionWorker(this.config, sender);\n\n this.transactionWorker.start();\n this.registerToEvents();\n }\n\n /**\n * Internal function to push transaction data to the transaction worker.\n *\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * TODO - make this public once worker supports adding transactions to existing queue\n */\n private push(args: {\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): void {\n const { data, options } = args;\n\n for (const d of data) {\n this.transactionWorker.push(d, options);\n }\n }\n\n /**\n * Internal function to start listening to transaction worker events\n *\n * TODO - should we ask events to listen to as an input?\n */\n private registerToEvents() {\n this.transactionWorker.on(TransactionWorkerEventsEnum.TransactionSent, async (data) => {\n this.emit(TransactionWorkerEventsEnum.TransactionSent, data);\n });\n this.transactionWorker.on(TransactionWorkerEventsEnum.TransactionSendFailed, async (data) => {\n this.emit(TransactionWorkerEventsEnum.TransactionSendFailed, data);\n });\n this.transactionWorker.on(TransactionWorkerEventsEnum.TransactionExecuted, async (data) => {\n this.emit(TransactionWorkerEventsEnum.TransactionExecuted, data);\n });\n this.transactionWorker.on(TransactionWorkerEventsEnum.TransactionExecutionFailed, async (data) => {\n this.emit(TransactionWorkerEventsEnum.TransactionExecutionFailed, data);\n });\n this.transactionWorker.on(TransactionWorkerEventsEnum.ExecutionFinish, async (data) => {\n this.emit(TransactionWorkerEventsEnum.ExecutionFinish, data);\n });\n }\n\n /**\n * Send batch transactions for a single account.\n *\n * This function uses a transaction worker that receives payloads to be processed\n * and submitted to chain.\n * Note that this process is best for submitting multiple transactions that\n * dont rely on each other, i.e batch funds, batch token mints, etc.\n *\n * If any worker failure, the functions throws an error.\n *\n * @param args.sender The sender account to sign and submit the transaction\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * @return void. Throws if any error\n */\n forSingleAccount(args: {\n sender: Account;\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): void {\n try {\n const { sender, data, options } = args;\n this.start({ sender });\n\n this.push({ data, options });\n } catch (error: any) {\n throw new Error(`failed to submit transactions with error: ${error}`);\n }\n }\n}\n"],"mappings":"yCAAA,OAAOA,MAAkB,gBAMlB,IAAMC,EAAN,cAAoCC,CAAsC,CAO/E,YAAYC,EAAqB,CAC/B,MAAM,EACN,KAAK,OAASA,CAChB,CAQQ,MAAMC,EAAiC,CAC7C,GAAM,CAAE,OAAAC,CAAO,EAAID,EACnB,KAAK,QAAUC,EACf,KAAK,kBAAoB,IAAIC,EAAkB,KAAK,OAAQD,CAAM,EAElE,KAAK,kBAAkB,MAAM,EAC7B,KAAK,iBAAiB,CACxB,CAUQ,KAAKD,EAGJ,CACP,GAAM,CAAE,KAAAG,EAAM,QAAAC,CAAQ,EAAIJ,EAE1B,QAAWK,KAAKF,EACd,KAAK,kBAAkB,KAAKE,EAAGD,CAAO,CAE1C,CAOQ,kBAAmB,CACzB,KAAK,kBAAkB,qBAAgD,MAAOD,GAAS,CACrF,KAAK,uBAAkDA,CAAI,CAC7D,CAAC,EACD,KAAK,kBAAkB,2BAAsD,MAAOA,GAAS,CAC3F,KAAK,6BAAwDA,CAAI,CACnE,CAAC,EACD,KAAK,kBAAkB,yBAAoD,MAAOA,GAAS,CACzF,KAAK,2BAAsDA,CAAI,CACjE,CAAC,EACD,KAAK,kBAAkB,gCAA2D,MAAOA,GAAS,CAChG,KAAK,kCAA6DA,CAAI,CACxE,CAAC,EACD,KAAK,kBAAkB,qBAAgD,MAAOA,GAAS,CACrF,KAAK,uBAAkDA,CAAI,CAC7D,CAAC,CACH,CAkBA,iBAAiBH,EAIR,CACP,GAAI,CACF,GAAM,CAAE,OAAAC,EAAQ,KAAAE,EAAM,QAAAC,CAAQ,EAAIJ,EAClC,KAAK,MAAM,CAAE,OAAAC,CAAO,CAAC,EAErB,KAAK,KAAK,CAAE,KAAAE,EAAM,QAAAC,CAAQ,CAAC,CAC7B,OAASE,EAAY,CACnB,MAAM,IAAI,MAAM,6CAA6CA,CAAK,EAAE,CACtE,CACF,CACF","names":["EventEmitter","TransactionManagement","EventEmitter","config","args","sender","TransactionWorker","data","options","d","error"]}
@@ -0,0 +1,2 @@
1
+ import{a as R,c as Q,d as Y,e as _}from"./chunk-NVN6BTXK.mjs";import{q as J,t as y}from"./chunk-T7TIIAWK.mjs";import{a as nn}from"./chunk-5TNUDFLP.mjs";import{a as Z}from"./chunk-XFI6MEYQ.mjs";import{b as j}from"./chunk-CKMU5DQN.mjs";import{a as z}from"./chunk-AH44UPM4.mjs";import{a as L}from"./chunk-GSOKKQQ7.mjs";import{g as D}from"./chunk-Y4VKIX2V.mjs";import{a as X}from"./chunk-S5YUB2BI.mjs";import{a as d}from"./chunk-F2OCQQAA.mjs";import{a as H}from"./chunk-3FL3NLZ6.mjs";import{b as x,d as B,e as E,f as F}from"./chunk-O63GDJY4.mjs";import{b as p,d as g,e as W}from"./chunk-Z5GI2A3I.mjs";import{a as l,c as T,d as w}from"./chunk-ED6PYTNG.mjs";import{c as k,d as v,e as O,f as b,g as V,h as q,i as K}from"./chunk-RBDX3YWC.mjs";import{a as U}from"./chunk-MRCVSUJQ.mjs";import{b as C,c as G}from"./chunk-YE5B2S5L.mjs";import{a as M,b as N}from"./chunk-5NKRMZEX.mjs";import{a as $,c as S}from"./chunk-ZSZCPOHE.mjs";import{b as u}from"./chunk-U7EZI5D5.mjs";import{b as P}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as sn}from"@noble/hashes/sha3";async function Un(n){if(J(n))return dn(n);let{moduleAddress:e,moduleName:t,functionName:o}=y(n.function),r=await en({key:"entry-function",moduleAddress:e,moduleName:t,functionName:o,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Q});return cn({...n,abi:r})}function cn(n){let e=n.abi,{moduleAddress:t,moduleName:o,functionName:r}=y(n.function),a=R(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n.functionArguments.map((s,m)=>_(n.function,e,s,m,a));if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);let c=b.build(`${t}::${o}`,r,a,i);if("multisigAddress"in n){let s=u.from(n.multisigAddress);return new O(new q(s,new K(c)))}return new v(c)}async function kn(n){let{moduleAddress:e,moduleName:t,functionName:o}=y(n.function),r=await en({key:"view-function",moduleAddress:e,moduleName:t,functionName:o,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Y});return un({abi:r,...n})}function un(n){let e=n.abi,{moduleAddress:t,moduleName:o,functionName:r}=y(n.function),a=R(n.typeArguments);if(a.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${a.length}`);let i=n?.functionArguments?.map((c,s)=>_(n.function,e,c,s,a))??[];if(i.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${o}::${r}', expected ${e.parameters.length} but got ${i.length}`);return b.build(`${t}::${o}`,r,a,i)}function dn(n){return new k(new V(P.fromHexInput(n.bytecode).toUint8Array(),n.typeArguments??[],n.functionArguments))}async function mn(n){let{aptosConfig:e,sender:t,payload:o,options:r,feePayerAddress:a}=n,i=async()=>D[e.network]?{chainId:D[e.network]}:{chainId:(await L({aptosConfig:e})).chain_id},c=async()=>r?.gasUnitPrice?{gasEstimate:r.gasUnitPrice}:{gasEstimate:(await j({aptosConfig:e})).gas_estimate},s=async()=>{let f=async()=>r?.accountSequenceNumber!==void 0?r.accountSequenceNumber:(await Z({aptosConfig:e,accountAddress:t})).sequence_number;if(a&&u.from(a).equals(u.ZERO))try{return await f()}catch{return 0}else return f()},[{chainId:m},{gasEstimate:A},I]=await Promise.all([i(),c(),s()]),{maxGasAmount:an,gasUnitPrice:rn,expireTimestamp:on}={maxGasAmount:r?.maxGasAmount?BigInt(r.maxGasAmount):BigInt(2e5),gasUnitPrice:BigInt(A),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+20),...r};return new l(u.from(t),BigInt(I),o,BigInt(an),BigInt(rn),BigInt(on),new U(m))}async function vn(n){let{aptosConfig:e,sender:t,payload:o,options:r,feePayerAddress:a}=n,i=await mn({aptosConfig:e,sender:t,payload:o,options:r,feePayerAddress:a});if("secondarySignerAddresses"in n){let c=n.secondarySignerAddresses?.map(s=>u.from(s))??[];return new nn(i,c,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new H(i,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function On(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:o,feePayerPublicKey:r}=n,a=h(e);if(t.feePayerAddress){let c=new w(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),s=[];o&&(s=o.map(I=>h(I)));let m=h(r),A=new E(a,t.secondarySignerAddresses??[],s,{address:t.feePayerAddress,authenticator:m});return new d(c.raw_txn,A).bcsToBytes()}if(t.secondarySignerAddresses){let c=new T(t.rawTransaction,t.secondarySignerAddresses),s=[];s=o.map(A=>h(A));let m=new B(a,t.secondarySignerAddresses,s);return new d(c.raw_txn,m).bcsToBytes()}let i;if(a instanceof p)i=new x(a.public_key,a.signature);else if(a instanceof g)i=new F(a);else throw new Error("Invalid public key");return new d(t.rawTransaction,i).bcsToBytes()}function h(n){return n instanceof M?new g(n,new N(new S(new Uint8Array(64)))):new p(new $(n.toUint8Array()),new S(new Uint8Array(64)))}function An(n){let{transaction:e,senderAuthenticator:t,feePayerAuthenticator:o,additionalSignersAuthenticators:r}=n,a=X(e);if((o||r)&&(a instanceof T||a instanceof w))return fn(a,t,o,r);if(t instanceof p&&a instanceof l){let i=new x(t.public_key,t.signature);return new d(a,i).bcsToBytes()}if((t instanceof g||t instanceof W)&&a instanceof l){let i=new F(t);return new d(a,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${t} is not a supported account authentication scheme`)}function tn(n){let e=sn.create();for(let t of n)e.update(t);return e.digest()}var yn=tn(["APTOS::Transaction"]);function Vn(n){let e=An(n);return new P(tn([yn,new Uint8Array([0]),e])).toString()}function fn(n,e,t,o){if(n instanceof w){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let r=new E(e,n.secondary_signer_addresses,o??[],{address:n.fee_payer_address,authenticator:t});return new d(n.raw_txn,r).bcsToBytes()}if(n instanceof T){if(!o)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let r=new B(e,n.secondary_signer_addresses,o??[]);return new d(n.raw_txn,r).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}async function en({key:n,moduleAddress:e,moduleName:t,functionName:o,aptosConfig:r,abi:a,fetch:i}){return a!==void 0?a:z(async()=>i(e,t,o,r),`${n}-${r.network}-${e}-${t}-${o}`,1e3*60*5)()}export{Un as a,cn as b,kn as c,un as d,mn as e,vn as f,On as g,h,An as i,tn as j,Vn as k,fn as l};
2
+ //# sourceMappingURL=chunk-MCSLNNV3.mjs.map