@aptos-labs/ts-sdk 5.1.1-side-effect-free.0 → 5.1.1

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 (411) hide show
  1. package/dist/common/chunk-A2XB7TVI.js +4 -0
  2. package/dist/common/chunk-A2XB7TVI.js.map +1 -0
  3. package/dist/common/cli/index.js +1 -1
  4. package/dist/common/cli/index.js.map +1 -1
  5. package/dist/common/index.d.ts +1 -12
  6. package/dist/common/index.js +34 -34
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  9. package/dist/esm/account/AbstractKeylessAccount.mjs.map +1 -1
  10. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  11. package/dist/esm/account/AbstractedAccount.mjs.map +1 -1
  12. package/dist/esm/account/Account.mjs +1 -1
  13. package/dist/esm/account/Account.mjs.map +1 -1
  14. package/dist/esm/account/AccountUtils.mjs +1 -1
  15. package/dist/esm/account/AccountUtils.mjs.map +1 -1
  16. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  17. package/dist/esm/account/DerivableAbstractedAccount.mjs.map +1 -1
  18. package/dist/esm/account/Ed25519Account.mjs +1 -1
  19. package/dist/esm/account/Ed25519Account.mjs.map +1 -1
  20. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  21. package/dist/esm/account/EphemeralKeyPair.mjs.map +1 -1
  22. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  23. package/dist/esm/account/FederatedKeylessAccount.mjs.map +1 -1
  24. package/dist/esm/account/KeylessAccount.mjs +1 -1
  25. package/dist/esm/account/KeylessAccount.mjs.map +1 -1
  26. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  27. package/dist/esm/account/MultiEd25519Account.mjs.map +1 -1
  28. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  29. package/dist/esm/account/MultiKeyAccount.mjs.map +1 -1
  30. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  31. package/dist/esm/account/SingleKeyAccount.mjs.map +1 -1
  32. package/dist/esm/account/index.mjs +1 -1
  33. package/dist/esm/account/index.mjs.map +1 -1
  34. package/dist/esm/account/utils.mjs +1 -1
  35. package/dist/esm/account/utils.mjs.map +1 -1
  36. package/dist/esm/api/account/abstraction.mjs +1 -1
  37. package/dist/esm/api/account/abstraction.mjs.map +1 -1
  38. package/dist/esm/api/account.mjs +1 -1
  39. package/dist/esm/api/account.mjs.map +1 -1
  40. package/dist/esm/api/ans.mjs +1 -1
  41. package/dist/esm/api/ans.mjs.map +1 -1
  42. package/dist/esm/api/aptos.mjs +1 -1
  43. package/dist/esm/api/aptos.mjs.map +1 -1
  44. package/dist/esm/api/aptosConfig.mjs +1 -1
  45. package/dist/esm/api/aptosConfig.mjs.map +1 -1
  46. package/dist/esm/api/coin.mjs +1 -1
  47. package/dist/esm/api/coin.mjs.map +1 -1
  48. package/dist/esm/api/digitalAsset.mjs +1 -1
  49. package/dist/esm/api/digitalAsset.mjs.map +1 -1
  50. package/dist/esm/api/faucet.mjs +1 -1
  51. package/dist/esm/api/faucet.mjs.map +1 -1
  52. package/dist/esm/api/fungibleAsset.mjs +1 -1
  53. package/dist/esm/api/fungibleAsset.mjs.map +1 -1
  54. package/dist/esm/api/general.mjs +1 -1
  55. package/dist/esm/api/general.mjs.map +1 -1
  56. package/dist/esm/api/index.mjs +1 -1
  57. package/dist/esm/api/index.mjs.map +1 -1
  58. package/dist/esm/api/keyless.mjs +1 -1
  59. package/dist/esm/api/keyless.mjs.map +1 -1
  60. package/dist/esm/api/object.mjs +1 -1
  61. package/dist/esm/api/object.mjs.map +1 -1
  62. package/dist/esm/api/staking.mjs +1 -1
  63. package/dist/esm/api/staking.mjs.map +1 -1
  64. package/dist/esm/api/table.mjs +1 -1
  65. package/dist/esm/api/table.mjs.map +1 -1
  66. package/dist/esm/api/transaction.mjs +1 -1
  67. package/dist/esm/api/transaction.mjs.map +1 -1
  68. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  69. package/dist/esm/api/transactionSubmission/build.mjs.map +1 -1
  70. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  71. package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -1
  72. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/management.mjs.map +1 -1
  74. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  75. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  76. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  77. package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -1
  78. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  79. package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -1
  80. package/dist/esm/api/utils.mjs +1 -1
  81. package/dist/esm/api/utils.mjs.map +1 -1
  82. package/dist/esm/bcs/consts.mjs +1 -1
  83. package/dist/esm/bcs/consts.mjs.map +1 -1
  84. package/dist/esm/bcs/deserializer.mjs +1 -1
  85. package/dist/esm/bcs/deserializer.mjs.map +1 -1
  86. package/dist/esm/bcs/index.mjs +1 -1
  87. package/dist/esm/bcs/index.mjs.map +1 -1
  88. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  89. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -1
  90. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  91. package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -1
  92. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  93. package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -1
  94. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  95. package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -1
  96. package/dist/esm/bcs/serializer.mjs +1 -1
  97. package/dist/esm/bcs/serializer.mjs.map +1 -1
  98. package/dist/esm/chunk-2PASUPUO.mjs +2 -0
  99. package/dist/esm/chunk-2PASUPUO.mjs.map +1 -0
  100. package/dist/esm/chunk-35DKMW7Q.mjs +2 -0
  101. package/dist/esm/chunk-35DKMW7Q.mjs.map +1 -0
  102. package/dist/esm/chunk-3LJVXUPB.mjs +2 -0
  103. package/dist/esm/chunk-3LJVXUPB.mjs.map +1 -0
  104. package/dist/esm/chunk-4QMXOWHP.mjs +1 -0
  105. package/dist/esm/chunk-4QMXOWHP.mjs.map +1 -0
  106. package/dist/esm/chunk-4WPQQPUF.mjs +1 -0
  107. package/dist/esm/chunk-4WPQQPUF.mjs.map +1 -0
  108. package/dist/esm/chunk-56CNRT2K.mjs +2 -0
  109. package/dist/esm/chunk-56CNRT2K.mjs.map +1 -0
  110. package/dist/esm/chunk-57YZ7I7V.mjs +2 -0
  111. package/dist/esm/chunk-57YZ7I7V.mjs.map +1 -0
  112. package/dist/esm/chunk-5HXLZHDW.mjs +1 -0
  113. package/dist/esm/chunk-5HXLZHDW.mjs.map +1 -0
  114. package/dist/esm/chunk-6WDVDEQZ.mjs +7 -0
  115. package/dist/esm/chunk-6WDVDEQZ.mjs.map +1 -0
  116. package/dist/esm/chunk-7DQDJ2SA.mjs +2 -0
  117. package/dist/esm/chunk-7DQDJ2SA.mjs.map +1 -0
  118. package/dist/esm/chunk-7ECCT6PK.mjs +1 -0
  119. package/dist/esm/chunk-7ECCT6PK.mjs.map +1 -0
  120. package/dist/esm/chunk-7ZESTCBD.mjs +2 -0
  121. package/dist/esm/chunk-7ZESTCBD.mjs.map +1 -0
  122. package/dist/esm/chunk-A5L76YP7.mjs +2 -0
  123. package/dist/esm/chunk-A5L76YP7.mjs.map +1 -0
  124. package/dist/esm/chunk-ADJMFL73.mjs +2 -0
  125. package/dist/esm/chunk-ADJMFL73.mjs.map +1 -0
  126. package/dist/esm/chunk-B563XRSZ.mjs +2 -0
  127. package/dist/esm/chunk-B563XRSZ.mjs.map +1 -0
  128. package/dist/esm/chunk-C3Q23D22.mjs +2 -0
  129. package/dist/esm/chunk-C3Q23D22.mjs.map +1 -0
  130. package/dist/esm/chunk-CW35YAMN.mjs +2 -0
  131. package/dist/esm/chunk-CW35YAMN.mjs.map +1 -0
  132. package/dist/esm/chunk-CZDNBI5K.mjs +2 -0
  133. package/dist/esm/chunk-CZDNBI5K.mjs.map +1 -0
  134. package/dist/esm/chunk-DHCGYW3W.mjs +2 -0
  135. package/dist/esm/chunk-DHCGYW3W.mjs.map +1 -0
  136. package/dist/esm/chunk-EBMEXURY.mjs +2 -0
  137. package/dist/esm/chunk-EBMEXURY.mjs.map +1 -0
  138. package/dist/esm/chunk-EF4FA5I6.mjs +2 -0
  139. package/dist/esm/chunk-EF4FA5I6.mjs.map +1 -0
  140. package/dist/esm/chunk-EMR3S3VO.mjs +2 -0
  141. package/dist/esm/chunk-EMR3S3VO.mjs.map +1 -0
  142. package/dist/esm/chunk-FD6FGKYY.mjs +1 -0
  143. package/dist/esm/chunk-FD6FGKYY.mjs.map +1 -0
  144. package/dist/esm/chunk-FGFLPH5K.mjs +2 -0
  145. package/dist/esm/chunk-FGFLPH5K.mjs.map +1 -0
  146. package/dist/esm/chunk-FLZPUYXQ.mjs +2 -0
  147. package/dist/esm/chunk-FLZPUYXQ.mjs.map +1 -0
  148. package/dist/esm/chunk-FZY4PMEE.mjs +1 -0
  149. package/dist/esm/chunk-FZY4PMEE.mjs.map +1 -0
  150. package/dist/esm/chunk-G3MHXDYA.mjs +1 -0
  151. package/dist/esm/chunk-G3MHXDYA.mjs.map +1 -0
  152. package/dist/esm/chunk-GOXRBEIJ.mjs +2 -0
  153. package/dist/esm/chunk-GOXRBEIJ.mjs.map +1 -0
  154. package/dist/esm/chunk-GUPVZIYS.mjs +2 -0
  155. package/dist/esm/chunk-GUPVZIYS.mjs.map +1 -0
  156. package/dist/esm/chunk-HGLO5LDS.mjs +1 -0
  157. package/dist/esm/chunk-HGLO5LDS.mjs.map +1 -0
  158. package/dist/esm/chunk-HNBVYE3N.mjs +2 -0
  159. package/dist/esm/chunk-HNBVYE3N.mjs.map +1 -0
  160. package/dist/esm/chunk-I7XT6L7S.mjs +2 -0
  161. package/dist/esm/chunk-I7XT6L7S.mjs.map +1 -0
  162. package/dist/esm/chunk-IF4UU2MT.mjs +2 -0
  163. package/dist/esm/chunk-IF4UU2MT.mjs.map +1 -0
  164. package/dist/esm/chunk-KB4XOTCR.mjs +2 -0
  165. package/dist/esm/chunk-KB4XOTCR.mjs.map +1 -0
  166. package/dist/esm/chunk-KDMSOCZY.mjs +2 -0
  167. package/dist/esm/chunk-KDMSOCZY.mjs.map +1 -0
  168. package/dist/esm/chunk-MCFQE4GC.mjs +2 -0
  169. package/dist/esm/chunk-MCFQE4GC.mjs.map +1 -0
  170. package/dist/esm/chunk-MT2RJ7H3.mjs +2 -0
  171. package/dist/esm/chunk-MT2RJ7H3.mjs.map +1 -0
  172. package/dist/esm/chunk-N6YTF76Q.mjs +2 -0
  173. package/dist/esm/chunk-N6YTF76Q.mjs.map +1 -0
  174. package/dist/esm/chunk-NECL5FCQ.mjs +1 -0
  175. package/dist/esm/chunk-NECL5FCQ.mjs.map +1 -0
  176. package/dist/esm/chunk-O26BHE5H.mjs +2 -0
  177. package/dist/esm/chunk-O26BHE5H.mjs.map +1 -0
  178. package/dist/esm/chunk-OLILO7VD.mjs +2 -0
  179. package/dist/esm/chunk-OLILO7VD.mjs.map +1 -0
  180. package/dist/esm/chunk-ORMOQWWH.mjs +2 -0
  181. package/dist/esm/chunk-ORMOQWWH.mjs.map +1 -0
  182. package/dist/esm/chunk-PGUSBALH.mjs +4 -0
  183. package/dist/esm/chunk-PGUSBALH.mjs.map +1 -0
  184. package/dist/esm/chunk-Q4W3WJ2U.mjs +2 -0
  185. package/dist/esm/chunk-Q4W3WJ2U.mjs.map +1 -0
  186. package/dist/esm/chunk-QREVMGQZ.mjs +2 -0
  187. package/dist/esm/chunk-QREVMGQZ.mjs.map +1 -0
  188. package/dist/esm/chunk-RGKRCZ36.mjs +4 -0
  189. package/dist/esm/chunk-RGKRCZ36.mjs.map +1 -0
  190. package/dist/esm/chunk-STY74NUA.mjs +2 -0
  191. package/dist/esm/chunk-STY74NUA.mjs.map +1 -0
  192. package/dist/esm/chunk-TOBQ5UE6.mjs +2 -0
  193. package/dist/esm/chunk-TOBQ5UE6.mjs.map +1 -0
  194. package/dist/esm/chunk-TSEAIF34.mjs +2 -0
  195. package/dist/esm/chunk-TSEAIF34.mjs.map +1 -0
  196. package/dist/esm/chunk-TT3MPSBB.mjs +2 -0
  197. package/dist/esm/chunk-TT3MPSBB.mjs.map +1 -0
  198. package/dist/esm/chunk-UL777LTI.mjs +494 -0
  199. package/dist/esm/chunk-UL777LTI.mjs.map +1 -0
  200. package/dist/esm/chunk-UYVPNUH3.mjs +1 -0
  201. package/dist/esm/chunk-UYVPNUH3.mjs.map +1 -0
  202. package/dist/esm/chunk-V3MBJJTL.mjs +1 -0
  203. package/dist/esm/chunk-V3MBJJTL.mjs.map +1 -0
  204. package/dist/esm/chunk-V74WPKSY.mjs +2 -0
  205. package/dist/esm/chunk-V74WPKSY.mjs.map +1 -0
  206. package/dist/esm/chunk-WCMW2L3P.mjs +2 -0
  207. package/dist/esm/chunk-WCMW2L3P.mjs.map +1 -0
  208. package/dist/esm/chunk-WSR5EBJM.mjs +2 -0
  209. package/dist/esm/chunk-WSR5EBJM.mjs.map +1 -0
  210. package/dist/esm/chunk-XJJVJOX5.mjs +2 -0
  211. package/dist/esm/chunk-XJJVJOX5.mjs.map +1 -0
  212. package/dist/esm/chunk-XKUIMGKU.mjs +2 -0
  213. package/dist/esm/chunk-XKUIMGKU.mjs.map +1 -0
  214. package/dist/esm/chunk-YOZBVVKL.mjs +2 -0
  215. package/dist/esm/chunk-YOZBVVKL.mjs.map +1 -0
  216. package/dist/esm/chunk-ZP4DWSQA.mjs +2 -0
  217. package/dist/esm/chunk-ZP4DWSQA.mjs.map +1 -0
  218. package/dist/esm/cli/index.mjs +1 -1
  219. package/dist/esm/cli/index.mjs.map +1 -1
  220. package/dist/esm/cli/localNode.mjs +1 -1
  221. package/dist/esm/cli/localNode.mjs.map +1 -1
  222. package/dist/esm/cli/move.mjs +1 -1
  223. package/dist/esm/cli/move.mjs.map +1 -1
  224. package/dist/esm/client/core.mjs +1 -1
  225. package/dist/esm/client/core.mjs.map +1 -1
  226. package/dist/esm/client/get.mjs +1 -1
  227. package/dist/esm/client/get.mjs.map +1 -1
  228. package/dist/esm/client/index.mjs +1 -1
  229. package/dist/esm/client/index.mjs.map +1 -1
  230. package/dist/esm/client/post.mjs +1 -1
  231. package/dist/esm/client/post.mjs.map +1 -1
  232. package/dist/esm/core/account/index.d.mts +1 -1
  233. package/dist/esm/core/account/index.mjs +1 -1
  234. package/dist/esm/core/account/index.mjs.map +1 -1
  235. package/dist/esm/core/account/utils/address.d.mts +1 -12
  236. package/dist/esm/core/account/utils/address.mjs +1 -1
  237. package/dist/esm/core/account/utils/address.mjs.map +1 -1
  238. package/dist/esm/core/account/utils/index.d.mts +1 -1
  239. package/dist/esm/core/account/utils/index.mjs +1 -1
  240. package/dist/esm/core/account/utils/index.mjs.map +1 -1
  241. package/dist/esm/core/accountAddress.mjs +1 -3
  242. package/dist/esm/core/accountAddress.mjs.map +1 -1
  243. package/dist/esm/core/authenticationKey.mjs +1 -1
  244. package/dist/esm/core/authenticationKey.mjs.map +1 -1
  245. package/dist/esm/core/common.mjs +1 -1
  246. package/dist/esm/core/common.mjs.map +1 -1
  247. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  248. package/dist/esm/core/crypto/abstraction.mjs.map +1 -1
  249. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  250. package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -1
  251. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  252. package/dist/esm/core/crypto/ed25519.mjs.map +1 -1
  253. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  254. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -1
  255. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  256. package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -1
  257. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  258. package/dist/esm/core/crypto/hdKey.mjs.map +1 -1
  259. package/dist/esm/core/crypto/index.mjs +1 -1
  260. package/dist/esm/core/crypto/index.mjs.map +1 -1
  261. package/dist/esm/core/crypto/keyless.mjs +1 -1
  262. package/dist/esm/core/crypto/keyless.mjs.map +1 -1
  263. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  264. package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -1
  265. package/dist/esm/core/crypto/multiKey.mjs +1 -3
  266. package/dist/esm/core/crypto/multiKey.mjs.map +1 -1
  267. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  268. package/dist/esm/core/crypto/poseidon.mjs.map +1 -1
  269. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  270. package/dist/esm/core/crypto/privateKey.mjs.map +1 -1
  271. package/dist/esm/core/crypto/proof.mjs +1 -1
  272. package/dist/esm/core/crypto/proof.mjs.map +1 -1
  273. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  274. package/dist/esm/core/crypto/publicKey.mjs.map +1 -1
  275. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  276. package/dist/esm/core/crypto/secp256k1.mjs.map +1 -1
  277. package/dist/esm/core/crypto/secp256r1.mjs +1 -1
  278. package/dist/esm/core/crypto/secp256r1.mjs.map +1 -1
  279. package/dist/esm/core/crypto/signature.mjs +1 -1
  280. package/dist/esm/core/crypto/signature.mjs.map +1 -1
  281. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  282. package/dist/esm/core/crypto/singleKey.mjs.map +1 -1
  283. package/dist/esm/core/crypto/types.mjs +1 -0
  284. package/dist/esm/core/crypto/utils.mjs +1 -1
  285. package/dist/esm/core/crypto/utils.mjs.map +1 -1
  286. package/dist/esm/core/hex.mjs +1 -1
  287. package/dist/esm/core/hex.mjs.map +1 -1
  288. package/dist/esm/core/index.d.mts +1 -1
  289. package/dist/esm/core/index.mjs +1 -1
  290. package/dist/esm/core/index.mjs.map +1 -1
  291. package/dist/esm/errors/index.mjs +1 -6
  292. package/dist/esm/errors/index.mjs.map +1 -1
  293. package/dist/esm/index.d.mts +1 -1
  294. package/dist/esm/index.mjs +1 -1
  295. package/dist/esm/index.mjs.map +1 -1
  296. package/dist/esm/internal/abstraction.mjs +1 -1
  297. package/dist/esm/internal/abstraction.mjs.map +1 -1
  298. package/dist/esm/internal/account.mjs +1 -1
  299. package/dist/esm/internal/account.mjs.map +1 -1
  300. package/dist/esm/internal/ans.mjs +1 -1
  301. package/dist/esm/internal/ans.mjs.map +1 -1
  302. package/dist/esm/internal/coin.mjs +1 -1
  303. package/dist/esm/internal/coin.mjs.map +1 -1
  304. package/dist/esm/internal/digitalAsset.mjs +1 -1
  305. package/dist/esm/internal/digitalAsset.mjs.map +1 -1
  306. package/dist/esm/internal/faucet.mjs +1 -1
  307. package/dist/esm/internal/faucet.mjs.map +1 -1
  308. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  309. package/dist/esm/internal/fungibleAsset.mjs.map +1 -1
  310. package/dist/esm/internal/general.mjs +1 -1
  311. package/dist/esm/internal/general.mjs.map +1 -1
  312. package/dist/esm/internal/keyless.mjs +1 -1
  313. package/dist/esm/internal/keyless.mjs.map +1 -1
  314. package/dist/esm/internal/object.mjs +1 -1
  315. package/dist/esm/internal/object.mjs.map +1 -1
  316. package/dist/esm/internal/staking.mjs +1 -1
  317. package/dist/esm/internal/staking.mjs.map +1 -1
  318. package/dist/esm/internal/table.mjs +1 -1
  319. package/dist/esm/internal/table.mjs.map +1 -1
  320. package/dist/esm/internal/transaction.mjs +1 -1
  321. package/dist/esm/internal/transaction.mjs.map +1 -1
  322. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  323. package/dist/esm/internal/transactionSubmission.mjs.map +1 -1
  324. package/dist/esm/internal/utils/index.mjs +1 -1
  325. package/dist/esm/internal/utils/index.mjs.map +1 -1
  326. package/dist/esm/internal/utils/utils.mjs +1 -1
  327. package/dist/esm/internal/utils/utils.mjs.map +1 -1
  328. package/dist/esm/internal/view.mjs +1 -1
  329. package/dist/esm/internal/view.mjs.map +1 -1
  330. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  331. package/dist/esm/transactions/authenticator/account.mjs.map +1 -1
  332. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  333. package/dist/esm/transactions/authenticator/index.mjs.map +1 -1
  334. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  335. package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -1
  336. package/dist/esm/transactions/index.mjs +1 -1
  337. package/dist/esm/transactions/index.mjs.map +1 -1
  338. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  339. package/dist/esm/transactions/instances/chainId.mjs.map +1 -1
  340. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  341. package/dist/esm/transactions/instances/identifier.mjs.map +1 -1
  342. package/dist/esm/transactions/instances/index.mjs +1 -1
  343. package/dist/esm/transactions/instances/index.mjs.map +1 -1
  344. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  345. package/dist/esm/transactions/instances/moduleId.mjs.map +1 -1
  346. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  347. package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -1
  348. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  349. package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -1
  350. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  351. package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -1
  352. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  353. package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -1
  354. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  355. package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -1
  356. package/dist/esm/transactions/instances/transactionArgument.mjs +1 -0
  357. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  358. package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -1
  359. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  360. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -1
  361. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  362. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -1
  363. package/dist/esm/transactions/management/index.mjs +1 -1
  364. package/dist/esm/transactions/management/index.mjs.map +1 -1
  365. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  366. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -1
  367. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  368. package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -1
  369. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  370. package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -1
  371. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  372. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -1
  373. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  374. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -1
  375. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  376. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -1
  377. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  378. package/dist/esm/transactions/typeTag/index.mjs.map +1 -1
  379. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  380. package/dist/esm/transactions/typeTag/parser.mjs.map +1 -1
  381. package/dist/esm/transactions/types.mjs +1 -0
  382. package/dist/esm/types/abstraction.mjs +1 -1
  383. package/dist/esm/types/abstraction.mjs.map +1 -1
  384. package/dist/esm/types/generated/queries.mjs +1 -493
  385. package/dist/esm/types/generated/queries.mjs.map +1 -1
  386. package/dist/esm/types/generated/types.mjs +1 -1
  387. package/dist/esm/types/generated/types.mjs.map +1 -1
  388. package/dist/esm/types/index.mjs +1 -1
  389. package/dist/esm/types/index.mjs.map +1 -1
  390. package/dist/esm/types/indexer.mjs +1 -0
  391. package/dist/esm/types/types.mjs +1 -1
  392. package/dist/esm/types/types.mjs.map +1 -1
  393. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  394. package/dist/esm/utils/apiEndpoints.mjs.map +1 -1
  395. package/dist/esm/utils/const.mjs +1 -1
  396. package/dist/esm/utils/const.mjs.map +1 -1
  397. package/dist/esm/utils/helpers.mjs +1 -1
  398. package/dist/esm/utils/helpers.mjs.map +1 -1
  399. package/dist/esm/utils/index.mjs +1 -1
  400. package/dist/esm/utils/index.mjs.map +1 -1
  401. package/dist/esm/utils/memoize.mjs +1 -1
  402. package/dist/esm/utils/memoize.mjs.map +1 -1
  403. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  404. package/dist/esm/utils/normalizeBundle.mjs.map +1 -1
  405. package/dist/esm/version.mjs +1 -1
  406. package/dist/esm/version.mjs.map +1 -1
  407. package/package.json +20 -39
  408. package/src/api/aptos.ts +14 -25
  409. package/src/core/account/utils/address.ts +0 -22
  410. package/dist/common/chunk-AWFAHZSB.js +0 -4
  411. package/dist/common/chunk-AWFAHZSB.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/utils/memoize.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The global cache Map shared across all functions. Must keep care to ensure that the\n * cache keys are unique across all functions.\n * @group Implementation\n * @category Utils\n */\nconst cache = new Map<string, { value: any; timestamp: number }>();\n\n/**\n * A memoize higher-order function to cache the response of an async function.\n * This function helps to improve performance by avoiding repeated calls to the same async function with the same arguments\n * within a specified time-to-live (TTL).\n *\n * @param func The async function to cache the result of.\n * @param key The cache key used to store the result.\n * @param ttlMs The time-to-live in milliseconds for cached data.\n * @returns The cached or latest result.\n * @group Implementation\n * @category Utils\n */\nexport function memoizeAsync<T>(\n func: (...args: any[]) => Promise<T>,\n key: string,\n ttlMs?: number,\n): (...args: any[]) => Promise<T> {\n return async (...args: any[]) => {\n // Check if the cached result exists and is within TTL\n if (cache.has(key)) {\n const { value, timestamp } = cache.get(key)!;\n if (ttlMs === undefined || Date.now() - timestamp <= ttlMs) {\n return value;\n }\n }\n\n // If not cached or TTL expired, compute the result\n const result = await func(...args);\n\n // Cache the result with a timestamp\n cache.set(key, { value: result, timestamp: Date.now() });\n\n return result;\n };\n}\n\n/**\n * Caches the result of a function call to improve performance on subsequent calls with the same arguments.\n *\n * @param key - The key to cache on, all accesses by this key will return the cached value.\n * @param func - The function whose result will be cached.\n * @param ttlMs - The time-to-live in milliseconds for cached data.\n * @returns A memoized version of the provided function that returns the cached result if available and within TTL.\n * @group Implementation\n * @category Utils\n */\nexport function memoize<T>(func: (...args: any[]) => T, key: string, ttlMs?: number): (...args: any[]) => T {\n return (...args: any[]) => {\n // Check if the cached result exists and is within TTL\n if (cache.has(key)) {\n const { value, timestamp } = cache.get(key)!;\n if (ttlMs === undefined || Date.now() - timestamp <= ttlMs) {\n return value;\n }\n }\n\n // If not cached or TTL expired, compute the result\n const result = func(...args);\n\n // Cache the result with a timestamp\n cache.set(key, { value: result, timestamp: Date.now() });\n\n return result;\n };\n}\n"],"mappings":"AASA,IAAMA,EAAQ,IAAI,IAcX,SAASC,EACdC,EACAC,EACAC,EACgC,CAChC,MAAO,UAAUC,IAAgB,CAE/B,GAAIL,EAAM,IAAIG,CAAG,EAAG,CAClB,GAAM,CAAE,MAAAG,EAAO,UAAAC,CAAU,EAAIP,EAAM,IAAIG,CAAG,EAC1C,GAAIC,IAAU,QAAa,KAAK,IAAI,EAAIG,GAAaH,EACnD,OAAOE,CAEX,CAGA,IAAME,EAAS,MAAMN,EAAK,GAAGG,CAAI,EAGjC,OAAAL,EAAM,IAAIG,EAAK,CAAE,MAAOK,EAAQ,UAAW,KAAK,IAAI,CAAE,CAAC,EAEhDA,CACT,CACF,CAYO,SAASC,EAAWP,EAA6BC,EAAaC,EAAuC,CAC1G,MAAO,IAAIC,IAAgB,CAEzB,GAAIL,EAAM,IAAIG,CAAG,EAAG,CAClB,GAAM,CAAE,MAAAG,EAAO,UAAAC,CAAU,EAAIP,EAAM,IAAIG,CAAG,EAC1C,GAAIC,IAAU,QAAa,KAAK,IAAI,EAAIG,GAAaH,EACnD,OAAOE,CAEX,CAGA,IAAME,EAASN,EAAK,GAAGG,CAAI,EAG3B,OAAAL,EAAM,IAAIG,EAAK,CAAE,MAAOK,EAAQ,UAAW,KAAK,IAAI,CAAE,CAAC,EAEhDA,CACT,CACF","names":["cache","memoizeAsync","func","key","ttlMs","args","value","timestamp","result","memoize"]}
@@ -0,0 +1,2 @@
1
+ var p=(e=>(e[e.V1=0]="V1",e[e.DerivableV1=1]="DerivableV1",e))(p||{}),x=(m=>(m[m.V1=0]="V1",m))(x||{});export{p as a,x as b};
2
+ //# sourceMappingURL=chunk-ZP4DWSQA.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/abstraction.ts"],"sourcesContent":["/**\n * The variant for the AbstractAuthenticationData enum.\n */\nexport enum AbstractAuthenticationDataVariant {\n V1 = 0,\n DerivableV1 = 1,\n}\n\n/**\n * The variant for the AASigningData enum.\n */\nexport enum AASigningDataVariant {\n V1 = 0,\n}\n"],"mappings":"AAGO,IAAKA,OACVA,IAAA,GAAK,GAAL,KACAA,IAAA,YAAc,GAAd,cAFUA,OAAA,IAQAC,OACVA,IAAA,GAAK,GAAL,KADUA,OAAA","names":["AbstractAuthenticationDataVariant","AASigningDataVariant"]}
@@ -1,2 +1,2 @@
1
- export*from"./localNode";export*from"./move";
1
+ import{a as o}from"../chunk-B563XRSZ.mjs";import{a as r}from"../chunk-35DKMW7Q.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{o as LocalNode,r as Move};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/index.ts"],"sourcesContent":["export * from \"./localNode\";\nexport * from \"./move\";\n"],"mappings":"AAAA,WAAc,cACd,WAAc","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{spawn as i}from"child_process";import n from"tree-kill";import{platform as c}from"os";import{sleep as l}from"../utils/helpers";class I{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.showStdout=t?.showStdout??!0}async stop(){await new Promise((t,o)=>{this.process?.pid&&n(this.process.pid,s=>{s?o(s):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){const t="npx",o=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api"],s=c(),e={env:{...process.env,ENABLE_KEYLESS_DEFAULT:"1"},...s==="win32"&&{shell:!0}};this.process=i(t,o,e),this.process.stdout?.on("data",r=>{const a=r.toString();this.showStdout&&console.log(a)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp();const o=Date.now()/1e3;let s=o;for(;!t&&o+this.MAXIMUM_WAIT_TIME_SEC>s;)await l(1e3),t=await this.checkIfProcessIsUp(),s=Date.now()/1e3;if(!t)throw new Error("Process failed to start");return!0}async checkIfProcessIsUp(){try{return(await fetch(this.READINESS_ENDPOINT)).status===200}catch{return!1}}}export{I as LocalNode};
1
+ import{a}from"../chunk-B563XRSZ.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{a as LocalNode};
2
2
  //# sourceMappingURL=localNode.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/localNode.ts"],"sourcesContent":["/* eslint-disable no-console */\n\nimport { ChildProcessWithoutNullStreams, spawn } from \"child_process\";\nimport kill from \"tree-kill\";\nimport { platform } from \"os\";\n\nimport { sleep } from \"../utils/helpers\";\n\n/**\n * Represents a local node for running a localnet environment.\n * This class provides methods to start, stop, and check the status of the localnet process.\n * It manages the lifecycle of the node process and ensures that it is operational before executing tests.\n * @group Implementation\n * @category CLI\n */\nexport class LocalNode {\n readonly MAXIMUM_WAIT_TIME_SEC = 75;\n\n readonly READINESS_ENDPOINT = \"http://127.0.0.1:8070/\";\n\n showStdout: boolean = true;\n\n process: ChildProcessWithoutNullStreams | null = null;\n\n constructor(args?: { showStdout?: boolean }) {\n this.showStdout = args?.showStdout ?? true;\n }\n\n /**\n * Kills the current process and all its descendant processes.\n *\n * @returns {Promise<void>} A promise that resolves to true if the process was successfully killed.\n * @throws {Error} If there is an error while attempting to kill the process.\n * @group Implementation\n * @category CLI\n */\n async stop(): Promise<void> {\n await new Promise((resolve, reject) => {\n if (!this.process?.pid) return;\n\n /**\n * Terminates the process associated with the given process ID.\n *\n * @param pid - The process ID of the process to be terminated.\n * @param callback - A function that is called after the termination attempt is complete.\n * @param callback.err - An error object if the termination failed; otherwise, null.\n * @param callback.resolve - A boolean indicating whether the termination was successful.\n * @group Implementation\n * @category CLI\n */\n kill(this.process.pid, (err) => {\n if (err) {\n reject(err);\n } else {\n resolve(true);\n }\n });\n });\n }\n\n /**\n * Runs a localnet and waits for the process to be up.\n * If the local node process is already running, it returns without starting the process.\n *\n * @returns {Promise<void>} A promise that resolves when the process is up.\n * @group Implementation\n * @category CLI\n */\n async run(): Promise<void> {\n const nodeIsUp = await this.checkIfProcessIsUp();\n if (nodeIsUp) {\n return;\n }\n this.start();\n await this.waitUntilProcessIsUp();\n }\n\n /**\n * Starts the localnet by running the Aptos node with the specified command-line arguments.\n *\n * @returns {void}\n *\n * @throws {Error} If there is an issue starting the localnet.\n * @group Implementation\n * @category CLI\n */\n start(): void {\n const cliCommand = \"npx\";\n const cliArgs = [\"aptos\", \"node\", \"run-localnet\", \"--force-restart\", \"--assume-yes\", \"--with-indexer-api\"];\n\n const currentPlatform = platform();\n const spawnConfig = {\n env: { ...process.env, ENABLE_KEYLESS_DEFAULT: \"1\" },\n ...(currentPlatform === \"win32\" && { shell: true }),\n };\n\n this.process = spawn(cliCommand, cliArgs, spawnConfig);\n\n this.process.stdout?.on(\"data\", (data: any) => {\n const str = data.toString();\n // Print local node output log\n if (this.showStdout) {\n console.log(str);\n }\n });\n }\n\n /**\n * Waits for the localnet process to be operational within a specified maximum wait time.\n * This function continuously checks if the process is up and will throw an error if it fails to start.\n *\n * @returns Promise<boolean> - Resolves to true if the process is up, otherwise throws an error.\n * @group Implementation\n * @category CLI\n */\n async waitUntilProcessIsUp(): Promise<boolean> {\n let operational = await this.checkIfProcessIsUp();\n const start = Date.now() / 1000;\n let last = start;\n\n while (!operational && start + this.MAXIMUM_WAIT_TIME_SEC > last) {\n // eslint-disable-next-line no-await-in-loop\n await sleep(1000);\n // eslint-disable-next-line no-await-in-loop\n operational = await this.checkIfProcessIsUp();\n last = Date.now() / 1000;\n }\n\n // If we are here it means something blocks the process to start.\n // Might worth checking if another process is running on port 8080\n if (!operational) {\n throw new Error(\"Process failed to start\");\n }\n\n return true;\n }\n\n /**\n * Checks if the localnet is up by querying the readiness endpoint.\n *\n * @returns Promise<boolean> - A promise that resolves to true if the localnet is up, otherwise false.\n * @group Implementation\n * @category CLI\n */\n async checkIfProcessIsUp(): Promise<boolean> {\n try {\n // Query readiness endpoint\n const data = await fetch(this.READINESS_ENDPOINT);\n if (data.status === 200) {\n return true;\n }\n return false;\n } catch (err: any) {\n return false;\n }\n }\n}\n"],"mappings":"AAEA,OAAyC,SAAAA,MAAa,gBACtD,OAAOC,MAAU,YACjB,OAAS,YAAAC,MAAgB,KAEzB,OAAS,SAAAC,MAAa,mBASf,MAAMC,CAAU,CASrB,YAAYC,EAAiC,CAR7C,KAAS,sBAAwB,GAEjC,KAAS,mBAAqB,yBAE9B,gBAAsB,GAEtB,aAAiD,KAG/C,KAAK,WAAaA,GAAM,YAAc,EACxC,CAUA,MAAM,MAAsB,CAC1B,MAAM,IAAI,QAAQ,CAACC,EAASC,IAAW,CAChC,KAAK,SAAS,KAYnBN,EAAK,KAAK,QAAQ,IAAMO,GAAQ,CAC1BA,EACFD,EAAOC,CAAG,EAEVF,EAAQ,EAAI,CAEhB,CAAC,CACH,CAAC,CACH,CAUA,MAAM,KAAqB,CACR,MAAM,KAAK,mBAAmB,IAI/C,KAAK,MAAM,EACX,MAAM,KAAK,qBAAqB,EAClC,CAWA,OAAc,CACZ,MAAMG,EAAa,MACbC,EAAU,CAAC,QAAS,OAAQ,eAAgB,kBAAmB,eAAgB,oBAAoB,EAEnGC,EAAkBT,EAAS,EAC3BU,EAAc,CAClB,IAAK,CAAE,GAAG,QAAQ,IAAK,uBAAwB,GAAI,EACnD,GAAID,IAAoB,SAAW,CAAE,MAAO,EAAK,CACnD,EAEA,KAAK,QAAUX,EAAMS,EAAYC,EAASE,CAAW,EAErD,KAAK,QAAQ,QAAQ,GAAG,OAASC,GAAc,CAC7C,MAAMC,EAAMD,EAAK,SAAS,EAEtB,KAAK,YACP,QAAQ,IAAIC,CAAG,CAEnB,CAAC,CACH,CAUA,MAAM,sBAAyC,CAC7C,IAAIC,EAAc,MAAM,KAAK,mBAAmB,EAChD,MAAMC,EAAQ,KAAK,IAAI,EAAI,IAC3B,IAAIC,EAAOD,EAEX,KAAO,CAACD,GAAeC,EAAQ,KAAK,sBAAwBC,GAE1D,MAAMd,EAAM,GAAI,EAEhBY,EAAc,MAAM,KAAK,mBAAmB,EAC5CE,EAAO,KAAK,IAAI,EAAI,IAKtB,GAAI,CAACF,EACH,MAAM,IAAI,MAAM,yBAAyB,EAG3C,MAAO,EACT,CASA,MAAM,oBAAuC,CAC3C,GAAI,CAGF,OADa,MAAM,MAAM,KAAK,kBAAkB,GACvC,SAAW,GAItB,MAAmB,CACjB,MAAO,EACT,CACF,CACF","names":["spawn","kill","platform","sleep","LocalNode","args","resolve","reject","err","cliCommand","cliArgs","currentPlatform","spawnConfig","data","str","operational","start","last"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{spawn as p}from"child_process";import{platform as u}from"os";class w{async init(t){const{network:o,profile:e,extraArguments:r,showStdout:a}=t,s=["aptos","init",`--network=${o??"local"}`,`--profile=${e??"default"}`];return r&&s.push(...r),this.runCommand(s,a)}async compile(t){const{packageDirectoryPath:o,namedAddresses:e,extraArguments:r,showStdout:a}=t,s=["aptos","move","compile","--package-dir",o],n=this.parseNamedAddresses(e);return s.push(...this.prepareNamedAddresses(n)),r&&s.push(...r),this.runCommand(s,a)}async test(t){const{packageDirectoryPath:o,namedAddresses:e,extraArguments:r,showStdout:a}=t,s=["aptos","move","test","--package-dir",o],n=this.parseNamedAddresses(e);return s.push(...this.prepareNamedAddresses(n)),r&&s.push(...r),this.runCommand(s,a)}async publish(t){const{packageDirectoryPath:o,namedAddresses:e,profile:r,extraArguments:a,showStdout:s}=t,n=["aptos","move","publish","--package-dir",o,`--profile=${r??"default"}`],d=this.parseNamedAddresses(e);return n.push(...this.prepareNamedAddresses(d)),a&&n.push(...a),this.runCommand(n,s)}async createObjectAndPublishPackage(t){const{packageDirectoryPath:o,addressName:e,namedAddresses:r,profile:a,extraArguments:s,showStdout:n}=t,d=["aptos","move","create-object-and-publish-package","--package-dir",o,"--address-name",e,`--profile=${a??"default"}`],i=this.parseNamedAddresses(r);d.push(...this.prepareNamedAddresses(i)),s&&d.push(...s);const{output:c}=await this.runCommand(d,n);return{objectAddress:this.extractAddressFromOutput(c)}}async upgradeObjectPackage(t){const{packageDirectoryPath:o,objectAddress:e,namedAddresses:r,profile:a,extraArguments:s,showStdout:n}=t,d=["aptos","move","upgrade-object-package","--package-dir",o,"--object-address",e,`--profile=${a??"default"}`],i=this.parseNamedAddresses(r);return d.push(...this.prepareNamedAddresses(i)),s&&d.push(...s),this.runCommand(d,n)}async buildPublishPayload(t){const{outputFile:o,packageDirectoryPath:e,namedAddresses:r,extraArguments:a,showStdout:s}=t,n=["aptos","move","build-publish-payload","--json-output-file",o,"--package-dir",e],d=this.parseNamedAddresses(r);return n.push(...this.prepareNamedAddresses(d)),a&&n.push(...a),this.runCommand(n,s)}async runScript(t){const{compiledScriptPath:o,profile:e,extraArguments:r,showStdout:a}=t,s=["aptos","move","run-script","--compiled-script-path",o,`--profile=${e??"default"}`];return r&&s.push(...r),this.runCommand(s,a)}async gasProfile(t){const{network:o,transactionId:e,extraArguments:r,showStdout:a}=t,s=["aptos","move","replay","--profile-gas","--network",o,"--txn-id",e];return r&&s.push(...r),this.runCommand(s,a)}async runCommand(t,o=!0){return new Promise((e,r)=>{const a=u();let s,n="",d="";a==="win32"?s=p("npx",t,{shell:!0}):s=p("npx",t),s.stdout.on("data",i=>{d=i.toString(),n+=i.toString()}),o&&(s.stdout.pipe(process.stdout),s.stderr.pipe(process.stderr)),process.stdin.pipe(s.stdin),s.on("close",i=>{if(i===0)try{const c=JSON.parse(d);c.Error?r(new Error(`Error: ${c.Error}`)):c.Result&&e({result:c.Result,output:n})}catch{e({output:n})}else r(new Error(`Child process exited with code ${i}`))})})}prepareNamedAddresses(t){const o=t.size,e=[];if(o===0)return e;e.push("--named-addresses");const r=[];return t.forEach((a,s)=>{const n=`${s}=${a.toString()}`;r.push(n)}),e.push(r.join(",")),e}parseNamedAddresses(t){const o=new Map;return Object.keys(t).forEach(e=>{const r=t[e];o.set(e,r)}),o}extractAddressFromOutput(t){const o=t.match("Code was successfully deployed to object address (0x[0-9a-fA-F]+)");if(o)return o[1];throw new Error("Failed to extract object address from output")}}export{w as Move};
