@aptos-labs/ts-sdk 0.0.5 → 0.0.6

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 (391) hide show
  1. package/README.md +3 -3
  2. package/dist/browser/index.d.ts +340 -288
  3. package/dist/browser/index.global.js +54 -30
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +340 -288
  6. package/dist/common/index.js +24 -24
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/{account.d.ts → account.d.mts} +17 -17
  9. package/dist/esm/api/account.mjs +1 -1
  10. package/dist/esm/api/{ans.d.ts → ans.d.mts} +33 -33
  11. package/dist/esm/api/ans.mjs +1 -1
  12. package/dist/esm/api/aptos.d.mts +72 -0
  13. package/dist/esm/api/aptos.mjs +1 -1
  14. package/dist/esm/api/{aptosConfig.d.ts → aptosConfig.d.mts} +6 -6
  15. package/dist/esm/api/aptosConfig.mjs +1 -1
  16. package/dist/esm/api/coin.d.mts +59 -0
  17. package/dist/esm/api/coin.mjs +1 -1
  18. package/dist/esm/api/{digitalAsset.d.ts → digitalAsset.d.mts} +33 -33
  19. package/dist/esm/api/digitalAsset.mjs +1 -1
  20. package/dist/esm/api/{event.d.ts → event.d.mts} +14 -14
  21. package/dist/esm/api/event.mjs +1 -1
  22. package/dist/esm/api/{faucet.d.ts → faucet.d.mts} +13 -13
  23. package/dist/esm/api/faucet.mjs +1 -1
  24. package/dist/esm/api/{fungibleAsset.d.ts → fungibleAsset.d.mts} +7 -7
  25. package/dist/esm/api/fungibleAsset.mjs +1 -1
  26. package/dist/esm/api/{general.d.ts → general.d.mts} +11 -11
  27. package/dist/esm/api/general.mjs +1 -1
  28. package/dist/esm/api/index.d.mts +46 -0
  29. package/dist/esm/api/index.mjs +1 -1
  30. package/dist/esm/api/{staking.d.ts → staking.d.mts} +13 -13
  31. package/dist/esm/api/staking.mjs +1 -1
  32. package/dist/esm/api/{transaction.d.ts → transaction.d.mts} +7 -7
  33. package/dist/esm/api/transaction.mjs +1 -1
  34. package/dist/esm/api/{transactionSubmission.d.ts → transactionSubmission.d.mts} +33 -33
  35. package/dist/esm/api/transactionSubmission.mjs +1 -1
  36. package/dist/esm/bcs/{consts.d.ts → consts.d.mts} +5 -5
  37. package/dist/esm/bcs/consts.mjs +1 -1
  38. package/dist/esm/bcs/{deserializer.d.ts → deserializer.d.mts} +5 -5
  39. package/dist/esm/bcs/deserializer.mjs +1 -1
  40. package/dist/esm/bcs/index.d.mts +14 -0
  41. package/dist/esm/bcs/index.mjs +1 -1
  42. package/dist/esm/bcs/serializable/{entryFunctionBytes.d.ts → entryFunctionBytes.d.mts} +11 -11
  43. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  44. package/dist/esm/bcs/serializable/{fixedBytes.d.ts → fixedBytes.d.mts} +10 -10
  45. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  46. package/dist/esm/bcs/serializable/{movePrimitives.d.ts → movePrimitives.d.mts} +10 -10
  47. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  48. package/dist/esm/bcs/serializable/{moveStructs.d.ts → moveStructs.d.mts} +11 -11
  49. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  50. package/dist/esm/bcs/{serializer.d.ts → serializer.d.mts} +7 -7
  51. package/dist/esm/bcs/serializer.mjs +1 -1
  52. package/dist/esm/{chunk-WVMDCC4V.mjs → chunk-2W744GUN.mjs} +2 -2
  53. package/dist/esm/{chunk-WVMDCC4V.mjs.map → chunk-2W744GUN.mjs.map} +1 -1
  54. package/dist/esm/chunk-3JVGSFHP.mjs +2 -0
  55. package/dist/esm/chunk-3JVGSFHP.mjs.map +1 -0
  56. package/dist/esm/chunk-44MGBJ73.mjs +2 -0
  57. package/dist/esm/{chunk-CZZJAR3B.mjs.map → chunk-44MGBJ73.mjs.map} +1 -1
  58. package/dist/esm/chunk-4ADA5BE7.mjs +2 -0
  59. package/dist/esm/{chunk-7AQXAH6Q.mjs.map → chunk-4ADA5BE7.mjs.map} +1 -1
  60. package/dist/esm/{chunk-KYWYIK5P.mjs → chunk-4RVIA63I.mjs} +2 -2
  61. package/dist/esm/chunk-4RVIA63I.mjs.map +1 -0
  62. package/dist/esm/chunk-62SCW5NH.mjs +2 -0
  63. package/dist/esm/{chunk-YS2OX7AB.mjs.map → chunk-62SCW5NH.mjs.map} +1 -1
  64. package/dist/esm/{chunk-MIBLZSNS.mjs → chunk-7MNEEVXY.mjs} +2 -2
  65. package/dist/esm/chunk-7MNEEVXY.mjs.map +1 -0
  66. package/dist/esm/{chunk-KPESAXVI.mjs → chunk-AAIBCWZY.mjs} +2 -2
  67. package/dist/esm/{chunk-N6XWY4UT.mjs → chunk-ARVSIDVB.mjs} +1 -1
  68. package/dist/esm/{chunk-N6XWY4UT.mjs.map → chunk-ARVSIDVB.mjs.map} +1 -1
  69. package/dist/esm/{chunk-IXMH6AXJ.mjs → chunk-BFSEVKNA.mjs} +2 -2
  70. package/dist/esm/chunk-BP5ZO7NK.mjs +2 -0
  71. package/dist/esm/{chunk-FHJ7F7Z6.mjs.map → chunk-BP5ZO7NK.mjs.map} +1 -1
  72. package/dist/esm/chunk-BPYLPPEQ.mjs +2 -0
  73. package/dist/esm/{chunk-V6AAQLLJ.mjs.map → chunk-BPYLPPEQ.mjs.map} +1 -1
  74. package/dist/esm/{chunk-3OJN4I42.mjs → chunk-BV4OOU5Y.mjs} +2 -2
  75. package/dist/esm/{chunk-3OJN4I42.mjs.map → chunk-BV4OOU5Y.mjs.map} +1 -1
  76. package/dist/esm/{chunk-VAGYTPSI.mjs → chunk-BWMNPUTK.mjs} +2 -2
  77. package/dist/esm/chunk-CYDWEPFL.mjs +1 -0
  78. package/dist/esm/chunk-EFIYW4WK.mjs +2 -0
  79. package/dist/esm/{chunk-2MQZUGO6.mjs → chunk-EGOYLZBU.mjs} +2 -2
  80. package/dist/esm/chunk-EGOYLZBU.mjs.map +1 -0
  81. package/dist/esm/chunk-EQ5BEDJ7.mjs +2 -0
  82. package/dist/esm/{chunk-ADR4XQPR.mjs.map → chunk-EQ5BEDJ7.mjs.map} +1 -1
  83. package/dist/esm/chunk-EWTHPMEE.mjs +2 -0
  84. package/dist/esm/{chunk-LAXIJRYU.mjs.map → chunk-EWTHPMEE.mjs.map} +1 -1
  85. package/dist/esm/chunk-EYXHVA6W.mjs +2 -0
  86. package/dist/esm/chunk-EYXHVA6W.mjs.map +1 -0
  87. package/dist/esm/chunk-GEFQFRL3.mjs +2 -0
  88. package/dist/esm/chunk-GEFQFRL3.mjs.map +1 -0
  89. package/dist/esm/{chunk-BC2NOUYT.mjs → chunk-GTC7WHMV.mjs} +2 -2
  90. package/dist/esm/{chunk-BC2NOUYT.mjs.map → chunk-GTC7WHMV.mjs.map} +1 -1
  91. package/dist/esm/{chunk-27P7PELS.mjs → chunk-HA6JD5R6.mjs} +2 -2
  92. package/dist/esm/{chunk-27P7PELS.mjs.map → chunk-HA6JD5R6.mjs.map} +1 -1
  93. package/dist/esm/chunk-HVADSXTB.mjs +2 -0
  94. package/dist/esm/{chunk-LU6VS7PJ.mjs.map → chunk-HVADSXTB.mjs.map} +1 -1
  95. package/dist/esm/{chunk-Z56AKXJ7.mjs → chunk-IG5CHHSI.mjs} +2 -2
  96. package/dist/esm/chunk-IXMB2GOK.mjs +2 -0
  97. package/dist/esm/chunk-IXMB2GOK.mjs.map +1 -0
  98. package/dist/esm/{chunk-TYHBYRUA.mjs → chunk-J5ZFOJN2.mjs} +2 -2
  99. package/dist/esm/chunk-J5ZFOJN2.mjs.map +1 -0
  100. package/dist/esm/chunk-JDS7K2WI.mjs +2 -0
  101. package/dist/esm/{chunk-KNLMUSIO.mjs.map → chunk-JDS7K2WI.mjs.map} +1 -1
  102. package/dist/esm/chunk-JZNLZMUC.mjs +2 -0
  103. package/dist/esm/{chunk-WGXAIQ7K.mjs.map → chunk-JZNLZMUC.mjs.map} +1 -1
  104. package/dist/esm/chunk-KQXRH5FK.mjs +2 -0
  105. package/dist/esm/{chunk-UQIOMAXE.mjs.map → chunk-KQXRH5FK.mjs.map} +1 -1
  106. package/dist/esm/{chunk-2B5QXKPU.mjs → chunk-NGCFPQ22.mjs} +2 -2
  107. package/dist/esm/chunk-NGCFPQ22.mjs.map +1 -0
  108. package/dist/esm/chunk-NTD3H2S4.mjs +2 -0
  109. package/dist/esm/chunk-NTD3H2S4.mjs.map +1 -0
  110. package/dist/esm/{chunk-KFP7MDSD.mjs → chunk-NYFVEKF6.mjs} +2 -2
  111. package/dist/esm/chunk-NZIJV4O2.mjs +2 -0
  112. package/dist/esm/{chunk-HH5RSP2H.mjs.map → chunk-NZIJV4O2.mjs.map} +1 -1
  113. package/dist/esm/{chunk-TXUMB5ZO.mjs → chunk-P32MY5YF.mjs} +2 -2
  114. package/dist/esm/{chunk-TXUMB5ZO.mjs.map → chunk-P32MY5YF.mjs.map} +1 -1
  115. package/dist/esm/{chunk-DNYVUM3K.mjs → chunk-Q6N6QACD.mjs} +2 -2
  116. package/dist/esm/{chunk-DNYVUM3K.mjs.map → chunk-Q6N6QACD.mjs.map} +1 -1
  117. package/dist/esm/chunk-QWVR4RCV.mjs +2 -0
  118. package/dist/esm/{chunk-IPJKGHQY.mjs.map → chunk-QWVR4RCV.mjs.map} +1 -1
  119. package/dist/esm/chunk-R26XML3D.mjs +2 -0
  120. package/dist/esm/chunk-R26XML3D.mjs.map +1 -0
  121. package/dist/esm/chunk-R3KWVOFG.mjs +2 -0
  122. package/dist/esm/{chunk-KWJ6XKNF.mjs.map → chunk-R3KWVOFG.mjs.map} +1 -1
  123. package/dist/esm/chunk-RYETO74W.mjs +2 -0
  124. package/dist/esm/{chunk-BIUGRAMO.mjs.map → chunk-RYETO74W.mjs.map} +1 -1
  125. package/dist/esm/chunk-S36IYY6K.mjs +2 -0
  126. package/dist/esm/{chunk-DXUIJ6KA.mjs.map → chunk-S36IYY6K.mjs.map} +1 -1
  127. package/dist/esm/chunk-TIH6ARYP.mjs +2 -0
  128. package/dist/esm/{chunk-IZHPCZE3.mjs.map → chunk-TIH6ARYP.mjs.map} +1 -1
  129. package/dist/esm/{chunk-O243HOP3.mjs → chunk-TQD4IGUM.mjs} +2 -2
  130. package/dist/esm/chunk-TQD4IGUM.mjs.map +1 -0
  131. package/dist/esm/chunk-U25N2VWA.mjs +2 -0
  132. package/dist/esm/{chunk-FNB6CFQR.mjs.map → chunk-U25N2VWA.mjs.map} +1 -1
  133. package/dist/esm/chunk-U3LO2FSJ.mjs +2 -0
  134. package/dist/esm/{chunk-ZXJ5ZBTL.mjs.map → chunk-U3LO2FSJ.mjs.map} +1 -1
  135. package/dist/esm/chunk-U6SZNNVL.mjs +2 -0
  136. package/dist/esm/chunk-U6SZNNVL.mjs.map +1 -0
  137. package/dist/esm/{chunk-EKAOAGNQ.mjs → chunk-UAAI3NCA.mjs} +2 -2
  138. package/dist/esm/chunk-UNQNACJT.mjs +2 -0
  139. package/dist/esm/chunk-UPLWWSB4.mjs +2 -0
  140. package/dist/esm/{chunk-J3QOSJFP.mjs.map → chunk-UPLWWSB4.mjs.map} +1 -1
  141. package/dist/esm/{chunk-XFSL7O6Q.mjs → chunk-V45RFKH7.mjs} +2 -2
  142. package/dist/esm/chunk-V45RFKH7.mjs.map +1 -0
  143. package/dist/esm/{chunk-PJDVHU7X.mjs → chunk-VMQWW5UT.mjs} +2 -2
  144. package/dist/esm/{chunk-PJDVHU7X.mjs.map → chunk-VMQWW5UT.mjs.map} +1 -1
  145. package/dist/esm/chunk-VOYW2TZW.mjs +2 -0
  146. package/dist/esm/{chunk-KJDY66XF.mjs.map → chunk-VOYW2TZW.mjs.map} +1 -1
  147. package/dist/esm/chunk-VWVEDCBM.mjs +2 -0
  148. package/dist/esm/{chunk-BREUBEPM.mjs.map → chunk-VWVEDCBM.mjs.map} +1 -1
  149. package/dist/esm/{chunk-ZT2A5ABR.mjs → chunk-VYAVLUPJ.mjs} +2 -2
  150. package/dist/esm/{chunk-ZT2A5ABR.mjs.map → chunk-VYAVLUPJ.mjs.map} +1 -1
  151. package/dist/esm/{chunk-XFS5O5GJ.mjs → chunk-WKY5ENCK.mjs} +2 -2
  152. package/dist/esm/{chunk-XFS5O5GJ.mjs.map → chunk-WKY5ENCK.mjs.map} +1 -1
  153. package/dist/esm/{chunk-BTK34A5U.mjs → chunk-WX43AJTD.mjs} +10 -10
  154. package/dist/esm/chunk-WX43AJTD.mjs.map +1 -0
  155. package/dist/esm/chunk-X32O46IB.mjs +2 -0
  156. package/dist/esm/{chunk-PDLUCVJB.mjs.map → chunk-X32O46IB.mjs.map} +1 -1
  157. package/dist/esm/chunk-Y5DJPHJT.mjs +2 -0
  158. package/dist/esm/chunk-Y5DJPHJT.mjs.map +1 -0
  159. package/dist/esm/{chunk-GUT3G5CG.mjs → chunk-Y7VR7X5W.mjs} +2 -2
  160. package/dist/esm/chunk-Y7VR7X5W.mjs.map +1 -0
  161. package/dist/esm/chunk-YYRDFZE6.mjs +2 -0
  162. package/dist/esm/{chunk-UVGCVCNG.mjs.map → chunk-YYRDFZE6.mjs.map} +1 -1
  163. package/dist/esm/chunk-Z2UDRTHA.mjs +2 -0
  164. package/dist/esm/{chunk-JTGGMXB7.mjs.map → chunk-Z2UDRTHA.mjs.map} +1 -1
  165. package/dist/esm/{chunk-XNFEUXDS.mjs → chunk-ZWH2ESXT.mjs} +1 -1
  166. package/dist/esm/chunk-ZWH2ESXT.mjs.map +1 -0
  167. package/dist/esm/client/{core.d.ts → core.d.mts} +9 -9
  168. package/dist/esm/client/core.mjs +1 -1
  169. package/dist/esm/client/{get.d.ts → get.d.mts} +12 -12
  170. package/dist/esm/client/get.mjs +1 -1
  171. package/dist/esm/client/index.d.mts +11 -0
  172. package/dist/esm/client/index.mjs +1 -1
  173. package/dist/esm/client/{post.d.ts → post.d.mts} +14 -14
  174. package/dist/esm/client/post.mjs +1 -1
  175. package/dist/esm/client/{types.d.ts → types.d.mts} +5 -5
  176. package/dist/esm/client/types.mjs +1 -1
  177. package/dist/esm/core/{account.d.ts → account.d.mts} +13 -13
  178. package/dist/esm/core/account.mjs +1 -1
  179. package/dist/esm/core/{accountAddress.d.ts → accountAddress.d.mts} +11 -11
  180. package/dist/esm/core/accountAddress.mjs +1 -1
  181. package/dist/esm/core/{authenticationKey.d.ts → authenticationKey.d.mts} +12 -12
  182. package/dist/esm/core/authenticationKey.mjs +1 -1
  183. package/dist/esm/core/{common.d.ts → common.d.mts} +1 -1
  184. package/dist/esm/core/common.mjs +1 -1
  185. package/dist/esm/core/crypto/{anyPublicKey.d.ts → anyPublicKey.d.mts} +11 -11
  186. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  187. package/dist/esm/core/crypto/{anySignature.d.ts → anySignature.d.mts} +10 -10
  188. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  189. package/dist/esm/core/crypto/{asymmetricCrypto.d.ts → asymmetricCrypto.d.mts} +8 -8
  190. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  191. package/dist/esm/core/crypto/{ed25519.d.ts → ed25519.d.mts} +10 -10
  192. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  193. package/dist/esm/core/crypto/{hdKey.d.ts → hdKey.d.mts} +1 -1
  194. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  195. package/dist/esm/core/crypto/index.d.mts +17 -0
  196. package/dist/esm/core/crypto/index.mjs +1 -1
  197. package/dist/esm/core/crypto/{multiEd25519.d.ts → multiEd25519.d.mts} +11 -11
  198. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  199. package/dist/esm/core/crypto/{multiKey.d.ts → multiKey.d.mts} +12 -12
  200. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  201. package/dist/esm/core/crypto/{secp256k1.d.ts → secp256k1.d.mts} +10 -10
  202. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  203. package/dist/esm/core/{hex.d.ts → hex.d.mts} +6 -6
  204. package/dist/esm/core/hex.mjs +1 -1
  205. package/dist/esm/core/index.d.mts +21 -0
  206. package/dist/esm/core/index.mjs +1 -1
  207. package/dist/esm/{index.d.ts → index.d.mts} +60 -60
  208. package/dist/esm/index.mjs +1 -1
  209. package/dist/esm/internal/{account.d.ts → account.d.mts} +17 -17
  210. package/dist/esm/internal/account.mjs +1 -1
  211. package/dist/esm/internal/{ans.d.ts → ans.d.mts} +32 -32
  212. package/dist/esm/internal/ans.mjs +1 -1
  213. package/dist/esm/internal/coin.d.mts +43 -0
  214. package/dist/esm/internal/coin.mjs +1 -1
  215. package/dist/esm/internal/{digitalAsset.d.ts → digitalAsset.d.mts} +32 -32
  216. package/dist/esm/internal/digitalAsset.mjs +1 -1
  217. package/dist/esm/internal/{event.d.ts → event.d.mts} +14 -14
  218. package/dist/esm/internal/event.mjs +1 -1
  219. package/dist/esm/internal/faucet.d.mts +29 -0
  220. package/dist/esm/internal/faucet.mjs +1 -1
  221. package/dist/esm/internal/{fungibleAsset.d.ts → fungibleAsset.d.mts} +7 -7
  222. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  223. package/dist/esm/internal/{general.d.ts → general.d.mts} +11 -11
  224. package/dist/esm/internal/general.mjs +1 -1
  225. package/dist/esm/internal/{staking.d.ts → staking.d.mts} +13 -13
  226. package/dist/esm/internal/staking.mjs +1 -1
  227. package/dist/esm/internal/{transaction.d.ts → transaction.d.mts} +7 -7
  228. package/dist/esm/internal/transaction.mjs +1 -1
  229. package/dist/esm/internal/{transactionSubmission.d.ts → transactionSubmission.d.mts} +32 -32
  230. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  231. package/dist/esm/transactions/authenticator/{account.d.ts → account.d.mts} +15 -15
  232. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  233. package/dist/esm/transactions/authenticator/index.d.mts +19 -0
  234. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  235. package/dist/esm/transactions/authenticator/{transaction.d.ts → transaction.d.mts} +18 -18
  236. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  237. package/dist/esm/transactions/{index.d.ts → index.d.mts} +39 -39
  238. package/dist/esm/transactions/index.mjs +1 -1
  239. package/dist/esm/transactions/instances/chainId.d.mts +21 -0
  240. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  241. package/dist/esm/transactions/instances/{identifier.d.ts → identifier.d.mts} +9 -9
  242. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  243. package/dist/esm/transactions/instances/index.d.mts +29 -0
  244. package/dist/esm/transactions/instances/index.mjs +1 -1
  245. package/dist/esm/transactions/instances/{moduleId.d.ts → moduleId.d.mts} +12 -12
  246. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  247. package/dist/esm/transactions/instances/{rawTransaction.d.ts → rawTransaction.d.mts} +16 -16
  248. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  249. package/dist/esm/transactions/instances/{rotationProofChallenge.d.ts → rotationProofChallenge.d.mts} +14 -14
  250. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  251. package/dist/esm/transactions/instances/{signedTransaction.d.ts → signedTransaction.d.mts} +25 -25
  252. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  253. package/dist/esm/transactions/instances/{transactionArgument.d.ts → transactionArgument.d.mts} +8 -8
  254. package/dist/esm/transactions/instances/{transactionPayload.d.ts → transactionPayload.d.mts} +14 -14
  255. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  256. package/dist/esm/transactions/transactionBuilder/{helpers.d.ts → helpers.d.mts} +31 -31
  257. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  258. package/dist/esm/transactions/transactionBuilder/index.d.mts +35 -0
  259. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  260. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +54 -0
  261. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  262. package/dist/esm/transactions/transactionBuilder/{transactionBuilder.d.ts → transactionBuilder.d.mts} +33 -35
  263. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  264. package/dist/esm/transactions/typeTag/{index.d.ts → index.d.mts} +12 -12
  265. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  266. package/dist/esm/transactions/typeTag/{parser.d.ts → parser.d.mts} +14 -13
  267. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  268. package/dist/esm/transactions/{types.d.ts → types.d.mts} +49 -60
  269. package/dist/esm/types/generated/{operations.d.ts → operations.d.mts} +78 -78
  270. package/dist/esm/types/generated/{queries.d.ts → queries.d.mts} +31 -31
  271. package/dist/esm/types/generated/queries.mjs +1 -1
  272. package/dist/esm/types/generated/{types.d.ts → types.d.mts} +3184 -3146
  273. package/dist/esm/types/generated/types.mjs +1 -1
  274. package/dist/esm/types/generated/types.mjs.map +1 -1
  275. package/dist/esm/types/{index.d.ts → index.d.mts} +94 -92
  276. package/dist/esm/types/index.mjs +1 -1
  277. package/dist/esm/types/indexer.d.mts +62 -0
  278. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  279. package/dist/esm/utils/const.mjs +1 -1
  280. package/dist/esm/utils/helpers.mjs +1 -1
  281. package/dist/esm/utils/index.d.mts +2 -0
  282. package/dist/esm/utils/index.mjs +2 -0
  283. package/dist/esm/utils/index.mjs.map +1 -0
  284. package/dist/esm/utils/memoize.mjs +1 -1
  285. package/dist/esm/version.mjs +1 -1
  286. package/package.json +30 -30
  287. package/src/api/account.ts +2 -2
  288. package/src/api/coin.ts +2 -2
  289. package/src/api/event.ts +2 -2
  290. package/src/api/general.ts +4 -4
  291. package/src/api/transactionSubmission.ts +7 -2
  292. package/src/client/core.ts +1 -1
  293. package/src/client/get.ts +6 -2
  294. package/src/client/post.ts +12 -4
  295. package/src/index.ts +1 -1
  296. package/src/internal/account.ts +2 -2
  297. package/src/internal/ans.ts +2 -2
  298. package/src/internal/coin.ts +2 -2
  299. package/src/internal/event.ts +2 -2
  300. package/src/internal/general.ts +7 -6
  301. package/src/internal/transactionSubmission.ts +41 -9
  302. package/src/transactions/transactionBuilder/helpers.ts +2 -2
  303. package/src/transactions/transactionBuilder/transactionBuilder.ts +15 -16
  304. package/src/transactions/typeTag/parser.ts +10 -2
  305. package/src/transactions/types.ts +3 -12
  306. package/src/types/generated/operations.ts +33 -33
  307. package/src/types/generated/queries.ts +22 -22
  308. package/src/types/generated/types.ts +2253 -2251
  309. package/src/types/index.ts +16 -10
  310. package/src/utils/index.ts +2 -0
  311. package/dist/esm/api/aptos.d.ts +0 -72
  312. package/dist/esm/api/coin.d.ts +0 -59
  313. package/dist/esm/api/index.d.ts +0 -46
  314. package/dist/esm/bcs/index.d.ts +0 -14
  315. package/dist/esm/chunk-2444YR3Y.mjs +0 -2
  316. package/dist/esm/chunk-2444YR3Y.mjs.map +0 -1
  317. package/dist/esm/chunk-2B5QXKPU.mjs.map +0 -1
  318. package/dist/esm/chunk-2MQZUGO6.mjs.map +0 -1
  319. package/dist/esm/chunk-3YOV42H5.mjs +0 -2
  320. package/dist/esm/chunk-3YOV42H5.mjs.map +0 -1
  321. package/dist/esm/chunk-7AIV5FEN.mjs +0 -2
  322. package/dist/esm/chunk-7AIV5FEN.mjs.map +0 -1
  323. package/dist/esm/chunk-7AQXAH6Q.mjs +0 -2
  324. package/dist/esm/chunk-7TL2MY2B.mjs +0 -2
  325. package/dist/esm/chunk-7TL2MY2B.mjs.map +0 -1
  326. package/dist/esm/chunk-ADR4XQPR.mjs +0 -2
  327. package/dist/esm/chunk-AY2HWVDO.mjs +0 -2
  328. package/dist/esm/chunk-AY2HWVDO.mjs.map +0 -1
  329. package/dist/esm/chunk-BIUGRAMO.mjs +0 -2
  330. package/dist/esm/chunk-BREUBEPM.mjs +0 -2
  331. package/dist/esm/chunk-BTK34A5U.mjs.map +0 -1
  332. package/dist/esm/chunk-CZZJAR3B.mjs +0 -2
  333. package/dist/esm/chunk-DXUIJ6KA.mjs +0 -2
  334. package/dist/esm/chunk-E72CFUU4.mjs +0 -2
  335. package/dist/esm/chunk-FHJ7F7Z6.mjs +0 -2
  336. package/dist/esm/chunk-FNB6CFQR.mjs +0 -2
  337. package/dist/esm/chunk-GUT3G5CG.mjs.map +0 -1
  338. package/dist/esm/chunk-HH5RSP2H.mjs +0 -2
  339. package/dist/esm/chunk-IPJKGHQY.mjs +0 -2
  340. package/dist/esm/chunk-IZHPCZE3.mjs +0 -2
  341. package/dist/esm/chunk-J3QOSJFP.mjs +0 -2
  342. package/dist/esm/chunk-J5OKXARS.mjs +0 -2
  343. package/dist/esm/chunk-J5OKXARS.mjs.map +0 -1
  344. package/dist/esm/chunk-JTGGMXB7.mjs +0 -2
  345. package/dist/esm/chunk-KJDY66XF.mjs +0 -2
  346. package/dist/esm/chunk-KNLMUSIO.mjs +0 -2
  347. package/dist/esm/chunk-KWJ6XKNF.mjs +0 -2
  348. package/dist/esm/chunk-KYWYIK5P.mjs.map +0 -1
  349. package/dist/esm/chunk-LAXIJRYU.mjs +0 -2
  350. package/dist/esm/chunk-LU6VS7PJ.mjs +0 -2
  351. package/dist/esm/chunk-MIBLZSNS.mjs.map +0 -1
  352. package/dist/esm/chunk-NKTKHC3Z.mjs +0 -2
  353. package/dist/esm/chunk-NKTKHC3Z.mjs.map +0 -1
  354. package/dist/esm/chunk-O243HOP3.mjs.map +0 -1
  355. package/dist/esm/chunk-PDLUCVJB.mjs +0 -2
  356. package/dist/esm/chunk-SJLO3JIH.mjs +0 -2
  357. package/dist/esm/chunk-TYHBYRUA.mjs.map +0 -1
  358. package/dist/esm/chunk-UQIOMAXE.mjs +0 -2
  359. package/dist/esm/chunk-UVGCVCNG.mjs +0 -2
  360. package/dist/esm/chunk-V6AAQLLJ.mjs +0 -2
  361. package/dist/esm/chunk-WGXAIQ7K.mjs +0 -2
  362. package/dist/esm/chunk-WNEZCERQ.mjs +0 -2
  363. package/dist/esm/chunk-WNEZCERQ.mjs.map +0 -1
  364. package/dist/esm/chunk-XFSL7O6Q.mjs.map +0 -1
  365. package/dist/esm/chunk-YS2OX7AB.mjs +0 -2
  366. package/dist/esm/chunk-ZXJ5ZBTL.mjs +0 -2
  367. package/dist/esm/client/index.d.ts +0 -11
  368. package/dist/esm/core/crypto/index.d.ts +0 -17
  369. package/dist/esm/core/index.d.ts +0 -21
  370. package/dist/esm/internal/coin.d.ts +0 -43
  371. package/dist/esm/internal/faucet.d.ts +0 -29
  372. package/dist/esm/transactions/authenticator/index.d.ts +0 -19
  373. package/dist/esm/transactions/instances/chainId.d.ts +0 -21
  374. package/dist/esm/transactions/instances/index.d.ts +0 -29
  375. package/dist/esm/transactions/transactionBuilder/index.d.ts +0 -35
  376. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.ts +0 -54
  377. package/dist/esm/types/indexer.d.ts +0 -62
  378. /package/dist/esm/{chunk-KPESAXVI.mjs.map → chunk-AAIBCWZY.mjs.map} +0 -0
  379. /package/dist/esm/{chunk-IXMH6AXJ.mjs.map → chunk-BFSEVKNA.mjs.map} +0 -0
  380. /package/dist/esm/{chunk-VAGYTPSI.mjs.map → chunk-BWMNPUTK.mjs.map} +0 -0
  381. /package/dist/esm/{chunk-XNFEUXDS.mjs.map → chunk-CYDWEPFL.mjs.map} +0 -0
  382. /package/dist/esm/{chunk-E72CFUU4.mjs.map → chunk-EFIYW4WK.mjs.map} +0 -0
  383. /package/dist/esm/{chunk-Z56AKXJ7.mjs.map → chunk-IG5CHHSI.mjs.map} +0 -0
  384. /package/dist/esm/{chunk-KFP7MDSD.mjs.map → chunk-NYFVEKF6.mjs.map} +0 -0
  385. /package/dist/esm/{chunk-EKAOAGNQ.mjs.map → chunk-UAAI3NCA.mjs.map} +0 -0
  386. /package/dist/esm/{chunk-SJLO3JIH.mjs.map → chunk-UNQNACJT.mjs.map} +0 -0
  387. /package/dist/esm/utils/{apiEndpoints.d.ts → apiEndpoints.d.mts} +0 -0
  388. /package/dist/esm/utils/{const.d.ts → const.d.mts} +0 -0
  389. /package/dist/esm/utils/{helpers.d.ts → helpers.d.mts} +0 -0
  390. /package/dist/esm/utils/{memoize.d.ts → memoize.d.mts} +0 -0
  391. /package/dist/esm/{version.d.ts → version.d.mts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/hex.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * This enum is used to explain why parsing might have failed.\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses, use AccountAddress.\n *\n * NOTE: When accepting hex data as input to a function, prefer to accept HexInput and\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Hex is a helper class for working with hex data. Hex data, when represented as a\n * string, generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * You might use this class like this:\n *\n * ```ts\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n *\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * These are some other ways to chain the functions together:\n * - `Hex.fromString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data Uint8Array\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Static method to convert a hex string to Hex\n *\n * @param str A hex string, with or without the 0x prefix\n *\n * @returns Hex\n */\n static fromString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (e) {\n const error = e as Error;\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Static method to convert an instance of HexInput to Hex\n *\n * @param hexInput A HexInput (string or Uint8Array)\n *\n * @returns Hex\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n return Hex.fromString(hexInput);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is valid hex.\n *\n * @param str A hex string representing byte data.\n *\n * @returns valid = true if the string is valid, false if not. If the string is not\n * valid, invalidReason and invalidReasonMessage will be set explaining why it is\n * invalid.\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromString(str);\n return { valid: true };\n } catch (e) {\n const error = e as ParsingError<HexInvalidReason>;\n return {\n valid: false,\n invalidReason: error.invalidReason,\n invalidReasonMessage: error.message,\n };\n }\n }\n\n /**\n * Return whether Hex instances are equal. Hex instances are considered equal if\n * their underlying byte data is identical.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n */\n equals(other: Hex): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"oCAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAOhC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBAHVA,OAAA,IAgCCC,EAAN,KAAU,CAQf,YAAYC,EAAkB,CAC5B,KAAK,KAAOA,CACd,CAYA,cAA2B,CACzB,OAAO,KAAK,IACd,CAOA,uBAAgC,CAC9B,OAAOC,EAAW,KAAK,IAAI,CAC7B,CAOA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,GACzC,CAaA,OAAO,WAAWC,EAAkB,CAClC,IAAIC,EAAQD,EAMZ,GAJIC,EAAM,WAAW,IAAI,IACvBA,EAAQA,EAAM,MAAM,CAAC,GAGnBA,EAAM,SAAW,EACnB,MAAM,IAAIC,EACR,4FACA,WACF,EAGF,GAAID,EAAM,OAAS,IAAM,EACvB,MAAM,IAAIC,EAAa,uDAAwD,gBAA+B,EAGhH,GAAI,CACF,OAAO,IAAIL,EAAIM,EAAWF,CAAK,CAAC,CAClC,OAAS,EAAP,CACA,IAAMG,EAAQ,EACd,MAAM,IAAIF,EACR,+CAA+CE,EAAM,UACrD,mBACF,CACF,CACF,CASA,OAAO,aAAaC,EAAyB,CAC3C,OAAIA,aAAoB,WAAmB,IAAIR,EAAIQ,CAAQ,EACpDR,EAAI,WAAWQ,CAAQ,CAChC,CAeA,OAAO,QAAQL,EAA8C,CAC3D,GAAI,CACF,OAAAH,EAAI,WAAWG,CAAG,EACX,CAAE,MAAO,EAAK,CACvB,OAASM,EAAP,CACA,IAAMF,EAAQE,EACd,MAAO,CACL,MAAO,GACP,cAAeF,EAAM,cACrB,qBAAsBA,EAAM,OAC9B,CACF,CACF,CASA,OAAOG,EAAqB,CAC1B,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,EAAM,CACtE,CACF","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","e","other","value","index"]}
