@aptos-labs/ts-sdk 1.12.1 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (373) hide show
  1. package/dist/common/chunk-KSEUZTKY.js +2 -0
  2. package/dist/common/chunk-KSEUZTKY.js.map +1 -0
  3. package/dist/common/cli/index.d.ts +37 -0
  4. package/dist/common/cli/index.js +2 -0
  5. package/dist/common/cli/index.js.map +1 -0
  6. package/dist/common/index.d.ts +384 -111
  7. package/dist/common/index.js +24 -24
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/{Ed25519Account-DHqzsb8B.d.mts → Ed25519Account--qjfup2u.d.mts} +1 -1
  10. package/dist/esm/api/account.d.mts +51 -10
  11. package/dist/esm/api/account.mjs +1 -1
  12. package/dist/esm/api/ans.d.mts +10 -18
  13. package/dist/esm/api/ans.mjs +1 -1
  14. package/dist/esm/api/aptos.d.mts +6 -2
  15. package/dist/esm/api/aptos.mjs +1 -1
  16. package/dist/esm/api/aptosConfig.d.mts +4 -0
  17. package/dist/esm/api/aptosConfig.mjs +1 -1
  18. package/dist/esm/api/coin.d.mts +8 -1
  19. package/dist/esm/api/coin.mjs +1 -1
  20. package/dist/esm/api/digitalAsset.d.mts +144 -5
  21. package/dist/esm/api/digitalAsset.mjs +1 -1
  22. package/dist/esm/api/event.d.mts +14 -9
  23. package/dist/esm/api/event.mjs +1 -1
  24. package/dist/esm/api/faucet.d.mts +3 -0
  25. package/dist/esm/api/faucet.mjs +1 -1
  26. package/dist/esm/api/fungibleAsset.d.mts +30 -7
  27. package/dist/esm/api/fungibleAsset.mjs +1 -1
  28. package/dist/esm/api/general.d.mts +51 -28
  29. package/dist/esm/api/general.mjs +1 -1
  30. package/dist/esm/api/index.d.mts +2 -2
  31. package/dist/esm/api/index.mjs +1 -1
  32. package/dist/esm/api/staking.d.mts +11 -2
  33. package/dist/esm/api/staking.mjs +1 -1
  34. package/dist/esm/api/transaction.d.mts +60 -17
  35. package/dist/esm/api/transaction.mjs +1 -1
  36. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  37. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  39. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  40. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  41. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  42. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  43. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  44. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  45. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  46. package/dist/esm/api/utils.mjs +1 -1
  47. package/dist/esm/bcs/index.mjs +1 -1
  48. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  49. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  50. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  51. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  52. package/dist/esm/bcs/serializer.mjs +1 -1
  53. package/dist/esm/{chunk-T4C6BVXK.mjs → chunk-2M6OT6DU.mjs} +2 -2
  54. package/dist/esm/chunk-2M6OT6DU.mjs.map +1 -0
  55. package/dist/esm/chunk-3CLYWZYZ.mjs +2 -0
  56. package/dist/esm/{chunk-A7XZTJ3D.mjs → chunk-3F6EYD5O.mjs} +2 -2
  57. package/dist/esm/{chunk-36QXVFR5.mjs → chunk-52C73T26.mjs} +2 -2
  58. package/dist/esm/{chunk-GJDGR3KQ.mjs → chunk-54BANKLA.mjs} +2 -2
  59. package/dist/esm/{chunk-CQS6ZCJ7.mjs → chunk-5AQEETAC.mjs} +1 -1
  60. package/dist/esm/chunk-5AQEETAC.mjs.map +1 -0
  61. package/dist/esm/{chunk-3RQ5V3F3.mjs → chunk-63AIRYJX.mjs} +2 -2
  62. package/dist/esm/{chunk-HJYT6LDB.mjs → chunk-647IOEXV.mjs} +2 -2
  63. package/dist/esm/{chunk-M4SQNMCW.mjs → chunk-6CBPMYW5.mjs} +2 -2
  64. package/dist/esm/chunk-6CBPMYW5.mjs.map +1 -0
  65. package/dist/esm/{chunk-GHYE26Q5.mjs → chunk-6FBKUTGF.mjs} +2 -2
  66. package/dist/esm/chunk-7CAEMK4R.mjs +2 -0
  67. package/dist/esm/chunk-7CAEMK4R.mjs.map +1 -0
  68. package/dist/esm/{chunk-AIPKOP3K.mjs → chunk-7PYFGGHM.mjs} +2 -2
  69. package/dist/esm/chunk-7PYFGGHM.mjs.map +1 -0
  70. package/dist/esm/{chunk-5ID6W7XL.mjs → chunk-A7MSW6OL.mjs} +2 -2
  71. package/dist/esm/{chunk-BCUSI3N6.mjs → chunk-AOCNYMMX.mjs} +2 -2
  72. package/dist/esm/{chunk-RIUFW2OG.mjs → chunk-AP7UZTPZ.mjs} +2 -2
  73. package/dist/esm/{chunk-FXHXOVL4.mjs → chunk-BMKDEIRL.mjs} +2 -2
  74. package/dist/esm/chunk-BMKDEIRL.mjs.map +1 -0
  75. package/dist/esm/{chunk-EV75CYGN.mjs → chunk-BSEQPVD6.mjs} +2 -2
  76. package/dist/esm/chunk-BWFJHFBQ.mjs +2 -0
  77. package/dist/esm/{chunk-U3YYSIIT.mjs → chunk-DMKUAQB7.mjs} +2 -2
  78. package/dist/esm/chunk-DSTKXJMA.mjs +2 -0
  79. package/dist/esm/chunk-FBPNHF54.mjs +2 -0
  80. package/dist/esm/{chunk-G56GPLTB.mjs → chunk-FS3NSGBF.mjs} +2 -2
  81. package/dist/esm/{chunk-UEKKYJGA.mjs → chunk-G2QII3AT.mjs} +2 -2
  82. package/dist/esm/{chunk-527DYQ3X.mjs → chunk-GMVVQD72.mjs} +2 -2
  83. package/dist/esm/chunk-GMVVQD72.mjs.map +1 -0
  84. package/dist/esm/{chunk-DUP7XY5P.mjs → chunk-GXVUN32G.mjs} +2 -2
  85. package/dist/esm/{chunk-VNIABDOT.mjs → chunk-H4UVHJ3M.mjs} +2 -2
  86. package/dist/esm/{chunk-KXFMI7RM.mjs → chunk-HB6T27S2.mjs} +2 -2
  87. package/dist/esm/{chunk-5NWTYUKC.mjs → chunk-HXN2WRUX.mjs} +2 -2
  88. package/dist/esm/{chunk-SUTBXHYU.mjs → chunk-I7YI22IW.mjs} +2 -2
  89. package/dist/esm/chunk-I7YI22IW.mjs.map +1 -0
  90. package/dist/esm/{chunk-FVMJDRHO.mjs → chunk-IA6XM7QE.mjs} +2 -2
  91. package/dist/esm/chunk-IA6XM7QE.mjs.map +1 -0
  92. package/dist/esm/{chunk-QRS4DGP3.mjs → chunk-IOSQVDZI.mjs} +2 -2
  93. package/dist/esm/{chunk-QRS4DGP3.mjs.map → chunk-IOSQVDZI.mjs.map} +1 -1
  94. package/dist/esm/{chunk-NF5OUPPU.mjs → chunk-IS3OLRMB.mjs} +2 -2
  95. package/dist/esm/chunk-IS3OLRMB.mjs.map +1 -0
  96. package/dist/esm/{chunk-DGLW7OBS.mjs → chunk-KL6VJ3UK.mjs} +2 -2
  97. package/dist/esm/{chunk-QRVYLV76.mjs → chunk-KOAUBVO6.mjs} +2 -2
  98. package/dist/esm/{chunk-25UTAIJG.mjs → chunk-KUOIRTNL.mjs} +2 -2
  99. package/dist/esm/chunk-KVIVMWN5.mjs +2 -0
  100. package/dist/esm/chunk-L4Q2XTHT.mjs +2 -0
  101. package/dist/esm/chunk-MIEV7J74.mjs +2 -0
  102. package/dist/esm/chunk-MIEV7J74.mjs.map +1 -0
  103. package/dist/esm/{chunk-5EN52MUT.mjs → chunk-NPFNYP75.mjs} +2 -2
  104. package/dist/esm/chunk-OKCU4GHN.mjs +2 -0
  105. package/dist/esm/chunk-OKCU4GHN.mjs.map +1 -0
  106. package/dist/esm/{chunk-6O5ZR5ME.mjs → chunk-ONDQ4MK7.mjs} +2 -2
  107. package/dist/esm/{chunk-NJRNZEHX.mjs → chunk-OWW6SIDP.mjs} +1 -1
  108. package/dist/esm/chunk-OWW6SIDP.mjs.map +1 -0
  109. package/dist/esm/chunk-QIAHBEEW.mjs +2 -0
  110. package/dist/esm/{chunk-SRDIYE3M.mjs.map → chunk-QIAHBEEW.mjs.map} +1 -1
  111. package/dist/esm/{chunk-EJBUUMWV.mjs → chunk-QK4P26SH.mjs} +2 -2
  112. package/dist/esm/{chunk-FPD4JBPV.mjs → chunk-QTSECE7R.mjs} +2 -2
  113. package/dist/esm/chunk-QTSECE7R.mjs.map +1 -0
  114. package/dist/esm/{chunk-FC5MU6ZN.mjs → chunk-QVKMFPAV.mjs} +2 -2
  115. package/dist/esm/{chunk-O3YFCZJ5.mjs → chunk-QW3VNZJ7.mjs} +2 -2
  116. package/dist/esm/chunk-R5QUBEH6.mjs +2 -0
  117. package/dist/esm/{chunk-JOLLCFQL.mjs → chunk-RAYJRFIG.mjs} +2 -2
  118. package/dist/esm/{chunk-JOLLCFQL.mjs.map → chunk-RAYJRFIG.mjs.map} +1 -1
  119. package/dist/esm/{chunk-35EWRSDK.mjs → chunk-RHBCVCOS.mjs} +2 -2
  120. package/dist/esm/{chunk-VLNBGWGX.mjs → chunk-SDUIZ3FY.mjs} +2 -2
  121. package/dist/esm/chunk-SDUIZ3FY.mjs.map +1 -0
  122. package/dist/esm/{chunk-XDXI3TRT.mjs → chunk-TBFLWWV4.mjs} +2 -2
  123. package/dist/esm/chunk-TBMAJ6AW.mjs +2 -0
  124. package/dist/esm/chunk-TGLSJGFO.mjs +2 -0
  125. package/dist/esm/chunk-TJDC5PWD.mjs +2 -0
  126. package/dist/esm/chunk-TLKV4NHK.mjs +2 -0
  127. package/dist/esm/chunk-TLKV4NHK.mjs.map +1 -0
  128. package/dist/esm/{chunk-YG6YYQRG.mjs → chunk-TR2YS7DT.mjs} +2 -2
  129. package/dist/esm/chunk-TR2YS7DT.mjs.map +1 -0
  130. package/dist/esm/{chunk-MJPUASSD.mjs → chunk-U43IJHQN.mjs} +2 -2
  131. package/dist/esm/{chunk-KAGLWBIJ.mjs → chunk-UML2VQZT.mjs} +2 -2
  132. package/dist/esm/{chunk-KQB7A4OX.mjs → chunk-V4YBGBCN.mjs} +2 -2
  133. package/dist/esm/{chunk-B4DWWHNL.mjs → chunk-V6SPPOWX.mjs} +2 -2
  134. package/dist/esm/{chunk-CP4QCRBZ.mjs → chunk-VBTJVPAM.mjs} +2 -2
  135. package/dist/esm/{chunk-3PMUIXFS.mjs → chunk-VM3EJYJU.mjs} +2 -2
  136. package/dist/esm/chunk-VM3EJYJU.mjs.map +1 -0
  137. package/dist/esm/chunk-VX6LTXGB.mjs +2 -0
  138. package/dist/esm/chunk-VX6LTXGB.mjs.map +1 -0
  139. package/dist/esm/chunk-WEZXFWPR.mjs +2 -0
  140. package/dist/esm/{chunk-CXR7MOBW.mjs.map → chunk-WEZXFWPR.mjs.map} +1 -1
  141. package/dist/esm/chunk-WFZDFFBM.mjs +2 -0
  142. package/dist/esm/{chunk-5ZQJLHJA.mjs → chunk-XYLYHSEI.mjs} +2 -2
  143. package/dist/esm/chunk-Y2VA7F5D.mjs +2 -0
  144. package/dist/esm/chunk-Y2VA7F5D.mjs.map +1 -0
  145. package/dist/esm/{chunk-FNLRLSGJ.mjs → chunk-Y5M5DD64.mjs} +2 -2
  146. package/dist/esm/{chunk-CAGDOGXS.mjs → chunk-YWQLLV2R.mjs} +2 -2
  147. package/dist/esm/chunk-ZEXZ4CX5.mjs +2 -0
  148. package/dist/esm/{chunk-3MFILHZT.mjs → chunk-ZKNM27TR.mjs} +2 -2
  149. package/dist/esm/{chunk-QJAI7DNA.mjs → chunk-ZPNCA4C7.mjs} +2 -2
  150. package/dist/esm/chunk-ZYYK3UXP.mjs +2 -0
  151. package/dist/esm/cli/index.mjs +1 -1
  152. package/dist/esm/client/core.mjs +1 -1
  153. package/dist/esm/client/get.mjs +1 -1
  154. package/dist/esm/client/index.mjs +1 -1
  155. package/dist/esm/client/post.mjs +1 -1
  156. package/dist/esm/client/types.mjs +1 -1
  157. package/dist/esm/core/account/Account.d.mts +2 -2
  158. package/dist/esm/core/account/Account.mjs +1 -1
  159. package/dist/esm/core/account/Ed25519Account.d.mts +2 -2
  160. package/dist/esm/core/account/Ed25519Account.mjs +1 -1
  161. package/dist/esm/core/account/SingleKeyAccount.d.mts +2 -2
  162. package/dist/esm/core/account/SingleKeyAccount.mjs +1 -1
  163. package/dist/esm/core/account/index.d.mts +2 -2
  164. package/dist/esm/core/account/index.mjs +1 -1
  165. package/dist/esm/core/account/utils/address.mjs +1 -1
  166. package/dist/esm/core/account/utils/index.mjs +1 -1
  167. package/dist/esm/core/accountAddress.mjs +1 -1
  168. package/dist/esm/core/authenticationKey.d.mts +1 -1
  169. package/dist/esm/core/authenticationKey.mjs +1 -1
  170. package/dist/esm/core/common.mjs +1 -1
  171. package/dist/esm/core/crypto/ed25519.d.mts +9 -2
  172. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  173. package/dist/esm/core/crypto/index.d.mts +1 -1
  174. package/dist/esm/core/crypto/index.mjs +1 -1
  175. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  176. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  177. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  178. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  179. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  180. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  181. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  182. package/dist/esm/core/crypto/secp256k1.d.mts +8 -1
  183. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  184. package/dist/esm/core/crypto/signature.mjs +1 -1
  185. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  186. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  187. package/dist/esm/core/crypto/utils.mjs +1 -1
  188. package/dist/esm/core/hex.mjs +1 -1
  189. package/dist/esm/core/index.d.mts +2 -2
  190. package/dist/esm/core/index.mjs +1 -1
  191. package/dist/esm/index.d.mts +2 -4
  192. package/dist/esm/index.mjs +1 -1
  193. package/dist/esm/internal/account.d.mts +3 -3
  194. package/dist/esm/internal/account.mjs +1 -1
  195. package/dist/esm/internal/ans.d.mts +2 -2
  196. package/dist/esm/internal/ans.mjs +1 -1
  197. package/dist/esm/internal/coin.d.mts +1 -1
  198. package/dist/esm/internal/coin.mjs +1 -1
  199. package/dist/esm/internal/digitalAsset.d.mts +3 -3
  200. package/dist/esm/internal/digitalAsset.mjs +1 -1
  201. package/dist/esm/internal/event.d.mts +1 -1
  202. package/dist/esm/internal/event.mjs +1 -1
  203. package/dist/esm/internal/faucet.mjs +1 -1
  204. package/dist/esm/internal/fungibleAsset.d.mts +6 -6
  205. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  206. package/dist/esm/internal/general.mjs +1 -1
  207. package/dist/esm/internal/staking.d.mts +2 -2
  208. package/dist/esm/internal/staking.mjs +1 -1
  209. package/dist/esm/internal/transaction.d.mts +5 -1
  210. package/dist/esm/internal/transaction.mjs +1 -1
  211. package/dist/esm/internal/transactionSubmission.d.mts +6 -6
  212. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  213. package/dist/esm/internal/view.d.mts +1 -1
  214. package/dist/esm/internal/view.mjs +1 -1
  215. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  216. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  217. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  218. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  219. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  220. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  221. package/dist/esm/transactions/index.d.mts +2 -2
  222. package/dist/esm/transactions/index.mjs +1 -1
  223. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  224. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  225. package/dist/esm/transactions/instances/index.d.mts +1 -1
  226. package/dist/esm/transactions/instances/index.mjs +1 -1
  227. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  228. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  229. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  230. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  231. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  232. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  233. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  234. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  235. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  236. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  237. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  238. package/dist/esm/transactions/management/index.d.mts +2 -2
  239. package/dist/esm/transactions/management/index.mjs +1 -1
  240. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  241. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  242. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  243. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  244. package/dist/esm/transactions/transactionBuilder/index.d.mts +2 -2
  245. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  246. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  247. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  248. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  249. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  250. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  251. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  252. package/dist/esm/transactions/types.d.mts +1 -1
  253. package/dist/esm/types/index.d.mts +1 -0
  254. package/dist/esm/types/index.mjs +1 -1
  255. package/dist/esm/version.d.mts +1 -1
  256. package/dist/esm/version.mjs +1 -1
  257. package/package.json +7 -6
  258. package/src/api/account.ts +48 -7
  259. package/src/api/ans.ts +8 -16
  260. package/src/api/aptos.ts +4 -0
  261. package/src/api/aptosConfig.ts +4 -0
  262. package/src/api/coin.ts +7 -0
  263. package/src/api/digitalAsset.ts +140 -1
  264. package/src/api/event.ts +13 -8
  265. package/src/api/faucet.ts +3 -0
  266. package/src/api/fungibleAsset.ts +27 -4
  267. package/src/api/general.ts +48 -25
  268. package/src/api/staking.ts +9 -0
  269. package/src/api/transaction.ts +57 -14
  270. package/src/client/core.ts +2 -1
  271. package/src/core/crypto/ed25519.ts +44 -10
  272. package/src/core/crypto/secp256k1.ts +9 -3
  273. package/src/index.ts +0 -1
  274. package/src/internal/account.ts +6 -9
  275. package/src/internal/digitalAsset.ts +1 -1
  276. package/src/internal/fungibleAsset.ts +3 -3
  277. package/src/internal/transaction.ts +48 -10
  278. package/src/types/index.ts +1 -0
  279. package/src/version.ts +1 -1
  280. package/dist/esm/chunk-3PMUIXFS.mjs.map +0 -1
  281. package/dist/esm/chunk-4AVC2RCH.mjs +0 -2
  282. package/dist/esm/chunk-4AVC2RCH.mjs.map +0 -1
  283. package/dist/esm/chunk-4NHWV5AI.mjs +0 -2
  284. package/dist/esm/chunk-527DYQ3X.mjs.map +0 -1
  285. package/dist/esm/chunk-AIPKOP3K.mjs.map +0 -1
  286. package/dist/esm/chunk-ARGODLTZ.mjs +0 -2
  287. package/dist/esm/chunk-ARGODLTZ.mjs.map +0 -1
  288. package/dist/esm/chunk-ASXXZH2D.mjs +0 -2
  289. package/dist/esm/chunk-ASXXZH2D.mjs.map +0 -1
  290. package/dist/esm/chunk-B7X6PSE7.mjs +0 -2
  291. package/dist/esm/chunk-BAYKVJBZ.mjs +0 -2
  292. package/dist/esm/chunk-CEHCDA3G.mjs +0 -2
  293. package/dist/esm/chunk-CQS6ZCJ7.mjs.map +0 -1
  294. package/dist/esm/chunk-CXR7MOBW.mjs +0 -2
  295. package/dist/esm/chunk-F7EMGK4M.mjs +0 -2
  296. package/dist/esm/chunk-FPD4JBPV.mjs.map +0 -1
  297. package/dist/esm/chunk-FVMJDRHO.mjs.map +0 -1
  298. package/dist/esm/chunk-FXHXOVL4.mjs.map +0 -1
  299. package/dist/esm/chunk-IZF6DFAL.mjs +0 -2
  300. package/dist/esm/chunk-LG7RJQ57.mjs +0 -2
  301. package/dist/esm/chunk-M4SQNMCW.mjs.map +0 -1
  302. package/dist/esm/chunk-N3U47Y6Y.mjs +0 -2
  303. package/dist/esm/chunk-NF5OUPPU.mjs.map +0 -1
  304. package/dist/esm/chunk-NJRNZEHX.mjs.map +0 -1
  305. package/dist/esm/chunk-PF57EOJY.mjs +0 -2
  306. package/dist/esm/chunk-SRDIYE3M.mjs +0 -2
  307. package/dist/esm/chunk-SUTBXHYU.mjs.map +0 -1
  308. package/dist/esm/chunk-SWZOGZJ6.mjs +0 -2
  309. package/dist/esm/chunk-SWZOGZJ6.mjs.map +0 -1
  310. package/dist/esm/chunk-SZKJ3TC5.mjs +0 -1
  311. package/dist/esm/chunk-SZKJ3TC5.mjs.map +0 -1
  312. package/dist/esm/chunk-T4C6BVXK.mjs.map +0 -1
  313. package/dist/esm/chunk-UGPALAPN.mjs +0 -2
  314. package/dist/esm/chunk-UQCSBLD5.mjs +0 -2
  315. package/dist/esm/chunk-VBDMQERT.mjs +0 -2
  316. package/dist/esm/chunk-VHANL47W.mjs +0 -2
  317. package/dist/esm/chunk-VHANL47W.mjs.map +0 -1
  318. package/dist/esm/chunk-VLNBGWGX.mjs.map +0 -1
  319. package/dist/esm/chunk-XX5J7KKC.mjs +0 -2
  320. package/dist/esm/chunk-YG6YYQRG.mjs.map +0 -1
  321. package/dist/esm/chunk-YIGDWPGM.mjs +0 -2
  322. package/dist/esm/chunk-YIGDWPGM.mjs.map +0 -1
  323. /package/dist/esm/{chunk-VBDMQERT.mjs.map → chunk-3CLYWZYZ.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-A7XZTJ3D.mjs.map → chunk-3F6EYD5O.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-36QXVFR5.mjs.map → chunk-52C73T26.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-GJDGR3KQ.mjs.map → chunk-54BANKLA.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-3RQ5V3F3.mjs.map → chunk-63AIRYJX.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-HJYT6LDB.mjs.map → chunk-647IOEXV.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-GHYE26Q5.mjs.map → chunk-6FBKUTGF.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-5ID6W7XL.mjs.map → chunk-A7MSW6OL.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-BCUSI3N6.mjs.map → chunk-AOCNYMMX.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-RIUFW2OG.mjs.map → chunk-AP7UZTPZ.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-EV75CYGN.mjs.map → chunk-BSEQPVD6.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-PF57EOJY.mjs.map → chunk-BWFJHFBQ.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-U3YYSIIT.mjs.map → chunk-DMKUAQB7.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-B7X6PSE7.mjs.map → chunk-DSTKXJMA.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-LG7RJQ57.mjs.map → chunk-FBPNHF54.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-G56GPLTB.mjs.map → chunk-FS3NSGBF.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-UEKKYJGA.mjs.map → chunk-G2QII3AT.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-DUP7XY5P.mjs.map → chunk-GXVUN32G.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-VNIABDOT.mjs.map → chunk-H4UVHJ3M.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-KXFMI7RM.mjs.map → chunk-HB6T27S2.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-5NWTYUKC.mjs.map → chunk-HXN2WRUX.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-DGLW7OBS.mjs.map → chunk-KL6VJ3UK.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-QRVYLV76.mjs.map → chunk-KOAUBVO6.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-25UTAIJG.mjs.map → chunk-KUOIRTNL.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-IZF6DFAL.mjs.map → chunk-KVIVMWN5.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-UQCSBLD5.mjs.map → chunk-L4Q2XTHT.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-5EN52MUT.mjs.map → chunk-NPFNYP75.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-6O5ZR5ME.mjs.map → chunk-ONDQ4MK7.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-EJBUUMWV.mjs.map → chunk-QK4P26SH.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-FC5MU6ZN.mjs.map → chunk-QVKMFPAV.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-O3YFCZJ5.mjs.map → chunk-QW3VNZJ7.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-UGPALAPN.mjs.map → chunk-R5QUBEH6.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-35EWRSDK.mjs.map → chunk-RHBCVCOS.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-XDXI3TRT.mjs.map → chunk-TBFLWWV4.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-CEHCDA3G.mjs.map → chunk-TBMAJ6AW.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-BAYKVJBZ.mjs.map → chunk-TGLSJGFO.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-F7EMGK4M.mjs.map → chunk-TJDC5PWD.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-MJPUASSD.mjs.map → chunk-U43IJHQN.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-KAGLWBIJ.mjs.map → chunk-UML2VQZT.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-KQB7A4OX.mjs.map → chunk-V4YBGBCN.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-B4DWWHNL.mjs.map → chunk-V6SPPOWX.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-CP4QCRBZ.mjs.map → chunk-VBTJVPAM.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-4NHWV5AI.mjs.map → chunk-WFZDFFBM.mjs.map} +0 -0
  366. /package/dist/esm/{chunk-5ZQJLHJA.mjs.map → chunk-XYLYHSEI.mjs.map} +0 -0
  367. /package/dist/esm/{chunk-FNLRLSGJ.mjs.map → chunk-Y5M5DD64.mjs.map} +0 -0
  368. /package/dist/esm/{chunk-CAGDOGXS.mjs.map → chunk-YWQLLV2R.mjs.map} +0 -0
  369. /package/dist/esm/{chunk-XX5J7KKC.mjs.map → chunk-ZEXZ4CX5.mjs.map} +0 -0
  370. /package/dist/esm/{chunk-3MFILHZT.mjs.map → chunk-ZKNM27TR.mjs.map} +0 -0
  371. /package/dist/esm/{chunk-QJAI7DNA.mjs.map → chunk-ZPNCA4C7.mjs.map} +0 -0
  372. /package/dist/esm/{chunk-N3U47Y6Y.mjs.map → chunk-ZYYK3UXP.mjs.map} +0 -0
  373. /package/dist/esm/{publicKey-B3XRNhHO.d.mts → publicKey-lq5djCIY.d.mts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/transaction.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"./aptosConfig\";\nimport {\n getGasPriceEstimation,\n getTransactionByHash,\n getTransactionByVersion,\n getTransactions,\n isTransactionPending,\n waitForTransaction,\n} from \"../internal/transaction\";\nimport {\n AnyNumber,\n CommittedTransactionResponse,\n GasEstimation,\n HexInput,\n PaginationArgs,\n PendingTransactionResponse,\n TransactionResponse,\n WaitForTransactionOptions,\n} from \"../types\";\nimport {\n getSigningMessage,\n publicPackageTransaction,\n rotateAuthKey,\n signAndSubmitTransaction,\n signTransaction,\n} from \"../internal/transactionSubmission\";\nimport {\n AccountAuthenticator,\n AnyRawTransaction,\n InputGenerateTransactionOptions,\n InputGenerateTransactionPayloadData,\n} from \"../transactions\";\nimport { AccountAddressInput, Account, PrivateKey } from \"../core\";\nimport { Build } from \"./transactionSubmission/build\";\nimport { Simulate } from \"./transactionSubmission/simulate\";\nimport { Submit } from \"./transactionSubmission/submit\";\nimport { TransactionManagement } from \"./transactionSubmission/management\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\nexport class Transaction {\n readonly config: AptosConfig;\n\n readonly build: Build;\n\n readonly simulate: Simulate;\n\n readonly submit: Submit;\n\n readonly batch: TransactionManagement;\n\n constructor(config: AptosConfig) {\n this.config = config;\n this.build = new Build(this.config);\n this.simulate = new Simulate(this.config);\n this.submit = new Submit(this.config);\n this.batch = new TransactionManagement(this.config);\n }\n\n /**\n * Queries on-chain transactions. This function will not return pending\n * transactions. For that, use `getTransactionsByHash`.\n *\n * @example\n * const transactions = await aptos.getTransactions()\n *\n * @param args.options.offset The number transaction to start with\n * @param args.options.limit Number of results to return\n *\n * @returns Array of on-chain transactions\n */\n async getTransactions(args?: { options?: PaginationArgs }): Promise<TransactionResponse[]> {\n return getTransactions({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by version. This function will not return pending transactions.\n *\n * @example\n * const transaction = await aptos.getTransactions({ledgerVersion:1})\n *\n * @param args.ledgerVersion - Transaction version is an unsigned 64-bit number.\n * @returns On-chain transaction. Only on-chain transactions have versions, so this\n * function cannot be used to query pending transactions.\n */\n async getTransactionByVersion(args: { ledgerVersion: AnyNumber }): Promise<TransactionResponse> {\n return getTransactionByVersion({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Queries on-chain transaction by transaction hash. This function will return pending transactions.\n *\n * @example\n * const transaction = await aptos.getTransactionByHash({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash - Transaction hash should be hex-encoded bytes string with 0x prefix.\n * @returns Transaction from mempool (pending) or on-chain (committed) transaction\n */\n async getTransactionByHash(args: { transactionHash: HexInput }): Promise<TransactionResponse> {\n return getTransactionByHash({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Defines if specified transaction is currently in pending state\n *\n * To create a transaction hash:\n *\n * 1. Create a hash message from the bytes: \"Aptos::Transaction\" bytes + the BCS-serialized Transaction bytes.\n * 2. Apply hash algorithm SHA3-256 to the hash message bytes.\n * 3. Hex-encode the hash bytes with 0x prefix.\n *\n * @example\n * const isPendingTransaction = await aptos.isPendingTransaction({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash A hash of transaction\n * @returns `true` if transaction is in pending state and `false` otherwise\n */\n async isPendingTransaction(args: { transactionHash: HexInput }): Promise<boolean> {\n return isTransactionPending({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Waits for a transaction to move past the pending state.\n *\n * There are 4 cases.\n * 1. Transaction is successfully processed and committed to the chain.\n * - The function will resolve with the transaction response from the API.\n * 2. Transaction is rejected for some reason, and is therefore not committed to the blockchain.\n * - The function will throw an AptosApiError with an HTTP status code indicating some problem with the request.\n * 3. Transaction is committed but execution failed, meaning no changes were\n * written to the blockchain state.\n * - If `checkSuccess` is true, the function will throw a FailedTransactionError\n * If `checkSuccess` is false, the function will resolve with the transaction response where the `success` field is false.\n * 4. Transaction does not move past the pending state within `args.options.timeoutSecs` seconds.\n * - The function will throw a WaitForTransactionError\n *\n * @example\n * const transaction = await aptos.waitForTransaction({transactionHash:\"0x123\"})\n *\n * @param args.transactionHash The hash of a transaction previously submitted to the blockchain.\n * @param args.options.timeoutSecs Timeout in seconds. Defaults to 20 seconds.\n * @param args.options.checkSuccess A boolean which controls whether the function will error if the transaction failed.\n * Defaults to true. See case 3 above.\n * @returns The transaction on-chain. See above for more details.\n */\n async waitForTransaction(args: {\n transactionHash: HexInput;\n options?: WaitForTransactionOptions;\n }): Promise<CommittedTransactionResponse> {\n return waitForTransaction({\n aptosConfig: this.config,\n ...args,\n });\n }\n\n /**\n * Gives an estimate of the gas unit price required to get a\n * transaction on chain in a reasonable amount of time.\n * For more information {@link https://api.mainnet.aptoslabs.com/v1/spec#/operations/estimate_gas_price}\n *\n * @returns Object holding the outputs of the estimate gas API\n *\n * @example\n * const gasPrice = await aptos.waitForTransaction()\n */\n async getGasPriceEstimation(): Promise<GasEstimation> {\n return getGasPriceEstimation({\n aptosConfig: this.config,\n });\n }\n\n /**\n * Returns a signing message for a transaction.\n *\n * This allows a user to sign a transaction using their own preferred signing method, and\n * then submit it to the network.\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const message = await aptos.getSigningMessage({transaction})\n *\n * @param args.transaction A raw transaction for signing elsewhere\n */\n // eslint-disable-next-line class-methods-use-this\n getSigningMessage(args: { transaction: AnyRawTransaction }): Uint8Array {\n return getSigningMessage(args);\n }\n\n /**\n * Generates a transaction to publish a move package to chain.\n *\n * To get the `metadataBytes` and `byteCode`, can compile using Aptos CLI with command\n * `aptos move compile --save-metadata ...`,\n * For more info {@link https://aptos.dev/tutorials/your-first-dapp/#step-4-publish-a-move-module}\n *\n * @example\n * const transaction = await aptos.publishPackageTransaction({\n * account: alice,\n * metadataBytes,\n * moduleBytecode: [byteCode],\n * })\n *\n * @param args.account The publisher account\n * @param args.metadataBytes The package metadata bytes\n * @param args.moduleBytecode An array of the bytecode of each module in the package in compiler output order\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async publishPackageTransaction(args: {\n account: AccountAddressInput;\n metadataBytes: HexInput;\n moduleBytecode: Array<HexInput>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return publicPackageTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Rotate an account's auth key. After rotation, only the new private key can be used to sign txns for\n * the account.\n * Note: Only legacy Ed25519 scheme is supported for now.\n * More info: {@link https://aptos.dev/guides/account-management/key-rotation/}\n *\n * @example\n * const response = await aptos.rotateAuthKey({\n * fromAccount: alice,\n * toNewPrivateKey: new ED25519PublicKey(\"0x123\"),\n * })\n *\n * @param args.fromAccount The account to rotate the auth key for\n * @param args.toNewPrivateKey The new private key to rotate to\n *\n * @returns PendingTransactionResponse\n */\n async rotateAuthKey(args: { fromAccount: Account; toNewPrivateKey: PrivateKey }): Promise<TransactionResponse> {\n return rotateAuthKey({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Sign a transaction that can later be submitted to chain\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.transaction.sign({\n * signer: alice,\n * transaction\n * })\n *\n * @param args.signer The signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n sign(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n return signTransaction({\n ...args,\n });\n }\n\n /**\n * Sign a transaction as a fee payer that can later be submitted to chain\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.transaction.signAsFeePayer({\n * signer: alice,\n * transaction\n * })\n *\n * @param args.signer The fee payer signer account\n * @param args.transaction A raw transaction to sign on\n *\n * @returns AccountAuthenticator\n */\n // eslint-disable-next-line class-methods-use-this\n signAsFeePayer(args: { signer: Account; transaction: AnyRawTransaction }): AccountAuthenticator {\n const { signer, transaction } = args;\n\n // if transaction doesnt hold a \"feePayerAddress\" prop it means\n // this is not a fee payer transaction\n if (!transaction.feePayerAddress) {\n throw new Error(`Transaction ${transaction} is not a Fee Payer transaction`);\n }\n\n // Set the feePayerAddress to the signer account address\n transaction.feePayerAddress = signer.accountAddress;\n\n return signTransaction({\n signer,\n transaction,\n });\n }\n\n // TRANSACTION SUBMISSION //\n\n /**\n * @deprecated Prefer to use `aptos.transaction.batch.forSingleAccount()`\n *\n * Batch transactions for a single account.\n *\n * This function uses a transaction worker that receives payloads to be processed\n * and submitted to chain.\n * Note that this process is best for submitting multiple transactions that\n * dont rely on each other, i.e batch funds, batch token mints, etc.\n *\n * If any worker failure, the functions throws an error.\n *\n * @param args.sender The sender account to sign and submit the transaction\n * @param args.data An array of transaction payloads\n * @param args.options optional. Transaction generation configurations (excluding accountSequenceNumber)\n *\n * @return void. Throws if any error\n */\n async batchTransactionsForSingleAccount(args: {\n sender: Account;\n data: InputGenerateTransactionPayloadData[];\n options?: Omit<InputGenerateTransactionOptions, \"accountSequenceNumber\">;\n }): Promise<void> {\n try {\n const { sender, data, options } = args;\n this.batch.forSingleAccount({ sender, data, options });\n } catch (error: any) {\n throw new Error(`failed to submit transactions with error: ${error}`);\n }\n }\n\n /**\n * Sign and submit a single signer transaction to chain\n *\n * @param args.signer The signer account to sign the transaction\n * @param args.transaction An instance of a RawTransaction, plus optional secondary/fee payer addresses\n *\n * @example\n * const transaction = await aptos.transaction.build.simple({...})\n * const transaction = await aptos.signAndSubmitTransaction({\n * signer: alice,\n * transaction\n * })\n *\n * @return PendingTransactionResponse\n */\n async signAndSubmitTransaction(args: {\n signer: Account;\n transaction: AnyRawTransaction;\n }): Promise<PendingTransactionResponse> {\n const { signer, transaction } = args;\n return signAndSubmitTransaction({\n aptosConfig: this.config,\n signer,\n transaction,\n });\n }\n}\n"],"mappings":"qTA0CO,IAAMA,EAAN,KAAkB,CAWvB,YAAYC,EAAqB,CAC/B,KAAK,OAASA,EACd,KAAK,MAAQ,IAAIC,EAAM,KAAK,MAAM,EAClC,KAAK,SAAW,IAAIC,EAAS,KAAK,MAAM,EACxC,KAAK,OAAS,IAAIC,EAAO,KAAK,MAAM,EACpC,KAAK,MAAQ,IAAIC,EAAsB,KAAK,MAAM,CACpD,CAcA,MAAM,gBAAgBC,EAAqE,CACzF,OAAOC,EAAgB,CACrB,YAAa,KAAK,OAClB,GAAGD,CACL,CAAC,CACH,CAYA,MAAM,wBAAwBA,EAAkE,CAC9F,OAAOE,EAAwB,CAC7B,YAAa,KAAK,OAClB,GAAGF,CACL,CAAC,CACH,CAWA,MAAM,qBAAqBA,EAAmE,CAC5F,OAAOG,EA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CAAY,EAAIZ,EAChC,OAAOiB,EAAyB,CAC9B,YAAa,KAAK,OAClB,OAAAN,EACA,YAAAC,CACF,CAAC,CACH,CACF","names":["Transaction","config","Build","Simulate","Submit","TransactionManagement","args","getTransactions","getTransactionByVersion","getTransactionByHash","isTransactionPending","waitForTransaction","getGasPriceEstimation","getSigningMessage","publicPackageTransaction","rotateAuthKey","signTransaction","signer","transaction","sender","data","options","error","signAndSubmitTransaction"]}