1
+ import{a}from"../chunk-35DKMW7Q.mjs";import"../chunk-KDMSOCZY.mjs";export{a as Move};
2
2
  //# sourceMappingURL=move.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/cli/move.ts"],"sourcesContent":["import { spawn } from \"child_process\";\nimport { platform } from \"os\";\n\nimport { AccountAddress } from \"../core\";\nimport { Network } from \"../utils\";\n\n/**\n * Class representing a Move package management utility for the Aptos blockchain.\n * This class provides methods to initialize directories, compile packages, run tests, publish modules, create objects, upgrade\n * packages, build transaction payloads, and run scripts.\n * @group Implementation\n * @category CLI\n */\nexport class Move {\n /**\n * Initialize the current directory for Aptos by configuring the necessary settings.\n * Configuration will be pushed into .aptos/config.yaml.\n *\n * @param args - The arguments for initialization.\n * @param args.network - Optional Network type argument to use for default settings; defaults to local.\n * @param args.profile - Optional Profile to use from the config file; defaults to 'default'. This will override associated\n * settings such as the REST URL, the Faucet URL, and the private key arguments.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n * @group Implementation\n * @category CLI\n */\n async init(args: {\n network?: Network;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { network, profile, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"init\", `--network=${network ?? \"local\"}`, `--profile=${profile ?? \"default\"}`];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Compile a Move package located at the specified directory path.\n * This function helps in preparing the Move package for deployment or further processing.\n *\n * @param args - The arguments for compiling the package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n * @group Implementation\n * @category CLI\n */\n async compile(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"compile\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Run Move unit tests for a specified package.\n *\n * @param args - The arguments for running the tests.\n * @param args.packageDirectoryPath - The path to a Move package (the folder containing a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns The stdout output from running the tests.\n * @group Implementation\n * @category CLI\n */\n async test(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"test\", \"--package-dir\", packageDirectoryPath];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Publishes the modules to the publisher account on the Aptos blockchain.\n *\n * @param args - The arguments for publishing the modules.\n * @param args.packageDirectoryPath - The path to a move package (the folder with a Move.toml file).\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n * @group Implementation\n * @category CLI\n */\n async publish(args: {\n packageDirectoryPath: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"publish\",\n \"--package-dir\",\n packageDirectoryPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Create a new object and publish the Move package to it on the Aptos blockchain.\n *\n * @param args - The arguments for creating the object and publishing the package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.addressName - Address name for the Move package.\n * @param args.namedAddresses - Named addresses for the Move binary.\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns The object address.\n *\n * A complete example in CLI:\n * aptos move create-object-and-publish-package \\\n * --package-dir path_to_directory_that_has_move.toml \\\n * --address-name launchpad_addr \\\n * --named-addresses \"launchpad_addr=0x123,initial_creator_addr=0x456\" \\\n * --profile my_profile \\\n * --assume-yes\n * @group Implementation\n * @category CLI\n */\n async createObjectAndPublishPackage(args: {\n packageDirectoryPath: string;\n addressName: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ objectAddress: string }> {\n const { packageDirectoryPath, addressName, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"create-object-and-publish-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--address-name\",\n addressName,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n const { output } = await this.runCommand(cliArgs, showStdout);\n return { objectAddress: this.extractAddressFromOutput(output) };\n }\n\n /**\n * Upgrade a Move package previously published to an object on the Aptos blockchain.\n * The caller must be the object owner to execute this function.\n *\n * @param args - The arguments for upgrading the object package.\n * @param args.packageDirectoryPath - Path to a Move package (the folder with a Move.toml file).\n * @param args.objectAddress - Address of the object that the Move package published to. Ex. 0x1000\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n * @returns stdout\n * @group Implementation\n * @category CLI\n */\n async upgradeObjectPackage(args: {\n packageDirectoryPath: string;\n objectAddress: string;\n namedAddresses: Record<string, AccountAddress>;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { packageDirectoryPath, objectAddress, namedAddresses, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"upgrade-object-package\",\n \"--package-dir\",\n packageDirectoryPath,\n \"--object-address\",\n objectAddress,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Build a publication transaction payload and store it in a JSON output file.\n *\n * @param args - The arguments for building the publishing payload.\n * @param args.packageDirectoryPath - Path to a move package (the folder with a Move.toml file).\n * @param args.outputFile - Output file to write the publication transaction to.\n * @param args.namedAddresses - Named addresses for the move binary. Ex. { alice: 0x1234, bob: 0x5678 }\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"] *\n * @returns stdout\n * @group Implementation\n * @category CLI\n */\n async buildPublishPayload(args: {\n packageDirectoryPath: string;\n outputFile: string;\n namedAddresses: Record<string, AccountAddress>;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { outputFile, packageDirectoryPath, namedAddresses, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"build-publish-payload\",\n \"--json-output-file\",\n outputFile,\n \"--package-dir\",\n packageDirectoryPath,\n ];\n\n const addressesMap = this.parseNamedAddresses(namedAddresses);\n\n cliArgs.push(...this.prepareNamedAddresses(addressesMap));\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Runs a Move script using the provided compiled script path and optional parameters. Ensure that the script is compiled\n * before executing this function.\n *\n * @param args - The arguments for running the script.\n * @param args.compiledScriptPath - Path to a compiled Move script bytecode file.\n * Ex. \"build/my_package/bytecode_scripts/my_move_script.mv\"\n * @param args.profile - Optional profile to use from the config file.\n * @param args.extraArguments - Optional extra arguments to include in the form of an array of strings.\n * Ex. [\"--assume-yes\",\"--gas-unit-price=10\"]\n *\n * @returns The standard output from running the script.\n * @group Implementation\n * @category CLI\n */\n async runScript(args: {\n compiledScriptPath: string;\n profile?: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string }> {\n const { compiledScriptPath, profile, extraArguments, showStdout } = args;\n const cliArgs = [\n \"aptos\",\n \"move\",\n \"run-script\",\n \"--compiled-script-path\",\n compiledScriptPath,\n `--profile=${profile ?? \"default\"}`,\n ];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n async gasProfile(args: {\n network: string;\n transactionId: string;\n extraArguments?: Array<string>;\n showStdout?: boolean;\n }): Promise<{ output: string; result?: any }> {\n const { network, transactionId, extraArguments, showStdout } = args;\n const cliArgs = [\"aptos\", \"move\", \"replay\", \"--profile-gas\", \"--network\", network, \"--txn-id\", transactionId];\n\n if (extraArguments) {\n cliArgs.push(...extraArguments);\n }\n\n return this.runCommand(cliArgs, showStdout);\n }\n\n /**\n * Run a command with the specified arguments and return the output.\n *\n * @param args - An array of strings representing the command-line arguments to be passed to the command.\n * @param showStdout - Show the standard output generated by the command.\n * @returns The standard output generated by the command.\n * @group Implementation\n * @category CLI\n */\n // eslint-disable-next-line class-methods-use-this\n private async runCommand(args: Array<string>, showStdout: boolean = true): Promise<{ result?: any; output: string }> {\n return new Promise((resolve, reject) => {\n const currentPlatform = platform();\n let childProcess;\n let stdout = \"\";\n // CLI final stdout is the Result/Error JSON string output\n // so we need to keep track of the last stdout\n let lastStdout = \"\";\n\n // Check if current OS is windows\n if (currentPlatform === \"win32\") {\n childProcess = spawn(\"npx\", args, { shell: true });\n } else {\n childProcess = spawn(\"npx\", args);\n }\n\n childProcess.stdout.on(\"data\", (data) => {\n lastStdout = data.toString();\n stdout += data.toString();\n });\n\n if (showStdout) {\n childProcess.stdout.pipe(process.stdout);\n childProcess.stderr.pipe(process.stderr);\n }\n process.stdin.pipe(childProcess.stdin);\n\n childProcess.on(\"close\", (code) => {\n if (code === 0) {\n try {\n // parse the last stdout as it might be the result\n const parsed = JSON.parse(lastStdout);\n if (parsed.Error) {\n reject(new Error(`Error: ${parsed.Error}`)); // Reject if the \"Error\" key exists\n } else if (parsed.Result) {\n resolve({ result: parsed.Result, output: stdout }); // Resolve if the \"Result\" key exists\n }\n } catch (error: any) {\n // resolve the stdout as it might be just a stdout\n resolve({ output: stdout });\n }\n } else {\n reject(new Error(`Child process exited with code ${code}`)); // Reject with an error if the child process exits with an error code\n }\n });\n });\n }\n\n /**\n * Convert named addresses from a Map into an array separated by a comma.\n *\n * @param namedAddresses - A Map where the key is a string representing the name and the value is an AccountAddress.\n * Ex. {'alice' => '0x123', 'bob' => '0x456'}\n * @returns An array of named addresses formatted as strings separated by a comma. Ex. \"alice=0x123,bob=0x456\"\n * @group Implementation\n * @category CLI\n */\n // eslint-disable-next-line class-methods-use-this\n private prepareNamedAddresses(namedAddresses: Map<string, AccountAddress>): Array<string> {\n const totalNames = namedAddresses.size;\n const newArgs: Array<string> = [];\n\n if (totalNames === 0) {\n return newArgs;\n }\n\n newArgs.push(\"--named-addresses\");\n\n const names: Array<string> = [];\n namedAddresses.forEach((value, key) => {\n const toAppend = `${key}=${value.toString()}`;\n names.push(toAppend);\n });\n newArgs.push(names.join(\",\"));\n return newArgs;\n }\n\n /**\n * Parse named addresses from a Record type into a Map.\n *\n * This function transforms a collection of named addresses into a more accessible format by mapping each name to its\n * corresponding address.\n *\n * @param namedAddresses - A record containing named addresses where the key is the name and the value is the AccountAddress.\n * @returns A Map where each key is a name and each value is the corresponding address.\n * @group Implementation\n * @category CLI\n */\n // eslint-disable-next-line class-methods-use-this\n private parseNamedAddresses(namedAddresses: Record<string, AccountAddress>): Map<string, AccountAddress> {\n const addressesMap = new Map();\n\n Object.keys(namedAddresses).forEach((key) => {\n const address = namedAddresses[key];\n addressesMap.set(key, address);\n });\n\n return addressesMap;\n }\n\n /**\n * Extracts the object address from the provided output string.\n *\n * @param output - The output string containing the object address.\n * @returns The extracted object address.\n * @throws Error if the object address cannot be extracted from the output.\n * @group Implementation\n * @category CLI\n */\n // eslint-disable-next-line class-methods-use-this\n private extractAddressFromOutput(output: string): string {\n const match = output.match(\"Code was successfully deployed to object address (0x[0-9a-fA-F]+)\");\n if (match) {\n return match[1];\n }\n throw new Error(\"Failed to extract object address from output\");\n }\n}\n"],"mappings":"AAAA,OAAS,SAAAA,MAAa,gBACtB,OAAS,YAAAC,MAAgB,KAYlB,MAAMC,CAAK,CAehB,MAAM,KAAKC,EAKqB,CAC9B,KAAM,CAAE,QAAAC,EAAS,QAAAC,EAAS,eAAAC,EAAgB,WAAAC,CAAW,EAAIJ,EACnDK,EAAU,CAAC,QAAS,OAAQ,aAAaJ,GAAW,OAAO,GAAI,aAAaC,GAAW,SAAS,EAAE,EAExG,OAAIC,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAeA,MAAM,QAAQJ,EAKkB,CAC9B,KAAM,CAAE,qBAAAM,EAAsB,eAAAC,EAAgB,eAAAJ,EAAgB,WAAAC,CAAW,EAAIJ,EACvEK,EAAU,CAAC,QAAS,OAAQ,UAAW,gBAAiBC,CAAoB,EAE5EE,EAAe,KAAK,oBAAoBD,CAAc,EAE5D,OAAAF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC,EAEpDL,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAcA,MAAM,KAAKJ,EAKqB,CAC9B,KAAM,CAAE,qBAAAM,EAAsB,eAAAC,EAAgB,eAAAJ,EAAgB,WAAAC,CAAW,EAAIJ,EACvEK,EAAU,CAAC,QAAS,OAAQ,OAAQ,gBAAiBC,CAAoB,EAEzEE,EAAe,KAAK,oBAAoBD,CAAc,EAE5D,OAAAF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC,EAEpDL,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAeA,MAAM,QAAQJ,EAMkB,CAC9B,KAAM,CAAE,qBAAAM,EAAsB,eAAAC,EAAgB,QAAAL,EAAS,eAAAC,EAAgB,WAAAC,CAAW,EAAIJ,EAChFK,EAAU,CACd,QACA,OACA,UACA,gBACAC,EACA,aAAaJ,GAAW,SAAS,EACnC,EAEMM,EAAe,KAAK,oBAAoBD,CAAc,EAE5D,OAAAF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC,EAEpDL,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAwBA,MAAM,8BAA8BJ,EAOG,CACrC,KAAM,CAAE,qBAAAM,EAAsB,YAAAG,EAAa,eAAAF,EAAgB,QAAAL,EAAS,eAAAC,EAAgB,WAAAC,CAAW,EAAIJ,EAC7FK,EAAU,CACd,QACA,OACA,oCACA,gBACAC,EACA,iBACAG,EACA,aAAaP,GAAW,SAAS,EACnC,EAEMM,EAAe,KAAK,oBAAoBD,CAAc,EAE5DF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC,EAEpDL,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGhC,KAAM,CAAE,OAAAO,CAAO,EAAI,MAAM,KAAK,WAAWL,EAASD,CAAU,EAC5D,MAAO,CAAE,cAAe,KAAK,yBAAyBM,CAAM,CAAE,CAChE,CAiBA,MAAM,qBAAqBV,EAOK,CAC9B,KAAM,CAAE,qBAAAM,EAAsB,cAAAK,EAAe,eAAAJ,EAAgB,QAAAL,EAAS,eAAAC,EAAgB,WAAAC,CAAW,EAAIJ,EAC/FK,EAAU,CACd,QACA,OACA,yBACA,gBACAC,EACA,mBACAK,EACA,aAAaT,GAAW,SAAS,EACnC,EAEMM,EAAe,KAAK,oBAAoBD,CAAc,EAE5D,OAAAF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC,EAEpDL,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAeA,MAAM,oBAAoBJ,EAMM,CAC9B,KAAM,CAAE,WAAAY,EAAY,qBAAAN,EAAsB,eAAAC,EAAgB,eAAAJ,EAAgB,WAAAC,CAAW,EAAIJ,EACnFK,EAAU,CACd,QACA,OACA,wBACA,qBACAO,EACA,gBACAN,CACF,EAEME,EAAe,KAAK,oBAAoBD,CAAc,EAE5D,OAAAF,EAAQ,KAAK,GAAG,KAAK,sBAAsBG,CAAY,CAAC,EAEpDL,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAiBA,MAAM,UAAUJ,EAKgB,CAC9B,KAAM,CAAE,mBAAAa,EAAoB,QAAAX,EAAS,eAAAC,EAAgB,WAAAC,CAAW,EAAIJ,EAC9DK,EAAU,CACd,QACA,OACA,aACA,yBACAQ,EACA,aAAaX,GAAW,SAAS,EACnC,EAEA,OAAIC,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAEA,MAAM,WAAWJ,EAK6B,CAC5C,KAAM,CAAE,QAAAC,EAAS,cAAAa,EAAe,eAAAX,EAAgB,WAAAC,CAAW,EAAIJ,EACzDK,EAAU,CAAC,QAAS,OAAQ,SAAU,gBAAiB,YAAaJ,EAAS,WAAYa,CAAa,EAE5G,OAAIX,GACFE,EAAQ,KAAK,GAAGF,CAAc,EAGzB,KAAK,WAAWE,EAASD,CAAU,CAC5C,CAYA,MAAc,WAAWJ,EAAqBI,EAAsB,GAAiD,CACnH,OAAO,IAAI,QAAQ,CAACW,EAASC,IAAW,CACtC,MAAMC,EAAkBnB,EAAS,EACjC,IAAIoB,EACAC,EAAS,GAGTC,EAAa,GAGbH,IAAoB,QACtBC,EAAerB,EAAM,MAAOG,EAAM,CAAE,MAAO,EAAK,CAAC,EAEjDkB,EAAerB,EAAM,MAAOG,CAAI,EAGlCkB,EAAa,OAAO,GAAG,OAASG,GAAS,CACvCD,EAAaC,EAAK,SAAS,EAC3BF,GAAUE,EAAK,SAAS,CAC1B,CAAC,EAEGjB,IACFc,EAAa,OAAO,KAAK,QAAQ,MAAM,EACvCA,EAAa,OAAO,KAAK,QAAQ,MAAM,GAEzC,QAAQ,MAAM,KAAKA,EAAa,KAAK,EAErCA,EAAa,GAAG,QAAUI,GAAS,CACjC,GAAIA,IAAS,EACX,GAAI,CAEF,MAAMC,EAAS,KAAK,MAAMH,CAAU,EAChCG,EAAO,MACTP,EAAO,IAAI,MAAM,UAAUO,EAAO,KAAK,EAAE,CAAC,EACjCA,EAAO,QAChBR,EAAQ,CAAE,OAAQQ,EAAO,OAAQ,OAAQJ,CAAO,CAAC,CAErD,MAAqB,CAEnBJ,EAAQ,CAAE,OAAQI,CAAO,CAAC,CAC5B,MAEAH,EAAO,IAAI,MAAM,kCAAkCM,CAAI,EAAE,CAAC,CAE9D,CAAC,CACH,CAAC,CACH,CAYQ,sBAAsBf,EAA4D,CACxF,MAAMiB,EAAajB,EAAe,KAC5BkB,EAAyB,CAAC,EAEhC,GAAID,IAAe,EACjB,OAAOC,EAGTA,EAAQ,KAAK,mBAAmB,EAEhC,MAAMC,EAAuB,CAAC,EAC9B,OAAAnB,EAAe,QAAQ,CAACoB,EAAOC,IAAQ,CACrC,MAAMC,EAAW,GAAGD,CAAG,IAAID,EAAM,SAAS,CAAC,GAC3CD,EAAM,KAAKG,CAAQ,CACrB,CAAC,EACDJ,EAAQ,KAAKC,EAAM,KAAK,GAAG,CAAC,EACrBD,CACT,CAcQ,oBAAoBlB,EAA6E,CACvG,MAAMC,EAAe,IAAI,IAEzB,cAAO,KAAKD,CAAc,EAAE,QAASqB,GAAQ,CAC3C,MAAME,EAAUvB,EAAeqB,CAAG,EAClCpB,EAAa,IAAIoB,EAAKE,CAAO,CAC/B,CAAC,EAEMtB,CACT,CAYQ,yBAAyBE,EAAwB,CACvD,MAAMqB,EAAQrB,EAAO,MAAM,mEAAmE,EAC9F,GAAIqB,EACF,OAAOA,EAAM,CAAC,EAEhB,MAAM,IAAI,MAAM,8CAA8C,CAChE,CACF","names":["spawn","platform","Move","args","network","profile","extraArguments","showStdout","cliArgs","packageDirectoryPath","namedAddresses","addressesMap","addressName","output","objectAddress","outputFile","compiledScriptPath","transactionId","resolve","reject","currentPlatform","childProcess","stdout","lastStdout","data","code","parsed","totalNames","newArgs","names","value","key","toAppend","address","match"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{VERSION as A}from"../version";import{MimeType as c}from"../types";import{AptosApiType as d}from"../utils";import{AptosApiError as R}from"../errors";async function f(s,u){const{url:t,method:r,body:n,contentType:i,params:o,overrides:e,originMethod:a}=s,p={...e?.HEADERS,"x-aptos-client":`aptos-typescript-sdk/${A}`,"content-type":i??c.JSON,"x-aptos-typescript-sdk-origin-method":a};return e?.AUTH_TOKEN&&(p.Authorization=`Bearer ${e?.AUTH_TOKEN}`),e?.API_KEY&&(p.Authorization=`Bearer ${e?.API_KEY}`),u.provider({url:t,method:r,body:n,params:o,headers:p,overrides:e})}async function $(s,u,t){const{url:r,path:n}=s,i=n?`${r}/${n}`:r,o=await f({...s,url:i},u.client),e={status:o.status,statusText:o.statusText??"No status text provided",data:o.data,headers:o.headers,config:o.config,request:o.request,url:i};if(e.status===401)throw new R({apiType:t,aptosRequest:s,aptosResponse:e});if(t===d.INDEXER){const a=e.data;if(a.errors)throw new R({apiType:t,aptosRequest:s,aptosResponse:e});e.data=a.data}else if((t===d.PEPPER||t===d.PROVER)&&e.status>=400)throw new R({apiType:t,aptosRequest:s,aptosResponse:e});if(e.status>=200&&e.status<300)return e;throw new R({apiType:t,aptosRequest:s,aptosResponse:e})}export{$ as aptosRequest,f as request};