1
+ {"version":3,"sources":["../../src/core/hex.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { HexInput } from \"../types\";\n\n/**\n * This enum is used to explain why parsing might have failed.\n */\nexport enum HexInvalidReason {\n TOO_SHORT = \"too_short\",\n INVALID_LENGTH = \"invalid_length\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n}\n\n/**\n * NOTE: Do not use this class when working with account addresses, use AccountAddress.\n *\n * NOTE: When accepting hex data as input to a function, prefer to accept HexInput and\n * then use the static helper methods of this class to convert it into the desired\n * format. This enables the greatest flexibility for the developer.\n *\n * Hex is a helper class for working with hex data. Hex data, when represented as a\n * string, generally looks like this, for example: 0xaabbcc, 45cd32, etc.\n *\n * You might use this class like this:\n *\n * ```ts\n * getTransactionByHash(txnHash: HexInput): Promise<Transaction> {\n * const txnHashString = Hex.fromHexInput(txnHash).toString();\n * return await getTransactionByHashInner(txnHashString);\n * }\n * ```\n *\n * This call to `Hex.fromHexInput().toString()` converts the HexInput to a hex string\n * with a leading 0x prefix, regardless of what the input format was.\n *\n * These are some other ways to chain the functions together:\n * - `Hex.fromString({ hexInput: \"0x1f\" }).toUint8Array()`\n * - `new Hex([1, 3]).toStringWithoutPrefix()`\n */\nexport class Hex {\n private readonly data: Uint8Array;\n\n /**\n * Create a new Hex instance from a Uint8Array.\n *\n * @param data Uint8Array\n */\n constructor(data: Uint8Array) {\n this.data = data;\n }\n\n // ===\n // Methods for representing an instance of Hex as other types.\n // ===\n\n /**\n * Get the inner hex data. The inner data is already a Uint8Array so no conversion\n * is taking place here, it just returns the inner data.\n *\n * @returns Hex data as Uint8Array\n */\n toUint8Array(): Uint8Array {\n return this.data;\n }\n\n /**\n * Get the hex data as a string without the 0x prefix.\n *\n * @returns Hex string without 0x prefix\n */\n toStringWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Get the hex data as a string with the 0x prefix.\n *\n * @returns Hex string with 0x prefix\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n // ===\n // Methods for creating an instance of Hex from other types.\n // ===\n\n /**\n * Static method to convert a hex string to Hex\n *\n * @param str A hex string, with or without the 0x prefix\n *\n * @returns Hex\n */\n static fromString(str: string): Hex {\n let input = str;\n\n if (input.startsWith(\"0x\")) {\n input = input.slice(2);\n }\n\n if (input.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.\",\n HexInvalidReason.TOO_SHORT,\n );\n }\n\n if (input.length % 2 !== 0) {\n throw new ParsingError(\"Hex string must be an even number of hex characters.\", HexInvalidReason.INVALID_LENGTH);\n }\n\n try {\n return new Hex(hexToBytes(input));\n } catch (e) {\n const error = e as Error;\n throw new ParsingError(\n `Hex string contains invalid hex characters: ${error.message}`,\n HexInvalidReason.INVALID_HEX_CHARS,\n );\n }\n }\n\n /**\n * Static method to convert an instance of HexInput to Hex\n *\n * @param hexInput A HexInput (string or Uint8Array)\n *\n * @returns Hex\n */\n static fromHexInput(hexInput: HexInput): Hex {\n if (hexInput instanceof Uint8Array) return new Hex(hexInput);\n return Hex.fromString(hexInput);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is valid hex.\n *\n * @param str A hex string representing byte data.\n *\n * @returns valid = true if the string is valid, false if not. If the string is not\n * valid, invalidReason and invalidReasonMessage will be set explaining why it is\n * invalid.\n */\n static isValid(str: string): ParsingResult<HexInvalidReason> {\n try {\n Hex.fromString(str);\n return { valid: true };\n } catch (e) {\n const error = e as ParsingError<HexInvalidReason>;\n return {\n valid: false,\n invalidReason: error.invalidReason,\n invalidReasonMessage: error.message,\n };\n }\n }\n\n /**\n * Return whether Hex instances are equal. Hex instances are considered equal if\n * their underlying byte data is identical.\n *\n * @param other The Hex instance to compare to.\n * @returns true if the Hex instances are equal, false if not.\n */\n equals(other: Hex): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"oCAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAOhC,IAAKC,OACVA,EAAA,UAAY,YACZA,EAAA,eAAiB,iBACjBA,EAAA,kBAAoB,oBAHVA,OAAA,IAgCCC,EAAN,MAAMC,CAAI,CAQf,YAAYC,EAAkB,CAC5B,KAAK,KAAOA,CACd,CAYA,cAA2B,CACzB,OAAO,KAAK,IACd,CAOA,uBAAgC,CAC9B,OAAOC,EAAW,KAAK,IAAI,CAC7B,CAOA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAaA,OAAO,WAAWC,EAAkB,CAClC,IAAIC,EAAQD,EAMZ,GAJIC,EAAM,WAAW,IAAI,IACvBA,EAAQA,EAAM,MAAM,CAAC,GAGnBA,EAAM,SAAW,EACnB,MAAM,IAAIC,EACR,4FACA,WACF,EAGF,GAAID,EAAM,OAAS,IAAM,EACvB,MAAM,IAAIC,EAAa,uDAAwD,gBAA+B,EAGhH,GAAI,CACF,OAAO,IAAIL,EAAIM,EAAWF,CAAK,CAAC,CAClC,OAAS,EAAG,CACV,IAAMG,EAAQ,EACd,MAAM,IAAIF,EACR,+CAA+CE,EAAM,OAAO,GAC5D,mBACF,CACF,CACF,CASA,OAAO,aAAaC,EAAyB,CAC3C,OAAIA,aAAoB,WAAmB,IAAIR,EAAIQ,CAAQ,EACpDR,EAAI,WAAWQ,CAAQ,CAChC,CAeA,OAAO,QAAQL,EAA8C,CAC3D,GAAI,CACF,OAAAH,EAAI,WAAWG,CAAG,EACX,CAAE,MAAO,EAAK,CACvB,OAASM,EAAG,CACV,IAAMF,EAAQE,EACd,MAAO,CACL,MAAO,GACP,cAAeF,EAAM,cACrB,qBAAsBA,EAAM,OAC9B,CACF,CACF,CASA,OAAOG,EAAqB,CAC1B,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF","names":["bytesToHex","hexToBytes","HexInvalidReason","Hex","_Hex","data","bytesToHex","str","input","ParsingError","hexToBytes","error","hexInput","e","other","value","index"]}
@@ -1,2 +1,2 @@
1
- import{a as b}from"./chunk-AH44UPM4.mjs";import{d as S,g as d}from"./chunk-MIBLZSNS.mjs";import{c as C,d as h,e as w,f as k,g as T,i as O,j as q,k as v}from"./chunk-BTK34A5U.mjs";import{a as f}from"./chunk-J3QOSJFP.mjs";import{a as A}from"./chunk-ZXJ5ZBTL.mjs";import{a as _}from"./chunk-UVGCVCNG.mjs";import{b as y}from"./chunk-BIUGRAMO.mjs";import{b as m}from"./chunk-YS2OX7AB.mjs";import{b as a}from"./chunk-HH5RSP2H.mjs";import{b as g,c as p}from"./chunk-2444YR3Y.mjs";import{a as l}from"./chunk-6FBKUTGF.mjs";async function M(t){let{aptosConfig:n,accountAddress:e}=t,{data:o}=await g({aptosConfig:n,originMethod:"getInfo",path:`accounts/${a.from(e).toString()}`});return o}async function co(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${a.from(e).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function ao(t){return t.options?.ledgerVersion!==void 0?G(t):b(async()=>G(t),`module-${t.accountAddress}-${t.moduleName}`,1e3*60*5)()}async function G(t){let{aptosConfig:n,accountAddress:e,moduleName:o,options:s}=t,{data:r}=await g({aptosConfig:n,originMethod:"getModule",path:`accounts/${a.from(e).toString()}/module/${o}`,params:{ledger_version:s?.ledgerVersion}});return r}async function io(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${a.from(e).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function uo(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${a.from(e).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??999}})}async function K(t){let{aptosConfig:n,accountAddress:e,resourceType:o,options:s}=t,{data:r}=await g({aptosConfig:n,originMethod:"getResource",path:`accounts/${a.from(e).toString()}/resource/${o}`,params:{ledger_version:s?.ledgerVersion}});return r.data}async function Q(t){let{aptosConfig:n,authenticationKey:e,options:o}=t,s=await K({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:r}}=s,c=a.from(e);try{let i=await S({aptosConfig:n,handle:r,data:{key:c.toString(),key_type:"address",value_type:"address"},options:o});return a.from(i)}catch(i){if(i instanceof l&&i.data.error_code==="table_item_not_found")return c;throw i}}async function go(t){let{aptosConfig:n,accountAddress:e}=t,s={owner_address:{_eq:a.from(e).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:q,variables:{where_condition:s}},originMethod:"getAccountTokensCount"});if(!c.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return c.current_token_ownerships_v2_aggregate.aggregate.count}async function po(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.token_standard={_eq:o?.tokenStandard});let c={query:T,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ao(t){let{aptosConfig:n,accountAddress:e,collectionAddress:o,options:s}=t,r=a.from(e).toStringLong(),c=a.from(o).toStringLong(),i={owner_address:{_eq:r},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};s?.tokenStandard&&(i.token_standard={_eq:s?.tokenStandard});let u={query:O,variables:{where_condition:i,offset:s?.pagination?.offset,limit:s?.pagination?.limit,order_by:s?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function fo(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.current_collection={token_standard:{_eq:o?.tokenStandard}});let c={query:w,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function lo(t){let{aptosConfig:n,accountAddress:e}=t,o=a.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:v,variables:{address:o}},originMethod:"getAccountTransactionsCount"});if(!r.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return r.account_transactions_aggregate.aggregate.count}async function yo(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()}},c={query:h,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function mo(t){let{aptosConfig:n,accountAddress:e}=t,o=a.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:C,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!r.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return r.current_fungible_asset_balances_aggregate.aggregate.count}async function _o(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()}},c={query:k,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function Co(t){let{aptosConfig:n,privateKey:e}=t,o=new _(e.publicKey());if(e instanceof m){let r=A.fromPublicKeyAndScheme({publicKey:o,scheme:2}).derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:e,address:r})}if(e instanceof y){let s=A.fromPublicKeyAndScheme({publicKey:o,scheme:2});if(await P({authKey:s,aptosConfig:n})){let u=s.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let c=A.fromPublicKeyAndScheme({publicKey:o,scheme:0});if(await P({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function P(t){let{aptosConfig:n,authKey:e}=t,o=await Q({aptosConfig:n,authenticationKey:e.derivedAddress()});try{return await M({aptosConfig:n,accountAddress:o}),!0}catch(s){if(s.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{M as a,co as b,ao as c,io as d,uo as e,K as f,Q as g,go as h,po as i,Ao as j,fo as k,lo as l,yo as m,mo as n,_o as o,Co as p,P as q};
2
- //# sourceMappingURL=chunk-O243HOP3.mjs.map
1
+ import{a as b}from"./chunk-AH44UPM4.mjs";import{d as S,g as d}from"./chunk-7MNEEVXY.mjs";import{c as C,d as h,e as w,f as k,g as T,i as O,j as q,k as v}from"./chunk-WX43AJTD.mjs";import{b as g,c as p}from"./chunk-3JVGSFHP.mjs";import{a as l}from"./chunk-6FBKUTGF.mjs";import{a as f}from"./chunk-UPLWWSB4.mjs";import{a as A}from"./chunk-U3LO2FSJ.mjs";import{a as _}from"./chunk-YYRDFZE6.mjs";import{b as m}from"./chunk-62SCW5NH.mjs";import{b as y}from"./chunk-RYETO74W.mjs";import{b as a}from"./chunk-NZIJV4O2.mjs";async function M(t){let{aptosConfig:n,accountAddress:e}=t,{data:o}=await g({aptosConfig:n,originMethod:"getInfo",path:`accounts/${a.from(e).toString()}`});return o}async function co(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getModules",path:`accounts/${a.from(e).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function ao(t){return t.options?.ledgerVersion!==void 0?G(t):b(async()=>G(t),`module-${t.accountAddress}-${t.moduleName}`,1e3*60*5)()}async function G(t){let{aptosConfig:n,accountAddress:e,moduleName:o,options:s}=t,{data:r}=await g({aptosConfig:n,originMethod:"getModule",path:`accounts/${a.from(e).toString()}/module/${o}`,params:{ledger_version:s?.ledgerVersion}});return r}async function io(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${a.from(e).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function uo(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return p({aptosConfig:n,originMethod:"getResources",path:`accounts/${a.from(e).toString()}/resources`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??999}})}async function K(t){let{aptosConfig:n,accountAddress:e,resourceType:o,options:s}=t,{data:r}=await g({aptosConfig:n,originMethod:"getResource",path:`accounts/${a.from(e).toString()}/resource/${o}`,params:{ledger_version:s?.ledgerVersion}});return r.data}async function Q(t){let{aptosConfig:n,authenticationKey:e,options:o}=t,s=await K({aptosConfig:n,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:o}),{address_map:{handle:r}}=s,c=a.from(e);try{let i=await S({aptosConfig:n,handle:r,data:{key:c.toString(),key_type:"address",value_type:"address"},options:o});return a.from(i)}catch(i){if(i instanceof l&&i.data.error_code==="table_item_not_found")return c;throw i}}async function go(t){let{aptosConfig:n,accountAddress:e}=t,s={owner_address:{_eq:a.from(e).toStringLong()},amount:{_gt:0}},c=await d({aptosConfig:n,query:{query:q,variables:{where_condition:s}},originMethod:"getAccountTokensCount"});if(!c.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return c.current_token_ownerships_v2_aggregate.aggregate.count}async function po(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.token_standard={_eq:o?.tokenStandard});let c={query:T,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ao(t){let{aptosConfig:n,accountAddress:e,collectionAddress:o,options:s}=t,r=a.from(e).toStringLong(),c=a.from(o).toStringLong(),i={owner_address:{_eq:r},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};s?.tokenStandard&&(i.token_standard={_eq:s?.tokenStandard});let u={query:O,variables:{where_condition:i,offset:s?.pagination?.offset,limit:s?.pagination?.limit,order_by:s?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function fo(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.current_collection={token_standard:{_eq:o?.tokenStandard}});let c={query:w,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function lo(t){let{aptosConfig:n,accountAddress:e}=t,o=a.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:v,variables:{address:o}},originMethod:"getAccountTransactionsCount"});if(!r.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return r.account_transactions_aggregate.aggregate.count}async function yo(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()}},c={query:h,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function mo(t){let{aptosConfig:n,accountAddress:e}=t,o=a.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:C,variables:{address:o}},originMethod:"getAccountCoinsCount"});if(!r.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return r.current_fungible_asset_balances_aggregate.aggregate.count}async function _o(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:a.from(e).toStringLong()}},c={query:k,variables:{where_condition:r,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function Co(t){let{aptosConfig:n,privateKey:e}=t,o=new _(e.publicKey());if(e instanceof m){let r=A.fromPublicKeyAndScheme({publicKey:o,scheme:2}).derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:e,address:r})}if(e instanceof y){let s=A.fromPublicKeyAndScheme({publicKey:o,scheme:2});if(await P({authKey:s,aptosConfig:n})){let u=s.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let c=A.fromPublicKeyAndScheme({publicKey:o,scheme:0});if(await P({authKey:c,aptosConfig:n})){let u=c.derivedAddress();return f.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function P(t){let{aptosConfig:n,authKey:e}=t,o=await Q({aptosConfig:n,authenticationKey:e.derivedAddress()});try{return await M({aptosConfig:n,accountAddress:o}),!0}catch(s){if(s.status===404)return!1;throw new Error(`Error while looking for an account info ${o.toString()}`)}}export{M as a,co as b,ao as c,io as d,uo as e,K as f,Q as g,go as h,po as i,Ao as j,fo as k,lo as l,yo as m,mo as n,_o as o,Co as p,P as q};
2
+ //# sourceMappingURL=chunk-TQD4IGUM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/internal/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This file contains the underlying implementations for exposed API surface in\n * the {@link api/account}. By moving the methods out into a separate file,\n * other namespaces and processes can access these methods without depending on the entire\n * account namespace and without having a dependency cycle error.\n */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AptosApiError, getAptosFullNode, paginateWithCursor } from \"../client\";\nimport { AccountAddress, AccountAddressInput } from \"../core/accountAddress\";\nimport { Account } from \"../core/account\";\nimport { PrivateKey } from \"../core/crypto/asymmetricCrypto\";\nimport { getTableItem, queryIndexer } from \"./general\";\nimport {\n AccountData,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedObjectsResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n LedgerVersion,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderBy,\n PaginationArgs,\n SigningScheme,\n TokenStandard,\n TransactionResponse,\n} from \"../types\";\nimport {\n GetAccountCoinsCountQuery,\n GetAccountCoinsDataQuery,\n GetAccountCollectionsWithOwnedTokensQuery,\n GetAccountOwnedObjectsQuery,\n GetAccountOwnedTokensFromCollectionQuery,\n GetAccountOwnedTokensQuery,\n GetAccountTokensCountQuery,\n GetAccountTransactionsCountQuery,\n} from \"../types/generated/operations\";\nimport {\n GetAccountCoinsCount,\n GetAccountCoinsData,\n GetAccountCollectionsWithOwnedTokens,\n GetAccountOwnedObjects,\n GetAccountOwnedTokens,\n GetAccountOwnedTokensFromCollection,\n GetAccountTokensCount,\n GetAccountTransactionsCount,\n} from \"../types/generated/queries\";\nimport { memoizeAsync } from \"../utils/memoize\";\nimport { Secp256k1PrivateKey, AuthenticationKey, Ed25519PrivateKey } from \"../core\";\nimport { AnyPublicKey } from \"../core/crypto/anyPublicKey\";\n\nexport async function getInfo(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<AccountData> {\n const { aptosConfig, accountAddress } = args;\n const { data } = await getAptosFullNode<{}, AccountData>({\n aptosConfig,\n originMethod: \"getInfo\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}`,\n });\n return data;\n}\n\nexport async function getModules(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersion;\n}): Promise<MoveModuleBytecode[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveModuleBytecode[]>({\n aptosConfig,\n originMethod: \"getModules\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/modules`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 1000,\n },\n });\n}\n\n/**\n * Queries for a move module given account address and module name\n *\n * @param args.accountAddress Hex-encoded 32 byte Aptos account address\n * @param args.moduleName The name of the module\n * @param args.query.ledgerVersion Specifies ledger version of transactions. By default, latest version will be used\n * @returns The move module.\n */\nexport async function getModule(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersion;\n}): Promise<MoveModuleBytecode> {\n // We don't memoize the account module by ledger version, as it's not a common use case, this would be handled\n // by the developer directly\n if (args.options?.ledgerVersion !== undefined) {\n return getModuleInner(args);\n }\n\n return memoizeAsync(\n async () => getModuleInner(args),\n `module-${args.accountAddress}-${args.moduleName}`,\n 1000 * 60 * 5, // 5 minutes\n )();\n}\n\nasync function getModuleInner(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n moduleName: string;\n options?: LedgerVersion;\n}): Promise<MoveModuleBytecode> {\n const { aptosConfig, accountAddress, moduleName, options } = args;\n\n const { data } = await getAptosFullNode<{}, MoveModuleBytecode>({\n aptosConfig,\n originMethod: \"getModule\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/module/${moduleName}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data;\n}\n\nexport async function getTransactions(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs;\n}): Promise<TransactionResponse[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, TransactionResponse[]>({\n aptosConfig,\n originMethod: \"getTransactions\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/transactions`,\n params: { start: options?.offset, limit: options?.limit },\n });\n}\n\nexport async function getResources(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & LedgerVersion;\n}): Promise<MoveResource[]> {\n const { aptosConfig, accountAddress, options } = args;\n return paginateWithCursor<{}, MoveResource[]>({\n aptosConfig,\n originMethod: \"getResources\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resources`,\n params: {\n ledger_version: options?.ledgerVersion,\n start: options?.offset,\n limit: options?.limit ?? 999,\n },\n });\n}\n\nexport async function getResource<T extends {}>(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n resourceType: MoveStructId;\n options?: LedgerVersion;\n}): Promise<T> {\n const { aptosConfig, accountAddress, resourceType, options } = args;\n const { data } = await getAptosFullNode<{}, MoveResource>({\n aptosConfig,\n originMethod: \"getResource\",\n path: `accounts/${AccountAddress.from(accountAddress).toString()}/resource/${resourceType}`,\n params: { ledger_version: options?.ledgerVersion },\n });\n return data.data as T;\n}\n\nexport async function lookupOriginalAccountAddress(args: {\n aptosConfig: AptosConfig;\n authenticationKey: AccountAddressInput;\n options?: LedgerVersion;\n}): Promise<AccountAddress> {\n const { aptosConfig, authenticationKey, options } = args;\n type OriginatingAddress = {\n address_map: { handle: string };\n };\n const resource = await getResource<OriginatingAddress>({\n aptosConfig,\n accountAddress: \"0x1\",\n resourceType: \"0x1::account::OriginatingAddress\",\n options,\n });\n\n const {\n address_map: { handle },\n } = resource;\n\n const authKeyAddress = AccountAddress.from(authenticationKey);\n\n // If the address is not found in the address map, which means its not rotated\n // then return the address as is\n try {\n const originalAddress = await getTableItem<string>({\n aptosConfig,\n handle,\n data: {\n key: authKeyAddress.toString(),\n key_type: \"address\",\n value_type: \"address\",\n },\n options,\n });\n\n return AccountAddress.from(originalAddress);\n } catch (err) {\n if (err instanceof AptosApiError && err.data.error_code === \"table_item_not_found\") {\n return authKeyAddress;\n }\n\n throw err;\n }\n}\n\nexport async function getAccountTokensCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number } } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n const graphqlQuery = {\n query: GetAccountTokensCount,\n variables: { where_condition: whereCondition },\n };\n\n const data = await queryIndexer<GetAccountTokensCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTokensCount\",\n });\n if (!data.current_token_ownerships_v2_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account tokens\");\n }\n return data.current_token_ownerships_v2_aggregate.aggregate.count;\n}\n\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: {\n tokenStandard?: TokenStandard;\n pagination?: PaginationArgs;\n orderBy?: OrderBy<GetAccountOwnedTokensQueryResponse[0]>;\n };\n}): Promise<GetAccountOwnedTokensQueryResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string }; amount: { _gt: number }; token_standard?: { _eq: string } } =\n {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.pagination?.offset,\n limit: options?.pagination?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokens\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountOwnedTokensFromCollectionAddress(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n collectionAddress: AccountAddressInput;\n options?: {\n tokenStandard?: TokenStandard;\n pagination?: PaginationArgs;\n orderBy?: OrderBy<GetAccountOwnedTokensFromCollectionResponse[0]>;\n };\n}): Promise<GetAccountOwnedTokensFromCollectionResponse> {\n const { aptosConfig, accountAddress, collectionAddress, options } = args;\n const ownerAddress = AccountAddress.from(accountAddress).toStringLong();\n const collAddress = AccountAddress.from(collectionAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n current_token_data: { collection_id: { _eq: string } };\n amount: { _gt: number };\n token_standard?: { _eq: string };\n } = {\n owner_address: { _eq: ownerAddress },\n current_token_data: { collection_id: { _eq: collAddress } },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.token_standard = { _eq: options?.tokenStandard };\n }\n\n const graphqlQuery = {\n query: GetAccountOwnedTokensFromCollection,\n variables: {\n where_condition: whereCondition,\n offset: options?.pagination?.offset,\n limit: options?.pagination?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountOwnedTokensFromCollectionQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedTokensFromCollectionAddress\",\n });\n\n return data.current_token_ownerships_v2;\n}\n\nexport async function getAccountCollectionsWithOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: {\n tokenStandard?: TokenStandard;\n pagination?: PaginationArgs;\n orderBy?: OrderBy<GetAccountCollectionsWithOwnedTokenResponse[0]>;\n };\n}): Promise<GetAccountCollectionsWithOwnedTokenResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: {\n owner_address: { _eq: string };\n amount: { _gt: number };\n current_collection?: { token_standard: { _eq: string } };\n } = {\n owner_address: { _eq: address },\n amount: { _gt: 0 },\n };\n\n if (options?.tokenStandard) {\n whereCondition.current_collection = {\n token_standard: { _eq: options?.tokenStandard },\n };\n }\n\n const graphqlQuery = {\n query: GetAccountCollectionsWithOwnedTokens,\n variables: {\n where_condition: whereCondition,\n offset: options?.pagination?.offset,\n limit: options?.pagination?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCollectionsWithOwnedTokensQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCollectionsWithOwnedTokens\",\n });\n\n return data.current_collection_ownership_v2_view;\n}\n\nexport async function getAccountTransactionsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountTransactionsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountTransactionsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountTransactionsCount\",\n });\n\n if (!data.account_transactions_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account transactions\");\n }\n\n return data.account_transactions_aggregate.aggregate.count;\n}\n\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: {\n pagination?: PaginationArgs;\n orderBy?: OrderBy<GetAccountCoinsDataResponse[0]>;\n };\n}): Promise<GetAccountCoinsDataResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.pagination?.offset,\n limit: options?.pagination?.limit,\n order_by: options?.orderBy,\n },\n };\n\n const data = await queryIndexer<GetAccountCoinsDataQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsData\",\n });\n\n return data.current_fungible_asset_balances;\n}\n\nexport async function getAccountCoinsCount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, accountAddress } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const graphqlQuery = {\n query: GetAccountCoinsCount,\n variables: { address },\n };\n\n const data = await queryIndexer<GetAccountCoinsCountQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountCoinsCount\",\n });\n\n if (!data.current_fungible_asset_balances_aggregate.aggregate) {\n throw Error(\"Failed to get the count of account coins\");\n }\n\n return data.current_fungible_asset_balances_aggregate.aggregate.count;\n}\n\nexport async function getAccountOwnedObjects(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: {\n pagination?: PaginationArgs;\n orderBy?: OrderBy<GetAccountOwnedObjectsResponse[0]>;\n };\n}): Promise<GetAccountOwnedObjectsResponse> {\n const { aptosConfig, accountAddress, options } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const whereCondition: { owner_address: { _eq: string } } = {\n owner_address: { _eq: address },\n };\n const graphqlQuery = {\n query: GetAccountOwnedObjects,\n variables: {\n where_condition: whereCondition,\n offset: options?.pagination?.offset,\n limit: options?.pagination?.limit,\n order_by: options?.orderBy,\n },\n };\n const data = await queryIndexer<GetAccountOwnedObjectsQuery>({\n aptosConfig,\n query: graphqlQuery,\n originMethod: \"getAccountOwnedObjects\",\n });\n\n return data.current_objects;\n}\n\n/**\n * NOTE: There is a potential issue once unified single signer scheme will be adopted\n * by the community.\n *\n * Becuase on could create 2 accounts with the same private key with this new authenticator type,\n * we’ll need to determine the order in which we lookup the accounts. First unified\n * scheme and then legacy scheme vs first legacy scheme and then unified scheme.\n *\n */\nexport async function deriveAccountFromPrivateKey(args: {\n aptosConfig: AptosConfig;\n privateKey: PrivateKey;\n}): Promise<Account> {\n const { aptosConfig, privateKey } = args;\n const publicKey = new AnyPublicKey(privateKey.publicKey());\n\n if (privateKey instanceof Secp256k1PrivateKey) {\n // private key is secp256k1, therefore we know it for sure uses a single signer key\n const authKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.SingleKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKeyAndAddress({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKeyAndScheme({\n publicKey,\n scheme: SigningScheme.SingleKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme: SigningScheme.Ed25519 });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKeyAndAddress({ privateKey, address, legacy: true });\n }\n }\n // if we are here, it means we couldn't find an address with an\n // auth key that matches the provided private key\n throw new Error(`Can't derive account from private key ${privateKey}`);\n}\n\nexport async function isAccountExist(args: { aptosConfig: AptosConfig; authKey: AuthenticationKey }): Promise<boolean> {\n const { aptosConfig, authKey } = args;\n const accountAddress = await lookupOriginalAccountAddress({\n aptosConfig,\n authenticationKey: authKey.derivedAddress(),\n });\n\n try {\n await getInfo({\n aptosConfig,\n accountAddress,\n });\n return true;\n } catch (error: any) {\n // account not found\n if (error.status === 404) {\n return false;\n }\n throw new Error(`Error while looking for an account info ${accountAddress.toString()}`);\n }\n}\n"],"mappings":"kgBAyDA,eAAsBA,EAAQC,EAGL,CACvB,GAAM,CAAE,YAAAC,EAAa,eAAAC,CAAe,EAAIF,EAClC,CAAE,KAAAG,CAAK,EAAI,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Ae,SAAS,CAAC,EAAE,CACxF,CACF","names":["getInfo","args","aptosConfig","accountAddress","data","getAptosFullNode","AccountAddress","getModules","options","paginateWithCursor","getModule","getModuleInner","memoizeAsync","moduleName","getTransactions","getResources","getResource","resourceType","lookupOriginalAccountAddress","authenticationKey","resource","handle","authKeyAddress","originalAddress","getTableItem","err","AptosApiError","getAccountTokensCount","whereCondition","queryIndexer","GetAccountTokensCount","getAccountOwnedTokens","graphqlQuery","GetAccountOwnedTokens","getAccountOwnedTokensFromCollectionAddress","collectionAddress","ownerAddress","collAddress","GetAccountOwnedTokensFromCollection","getAccountCollectionsWithOwnedTokens","GetAccountCollectionsWithOwnedTokens","getAccountTransactionsCount","address","GetAccountTransactionsCount","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetAccountOwnedObjects","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
@@ -0,0 +1,2 @@
1
+ import{a as l,c as h}from"./chunk-RYETO74W.mjs";import{a as E,c as b}from"./chunk-EFIYW4WK.mjs";import{b as u}from"./chunk-TIH6ARYP.mjs";var i=class i extends E{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>i.MAX_KEYS||t.length<i.MIN_KEYS)throw new Error(`Must have between ${i.MIN_KEYS} and ${i.MAX_KEYS} public keys, inclusive`);if(r<i.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${i.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*l.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*l.LENGTH)}),e[this.publicKeys.length*l.LENGTH]=this.threshold,e}toString(){return u.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],o=[];for(let a=0;a<t.length-1;a+=l.LENGTH){let s=a;o.push(new l(t.subarray(s,s+l.LENGTH)))}return new i({publicKeys:o,threshold:r})}};i.MAX_KEYS=32,i.MIN_KEYS=2,i.MIN_THRESHOLD=1;var g=i,n=class n extends b{constructor(e){super();let{signatures:t,bitmap:r}=e;if(r.length!==n.BITMAP_LEN)throw new Error(`"bitmap" length should be ${n.BITMAP_LEN}`);if(t.length>n.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${n.MAX_SIGNATURES_SUPPORTED}`);this.signatures=t,this.bitmap=r}toUint8Array(){let e=new Uint8Array(this.signatures.length*h.LENGTH+n.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*h.LENGTH)}),e.set(this.bitmap,this.signatures.length*h.LENGTH),e}toString(){return u.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:t}=e,r=128,o=new Uint8Array([0,0,0,0]),a=new Set;return t.forEach(s=>{if(s>=n.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${n.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(s))throw new Error("Duplicate bits detected.");a.add(s);let c=Math.floor(s/8),y=o[c];y|=r>>s%8,o[c]=y}),o}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),o=[];for(let a=0;a<t.length-r.length;a+=h.LENGTH){let s=a;o.push(new h(t.subarray(s,s+h.LENGTH)))}return new n({signatures:o,bitmap:r})}};n.MAX_SIGNATURES_SUPPORTED=32,n.BITMAP_LEN=4;var p=n;export{g as a,p as b};
2
+ //# sourceMappingURL=chunk-U25N2VWA.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PublicKey, Signature } from \"./asymmetricCrypto\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\nimport { HexInput } from \"../../types\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n */\nexport class MultiEd25519PublicKey extends PublicKey {\n /**\n * Maximum number of public keys supported\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this MultiEd25519PublicKey\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n *\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n super();\n\n const { publicKeys, threshold } = args;\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n verifySignature(args: { message: HexInput; signature: MultiEd25519Signature }): boolean {\n throw new Error(\"TODO - Method not implemented.\");\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\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 * The list of underlying Ed25519 signatures\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n */\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: Ed25519Signature[]; bitmap: Uint8Array }) {\n super();\n\n const { signatures, bitmap } = args;\n if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n }\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n\n this.signatures = signatures;\n this.bitmap = bitmap;\n }\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\n }\n\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\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 >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n 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 serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin, begin + Ed25519Signature.LENGTH)));\n }\n return new MultiEd25519Signature({ signatures, bitmap });\n }\n}\n"],"mappings":"yIAaO,IAAMA,EAAN,cAAoCC,CAAU,CAqCnD,YAAYC,EAA6D,CACvE,MAAM,EAEN,GAAM,CAAE,WAAAC,EAAY,UAAAC,CAAU,EAAIF,EAGlC,GAAIC,EAAW,OAASH,EAAsB,UAAYG,EAAW,OAASH,EAAsB,SAClG,MAAM,IAAI,MACR,qBAAqBA,EAAsB,gBAAgBA,EAAsB,iCACnF,EAIF,GAAII,EAAYJ,EAAsB,eAAiBI,EAAYD,EAAW,OAC5E,MAAM,IAAI,MACR,6BAA6BH,EAAsB,qBAAqBG,EAAW,mBACrF,EAGF,KAAK,WAAaA,EAClB,KAAK,UAAYC,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,EAAiBd,EAAM,SAASQ,EAAOA,EAAQM,EAAiB,MAAM,CAAC,CAAC,CAC9F,CACA,OAAO,IAAIJ,EAAsB,CAAE,WAAAE,EAAY,OAAAC,CAAO,CAAC,CACzD,CACF,EArIaQ,EAANX,EAAMW,EAIJ,yBAA2B,GAJvBA,EASJ,WAAqB","names":["_MultiEd25519PublicKey","PublicKey","args","publicKeys","threshold","bytes","Ed25519PublicKey","k","i","Hex","serializer","deserializer","keys","begin","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte","MultiEd25519Signature"]}
1
+ {"version":3,"sources":["../../src/core/crypto/multiEd25519.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { PublicKey, Signature } from \"./asymmetricCrypto\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { Serializer } from \"../../bcs/serializer\";\nimport { Ed25519PublicKey, Ed25519Signature } from \"./ed25519\";\nimport { Hex } from \"../hex\";\nimport { HexInput } from \"../../types\";\n\n/**\n * Represents the public key of a K-of-N Ed25519 multi-sig transaction.\n */\nexport class MultiEd25519PublicKey extends PublicKey {\n /**\n * Maximum number of public keys supported\n */\n static readonly MAX_KEYS = 32;\n\n /**\n * Minimum number of public keys needed\n */\n static readonly MIN_KEYS = 2;\n\n /**\n * Minimum threshold for the number of valid signatures required\n */\n static readonly MIN_THRESHOLD = 1;\n\n /**\n * List of Ed25519 public keys for this MultiEd25519PublicKey\n */\n public readonly publicKeys: Ed25519PublicKey[];\n\n /**\n * The minimum number of valid signatures required, for the number of public keys specified\n */\n public readonly threshold: number;\n\n /**\n * Public key for a K-of-N multi-sig transaction. A K-of-N multi-sig transaction means that for such a\n * transaction to be executed, at least K out of the N authorized signers have signed the transaction\n * and passed the check conducted by the chain.\n *\n * @see {@link\n * https://aptos.dev/integration/creating-a-signed-transaction/ | Creating a Signed Transaction}\n *\n * @param args.publicKeys A list of public keys\n * @param args.threshold At least \"threshold\" signatures must be valid\n */\n constructor(args: { publicKeys: Ed25519PublicKey[]; threshold: number }) {\n super();\n\n const { publicKeys, threshold } = args;\n\n // Validate number of public keys\n if (publicKeys.length > MultiEd25519PublicKey.MAX_KEYS || publicKeys.length < MultiEd25519PublicKey.MIN_KEYS) {\n throw new Error(\n `Must have between ${MultiEd25519PublicKey.MIN_KEYS} and ${MultiEd25519PublicKey.MAX_KEYS} public keys, inclusive`,\n );\n }\n\n // Validate threshold: must be between 1 and the number of public keys, inclusive\n if (threshold < MultiEd25519PublicKey.MIN_THRESHOLD || threshold > publicKeys.length) {\n throw new Error(\n `Threshold must be between ${MultiEd25519PublicKey.MIN_THRESHOLD} and ${publicKeys.length}, inclusive`,\n );\n }\n\n this.publicKeys = publicKeys;\n this.threshold = threshold;\n }\n\n /**\n * Converts a PublicKeys into Uint8Array (bytes) with: bytes = p1_bytes | ... | pn_bytes | threshold\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.publicKeys.length * Ed25519PublicKey.LENGTH + 1);\n this.publicKeys.forEach((k: Ed25519PublicKey, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519PublicKey.LENGTH);\n });\n\n bytes[this.publicKeys.length * Ed25519PublicKey.LENGTH] = this.threshold;\n\n return bytes;\n }\n\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n verifySignature(args: { message: HexInput; signature: MultiEd25519Signature }): boolean {\n throw new Error(\"TODO - Method not implemented.\");\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519PublicKey {\n const bytes = deserializer.deserializeBytes();\n const threshold = bytes[bytes.length - 1];\n\n const keys: Ed25519PublicKey[] = [];\n\n for (let i = 0; i < bytes.length - 1; i += Ed25519PublicKey.LENGTH) {\n const begin = i;\n keys.push(new Ed25519PublicKey(bytes.subarray(begin, begin + Ed25519PublicKey.LENGTH)));\n }\n return new MultiEd25519PublicKey({ publicKeys: keys, threshold });\n }\n}\n\n/**\n * Represents the signature of a K-of-N Ed25519 multi-sig transaction.\n */\nexport class MultiEd25519Signature extends Signature {\n /**\n * Maximum number of Ed25519 signatures supported\n */\n static MAX_SIGNATURES_SUPPORTED = 32;\n\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 * The list of underlying Ed25519 signatures\n */\n public readonly signatures: Ed25519Signature[];\n\n /**\n * 32-bit Bitmap representing who signed the transaction\n *\n * This is represented where each public key can be masked to determine whether the message was signed by that key.\n */\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: Ed25519Signature[]; bitmap: Uint8Array }) {\n super();\n\n const { signatures, bitmap } = args;\n if (bitmap.length !== MultiEd25519Signature.BITMAP_LEN) {\n throw new Error(`\"bitmap\" length should be ${MultiEd25519Signature.BITMAP_LEN}`);\n }\n\n if (signatures.length > MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(\n `The number of signatures cannot be greater than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED}`,\n );\n }\n\n this.signatures = signatures;\n this.bitmap = bitmap;\n }\n\n /**\n * Converts a MultiSignature into Uint8Array (bytes) with `bytes = s1_bytes | ... | sn_bytes | bitmap`\n */\n toUint8Array(): Uint8Array {\n const bytes = new Uint8Array(this.signatures.length * Ed25519Signature.LENGTH + MultiEd25519Signature.BITMAP_LEN);\n this.signatures.forEach((k: Ed25519Signature, i: number) => {\n bytes.set(k.toUint8Array(), i * Ed25519Signature.LENGTH);\n });\n\n bytes.set(this.bitmap, this.signatures.length * Ed25519Signature.LENGTH);\n\n return bytes;\n }\n\n toString(): string {\n return Hex.fromHexInput(this.toUint8Array()).toString();\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 >= MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED) {\n throw new Error(`Cannot have a signature larger than ${MultiEd25519Signature.MAX_SIGNATURES_SUPPORTED - 1}.`);\n }\n\n if (dupCheckSet.has(bit)) {\n throw new Error(\"Duplicate bits detected.\");\n }\n\n 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 serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): MultiEd25519Signature {\n const bytes = deserializer.deserializeBytes();\n const bitmap = bytes.subarray(bytes.length - 4);\n\n const signatures: Ed25519Signature[] = [];\n\n for (let i = 0; i < bytes.length - bitmap.length; i += Ed25519Signature.LENGTH) {\n const begin = i;\n signatures.push(new Ed25519Signature(bytes.subarray(begin,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AAY,IAAIC,CAAG,EACrB,MAAM,IAAI,MAAM,0BAA0B,EAG5CD,EAAY,IAAIC,CAAG,EAEnB,IAAMC,EAAa,KAAK,MAAMD,EAAM,CAAC,EAEjCE,EAAOP,EAAOM,CAAU,EAG5BC,GAAQJ,GAAkBE,EAAM,EAEhCL,EAAOM,CAAU,EAAIC,CACvB,CAAC,EAEMP,CACT,CAEA,UAAUR,EAA8B,CACtCA,EAAW,eAAe,KAAK,aAAa,CAAC,CAC/C,CAEA,OAAO,YAAYC,EAAmD,CACpE,IAAMN,EAAQM,EAAa,iBAAiB,EACtCO,EAASb,EAAM,SAASA,EAAM,OAAS,CAAC,EAExCY,EAAiC,CAAC,EAExC,QAAST,EAAI,EAAGA,EAAIH,EAAM,OAASa,EAAO,OAAQV,GAAKW,EAAiB,OAAQ,CAC9E,IAAMN,EAAQL,EACdS,EAAW,KAAK,IAAIE,EAAiBd,EAAM,SAASQ,EAAOA,EAAQM,EAAiB,MAAM,CAAC,CAAC,CAC9F,CACA,OAAO,IAAIJ,EAAsB,CAAE,WAAAE,EAAY,OAAAC,CAAO,CAAC,CACzD,CACF,EArIaH,EAIJ,yBAA2B,GAJvBA,EASJ,WAAqB,EATvB,IAAMW,EAANX","names":["_MultiEd25519PublicKey","PublicKey","args","publicKeys","threshold","bytes","Ed25519PublicKey","k","i","Hex","serializer","deserializer","keys","begin","MultiEd25519PublicKey","_MultiEd25519Signature","Signature","signatures","bitmap","Ed25519Signature","bits","firstBitInByte","dupCheckSet","bit","byteOffset","byte","MultiEd25519Signature"]}
@@ -0,0 +1,2 @@
1
+ import{a as y}from"./chunk-U25N2VWA.mjs";import{a as m}from"./chunk-44MGBJ73.mjs";import{a as d}from"./chunk-YYRDFZE6.mjs";import{a as l}from"./chunk-RYETO74W.mjs";import{b as u}from"./chunk-NZIJV4O2.mjs";import{a as c}from"./chunk-HA6JD5R6.mjs";import{b as s}from"./chunk-TIH6ARYP.mjs";import{sha3_256 as b}from"@noble/hashes/sha3";var i=class i extends c{constructor(r){super();let{data:t}=r,e=s.fromHexInput(t);if(e.toUint8Array().length!==i.LENGTH)throw new Error(`Authentication Key length should be ${i.LENGTH}`);this.data=e}serialize(r){r.serializeFixedBytes(this.data.toUint8Array())}static deserialize(r){let t=r.deserializeFixedBytes(i.LENGTH);return new i({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(r){let{publicKey:t,scheme:e}=r,n;switch(e){case 3:case 2:{let a=t.bcsToBytes();n=new Uint8Array([...a,e]);break}case 0:case 1:{let a=t.toUint8Array(),p=s.fromHexInput(a).toUint8Array();n=new Uint8Array([...p,e]);break}default:throw new Error(`Scheme ${e} is not supported`)}let o=b.create();o.update(n);let f=o.digest();return new i({data:f})}static fromPublicKey(r){let{publicKey:t}=r,e;if(t instanceof l)e=0 .valueOf();else if(t instanceof y)e=1 .valueOf();else if(t instanceof d)e=2 .valueOf();else if(t instanceof m)e=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return i.fromPublicKeyAndScheme({publicKey:t,scheme:e})}derivedAddress(){return new u(this.data.toUint8Array())}};i.LENGTH=32;var h=i;export{h as a};
2
+ //# sourceMappingURL=chunk-U3LO2FSJ.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/authenticationKey.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AccountAddress } from \"./accountAddress\";\nimport { PublicKey } from \"./crypto/asymmetricCrypto\";\nimport { Ed25519PublicKey } from \"./crypto/ed25519\";\nimport { MultiEd25519PublicKey } from \"./crypto/multiEd25519\";\nimport { Hex } from \"./hex\";\nimport { AuthenticationKeyScheme, HexInput, SigningScheme } from \"../types\";\nimport { AnyPublicKey } from \"./crypto/anyPublicKey\";\nimport { MultiKey } from \"./crypto/multiKey\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\n\n/**\n * Each account stores an authentication key. Authentication key enables account owners to rotate\n * their private key(s) associated with the account without changing the address that hosts their account.\n * @see {@link https://aptos.dev/concepts/accounts | Account Basics}\n *\n * Account addresses can be derived from AuthenticationKey\n */\nexport class AuthenticationKey extends Serializable {\n /**\n * An authentication key is always a SHA3-256 hash of data, and is always 32 bytes.\n *\n * The data to hash depends on the underlying public key type and the derivation scheme.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The raw bytes of the authentication key.\n */\n public readonly data: Hex;\n\n constructor(args: { data: HexInput }) {\n super();\n const { data } = args;\n const hex = Hex.fromHexInput(data);\n if (hex.toUint8Array().length !== AuthenticationKey.LENGTH) {\n throw new Error(`Authentication Key length should be ${AuthenticationKey.LENGTH}`);\n }\n this.data = hex;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserialize an AuthenticationKey from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AuthenticationKey from.\n * @returns An instance of AuthenticationKey.\n */\n static deserialize(deserializer: Deserializer): AuthenticationKey {\n const bytes = deserializer.deserializeFixedBytes(AuthenticationKey.LENGTH);\n return new AuthenticationKey({ data: bytes });\n }\n\n toString(): string {\n return this.data.toString();\n }\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n /**\n * Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme.\n *\n * This facilitates targeting a specific scheme for deriving an authentication key from a public key.\n *\n * @param args - the public key and scheme to use for the derivation\n */\n public static fromPublicKeyAndScheme(args: { publicKey: PublicKey; scheme: AuthenticationKeyScheme }) {\n const { publicKey, scheme } = args;\n let authKeyBytes: Uint8Array;\n\n switch (scheme) {\n case SigningScheme.MultiKey:\n case SigningScheme.SingleKey: {\n const singleKeyBytes = publicKey.bcsToBytes();\n authKeyBytes = new Uint8Array([...singleKeyBytes, scheme]);\n break;\n }\n\n case SigningScheme.Ed25519:\n case SigningScheme.MultiEd25519: {\n const ed25519PublicKeyBytes = publicKey.toUint8Array();\n const inputBytes = Hex.fromHexInput(ed25519PublicKeyBytes).toUint8Array();\n authKeyBytes = new Uint8Array([...inputBytes, scheme]);\n break;\n }\n\n default:\n throw new Error(`Scheme ${scheme} is not supported`);\n }\n\n const hash = sha3Hash.create();\n hash.update(authKeyBytes);\n const hashDigest = hash.digest();\n return new AuthenticationKey({ data: hashDigest });\n }\n\n /**\n * Converts a PublicKey(s) to an AuthenticationKey, using the derivation scheme inferred from the\n * instance of the PublicKey type passed in.\n *\n * @param args.publicKey\n * @returns AuthenticationKey\n */\n static fromPublicKey(args: { publicKey: PublicKey }): AuthenticationKey {\n const { publicKey } = args;\n\n let scheme: number;\n if (publicKey instanceof Ed25519PublicKey) {\n // for legacy support\n scheme = SigningScheme.Ed25519.valueOf();\n } else if (publicKey instanceof MultiEd25519PublicKey) {\n // for legacy support\n scheme = SigningScheme.MultiEd25519.valueOf();\n } else if (publicKey instanceof AnyPublicKey) {\n scheme = SigningScheme.SingleKey.valueOf();\n } else if (publicKey instanceof MultiKey) {\n scheme = SigningScheme.MultiKey.valueOf();\n } else {\n throw new Error(\"No supported authentication scheme for public key\");\n }\n\n return AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme });\n }\n\n /**\n * Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes,\n * the AuthenticationKey bytes are directly translated to an AccountAddress.\n *\n * @returns AccountAddress\n */\n derivedAddress(): AccountAddress {\n return new AccountAddress(this.data.toUint8Array());\n }\n}\n"],"mappings":"+RAGA,OAAS,YAAYA,MAAgB,qBAmB9B,IAAMC,EAAN,cAAgCC,CAAa,CAalD,YAAYC,EAA0B,CACpC,MAAM,EACN,GAAM,CAAE,KAAAC,CAAK,EAAID,EACXE,EAAMC,EAAI,aAAaF,CAAI,EACjC,GAAIC,EAAI,aAAa,EAAE,SAAWJ,EAAkB,OAClD,MAAM,IAAI,MAAM,uCAAuCA,EAAkB,QAAQ,EAE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,CAAE,UAAAS,EAAW,OAAAC,CAAO,CAAC,CACvE,CAQA,gBAAiC,CAC/B,OAAO,IAAIY,EAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CACF,EAvHaC,EAANvB,EAAMuB,EAMK,OAAiB","names":["sha3Hash","_AuthenticationKey","Serializable","args","data","hex","Hex","serializer","deserializer","bytes","publicKey","scheme","authKeyBytes","singleKeyBytes","ed25519PublicKeyBytes","inputBytes","hash","sha3Hash","hashDigest","Ed25519PublicKey","MultiEd25519PublicKey","AnyPublicKey","MultiKey","AccountAddress","AuthenticationKey"]}
1
+ {"version":3,"sources":["../../src/core/authenticationKey.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AccountAddress } from \"./accountAddress\";\nimport { PublicKey } from \"./crypto/asymmetricCrypto\";\nimport { Ed25519PublicKey } from \"./crypto/ed25519\";\nimport { MultiEd25519PublicKey } from \"./crypto/multiEd25519\";\nimport { Hex } from \"./hex\";\nimport { AuthenticationKeyScheme, HexInput, SigningScheme } from \"../types\";\nimport { AnyPublicKey } from \"./crypto/anyPublicKey\";\nimport { MultiKey } from \"./crypto/multiKey\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\n\n/**\n * Each account stores an authentication key. Authentication key enables account owners to rotate\n * their private key(s) associated with the account without changing the address that hosts their account.\n * @see {@link https://aptos.dev/concepts/accounts | Account Basics}\n *\n * Account addresses can be derived from AuthenticationKey\n */\nexport class AuthenticationKey extends Serializable {\n /**\n * An authentication key is always a SHA3-256 hash of data, and is always 32 bytes.\n *\n * The data to hash depends on the underlying public key type and the derivation scheme.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The raw bytes of the authentication key.\n */\n public readonly data: Hex;\n\n constructor(args: { data: HexInput }) {\n super();\n const { data } = args;\n const hex = Hex.fromHexInput(data);\n if (hex.toUint8Array().length !== AuthenticationKey.LENGTH) {\n throw new Error(`Authentication Key length should be ${AuthenticationKey.LENGTH}`);\n }\n this.data = hex;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserialize an AuthenticationKey from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AuthenticationKey from.\n * @returns An instance of AuthenticationKey.\n */\n static deserialize(deserializer: Deserializer): AuthenticationKey {\n const bytes = deserializer.deserializeFixedBytes(AuthenticationKey.LENGTH);\n return new AuthenticationKey({ data: bytes });\n }\n\n toString(): string {\n return this.data.toString();\n }\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n /**\n * Derives an AuthenticationKey from the public key seed bytes and an explicit derivation scheme.\n *\n * This facilitates targeting a specific scheme for deriving an authentication key from a public key.\n *\n * @param args - the public key and scheme to use for the derivation\n */\n public static fromPublicKeyAndScheme(args: { publicKey: PublicKey; scheme: AuthenticationKeyScheme }) {\n const { publicKey, scheme } = args;\n let authKeyBytes: Uint8Array;\n\n switch (scheme) {\n case SigningScheme.MultiKey:\n case SigningScheme.SingleKey: {\n const singleKeyBytes = publicKey.bcsToBytes();\n authKeyBytes = new Uint8Array([...singleKeyBytes, scheme]);\n break;\n }\n\n case SigningScheme.Ed25519:\n case SigningScheme.MultiEd25519: {\n const ed25519PublicKeyBytes = publicKey.toUint8Array();\n const inputBytes = Hex.fromHexInput(ed25519PublicKeyBytes).toUint8Array();\n authKeyBytes = new Uint8Array([...inputBytes, scheme]);\n break;\n }\n\n default:\n throw new Error(`Scheme ${scheme} is not supported`);\n }\n\n const hash = sha3Hash.create();\n hash.update(authKeyBytes);\n const hashDigest = hash.digest();\n return new AuthenticationKey({ data: hashDigest });\n }\n\n /**\n * Converts a PublicKey(s) to an AuthenticationKey, using the derivation scheme inferred from the\n * instance of the PublicKey type passed in.\n *\n * @param args.publicKey\n * @returns AuthenticationKey\n */\n static fromPublicKey(args: { publicKey: PublicKey }): AuthenticationKey {\n const { publicKey } = args;\n\n let scheme: number;\n if (publicKey instanceof Ed25519PublicKey) {\n // for legacy support\n scheme = SigningScheme.Ed25519.valueOf();\n } else if (publicKey instanceof MultiEd25519PublicKey) {\n // for legacy support\n scheme = SigningScheme.MultiEd25519.valueOf();\n } else if (publicKey instanceof AnyPublicKey) {\n scheme = SigningScheme.SingleKey.valueOf();\n } else if (publicKey instanceof MultiKey) {\n scheme = SigningScheme.MultiKey.valueOf();\n } else {\n throw new Error(\"No supported authentication scheme for public key\");\n }\n\n return AuthenticationKey.fromPublicKeyAndScheme({ publicKey, scheme });\n }\n\n /**\n * Derives an account address from an AuthenticationKey. Since an AccountAddress is also 32 bytes,\n * the AuthenticationKey bytes are directly translated to an AccountAddress.\n *\n * @returns AccountAddress\n */\n derivedAddress(): AccountAddress {\n return new AccountAddress(this.data.toUint8Array());\n }\n}\n"],"mappings":"+RAGA,OAAS,YAAYA,MAAgB,qBAmB9B,IAAMC,EAAN,MAAMA,UAA0BC,CAAa,CAalD,YAAYC,EAA0B,CACpC,MAAM,EACN,GAAM,CAAE,KAAAC,CAAK,EAAID,EACXE,EAAMC,EAAI,aAAaF,CAAI,EACjC,GAAIC,EAAI,aAAa,EAAE,SAAWJ,EAAkB,OAClD,MAAM,IAAI,MAAM,uCAAuCA,EAAkB,MAAM,EAAE,EAEnF,KAAK,KAAOI,CACd,CAEA,UAAUE,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,KAAK,aAAa,CAAC,CACzD,CAOA,OAAO,YAAYC,EAA+C,CAChE,IAAMC,EAAQD,EAAa,sBAAsBP,EAAkB,MAAM,EACzE,OAAO,IAAIA,EAAkB,CAAE,KAAMQ,CAAM,CAAC,CAC9C,CAEA,UAAmB,CACjB,OAAO,KAAK,KAAK,SAAS,CAC5B,CAEA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CASA,OAAc,uBAAuBN,EAAiE,CACpG,GAAM,CAAE,UAAAO,EAAW,OAAAC,CAAO,EAAIR,EAC1BS,EAEJ,OAAQD,EAAQ,CACd,OACA,OAA8B,CAC5B,IAAME,EAAiBH,EAAU,WAAW,EAC5CE,EAAe,IAAI,WAAW,CAAC,GAAGC,EAAgBF,CAAM,CAAC,EACzD,KACF,CAEA,OACA,OAAiC,CAC/B,IAAMG,EAAwBJ,EAAU,aAAa,EAC/CK,EAAaT,EAAI,aAAaQ,CAAqB,EAAE,aAAa,EACxEF,EAAe,IAAI,WAAW,CAAC,GAAGG,EAAYJ,CAAM,CAAC,EACrD,KACF,CAEA,QACE,MAAM,IAAI,MAAM,UAAUA,CAAM,mBAAmB,CACvD,CAEA,IAAMK,EAAOC,EAAS,OAAO,EAC7BD,EAAK,OAAOJ,CAAY,EACxB,IAAMM,EAAaF,EAAK,OAAO,EAC/B,OAAO,IAAIf,EAAkB,CAAE,KAAMiB,CAAW,CAAC,CACnD,CASA,OAAO,cAAcf,EAAmD,CACtE,GAAM,CAAE,UAAAO,CAAU,EAAIP,EAElBQ,EACJ,GAAID,aAAqBS,EAEvBR,KAA+B,QAAQ,UAC9BD,aAAqBU,EAE9BT,KAAoC,QAAQ,UACnCD,aAAqBW,EAC9BV,KAAiC,QAAQ,UAChCD,aAAqBY,EAC9BX,KAAgC,QAAQ,MAExC,OAAM,IAAI,MAAM,mDAAmD,EAGrE,OAAOV,EAAkB,uBAAuB,CAAE,UAAAS,EAAW,OAAAC,CAAO,CAAC,CACvE,CAQA,gBAAiC,CAC/B,OAAO,IAAIY,EAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CACF,EAvHatB,EAMK,OAAiB,GAN5B,IAAMuB,EAANvB","names":["sha3Hash","_AuthenticationKey","Serializable","args","data","hex","Hex","serializer","deserializer","bytes","publicKey","scheme","authKeyBytes","singleKeyBytes","ed25519PublicKeyBytes","inputBytes","hash","sha3Hash","hashDigest","Ed25519PublicKey","MultiEd25519PublicKey","AnyPublicKey","MultiKey","AccountAddress","AuthenticationKey"]}
@@ -0,0 +1,2 @@
1
+ import{b as w,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-VWVEDCBM.mjs";import{a as d}from"./chunk-EWTHPMEE.mjs";import{b as l}from"./chunk-NZIJV4O2.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 w;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(l.fromStringRelaxed(c[0]),new d(c[1]),new d(c[2]),n))}}export{S as a,r as b,Z as c};
2
+ //# sourceMappingURL=chunk-U6SZNNVL.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/transactions/typeTag/parser.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n StructTag,\n TypeTag,\n TypeTagAddress,\n TypeTagBool,\n TypeTagGeneric,\n TypeTagReference,\n TypeTagSigner,\n TypeTagStruct,\n TypeTagU128,\n TypeTagU16,\n TypeTagU256,\n TypeTagU32,\n TypeTagU64,\n TypeTagU8,\n TypeTagVector,\n} from \".\";\nimport { AccountAddress } from \"../../core\";\nimport { Identifier } from \"../instances/identifier\";\n\nfunction isValidIdentifier(str: string) {\n return !!str.match(/^[_a-zA-Z0-9]+$/);\n}\n\nfunction isValidWhitespaceCharacter(char: string) {\n return !!char.match(/\\s/);\n}\n\nfunction isGeneric(str: string) {\n return !!str.match(/^T[0-9]+$/);\n}\n\nfunction consumeWhitespace(tagStr: string, pos: number) {\n let i = pos;\n for (; i < tagStr.length; i += 1) {\n const innerChar = tagStr[i];\n\n if (!isValidWhitespaceCharacter(innerChar)) {\n // If it's not colons, and it's an invalid character, we will stop here\n break;\n }\n }\n return i;\n}\n\ntype TypeTagState = {\n savedExpectedTypes: number;\n savedStr: string;\n savedTypes: Array<TypeTag>;\n};\n\nexport enum TypeTagParserErrorType {\n InvalidTypeTag = \"unknown type\",\n UnexpectedGenericType = \"unexpected generic type\",\n UnexpectedTypeArgumentClose = \"unexpected '>'\",\n UnexpectedWhitespaceCharacter = \"unexpected whitespace character\",\n UnexpectedComma = \"unexpected ','\",\n TypeArgumentCountMismatch = \"type argument count doesn't match expected amount\",\n MissingTypeArgumentClose = \"no matching '>' for '<'\",\n UnexpectedPrimitiveTypeArguments = \"primitive types not expected to have type arguments\",\n UnexpectedVectorTypeArgumentCount = \"vector type expected to have exactly one type argument\",\n UnexpectedStructFormat = \"unexpected struct format, must be of the form 0xaddress::module_name::struct_name\",\n InvalidModuleNameCharacter = \"module name must only contain alphanumeric or '_' characters\",\n InvalidStructNameCharacter = \"struct name must only contain alphanumeric or '_' characters\",\n}\n\nexport class TypeTagParserError extends Error {\n constructor(typeTagStr: string, invalidReason: TypeTagParserErrorType) {\n super(`Failed to parse typeTag '${typeTagStr}', ${invalidReason}`);\n }\n}\n\n/**\n * All types are made of a few parts they're either:\n * 1. A simple type e.g. u8\n * 2. A standalone struct e.g. 0x1::account::Account\n * 3. A nested struct e.g. 0x1::coin::Coin<0x1234::coin::MyCoin>\n *\n * There are a few more special cases that need to be handled, however.\n * 1. Multiple generics e.g 0x1::pair::Pair<u8, u16>\n * 2. Spacing in the generics e.g. 0x1::pair::Pair< u8 , u16>\n * 3. Nested generics of different depths e.g. 0x1::pair::Pair<0x1::coin::Coin<0x1234::coin::MyCoin>, u8>\n * 4. Generics for types in ABIs are filled in with placeholders e.g T1, T2, T3\n */\nexport function parseTypeTag(typeStr: string, options?: { allowGenerics?: boolean }) {\n const allowGenerics = options?.allowGenerics ?? false;\n\n const saved: Array<TypeTagState> = [];\n // This represents the internal types for a type tag e.g. '0x1::coin::Coin<innerTypes>'\n let innerTypes: Array<TypeTag> = [];\n // This represents the current parsed types in a comma list e.g. 'u8, u8'\n let curTypes: Array<TypeTag> = [];\n // This represents the current character index\n let cur: number = 0;\n // This represents the current working string as a type or struct name\n let currentStr: string = \"\";\n let expectedTypes: number = 1;\n\n // Iterate through each character, and handle the border conditions\n while (cur < typeStr.length) {\n const char = typeStr[cur];\n\n if (char === \"<\") {\n // Start of a type argument, push current state onto a stack\n saved.push({\n savedExpectedTypes: expectedTypes,\n savedStr: currentStr,\n savedTypes: curTypes,\n });\n\n // Clear current state\n currentStr = \"\";\n curTypes = [];\n expectedTypes = 1;\n } else if (char === \">\") {\n // Process last type, if there is no type string, then don't parse it\n if (currentStr !== \"\") {\n const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n curTypes.push(newType);\n }\n\n // Pop off stack outer type, if there's nothing left, there were too many '>'\n const savedPop = saved.pop();\n if (savedPop === undefined) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedTypeArgumentClose);\n }\n\n // If the expected types don't match the number of commas, then we also fail\n if (expectedTypes !== curTypes.length) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.TypeArgumentCountMismatch);\n }\n\n // Add in the new created type, shifting the current types to the inner types\n const { savedStr, savedTypes, savedExpectedTypes } = savedPop;\n innerTypes = curTypes;\n curTypes = savedTypes;\n currentStr = savedStr;\n expectedTypes = savedExpectedTypes;\n } else if (char === \",\") {\n // Comma means we need to start parsing a new tag, push the previous one to the curTypes\n // Process last type, if there is no type string, then don't parse it\n if (currentStr.length !== 0) {\n const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n\n // parse type tag and push it on the types\n innerTypes = [];\n curTypes.push(newType);\n currentStr = \"\";\n expectedTypes += 1;\n }\n } else if (isValidWhitespaceCharacter(char)) {\n // This means we should save what we have and everything else should skip until the next\n let parsedTypeTag = false;\n if (currentStr.length !== 0) {\n const newType = parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n\n // parse type tag and push it on the types\n innerTypes = [];\n curTypes.push(newType);\n currentStr = \"\";\n parsedTypeTag = true;\n }\n\n // Skip ahead on any more whitespace\n cur = consumeWhitespace(typeStr, cur);\n\n // The next space MUST be a comma, or a closing > if there was something parsed before\n // e.g. `u8 u8` is invalid but `u8, u8` is valid\n const nextChar = typeStr[cur];\n if (cur < typeStr.length && parsedTypeTag && nextChar !== \",\" && nextChar !== \">\") {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedWhitespaceCharacter);\n }\n\n // eslint-disable-next-line no-continue\n continue;\n } else {\n // Any other characters just append to the current string\n currentStr += char;\n }\n\n cur += 1;\n }\n\n // This prevents a missing '>' on type arguments\n if (saved.length > 0) {\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.MissingTypeArgumentClose);\n }\n\n // This prevents 'u8, u8' as an input\n switch (curTypes.length) {\n case 0:\n return parseTypeTagInner(currentStr, innerTypes, allowGenerics);\n case 1:\n if (currentStr === \"\") {\n return curTypes[0];\n }\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedComma);\n default:\n throw new TypeTagParserError(typeStr, TypeTagParserErrorType.UnexpectedWhitespaceCharacter);\n }\n}\n\n/**\n * Parses a type tag with internal types associated\n * @param str\n * @param types\n */\nfunction parseTypeTagInner(str: string, types: Array<TypeTag>, allowGenerics: boolean): TypeTag {\n // TODO: Parse references to any item not just signer\n switch (str) {\n case \"&signer\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagReference(new TypeTagSigner());\n case \"signer\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagSigner();\n case \"bool\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagBool();\n case \"address\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagAddress();\n case \"u8\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagU8();\n case \"u16\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagU16();\n case \"u32\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagU32();\n case \"u64\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagU64();\n case \"u128\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagU128();\n case \"u256\":\n if (types.length > 0) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedPrimitiveTypeArguments);\n }\n return new TypeTagU256();\n case \"vector\":\n if (types.length !== 1) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedVectorTypeArgumentCount);\n }\n return new TypeTagVector(types[0]);\n default:\n if (isGeneric(str)) {\n if (allowGenerics) {\n return new TypeTagGeneric(Number(str.split(\"T\")[1]));\n }\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedGenericType);\n }\n\n // If the value doesn't contain a colon, then we'll assume it isn't trying to be a struct\n if (!str.match(/.*:.*/)) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidTypeTag);\n }\n\n // Parse for a struct tag\n // eslint-disable-next-line no-case-declarations\n const structParts = str.split(\"::\");\n if (structParts.length !== 3) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.UnexpectedStructFormat);\n }\n\n // Validate identifier characters\n if (!isValidIdentifier(structParts[1])) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidModuleNameCharacter);\n }\n if (!isValidIdentifier(structParts[2])) {\n throw new TypeTagParserError(str, TypeTagParserErrorType.InvalidStructNameCharacter);\n }\n\n return new TypeTagStruct(\n new StructTag(\n AccountAddress.fromStringRelaxed(structParts[0]),\n new Identifier(structParts[1]),\n new Identifier(structParts[2]),\n types,\n ),\n );\n }\n}\n"],"mappings":"sNAuBA,SAASA,EAAkBC,EAAa,CACtC,MAAO,CAAC,CAACA,EAAI,MAAM,iBAAiB,CACtC,CAEA,SAASC,EAA2BC,EAAc,CAChD,MAAO,CAAC,CAACA,EAAK,MAAM,IAAI,CAC1B,CAEA,SAASC,EAAUH,EAAa,CAC9B,MAAO,CAAC,CAACA,EAAI,MAAM,WAAW,CAChC,CAEA,SAASI,EAAkBC,EAAgBC,EAAa,CACtD,IAAI,EAAIA,EACR,KAAO,EAAID,EAAO,OAAQ,GAAK,EAAG,CAChC,IAAME,EAAYF,EAAO,CAAC,EAE1B,GAAI,CAACJ,EAA2BM,CAAS,EAEvC,KAEJ,CACA,OAAO,CACT,CAQO,IAAKC,OACVA,EAAA,eAAiB,eACjBA,EAAA,sBAAwB,0BACxBA,EAAA,4BAA8B,iBAC9BA,EAAA,8BAA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EAAmBT,EAAK,8DAAiD,EAErF,GAAI,CAACD,EAAkB4C,EAAY,CAAC,CAAC,EACnC,MAAM,IAAIlC,EAAmBT,EAAK,8DAAiD,EAGrF,OAAO,IAAI4C,EACT,IAAIC,EACFC,EAAe,kBAAkBH,EAAY,CAAC,CAAC,EAC/C,IAAII,EAAWJ,EAAY,CAAC,CAAC,EAC7B,IAAII,EAAWJ,EAAY,CAAC,CAAC,EAC7Bb,CACF,CACF,CACJ,CACF","names":["isValidIdentifier","str","isValidWhitespaceCharacter","char","isGeneric","consumeWhitespace","tagStr","pos","innerChar","TypeTagParserErrorType","TypeTagParserError","typeTagStr","invalidReason","parseTypeTag","typeStr","options","allowGenerics","saved","innerTypes","curTypes","cur","currentStr","expectedTypes","newType","parseTypeTagInner","savedPop","savedStr","savedTypes","savedExpectedTypes","parsedTypeTag","nextChar","types","TypeTagReference","TypeTagSigner","TypeTagBool","TypeTagAddress","TypeTagU8","TypeTagU16","TypeTagU32","TypeTagU64","TypeTagU128","TypeTagU256","TypeTagVector","TypeTagGeneric","structParts","TypeTagStruct","StructTag","AccountAddress","Identifier"]}
@@ -1,2 +1,2 @@
1
- import{b as t}from"./chunk-HH5RSP2H.mjs";import{a as o,b as r}from"./chunk-7AQXAH6Q.mjs";import{e as u}from"./chunk-PDLUCVJB.mjs";import{a as i}from"./chunk-27P7PELS.mjs";var c=class extends i{constructor(e){super();this.accountAddress=t.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new u(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=o.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
- //# sourceMappingURL=chunk-EKAOAGNQ.mjs.map
1
+ import{a as o,b as r}from"./chunk-4ADA5BE7.mjs";import{e as u}from"./chunk-X32O46IB.mjs";import{b as t}from"./chunk-NZIJV4O2.mjs";import{a as i}from"./chunk-HA6JD5R6.mjs";var c=class extends i{constructor(e){super();this.accountAddress=t.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new u(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=o.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
+ //# sourceMappingURL=chunk-UAAI3NCA.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-WKY5ENCK.mjs";var t=class{constructor(o){this.config=o}async fundAccount(o){return n({aptosConfig:this.config,...o})}};export{t as a};
2
+ //# sourceMappingURL=chunk-UNQNACJT.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-U3LO2FSJ.mjs";import{a as K}from"./chunk-U25N2VWA.mjs";import{a as n}from"./chunk-YYRDFZE6.mjs";import{a as d,b as y}from"./chunk-62SCW5NH.mjs";import{a as p,b as o}from"./chunk-RYETO74W.mjs";import{b as l}from"./chunk-TIH6ARYP.mjs";var g=class a{constructor(t){let{privateKey:e,address:i,legacy:r}=t,c=r??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof p)c?this.signingScheme=0:(this.publicKey=new n(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof K)this.signingScheme=1;else if(this.publicKey instanceof d)this.publicKey=new n(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=i}static generate(t){let e=t?.legacy??!0,i,r;switch(t?.scheme){case 2:i=y.generate(),r=new n(i.publicKey());break;default:i=o.generate(),e===!1?r=new n(i.publicKey()):r=i.publicKey()}let s=u.fromPublicKey({publicKey:r}).derivedAddress();return new a({privateKey:i,address:s,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:i}=t,r=i??!0,c;if(e instanceof y)c=new n(e.publicKey());else if(e instanceof o)r?c=e.publicKey():c=new n(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let m=u.fromPublicKey({publicKey:c}).derivedAddress();return new a({privateKey:e,address:m,legacy:r})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:i,legacy:r}=t;return new a({privateKey:e,address:i,legacy:r})}static fromDerivationPath(t){let{path:e,mnemonic:i,scheme:r,legacy:c}=t,s;switch(r){case 2:s=y.fromDerivationPath(e,i);break;case 0:s=o.fromDerivationPath(e,i);break;default:throw new Error(`Unsupported scheme ${r}`)}return a.fromPrivateKey({privateKey:s,legacy:c})}static authKey(t){let{publicKey:e}=t;return u.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:i}=t,r=l.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:r,signature:i})}};export{g as a};
2
+ //# sourceMappingURL=chunk-UPLWWSB4.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddress } from \"./accountAddress\";\nimport { AuthenticationKey } from \"./authenticationKey\";\nimport { PrivateKey, PublicKey, Signature } from \"./crypto/asymmetricCrypto\";\nimport { Ed25519PrivateKey, Ed25519PublicKey } from \"./crypto/ed25519\";\nimport { MultiEd25519PublicKey } from \"./crypto/multiEd25519\";\nimport { Secp256k1PrivateKey, Secp256k1PublicKey } from \"./crypto/secp256k1\";\nimport { Hex } from \"./hex\";\nimport { GenerateAccount, HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport { AnyPublicKey } from \"./crypto/anyPublicKey\";\n\n/**\n * Class for creating and managing account on Aptos network\n *\n * Use this class to create accounts, sign transactions, and more.\n * Note: Creating an account instance does not create the account on-chain.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentications.\n *\n * @Legacy includes `ED25519` and `MultiED25519`\n * @Unified includes `SingleSender` and `MultiSender`, where currently\n * `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports\n * `MultiED25519`.\n *\n * In TypeScript SDK, we support all of these options:\n *\n * @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument\n * that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromPrivateKey derives an account by a provided private key and address, with an optional\n * `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromDerivationPath derives an account with bip44 path and mnemonics,\n *\n */\nexport class Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: PublicKey;\n\n /**\n * Private key associated with the account\n */\n readonly privateKey: PrivateKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * constructor for Account\n *\n * Need to update this to use the new crypto library if new schemes are added.\n *\n * @param args.privateKey PrivateKey - private key of the account\n * @param args.address AccountAddress - address of the account\n * @param args.legacy optional. If set to true, the keypair authentication keys will be derived with a Legacy scheme.\n * Defaults to deriving an authentication key with a Unified scheme\n *\n * This method is private because it should only be called by the factory static methods.\n * @returns Account\n */\n private constructor(args: { privateKey: PrivateKey; address: AccountAddress; legacy?: boolean }) {\n const { privateKey, address, legacy } = args;\n const useLegacy = legacy ?? true;\n\n // Derive the public key from the private key\n this.publicKey = privateKey.publicKey();\n\n // Derive the signing scheme from the public key\n if (this.publicKey instanceof Ed25519PublicKey) {\n if (useLegacy) {\n this.signingScheme = SigningScheme.Ed25519;\n } else {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n }\n } else if (this.publicKey instanceof MultiEd25519PublicKey) {\n this.signingScheme = SigningScheme.MultiEd25519;\n } else if (this.publicKey instanceof Secp256k1PublicKey) {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n } else {\n throw new Error(\"Can not create new Account, unsupported public key type\");\n }\n\n this.privateKey = privateKey;\n this.accountAddress = address;\n }\n\n /**\n * Derives an account with random private key and address.\n *\n * Default generation is using the Legacy ED25519 key\n *\n * @param args optional. Unify GenerateAccount type for Legacy and Unified keys\n *\n * Account input type to generate an account using Legacy\n * Ed25519 or MultiEd25519 keys or without a specified `scheme`.\n * ```\n * GenerateAccountWithLegacyKey = {\n * scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;\n * legacy: true;\n * };\n * ```\n *\n * Account input type to generate an account using Unified\n * Secp256k1Ecdsa key\n * In this case `legacy` is always false\n * ```\n * GenerateAccountWithUnifiedKey = {\n * scheme: SigningSchemeInput.Secp256k1Ecdsa;\n * legacy?: false;\n * };\n * ```\n *\n * @returns Account with the given signing scheme\n */\n static generate(args?: GenerateAccount): Account {\n const useLegacy = args?.legacy ?? true;\n\n let privateKey: PrivateKey;\n let publicKey: PublicKey;\n\n switch (args?.scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.generate();\n publicKey = new AnyPublicKey(privateKey.publicKey());\n break;\n default:\n privateKey = Ed25519PrivateKey.generate();\n if (useLegacy === false) {\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else {\n publicKey = privateKey.publicKey();\n }\n }\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: args?.legacy });\n }\n\n /**\n * Instantiates an account given a private key.\n *\n * This is used as a local calculation and therefore is used to instantiate an `Account`\n * that has not had its authentication key rotated.\n *\n * @param privateKey PrivateKey - private key of the account\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 fromPrivateKey(args: { privateKey: PrivateKey; legacy?: boolean }): Account {\n const { privateKey, legacy } = args;\n const useLegacy = legacy ?? true;\n\n let publicKey;\n if (privateKey instanceof Secp256k1PrivateKey) {\n // Secp256k1 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else if (privateKey instanceof Ed25519PrivateKey) {\n // legacy Ed25519\n if (useLegacy) {\n publicKey = privateKey.publicKey();\n } else {\n // Ed25519 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n }\n } else {\n throw new Error(`Unsupported private key ${privateKey}`);\n }\n\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: useLegacy });\n }\n\n /**\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: {\n privateKey: PrivateKey;\n address: AccountAddress;\n legacy?: boolean;\n }): Account {\n const { privateKey, address, legacy } = args;\n return new Account({ privateKey, address, legacy });\n }\n\n /**\n * Derives an account with bip44 path and mnemonics,\n *\n * @param args.scheme The signing scheme to derive 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 * @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 fromDerivationPath(args: {\n scheme: SigningSchemeInput;\n path: string;\n mnemonic: string;\n legacy?: boolean;\n }): Account {\n const { path, mnemonic, scheme, legacy } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n default:\n throw new Error(`Unsupported scheme ${scheme}`);\n }\n return Account.fromPrivateKey({ privateKey, legacy });\n }\n\n /**\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: PublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return AuthenticationKey.fromPublicKey({ publicKey });\n }\n\n /**\n * Sign the given message with the private key.\n *\n * TODO: Add sign transaction or specific types\n *\n * @param data in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): Signature {\n return this.privateKey.sign(data);\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signature signed message Signature\n * @returns\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n const rawMessage = Hex.fromHexInput(message).toUint8Array();\n return this.publicKey.verifySignature({ message: rawMessage, signature });\n }\n}\n"],"mappings":"oQAsCO,IAAMA,EAAN,KAAc,CAkCX,YAAYC,EAA6E,CAC/F,GAAM,CAAE,WAAAC,EAAY,QAAAC,EAAS,OAAAC,CAAO,EAAIH,EAClCI,EAAYD,GAAU,GAM5B,GAHA,KAAK,UAAYF,EAAW,UAAU,EAGlC,KAAK,qBAAqBI,EACxBD,EACF,KAAK,cAAgB,GAErB,KAAK,UAAY,IAAIE,EAAa,KAAK,SAAS,EAChD,KAAK,cAAgB,WAEd,KAAK,qBAAqBC,EACnC,KAAK,cAAgB,UACZ,KAAK,qBAAqBC,EACnC,KAAK,UAAY,IAAIF,EAAa,KAAK,SAAS,EAChD,KAAK,cAAgB,MAErB,OAAM,IAAI,MAAM,yDAAyD,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AC,EAAU,OAAAC,EAAQ,OAAAZ,CAAO,EAAIH,EACvCC,EACJ,OAAQc,EAAQ,CACd,OACEd,EAAaS,EAAoB,mBAAmBG,EAAMC,CAAQ,EAClE,MACF,OACEb,EAAaU,EAAkB,mBAAmBE,EAAMC,CAAQ,EAChE,MACF,QACE,MAAM,IAAI,MAAM,sBAAsBC,GAAQ,CAClD,CACA,OAAOhB,EAAQ,eAAe,CAAE,WAAAE,EAAY,OAAAE,CAAO,CAAC,CACtD,CAUA,OAAO,QAAQH,EAAmD,CAChE,GAAM,CAAE,UAAAS,CAAU,EAAIT,EACtB,OAAOY,EAAkB,cAAc,CAAE,UAAAH,CAAU,CAAC,CACtD,CAUA,KAAKO,EAA2B,CAC9B,OAAO,KAAK,WAAW,KAAKA,CAAI,CAClC,CASA,gBAAgBhB,EAA4D,CAC1E,GAAM,CAAE,QAAAiB,EAAS,UAAAC,CAAU,EAAIlB,EACzBmB,EAAaC,EAAI,aAAaH,CAAO,EAAE,aAAa,EAC1D,OAAO,KAAK,UAAU,gBAAgB,CAAE,QAASE,EAAY,UAAAD,CAAU,CAAC,CAC1E,CACF","names":["Account","args","privateKey","address","legacy","useLegacy","Ed25519PublicKey","AnyPublicKey","MultiEd25519PublicKey","Secp256k1PublicKey","publicKey","Secp256k1PrivateKey","Ed25519PrivateKey","AuthenticationKey","path","mnemonic","scheme","data","message","signature","rawMessage","Hex"]}
1
+ {"version":3,"sources":["../../src/core/account.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AccountAddress } from \"./accountAddress\";\nimport { AuthenticationKey } from \"./authenticationKey\";\nimport { PrivateKey, PublicKey, Signature } from \"./crypto/asymmetricCrypto\";\nimport { Ed25519PrivateKey, Ed25519PublicKey } from \"./crypto/ed25519\";\nimport { MultiEd25519PublicKey } from \"./crypto/multiEd25519\";\nimport { Secp256k1PrivateKey, Secp256k1PublicKey } from \"./crypto/secp256k1\";\nimport { Hex } from \"./hex\";\nimport { GenerateAccount, HexInput, SigningScheme, SigningSchemeInput } from \"../types\";\nimport { AnyPublicKey } from \"./crypto/anyPublicKey\";\n\n/**\n * Class for creating and managing account on Aptos network\n *\n * Use this class to create accounts, sign transactions, and more.\n * Note: Creating an account instance does not create the account on-chain.\n *\n * Since [AIP-55](https://github.com/aptos-foundation/AIPs/pull/263) Aptos supports\n * `Legacy` and `Unified` authentications.\n *\n * @Legacy includes `ED25519` and `MultiED25519`\n * @Unified includes `SingleSender` and `MultiSender`, where currently\n * `SingleSender` supports `ED25519` and `Secp256k1`, and `MultiSender` supports\n * `MultiED25519`.\n *\n * In TypeScript SDK, we support all of these options:\n *\n * @generate default to generate Legacy Ed25519 keys, with an optional `legacy` boolean argument\n * that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromPrivateKey derives an account by a provided private key and address, with an optional\n * `legacy` boolean argument that lets you generate new keys conforming to the Unified authentication.\n *\n * @fromDerivationPath derives an account with bip44 path and mnemonics,\n *\n */\nexport class Account {\n /**\n * Public key associated with the account\n */\n readonly publicKey: PublicKey;\n\n /**\n * Private key associated with the account\n */\n readonly privateKey: PrivateKey;\n\n /**\n * Account address associated with the account\n */\n readonly accountAddress: AccountAddress;\n\n /**\n * Signing scheme used to sign transactions\n */\n readonly signingScheme: SigningScheme;\n\n /**\n * constructor for Account\n *\n * Need to update this to use the new crypto library if new schemes are added.\n *\n * @param args.privateKey PrivateKey - private key of the account\n * @param args.address AccountAddress - address of the account\n * @param args.legacy optional. If set to true, the keypair authentication keys will be derived with a Legacy scheme.\n * Defaults to deriving an authentication key with a Unified scheme\n *\n * This method is private because it should only be called by the factory static methods.\n * @returns Account\n */\n private constructor(args: { privateKey: PrivateKey; address: AccountAddress; legacy?: boolean }) {\n const { privateKey, address, legacy } = args;\n const useLegacy = legacy ?? true;\n\n // Derive the public key from the private key\n this.publicKey = privateKey.publicKey();\n\n // Derive the signing scheme from the public key\n if (this.publicKey instanceof Ed25519PublicKey) {\n if (useLegacy) {\n this.signingScheme = SigningScheme.Ed25519;\n } else {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n }\n } else if (this.publicKey instanceof MultiEd25519PublicKey) {\n this.signingScheme = SigningScheme.MultiEd25519;\n } else if (this.publicKey instanceof Secp256k1PublicKey) {\n this.publicKey = new AnyPublicKey(this.publicKey);\n this.signingScheme = SigningScheme.SingleKey;\n } else {\n throw new Error(\"Can not create new Account, unsupported public key type\");\n }\n\n this.privateKey = privateKey;\n this.accountAddress = address;\n }\n\n /**\n * Derives an account with random private key and address.\n *\n * Default generation is using the Legacy ED25519 key\n *\n * @param args optional. Unify GenerateAccount type for Legacy and Unified keys\n *\n * Account input type to generate an account using Legacy\n * Ed25519 or MultiEd25519 keys or without a specified `scheme`.\n * ```\n * GenerateAccountWithLegacyKey = {\n * scheme?: SigningSchemeInput.Ed25519 | SigningSchemeInput.MultiEd25519;\n * legacy: true;\n * };\n * ```\n *\n * Account input type to generate an account using Unified\n * Secp256k1Ecdsa key\n * In this case `legacy` is always false\n * ```\n * GenerateAccountWithUnifiedKey = {\n * scheme: SigningSchemeInput.Secp256k1Ecdsa;\n * legacy?: false;\n * };\n * ```\n *\n * @returns Account with the given signing scheme\n */\n static generate(args?: GenerateAccount): Account {\n const useLegacy = args?.legacy ?? true;\n\n let privateKey: PrivateKey;\n let publicKey: PublicKey;\n\n switch (args?.scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.generate();\n publicKey = new AnyPublicKey(privateKey.publicKey());\n break;\n default:\n privateKey = Ed25519PrivateKey.generate();\n if (useLegacy === false) {\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else {\n publicKey = privateKey.publicKey();\n }\n }\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: args?.legacy });\n }\n\n /**\n * Instantiates an account given a private key.\n *\n * This is used as a local calculation and therefore is used to instantiate an `Account`\n * that has not had its authentication key rotated.\n *\n * @param privateKey PrivateKey - private key of the account\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 fromPrivateKey(args: { privateKey: PrivateKey; legacy?: boolean }): Account {\n const { privateKey, legacy } = args;\n const useLegacy = legacy ?? true;\n\n let publicKey;\n if (privateKey instanceof Secp256k1PrivateKey) {\n // Secp256k1 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n } else if (privateKey instanceof Ed25519PrivateKey) {\n // legacy Ed25519\n if (useLegacy) {\n publicKey = privateKey.publicKey();\n } else {\n // Ed25519 single sender\n publicKey = new AnyPublicKey(privateKey.publicKey());\n }\n } else {\n throw new Error(`Unsupported private key ${privateKey}`);\n }\n\n const authKey = AuthenticationKey.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return new Account({ privateKey, address, legacy: useLegacy });\n }\n\n /**\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: {\n privateKey: PrivateKey;\n address: AccountAddress;\n legacy?: boolean;\n }): Account {\n const { privateKey, address, legacy } = args;\n return new Account({ privateKey, address, legacy });\n }\n\n /**\n * Derives an account with bip44 path and mnemonics,\n *\n * @param args.scheme The signing scheme to derive 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 * @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 fromDerivationPath(args: {\n scheme: SigningSchemeInput;\n path: string;\n mnemonic: string;\n legacy?: boolean;\n }): Account {\n const { path, mnemonic, scheme, legacy } = args;\n let privateKey: PrivateKey;\n switch (scheme) {\n case SigningSchemeInput.Secp256k1Ecdsa:\n privateKey = Secp256k1PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n case SigningSchemeInput.Ed25519:\n privateKey = Ed25519PrivateKey.fromDerivationPath(path, mnemonic);\n break;\n default:\n throw new Error(`Unsupported scheme ${scheme}`);\n }\n return Account.fromPrivateKey({ privateKey, legacy });\n }\n\n /**\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: PublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return AuthenticationKey.fromPublicKey({ publicKey });\n }\n\n /**\n * Sign the given message with the private key.\n *\n * TODO: Add sign transaction or specific types\n *\n * @param data in HexInput format\n * @returns Signature\n */\n sign(data: HexInput): Signature {\n return this.privateKey.sign(data);\n }\n\n /**\n * Verify the given message and signature with the public key.\n *\n * @param args.message raw message data in HexInput format\n * @param args.signature signed message Signature\n * @returns\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n const rawMessage = Hex.fromHexInput(message).toUint8Array();\n return this.publicKey.verifySignature({ message: rawMessage, signature });\n }\n}\n"],"mappings":"oQAsCO,IAAMA,EAAN,MAAMC,CAAQ,CAkCX,YAAYC,EAA6E,CAC/F,GAAM,CAAE,WAAAC,EAAY,QAAAC,EAAS,OAAAC,CAAO,EAAIH,EAClCI,EAAYD,GAAU,GAM5B,GAHA,KAAK,UAAYF,EAAW,UAAU,EAGlC,KAAK,qBAAqBI,EACxBD,EACF,KAAK,cAAgB,GAErB,KAAK,UAAY,IAAIE,EA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,CAAE,WAAAC,EAAY,QAAAC,EAAS,OAAAC,CAAO,EAAIH,EACxC,OAAO,IAAID,EAAQ,CAAE,WAAAE,EAAY,QAAAC,EAAS,OAAAC,CAAO,CAAC,CACpD,CAeA,OAAO,mBAAmBH,EAKd,CACV,GAAM,CAAE,KAAAa,EAAM,SAAAC,EAAU,OAAAC,EAAQ,OAAAZ,CAAO,EAAIH,EACvCC,EACJ,OAAQc,EAAQ,CACd,OACEd,EAAaS,EAAoB,mBAAmBG,EAAMC,CAAQ,EAClE,MACF,OACEb,EAAaU,EAAkB,mBAAmBE,EAAMC,CAAQ,EAChE,MACF,QACE,MAAM,IAAI,MAAM,sBAAsBC,CAAM,EAAE,CAClD,CACA,OAAOhB,EAAQ,eAAe,CAAE,WAAAE,EAAY,OAAAE,CAAO,CAAC,CACtD,CAUA,OAAO,QAAQH,EAAmD,CAChE,GAAM,CAAE,UAAAS,CAAU,EAAIT,EACtB,OAAOY,EAAkB,cAAc,CAAE,UAAAH,CAAU,CAAC,CACtD,CAUA,KAAKO,EAA2B,CAC9B,OAAO,KAAK,WAAW,KAAKA,CAAI,CAClC,CASA,gBAAgBhB,EAA4D,CAC1E,GAAM,CAAE,QAAAiB,EAAS,UAAAC,CAAU,EAAIlB,EACzBmB,EAAaC,EAAI,aAAaH,CAAO,EAAE,aAAa,EAC1D,OAAO,KAAK,UAAU,gBAAgB,CAAE,QAASE,EAAY,UAAAD,CAAU,CAAC,CAC1E,CACF","names":["Account","_Account","args","privateKey","address","legacy","useLegacy","Ed25519PublicKey","AnyPublicKey","MultiEd25519PublicKey","Secp256k1PublicKey","publicKey","Secp256k1PrivateKey","Ed25519PrivateKey","AuthenticationKey","path","mnemonic","scheme","data","message","signature","rawMessage","Hex"]}
@@ -1,2 +1,2 @@
1
- import{a as o}from"./chunk-J5OKXARS.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
2
- //# sourceMappingURL=chunk-XFSL7O6Q.mjs.map
1
+ import{a as o}from"./chunk-IXMB2GOK.mjs";var t=class{constructor(n){this.config=n}async transferCoinTransaction(n){return o({aptosConfig:this.config,...n})}};export{t as a};
2
+ //# sourceMappingURL=chunk-V45RFKH7.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/coin.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Account, AccountAddressInput } from \"../core\";\nimport { transferCoinTransaction } from \"../internal/coin\";\nimport { InputSingleSignerTransaction, InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\n\n/**\n * A class to handle all `Coin` operations\n */\nexport class Coin {\n readonly config: AptosConfig;\n\n constructor(config: AptosConfig) {\n this.config = config;\n }\n\n /**\n * Generate a transfer coin transaction that can be simulated and/or signed and submitted\n *\n * @param args.sender The sender account\n * @param args.recipient The recipient address\n * @param args.amount The amount to transfer\n * @param args.coinType optional. The coin struct type to transfer. Defaults to 0x1::aptos_coin::AptosCoin\n *\n * @returns SingleSignerTransaction\n */\n async transferCoinTransaction(args: {\n sender: Account;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<InputSingleSignerTransaction> {\n return transferCoinTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAYO,IAAMA,EAAN,KAAW,CAGhB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,CAChB,CAYA,MAAM,wBAAwBC,EAMY,CACxC,OAAOC,EAAwB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtE,CACF","names":["Coin","config","args","transferCoinTransaction"]}
@@ -1,2 +1,2 @@
1
- import{g as a}from"./chunk-MIBLZSNS.mjs";import{o as g,s as d}from"./chunk-BTK34A5U.mjs";import{b as s}from"./chunk-HH5RSP2H.mjs";async function f(e){let{aptosConfig:t,poolAddress:o}=e,r=s.fromRelaxed(o).toStringLong(),i=await a({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function m(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{where_condition:{},order_by:o?.orderBy}};return(await a({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,n={query:g,variables:{delegatorAddress:s.fromRelaxed(o).toStringLong(),poolAddress:s.fromRelaxed(r).toStringLong()}};return(await a({aptosConfig:t,query:n})).delegated_staking_activities}export{f as a,m as b,A as c};
2
- //# sourceMappingURL=chunk-PJDVHU7X.mjs.map
1
+ import{g as a}from"./chunk-7MNEEVXY.mjs";import{o as g,s as d}from"./chunk-WX43AJTD.mjs";import{b as s}from"./chunk-NZIJV4O2.mjs";async function f(e){let{aptosConfig:t,poolAddress:o}=e,r=s.fromRelaxed(o).toStringLong(),i=await a({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function m(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{where_condition:{},order_by:o?.orderBy}};return(await a({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,n={query:g,variables:{delegatorAddress:s.fromRelaxed(o).toStringLong(),poolAddress:s.fromRelaxed(r).toStringLong()}};return(await a({aptosConfig:t,query:n})).delegated_staking_activities}export{f as a,m as b,A as c};
2
+ //# sourceMappingURL=chunk-VMQWW5UT.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/internal/staking.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/staking}. 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 */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderBy } from \"../types\";\nimport { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from \"../types/generated/operations\";\nimport { GetDelegatedStakingActivities, GetNumberOfDelegators } from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\n\nexport async function getNumberOfDelegators(args: {\n aptosConfig: AptosConfig;\n poolAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, poolAddress } = args;\n const address = AccountAddress.fromRelaxed(poolAddress).toStringLong();\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: { pool_address: { _eq: address } } },\n };\n const data: GetNumberOfDelegatorsQuery = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });\n if (data.num_active_delegator_per_pool.length === 0) {\n throw Error(\"Delegator pool not found\");\n }\n return data.num_active_delegator_per_pool[0].num_active_delegator;\n}\n\nexport async function getNumberOfDelegatorsForAllPools(args: {\n aptosConfig: AptosConfig;\n options?: {\n orderBy?: OrderBy<GetNumberOfDelegatorsResponse[0]>;\n };\n}): Promise<GetNumberOfDelegatorsResponse> {\n const { aptosConfig, options } = args;\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: {}, order_by: options?.orderBy },\n };\n const data: GetNumberOfDelegatorsQuery = await queryIndexer<GetNumberOfDelegatorsQuery>({\n aptosConfig,\n query,\n });\n return data.num_active_delegator_per_pool;\n}\n\nexport async function getDelegatedStakingActivities(args: {\n aptosConfig: AptosConfig;\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n}): Promise<GetDelegatedStakingActivitiesResponse> {\n const { aptosConfig, delegatorAddress, poolAddress } = args;\n const query = {\n query: GetDelegatedStakingActivities,\n variables: {\n delegatorAddress: AccountAddress.fromRelaxed(delegatorAddress).toStringLong(),\n poolAddress: AccountAddress.fromRelaxed(poolAddress).toStringLong(),\n },\n };\n const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });\n return data.delegated_staking_activities;\n}\n"],"mappings":"kIAiBA,eAAsBA,EAAsBC,EAGxB,CAClB,GAAM,CAAE,YAAAC,EAAa,YAAAC,CAAY,EAAIF,EAC/BG,EAAUC,EAAe,YAAYF,CAAW,EAAE,aAAa,EAK/DG,EAAmC,MAAMC,EAAyC,CAAE,YAAAL,EAAa,MAJzF,CACZ,MAAOM,EACP,UAAW,CAAE,gBAAiB,CAAE,aAAc,CAAE,IAAKJ,CAAQ,CAAE,CAAE,CACnE,CAC6G,CAAC,EAC9G,GAAIE,EAAK,8BAA8B,SAAW,EAChD,MAAM,MAAM,0BAA0B,EAExC,OAAOA,EAAK,8BAA8B,GAAG,oBAC/C,CAEA,eAAsBG,EAAiCR,EAKZ,CACzC,GAAM,CAAE,YAAAC,EAAa,QAAAQ,CAAQ,EAAIT,EAC3BU,EAAQ,CACZ,MAAOH,EACP,UAAW,CAAE,gBAAiB,CAAC,EAAG,SAAUE,GAAS,OAAQ,CAC/D,EAKA,OAJyC,MAAMH,EAAyC,CACtF,YAAAL,EACA,MAAAS,CACF,CAAC,GACW,6BACd,CAEA,eAAsBC,EAA8BX,EAID,CACjD,GAAM,CAAE,YAAAC,EAAa,iBAAAW,EAAkB,YAAAV,CAAY,EAAIF,EACjDU,EAAQ,CACZ,MAAOG,EACP,UAAW,CACT,iBAAkBT,EAAe,YAAYQ,CAAgB,EAAE,aAAa,EAC5E,YAAaR,EAAe,YAAYF,CAAW,EAAE,aAAa,CACpE,CACF,EAEA,OADa,MAAMI,EAAiD,CAAE,YAAAL,EAAa,MAAAS,CAAM,CAAC,GAC9E,4BACd","names":["getNumberOfDelegators","args","aptosConfig","poolAddress","address","AccountAddress","data","queryIndexer","GetNumberOfDelegators","getNumberOfDelegatorsForAllPools","options","query","getDelegatedStakingActivities","delegatorAddress","GetDelegatedStakingActivities"]}
1
+ {"version":3,"sources":["../../src/internal/staking.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/staking}. 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 */\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { AccountAddress, AccountAddressInput } from \"../core\";\nimport { GetDelegatedStakingActivitiesResponse, GetNumberOfDelegatorsResponse, OrderBy } from \"../types\";\nimport { GetDelegatedStakingActivitiesQuery, GetNumberOfDelegatorsQuery } from \"../types/generated/operations\";\nimport { GetDelegatedStakingActivities, GetNumberOfDelegators } from \"../types/generated/queries\";\nimport { queryIndexer } from \"./general\";\n\nexport async function getNumberOfDelegators(args: {\n aptosConfig: AptosConfig;\n poolAddress: AccountAddressInput;\n}): Promise<number> {\n const { aptosConfig, poolAddress } = args;\n const address = AccountAddress.fromRelaxed(poolAddress).toStringLong();\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: { pool_address: { _eq: address } } },\n };\n const data: GetNumberOfDelegatorsQuery = await queryIndexer<GetNumberOfDelegatorsQuery>({ aptosConfig, query });\n if (data.num_active_delegator_per_pool.length === 0) {\n throw Error(\"Delegator pool not found\");\n }\n return data.num_active_delegator_per_pool[0].num_active_delegator;\n}\n\nexport async function getNumberOfDelegatorsForAllPools(args: {\n aptosConfig: AptosConfig;\n options?: {\n orderBy?: OrderBy<GetNumberOfDelegatorsResponse[0]>;\n };\n}): Promise<GetNumberOfDelegatorsResponse> {\n const { aptosConfig, options } = args;\n const query = {\n query: GetNumberOfDelegators,\n variables: { where_condition: {}, order_by: options?.orderBy },\n };\n const data: GetNumberOfDelegatorsQuery = await queryIndexer<GetNumberOfDelegatorsQuery>({\n aptosConfig,\n query,\n });\n return data.num_active_delegator_per_pool;\n}\n\nexport async function getDelegatedStakingActivities(args: {\n aptosConfig: AptosConfig;\n delegatorAddress: AccountAddressInput;\n poolAddress: AccountAddressInput;\n}): Promise<GetDelegatedStakingActivitiesResponse> {\n const { aptosConfig, delegatorAddress, poolAddress } = args;\n const query = {\n query: GetDelegatedStakingActivities,\n variables: {\n delegatorAddress: AccountAddress.fromRelaxed(delegatorAddress).toStringLong(),\n poolAddress: AccountAddress.fromRelaxed(poolAddress).toStringLong(),\n },\n };\n const data = await queryIndexer<GetDelegatedStakingActivitiesQuery>({ aptosConfig, query });\n return data.delegated_staking_activities;\n}\n"],"mappings":"kIAiBA,eAAsBA,EAAsBC,EAGxB,CAClB,GAAM,CAAE,YAAAC,EAAa,YAAAC,CAAY,EAAIF,EAC/BG,EAAUC,EAAe,YAAYF,CAAW,EAAE,aAAa,EAK/DG,EAAmC,MAAMC,EAAyC,CAAE,YAAAL,EAAa,MAJzF,CACZ,MAAOM,EACP,UAAW,CAAE,gBAAiB,CAAE,aAAc,CAAE,IAAKJ,CAAQ,CAAE,CAAE,CACnE,CAC6G,CAAC,EAC9G,GAAIE,EAAK,8BAA8B,SAAW,EAChD,MAAM,MAAM,0BAA0B,EAExC,OAAOA,EAAK,8BAA8B,CAAC,EAAE,oBAC/C,CAEA,eAAsBG,EAAiCR,EAKZ,CACzC,GAAM,CAAE,YAAAC,EAAa,QAAAQ,CAAQ,EAAIT,EAC3BU,EAAQ,CACZ,MAAOH,EACP,UAAW,CAAE,gBAAiB,CAAC,EAAG,SAAUE,GAAS,OAAQ,CAC/D,EAKA,OAJyC,MAAMH,EAAyC,CACtF,YAAAL,EACA,MAAAS,CACF,CAAC,GACW,6BACd,CAEA,eAAsBC,EAA8BX,EAID,CACjD,GAAM,CAAE,YAAAC,EAAa,iBAAAW,EAAkB,YAAAV,CAAY,EAAIF,EACjDU,EAAQ,CACZ,MAAOG,EACP,UAAW,CACT,iBAAkBT,EAAe,YAAYQ,CAAgB,EAAE,aAAa,EAC5E,YAAaR,EAAe,YAAYF,CAAW,EAAE,aAAa,CACpE,CACF,EAEA,OADa,MAAMI,EAAiD,CAAE,YAAAL,EAAa,MAAAS,CAAM,CAAC,GAC9E,4BACd","names":["getNumberOfDelegators","args","aptosConfig","poolAddress","address","AccountAddress","data","queryIndexer","GetNumberOfDelegators","getNumberOfDelegatorsForAllPools","options","query","getDelegatedStakingActivities","delegatorAddress","GetDelegatedStakingActivities"]}
@@ -0,0 +1,2 @@
1
+ import{a as m}from"./chunk-BFSEVKNA.mjs";import{a as p}from"./chunk-AAIBCWZY.mjs";import{a as h}from"./chunk-EYXHVA6W.mjs";import{a as A}from"./chunk-ARVSIDVB.mjs";import{a as r}from"./chunk-V45RFKH7.mjs";import{a}from"./chunk-BWMNPUTK.mjs";import{a as c}from"./chunk-R26XML3D.mjs";import{a as f}from"./chunk-UNQNACJT.mjs";import{a as g}from"./chunk-Q6N6QACD.mjs";import{a as l}from"./chunk-4RVIA63I.mjs";import{a as s}from"./chunk-J5ZFOJN2.mjs";import{a as u}from"./chunk-IG5CHHSI.mjs";var n=class{constructor(i){this.config=new A(i),this.account=new s(this.config),this.ans=new u(this.config),this.coin=new r(this.config),this.digitalAsset=new a(this.config),this.event=new c(this.config),this.faucet=new f(this.config),this.fungibleAsset=new g(this.config),this.general=new l(this.config),this.staking=new m(this.config),this.transaction=new p(this.config),this.transactionSubmission=new h(this.config)}};function t(y,i,d){Object.getOwnPropertyNames(i.prototype).forEach(o=>{let e=Object.getOwnPropertyDescriptor(i.prototype,o);e&&(e.value=function(...b){return this[d][o](...b)},Object.defineProperty(y.prototype,o,e))})}t(n,s,"account");t(n,u,"ans");t(n,r,"coin");t(n,a,"digitalAsset");t(n,c,"event");t(n,f,"faucet");t(n,g,"fungibleAsset");t(n,l,"general");t(n,m,"staking");t(n,p,"transaction");t(n,h,"transactionSubmission");export{n as a};
2
+ //# sourceMappingURL=chunk-VOYW2TZW.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/api/aptos.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./account\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Coin } from \"./coin\";\nimport { DigitalAsset } from \"./digitalAsset\";\nimport { Event } from \"./event\";\nimport { Faucet } from \"./faucet\";\nimport { FungibleAsset } from \"./fungibleAsset\";\nimport { General } from \"./general\";\nimport { ANS } from \"./ans\";\nimport { Staking } from \"./staking\";\nimport { Transaction } from \"./transaction\";\nimport { TransactionSubmission } from \"./transactionSubmission\";\n\n/**\n * This class is the main entry point into Aptos's\n * APIs and separates functionality into different namespaces.\n *\n * To use the SDK, create a new Aptos instance to get access\n * to all the sdk functionality.\n */\nexport class Aptos {\n readonly config: AptosConfig;\n\n readonly account: Account;\n\n readonly ans: ANS;\n\n readonly coin: Coin;\n\n readonly digitalAsset: DigitalAsset;\n\n readonly event: Event;\n\n readonly faucet: Faucet;\n\n readonly fungibleAsset: FungibleAsset;\n\n readonly general: General;\n\n readonly staking: Staking;\n\n readonly transaction: Transaction;\n\n readonly transactionSubmission: TransactionSubmission;\n\n constructor(settings?: AptosConfig) {\n this.config = new AptosConfig(settings);\n this.account = new Account(this.config);\n this.ans = new ANS(this.config);\n this.coin = new Coin(this.config);\n this.digitalAsset = new DigitalAsset(this.config);\n this.event = new Event(this.config);\n this.faucet = new Faucet(this.config);\n this.fungibleAsset = new FungibleAsset(this.config);\n this.general = new General(this.config);\n this.staking = new Staking(this.config);\n this.transaction = new Transaction(this.config);\n this.transactionSubmission = new TransactionSubmission(this.config);\n }\n}\n\nexport interface Aptos\n extends Account,\n Coin,\n DigitalAsset,\n Event,\n Faucet,\n FungibleAsset,\n General,\n Staking,\n Transaction,\n ANS,\n TransactionSubmission {}\n\n/**\nIn TypeScript, we can’t inherit or extend from more than one class,\nMixins helps us to get around that by creating a partial classes\nthat we can combine to form a single class that contains all the methods and properties from the partial classes.\n{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n\nHere, we combine any subclass and the Aptos class.\n*/\nfunction applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {\n // Mixin instance methods\n Object.getOwnPropertyNames(baseClass.prototype).forEach((propertyName) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(baseClass.prototype, propertyName);\n if (!propertyDescriptor) return;\n // eslint-disable-next-line func-names\n propertyDescriptor.value = function (...args: any) {\n return (this as any)[baseClassProp][propertyName](...args);\n };\n Object.defineProperty(targetClass.prototype, propertyName, propertyDescriptor);\n });\n}\n\napplyMixin(Aptos, Account, \"account\");\napplyMixin(Aptos, ANS, \"ans\");\napplyMixin(Aptos, Coin, \"coin\");\napplyMixin(Aptos, DigitalAsset, \"digitalAsset\");\napplyMixin(Aptos, Event, \"event\");\napplyMixin(Aptos, Faucet, \"faucet\");\napplyMixin(Aptos, FungibleAsset, \"fungibleAsset\");\napplyMixin(Aptos, General, \"general\");\napplyMixin(Aptos, Staking, \"staking\");\napplyMixin(Aptos, Transaction, \"transaction\");\napplyMixin(Aptos, TransactionSubmission, \"transactionSubmission\");\n"],"mappings":"ueAuBO,IAAMA,EAAN,KAAY,CAyBjB,YAAYC,EAAwB,CAClC,KAAK,OAAS,IAAIC,EAAYD,CAAQ,EACtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,MAAM,EACtC,KAAK,IAAM,IAAIC,EAAI,KAAK,MAAM,EAC9B,KAAK,KAAO,IAAIC,EAAK,KAAK,MAAM,EAChC,KAAK,aAAe,IAAIC,EAAa,KAAK,MAAM,EAChD,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,cAAgB,IAAIC,EAAc,KAAK,MAAM,EAClD,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,YAAc,IAAIC,EAAY,KAAK,MAAM,EAC9C,KAAK,sBAAwB,IAAIC,EAAsB,KAAK,MAAM,CACpE,CACF,EAuBA,SAASC,EAAWC,EAAkBC,EAAgBC,EAAuB,CAE3E,OAAO,oBAAoBD,EAAU,SAAS,EAAE,QAASE,GAAiB,CACxE,IAAMC,EAAqB,OAAO,yBAAyBH,EAAU,UAAWE,CAAY,EACxF,CAACC,IAELA,EAAmB,MAAQ,YAAaC,EAAW,CACjD,OAAQ,KAAaH,GAAeC,GAAc,GAAGE,CAAI,CAC3D,EACA,OAAO,eAAeL,EAAY,UAAWG,EAAcC,CAAkB,EAC/E,CAAC,CACH,CAEAL,EAAWd,EAAOG,EAAS,SAAS,EACpCW,EAAWd,EAAOI,EAAK,KAAK,EAC5BU,EAAWd,EAAOK,EAAM,MAAM,EAC9BS,EAAWd,EAAOM,EAAc,cAAc,EAC9CQ,EAAWd,EAAOO,EAAO,OAAO,EAChCO,EAAWd,EAAOQ,EAAQ,QAAQ,EAClCM,EAAWd,EAAOS,EAAe,eAAe,EAChDK,EAAWd,EAAOU,EAAS,SAAS,EACpCI,EAAWd,EAAOW,EAAS,SAAS,EACpCG,EAAWd,EAAOY,EAAa,aAAa,EAC5CE,EAAWd,EAAOa,EAAuB,uBAAuB","names":["Aptos","settings","AptosConfig","Account","ANS","Coin","DigitalAsset","Event","Faucet","FungibleAsset","General","Staking","Transaction","TransactionSubmission","applyMixin","targetClass","baseClass","baseClassProp","propertyName","propertyDescriptor","args"]}
1
+ {"version":3,"sources":["../../src/api/aptos.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { Account } from \"./account\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { Coin } from \"./coin\";\nimport { DigitalAsset } from \"./digitalAsset\";\nimport { Event } from \"./event\";\nimport { Faucet } from \"./faucet\";\nimport { FungibleAsset } from \"./fungibleAsset\";\nimport { General } from \"./general\";\nimport { ANS } from \"./ans\";\nimport { Staking } from \"./staking\";\nimport { Transaction } from \"./transaction\";\nimport { TransactionSubmission } from \"./transactionSubmission\";\n\n/**\n * This class is the main entry point into Aptos's\n * APIs and separates functionality into different namespaces.\n *\n * To use the SDK, create a new Aptos instance to get access\n * to all the sdk functionality.\n */\nexport class Aptos {\n readonly config: AptosConfig;\n\n readonly account: Account;\n\n readonly ans: ANS;\n\n readonly coin: Coin;\n\n readonly digitalAsset: DigitalAsset;\n\n readonly event: Event;\n\n readonly faucet: Faucet;\n\n readonly fungibleAsset: FungibleAsset;\n\n readonly general: General;\n\n readonly staking: Staking;\n\n readonly transaction: Transaction;\n\n readonly transactionSubmission: TransactionSubmission;\n\n constructor(settings?: AptosConfig) {\n this.config = new AptosConfig(settings);\n this.account = new Account(this.config);\n this.ans = new ANS(this.config);\n this.coin = new Coin(this.config);\n this.digitalAsset = new DigitalAsset(this.config);\n this.event = new Event(this.config);\n this.faucet = new Faucet(this.config);\n this.fungibleAsset = new FungibleAsset(this.config);\n this.general = new General(this.config);\n this.staking = new Staking(this.config);\n this.transaction = new Transaction(this.config);\n this.transactionSubmission = new TransactionSubmission(this.config);\n }\n}\n\nexport interface Aptos\n extends Account,\n Coin,\n DigitalAsset,\n Event,\n Faucet,\n FungibleAsset,\n General,\n Staking,\n Transaction,\n ANS,\n TransactionSubmission {}\n\n/**\nIn TypeScript, we can’t inherit or extend from more than one class,\nMixins helps us to get around that by creating a partial classes\nthat we can combine to form a single class that contains all the methods and properties from the partial classes.\n{@link https://www.typescriptlang.org/docs/handbook/mixins.html#alternative-pattern}\n\nHere, we combine any subclass and the Aptos class.\n*/\nfunction applyMixin(targetClass: any, baseClass: any, baseClassProp: string) {\n // Mixin instance methods\n Object.getOwnPropertyNames(baseClass.prototype).forEach((propertyName) => {\n const propertyDescriptor = Object.getOwnPropertyDescriptor(baseClass.prototype, propertyName);\n if (!propertyDescriptor) return;\n // eslint-disable-next-line func-names\n propertyDescriptor.value = function (...args: any) {\n return (this as any)[baseClassProp][propertyName](...args);\n };\n Object.defineProperty(targetClass.prototype, propertyName, propertyDescriptor);\n });\n}\n\napplyMixin(Aptos, Account, \"account\");\napplyMixin(Aptos, ANS, \"ans\");\napplyMixin(Aptos, Coin, \"coin\");\napplyMixin(Aptos, DigitalAsset, \"digitalAsset\");\napplyMixin(Aptos, Event, \"event\");\napplyMixin(Aptos, Faucet, \"faucet\");\napplyMixin(Aptos, FungibleAsset, \"fungibleAsset\");\napplyMixin(Aptos, General, \"general\");\napplyMixin(Aptos, Staking, \"staking\");\napplyMixin(Aptos, Transaction, \"transaction\");\napplyMixin(Aptos, TransactionSubmission, \"transactionSubmission\");\n"],"mappings":"ueAuBO,IAAMA,EAAN,KAAY,CAyBjB,YAAYC,EAAwB,CAClC,KAAK,OAAS,IAAIC,EAAYD,CAAQ,EACtC,KAAK,QAAU,IAAIE,EAAQ,KAAK,MAAM,EACtC,KAAK,IAAM,IAAIC,EAAI,KAAK,MAAM,EAC9B,KAAK,KAAO,IAAIC,EAAK,KAAK,MAAM,EAChC,KAAK,aAAe,IAAIC,EAAa,KAAK,MAAM,EAChD,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,cAAgB,IAAIC,EAAc,KAAK,MAAM,EAClD,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,QAAU,IAAIC,EAAQ,KAAK,MAAM,EACtC,KAAK,YAAc,IAAIC,EAAY,KAAK,MAAM,EAC9C,KAAK,sBAAwB,IAAIC,EAAsB,KAAK,MAAM,CACpE,CACF,EAuBA,SAASC,EAAWC,EAAkBC,EAAgBC,EAAuB,CAE3E,OAAO,oBAAoBD,EAAU,SAAS,EAAE,QAASE,GAAiB,CACxE,IAAMC,EAAqB,OAAO,yBAAyBH,EAAU,UAAWE,CAAY,EACvFC,IAELA,EAAmB,MAAQ,YAAaC,EAAW,CACjD,OAAQ,KAAaH,CAAa,EAAEC,CAAY,EAAE,GAAGE,CAAI,CAC3D,EACA,OAAO,eAAeL,EAAY,UAAWG,EAAcC,CAAkB,EAC/E,CAAC,CACH,CAEAL,EAAWd,EAAOG,EAAS,SAAS,EACpCW,EAAWd,EAAOI,EAAK,KAAK,EAC5BU,EAAWd,EAAOK,EAAM,MAAM,EAC9BS,EAAWd,EAAOM,EAAc,cAAc,EAC9CQ,EAAWd,EAAOO,EAAO,OAAO,EAChCO,EAAWd,EAAOQ,EAAQ,QAAQ,EAClCM,EAAWd,EAAOS,EAAe,eAAe,EAChDK,EAAWd,EAAOU,EAAS,SAAS,EACpCI,EAAWd,EAAOW,EAAS,SAAS,EACpCG,EAAWd,EAAOY,EAAa,aAAa,EAC5CE,EAAWd,EAAOa,EAAuB,uBAAuB","names":["Aptos","settings","AptosConfig","Account","ANS","Coin","DigitalAsset","Event","Faucet","FungibleAsset","General","Staking","Transaction","TransactionSubmission","applyMixin","targetClass","baseClass","baseClassProp","propertyName","propertyDescriptor","args"]}
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-EWTHPMEE.mjs";import{b as n}from"./chunk-NZIJV4O2.mjs";import{a as x}from"./chunk-HA6JD5R6.mjs";var t=class extends x{static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return u.load(e);case 1:return c.load(e);case 2:return p.load(e);case 3:return z.load(e);case 4:return S.load(e);case 5:return U.load(e);case 6:return y.load(e);case 7:return v.load(e);case 8:return d.load(e);case 9:return g.load(e);case 10:return T.load(e);case 255:return h.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${r}`)}}isBool(){return this instanceof u}isAddress(){return this instanceof S}isGeneric(){return this instanceof h}isSigner(){return this instanceof U}isVector(){return this instanceof y}isStruct(){return this instanceof v}isU8(){return this instanceof c}isU16(){return this instanceof d}isU32(){return this instanceof g}isU64(){return this instanceof p}isU128(){return this instanceof z}isU256(){return this instanceof T}},u=class i extends t{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new i}},c=class i extends t{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new i}},d=class i extends t{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new i}},g=class i extends t{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new i}},p=class i extends t{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new i}},z=class i extends t{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new i}},T=class i extends t{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new i}},S=class i extends t{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new i}},U=class i extends t{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new i}},A=class i extends t{constructor(r){super();this.value=r}toString(){return`&${this.value.toString()}`}serialize(r){r.serializeU32AsUleb128(254)}static load(r){let s=t.deserialize(r);return new i(s)}},h=class i extends t{constructor(r){super();this.value=r}toString(){return`T${this.value}`}serialize(r){r.serializeU32AsUleb128(255),r.serializeU32(this.value)}static load(r){let s=r.deserializeU32();return new i(s)}},y=class i extends t{constructor(r){super();this.value=r}toString(){return`vector<${this.value.toString()}>`}serialize(r){r.serializeU32AsUleb128(6),this.value.serialize(r)}static load(r){let s=t.deserialize(r);return new i(s)}},v=class i extends t{constructor(r){super();this.value=r}toString(){let r="";return this.value.typeArgs.length>0&&(r=`<${this.value.typeArgs.map(s=>s.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${r}`}serialize(r){r.serializeU32AsUleb128(7),this.value.serialize(r)}static load(r){let s=o.deserialize(r);return new i(s)}isTypeTag(r,s,l){return this.value.moduleName.identifier===s&&this.value.name.identifier===l&&this.value.address.equals(r)}isString(){return this.isTypeTag(n.ONE,"string","String")}isOption(){return this.isTypeTag(n.ONE,"option","Option")}isObject(){return this.isTypeTag(n.ONE,"object","Object")}},o=class i extends x{constructor(r,s,l,b){super();this.address=r,this.moduleName=s,this.name=l,this.typeArgs=b}serialize(r){r.serialize(this.address),r.serialize(this.moduleName),r.serialize(this.name),r.serializeVector(this.typeArgs)}static deserialize(r){let s=n.deserialize(r),l=a.deserialize(r),b=a.deserialize(r),f=r.deserializeVector(t);return new i(s,l,b,f)}};function E(){return new o(n.ONE,new a("aptos_coin"),new a("AptosCoin"),[])}function j(){return new o(n.ONE,new a("string"),new a("String"),[])}function V(i){return new o(n.ONE,new a("option"),new a("Option"),[i])}function I(i){return new o(n.ONE,new a("object"),new a("Object"),[i])}export{t as a,u as b,c,d,g as e,p as f,z as g,T as h,S as i,U as j,A as k,h as l,y as m,v as n,o,E as p,j as q,V as r,I as s};
2
+ //# sourceMappingURL=chunk-VWVEDCBM.mjs.map