@@ -1,2 +1,2 @@
1
- import{b as r}from"./chunk-SWZOGZJ6.mjs";async function i(e){let{aptosConfig:t,overrides:s,params:n,contentType:o,acceptType:p,path:a,originMethod:d,type:R}=e,u=t.getRequestUrl(R);return r({url:u,method:"GET",originMethod:d,path:a,contentType:o,acceptType:p,params:n,overrides:{...t.clientConfig,...s}},t,e.type)}async function c(e){let{aptosConfig:t}=e;return i({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){let t=[],s,n=e.params;do{let o=await i({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:n,overrides:e.overrides});s=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),n.start=s}while(s!=null);return t}export{i as a,c as b,y as c};
2
- //# sourceMappingURL=chunk-DUP7XY5P.mjs.map
1
+ import{b as r}from"./chunk-TLKV4NHK.mjs";async function i(e){let{aptosConfig:t,overrides:s,params:n,contentType:o,acceptType:p,path:a,originMethod:d,type:R}=e,u=t.getRequestUrl(R);return r({url:u,method:"GET",originMethod:d,path:a,contentType:o,acceptType:p,params:n,overrides:{...t.clientConfig,...s}},t,e.type)}async function c(e){let{aptosConfig:t}=e;return i({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){let t=[],s,n=e.params;do{let o=await i({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:n,overrides:e.overrides});s=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),n.start=s}while(s!=null);return t}export{i as a,c as b,y as c};
2
+ //# sourceMappingURL=chunk-GXVUN32G.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as g}from"./chunk-EJBUUMWV.mjs";import{a as m}from"./chunk-DGLW7OBS.mjs";import{b as w}from"./chunk-QRS4DGP3.mjs";import{f as A}from"./chunk-FNLRLSGJ.mjs";import{t as f}from"./chunk-S4SEFF4K.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function E(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[n,t,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!E(n))throw new Error(`${n} is not valid. ${T}`);if(t&&!E(t))throw new Error(`${t} is not valid. ${T}`);return{domainName:t||n,subdomainName:t?n:void 0}}var V="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",G="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",P={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:G,custom:null,devnet:null,randomnet:null};function d(e){let n=P[e.network];if(!n)throw new Error(`The ANS contract is not deployed to ${e.network}`);return n}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function j(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function Y(e){let{aptosConfig:n,expiration:t,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(n),{domainName:N,subdomainName:l}=c(o),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(l&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!l)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let h=t.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let D=h*31536e3;return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[N,D,s,i]},options:a})}if(!l)throw new Error(`${t.policy} requires a subdomain to be provided.`);let _=await I({aptosConfig:n,name:N});if(!_)throw new Error("The domain does not exist");let x=t.policy==="subdomain:independent"?t.expirationDate:_;if(x>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[N,l,Math.round(x/1e3),t.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function I(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t);try{let i=await g({aptosConfig:n,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function K(e){let{aptosConfig:n,address:t}=e,o=d(n),r=await g({aptosConfig:n,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(t).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function W(e){let{aptosConfig:n,sender:t,name:o,options:r}=e,s=d(n);if(!o)return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function F(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function H(e){let{aptosConfig:n,sender:t,name:o,address:r,options:s}=e,i=d(n),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function J(e){let{aptosConfig:n,name:t}=e,{domainName:o,subdomainName:r=""}=c(t),a=(await A({aptosConfig:n,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=y(a)),a}async function X(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountNames",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(y)}async function Z(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountDomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(y)}async function ee(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function ne(e){let{aptosConfig:n,options:t,domain:o}=e;return(await A({aptosConfig:n,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(y)}async function C(e){let{aptosConfig:n}=e,t=d(n),[o]=await g({aptosConfig:n,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function te(e){let{aptosConfig:n,sender:t,name:o,years:r=1,options:s}=e,i=d(n),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function y(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,E as b,c,V as d,G as e,j as f,Y as g,I as h,K as i,W as j,F as k,H as l,J as m,X as n,Z as o,ee as p,ne as q,te as r};
2
- //# sourceMappingURL=chunk-VNIABDOT.mjs.map
1
+ import{a as g}from"./chunk-QK4P26SH.mjs";import{a as m}from"./chunk-KL6VJ3UK.mjs";import{f as A}from"./chunk-Y5M5DD64.mjs";import{t as f}from"./chunk-S4SEFF4K.mjs";import{b as w}from"./chunk-IOSQVDZI.mjs";var T=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function E(e){return!(!e||e.length<3||e.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(e))}function c(e){let[n,t,...o]=e.replace(/\.apt$/,"").split(".");if(o.length>0)throw new Error(`${e} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!E(n))throw new Error(`${n} is not valid. ${T}`);if(t&&!E(t))throw new Error(`${t} is not valid. ${T}`);return{domainName:t||n,subdomainName:t?n:void 0}}var V="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",G="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",P={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:G,custom:null,devnet:null,randomnet:null};function d(e){let n=P[e.network];if(!n)throw new Error(`The ANS contract is not deployed to ${e.network}`);return n}var b=e=>{if(e&&typeof e=="object"&&"vec"in e&&Array.isArray(e.vec))return e.vec[0]};async function j(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_owner_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function Y(e){let{aptosConfig:n,expiration:t,name:o,sender:r,targetAddress:s,toAddress:i,options:a,transferable:u}=e,p=d(n),{domainName:N,subdomainName:l}=c(o),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(l&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!l)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let h=t.years??1;if(h!==1)throw new Error("For now, names can only be registered for 1 year at a time");let D=h*31536e3;return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[N,D,s,i]},options:a})}if(!l)throw new Error(`${t.policy} requires a subdomain to be provided.`);let _=await I({aptosConfig:n,name:N});if(!_)throw new Error("The domain does not exist");let x=t.policy==="subdomain:independent"?t.expirationDate:_;if(x>_)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await m({aptosConfig:n,sender:r.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[N,l,Math.round(x/1e3),t.policy==="subdomain:follow-domain"?1:0,!!u,s,i]},options:a})}async function I(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t);try{let i=await g({aptosConfig:n,payload:{function:`${o}::router::get_expiration`,functionArguments:[r,s]}});return Number(i[0])*1e3}catch{return}}async function K(e){let{aptosConfig:n,address:t}=e,o=d(n),r=await g({aptosConfig:n,payload:{function:`${o}::router::get_primary_name`,functionArguments:[w.from(t).toString()]}}),s=b(r[1]),i=b(r[0]);if(s)return[i,s].filter(Boolean).join(".")}async function W(e){let{aptosConfig:n,sender:t,name:o,options:r}=e,s=d(n);if(!o)return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:r});let{domainName:i,subdomainName:a}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:r})}async function F(e){let{aptosConfig:n,name:t}=e,o=d(n),{domainName:r,subdomainName:s}=c(t),i=await g({aptosConfig:n,payload:{function:`${o}::router::get_target_addr`,functionArguments:[r,s]}}),a=b(i[0]);return a?w.from(a):void 0}async function H(e){let{aptosConfig:n,sender:t,name:o,address:r,options:s}=e,i=d(n),{domainName:a,subdomainName:u}=c(o);return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,u,r]},options:s})}async function J(e){let{aptosConfig:n,name:t}=e,{domainName:o,subdomainName:r=""}=c(t),a=(await A({aptosConfig:n,query:{query:f,variables:{where_condition:{domain:{_eq:o},subdomain:{_eq:r},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=y(a)),a}async function X(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountNames",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r}}}}})).current_aptos_names.map(y)}async function Z(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountDomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_eq:""}}}}})).current_aptos_names.map(y)}async function ee(e){let{aptosConfig:n,options:t,accountAddress:o}=e,r=await C({aptosConfig:n});return(await A({aptosConfig:n,originMethod:"getAccountSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},owner_address:{_eq:o.toString()},expiration_timestamp:{_gte:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(y)}async function ne(e){let{aptosConfig:n,options:t,domain:o}=e;return(await A({aptosConfig:n,originMethod:"getDomainSubdomains",query:{query:f,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...e.options?.where??{},domain:{_eq:o},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(y)}async function C(e){let{aptosConfig:n}=e,t=d(n),[o]=await g({aptosConfig:n,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),r=o/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-r)).toISOString()}async function te(e){let{aptosConfig:n,sender:t,name:o,years:r=1,options:s}=e,i=d(n),a=r*31536e3,{domainName:u,subdomainName:p}=c(o);if(p)throw new Error("Subdomains cannot be renewed");if(r!==1)throw new Error("Currently, only 1 year renewals are supported");return await m({aptosConfig:n,sender:t.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[u,a]},options:s})}function y(e){return{...e,expiration_timestamp:new Date(e.expiration_timestamp).getTime()}}export{T as a,E as b,c,V as d,G as e,j as f,Y as g,I as h,K as i,W as j,F as k,H as l,J as m,X as n,Z as o,ee as p,ne as q,te as r};
2
+ //# sourceMappingURL=chunk-H4UVHJ3M.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-QRS4DGP3.mjs";import{f as n}from"./chunk-FNLRLSGJ.mjs";import{p as g,u as d}from"./chunk-S4SEFF4K.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
2
- //# sourceMappingURL=chunk-KXFMI7RM.mjs.map
1
+ import{f as n}from"./chunk-Y5M5DD64.mjs";import{p as g,u as d}from"./chunk-S4SEFF4K.mjs";import{b as s}from"./chunk-IOSQVDZI.mjs";async function m(e){let{aptosConfig:t,poolAddress:o}=e,r=s.from(o).toStringLong(),i=await n({aptosConfig:t,query:{query:d,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function f(e){let{aptosConfig:t,options:o}=e,r={query:d,variables:{order_by:o?.orderBy}};return(await n({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function A(e){let{aptosConfig:t,delegatorAddress:o,poolAddress:r}=e,a={query:g,variables:{delegatorAddress:s.from(o).toStringLong(),poolAddress:s.from(r).toStringLong()}};return(await n({aptosConfig:t,query:a})).delegated_staking_activities}export{m as a,f as b,A as c};
2
+ //# sourceMappingURL=chunk-HB6T27S2.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as t}from"./chunk-DGLW7OBS.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
2
- //# sourceMappingURL=chunk-5NWTYUKC.mjs.map
1
+ import{a as t}from"./chunk-KL6VJ3UK.mjs";var o=class{constructor(n){this.config=n}async simple(n){return t({aptosConfig:this.config,...n})}async multiAgent(n){return t({aptosConfig:this.config,...n})}};export{o as a};
2
+ //# sourceMappingURL=chunk-HXN2WRUX.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as o}from"./chunk-5ID6W7XL.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-SUTBXHYU.mjs.map
1
+ import{a as o}from"./chunk-A7MSW6OL.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-I7YI22IW.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 { AccountAddressInput } from \"../core\";\nimport { transferCoinTransaction } from \"../internal/coin\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport { AnyNumber, MoveStructId } from \"../types\";\nimport { AptosConfig } from \"./aptosConfig\";\n\n/**\n * A class to handle all `Coin` operations\n */\nexport class Coin {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Generate a transfer coin transaction that can be simulated and/or signed and submitted\n *\n * @example\n * const transferCoinTransaction = await aptos.transferCoinTransaction({\n * sender: \"0x123\",\n * recipient:\"0x456\",\n * amount: 10,\n * })\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 SimpleTransaction\n */\n async transferCoinTransaction(args: {\n sender: AccountAddressInput;\n recipient: AccountAddressInput;\n amount: AnyNumber;\n coinType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferCoinTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"yCAaO,IAAMA,EAAN,KAAW,CAChB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAmB3C,MAAM,wBAAwBC,EAMC,CAC7B,OAAOC,EAAwB,CAAE,YAAa,KAAK,OAAQ,GAAGD,CAAK,CAAC,CACtE,CACF","names":["Coin","config","args","transferCoinTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a as n,b as s,c as r,d as i,e as o,f as a,g as c,h as p,i as d,j as g,k as u,l as A,m as y,n as l,o as m,p as T,q as f,r as I,s as C,t as O,u as P,v as D}from"./chunk-3PMUIXFS.mjs";import{a as e}from"./chunk-O3YFCZJ5.mjs";var V=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),p({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),n({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),s({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),r({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return o({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return d({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return u({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return A({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return y({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return T({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return f({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return I({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return D({aptosConfig:this.config,...t})}};export{V as a};
2
- //# sourceMappingURL=chunk-FVMJDRHO.mjs.map
1
+ import{a as e}from"./chunk-QW3VNZJ7.mjs";import{a as n,b as s,c as r,d as i,e as o,f as a,g as c,h as p,i as d,j as g,k as u,l as A,m as y,n as l,o as m,p as T,q as f,r as I,s as C,t as O,u as P,v as D}from"./chunk-VM3EJYJU.mjs";var V=class{constructor(t){this.config=t}async getCollectionData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),a({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),c({aptosConfig:this.config,...t})}async getCollectionId(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),p({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),n({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),s({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),r({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await e({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),i({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return o({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return d({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return g({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return u({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return A({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return y({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return l({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return m({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return T({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return f({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return I({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return C({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return O({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return P({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return D({aptosConfig:this.config,...t})}};export{V as a};
2
+ //# sourceMappingURL=chunk-IA6XM7QE.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/digitalAsset.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n AnyNumber,\n GetCollectionDataResponse,\n GetCurrentTokenOwnershipResponse,\n GetOwnedTokensResponse,\n GetTokenActivityResponse,\n GetTokenDataResponse,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n} from \"../types\";\nimport { Account, AccountAddress, AccountAddressInput } from \"../core\";\nimport { InputGenerateTransactionOptions } from \"../transactions/types\";\nimport {\n addDigitalAssetPropertyTransaction,\n addDigitalAssetTypedPropertyTransaction,\n burnDigitalAssetTransaction,\n CreateCollectionOptions,\n createCollectionTransaction,\n freezeDigitalAssetTransferTransaction,\n getCollectionData,\n getCollectionDataByCollectionId,\n getCollectionId,\n getCurrentDigitalAssetOwnership,\n getDigitalAssetActivity,\n getDigitalAssetData,\n getOwnedDigitalAssets,\n mintDigitalAssetTransaction,\n mintSoulBoundTransaction,\n PropertyType,\n PropertyValue,\n removeDigitalAssetPropertyTransaction,\n setDigitalAssetDescriptionTransaction,\n setDigitalAssetNameTransaction,\n setDigitalAssetURITransaction,\n transferDigitalAssetTransaction,\n unfreezeDigitalAssetTransferTransaction,\n updateDigitalAssetPropertyTransaction,\n updateDigitalAssetTypedPropertyTransaction,\n} from \"../internal/digitalAsset\";\nimport { ProcessorType } from \"../utils/const\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexerOnVersion } from \"./utils\";\nimport { SimpleTransaction } from \"../transactions/instances/simpleTransaction\";\n\n/**\n * A class to query all `DigitalAsset` related queries on Aptos.\n */\nexport class DigitalAsset {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * Queries data of a specific collection by the collection creator address and the collection name.\n *\n * If, for some reason, a creator account has 2 collections with the same name in v1 and v2,\n * can pass an optional `tokenStandard` parameter to query a specific standard\n *\n * @example\n * const collection = await aptos.getCollectionData({creatorAddress:\"0x123\",collectionName:\"myCollection\"})\n *\n * @param args.creatorAddress the address of the collection's creator\n * @param args.collectionName the name of the collection\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard the token standard to query\n * @returns GetCollectionDataResponse response type\n */\n async getCollectionData(args: {\n creatorAddress: AccountAddressInput;\n collectionName: string;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg;\n }): Promise<GetCollectionDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCollectionData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries data of a specific collection by the collection ID.\n *\n * @example\n * const collection = await aptos.getCollectionDataByCollectionId({collectionId:\"0x123\"})\n *\n * @param args.collectionId the ID of the collection, it's the same thing as the address of the collection object\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns GetCollectionDataResponse response type\n */\n async getCollectionDataByCollectionId(args: {\n collectionId: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetCollectionDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCollectionDataByCollectionId({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Queries a collection's ID.\n *\n * This is the same as the collection's object address in V2, but V1 does\n * not use objects, and does not have an address\n *\n * @example\n * const collection = await aptos.getCollectionId({creatorAddress:\"0x123\",collectionName:\"myCollection\"})\n *\n * @param args.creatorAddress the address of the collection's creator\n * @param args.collectionName the name of the collection\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @param args.options.tokenStandard the token standard to query\n * @returns the collection id\n */\n async getCollectionId(args: {\n creatorAddress: AccountAddressInput;\n collectionName: string;\n minimumLedgerVersion?: AnyNumber;\n options?: TokenStandardArg;\n }): Promise<string> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCollectionId({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets digital asset data given the address of a digital asset.\n *\n * @example\n * const digitalAsset = await aptos.getDigitalAssetData({digitalAssetAddress:\"0x123\"})\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n * @returns GetTokenDataResponse containing relevant data to the digital asset.\n */\n async getDigitalAssetData(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetTokenDataResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getDigitalAssetData({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets digital asset ownership data given the address of a digital asset.\n *\n * @example\n * const digitalAssetOwner = await aptos.getCurrentDigitalAssetOwnership({digitalAssetAddress:\"0x123\"})\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetCurrentTokenOwnershipResponse containing relevant ownership data of the digital asset.\n */\n async getCurrentDigitalAssetOwnership(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n }): Promise<GetCurrentTokenOwnershipResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getCurrentDigitalAssetOwnership({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets the digital assets that the given address owns.\n *\n * @example\n * const digitalAssets = await aptos.getOwnedDigitalAssets({ownerAddress:\"0x123\"})\n *\n * @param args.ownerAddress The address of the owner\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetOwnedTokensResponse containing ownership data of the digital assets belonging to the ownerAddresss.\n */\n async getOwnedDigitalAssets(args: {\n ownerAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetOwnedTokensResponse[0]>;\n }): Promise<GetOwnedTokensResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getOwnedDigitalAssets({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Gets the activity data given the address of a digital asset.\n *\n * @example\n * const digitalAssetActivity = await aptos.getDigitalAssetActivity({digitalAssetAddress:\"0x123\"})\n *\n * @param args.tokenAddress The address of the digital asset\n * @param args.minimumLedgerVersion Optional ledger version to sync up to, before querying\n *\n * @returns GetTokenActivityResponse containing relevant activity data to the digital asset.\n */\n async getDigitalAssetActivity(args: {\n digitalAssetAddress: AccountAddressInput;\n minimumLedgerVersion?: AnyNumber;\n options?: PaginationArgs & OrderByArg<GetTokenActivityResponse[0]>;\n }): Promise<GetTokenActivityResponse> {\n await waitForIndexerOnVersion({\n config: this.config,\n minimumLedgerVersion: args.minimumLedgerVersion,\n processorType: ProcessorType.TOKEN_V2_PROCESSOR,\n });\n return getDigitalAssetActivity({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Creates a new collection within the specified account\n *\n * @example\n * const transaction = await aptos.createCollectionTransaction({\n * creator: alice,\n * description: \"collectionDescription\",\n * name: \"collectionName\",\n * uri: \"collection-uri.com\",\n * });\n *\n * @param args.creator the account of the collection's creator\n * @param args.description the description of the collection\n * @param args.name the name of the collection\n * @param args.uri the URI to additional info about the collection\n *\n * The parameters below are optional.\n * @param args.maxSupply controls the max supply of the digital assets - defaults MAX_U64_BIG_INT\n * @param args.mutableDescription controls mutability of the collection's description - defaults true\n * @param args.mutableRoyalty controls mutability of the collection's description - defaults true\n * @param args.mutableUri controls mutability of the collection's URI - defaults true\n * @param args.mutableTokenDescription controls mutability of the digital asset's description - defaults true\n * @param args.mutableTokenName controls mutability of the digital asset's name - defaults true\n * @param args.mutableTokenProperties controls mutability of digital asset's properties - defaults true\n * @param args.mutableTokenUri controls mutability of the digital asset's URI - defaults true\n * @param args.tokensBurnableByCreator controls whether digital assets can be burnable by the creator - defaults true\n * @param args.tokensFreezableByCreator controls whether digital assets can be frozen by the creator - defaults true\n * @param args.royaltyNumerator the numerator of the royalty to be paid to the creator when\n * a digital asset is transferred - defaults 0\n * @param args.royaltyDenominator the denominator of the royalty to be paid to the creator\n * when a digital asset is transferred - defaults 1\n *\n * @returns A SimpleTransaction that when submitted will create the collection.\n */\n async createCollectionTransaction(\n args: {\n creator: Account;\n description: string;\n name: string;\n uri: string;\n options?: InputGenerateTransactionOptions;\n } & CreateCollectionOptions,\n ): Promise<SimpleTransaction> {\n return createCollectionTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Create a transaction to mint a digital asset into the creators account within an existing collection.\n *\n * @example\n * const transaction = await aptos.mintDigitalAssetTransaction({\n * creator: alice,\n * description: \"collectionDescription\",\n * collection: \"collectionName\",\n * name: \"digitalAssetName\",\n * uri: \"digital-asset-uri.com\",\n * });\n *\n * @param args.creator the creator of the collection\n * @param args.collection the name of the collection the digital asset belongs to\n * @param args.description the description of the digital asset\n * @param args.name the name of the digital asset\n * @param args.uri the URI to additional info about the digital asset\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async mintDigitalAssetTransaction(args: {\n creator: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return mintDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Transfer a digital asset (non fungible digital asset) ownership.\n *\n * We can transfer a digital asset only when the digital asset is not frozen\n * (i.e. owner transfer is not disabled such as for soul bound digital assets)\n *\n * @example\n * const transaction = await aptos.transferDigitalAssetTransaction({\n * sender: alice,\n * digitalAssetAddress: \"0x123\",\n * recipient: \"0x456\",\n * });\n *\n * @param args.sender The sender account of the current digital asset owner\n * @param args.digitalAssetAddress The digital asset address\n * @param args.recipient The recipient account address\n * @param args.digitalAssetType optional. The digital asset type, default to \"0x4::token::Token\"\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async transferDigitalAssetTransaction(args: {\n sender: Account;\n digitalAssetAddress: AccountAddressInput;\n recipient: AccountAddress;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return transferDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Mint a soul bound digital asset into a recipient's account\n *\n * @example\n * const transaction = await aptos.mintSoulBoundTransaction({\n * account: alice,\n * collection: \"collectionName\",\n * description: \"collectionDescription\",\n * name: \"digitalAssetName\",\n * uri: \"digital-asset-uri.com\",\n * recipient: \"0x123\"\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.collection The collection name that the digital asset belongs to\n * @param args.description The digital asset description\n * @param args.name The digital asset name\n * @param args.uri The digital asset URL\n * @param args.recipient The account address where the digital asset will be created\n * @param args.propertyKeys The property keys for storing on-chain properties\n * @param args.propertyTypes The type of property values\n * @param args.propertyValues The property values to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async mintSoulBoundTransaction(args: {\n account: Account;\n collection: string;\n description: string;\n name: string;\n uri: string;\n recipient: AccountAddressInput;\n propertyKeys?: Array<string>;\n propertyTypes?: Array<PropertyType>;\n propertyValues?: Array<PropertyValue>;\n options?: InputGenerateTransactionOptions;\n }): Promise<SimpleTransaction> {\n return mintSoulBoundTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Burn a digital asset by its creator\n *\n * @example\n * const transaction = await aptos.burnDigitalAssetTransaction({\n * creator: alice,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async burnDigitalAssetTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return burnDigitalAssetTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Freeze digital asset transfer ability\n *\n * @example\n * const transaction = await aptos.freezeDigitalAssetTransaferTransaction({\n * creator: alice,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async freezeDigitalAssetTransaferTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return freezeDigitalAssetTransferTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Unfreeze digital asset transfer ability\n *\n * @example\n * const transaction = await aptos.unfreezeDigitalAssetTransaferTransaction({\n * creator: alice,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async unfreezeDigitalAssetTransaferTransaction(args: {\n creator: Account;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return unfreezeDigitalAssetTransferTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset description\n *\n * @example\n * const transaction = await aptos.setDigitalAssetDescriptionTransaction({\n * creator: alice,\n * description: \"digitalAssetDescription\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.description The digital asset description\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetDescriptionTransaction(args: {\n creator: Account;\n description: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetDescriptionTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset name\n *\n * @example\n * const transaction = await aptos.setDigitalAssetNameTransaction({\n * creator: alice,\n * name: \"digitalAssetName\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.name The digital asset name\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetNameTransaction(args: {\n creator: Account;\n name: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetNameTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Set the digital asset name\n *\n * @example\n * const transaction = await aptos.setDigitalAssetURITransaction({\n * creator: alice,\n * uri: \"digital-asset-uri.com\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.creator The creator account\n * @param args.uri The digital asset uri\n * @param args.digitalAssetAddress The digital asset address\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async setDigitalAssetURITransaction(args: {\n creator: Account;\n uri: string;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return setDigitalAssetURITransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Add a digital asset property\n *\n * @example\n * const transaction = await aptos.addDigitalAssetPropertyTransaction({\n * creator: alice,\n * propertyKey: \"newKey\",\n * propertyType: \"BOOLEAN\",\n * propertyValue: true,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async addDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return addDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Remove a digital asset property\n *\n * @example\n * const transaction = await aptos.removeDigitalAssetPropertyTransaction({\n * creator: alice,\n * propertyKey: \"newKey\",\n * propertyType: \"BOOLEAN\",\n * propertyValue: true,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async removeDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return removeDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Update a digital asset property\n *\n * @example\n * const transaction = await aptos.updateDigitalAssetPropertyTransaction({\n * creator: alice,\n * propertyKey: \"newKey\",\n * propertyType: \"BOOLEAN\",\n * propertyValue: false,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async updateDigitalAssetPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return updateDigitalAssetPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Add a typed digital asset property\n *\n * @example\n * const transaction = await aptos.addDigitalAssetTypedPropertyTransaction({\n * creator: alice,\n * propertyKey: \"typedKey\",\n * propertyType: \"STRING\",\n * propertyValue: \"hello\",\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async addDigitalAssetTypedPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return addDigitalAssetTypedPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n\n /**\n * Update a typed digital asset property\n *\n * @example\n * const transaction = await aptos.updateDigitalAssetTypedPropertyTransaction({\n * creator: alice,\n * propertyKey: \"typedKey\",\n * propertyType: \"U8\",\n * propertyValue: 2,\n * digitalAssetAddress: \"0x123\",\n * });\n *\n * @param args.account The account that mints the digital asset\n * @param args.digitalAssetAddress The digital asset address\n * @param args.propertyKey The property key for storing on-chain properties\n * @param args.propertyType The type of property value\n * @param args.propertyValue The property value to be stored on-chain\n *\n * @returns A SimpleTransaction that can be simulated or submitted to chain\n */\n async updateDigitalAssetTypedPropertyTransaction(args: {\n creator: Account;\n propertyKey: string;\n propertyType: PropertyType;\n propertyValue: PropertyValue;\n digitalAssetAddress: AccountAddressInput;\n digitalAssetType?: MoveStructId;\n options?: InputGenerateTransactionOptions;\n }) {\n return updateDigitalAssetTypedPropertyTransaction({ aptosConfig: this.config, ...args });\n }\n}\n"],"mappings":"qOAoDO,IAAMA,EAAN,KAAmB,CACxB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAiB3C,MAAM,kBAAkBC,EAKe,CACrC,aAAMC,EAAwB,CAC5B,OAAQ,KAAK,OACb,qBAAsBD,EAAK,qBAC3B,kCACF,CAAC,EACME,EAAkB,CAAE,YAAa,KAAK,O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E,YAAa,KAAK,OAAQ,GAAGtB,CAAK,CAAC,CACtF,CAsBA,MAAM,2CAA2CA,EAQ9C,CACD,OAAOuB,EAA2C,CAAE,YAAa,KAAK,OAAQ,GAAGvB,CAAK,CAAC,CACzF,CACF","names":["DigitalAsset","config","args","waitForIndexerOnVersion","getCollectionData","getCollectionDataByCollectionId","getCollectionId","getDigitalAssetData","getCurrentDigitalAssetOwnership","getOwnedDigitalAssets","getDigitalAssetActivity","createCollectionTransaction","mintDigitalAssetTransaction","transferDigitalAssetTransaction","mintSoulBoundTransaction","burnDigitalAssetTransaction","freezeDigitalAssetTransferTransaction","unfreezeDigitalAssetTransferTransaction","setDigitalAssetDescriptionTransaction","setDigitalAssetNameTransaction","setDigitalAssetURITransaction","addDigitalAssetPropertyTransaction","removeDigitalAssetPropertyTransaction","updateDigitalAssetPropertyTransaction","addDigitalAssetTypedPropertyTransaction","updateDigitalAssetTypedPropertyTransaction"]}
@@ -1,2 +1,2 @@
1
- import{a}from"./chunk-36QXVFR5.mjs";import{a as i}from"./chunk-LG7RJQ57.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var h=(s=>(s.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",s.INVALID_HEX_CHARS="invalid_hex_chars",s.TOO_SHORT="too_short",s.TOO_LONG="too_long",s.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",s.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",s.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",s))(h||{}),r=class r extends a{constructor(t){if(super(),t.length!==r.LENGTH)throw new i("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=o(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return o(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let e=this.bcsToBytes();t.serializeBytes(e)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r(e)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");let e=r.fromString(t);if(t.length!==r.LONG_STRING_LENGTH+2)if(e.isSpecial()){if(t.length!==3)throw new i(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new i(`The given hex string ${t} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return e}static fromString(t){let e=t;if(t.startsWith("0x")&&(e=t.slice(2)),e.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(e.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let n;try{n=l(e.padStart(64,"0"))}catch(d){throw new i(`Hex characters are invalid: ${d?.message}`,"invalid_hex_chars")}return new r(n)}static from(t){return t instanceof r?t:t instanceof Uint8Array?new r(t):r.fromString(t)}static fromStrict(t){return t instanceof r?t:t instanceof Uint8Array?new r(t):r.fromStringStrict(t)}static isValid(t){try{return t.strict?r.fromStrict(t.input):r.from(t.input),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};r.LENGTH=32,r.LONG_STRING_LENGTH=64,r.ZERO=r.from("0x0"),r.ONE=r.from("0x1"),r.TWO=r.from("0x2"),r.THREE=r.from("0x3"),r.FOUR=r.from("0x4");var c=r;export{h as a,c as b};
2
- //# sourceMappingURL=chunk-QRS4DGP3.mjs.map
1
+ import{a}from"./chunk-52C73T26.mjs";import{a as i}from"./chunk-FBPNHF54.mjs";import{bytesToHex as o,hexToBytes as l}from"@noble/hashes/utils";var h=(s=>(s.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",s.INVALID_HEX_CHARS="invalid_hex_chars",s.TOO_SHORT="too_short",s.TOO_LONG="too_long",s.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",s.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",s.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",s))(h||{}),r=class r extends a{constructor(t){super();if(t.length!==r.LENGTH)throw new i("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=o(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return o(this.data)}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){let e=this.bcsToBytes();t.serializeBytes(e)}serializeForScriptFunction(t){t.serializeU32AsUleb128(3),t.serialize(this)}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r(e)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");let e=r.fromString(t);if(t.length!==r.LONG_STRING_LENGTH+2)if(e.isSpecial()){if(t.length!==3)throw new i(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new i(`The given hex string ${t} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return e}static fromString(t){let e=t;if(t.startsWith("0x")&&(e=t.slice(2)),e.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(e.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let n;try{n=l(e.padStart(64,"0"))}catch(d){throw new i(`Hex characters are invalid: ${d?.message}`,"invalid_hex_chars")}return new r(n)}static from(t){return t instanceof r?t:t instanceof Uint8Array?new r(t):r.fromString(t)}static fromStrict(t){return t instanceof r?t:t instanceof Uint8Array?new r(t):r.fromStringStrict(t)}static isValid(t){try{return t.strict?r.fromStrict(t.input):r.from(t.input),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};r.LENGTH=32,r.LONG_STRING_LENGTH=64,r.ZERO=r.from("0x0"),r.ONE=r.from("0x1"),r.TWO=r.from("0x2"),r.THREE=r.from("0x3"),r.FOUR=r.from("0x4");var c=r;export{h as a,c as b};
2
+ //# sourceMappingURL=chunk-IOSQVDZI.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * This enum is used to explain why an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * @param args.data A Uint8Array representing an account address.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Returns whether an address is special, where special is defined as 0x0 to 0xf\n * inclusive. In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false if not.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * In short, it means that special addresses are represented in SHORT form, meaning\n * 0x0 through to 0xf inclusive, and every other address is represented in LONG form,\n * meaning 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Return the AccountAddress as a string as per AIP-40 but without the leading 0x.\n *\n * Learn more by reading the docstring of `toString`.\n *\n * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this format the address in the LONG format\n * unconditionally.\n *\n * This means it will be 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this function will include leading zeroes. The string\n * will not have a leading zero.\n *\n * This means it will be 64 hex characters without a leading 0x.\n *\n * @returns AccountAddress as a string in LONG form without a leading 0x.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\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 * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromString(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromString(input);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromStringStrict(input);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is a valid AccountAddress.\n *\n * @param args.input A hex string representing an account address.\n * @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.\n *\n * @returns valid = true if the string is valid, valid = false if not. If the string\n * is not valid, invalidReason will be set explaining why it is invalid.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Return whether AccountAddresses are equal. AccountAddresses are considered equal\n * if their underlying byte data is identical.\n *\n * @param other The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"6EAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAUhC,IAAKC,OACVA,EAAA,0BAA4B,4BAC5BA,EAAA,kBAAoB,oBACpBA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,wBAA0B,0BAC1BA,EAAA,kCAAoC,oCACpCA,EAAA,uBAAyB,yBAPfA,OAAA,IA4BCC,EAAN,MAAMA,UAAuBC,CAA4C,CA+B9E,YAAYC,EAAmB,CAE7B,GADA,MAAM,EACFA,EAAM,SAAWF,EAAe,OAClC,MAAM,IAAIG,EACR,sDACA,2BACF,EAEF,KAAK,KAAOD,CACd,CAYA,WAAqB,CACnB,OACE,KAAK,KAAK,MAAM,EAAG,KAAK,KAAK,OAAS,CAAC,EAAE,MAAOE,GAASA,IAAS,CAAC,GAAK,KAAK,KAAK,KAAK,KAAK,OAAS,CAAC,EAAI,EAE9G,CAgBA,UAA0B,CACxB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAWA,uBAAgC,CAC9B,IAAIC,EAAMC,EAAW,KAAK,IAAI,EAC9B,OAAI,KAAK,UAAU,IACjBD,EAAMA,EAAIA,EAAI,OAAS,CAAC,GAEnBA,CACT,CAaA,cAA8B,CAC5B,MAAO,KAAK,KAAK,0BAA0B,CAAC,EAC9C,CAaA,2BAAoC,CAClC,OAAOC,EAAW,KAAK,IAAI,CAC7B,CAQA,cAA2B,CACzB,OAAO,KAAK,IACd,CAaA,UAAUC,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,IAAI,CAC1C,CAEA,0BAA0BA,EAA8B,CACtD,IAAMC,EAAW,KAAK,WAAW,EACjCD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F,EAAeE,CAAK,EAE1BF,EAAe,iBAAiBE,CAAK,CAC9C,CAeA,OAAO,QAAQc,EAA6F,CAC1G,GAAI,CACF,OAAIA,EAAK,OACPhB,EAAe,WAAWgB,EAAK,KAAK,EAEpChB,EAAe,KAAKgB,EAAK,KAAK,EAEzB,CAAE,MAAO,EAAK,CACvB,OAASD,EAAY,CACnB,MAAO,CACL,MAAO,GACP,cAAeA,GAAO,cACtB,qBAAsBA,GAAO,OAC/B,CACF,CACF,CASA,OAAOE,EAAgC,CACrC,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF,EAjXanB,EASK,OAAiB,GATtBA,EAcK,mBAA6B,GAdlCA,EAgBJ,KAAuBA,EAAe,KAAK,KAAK,EAhB5CA,EAkBJ,IAAsBA,EAAe,KAAK,KAAK,EAlB3CA,EAoBJ,IAAsBA,EAAe,KAAK,KAAK,EApB3CA,EAsBJ,MAAwBA,EAAe,KAAK,KAAK,EAtB7CA,EAwBJ,KAAuBA,EAAe,KAAK,KAAK,EAxBlD,IAAMoB,EAANpB","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
1
+ {"version":3,"sources":["../../src/core/accountAddress.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { bytesToHex, hexToBytes } from \"@noble/hashes/utils\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\nimport { ParsingError, ParsingResult } from \"./common\";\nimport { TransactionArgument } from \"../transactions/instances/transactionArgument\";\nimport { HexInput, ScriptTransactionArgumentVariants } from \"../types\";\n\n/**\n * This enum is used to explain why an address was invalid.\n */\nexport enum AddressInvalidReason {\n INCORRECT_NUMBER_OF_BYTES = \"incorrect_number_of_bytes\",\n INVALID_HEX_CHARS = \"invalid_hex_chars\",\n TOO_SHORT = \"too_short\",\n TOO_LONG = \"too_long\",\n LEADING_ZERO_X_REQUIRED = \"leading_zero_x_required\",\n LONG_FORM_REQUIRED_UNLESS_SPECIAL = \"long_form_required_unless_special\",\n INVALID_PADDING_ZEROES = \"INVALID_PADDING_ZEROES\",\n}\n\nexport type AccountAddressInput = HexInput | AccountAddress;\n\n/**\n * NOTE: Only use this class for account addresses. For other hex data, e.g. transaction\n * hashes, use the Hex class.\n *\n * AccountAddress is used for working with account addresses. Account addresses, when\n * represented as a string, generally look like these examples:\n * - 0x1\n * - 0xaa86fe99004361f747f91342ca13c426ca0cccb0c1217677180c9493bad6ef0c\n *\n * Proper formatting and parsing of account addresses is defined by AIP-40.\n * To learn more about the standard, read the AIP here:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * The comments in this class make frequent reference to the LONG and SHORT formats,\n * as well as \"special\" addresses. To learn what these refer to see AIP-40.\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * @param args.data A Uint8Array representing an account address.\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Returns whether an address is special, where special is defined as 0x0 to 0xf\n * inclusive. In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false if not.\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * In short, it means that special addresses are represented in SHORT form, meaning\n * 0x0 through to 0xf inclusive, and every other address is represented in LONG form,\n * meaning 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Return the AccountAddress as a string as per AIP-40 but without the leading 0x.\n *\n * Learn more by reading the docstring of `toString`.\n *\n * @returns AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this format the address in the LONG format\n * unconditionally.\n *\n * This means it will be 0x + 64 hex characters.\n *\n * @returns AccountAddress as a string in LONG form.\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * NOTE: Prefer to use `toString` where possible.\n *\n * Whereas toString will format special addresses (as defined by isSpecial) using the\n * SHORT form (no leading 0s), this function will include leading zeroes. The string\n * will not have a leading zero.\n *\n * This means it will be 64 hex characters without a leading 0x.\n *\n * @returns AccountAddress as a string in LONG form without a leading 0x.\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\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 * Serialize the AccountAddress to a Serializer instance's data buffer.\n * @param serializer The serializer to serialize the AccountAddress to.\n * @returns void\n * @example\n * const serializer = new Serializer();\n * const address = AccountAddress.fromString(\"0x1\");\n * address.serialize(serializer);\n * const bytes = serializer.toUint8Array();\n * // `bytes` is now the BCS-serialized address.\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromStringStrict(input: string): AccountAddress {\n // Assert the string starts with 0x.\n if (!input.startsWith(\"0x\")) {\n throw new ParsingError(\"Hex string must start with a leading 0x.\", AddressInvalidReason.LEADING_ZERO_X_REQUIRED);\n }\n\n const address = AccountAddress.fromString(input);\n\n // Check if the address is in LONG form. If it is not, this is only allowed for\n // special addresses, in which case we check it is in proper SHORT form.\n if (input.length !== AccountAddress.LONG_STRING_LENGTH + 2) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `The given hex string ${input} is not a special address, it must be represented as 0x + 64 chars.`,\n AddressInvalidReason.LONG_FORM_REQUIRED_UNLESS_SPECIAL,\n );\n } else if (input.length !== 3) {\n // 0x + one hex char is the only valid SHORT form for special addresses.\n throw new ParsingError(\n // eslint-disable-next-line max-len\n `The given hex string ${input} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,\n AddressInvalidReason.INVALID_PADDING_ZEROES,\n );\n }\n }\n\n return address;\n }\n\n /**\n * NOTE: This function has relaxed parsing behavior. For strict behavior, please use\n * the `fromStringStrict` function. Where possible use `fromStringStrict` rather than this\n * function, `fromString` is only provided for backwards compatibility.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows all formats defined by AIP-40. In short this means the\n * following formats are accepted:\n *\n * - LONG, with or without leading 0x\n * - SHORT, with or without leading 0x\n *\n * Where:\n * - LONG is 64 hex characters.\n * - SHORT is 1 to 63 hex characters inclusive.\n * - Padding zeroes are allowed, e.g. 0x0123 is valid.\n *\n * Learn more about the different address formats by reading AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @param input A hex string representing an account address.\n *\n * @returns An instance of AccountAddress.\n */\n static fromString(input: string): AccountAddress {\n let parsedInput = input;\n // Remove leading 0x for parsing.\n if (input.startsWith(\"0x\")) {\n parsedInput = input.slice(2);\n }\n\n // Ensure the address string is at least 1 character long.\n if (parsedInput.length === 0) {\n throw new ParsingError(\n \"Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_SHORT,\n );\n }\n\n // Ensure the address string is not longer than 64 characters.\n if (parsedInput.length > 64) {\n throw new ParsingError(\n \"Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.\",\n AddressInvalidReason.TOO_LONG,\n );\n }\n\n let addressBytes: Uint8Array;\n try {\n // Pad the address with leading zeroes, so it is 64 chars long and then convert\n // the hex string to bytes. Every two characters in a hex string constitutes a\n // single byte. So a 64 length hex string becomes a 32 byte array.\n addressBytes = hexToBytes(parsedInput.padStart(64, \"0\"));\n } catch (error: any) {\n // At this point the only way this can fail is if the hex string contains\n // invalid characters.\n throw new ParsingError(`Hex characters are invalid: ${error?.message}`, AddressInvalidReason.INVALID_HEX_CHARS);\n }\n\n return new AccountAddress(addressBytes);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static from(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromString(input);\n }\n\n /**\n * Convenience method for creating an AccountAddress from all known inputs.\n *\n * This handles, Uint8array, string, and AccountAddress itself\n * @param input\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (input instanceof AccountAddress) {\n return input;\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return AccountAddress.fromStringStrict(input);\n }\n\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the string is a valid AccountAddress.\n *\n * @param args.input A hex string representing an account address.\n * @param args.strict If true, use strict parsing behavior. If false, use relaxed parsing behavior.\n *\n * @returns valid = true if the string is valid, valid = false if not. If the string\n * is not valid, invalidReason will be set explaining why it is invalid.\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Return whether AccountAddresses are equal. AccountAddresses are considered equal\n * if their underlying byte data is identical.\n *\n * @param other The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"6EAGA,OAAS,cAAAA,EAAY,cAAAC,MAAkB,sBAUhC,IAAKC,OACVA,EAAA,0BAA4B,4BAC5BA,EAAA,kBAAoB,oBACpBA,EAAA,UAAY,YACZA,EAAA,SAAW,WACXA,EAAA,wBAA0B,0BAC1BA,EAAA,kCAAoC,oCACpCA,EAAA,uBAAyB,yBAPfA,OAAA,IA4BCC,EAAN,MAAMA,UAAuBC,CAA4C,CA+B9E,YAAYC,EAAmB,CAC7B,MAAM,EACF,GAAAA,EAAM,SAAWF,EAAe,OAClC,MAAM,IAAIG,EACR,sDACA,2BACF,EAEF,KAAK,KAAOD,CACd,CAYA,WAAqB,CACnB,OACE,KAAK,KAAK,MAAM,EAAG,KAAK,KAAK,OAAS,CAAC,EAAE,MAAOE,GAASA,IAAS,CAAC,GAAK,KAAK,KAAK,KAAK,KAAK,OAAS,CAAC,EAAI,EAE9G,CAgBA,UAA0B,CACxB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CAWA,uBAAgC,CAC9B,IAAIC,EAAMC,EAAW,KAAK,IAAI,EAC9B,OAAI,KAAK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ACzD,OAASG,EAAY,CAGnB,MAAM,IAAIZ,EAAa,+BAA+BY,GAAO,OAAO,GAAI,mBAAsC,CAChH,CAEA,OAAO,IAAIf,EAAea,CAAY,CACxC,CAQA,OAAO,KAAKX,EAA4C,CACtD,OAAIA,aAAiBF,EACZE,EAELA,aAAiB,WACZ,IAAIF,EAAeE,CAAK,EAE1BF,EAAe,WAAWE,CAAK,CACxC,CAQA,OAAO,WAAWA,EAA4C,CAC5D,OAAIA,aAAiBF,EACZE,EAELA,aAAiB,WACZ,IAAIF,EAAeE,CAAK,EAE1BF,EAAe,iBAAiBE,CAAK,CAC9C,CAeA,OAAO,QAAQc,EAA6F,CAC1G,GAAI,CACF,OAAIA,EAAK,OACPhB,EAAe,WAAWgB,EAAK,KAAK,EAEpChB,EAAe,KAAKgB,EAAK,KAAK,EAEzB,CAAE,MAAO,EAAK,CACvB,OAASD,EAAY,CACnB,MAAO,CACL,MAAO,GACP,cAAeA,GAAO,cACtB,qBAAsBA,GAAO,OAC/B,CACF,CACF,CASA,OAAOE,EAAgC,CACrC,OAAI,KAAK,KAAK,SAAWA,EAAM,KAAK,OAAe,GAC5C,KAAK,KAAK,MAAM,CAACC,EAAOC,IAAUD,IAAUD,EAAM,KAAKE,CAAK,CAAC,CACtE,CACF,EAjXanB,EASK,OAAiB,GATtBA,EAcK,mBAA6B,GAdlCA,EAgBJ,KAAuBA,EAAe,KAAK,KAAK,EAhB5CA,EAkBJ,IAAsBA,EAAe,KAAK,KAAK,EAlB3CA,EAoBJ,IAAsBA,EAAe,KAAK,KAAK,EApB3CA,EAsBJ,MAAwBA,EAAe,KAAK,KAAK,EAtB7CA,EAwBJ,KAAuBA,EAAe,KAAK,KAAK,EAxBlD,IAAMoB,EAANpB","names":["bytesToHex","hexToBytes","AddressInvalidReason","_AccountAddress","Serializable","input","ParsingError","byte","hex","bytesToHex","serializer","bcsBytes","deserializer","bytes","address","parsedInput","addressBytes","hexToBytes","error","args","other","value","index","AccountAddress"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-3RQ5V3F3.mjs";import{g as t}from"./chunk-4AVC2RCH.mjs";var r=class{constructor(o){this.config=o}async fundAccount(o){let n=await i({aptosConfig:this.config,...o});return o.options?.waitForIndexer!==!1&&await t({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version)}),n}};export{r as a};
2
- //# sourceMappingURL=chunk-NF5OUPPU.mjs.map
1
+ import{a as i}from"./chunk-63AIRYJX.mjs";import{h as t}from"./chunk-7CAEMK4R.mjs";var r=class{constructor(o){this.config=o}async fundAccount(o){let n=await i({aptosConfig:this.config,...o});return o.options?.waitForIndexer!==!1&&await t({aptosConfig:this.config,minimumLedgerVersion:BigInt(n.version)}),n}};export{r as a};
2
+ //# sourceMappingURL=chunk-IS3OLRMB.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/api/faucet.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { fundAccount } from \"../internal/faucet\";\nimport { UserTransactionResponse, WaitForTransactionOptions } from \"../types\";\nimport { AccountAddressInput } from \"../core\";\nimport { AptosConfig } from \"./aptosConfig\";\nimport { waitForIndexer } from \"../internal/transaction\";\n\n/**\n * A class to query all `Faucet` related queries on Aptos.\n */\nexport class Faucet {\n constructor(readonly config: AptosConfig) {}\n\n /**\n * This creates an account if it does not exist and mints the specified amount of\n * coins into that account\n *\n * @example\n * const transaction = await aptos.fundAccount({accountAddress:\"0x123\", amount: 100})\n *\n * @param args.accountAddress Address of the account to fund\n * @param args.amount Amount of tokens to fund the account with\n * @param args.options Configuration options for waitForTransaction\n * @returns Transaction hash of the transaction that funded the account\n */\n async fundAccount(args: {\n accountAddress: AccountAddressInput;\n amount: number;\n options?: WaitForTransactionOptions;\n }): Promise<UserTransactionResponse> {\n const fundTxn = await fundAccount({ aptosConfig: this.config, ...args });\n\n if (args.options?.waitForIndexer !== false) {\n await waitForIndexer({ aptosConfig: this.config, minimumLedgerVersion: BigInt(fundTxn.version) });\n }\n\n return fundTxn;\n }\n}\n"],"mappings":"kFAYO,IAAMA,EAAN,KAAa,CAClB,YAAqBC,EAAqB,CAArB,YAAAA,CAAsB,CAc3C,MAAM,YAAYC,EAImB,CACnC,IAAMC,EAAU,MAAMC,EAAY,CAAE,YAAa,KAAK,OAAQ,GAAGF,CAAK,CAAC,EAEvE,OAAIA,EAAK,SAAS,iBAAmB,IACnC,MAAMG,EAAe,CAAE,YAAa,KAAK,OAAQ,qBAAsB,OAAOF,EAAQ,OAAO,CAAE,CAAC,EAG3FA,CACT,CACF","names":["Faucet","config","args","fundTxn","fundAccount","waitForIndexer"]}
@@ -1,2 +1,2 @@
1
- import{a as g,f as d,g as I,i as C,j as w,o as S}from"./chunk-GJDGR3KQ.mjs";import{a as P}from"./chunk-B4DWWHNL.mjs";import{c as f,m as s}from"./chunk-U3YYSIIT.mjs";import{a as l}from"./chunk-VHANL47W.mjs";import{a as T}from"./chunk-UEKKYJGA.mjs";import{a as r}from"./chunk-G56GPLTB.mjs";import{b as y}from"./chunk-SRDIYE3M.mjs";import{b as p}from"./chunk-QRS4DGP3.mjs";import{b as A}from"./chunk-CAGDOGXS.mjs";async function b(n){let a=await x(n);return D(n,a)}async function x(n){let{aptosConfig:a,data:t}=n,e,o;return"bytecode"in t?o=await g(t):"multisigAddress"in t?(e={aptosConfig:a,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await g(e)):(e={aptosConfig:a,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await g(e)),o}async function D(n,a){let{aptosConfig:t,sender:e,options:o}=n,i;if(G(n)&&(i=p.ZERO.toString()),U(n)){let{secondarySignerAddresses:c}=n;return d({aptosConfig:t,sender:e,payload:a,options:o,secondarySignerAddresses:c,feePayerAddress:i})}return d({aptosConfig:t,sender:e,payload:a,options:o,feePayerAddress:i})}function G(n){return n.withFeePayer===!0}function U(n){return"secondarySignerAddresses"in n}function X(n){let{transaction:a}=n;return S(a)}function _(n){return C({...n})}async function Y(n){let{aptosConfig:a,transaction:t,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}=n,u=I({transaction:t,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}),{data:m}=await A({aptosConfig:a,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:n.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:n.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:n.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return m}async function K(n){let{aptosConfig:a}=n,t=w({...n}),{data:e}=await A({aptosConfig:a,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return e}async function B(n){let{aptosConfig:a,signer:t,transaction:e}=n,o=_({signer:t,transaction:e});return K({aptosConfig:a,transaction:e,senderAuthenticator:o})}var M={typeParameters:[],parameters:[s.u8(),new s(s.u8())]};async function $(n){let{aptosConfig:a,account:t,metadataBytes:e,moduleBytecode:o,options:i}=n,c=o.map(u=>r.U8(u));return b({aptosConfig:a,sender:p.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[r.U8(e),new r(c)],abi:M},options:i})}var N={typeParameters:[],parameters:[new f,s.u8(),new f,s.u8(),s.u8(),s.u8()]};async function nn(n){let{aptosConfig:a,fromAccount:t,toNewPrivateKey:e}=n,o=await l({aptosConfig:a,accountAddress:t.accountAddress}),i=T.fromPrivateKey({privateKey:e,legacy:!0}),u=new P({sequenceNumber:BigInt(o.sequence_number),originator:t.accountAddress,currentAuthKey:p.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),m=t.sign(u),R=i.sign(u),h=await b({aptosConfig:a,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new y(t.signingScheme),r.U8(t.publicKey.toUint8Array()),new y(i.signingScheme),r.U8(i.publicKey.toUint8Array()),r.U8(m.toUint8Array()),r.U8(R.toUint8Array())],abi:N}});return B({aptosConfig:a,signer:t,transaction:h})}export{b as a,x as b,D as c,X as d,_ as e,Y as f,K as g,B as h,$ as i,nn as j};
2
- //# sourceMappingURL=chunk-DGLW7OBS.mjs.map
1
+ import{a as g,f as d,g as I,i as C,j as w,o as S}from"./chunk-54BANKLA.mjs";import{a as P}from"./chunk-V6SPPOWX.mjs";import{c as f,m as s}from"./chunk-DMKUAQB7.mjs";import{a as l}from"./chunk-MIEV7J74.mjs";import{b as A}from"./chunk-YWQLLV2R.mjs";import{a as T}from"./chunk-G2QII3AT.mjs";import{a as r}from"./chunk-FS3NSGBF.mjs";import{b as y}from"./chunk-QIAHBEEW.mjs";import{b as p}from"./chunk-IOSQVDZI.mjs";async function b(n){let a=await x(n);return D(n,a)}async function x(n){let{aptosConfig:a,data:t}=n,e,o;return"bytecode"in t?o=await g(t):"multisigAddress"in t?(e={aptosConfig:a,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await g(e)):(e={aptosConfig:a,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments},o=await g(e)),o}async function D(n,a){let{aptosConfig:t,sender:e,options:o}=n,i;if(G(n)&&(i=p.ZERO.toString()),U(n)){let{secondarySignerAddresses:c}=n;return d({aptosConfig:t,sender:e,payload:a,options:o,secondarySignerAddresses:c,feePayerAddress:i})}return d({aptosConfig:t,sender:e,payload:a,options:o,feePayerAddress:i})}function G(n){return n.withFeePayer===!0}function U(n){return"secondarySignerAddresses"in n}function X(n){let{transaction:a}=n;return S(a)}function _(n){return C({...n})}async function Y(n){let{aptosConfig:a,transaction:t,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}=n,u=I({transaction:t,signerPublicKey:e,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:c}),{data:m}=await A({aptosConfig:a,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:n.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:n.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:n.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return m}async function K(n){let{aptosConfig:a}=n,t=w({...n}),{data:e}=await A({aptosConfig:a,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return e}async function B(n){let{aptosConfig:a,signer:t,transaction:e}=n,o=_({signer:t,transaction:e});return K({aptosConfig:a,transaction:e,senderAuthenticator:o})}var M={typeParameters:[],parameters:[s.u8(),new s(s.u8())]};async function $(n){let{aptosConfig:a,account:t,metadataBytes:e,moduleBytecode:o,options:i}=n,c=o.map(u=>r.U8(u));return b({aptosConfig:a,sender:p.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[r.U8(e),new r(c)],abi:M},options:i})}var N={typeParameters:[],parameters:[new f,s.u8(),new f,s.u8(),s.u8(),s.u8()]};async function nn(n){let{aptosConfig:a,fromAccount:t,toNewPrivateKey:e}=n,o=await l({aptosConfig:a,accountAddress:t.accountAddress}),i=T.fromPrivateKey({privateKey:e,legacy:!0}),u=new P({sequenceNumber:BigInt(o.sequence_number),originator:t.accountAddress,currentAuthKey:p.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),m=t.sign(u),R=i.sign(u),h=await b({aptosConfig:a,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new y(t.signingScheme),r.U8(t.publicKey.toUint8Array()),new y(i.signingScheme),r.U8(i.publicKey.toUint8Array()),r.U8(m.toUint8Array()),r.U8(R.toUint8Array())],abi:N}});return B({aptosConfig:a,signer:t,transaction:h})}export{b as a,x as b,D as c,X as d,_ as e,Y as f,K as g,B as h,$ as i,nn as j};
2
+ //# sourceMappingURL=chunk-KL6VJ3UK.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-CEHCDA3G.mjs";import{a,b as g,c as f}from"./chunk-G56GPLTB.mjs";import{a as o,b as u,c as s,d as c,e as p,f as y,g as m}from"./chunk-SRDIYE3M.mjs";import{b as r}from"./chunk-QRS4DGP3.mjs";function M(n){return typeof n=="boolean"}function D(n){return typeof n=="string"}function N(n){return typeof n=="number"}function P(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function w(n){return n==null}function G(n){return A(n)||x(n)||S(n)||B(n)||U(n)||I(n)||b(n)||T(n)||E(n)||d(n)||n instanceof a||n instanceof f}function A(n){return n instanceof o}function T(n){return n instanceof r}function E(n){return n instanceof g}function d(n){return n instanceof i}function x(n){return n instanceof u}function S(n){return n instanceof s}function B(n){return n instanceof c}function U(n){return n instanceof p}function I(n){return n instanceof y}function b(n){return n instanceof m}function $(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],l=t[2];return{moduleAddress:e,moduleName:F,functionName:l}}export{M as a,D as b,N as c,P as d,w as e,G as f,A as g,T as h,E as i,d as j,x as k,S as l,B as m,U as n,I as o,b as p,$ as q,R as r,W as s,L as t};
2
- //# sourceMappingURL=chunk-QRVYLV76.mjs.map
1
+ import{a,b as g,c as f}from"./chunk-FS3NSGBF.mjs";import{a as i}from"./chunk-TBMAJ6AW.mjs";import{a as o,b as u,c as s,d as c,e as p,f as y,g as m}from"./chunk-QIAHBEEW.mjs";import{b as r}from"./chunk-IOSQVDZI.mjs";function M(n){return typeof n=="boolean"}function D(n){return typeof n=="string"}function N(n){return typeof n=="number"}function P(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function w(n){return n==null}function G(n){return A(n)||x(n)||S(n)||B(n)||U(n)||I(n)||b(n)||T(n)||E(n)||d(n)||n instanceof a||n instanceof f}function A(n){return n instanceof o}function T(n){return n instanceof r}function E(n){return n instanceof g}function d(n){return n instanceof i}function x(n){return n instanceof u}function S(n){return n instanceof s}function B(n){return n instanceof c}function U(n){return n instanceof p}function I(n){return n instanceof y}function b(n){return n instanceof m}function $(n){return"bytecode"in n}function R(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function W(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function L(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],F=t[1],l=t[2];return{moduleAddress:e,moduleName:F,functionName:l}}export{M as a,D as b,N as c,P as d,w as e,G as f,A as g,T as h,E as i,d as j,x as k,S as l,B as m,U as n,I as o,b as p,$ as q,R as r,W as s,L as t};
2
+ //# sourceMappingURL=chunk-KOAUBVO6.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-UQCSBLD5.mjs";import{b as i}from"./chunk-QRS4DGP3.mjs";import{a as d}from"./chunk-36QXVFR5.mjs";var o=class t extends d{constructor(e,s,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=s}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let s=n.deserialize(e),r=e.deserializeVector(i),c=e.deserializeBool(),a;return c&&(a=i.deserialize(e)),new t(s,r,a)}};export{o as a};
2
- //# sourceMappingURL=chunk-25UTAIJG.mjs.map
1
+ import{a as n}from"./chunk-L4Q2XTHT.mjs";import{b as i}from"./chunk-IOSQVDZI.mjs";import{a as d}from"./chunk-52C73T26.mjs";var o=class t extends d{constructor(e,s,r){super();this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=s}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let s=n.deserialize(e),r=e.deserializeVector(i),c=e.deserializeBool(),a;return c&&(a=i.deserialize(e)),new t(s,r,a)}};export{o as a};
2
+ //# sourceMappingURL=chunk-KUOIRTNL.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as n}from"./chunk-ZEXZ4CX5.mjs";import{a as g,b as _}from"./chunk-TBFLWWV4.mjs";import{a as p,c as b}from"./chunk-Y2VA7F5D.mjs";import{b as o}from"./chunk-IOSQVDZI.mjs";import{a as h}from"./chunk-52C73T26.mjs";var c=class extends h{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return d.load(t);case 1:return u.load(t);case 2:return l.load(t);case 3:return A.load(t);case 4:return y.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},d=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=p.deserialize(e),s=b.deserialize(e);return new i(r,s)}},u=class i extends c{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=g.deserialize(e),s=_.deserialize(e);return new i(r,s)}},l=class i extends c{constructor(e,r,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n);return new i(r,s,a)}},A=class i extends c{constructor(e,r,s,a){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=s,this.fee_payer=a}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=n.deserialize(e),s=e.deserializeVector(o),a=e.deserializeVector(n),z=o.deserialize(e),S=n.deserialize(e),E={address:z,authenticator:S};return new i(r,s,a,E)}},y=class i extends c{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=n.deserialize(e);return new i(r)}};export{c as a,d as b,u as c,l as d,A as e,y as f};
2
+ //# sourceMappingURL=chunk-KVIVMWN5.mjs.map
@@ -0,0 +1,2 @@
1
+ import{b as m}from"./chunk-TGLSJGFO.mjs";import{a as h}from"./chunk-BWFJHFBQ.mjs";import{b as t}from"./chunk-IOSQVDZI.mjs";import{a as u}from"./chunk-52C73T26.mjs";var o=class i extends u{constructor(e,s,a,n,d,l,_){super();this.sender=e,this.sequence_number=s,this.payload=a,this.max_gas_amount=n,this.gas_unit_price=d,this.expiration_timestamp_secs=l,this.chain_id=_}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let s=t.deserialize(e),a=e.deserializeU64(),n=m.deserialize(e),d=e.deserializeU64(),l=e.deserializeU64(),_=e.deserializeU64(),b=h.deserialize(e);return new i(s,a,n,d,l,_,b)}},c=class extends u{static deserialize(r){let e=r.deserializeUleb128AsU32();switch(e){case 0:return p.load(r);case 1:return y.load(r);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},p=class i extends c{constructor(e,s){super();this.raw_txn=e,this.secondary_signer_addresses=s}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let s=o.deserialize(e),a=e.deserializeVector(t);return new i(s,a)}},y=class i extends c{constructor(e,s,a){super();this.raw_txn=e,this.secondary_signer_addresses=s,this.fee_payer_address=a}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let s=o.deserialize(e),a=e.deserializeVector(t),n=t.deserialize(e);return new i(s,a,n)}};export{o as a,c as b,p as c,y as d};
2
+ //# sourceMappingURL=chunk-L4Q2XTHT.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as P}from"./chunk-AH44UPM4.mjs";import{d as v,f as d}from"./chunk-Y5M5DD64.mjs";import{d as C,e as w,f as h,g as k,h as T,j as b,k as O,l as q}from"./chunk-S4SEFF4K.mjs";import{b as g,c as A}from"./chunk-GXVUN32G.mjs";import{a as l}from"./chunk-6FBKUTGF.mjs";import{a as f}from"./chunk-G2QII3AT.mjs";import{a as _}from"./chunk-RAYJRFIG.mjs";import{b as m}from"./chunk-OKCU4GHN.mjs";import{b as y}from"./chunk-Y2VA7F5D.mjs";import{a as p}from"./chunk-NPFNYP75.mjs";import{b as c}from"./chunk-IOSQVDZI.mjs";async function S(t){let{aptosConfig:n,accountAddress:e}=t,{data:o}=await g({aptosConfig:n,originMethod:"getInfo",path:`accounts/${c.from(e).toString()}`});return o}async function z(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return A({aptosConfig:n,originMethod:"getModules",path:`accounts/${c.from(e).toString()}/modules`,params:{ledger_version:o?.ledgerVersion,start:o?.offset,limit:o?.limit??1e3}})}async function H(t){return t.options?.ledgerVersion!==void 0?G(t):P(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/${c.from(e).toString()}/module/${o}`,params:{ledger_version:s?.ledgerVersion}});return r}async function J(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return A({aptosConfig:n,originMethod:"getTransactions",path:`accounts/${c.from(e).toString()}/transactions`,params:{start:o?.offset,limit:o?.limit}})}async function U(t){let{aptosConfig:n,accountAddress:e,options:o}=t;return A({aptosConfig:n,originMethod:"getResources",path:`accounts/${c.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/${c.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,a=c.from(e);try{let i=await v({aptosConfig:n,handle:r,data:{key:a.toString(),key_type:"address",value_type:"address"},options:o});return c.from(i)}catch(i){if(i instanceof l&&i.data.error_code==="table_item_not_found")return a;throw i}}async function X(t){let{aptosConfig:n,accountAddress:e}=t,s={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}},a=await d({aptosConfig:n,query:{query:O,variables:{where_condition:s}},originMethod:"getAccountTokensCount"});return a.current_token_ownerships_v2_aggregate.aggregate?a.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Y(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.token_standard={_eq:o?.tokenStandard});let a={query:T,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Z(t){let{aptosConfig:n,accountAddress:e,collectionAddress:o,options:s}=t,r=c.from(e).toStringLong(),a=c.from(o).toStringLong(),i={owner_address:{_eq:r},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};s?.tokenStandard&&(i.token_standard={_eq:s?.tokenStandard});let u={query:b,variables:{where_condition:i,offset:s?.offset,limit:s?.limit,order_by:s?.orderBy}};return(await d({aptosConfig:n,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function oo(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};o?.tokenStandard&&(r.current_collection={token_standard:{_eq:o?.tokenStandard}});let a={query:h,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function to(t){let{aptosConfig:n,accountAddress:e}=t,o=c.from(e).toStringLong(),r=await d({aptosConfig:n,query:{query:q,variables:{address:o}},originMethod:"getAccountTransactionsCount"});return r.account_transactions_aggregate.aggregate?r.account_transactions_aggregate.aggregate.count:0}async function eo(t){let{aptosConfig:n,accountAddress:e,coinType:o}=t,s=c.from(e).toStringLong(),r=await I({aptosConfig:n,accountAddress:s,options:{where:{asset_type:{_eq:o}}}});return r[0]?r[0].amount:0}async function I(t){let{aptosConfig:n,accountAddress:e,options:o}=t,s=c.from(e).toStringLong(),r={...o?.where,owner_address:{_eq:s}},a={query:w,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function no(t){let{aptosConfig:n,accountAddress:e}=t,o=c.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 ro(t){let{aptosConfig:n,accountAddress:e,options:o}=t,r={owner_address:{_eq:c.from(e).toStringLong()}},a={query:k,variables:{where_condition:r,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await d({aptosConfig:n,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}async function so(t){let{aptosConfig:n,privateKey:e}=t,o=new _(e.publicKey());if(e instanceof m){let r=p.fromPublicKey({publicKey:o}).derivedAddress();return f.fromPrivateKey({privateKey:e,address:r})}if(e instanceof y){let s=p.fromPublicKey({publicKey:o});if(await M({authKey:s,aptosConfig:n})){let u=s.derivedAddress();return f.fromPrivateKey({privateKey:e,address:u,legacy:!1})}let a=p.fromPublicKey({publicKey:o.publicKey});if(await M({authKey:a,aptosConfig:n})){let u=a.derivedAddress();return f.fromPrivateKey({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function M(t){let{aptosConfig:n,authKey:e}=t,o=await Q({aptosConfig:n,authenticationKey:e.derivedAddress()});try{return await S({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{S as a,z as b,H as c,J as d,U as e,K as f,Q as g,X as h,Y as i,Z as j,oo as k,to as l,eo as m,I as n,no as o,ro as p,so as q,M as r};
2
+ //# sourceMappingURL=chunk-MIEV7J74.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 { AnyPublicKey, Ed25519PublicKey, PrivateKey } from \"../core/crypto\";\nimport { getTableItem, queryIndexer } from \"./general\";\nimport {\n AccountData,\n GetAccountCoinsDataResponse,\n GetAccountCollectionsWithOwnedTokenResponse,\n GetAccountOwnedObjectsResponse,\n GetAccountOwnedTokensFromCollectionResponse,\n GetAccountOwnedTokensQueryResponse,\n LedgerVersionArg,\n MoveModuleBytecode,\n MoveResource,\n MoveStructId,\n OrderByArg,\n PaginationArgs,\n TokenStandardArg,\n TransactionResponse,\n WhereArg,\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 { CurrentFungibleAssetBalancesBoolExp } from \"../types/generated/types\";\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 & LedgerVersionArg;\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?: LedgerVersionArg;\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?: LedgerVersionArg;\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 & LedgerVersionArg;\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?: LedgerVersionArg;\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?: LedgerVersionArg;\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\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.current_token_ownerships_v2_aggregate.aggregate\n ? data.current_token_ownerships_v2_aggregate.aggregate.count\n : 0;\n}\n\nexport async function getAccountOwnedTokens(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensQueryResponse[0]>;\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?.offset,\n limit: options?.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?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountOwnedTokensFromCollectionResponse[0]>;\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?.offset,\n limit: options?.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?: TokenStandardArg & PaginationArgs & OrderByArg<GetAccountCollectionsWithOwnedTokenResponse[0]>;\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?.offset,\n limit: options?.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 // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data.account_transactions_aggregate.aggregate ? data.account_transactions_aggregate.aggregate.count : 0;\n}\n\nexport async function getAccountCoinAmount(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n coinType: MoveStructId;\n}): Promise<number> {\n const { aptosConfig, accountAddress, coinType } = args;\n const address = AccountAddress.from(accountAddress).toStringLong();\n\n const data = await getAccountCoinsData({\n aptosConfig,\n accountAddress: address,\n options: {\n where: { asset_type: { _eq: coinType } },\n },\n });\n\n // commonjs (aka cjs) doesnt handle Nullish Coalescing for some reason\n // might be because of how ts infer the graphql generated scheme type\n return data[0] ? data[0].amount : 0;\n}\n\nexport async function getAccountCoinsData(args: {\n aptosConfig: AptosConfig;\n accountAddress: AccountAddressInput;\n options?: PaginationArgs & OrderByArg<GetAccountCoinsDataResponse[0]> & WhereArg<CurrentFungibleAssetBalancesBoolExp>;\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 ...options?.where,\n owner_address: { _eq: address },\n };\n\n const graphqlQuery = {\n query: GetAccountCoinsData,\n variables: {\n where_condition: whereCondition,\n offset: options?.offset,\n limit: options?.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?: PaginationArgs & OrderByArg<GetAccountOwnedObjectsResponse[0]>;\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?.offset,\n limit: options?.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.fromPublicKey({ publicKey });\n const address = authKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address });\n }\n\n if (privateKey instanceof Ed25519PrivateKey) {\n // lookup single sender ed25519\n const singleSenderTransactionAuthenticatorAuthKey = AuthenticationKey.fromPublicKey({\n publicKey,\n });\n const isSingleSenderTransactionAuthenticator = await isAccountExist({\n authKey: singleSenderTransactionAuthenticatorAuthKey,\n aptosConfig,\n });\n if (isSingleSenderTransactionAuthenticator) {\n const address = singleSenderTransactionAuthenticatorAuthKey.derivedAddress();\n return Account.fromPrivateKey({ privateKey, address, legacy: false });\n }\n // lookup legacy ed25519\n const legacyAuthKey = AuthenticationKey.fromPublicKey({\n publicKey: publicKey.publicKey as Ed25519PublicKey,\n });\n const isLegacyEd25519 = await isAccountExist({ authKey: legacyAuthKey, aptosConfig });\n if (isLegacyEd25519) {\n const address = legacyAuthKey.derivedAddress();\n return Account.fromPrivateKey({ 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,MAAMC,EAAkC,CACvD,YAAAH,EACA,aAAc,UACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,EAClE,CAAC,EACD,OAAOC,CACT,CAEA,eAAsBG,EAAWN,EAIC,CAChC,GAAM,CAAE,YAAAC,EAAa,eAAAC,EAAgB,QAAAK,CAAQ,EAAIP,EACjD,OAAOQ,EAA6C,CAClD,YAAAP,EACA,aAAc,aACd,KAAM,YAAYI,EAAe,KAAKH,CAAc,EAAE,SAAS,CAAC,WAChE,OAAQ,CACN,eAAgBK,GAAS,cACzB,MAAOA,GAAS,OAChB,MAAOA,GAAS,OAAS,GAC3B,CACF,CAAC,CACH,CAUA,eAAsBE,EAAUT,EAKA,C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,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAX,CAAQ,CAAC,CACvD,CAEA,GAAIW,aAAsBM,EAAmB,CAE3C,IAAMC,EAA8CH,EAAkB,cAAc,CAClF,UAAAH,CACF,CAAC,EAKD,GAJ+C,MAAMO,EAAe,CAClE,QAASD,EACT,YAAA1D,CACF,CAAC,EAC2C,CAC1C,IAAMwC,EAAUkB,EAA4C,eAAe,EAC3E,OAAOF,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAX,EAAS,OAAQ,EAAM,CAAC,CACtE,CAEA,IAAMoB,EAAgBL,EAAkB,cAAc,CACpD,UAAWH,EAAU,SACvB,CAAC,EAED,GADwB,MAAMO,EAAe,CAAE,QAASC,EAAe,YAAA5D,CAAY,CAAC,EAC/D,CACnB,IAAMwC,EAAUoB,EAAc,eAAe,EAC7C,OAAOJ,EAAQ,eAAe,CAAE,WAAAL,EAAY,QAAAX,EAAS,OAAQ,EAAK,CAAC,CACrE,CACF,CAGA,MAAM,IAAI,MAAM,yCAAyCW,CAAU,EAAE,CACvE,CAEA,eAAsBQ,EAAe5D,EAAkF,CACrH,GAAM,CAAE,YAAAC,EAAa,QAAA6D,CAAQ,EAAI9D,EAC3BE,EAAiB,MAAMe,EAA6B,CACxD,YAAAhB,EACA,kBAAmB6D,EAAQ,eAAe,CAC5C,CAAC,EAED,GAAI,CACF,aAAM/D,EAAQ,CACZ,YAAAE,EACA,eAAAC,CACF,CAAC,EACM,EACT,OAAS6D,EAAY,CAEnB,GAAIA,EAAM,SAAW,IACnB,MAAO,GAET,MAAM,IAAI,MAAM,2CAA2C7D,EAAe,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","getAccountCoinAmount","coinType","getAccountCoinsData","GetAccountCoinsData","getAccountCoinsCount","GetAccountCoinsCount","getAccountOwnedObjects","GetAccountOwnedObjects","deriveAccountFromPrivateKey","privateKey","publicKey","AnyPublicKey","Secp256k1PrivateKey","AuthenticationKey","Account","Ed25519PrivateKey","singleSenderTransactionAuthenticatorAuthKey","isAccountExist","legacyAuthKey","authKey","error"]}
@@ -1,2 +1,2 @@
1
- import{b as s}from"./chunk-QRS4DGP3.mjs";import{a as o}from"./chunk-36QXVFR5.mjs";import{b as n}from"./chunk-BCUSI3N6.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
2
- //# sourceMappingURL=chunk-5EN52MUT.mjs.map
1
+ import{b as s}from"./chunk-IOSQVDZI.mjs";import{a as o}from"./chunk-52C73T26.mjs";import{b as n}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new s(this.data.toUint8Array())}};r.LENGTH=32;var c=r;export{c as a};
2
+ //# sourceMappingURL=chunk-NPFNYP75.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as u}from"./chunk-TJDC5PWD.mjs";import{a as d}from"./chunk-WFZDFFBM.mjs";import{a as v}from"./chunk-R5QUBEH6.mjs";import{e as h,j as f}from"./chunk-LR65XHSF.mjs";import{a as g}from"./chunk-52C73T26.mjs";import{b as s}from"./chunk-AOCNYMMX.mjs";import{sha3_256 as A}from"@noble/hashes/sha3";import{secp256k1 as o}from"@noble/curves/secp256k1";import{HDKey as U}from"@scure/bip32";var n=class n extends d{constructor(e){super();let r=s.fromHexInput(e);if(r.toUint8Array().length!==n.LENGTH)throw new Error(`PublicKey length should be ${n.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof y))return!1;let l=u(r),c=s.fromHexInput(l).toUint8Array(),x=A(c),S=i.toUint8Array();return o.verify(S,x,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new n(r)}static isPublicKey(e){return e instanceof n}};n.LENGTH=65;var m=n,t=class t extends g{constructor(e){super();let r=s.fromHexInput(e);if(r.toUint8Array().length!==t.LENGTH)throw new Error(`PrivateKey length should be ${t.LENGTH}`);this.key=r}static generate(){let e=o.utils.randomPrivateKey();return new t(e)}static fromDerivationPath(e,r){if(!h(e))throw new Error(`Invalid derivation path ${e}`);return t.fromDerivationPathInner(e,f(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=U.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new t(i)}sign(e){let r=u(e),i=s.fromHexInput(r),l=A(i.toUint8Array()),c=o.sign(l,this.key.toUint8Array(),{lowS:!0});return new y(c.toCompactRawBytes())}publicKey(){let e=o.getPublicKey(this.key.toUint8Array(),!1);return new m(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new t(r)}static isPrivateKey(e){return e instanceof t}};t.LENGTH=32;var H=t,a=class a extends v{constructor(e){super();let r=s.fromHexInput(e);if(r.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new a(r)}};a.LENGTH=64;var y=a;export{m as a,H as b,y as c};
2
+ //# sourceMappingURL=chunk-OKCU4GHN.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/crypto/secp256k1.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 } from \"@noble/hashes/sha3\";\nimport { secp256k1 } from \"@noble/curves/secp256k1\";\nimport { HDKey } from \"@scure/bip32\";\nimport { Serializable, Deserializer, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport { HexInput } from \"../../types\";\nimport { isValidBIP44Path, mnemonicToSeed } from \"./hdKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { PublicKey, VerifySignatureArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\nimport { convertSigningMessage } from \"./utils\";\n\n/**\n * Represents the Secp256k1 ecdsa public key\n *\n * Secp256k1 authentication key is represented in the SDK as `AnyPublicKey`.\n */\nexport class Secp256k1PublicKey extends PublicKey {\n // Secp256k1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.\n static readonly LENGTH: number = 65;\n\n // Hex value of the public key\n private readonly key: Hex;\n\n /**\n * Create a new PublicKey instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n if (hex.toUint8Array().length !== Secp256k1PublicKey.LENGTH) {\n throw new Error(`PublicKey length should be ${Secp256k1PublicKey.LENGTH}`);\n }\n this.key = hex;\n }\n\n // region PublicKey\n /**\n * Verifies a Secp256k1 signature against the public key\n *\n * Note signatures are validated to be canonical as a malleability check\n */\n verifySignature(args: VerifySignatureArgs): boolean {\n const { message, signature } = args;\n if (!(signature instanceof Secp256k1Signature)) {\n return false;\n }\n const messageToVerify = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToVerify).toUint8Array();\n const messageSha3Bytes = sha3_256(messageBytes);\n const signatureBytes = signature.toUint8Array();\n return secp256k1.verify(signatureBytes, messageSha3Bytes, this.key.toUint8Array(), { lowS: true });\n }\n\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256k1PublicKey(bytes);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof Secp256k1PublicKey` instead\n * @param publicKey\n */\n static isPublicKey(publicKey: PublicKey): publicKey is Secp256k1PublicKey {\n return publicKey instanceof Secp256k1PublicKey;\n }\n}\n\n/**\n * A Secp256k1 ecdsa private key\n */\nexport class Secp256k1PrivateKey extends Serializable implements PrivateKey {\n /**\n * Length of Secp256k1 ecdsa private key\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The private key bytes\n * @private\n */\n private readonly key: Hex;\n\n // region Constructors\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n\n const privateKeyHex = Hex.fromHexInput(hexInput);\n if (privateKeyHex.toUint8Array().length !== Secp256k1PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Secp256k1PrivateKey.LENGTH}`);\n }\n\n this.key = privateKeyHex;\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Secp256k1PrivateKey\n */\n static generate(): Secp256k1PrivateKey {\n const hexInput = secp256k1.utils.randomPrivateKey();\n return new Secp256k1PrivateKey(hexInput);\n }\n\n /**\n * Derives a private key from a mnemonic seed phrase.\n *\n * @param path the BIP44 path\n * @param mnemonics the mnemonic seed phrase\n *\n * @returns The generated key\n */\n static fromDerivationPath(path: string, mnemonics: string): Secp256k1PrivateKey {\n if (!isValidBIP44Path(path)) {\n throw new Error(`Invalid derivation path ${path}`);\n }\n return Secp256k1PrivateKey.fromDerivationPathInner(path, mnemonicToSeed(mnemonics));\n }\n\n /**\n * A private inner function so we can separate from the main fromDerivationPath() method\n * to add tests to verify we create the keys correctly.\n *\n * @param path the BIP44 path\n * @param seed the seed phrase created by the mnemonics\n *\n * @returns The generated key\n */\n private static fromDerivationPathInner(path: string, seed: Uint8Array): Secp256k1PrivateKey {\n const { privateKey } = HDKey.fromMasterSeed(seed).derive(path);\n // library returns privateKey as Uint8Array | null\n if (privateKey === null) {\n throw new Error(\"Invalid key\");\n }\n\n return new Secp256k1PrivateKey(privateKey);\n }\n\n // endregion\n\n // region PrivateKey\n\n /**\n * Sign the given message with the private key.\n *\n * Note: signatures are canonical, and non-malleable\n *\n * @param message a message as a string or Uint8Array\n * @returns Signature\n */\n sign(message: HexInput): Secp256k1Signature {\n const messageToSign = convertSigningMessage(message);\n const messageBytes = Hex.fromHexInput(messageToSign);\n const messageHashBytes = sha3_256(messageBytes.toUint8Array());\n const signature = secp256k1.sign(messageHashBytes, this.key.toUint8Array(), { lowS: true });\n return new Secp256k1Signature(signature.toCompactRawBytes());\n }\n\n /**\n * Derive the Secp256k1PublicKey from this private key.\n *\n * @returns Secp256k1PublicKey\n */\n publicKey(): Secp256k1PublicKey {\n const bytes = secp256k1.getPublicKey(this.key.toUint8Array(), false);\n return new Secp256k1PublicKey(bytes);\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key\n */\n toString(): string {\n return this.key.toString();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256k1PrivateKey(bytes);\n }\n\n // endregion\n\n /**\n * @deprecated use `instanceof Secp256k1PrivateKey` instead\n */\n static isPrivateKey(privateKey: PrivateKey): privateKey is Secp256k1PrivateKey {\n return privateKey instanceof Secp256k1PrivateKey;\n }\n}\n\n/**\n * A signature of a message signed using a Secp256k1 ecdsa private key\n */\nexport class Secp256k1Signature extends Signature {\n /**\n * Secp256k1 ecdsa signatures are 256-bit.\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n */\n private readonly data: Hex;\n\n // region Constructors\n\n /**\n * Create a new Signature instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n */\n constructor(hexInput: HexInput) {\n super();\n const data = Hex.fromHexInput(hexInput);\n if (data.toUint8Array().length !== Secp256k1Signature.LENGTH) {\n throw new Error(\n `Signature length should be ${Secp256k1Signature.LENGTH}, received ${data.toUint8Array().length}`,\n );\n }\n this.data = data;\n }\n\n // endregion\n\n // region Signature\n\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n // endregion\n\n // region Serializable\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n static deserialize(deserializer: Deserializer): Secp256k1Signature {\n const hex = deserializer.deserializeBytes();\n return new Secp256k1Signature(hex);\n }\n\n // endregion\n}\n"],"mappings":"6PAGA,OAAS,YAAAA,MAAgB,qBACzB,OAAS,aAAAC,MAAiB,0BAC1B,OAAS,SAAAC,MAAa,eAef,IAAMC,EAAN,MAAMA,UAA2BC,CAAU,CAYhD,YAAYC,EAAoB,CAC9B,MAAM,EAEN,IAAMC,EAAMC,EAAI,aAAaF,CAAQ,EACrC,GAAIC,EAAI,aAAa,EAAE,SAAWH,EAAmB,OACnD,MAAM,IAAI,MAAM,8BAA8BA,EAAmB,MAAM,EAAE,EAE3E,KAAK,IAAMG,CACb,CAQA,gBAAgBE,EAAoC,CAClD,GAAM,CAAE,QAAAC,EAAS,UAAAC,CAAU,EAAIF,EAC/B,GAAI,EAAEE,aAAqBC,GACzB,MAAO,GAET,IAAMC,EAAkBC,EAAsBJ,CAAO,EAC/CK,EAAeP,EAAI,aAAaK,CAAe,EAAE,aAAa,EAC9DG,EAAmBC,EAASF,CAAY,EACxCG,EAAiBP,EAAU,aAAa,EAC9C,OAAOQ,EAAU,OAAOD,EAAgBF,EAAkB,KAAK,IAAI,aAAa,EAAG,CAAE,KAAM,EAAK,CAAC,CACnG,CAEA,cAA2B,CACzB,OAAO,KAAK,IAAI,aAAa,CAC/B,CAMA,UAAUI,EAA8B,CACtCA,EAAW,eAAe,KAAK,IAAI,aAAa,CAAC,CACnD,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMC,EAAQD,EAAa,iBAAiB,EAC5C,OAAO,IAAIjB,EAAmBkB,CAAK,CACrC,CAQA,OAAO,YAAYC,EAAuD,C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,CACzB,OAAO,KAAK,IAAI,aAAa,CAC/B,CAOA,UAAmB,CACjB,OAAO,KAAK,IAAI,SAAS,CAC3B,CAMA,UAAUF,EAA8B,CACtCA,EAAW,eAAe,KAAK,aAAa,CAAC,CAC/C,CAEA,OAAO,YAAYC,EAAiD,CAClE,IAAMC,EAAQD,EAAa,iBAAiB,EAC5C,OAAO,IAAII,EAAoBH,CAAK,CACtC,CAOA,OAAO,aAAaW,EAA2D,CAC7E,OAAOA,aAAsBR,CAC/B,CACF,EA/IaA,EAIK,OAAiB,GAJ5B,IAAMY,EAANZ,EAoJMa,EAAN,MAAMA,UAA2BC,CAAU,CAmBhD,YAAYjC,EAAoB,CAC9B,MAAM,EACN,IAAMkC,EAAOhC,EAAI,aAAaF,CAAQ,EACtC,GAAIkC,EAAK,aAAa,EAAE,SAAWF,EAAmB,OACpD,MAAM,IAAI,MACR,8BAA8BA,EAAmB,MAAM,cAAcE,EAAK,aAAa,EAAE,MAAM,EACjG,EAEF,KAAK,KAAOA,CACd,CAMA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CAMA,UAAUpB,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAEA,OAAO,YAAYC,EAAgD,CACjE,IAAMd,EAAMc,EAAa,iBAAiB,EAC1C,OAAO,IAAIiB,EAAmB/B,CAAG,CACnC,CAGF,EApDa+B,EAIK,OAAS,GAJpB,IAAM1B,EAAN0B","names":["sha3_256","secp256k1","HDKey","_Secp256k1PublicKey","PublicKey","hexInput","hex","Hex","args","message","signature","Secp256k1Signature","messageToVerify","convertSigningMessage","messageBytes","messageSha3Bytes","sha3_256","signatureBytes","secp256k1","serializer","deserializer","bytes","publicKey","Secp256k1PublicKey","_Secp256k1PrivateKey","Serializable","privateKeyHex","path","mnemonics","isValidBIP44Path","mnemonicToSeed","seed","privateKey","HDKey","messageToSign","messageHashBytes","Secp256k1PrivateKey","_Secp256k1Signature","Signature","data"]}
@@ -1,2 +1,2 @@
1
- import{a as n}from"./chunk-UQCSBLD5.mjs";import{b as a}from"./chunk-QRS4DGP3.mjs";import{a as i}from"./chunk-36QXVFR5.mjs";var o=class t extends i{constructor(e,r){super(),this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=n.deserialize(e),d=e.deserializeBool(),s;return d&&(s=a.deserialize(e)),new t(r,s)}};export{o as a};
2
- //# sourceMappingURL=chunk-6O5ZR5ME.mjs.map
1
+ import{a as n}from"./chunk-L4Q2XTHT.mjs";import{b as a}from"./chunk-IOSQVDZI.mjs";import{a as i}from"./chunk-52C73T26.mjs";var o=class t extends i{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=n.deserialize(e),d=e.deserializeBool(),s;return d&&(s=a.deserialize(e)),new t(r,s)}};export{o as a};
2
+ //# sourceMappingURL=chunk-ONDQ4MK7.mjs.map
@@ -1,2 +1,2 @@
1
1
  var a=(e=>(e.JSON="application/json",e.BCS="application/x-bcs",e.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",e.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",e))(a||{}),g=(t=>(t[t.Bool=0]="Bool",t[t.U8=1]="U8",t[t.U64=2]="U64",t[t.U128=3]="U128",t[t.Address=4]="Address",t[t.Signer=5]="Signer",t[t.Vector=6]="Vector",t[t.Struct=7]="Struct",t[t.U16=8]="U16",t[t.U32=9]="U32",t[t.U256=10]="U256",t[t.Reference=254]="Reference",t[t.Generic=255]="Generic",t))(g||{}),y=(o=>(o[o.U8=0]="U8",o[o.U64=1]="U64",o[o.U128=2]="U128",o[o.Address=3]="Address",o[o.U8Vector=4]="U8Vector",o[o.Bool=5]="Bool",o[o.U16=6]="U16",o[o.U32=7]="U32",o[o.U256=8]="U256",o))(y||{}),d=(i=>(i[i.Script=0]="Script",i[i.EntryFunction=2]="EntryFunction",i[i.Multisig=3]="Multisig",i))(d||{}),u=(r=>(r[r.MultiAgentTransaction=0]="MultiAgentTransaction",r[r.FeePayerTransaction=1]="FeePayerTransaction",r))(u||{}),c=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(c||{}),l=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(l||{}),_=(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r))(_||{}),x=(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r))(x||{}),h=(p=>(p.Pending="pending_transaction",p.User="user_transaction",p.Genesis="genesis_transaction",p.BlockMetadata="block_metadata_transaction",p.StateCheckpoint="state_checkpoint_transaction",p.Validator="validator_transaction",p))(h||{});function C(n){return n.type==="pending_transaction"}function k(n){return n.type==="user_transaction"}function f(n){return n.type==="genesis_transaction"}function T(n){return n.type==="block_metadata_transaction"}function E(n){return n.type==="state_checkpoint_transaction"}function U(n){return n.type==="validator_transaction"}function W(n){return"signature"in n&&n.signature==="ed25519_signature"}function F(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function A(n){return n.type==="multi_agent_signature"}function I(n){return n.type==="fee_payer_signature"}function P(n){return n.type==="multi_ed25519_signature"}var v=(i=>(i.PRIVATE="private",i.PUBLIC="public",i.FRIEND="friend",i))(v||{}),M=(e=>(e.STORE="store",e.DROP="drop",e.KEY="key",e.COPY="copy",e))(M||{}),m=(r=>(r.VALIDATOR="validator",r.FULL_NODE="full_node",r))(m||{}),R=(e=>(e[e.Ed25519=0]="Ed25519",e[e.MultiEd25519=1]="MultiEd25519",e[e.SingleKey=2]="SingleKey",e[e.MultiKey=3]="MultiKey",e))(R||{}),b=(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",r))(b||{}),S=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(S||{});export{a,g as b,y as c,d,u as e,c as f,l as g,_ as h,x as i,h as j,C as k,k as l,f as m,T as n,E as o,U as p,W as q,F as r,A as s,I as t,P as u,v,M as w,m as x,R as y,b as z,S as A};
2
- //# sourceMappingURL=chunk-NJRNZEHX.mjs.map
2
+ //# sourceMappingURL=chunk-OWW6SIDP.mjs.map