1
+ import{a,b}from"../chunk-CZDNBI5K.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-EMR3S3VO.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-GUPVZIYS.mjs";import"../chunk-KDMSOCZY.mjs";export{b as aptosRequest,a as request};
2
2
  //# sourceMappingURL=core.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/core.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { VERSION } from \"../version\";\nimport { AnyNumber, AptosRequest, AptosResponse, Client, ClientRequest, ClientResponse, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils\";\nimport { AptosApiError } from \"../errors\";\n\n/**\n * Sends a request using the specified options and returns the response.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to send the request to.\n * @param options.method - The HTTP method to use for the request.\n * @param options.body - The body of the request.\n * @param options.contentType - The content type of the request.\n * @param options.params - The query parameters to include in the request.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @param options.overrides.AUTH_TOKEN - The authorization token for the request.\n * @param options.overrides.API_KEY - The API key for the request.\n * @param options.originMethod - The origin method for the request.\n * @param client - The client used to make the request.\n *\n * @returns The response from the request.\n * @group Implementation\n * @category Client\n */\nexport async function request<Req, Res>(options: ClientRequest<Req>, client: Client): Promise<ClientResponse<Res>> {\n const { url, method, body, contentType, params, overrides, originMethod } = options;\n const headers: Record<string, string | AnyNumber | boolean | undefined> = {\n ...overrides?.HEADERS,\n \"x-aptos-client\": `aptos-typescript-sdk/${VERSION}`,\n \"content-type\": contentType ?? MimeType.JSON,\n \"x-aptos-typescript-sdk-origin-method\": originMethod,\n };\n\n if (overrides?.AUTH_TOKEN) {\n headers.Authorization = `Bearer ${overrides?.AUTH_TOKEN}`;\n }\n if (overrides?.API_KEY) {\n headers.Authorization = `Bearer ${overrides?.API_KEY}`;\n }\n\n /*\n * make a call using the @aptos-labs/aptos-client package\n * {@link https://www.npmjs.com/package/@aptos-labs/aptos-client}\n */\n return client.provider<Req, Res>({\n url,\n method,\n body,\n params,\n headers,\n overrides,\n });\n}\n\n/**\n * The main function to use when making an API request, returning the response or throwing an AptosApiError on failure.\n *\n * @param aptosRequestOpts - Options for the Aptos request, including the URL and path.\n * @param aptosConfig - The configuration information for the SDK client instance.\n * @param apiType - The type of API being accessed, which determines how the response is handled.\n * @returns The response from the API request or throws an AptosApiError if the request fails.\n * @group Implementation\n * @category Client\n */\nexport async function aptosRequest<Req extends {}, Res extends {}>(\n aptosRequestOpts: AptosRequest,\n aptosConfig: AptosConfig,\n apiType: AptosApiType,\n): Promise<AptosResponse<Req, Res>> {\n const { url, path } = aptosRequestOpts;\n const fullUrl = path ? `${url}/${path}` : url;\n const clientResponse = await request<Req, Res>({ ...aptosRequestOpts, url: fullUrl }, aptosConfig.client);\n\n const aptosResponse: AptosResponse<Req, Res> = {\n status: clientResponse.status,\n statusText: clientResponse.statusText ?? \"No status text provided\",\n data: clientResponse.data,\n headers: clientResponse.headers,\n config: clientResponse.config,\n request: clientResponse.request,\n url: fullUrl,\n };\n\n // Handle case for `Unauthorized` error (i.e. API_KEY error)\n if (aptosResponse.status === 401) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n\n // to support both fullnode and indexer responses,\n // check if it is an indexer query, and adjust response.data\n if (apiType === AptosApiType.INDEXER) {\n const indexerResponse = aptosResponse.data as any;\n // Handle Indexer general errors\n if (indexerResponse.errors) {\n throw new AptosApiError({\n apiType,\n aptosRequest: aptosRequestOpts,\n aptosResponse,\n });\n }\n aptosResponse.data = indexerResponse.data as Res;\n } else if (apiType === AptosApiType.PEPPER || apiType === AptosApiType.PROVER) {\n if (aptosResponse.status >= 400) {\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n }\n }\n\n if (aptosResponse.status >= 200 && aptosResponse.status < 300) {\n return aptosResponse;\n }\n\n // We have to explicitly check for all request types, because if the error is a non-indexer error, but\n // comes from an indexer request (e.g. 404), we'll need to mention it appropriately\n throw new AptosApiError({ apiType, aptosRequest: aptosRequestOpts, aptosResponse });\n}\n"],"mappings":"AAIA,OAAS,WAAAA,MAAe,aACxB,OAAwF,YAAAC,MAAgB,WACxG,OAAS,gBAAAC,MAAoB,WAC7B,OAAS,iBAAAC,MAAqB,YAsB9B,eAAsBC,EAAkBC,EAA6BC,EAA8C,CACjH,KAAM,CAAE,IAAAC,EAAK,OAAAC,EAAQ,KAAAC,EAAM,YAAAC,EAAa,OAAAC,EAAQ,UAAAC,EAAW,aAAAC,CAAa,EAAIR,EACtES,EAAoE,CACxE,GAAGF,GAAW,QACd,iBAAkB,wBAAwBZ,CAAO,GACjD,eAAgBU,GAAeT,EAAS,KACxC,uCAAwCY,CAC1C,EAEA,OAAID,GAAW,aACbE,EAAQ,cAAgB,UAAUF,GAAW,UAAU,IAErDA,GAAW,UACbE,EAAQ,cAAgB,UAAUF,GAAW,OAAO,IAO/CN,EAAO,SAAmB,CAC/B,IAAAC,EACA,OAAAC,EACA,KAAAC,EACA,OAAAE,EACA,QAAAG,EACA,UAAAF,CACF,CAAC,CACH,CAYA,eAAsBG,EACpBC,EACAC,EACAC,EACkC,CAClC,KAAM,CAAE,IAAAX,EAAK,KAAAY,CAAK,EAAIH,EAChBI,EAAUD,EAAO,GAAGZ,CAAG,IAAIY,CAAI,GAAKZ,EACpCc,EAAiB,MAAMjB,EAAkB,CAAE,GAAGY,EAAkB,IAAKI,CAAQ,EAAGH,EAAY,MAAM,EAElGK,EAAyC,CAC7C,OAAQD,EAAe,OACvB,WAAYA,EAAe,YAAc,0BACzC,KAAMA,EAAe,KACrB,QAASA,EAAe,QACxB,OAAQA,EAAe,OACvB,QAASA,EAAe,QACxB,IAAKD,CACP,EAGA,GAAIE,EAAc,SAAW,IAC3B,MAAM,IAAInB,EAAc,CAAE,QAAAe,EAAS,aAAcF,EAAkB,cAAAM,CAAc,CAAC,EAKpF,GAAIJ,IAAYhB,EAAa,QAAS,CACpC,MAAMqB,EAAkBD,EAAc,KAEtC,GAAIC,EAAgB,OAClB,MAAM,IAAIpB,EAAc,CACtB,QAAAe,EACA,aAAcF,EACd,cAAAM,CACF,CAAC,EAEHA,EAAc,KAAOC,EAAgB,IACvC,UAAWL,IAAYhB,EAAa,QAAUgB,IAAYhB,EAAa,SACjEoB,EAAc,QAAU,IAC1B,MAAM,IAAInB,EAAc,CAAE,QAAAe,EAAS,aAAcF,EAAkB,cAAAM,CAAc,CAAC,EAItF,GAAIA,EAAc,QAAU,KAAOA,EAAc,OAAS,IACxD,OAAOA,EAKT,MAAM,IAAInB,EAAc,CAAE,QAAAe,EAAS,aAAcF,EAAkB,cAAAM,CAAc,CAAC,CACpF","names":["VERSION","MimeType","AptosApiType","AptosApiError","request","options","client","url","method","body","contentType","params","overrides","originMethod","headers","aptosRequest","aptosRequestOpts","aptosConfig","apiType","path","fullUrl","clientResponse","aptosResponse","indexerResponse"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{aptosRequest as m}from"./core";import{AptosApiType as i}from"../utils/const";async function a(e){const{aptosConfig:t,overrides:s,params:r,contentType:n,acceptType:p,path:u,originMethod:o,type:R}=e,d=t.getRequestUrl(R);return m({url:d,method:"GET",originMethod:o,path:u,contentType:n,acceptType:p,params:r,overrides:{...t.clientConfig,...s}},t,e.type)}async function O(e){const{aptosConfig:t}=e;return a({...e,type:i.FULLNODE,overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function P(e){return a({...e,type:i.PEPPER})}async function E(e){const t=new Array(0);let s;const r=e.params;do{const n=await a({type:i.FULLNODE,aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:r,overrides:e.overrides});s=n.headers["x-aptos-cursor"],delete n.headers,t.push(...n.data),r.start=s}while(s!=null);return t}async function b(e){const t=new Array(0);let s;const r=e.params,n=r.limit;do{const{response:p,cursor:u}=await c({...e});if(s=u,t.push(...p.data),e?.params&&(e.params.start=s),n!==void 0){const o=n-t.length;if(o<=0)break;r.limit=o}}while(s!=null);return t}async function c(e){let t,s={};typeof e.params?.cursor=="string"&&(s.start=e.params.cursor),typeof e.params?.limit=="number"&&(s.limit=e.params.limit);const r=await a({type:i.FULLNODE,aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:s,overrides:e.overrides});return t=r.headers["x-aptos-cursor"],{response:r,cursor:t}}export{a as get,O as getAptosFullNode,P as getAptosPepperService,c as getPageWithObfuscatedCursor,E as paginateWithCursor,b as paginateWithObfuscatedCursor};
1
+ import{a,b,c,d,e,f}from"../chunk-KB4XOTCR.mjs";import"../chunk-CZDNBI5K.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-EMR3S3VO.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-GUPVZIYS.mjs";import"../chunk-KDMSOCZY.mjs";export{a as get,b as getAptosFullNode,c as getAptosPepperService,f as getPageWithObfuscatedCursor,d as paginateWithCursor,e as paginateWithObfuscatedCursor};
2
2
  //# sourceMappingURL=get.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/get.ts"],"sourcesContent":["import { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse, AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Options for making a GET request, including configuration for the API client.\n * @group Implementation\n * @category Client\n */\nexport type GetRequestOptions = {\n /**\n * The config for the API client\n * @group Implementation\n * @category Client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n * @group Implementation\n * @category Client\n */\n type: AptosApiType;\n /**\n * The name of the API method\n * @group Implementation\n * @category Client\n */\n originMethod: string;\n /**\n * The URL path to the API method\n * @group Implementation\n * @category Client\n */\n path: string;\n /**\n * The content type of the request body\n * @group Implementation\n * @category Client\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n * @group Implementation\n * @category Client\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n * @group Implementation\n * @category Client\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * Specific client overrides for this request to override aptosConfig\n * @group Implementation\n * @category Client\n */\n overrides?: ClientConfig;\n};\n\n/**\n * Options for making a request to the Aptos API, excluding the \"type\" field.\n * @group Implementation\n * @category Client\n */\nexport type GetAptosRequestOptions = Omit<GetRequestOptions, \"type\">;\n\n/**\n * Executes a GET request to retrieve data based on the provided options.\n *\n * @param options - The options for the GET request.\n * @param options.aptosConfig - The configuration object for Aptos requests.\n * @param options.overrides - Optional overrides for the request configuration.\n * @param options.params - Query parameters to include in the request.\n * @param options.contentType - The content type of the request.\n * @param options.acceptType - The accepted response type.\n * @param options.path - The specific path for the request.\n * @param options.originMethod - The original method of the request.\n * @param options.type - The type of request being made.\n * @returns The response from the GET request.\n * @group Implementation\n * @category Client\n */\nexport async function get<Req extends {}, Res extends {}>(\n options: GetRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig, overrides, params, contentType, acceptType, path, originMethod, type } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"GET\",\n originMethod,\n path,\n contentType,\n acceptType,\n params,\n overrides: {\n ...aptosConfig.clientConfig,\n ...overrides,\n },\n },\n aptosConfig,\n options.type,\n );\n}\n\n/**\n * Retrieves data from the Aptos full node using the provided options.\n *\n * @param options - The options for the request to the Aptos full node.\n * @param options.aptosConfig - Configuration settings specific to the Aptos client and full node.\n * @param options.aptosConfig.clientConfig - The client configuration settings.\n * @param options.aptosConfig.fullnodeConfig - The full node configuration settings.\n * @param options.overrides - Additional overrides for the request.\n * @param options.type - The type of API request being made.\n *\n * @returns A promise that resolves with the response from the Aptos full node.\n * @group Implementation\n * @category Client\n */\nexport async function getAptosFullNode<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return get<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Makes a GET request to the Aptos Pepper service to retrieve data.\n *\n * @param options - The options for the request.\n * @param options.param1 - Description of param1.\n * @param options.param2 - Description of param2.\n * @returns AptosResponse - The response from the Aptos Pepper service.\n * @group Implementation\n * @category Client\n */\nexport async function getAptosPepperService<Req extends {}, Res extends {}>(\n options: GetAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return get<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/**\n * This function is a helper for paginating using a function wrapping an API\n * @group Implementation\n * @category Client\n */\nexport async function paginateWithCursor<Req extends Record<string, any>, Res extends Array<{}>>(\n options: GetAptosRequestOptions,\n): Promise<Res> {\n const out: Res = new Array(0) as Res;\n let cursor: string | undefined;\n const requestParams = options.params as { start?: string; limit?: number };\n do {\n // eslint-disable-next-line no-await-in-loop\n const response = await get<Req, Res>({\n type: AptosApiType.FULLNODE,\n aptosConfig: options.aptosConfig,\n originMethod: options.originMethod,\n path: options.path,\n params: requestParams,\n overrides: options.overrides,\n });\n /**\n * the cursor is a \"state key\" from the API perspective. Client\n * should not need to \"care\" what it represents but just use it\n * to query the next chunk of data.\n * @group Implementation\n * @category Client\n */\n cursor = response.headers[\"x-aptos-cursor\"];\n // Now that we have the cursor (if any), we remove the headers before\n // adding these to the output of this function.\n delete response.headers;\n out.push(...response.data);\n requestParams.start = cursor;\n } while (cursor !== null && cursor !== undefined);\n return out;\n}\n\n/// This function is a helper for paginating using a function wrapping an API using offset instead of start\nexport async function paginateWithObfuscatedCursor<Req extends Record<string, any>, Res extends Array<{}>>(\n options: GetAptosRequestOptions,\n): Promise<Res> {\n const out: Res = new Array(0) as Res;\n let cursor: string | undefined;\n const requestParams = options.params as { start?: string; limit?: number };\n const totalLimit = requestParams.limit;\n do {\n // eslint-disable-next-line no-await-in-loop\n const { response, cursor: newCursor } = await getPageWithObfuscatedCursor<Req, Res>({ ...options });\n\n /**\n * the cursor is a \"state key\" from the API perspective. Client\n * should not need to \"care\" what it represents but just use it\n * to query the next chunk of data.\n */\n cursor = newCursor;\n out.push(...response.data);\n if (options?.params) {\n options.params.start = cursor;\n }\n\n // Re-evaluate length\n if (totalLimit !== undefined) {\n const newLimit = totalLimit - out.length;\n if (newLimit <= 0) {\n break;\n }\n requestParams.limit = newLimit;\n }\n } while (cursor !== null && cursor !== undefined);\n return out;\n}\n\nexport async function getPageWithObfuscatedCursor<Req extends Record<string, any>, Res extends Array<{}>>(\n options: GetAptosRequestOptions,\n): Promise<{ response: AptosResponse<Req, Res>; cursor: string | undefined }> {\n let cursor: string | undefined;\n let requestParams: { start?: string; limit?: number } = {};\n\n // Drop any other values\n // TODO: Throw error if cursor is not a string\n if (typeof options.params?.cursor === \"string\") {\n requestParams.start = options.params.cursor;\n }\n if (typeof options.params?.limit === \"number\") {\n requestParams.limit = options.params.limit;\n }\n\n // eslint-disable-next-line no-await-in-loop\n const response = await get<Req, Res>({\n type: AptosApiType.FULLNODE,\n aptosConfig: options.aptosConfig,\n originMethod: options.originMethod,\n path: options.path,\n params: requestParams,\n overrides: options.overrides,\n });\n\n /**\n * the cursor is a \"state key\" from the API perspective. Client\n * should not need to \"care\" what it represents but just use it\n * to query the next chunk of data.\n */\n cursor = response.headers[\"x-aptos-cursor\"];\n return { response, cursor };\n}\n"],"mappings":"AACA,OAAS,gBAAAA,MAAoB,SAE7B,OAAS,gBAAAC,MAAoB,iBAiF7B,eAAsBC,EACpBC,EACkC,CAClC,KAAM,CAAE,YAAAC,EAAa,UAAAC,EAAW,OAAAC,EAAQ,YAAAC,EAAa,WAAAC,EAAY,KAAAC,EAAM,aAAAC,EAAc,KAAAC,CAAK,EAAIR,EACxFS,EAAMR,EAAY,cAAcO,CAAI,EAE1C,OAAOX,EACL,CACE,IAAAY,EACA,OAAQ,MACR,aAAAF,EACA,KAAAD,EACA,YAAAF,EACA,WAAAC,EACA,OAAAF,EACA,UAAW,CACT,GAAGF,EAAY,aACf,GAAGC,CACL,CACF,EACAD,EACAD,EAAQ,IACV,CACF,CAgBA,eAAsBU,EACpBV,EACkC,CAClC,KAAM,CAAE,YAAAC,CAAY,EAAID,EAExB,OAAOD,EAAc,CACnB,GAAGC,EACH,KAAMF,EAAa,SACnB,UAAW,CACT,GAAGG,EAAY,aACf,GAAGA,EAAY,eACf,GAAGD,EAAQ,UACX,QAAS,CAAE,GAAGC,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAYA,eAAsBU,EACpBX,EACkC,CAClC,OAAOD,EAAc,CAAE,GAAGC,EAAS,KAAMF,EAAa,MAAO,CAAC,CAChE,CAOA,eAAsBc,EACpBZ,EACc,CACd,MAAMa,EAAW,IAAI,MAAM,CAAC,EAC5B,IAAIC,EACJ,MAAMC,EAAgBf,EAAQ,OAC9B,EAAG,CAED,MAAMgB,EAAW,MAAMjB,EAAc,CACnC,KAAMD,EAAa,SACnB,YAAaE,EAAQ,YACrB,aAAcA,EAAQ,aACtB,KAAMA,EAAQ,KACd,OAAQe,EACR,UAAWf,EAAQ,SACrB,CAAC,EAQDc,EAASE,EAAS,QAAQ,gBAAgB,EAG1C,OAAOA,EAAS,QAChBH,EAAI,KAAK,GAAGG,EAAS,IAAI,EACzBD,EAAc,MAAQD,CACxB,OAASA,GAAW,MACpB,OAAOD,CACT,CAGA,eAAsBI,EACpBjB,EACc,CACd,MAAMa,EAAW,IAAI,MAAM,CAAC,EAC5B,IAAIC,EACJ,MAAMC,EAAgBf,EAAQ,OACxBkB,EAAaH,EAAc,MACjC,EAAG,CAED,KAAM,CAAE,SAAAC,EAAU,OAAQG,CAAU,EAAI,MAAMC,EAAsC,CAAE,GAAGpB,CAAQ,CAAC,EAclG,GAPAc,EAASK,EACTN,EAAI,KAAK,GAAGG,EAAS,IAAI,EACrBhB,GAAS,SACXA,EAAQ,OAAO,MAAQc,GAIrBI,IAAe,OAAW,CAC5B,MAAMG,EAAWH,EAAaL,EAAI,OAClC,GAAIQ,GAAY,EACd,MAEFN,EAAc,MAAQM,CACxB,CACF,OAASP,GAAW,MACpB,OAAOD,CACT,CAEA,eAAsBO,EACpBpB,EAC4E,CAC5E,IAAIc,EACAC,EAAoD,CAAC,EAIrD,OAAOf,EAAQ,QAAQ,QAAW,WACpCe,EAAc,MAAQf,EAAQ,OAAO,QAEnC,OAAOA,EAAQ,QAAQ,OAAU,WACnCe,EAAc,MAAQf,EAAQ,OAAO,OAIvC,MAAMgB,EAAW,MAAMjB,EAAc,CACnC,KAAMD,EAAa,SACnB,YAAaE,EAAQ,YACrB,aAAcA,EAAQ,aACtB,KAAMA,EAAQ,KACd,OAAQe,EACR,UAAWf,EAAQ,SACrB,CAAC,EAOD,OAAAc,EAASE,EAAS,QAAQ,gBAAgB,EACnC,CAAE,SAAAA,EAAU,OAAAF,CAAO,CAC5B","names":["aptosRequest","AptosApiType","get","options","aptosConfig","overrides","params","contentType","acceptType","path","originMethod","type","url","getAptosFullNode","getAptosPepperService","paginateWithCursor","out","cursor","requestParams","response","paginateWithObfuscatedCursor","totalLimit","newCursor","getPageWithObfuscatedCursor","newLimit"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- export*from"./core";export*from"./get";export*from"./post";
1
+ import"../chunk-7ECCT6PK.mjs";import{a as c,b as d,c as e,d as f,e as g,f as h}from"../chunk-KB4XOTCR.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n}from"../chunk-3LJVXUPB.mjs";import{a,b}from"../chunk-CZDNBI5K.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-EMR3S3VO.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-GUPVZIYS.mjs";import"../chunk-KDMSOCZY.mjs";export{b as aptosRequest,c as get,d as getAptosFullNode,e as getAptosPepperService,h as getPageWithObfuscatedCursor,f as paginateWithCursor,g as paginateWithObfuscatedCursor,i as post,l as postAptosFaucet,j as postAptosFullNode,k as postAptosIndexer,m as postAptosPepperService,n as postAptosProvingService,a as request};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/index.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nexport * from \"./core\";\nexport * from \"./get\";\nexport * from \"./post\";\n"],"mappings":"AAGA,WAAc,SACd,WAAc,QACd,WAAc","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{aptosRequest as g}from"./core";import{AptosApiType as o}from"../utils/const";async function n(e){const{type:t,originMethod:s,path:i,body:r,acceptType:R,contentType:f,params:c,aptosConfig:p,overrides:A}=e,d=p.getRequestUrl(t);return g({url:d,method:"POST",originMethod:s,path:i,body:r,contentType:f,acceptType:R,params:c,overrides:A},p,e.type)}async function l(e){const{aptosConfig:t}=e;return n({...e,type:o.FULLNODE,overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function O(e){const{aptosConfig:t}=e;return n({...e,type:o.INDEXER,overrides:{...t.clientConfig,...t.indexerConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.indexerConfig?.HEADERS}}})}async function S(e){const{aptosConfig:t}=e,s={...t,clientConfig:{...t.clientConfig}};return delete s?.clientConfig?.API_KEY,n({...e,type:o.FAUCET,overrides:{...s.clientConfig,...s.faucetConfig,...e.overrides,HEADERS:{...s.clientConfig?.HEADERS,...s.faucetConfig?.HEADERS}}})}async function v(e){return n({...e,type:o.PEPPER})}async function D(e){return n({...e,type:o.PROVER})}export{n as post,S as postAptosFaucet,l as postAptosFullNode,O as postAptosIndexer,v as postAptosPepperService,D as postAptosProvingService};
1
+ import{a,b,c,d,e,f}from"../chunk-3LJVXUPB.mjs";import"../chunk-CZDNBI5K.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-EMR3S3VO.mjs";import"../chunk-OLILO7VD.mjs";import"../chunk-GUPVZIYS.mjs";import"../chunk-KDMSOCZY.mjs";export{a as post,d as postAptosFaucet,b as postAptosFullNode,c as postAptosIndexer,e as postAptosPepperService,f as postAptosProvingService};
2
2
  //# sourceMappingURL=post.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/client/post.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { AptosConfig } from \"../api/aptosConfig\";\nimport { aptosRequest } from \"./core\";\nimport { AptosResponse, AnyNumber, ClientConfig, MimeType } from \"../types\";\nimport { AptosApiType } from \"../utils/const\";\n\n/**\n * Options for making a POST request, including the API client configuration.\n * @group Implementation\n * @category Client\n */\nexport type PostRequestOptions = {\n /**\n * The config for the API client\n * @group Implementation\n * @category Client\n */\n aptosConfig: AptosConfig;\n /**\n * The type of API endpoint to call e.g. fullnode, indexer, etc\n * @group Implementation\n * @category Client\n */\n type: AptosApiType;\n /**\n * The name of the API method\n * @group Implementation\n * @category Client\n */\n originMethod: string;\n /**\n * The URL path to the API method\n * @group Implementation\n * @category Client\n */\n path: string;\n /**\n * The content type of the request body\n * @group Implementation\n * @category Client\n */\n contentType?: MimeType;\n /**\n * The accepted content type of the response of the API\n * @group Implementation\n * @category Client\n */\n acceptType?: MimeType;\n /**\n * The query parameters for the request\n * @group Implementation\n * @category Client\n */\n params?: Record<string, string | AnyNumber | boolean | undefined>;\n /**\n * The body of the request, should match the content type of the request\n * @group Implementation\n * @category Client\n */\n body?: any;\n /**\n * Specific client overrides for this request to override aptosConfig\n * @group Implementation\n * @category Client\n */\n overrides?: ClientConfig;\n};\n\n/**\n * Options for posting a request to Aptos, excluding the type field.\n * @group Implementation\n * @category Client\n */\nexport type PostAptosRequestOptions = Omit<PostRequestOptions, \"type\">;\n\n/**\n * Executes a POST request to the specified URL with the provided options.\n *\n * @param options - The options for the POST request.\n * @param options.type - The type of the request.\n * @param options.originMethod - The original method that initiated the request.\n * @param options.path - The path for the request.\n * @param options.body - The body content to be sent with the request.\n * @param options.acceptType - The type of response expected from the server.\n * @param options.contentType - The content type of the request body.\n * @param options.params - Additional parameters to include in the request.\n * @param options.aptosConfig - Configuration settings for the Aptos request.\n * @param options.overrides - Any overrides for the default request behavior.\n * @returns The response from the POST request.\n * @group Implementation\n * @category Client\n */\nexport async function post<Req extends {}, Res extends {}>(\n options: PostRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { type, originMethod, path, body, acceptType, contentType, params, aptosConfig, overrides } = options;\n const url = aptosConfig.getRequestUrl(type);\n\n return aptosRequest<Req, Res>(\n {\n url,\n method: \"POST\",\n originMethod,\n path,\n body,\n contentType,\n acceptType,\n params,\n overrides,\n },\n aptosConfig,\n options.type,\n );\n}\n\n/**\n * Sends a request to the Aptos full node using the specified options.\n * This function allows you to interact with the Aptos blockchain by sending requests to the full node.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - Configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - Client-specific configuration settings.\n * @param options.aptosConfig.fullnodeConfig - Full node-specific configuration settings.\n * @param options.overrides - Additional overrides for the request.\n * @group Implementation\n * @category Client\n */\nexport async function postAptosFullNode<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FULLNODE,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.fullnodeConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.fullnodeConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos indexer with the specified options.\n * This function allows you to interact with the Aptos indexer and customize the request using various configurations.\n *\n * @param options - The options for the request to the Aptos indexer.\n * @param options.aptosConfig - Configuration settings specific to the Aptos client and indexer.\n * @param options.aptosConfig.clientConfig - The client configuration settings.\n * @param options.aptosConfig.indexerConfig - The indexer configuration settings.\n * @param options.overrides - Additional overrides for the request.\n * @param options.overrides.HEADERS - Custom headers to include in the request.\n * @group Implementation\n * @category Client\n */\nexport async function postAptosIndexer<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.INDEXER,\n overrides: {\n ...aptosConfig.clientConfig,\n ...aptosConfig.indexerConfig,\n ...options.overrides,\n HEADERS: { ...aptosConfig.clientConfig?.HEADERS, ...aptosConfig.indexerConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Sends a request to the Aptos faucet to obtain test tokens.\n * This function modifies the provided configuration to ensure that the API_KEY is not included in the request.\n *\n * Note that only devnet has a publicly accessible faucet. For testnet, you must use\n * the minting page at https://aptos.dev/network/faucet.\n *\n * @param options - The options for the request.\n * @param options.aptosConfig - The configuration settings for the Aptos client.\n * @param options.aptosConfig.clientConfig - The client-specific configuration settings.\n * @param options.aptosConfig.clientConfig.HEADERS - Optional headers to include in the request.\n * @param options.aptosConfig.faucetConfig - The configuration settings specific to the faucet.\n * @param options.overrides - Additional overrides for the request configuration.\n * @group Implementation\n * @category Client\n */\nexport async function postAptosFaucet<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n const { aptosConfig } = options;\n // Faucet does not support API_KEY\n // Create a new object with the desired modification\n const modifiedAptosConfig = {\n ...aptosConfig,\n clientConfig: { ...aptosConfig.clientConfig },\n };\n // Delete API_KEY config\n delete modifiedAptosConfig?.clientConfig?.API_KEY;\n\n return post<Req, Res>({\n ...options,\n type: AptosApiType.FAUCET,\n overrides: {\n ...modifiedAptosConfig.clientConfig,\n ...modifiedAptosConfig.faucetConfig,\n ...options.overrides,\n HEADERS: { ...modifiedAptosConfig.clientConfig?.HEADERS, ...modifiedAptosConfig.faucetConfig?.HEADERS },\n },\n });\n}\n\n/**\n * Makes a post request to the pepper service.\n *\n * @param options - The options for the request.\n * @param options.url - The URL to which the request is sent.\n * @param options.headers - The headers to include in the request.\n * @param options.body - The body of the request.\n * @returns A promise that resolves to the response from the pepper service.\n * @group Implementation\n * @category Client\n */\nexport async function postAptosPepperService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PEPPER });\n}\n\n/**\n * Sends a request to the Aptos proving service with the specified options.\n *\n * @param options - The options for the request to the Aptos proving service.\n * @param options.type - The type of the request, which should be set to AptosApiType.PROVER.\n * @param options.data - The data to be included in the request.\n * @group Implementation\n * @category Client\n */\nexport async function postAptosProvingService<Req extends {}, Res extends {}>(\n options: PostAptosRequestOptions,\n): Promise<AptosResponse<Req, Res>> {\n return post<Req, Res>({ ...options, type: AptosApiType.PROVER });\n}\n"],"mappings":"AAIA,OAAS,gBAAAA,MAAoB,SAE7B,OAAS,gBAAAC,MAAoB,iBAwF7B,eAAsBC,EACpBC,EACkC,CAClC,KAAM,CAAE,KAAAC,EAAM,aAAAC,EAAc,KAAAC,EAAM,KAAAC,EAAM,WAAAC,EAAY,YAAAC,EAAa,OAAAC,EAAQ,YAAAC,EAAa,UAAAC,CAAU,EAAIT,EAC9FU,EAAMF,EAAY,cAAcP,CAAI,EAE1C,OAAOJ,EACL,CACE,IAAAa,EACA,OAAQ,OACR,aAAAR,EACA,KAAAC,EACA,KAAAC,EACA,YAAAE,EACA,WAAAD,EACA,OAAAE,EACA,UAAAE,CACF,EACAD,EACAR,EAAQ,IACV,CACF,CAcA,eAAsBW,EACpBX,EACkC,CAClC,KAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,KAAMF,EAAa,SACnB,UAAW,CACT,GAAGU,EAAY,aACf,GAAGA,EAAY,eACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,gBAAgB,OAAQ,CAC1F,CACF,CAAC,CACH,CAeA,eAAsBI,EACpBZ,EACkC,CAClC,KAAM,CAAE,YAAAQ,CAAY,EAAIR,EAExB,OAAOD,EAAe,CACpB,GAAGC,EACH,KAAMF,EAAa,QACnB,UAAW,CACT,GAAGU,EAAY,aACf,GAAGA,EAAY,cACf,GAAGR,EAAQ,UACX,QAAS,CAAE,GAAGQ,EAAY,cAAc,QAAS,GAAGA,EAAY,eAAe,OAAQ,CACzF,CACF,CAAC,CACH,CAkBA,eAAsBK,EACpBb,EACkC,CAClC,KAAM,CAAE,YAAAQ,CAAY,EAAIR,EAGlBc,EAAsB,CAC1B,GAAGN,EACH,aAAc,CAAE,GAAGA,EAAY,YAAa,CAC9C,EAEA,cAAOM,GAAqB,cAAc,QAEnCf,EAAe,CACpB,GAAGC,EACH,KAAMF,EAAa,OACnB,UAAW,CACT,GAAGgB,EAAoB,aACvB,GAAGA,EAAoB,aACvB,GAAGd,EAAQ,UACX,QAAS,CAAE,GAAGc,EAAoB,cAAc,QAAS,GAAGA,EAAoB,cAAc,OAAQ,CACxG,CACF,CAAC,CACH,CAaA,eAAsBC,EACpBf,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,KAAMF,EAAa,MAAO,CAAC,CACjE,CAWA,eAAsBkB,EACpBhB,EACkC,CAClC,OAAOD,EAAe,CAAE,GAAGC,EAAS,KAAMF,EAAa,MAAO,CAAC,CACjE","names":["aptosRequest","AptosApiType","post","options","type","originMethod","path","body","acceptType","contentType","params","aptosConfig","overrides","url","postAptosFullNode","postAptosIndexer","postAptosFaucet","modifiedAptosConfig","postAptosPepperService","postAptosProvingService"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,4 @@
1
- export { createObjectAddress, createResourceAddress, createTokenAddress, createUserDerivedObjectAddress } from './utils/address.mjs';
1
+ export { createObjectAddress, createResourceAddress, createTokenAddress } from './utils/address.mjs';
2
2
  import '../../account-BortO8g2.mjs';
3
3
  import '../../types/indexer.mjs';
4
4
  import '../../types/generated/operations.mjs';
@@ -1,2 +1,2 @@
1
- export*from"./utils";
1
+ import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import{a,b,c}from"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as createObjectAddress,b as createResourceAddress,c as createTokenAddress};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/account/index.ts"],"sourcesContent":["export * from \"./utils\";\n"],"mappings":"AAAA,WAAc","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -28,17 +28,6 @@ declare const createObjectAddress: (creatorAddress: AccountAddress, seed: Uint8A
28
28
  * @category Account (On-Chain Model)
29
29
  */
30
30
  declare const createResourceAddress: (creatorAddress: AccountAddress, seed: Uint8Array | string) => AccountAddress;
31
- /**
32
- * Creates a user derived object address from source address and derive_from address
33
- *
34
- * @param sourceAddress The source account address
35
- * @param deriveFromAddress The address to derive from
36
- *
37
- * @returns The user derived object address
38
- * @group Implementation
39
- * @category Account (On-Chain Model)
40
- */
41
- declare const createUserDerivedObjectAddress: (sourceAddress: AccountAddress, deriveFromAddress: AccountAddress) => AccountAddress;
42
31
  /**
43
32
  * Creates a token object address from creator address, collection name and token name
44
33
  *
@@ -52,4 +41,4 @@ declare const createUserDerivedObjectAddress: (sourceAddress: AccountAddress, de
52
41
  */
53
42
  declare const createTokenAddress: (creatorAddress: AccountAddress, collectionName: string, tokenName: string) => AccountAddress;
54
43
 
55
- export { createObjectAddress, createResourceAddress, createTokenAddress, createUserDerivedObjectAddress };
44
+ export { createObjectAddress, createResourceAddress, createTokenAddress };
@@ -1,2 +1,2 @@
1
- import{sha3_256 as o}from"@noble/hashes/sha3";import{AccountAddress as n}from"../../accountAddress";import{DeriveScheme as d}from"../../../types";const A=(r,e)=>{const s=r.bcsToBytes(),t=typeof e=="string"?Buffer.from(e,"utf8"):e,c=new Uint8Array([...s,...t,d.DeriveObjectAddressFromSeed]);return new n(o(c))},f=(r,e)=>{const s=r.bcsToBytes(),t=typeof e=="string"?Buffer.from(e,"utf8"):e,c=new Uint8Array([...s,...t,d.DeriveResourceAccountAddress]);return new n(o(c))},a=(r,e)=>{const s=r.bcsToBytes(),t=e.bcsToBytes(),c=new Uint8Array([...s,...t,d.DeriveObjectAddressFromObject]);return new n(o(c))},b=(r,e,s)=>{const t=`${e}::${s}`;return A(r,t)};export{A as createObjectAddress,f as createResourceAddress,b as createTokenAddress,a as createUserDerivedObjectAddress};
1
+ import{a,b,c}from"../../../chunk-HNBVYE3N.mjs";import"../../../chunk-RGKRCZ36.mjs";import"../../../chunk-FD6FGKYY.mjs";import"../../../chunk-4WPQQPUF.mjs";import"../../../chunk-MCFQE4GC.mjs";import"../../../chunk-EBMEXURY.mjs";import"../../../chunk-STY74NUA.mjs";import"../../../chunk-IF4UU2MT.mjs";import"../../../chunk-56CNRT2K.mjs";import"../../../chunk-KDMSOCZY.mjs";export{a as createObjectAddress,b as createResourceAddress,c as createTokenAddress};
2
2
  //# sourceMappingURL=address.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/core/account/utils/address.ts"],"sourcesContent":["import { sha3_256 } from \"@noble/hashes/sha3\";\nimport { AccountAddress } from \"../../accountAddress\";\nimport { DeriveScheme } from \"../../../types\";\n\n/**\n * Creates an object address from creator address and seed\n *\n * @param creatorAddress The object creator account address\n * @param seed The seed in either Uint8Array | string type\n *\n * @returns The object account address\n * @group Implementation\n * @category Account (On-Chain Model)\n */\nexport const createObjectAddress = (creatorAddress: AccountAddress, seed: Uint8Array | string): AccountAddress => {\n const creatorBytes = creatorAddress.bcsToBytes();\n\n const seedBytes = typeof seed === \"string\" ? Buffer.from(seed, \"utf8\") : seed;\n\n const bytes = new Uint8Array([...creatorBytes, ...seedBytes, DeriveScheme.DeriveObjectAddressFromSeed]);\n\n return new AccountAddress(sha3_256(bytes));\n};\n\n/**\n * Creates a resource address from creator address and seed\n *\n * @param creatorAddress The creator account address\n * @param seed The seed in either Uint8Array | string type\n *\n * @returns The resource account address\n * @group Implementation\n * @category Account (On-Chain Model)\n */\nexport const createResourceAddress = (creatorAddress: AccountAddress, seed: Uint8Array | string): AccountAddress => {\n const creatorBytes = creatorAddress.bcsToBytes();\n\n const seedBytes = typeof seed === \"string\" ? Buffer.from(seed, \"utf8\") : seed;\n\n const bytes = new Uint8Array([...creatorBytes, ...seedBytes, DeriveScheme.DeriveResourceAccountAddress]);\n\n return new AccountAddress(sha3_256(bytes));\n};\n\n/**\n * Creates a user derived object address from source address and derive_from address\n *\n * @param sourceAddress The source account address\n * @param deriveFromAddress The address to derive from\n *\n * @returns The user derived object address\n * @group Implementation\n * @category Account (On-Chain Model)\n */\nexport const createUserDerivedObjectAddress = (\n sourceAddress: AccountAddress,\n deriveFromAddress: AccountAddress,\n): AccountAddress => {\n const sourceBytes = sourceAddress.bcsToBytes();\n const deriveFromBytes = deriveFromAddress.bcsToBytes();\n\n const bytes = new Uint8Array([...sourceBytes, ...deriveFromBytes, DeriveScheme.DeriveObjectAddressFromObject]);\n\n return new AccountAddress(sha3_256(bytes));\n};\n\n/**\n * Creates a token object address from creator address, collection name and token name\n *\n * @param creatorAddress The token creator account address\n * @param collectionName The collection name\n * @param tokenName The token name\n *\n * @returns The token account address\n * @group Implementation\n * @category Account (On-Chain Model)\n */\nexport const createTokenAddress = (\n creatorAddress: AccountAddress,\n collectionName: string,\n tokenName: string,\n): AccountAddress => {\n const seed = `${collectionName}::${tokenName}`;\n return createObjectAddress(creatorAddress, seed);\n};\n"],"mappings":"AAAA,OAAS,YAAAA,MAAgB,qBACzB,OAAS,kBAAAC,MAAsB,uBAC/B,OAAS,gBAAAC,MAAoB,iBAYtB,MAAMC,EAAsB,CAACC,EAAgCC,IAA8C,CAChH,MAAMC,EAAeF,EAAe,WAAW,EAEzCG,EAAY,OAAOF,GAAS,SAAW,OAAO,KAAKA,EAAM,MAAM,EAAIA,EAEnEG,EAAQ,IAAI,WAAW,CAAC,GAAGF,EAAc,GAAGC,EAAWL,EAAa,2BAA2B,CAAC,EAEtG,OAAO,IAAID,EAAeD,EAASQ,CAAK,CAAC,CAC3C,EAYaC,EAAwB,CAACL,EAAgCC,IAA8C,CAClH,MAAMC,EAAeF,EAAe,WAAW,EAEzCG,EAAY,OAAOF,GAAS,SAAW,OAAO,KAAKA,EAAM,MAAM,EAAIA,EAEnEG,EAAQ,IAAI,WAAW,CAAC,GAAGF,EAAc,GAAGC,EAAWL,EAAa,4BAA4B,CAAC,EAEvG,OAAO,IAAID,EAAeD,EAASQ,CAAK,CAAC,CAC3C,EAYaE,EAAiC,CAC5CC,EACAC,IACmB,CACnB,MAAMC,EAAcF,EAAc,WAAW,EACvCG,EAAkBF,EAAkB,WAAW,EAE/CJ,EAAQ,IAAI,WAAW,CAAC,GAAGK,EAAa,GAAGC,EAAiBZ,EAAa,6BAA6B,CAAC,EAE7G,OAAO,IAAID,EAAeD,EAASQ,CAAK,CAAC,CAC3C,EAaaO,EAAqB,CAChCX,EACAY,EACAC,IACmB,CACnB,MAAMZ,EAAO,GAAGW,CAAc,KAAKC,CAAS,GAC5C,OAAOd,EAAoBC,EAAgBC,CAAI,CACjD","names":["sha3_256","AccountAddress","DeriveScheme","createObjectAddress","creatorAddress","seed","creatorBytes","seedBytes","bytes","createResourceAddress","createUserDerivedObjectAddress","sourceAddress","deriveFromAddress","sourceBytes","deriveFromBytes","createTokenAddress","collectionName","tokenName"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,4 @@
1
- export { createObjectAddress, createResourceAddress, createTokenAddress, createUserDerivedObjectAddress } from './address.mjs';
1
+ export { createObjectAddress, createResourceAddress, createTokenAddress } from './address.mjs';
2
2
  import '../../../account-BortO8g2.mjs';
3
3
  import '../../../types/indexer.mjs';
4
4
  import '../../../types/generated/operations.mjs';
@@ -1,2 +1,2 @@
1
- export*from"./address";
1
+ import"../../../chunk-4QMXOWHP.mjs";import{a,b,c}from"../../../chunk-HNBVYE3N.mjs";import"../../../chunk-RGKRCZ36.mjs";import"../../../chunk-FD6FGKYY.mjs";import"../../../chunk-4WPQQPUF.mjs";import"../../../chunk-MCFQE4GC.mjs";import"../../../chunk-EBMEXURY.mjs";import"../../../chunk-STY74NUA.mjs";import"../../../chunk-IF4UU2MT.mjs";import"../../../chunk-56CNRT2K.mjs";import"../../../chunk-KDMSOCZY.mjs";export{a as createObjectAddress,b as createResourceAddress,c as createTokenAddress};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../src/core/account/utils/index.ts"],"sourcesContent":["export * from \"./address\";\n"],"mappings":"AAAA,WAAc","names":[]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,4 +1,2 @@
1
- import{bytesToHex as a,hexToBytes as h}from"@noble/hashes/utils";import{Serializable as g}from"../bcs/serializer";import{ParsingError as i}from"./common";import{ScriptTransactionArgumentVariants as u}from"../types";var S=(s=>(s.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",s.INVALID_HEX_CHARS="invalid_hex_chars",s.TOO_SHORT="too_short",s.TOO_LONG="too_long",s.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",s.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",s.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",s.INVALID_PADDING_STRICTNESS="INVALID_PADDING_STRICTNESS",s))(S||{});const e=class e extends g{constructor(t){if(super(),t.length!==e.LENGTH)throw new i("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=t}isSpecial(){return this.data.slice(0,this.data.length-1).every(t=>t===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let t=a(this.data);return this.isSpecial()&&(t=t[t.length-1]),t}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return a(this.data)}toStringShort(){return`0x${this.toStringShortWithoutPrefix()}`}toStringShortWithoutPrefix(){const t=a(this.data).replace(/^0+/,"");return t===""?"0":t}toUint8Array(){return this.data}serialize(t){t.serializeFixedBytes(this.data)}serializeForEntryFunction(t){const r=this.bcsToBytes();t.serializeBytes(r)}serializeForScriptFunction(t){t.serializeU32AsUleb128(u.Address),t.serialize(this)}static deserialize(t){const r=t.deserializeFixedBytes(e.LENGTH);return new e(r)}static fromStringStrict(t){if(!t.startsWith("0x"))throw new i("Hex string must start with a leading 0x.","leading_zero_x_required");const r=e.fromString(t);if(t.length!==e.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(t.length!==3)throw new i(`The given hex string ${t} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new i(`The given hex string ${t} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(t,{maxMissingChars:r=4}={}){let n=t;if(t.startsWith("0x")&&(n=t.slice(2)),n.length===0)throw new i("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new i("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");if(r>63||r<0)throw new i(`maxMissingChars must be between or equal to 0 and 63. Received ${r}`,"INVALID_PADDING_STRICTNESS");let o;try{o=h(n.padStart(64,"0"))}catch(l){throw new i(`Hex characters are invalid: ${l?.message}`,"invalid_hex_chars")}const d=new e(o);if(n.length<64-r&&!d.isSpecial())throw new i(`Hex string is too short, must be ${64-r} to 64 chars long, excluding the leading 0x. You may need to fix
2
- the addresss by padding it with 0s before passing it to \`fromString\` (e.g. <addressString>.padStart(64, '0')).
3
- Received ${t}`,"too_short");return d}static from(t,{maxMissingChars:r=4}={}){return typeof t=="string"?e.fromString(t,{maxMissingChars:r}):t instanceof Uint8Array?new e(t):t}static fromStrict(t){return typeof t=="string"?e.fromStringStrict(t):t instanceof Uint8Array?new e(t):t}static isValid(t){try{return t.strict?e.fromStrict(t.input):e.from(t.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:r?.invalidReason,invalidReasonMessage:r?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((r,n)=>r===t.data[n])}};e.LENGTH=32,e.LONG_STRING_LENGTH=64,e.ZERO=e.from("0x0"),e.ONE=e.from("0x1"),e.TWO=e.from("0x2"),e.THREE=e.from("0x3"),e.FOUR=e.from("0x4"),e.A=e.from("0xA");let c=e;export{c as AccountAddress,S as AddressInvalidReason};
1
+ import{a,b}from"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{b as AccountAddress,a as AddressInvalidReason};
4
2
  //# sourceMappingURL=accountAddress.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 * Provides reasons for an address was invalid.\n * @group Implementation\n * @category Serialization\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 INVALID_PADDING_STRICTNESS = \"INVALID_PADDING_STRICTNESS\",\n}\n\n/**\n * The input for an account address, which can be either a hexadecimal string or a standard account address.\n * @group Implementation\n * @category Serialization\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 * @group Implementation\n * @category Serialization\n */\nexport class AccountAddress extends Serializable implements TransactionArgument {\n /**\n * This is the internal representation of an account address.\n * @group Implementation\n * @category Serialization\n */\n readonly data: Uint8Array;\n\n /**\n * The number of bytes that make up an account address.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The length of an address string in LONG form without a leading 0x.\n * @group Implementation\n * @category Serialization\n */\n static readonly LONG_STRING_LENGTH: number = 64;\n\n static ZERO: AccountAddress = AccountAddress.from(\"0x0\");\n\n static ONE: AccountAddress = AccountAddress.from(\"0x1\");\n\n static TWO: AccountAddress = AccountAddress.from(\"0x2\");\n\n static THREE: AccountAddress = AccountAddress.from(\"0x3\");\n\n static FOUR: AccountAddress = AccountAddress.from(\"0x4\");\n\n static A: AccountAddress = AccountAddress.from(\"0xA\");\n\n /**\n * Creates an instance of AccountAddress from a Uint8Array.\n *\n * This function ensures that the input data is exactly 32 bytes long, which is required for a valid account address.\n *\n * @param input A Uint8Array representing an account address.\n * @throws ParsingError if the input length is not equal to 32 bytes.\n * @group Implementation\n * @category Serialization\n */\n constructor(input: Uint8Array) {\n super();\n if (input.length !== AccountAddress.LENGTH) {\n throw new ParsingError(\n \"AccountAddress data should be exactly 32 bytes long\",\n AddressInvalidReason.INCORRECT_NUMBER_OF_BYTES,\n );\n }\n this.data = input;\n }\n\n /**\n * Determines if the address is classified as special, which is defined as 0x0 to 0xf inclusive.\n * In other words, the last byte of the address must be < 0b10000 (16)\n * and every other byte must be zero.\n *\n * For more information on how special addresses are defined, see AIP-40:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns true if the address is special, false otherwise.\n * @group Implementation\n * @category Serialization\n */\n isSpecial(): boolean {\n return (\n this.data.slice(0, this.data.length - 1).every((byte) => byte === 0) && this.data[this.data.length - 1] < 0b10000\n );\n }\n // ===\n // Methods for representing an instance of AccountAddress as other types.\n // ===\n\n /**\n * Return the AccountAddress as a string as per AIP-40.\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n * This representation returns special addresses in SHORT form (0xf)\n * and other addresses in LONG form (0x + 64 characters).\n *\n * @returns AccountAddress as a string conforming to AIP-40.\n * @group Implementation\n * @category Serialization\n */\n toString(): `0x${string}` {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n\n /**\n * Return the AccountAddress as a string conforming to AIP-40 but without the leading 0x.\n *\n * NOTE: Prefer to use `toString` where possible.\n *\n * @returns AccountAddress as a string without the leading 0x.\n * @group Implementation\n * @category Serialization\n */\n toStringWithoutPrefix(): string {\n let hex = bytesToHex(this.data);\n if (this.isSpecial()) {\n hex = hex[hex.length - 1];\n }\n return hex;\n }\n\n /**\n * Convert the account address to a string in LONG format, which is always 0x followed by 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns AccountAddress as a string in LONG form.\n * @group Implementation\n * @category Serialization\n */\n toStringLong(): `0x${string}` {\n return `0x${this.toStringLongWithoutPrefix()}`;\n }\n\n /**\n * Returns the account address as a string in LONG form without a leading 0x.\n * This function will include leading zeroes and will produce a string of 64 hex characters.\n *\n * NOTE: Prefer to use `toString` where possible, as it formats special addresses using the SHORT form (no leading 0s).\n *\n * @returns {string} The account address in LONG form.\n * @group Implementation\n * @category Serialization\n */\n toStringLongWithoutPrefix(): string {\n return bytesToHex(this.data);\n }\n\n /**\n * Convert the account address to a string in SHORT format, which is 0x followed by the shortest\n * possible representation (no leading zeros).\n *\n * @returns AccountAddress as a string in SHORT form.\n * @group Implementation\n * @category Serialization\n */\n toStringShort(): `0x${string}` {\n return `0x${this.toStringShortWithoutPrefix()}`;\n }\n\n /**\n * Returns a lossless short string representation of the address by trimming leading zeros.\n * If the address consists of all zeros, returns \"0\".\n *\n * @returns A string representation of the address without leading zeros\n * @group Implementation\n * @category Serialization\n */\n toStringShortWithoutPrefix(): string {\n const hex = bytesToHex(this.data).replace(/^0+/, \"\");\n return hex === \"\" ? \"0\" : hex;\n }\n\n /**\n * Get the inner data as a Uint8Array.\n * The inner data is already a Uint8Array, so no conversion takes place.\n *\n * @returns Hex data as Uint8Array\n * @group Implementation\n * @category Serialization\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 * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data);\n }\n\n /**\n * Serializes the current instance into a byte sequence suitable for entry functions.\n * This allows for the proper encoding of data when interacting with entry functions in the blockchain.\n *\n * @param serializer - The serializer instance used to convert the data into bytes.\n * @group Implementation\n * @category Serialization\n */\n serializeForEntryFunction(serializer: Serializer): void {\n const bcsBytes = this.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n\n /**\n * Serializes the current instance for use in a script function by encoding it into a byte sequence.\n * This process involves serializing the variant index and the instance data, making it suitable for transmission.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Serialization\n */\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Address);\n serializer.serialize(this);\n }\n\n /**\n * Deserialize an AccountAddress from the byte buffer in a Deserializer instance.\n * This function allows you to convert a byte representation of an AccountAddress into an instance of AccountAddress.\n * @param deserializer The deserializer to deserialize the AccountAddress from.\n * @returns An instance of AccountAddress.\n * @example\n * const bytes = hexToBytes(\"0x0102030405060708091011121314151617181920212223242526272829303132\");\n * const deserializer = new Deserializer(bytes);\n * const address = AccountAddress.deserialize(deserializer);\n * // `address` is now an instance of AccountAddress.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): AccountAddress {\n const bytes = deserializer.deserializeFixedBytes(AccountAddress.LENGTH);\n return new AccountAddress(bytes);\n }\n\n // ===\n // Methods for creating an instance of AccountAddress from other types.\n // ===\n\n /**\n * NOTE: This function has strict parsing behavior. For relaxed behavior, please use\n * the `fromString` function.\n *\n * Creates an instance of AccountAddress from a hex string.\n *\n * This function allows only the strictest formats defined by AIP-40. In short this\n * means only the following formats are accepted:\n *\n * - LONG\n * - SHORT for special addresses\n *\n * Where:\n * - LONG is defined as 0x + 64 hex characters.\n * - SHORT for special addresses is 0x0 to 0xf inclusive without padding zeroes.\n *\n * This means the following are not accepted:\n * - SHORT for non-special addresses.\n * - Any address without a leading 0x.\n *\n * @param input - A hex string representing an account address.\n *\n * @throws {ParsingError} If the hex string does not start with 0x or is not in a valid format.\n *\n * @remarks\n *\n * This function has strict parsing behavior. For relaxed behavior, please use the `fromString` function.\n *\n * @see AIP-40 documentation for more details on address formats:\n * https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-40.md.\n *\n * @returns An instance of AccountAddress.\n * @group Implementation\n * @category Serialization\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`.\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. The address can have missing values up to `maxMissingChars` before it is padded.\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 * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.\n *\n * @returns An instance of AccountAddress.\n *\n * @throws ParsingError if the hex string is too short, too long, or contains invalid characters.\n * @group Implementation\n * @category Serialization\n */\n static fromString(input: string, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): 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 // Ensure that the maxMissingChars is between or equal to 0 and 63.\n if (maxMissingChars > 63 || maxMissingChars < 0) {\n throw new ParsingError(\n `maxMissingChars must be between or equal to 0 and 63. Received ${maxMissingChars}`,\n AddressInvalidReason.INVALID_PADDING_STRICTNESS,\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 const address = new AccountAddress(addressBytes);\n\n // Cannot pad the address if it has more than maxMissingChars missing.\n if (parsedInput.length < 64 - maxMissingChars) {\n if (!address.isSpecial()) {\n throw new ParsingError(\n `Hex string is too short, must be ${64 - maxMissingChars} to 64 chars long, excluding the leading 0x. You may need to fix \nthe addresss by padding it with 0s before passing it to \\`fromString\\` (e.g. <addressString>.padStart(64, '0')). \nReceived ${input}`,\n AddressInvalidReason.TOO_SHORT,\n );\n }\n }\n\n return address;\n }\n\n /**\n * Convenience method for creating an AccountAddress from various input types.\n * This function accepts a string, Uint8Array, or an existing AccountAddress instance and returns the corresponding\n * AccountAddress.\n *\n * @param input - The input to convert into an AccountAddress. This can be a string representation of an address, a Uint8Array,\n * or an existing AccountAddress.\n * @param args.maxMissingChars The number of characters that can be missing in a padded address before it is invalid.\n * @group Implementation\n * @category Serialization\n */\n static from(input: AccountAddressInput, { maxMissingChars = 4 }: { maxMissingChars?: number } = {}): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromString(input, { maxMissingChars });\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n\n /**\n * Create an AccountAddress from various input types, including strings, Uint8Array, and AccountAddress instances.\n *\n * @param input - The input to convert into an AccountAddress, which can be a string, a Uint8Array, or an AccountAddress.\n * @group Implementation\n * @category Serialization\n */\n static fromStrict(input: AccountAddressInput): AccountAddress {\n if (typeof input === \"string\") {\n return AccountAddress.fromStringStrict(input);\n }\n if (input instanceof Uint8Array) {\n return new AccountAddress(input);\n }\n return input;\n }\n // ===\n // Methods for checking validity.\n // ===\n\n /**\n * Check if the provided input is a valid AccountAddress.\n *\n * @param args - The arguments for validation.\n * @param args.input - A hex string representing an account address.\n * @param args.strict - If true, use strict parsing behavior; if false, use relaxed parsing behavior.\n *\n * @returns An object indicating whether the address is valid. If valid, valid = true; if not, valid = false with additional details.\n * If the address is invalid, invalidReason will explain why it is invalid, and invalidReasonMessage will provide the error message.\n * @group Implementation\n * @category Serialization\n */\n static isValid(args: { input: AccountAddressInput; strict?: boolean }): ParsingResult<AddressInvalidReason> {\n try {\n if (args.strict) {\n AccountAddress.fromStrict(args.input);\n } else {\n AccountAddress.from(args.input);\n }\n return { valid: true };\n } catch (error: any) {\n return {\n valid: false,\n invalidReason: error?.invalidReason,\n invalidReasonMessage: error?.message,\n };\n }\n }\n\n /**\n * Determine if two AccountAddresses are equal based on their underlying byte data.\n *\n * @param other - The AccountAddress to compare to.\n * @returns true if the AccountAddresses are equal, false if not.\n * @group Implementation\n * @category Serialization\n */\n equals(other: AccountAddress): boolean {\n if (this.data.length !== other.data.length) return false;\n return this.data.every((value, index) => value === other.data[index]);\n }\n}\n"],"mappings":"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","names":["bytesToHex","hexToBytes","Serializable","ParsingError","ScriptTransactionArgumentVariants","AddressInvalidReason","_AccountAddress","input","byte","hex","serializer","bcsBytes","deserializer","bytes","address","maxMissingChars","parsedInput","addressBytes","error","args","other","value","index","AccountAddress"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{sha3_256 as h}from"@noble/hashes/sha3";import{AccountAddress as y}from"./accountAddress";import{Hex as a}from"./hex";import{Serializable as d}from"../bcs/serializer";const r=class r extends d{constructor(t){super();const{data:e}=t,i=a.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){const e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){const{scheme:e,input:i}=t,c=a.fromHexInput(i).toUint8Array(),s=new Uint8Array([...c,e]),n=h.create();n.update(s);const u=n.digest();return new r({data:u})}static fromPublicKeyAndScheme(t){const{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){const{publicKey:e}=t;return e.authKey()}derivedAddress(){return new y(this.data.toUint8Array())}};r.LENGTH=32;let o=r;export{o as AuthenticationKey};
1
+ import{a}from"../chunk-FGFLPH5K.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-MCFQE4GC.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{a as AuthenticationKey};
2
2
  //# sourceMappingURL=authenticationKey.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/authenticationKey.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 as sha3Hash } from \"@noble/hashes/sha3\";\nimport { AccountAddress } from \"./accountAddress\";\nimport type { AccountPublicKey } from \"./crypto\";\nimport { Hex } from \"./hex\";\nimport { AuthenticationKeyScheme, HexInput } from \"../types\";\nimport { Serializable, Serializer } from \"../bcs/serializer\";\nimport { Deserializer } from \"../bcs/deserializer\";\n\n/**\n * Represents an authentication key used for account management. Each account stores an authentication key that enables account\n * owners to rotate their private key(s) without changing the address that hosts their account. The authentication key is a\n * SHA3-256 hash of data and is always 32 bytes in length.\n *\n * @see {@link https://aptos.dev/concepts/accounts | Account Basics}\n *\n * Account addresses can be derived from the AuthenticationKey.\n * @group Implementation\n * @category Serialization\n */\nexport class AuthenticationKey extends Serializable {\n /**\n * An authentication key is always a SHA3-256 hash of data, and is always 32 bytes.\n *\n * The data to hash depends on the underlying public key type and the derivation scheme.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The raw bytes of the authentication key.\n * @group Implementation\n * @category Serialization\n */\n public readonly data: Hex;\n\n /**\n * Creates an instance of the AuthenticationKey using the provided hex input.\n * This ensures that the hex input is valid and conforms to the required length for an Authentication Key.\n *\n * @param args - The arguments for constructing the AuthenticationKey.\n * @param args.data - The hex input data to be used for the Authentication Key.\n * @throws {Error} Throws an error if the length of the provided hex input is not equal to the required Authentication Key\n * length.\n * @group Implementation\n * @category Serialization\n */\n constructor(args: { data: HexInput }) {\n super();\n const { data } = args;\n const hex = Hex.fromHexInput(data);\n if (hex.toUint8Array().length !== AuthenticationKey.LENGTH) {\n throw new Error(`Authentication Key length should be ${AuthenticationKey.LENGTH}`);\n }\n this.data = hex;\n }\n\n /**\n * Serializes the fixed bytes data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to perform the serialization.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeFixedBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserialize an AuthenticationKey from the byte buffer in a Deserializer instance.\n * @param deserializer - The deserializer to deserialize the AuthenticationKey from.\n * @returns An instance of AuthenticationKey.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): AuthenticationKey {\n const bytes = deserializer.deserializeFixedBytes(AuthenticationKey.LENGTH);\n return new AuthenticationKey({ data: bytes });\n }\n\n /**\n * Convert the internal data representation to a Uint8Array.\n *\n * This function is useful for obtaining a byte representation of the data, which can be utilized for serialization or transmission.\n *\n * @returns Uint8Array representation of the internal data.\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n /**\n * Generates an AuthenticationKey from the specified scheme and input bytes.\n * This function is essential for creating a valid authentication key based on a given scheme.\n *\n * @param args - The arguments for generating the AuthenticationKey.\n * @param args.scheme - The authentication key scheme to use.\n * @param args.input - The input data in hexadecimal format to derive the key.\n * @returns An instance of AuthenticationKey containing the generated key data.\n * @group Implementation\n * @category Serialization\n */\n static fromSchemeAndBytes(args: { scheme: AuthenticationKeyScheme; input: HexInput }): AuthenticationKey {\n const { scheme, input } = args;\n const inputBytes = Hex.fromHexInput(input).toUint8Array();\n const hashInput = new Uint8Array([...inputBytes, scheme]);\n const hash = sha3Hash.create();\n hash.update(hashInput);\n const hashDigest = hash.digest();\n return new AuthenticationKey({ data: hashDigest });\n }\n\n /**\n * Derives an AuthenticationKey from the provided public key using a specified derivation scheme.\n *\n * @deprecated Use `fromPublicKey` instead.\n * @param args - The arguments for deriving the authentication key.\n * @param args.publicKey - The public key used for the derivation.\n * @param args.scheme - The scheme to use for deriving the authentication key.\n * @group Implementation\n * @category Serialization\n */\n public static fromPublicKeyAndScheme(args: { publicKey: AccountPublicKey; scheme: AuthenticationKeyScheme }) {\n const { publicKey } = args;\n return publicKey.authKey();\n }\n\n /**\n * Converts a PublicKey to an AuthenticationKey using the derivation scheme inferred from the provided PublicKey instance.\n *\n * @param args - The arguments for the function.\n * @param args.publicKey - The PublicKey to be converted.\n * @returns AuthenticationKey - The derived AuthenticationKey.\n * @group Implementation\n * @category Serialization\n */\n static fromPublicKey(args: { publicKey: AccountPublicKey }): AuthenticationKey {\n const { publicKey } = args;\n return publicKey.authKey();\n }\n\n /**\n * Derives an account address from an AuthenticationKey by translating the AuthenticationKey bytes directly to an AccountAddress.\n *\n * @returns AccountAddress - The derived account address.\n * @group Implementation\n * @category Serialization\n */\n derivedAddress(): AccountAddress {\n return new AccountAddress(this.data.toUint8Array());\n }\n}\n"],"mappings":"AAGA,OAAS,YAAYA,MAAgB,qBACrC,OAAS,kBAAAC,MAAsB,mBAE/B,OAAS,OAAAC,MAAW,QAEpB,OAAS,gBAAAC,MAAgC,oBAclC,MAAMC,EAAN,MAAMA,UAA0BD,CAAa,CA4BlD,YAAYE,EAA0B,CACpC,MAAM,EACN,KAAM,CAAE,KAAAC,CAAK,EAAID,EACXE,EAAML,EAAI,aAAaI,CAAI,EACjC,GAAIC,EAAI,aAAa,EAAE,SAAWH,EAAkB,OAClD,MAAM,IAAI,MAAM,uCAAuCA,EAAkB,MAAM,EAAE,EAEnF,KAAK,KAAOG,CACd,CASA,UAAUC,EAA8B,CACtCA,EAAW,oBAAoB,KAAK,KAAK,aAAa,CAAC,CACzD,CASA,OAAO,YAAYC,EAA+C,CAChE,MAAMC,EAAQD,EAAa,sBAAsBL,EAAkB,MAAM,EACzE,OAAO,IAAIA,EAAkB,CAAE,KAAMM,CAAM,CAAC,CAC9C,CAWA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CAaA,OAAO,mBAAmBL,EAA+E,CACvG,KAAM,CAAE,OAAAM,EAAQ,MAAAC,CAAM,EAAIP,EACpBQ,EAAaX,EAAI,aAAaU,CAAK,EAAE,aAAa,EAClDE,EAAY,IAAI,WAAW,CAAC,GAAGD,EAAYF,CAAM,CAAC,EAClDI,EAAOf,EAAS,OAAO,EAC7Be,EAAK,OAAOD,CAAS,EACrB,MAAME,EAAaD,EAAK,OAAO,EAC/B,OAAO,IAAIX,EAAkB,CAAE,KAAMY,CAAW,CAAC,CACnD,CAYA,OAAc,uBAAuBX,EAAwE,CAC3G,KAAM,CAAE,UAAAY,CAAU,EAAIZ,EACtB,OAAOY,EAAU,QAAQ,CAC3B,CAWA,OAAO,cAAcZ,EAA0D,CAC7E,KAAM,CAAE,UAAAY,CAAU,EAAIZ,EACtB,OAAOY,EAAU,QAAQ,CAC3B,CASA,gBAAiC,CAC/B,OAAO,IAAIhB,EAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CACF,EAtIaG,EAQK,OAAiB,GAR5B,IAAMc,EAANd","names":["sha3Hash","AccountAddress","Hex","Serializable","_AuthenticationKey","args","data","hex","serializer","deserializer","bytes","scheme","input","inputBytes","hashInput","hash","hashDigest","publicKey","AuthenticationKey"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- class r extends Error{constructor(s,i){super(s),this.invalidReason=i}}export{r as ParsingError};
1
+ import{a}from"../chunk-IF4UU2MT.mjs";import"../chunk-KDMSOCZY.mjs";export{a as ParsingError};
2
2
  //# sourceMappingURL=common.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/common.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * This error is used to explain why parsing failed.\n * @group Implementation\n * @category Serialization\n */\nexport class ParsingError<T> extends Error {\n /**\n * This provides a programmatic way to access why parsing failed. Downstream devs\n * might want to use this to build their own error messages if the default error\n * messages are not suitable for their use case. This should be an enum.\n * @group Implementation\n * @category Serialization\n */\n public invalidReason: T;\n\n /**\n * Creates an instance of the error with a specified message and invalid reason.\n *\n * @param message The error message that describes the issue.\n * @param invalidReason The reason why the input is considered invalid.\n * @group Implementation\n * @category Serialization\n */\n constructor(message: string, invalidReason: T) {\n super(message);\n this.invalidReason = invalidReason;\n }\n}\n\n/**\n * Whereas ParsingError is thrown when parsing fails, e.g. in a fromString function,\n * this type is returned from \"defensive\" functions like isValid.\n * @group Implementation\n * @category Serialization\n */\nexport type ParsingResult<T> = {\n /**\n * True if valid, false otherwise.\n * @group Implementation\n * @category Serialization\n */\n valid: boolean;\n\n /**\n * If valid is false, this will be a code explaining why parsing failed.\n * @group Implementation\n * @category Serialization\n */\n invalidReason?: T;\n\n /**\n * If valid is false, this will be a string explaining why parsing failed.\n * @group Implementation\n * @category Serialization\n */\n invalidReasonMessage?: string;\n};\n"],"mappings":"AAQO,MAAMA,UAAwB,KAAM,CAkBzC,YAAYC,EAAiBC,EAAkB,CAC7C,MAAMD,CAAO,EACb,KAAK,cAAgBC,CACvB,CACF","names":["ParsingError","message","invalidReason"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{AuthenticationKey as t}from"../authenticationKey";import{Hex as i}from"../hex";import{AccountPublicKey as s}from"./publicKey";import{Signature as n}from"./signature";class e extends n{constructor(r){super(),this.value=i.fromHexInput(r).toUint8Array()}serialize(r){r.serializeBytes(this.value)}static deserialize(r){return new e(r.deserializeBytes())}}class z extends s{constructor(r){super(),this.accountAddress=r}authKey(){return new t({data:this.accountAddress.toUint8Array()})}verifySignature(r){throw new Error("This function is not implemented for AbstractPublicKey.")}async verifySignatureAsync(r){throw new Error("This function is not implemented for AbstractPublicKey.")}serialize(r){throw new Error("This function is not implemented for AbstractPublicKey.")}}export{z as AbstractPublicKey,e as AbstractSignature};
1
+ import{a,b}from"../../chunk-EF4FA5I6.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{b as AbstractPublicKey,a as AbstractSignature};
2
2
  //# sourceMappingURL=abstraction.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/crypto/abstraction.ts"],"sourcesContent":["import { Deserializer, Serializer } from \"../../bcs\";\nimport { HexInput } from \"../../types\";\nimport { AccountAddress } from \"../accountAddress\";\nimport { AuthenticationKey } from \"../authenticationKey\";\nimport { Hex } from \"../hex\";\nimport { AccountPublicKey, VerifySignatureArgs, VerifySignatureAsyncArgs } from \"./publicKey\";\nimport { Signature } from \"./signature\";\n\nexport class AbstractSignature extends Signature {\n readonly value: Uint8Array;\n\n constructor(value: HexInput) {\n super();\n this.value = Hex.fromHexInput(value).toUint8Array();\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.value);\n }\n\n static deserialize(deserializer: Deserializer): AbstractSignature {\n return new AbstractSignature(deserializer.deserializeBytes());\n }\n}\n\nexport class AbstractPublicKey extends AccountPublicKey {\n readonly accountAddress: AccountAddress;\n\n constructor(accountAddress: AccountAddress) {\n super();\n this.accountAddress = accountAddress;\n }\n\n authKey(): AuthenticationKey {\n return new AuthenticationKey({ data: this.accountAddress.toUint8Array() });\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n verifySignature(args: VerifySignatureArgs): boolean {\n throw new Error(\"This function is not implemented for AbstractPublicKey.\");\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {\n throw new Error(\"This function is not implemented for AbstractPublicKey.\");\n }\n\n // eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars\n serialize(serializer: Serializer): void {\n throw new Error(\"This function is not implemented for AbstractPublicKey.\");\n }\n}\n"],"mappings":"AAGA,OAAS,qBAAAA,MAAyB,uBAClC,OAAS,OAAAC,MAAW,SACpB,OAAS,oBAAAC,MAAuE,cAChF,OAAS,aAAAC,MAAiB,cAEnB,MAAMC,UAA0BD,CAAU,CAG/C,YAAYE,EAAiB,CAC3B,MAAM,EACN,KAAK,MAAQJ,EAAI,aAAaI,CAAK,EAAE,aAAa,CACpD,CAEA,UAAUC,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,CACtC,CAEA,OAAO,YAAYC,EAA+C,CAChE,OAAO,IAAIH,EAAkBG,EAAa,iBAAiB,CAAC,CAC9D,CACF,CAEO,MAAMC,UAA0BN,CAAiB,CAGtD,YAAYO,EAAgC,CAC1C,MAAM,EACN,KAAK,eAAiBA,CACxB,CAEA,SAA6B,CAC3B,OAAO,IAAIT,EAAkB,CAAE,KAAM,KAAK,eAAe,aAAa,CAAE,CAAC,CAC3E,CAGA,gBAAgBU,EAAoC,CAClD,MAAM,IAAI,MAAM,yDAAyD,CAC3E,CAGA,MAAM,qBAAqBA,EAAkD,CAC3E,MAAM,IAAI,MAAM,yDAAyD,CAC3E,CAGA,UAAUJ,EAA8B,CACtC,MAAM,IAAI,MAAM,yDAAyD,CAC3E,CACF","names":["AuthenticationKey","Hex","AccountPublicKey","Signature","AbstractSignature","value","serializer","deserializer","AbstractPublicKey","accountAddress","args"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{AnyPublicKey as l,Ed25519PublicKey as a,MultiKey as c,KeylessPublicKey as d,MultiEd25519PublicKey as y,FederatedKeylessPublicKey as f,Secp256k1PublicKey as p,Ed25519Signature as S,Secp256k1Signature as K,KeylessSignature as g,AnySignature as E,MultiEd25519Signature as b,MultiKeySignature as P}from"..";import{Deserializer as u}from"../../bcs/deserializer";const t="Multiple possible deserializations found";function M(i){const n=[a,l,y,c,d,f,p];let r;for(const s of n)try{const e=u.fromHex(i),o=s.deserialize(e);if(e.assertFinished(),r)throw new Error(`${t}: ${i}`);r=o}catch(e){if(e instanceof Error&&e.message.includes(t))throw e}if(!r)throw new Error(`Failed to deserialize public key: ${i}`);return r}function T(i){const n=[S,E,b,P,g,K];let r;for(const s of n)try{const e=u.fromHex(i),o=s.deserialize(e);if(e.assertFinished(),r)throw new Error(`${t}: ${i}`);r=o}catch(e){if(e instanceof Error&&e.message.includes(t))throw e}if(!r)throw new Error(`Failed to deserialize signature: ${i}`);return r}export{M as deserializePublicKey,T as deserializeSignature};
1
+ import{T as a,U as b}from"../../chunk-PGUSBALH.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-V74WPKSY.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-O26BHE5H.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-I7XT6L7S.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-2PASUPUO.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ZP4DWSQA.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-ADJMFL73.mjs";import"../../chunk-TT3MPSBB.mjs";import"../../chunk-TSEAIF34.mjs";import"../../chunk-57YZ7I7V.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-DHCGYW3W.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-KB4XOTCR.mjs";import"../../chunk-3LJVXUPB.mjs";import"../../chunk-CZDNBI5K.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-7ZESTCBD.mjs";import"../../chunk-EMR3S3VO.mjs";import"../../chunk-OLILO7VD.mjs";import"../../chunk-GUPVZIYS.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as deserializePublicKey,b as deserializeSignature};
2
2
  //# sourceMappingURL=deserializationUtils.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/core/crypto/deserializationUtils.ts"],"sourcesContent":["import {\n AnyPublicKey,\n Ed25519PublicKey,\n MultiKey,\n KeylessPublicKey,\n MultiEd25519PublicKey,\n FederatedKeylessPublicKey,\n Secp256k1PublicKey,\n Signature,\n PublicKey,\n Ed25519Signature,\n Secp256k1Signature,\n KeylessSignature,\n AnySignature,\n MultiEd25519Signature,\n MultiKeySignature,\n} from \"..\";\nimport { Deserializer } from \"../../bcs/deserializer\";\nimport { HexInput } from \"../../types\";\n\nconst MULTIPLE_DESERIALIZATIONS_ERROR_MSG = \"Multiple possible deserializations found\";\n\n/**\n * Deserializes a public key from a hex string.\n * Attempts to deserialize using various public key types in sequence until one succeeds.\n *\n * @param publicKey - The hex string representation of the public key to deserialize\n * @returns The deserialized public key\n * @throws Error if deserialization fails for all supported key types or if multiple deserializations are found\n */\nexport function deserializePublicKey(publicKey: HexInput): PublicKey {\n const publicKeyTypes = [\n Ed25519PublicKey,\n AnyPublicKey,\n MultiEd25519PublicKey,\n MultiKey,\n KeylessPublicKey,\n FederatedKeylessPublicKey,\n Secp256k1PublicKey,\n ];\n\n let result: PublicKey | undefined;\n for (const KeyType of publicKeyTypes) {\n try {\n const deserializer = Deserializer.fromHex(publicKey);\n const key = KeyType.deserialize(deserializer);\n deserializer.assertFinished();\n if (result) {\n throw new Error(`${MULTIPLE_DESERIALIZATIONS_ERROR_MSG}: ${publicKey}`);\n }\n result = key;\n } catch (error) {\n if (error instanceof Error && error.message.includes(MULTIPLE_DESERIALIZATIONS_ERROR_MSG)) {\n throw error;\n }\n }\n }\n\n if (!result) {\n throw new Error(`Failed to deserialize public key: ${publicKey}`);\n }\n\n return result;\n}\n\n/**\n * Deserializes a signature from a hex string.\n * Attempts to deserialize using various signature types in sequence until one succeeds.\n *\n * @param signature - The hex string representation of the signature to deserialize\n * @returns The deserialized signature\n * @throws Error if deserialization fails for all supported signature types or if multiple deserializations are found\n */\nexport function deserializeSignature(signature: HexInput): Signature {\n const signatureTypes = [\n Ed25519Signature,\n AnySignature,\n MultiEd25519Signature,\n MultiKeySignature,\n KeylessSignature,\n Secp256k1Signature,\n ];\n\n let result: Signature | undefined;\n for (const SignatureType of signatureTypes) {\n try {\n const deserializer = Deserializer.fromHex(signature);\n const sig = SignatureType.deserialize(deserializer);\n deserializer.assertFinished();\n if (result) {\n throw new Error(`${MULTIPLE_DESERIALIZATIONS_ERROR_MSG}: ${signature}`);\n }\n result = sig;\n } catch (error) {\n if (error instanceof Error && error.message.includes(MULTIPLE_DESERIALIZATIONS_ERROR_MSG)) {\n throw error;\n }\n }\n }\n\n if (!result) {\n throw new Error(`Failed to deserialize signature: ${signature}`);\n }\n\n return result;\n}\n"],"mappings":"AAAA,OACE,gBAAAA,EACA,oBAAAC,EACA,YAAAC,EACA,oBAAAC,EACA,yBAAAC,EACA,6BAAAC,EACA,sBAAAC,EAGA,oBAAAC,EACA,sBAAAC,EACA,oBAAAC,EACA,gBAAAC,EACA,yBAAAC,EACA,qBAAAC,MACK,KACP,OAAS,gBAAAC,MAAoB,yBAG7B,MAAMC,EAAsC,2CAUrC,SAASC,EAAqBC,EAAgC,CACnE,MAAMC,EAAiB,CACrBhB,EACAD,EACAI,EACAF,EACAC,EACAE,EACAC,CACF,EAEA,IAAIY,EACJ,UAAWC,KAAWF,EACpB,GAAI,CACF,MAAMG,EAAeP,EAAa,QAAQG,CAAS,EAC7CK,EAAMF,EAAQ,YAAYC,CAAY,EAE5C,GADAA,EAAa,eAAe,EACxBF,EACF,MAAM,IAAI,MAAM,GAAGJ,CAAmC,KAAKE,CAAS,EAAE,EAExEE,EAASG,CACX,OAASC,EAAO,CACd,GAAIA,aAAiB,OAASA,EAAM,QAAQ,SAASR,CAAmC,EACtF,MAAMQ,CAEV,CAGF,GAAI,CAACJ,EACH,MAAM,IAAI,MAAM,qCAAqCF,CAAS,EAAE,EAGlE,OAAOE,CACT,CAUO,SAASK,EAAqBC,EAAgC,CACnE,MAAMC,EAAiB,CACrBlB,EACAG,EACAC,EACAC,EACAH,EACAD,CACF,EAEA,IAAIU,EACJ,UAAWQ,KAAiBD,EAC1B,GAAI,CACF,MAAML,EAAeP,EAAa,QAAQW,CAAS,EAC7CG,EAAMD,EAAc,YAAYN,CAAY,EAElD,GADAA,EAAa,eAAe,EACxBF,EACF,MAAM,IAAI,MAAM,GAAGJ,CAAmC,KAAKU,CAAS,EAAE,EAExEN,EAASS,CACX,OAASL,EAAO,CACd,GAAIA,aAAiB,OAASA,EAAM,QAAQ,SAASR,CAAmC,EACtF,MAAMQ,CAEV,CAGF,GAAI,CAACJ,EACH,MAAM,IAAI,MAAM,oCAAoCM,CAAS,EAAE,EAGjE,OAAON,CACT","names":["AnyPublicKey","Ed25519PublicKey","MultiKey","KeylessPublicKey","MultiEd25519PublicKey","FederatedKeylessPublicKey","Secp256k1PublicKey","Ed25519Signature","Secp256k1Signature","KeylessSignature","AnySignature","MultiEd25519Signature","MultiKeySignature","Deserializer","MULTIPLE_DESERIALIZATIONS_ERROR_MSG","deserializePublicKey","publicKey","publicKeyTypes","result","KeyType","deserializer","key","error","deserializeSignature","signature","signatureTypes","SignatureType","sig"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,2 +1,2 @@
1
- import{ed25519 as o}from"@noble/curves/ed25519";import{Serializable as v}from"../../bcs/serializer";import{AuthenticationKey as P}from"../authenticationKey";import{Hex as y}from"../hex";import{SigningScheme as E,PrivateKeyVariants as f}from"../../types";import{CKDPriv as H,deriveKey as b,HARDENED_OFFSET as U,isValidHardenedPath as z,mnemonicToSeed as I,splitPath as w}from"./hdKey";import{PrivateKey as h}from"./privateKey";import{AccountPublicKey as T}from"./publicKey";import{Signature as L}from"./signature";import{convertSigningMessage as p}from"./utils";const x=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function B(K){const e=K.toUint8Array().slice(32);for(let t=x.length-1;t>=0;t-=1){if(e[t]<x[t])return!0;if(e[t]>x[t])return!1}return!1}const n=class n extends T{constructor(e){super();const t=y.fromHexInput(e);if(t.toUint8Array().length!==n.LENGTH)throw new Error(`PublicKey length should be ${n.LENGTH}`);this.key=t}verifySignature(e){const{message:t,signature:i}=e;if(!B(i))return!1;const a=p(t),u=y.fromHexInput(a).toUint8Array(),c=i.toUint8Array(),l=this.key.toUint8Array();return o.verify(c,u,l)}async verifySignatureAsync(e){return this.verifySignature(e)}authKey(){return P.fromSchemeAndBytes({scheme:E.Ed25519,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){const t=e.deserializeBytes();return new n(t)}static isPublicKey(e){return e instanceof n}static isInstance(e){return"key"in e&&e.key?.data?.length===n.LENGTH}};n.LENGTH=32;let d=n;const r=class r extends v{constructor(e,t){super();const i=h.parseHexInput(e,f.Ed25519,t);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`PrivateKey length should be ${r.LENGTH}`);this.signingKey=i}static generate(){const e=o.utils.randomPrivateKey();return new r(e,!1)}static fromDerivationPath(e,t){if(!z(e))throw new Error(`Invalid derivation path ${e}`);return r.fromDerivationPathInner(e,I(t))}static fromDerivationPathInner(e,t,i=U){const{key:a,chainCode:u}=b(r.SLIP_0010_SEED,t),c=w(e).map(g=>parseInt(g,10)),{key:l}=c.reduce((g,S)=>H(g,S+i),{key:a,chainCode:u});return new r(l,!1)}publicKey(){const e=o.getPublicKey(this.signingKey.toUint8Array());return new d(e)}sign(e){const t=p(e),i=y.fromHexInput(t).toUint8Array(),a=o.sign(i,this.signingKey.toUint8Array());return new m(a)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.signingKey.toString()}toAIP80String(){return h.formatPrivateKey(this.signingKey.toString(),f.Ed25519)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){const t=e.deserializeBytes();return new r(t,!1)}static isPrivateKey(e){return e instanceof r}};r.LENGTH=32,r.SLIP_0010_SEED="ed25519 seed";let A=r;const s=class s extends L{constructor(e){super();const t=y.fromHexInput(e);if(t.toUint8Array().length!==s.LENGTH)throw new Error(`Signature length should be ${s.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){const t=e.deserializeBytes();return new s(t)}};s.LENGTH=64;let m=s;export{A as Ed25519PrivateKey,d as Ed25519PublicKey,m as Ed25519Signature,B as isCanonicalEd25519Signature};
1
+ import{P as a,Q as b,R as c,S as d}from"../../chunk-PGUSBALH.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-V74WPKSY.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-O26BHE5H.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-I7XT6L7S.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-2PASUPUO.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ZP4DWSQA.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-ADJMFL73.mjs";import"../../chunk-TT3MPSBB.mjs";import"../../chunk-TSEAIF34.mjs";import"../../chunk-57YZ7I7V.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-DHCGYW3W.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-KB4XOTCR.mjs";import"../../chunk-3LJVXUPB.mjs";import"../../chunk-CZDNBI5K.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-MCFQE4GC.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-7ZESTCBD.mjs";import"../../chunk-EMR3S3VO.mjs";import"../../chunk-OLILO7VD.mjs";import"../../chunk-GUPVZIYS.mjs";import"../../chunk-KDMSOCZY.mjs";export{c as Ed25519PrivateKey,b as Ed25519PublicKey,d as Ed25519Signature,a as isCanonicalEd25519Signature};
2
2
  //# sourceMappingURL=ed25519.mjs.map