@aptos-labs/ts-sdk 6.2.0 → 6.3.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 (344) hide show
  1. package/dist/common/{account-DGpxrkAn.d.ts → account-2FUAPVPW.d.ts} +15 -4
  2. package/dist/common/chunk-L5DUJTE3.js +4 -0
  3. package/dist/common/chunk-L5DUJTE3.js.map +1 -0
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/index.d.ts +22 -20
  7. package/dist/common/index.js +34 -34
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/{Ed25519Account-BCt2cu_M.d.mts → Ed25519Account-DpZh3fRy.d.mts} +1 -1
  10. package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
  11. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  12. package/dist/esm/account/AbstractedAccount.d.mts +2 -2
  13. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  14. package/dist/esm/account/Account.d.mts +2 -2
  15. package/dist/esm/account/Account.mjs +1 -1
  16. package/dist/esm/account/AccountUtils.d.mts +3 -3
  17. package/dist/esm/account/AccountUtils.mjs +1 -1
  18. package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
  19. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  20. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  21. package/dist/esm/account/Ed25519Account.mjs +1 -1
  22. package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
  23. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  24. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  25. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  26. package/dist/esm/account/KeylessAccount.d.mts +3 -3
  27. package/dist/esm/account/KeylessAccount.mjs +1 -1
  28. package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
  29. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  30. package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
  31. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  32. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  33. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  34. package/dist/esm/account/index.d.mts +3 -3
  35. package/dist/esm/account/index.mjs +1 -1
  36. package/dist/esm/account/utils.d.mts +1 -1
  37. package/dist/esm/account/utils.mjs +1 -1
  38. package/dist/esm/{account-Dg0ejXHy.d.mts → account-sIOs_9XJ.d.mts} +15 -4
  39. package/dist/esm/api/account/abstraction.d.mts +1 -1
  40. package/dist/esm/api/account/abstraction.mjs +1 -1
  41. package/dist/esm/api/account.d.mts +2 -2
  42. package/dist/esm/api/account.mjs +1 -1
  43. package/dist/esm/api/ans.d.mts +1 -1
  44. package/dist/esm/api/ans.mjs +1 -1
  45. package/dist/esm/api/aptos.d.mts +3 -3
  46. package/dist/esm/api/aptos.mjs +1 -1
  47. package/dist/esm/api/aptosConfig.d.mts +1 -1
  48. package/dist/esm/api/aptosConfig.mjs +1 -1
  49. package/dist/esm/api/coin.d.mts +1 -1
  50. package/dist/esm/api/coin.mjs +1 -1
  51. package/dist/esm/api/digitalAsset.d.mts +2 -2
  52. package/dist/esm/api/digitalAsset.mjs +1 -1
  53. package/dist/esm/api/faucet.d.mts +1 -1
  54. package/dist/esm/api/faucet.mjs +1 -1
  55. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  56. package/dist/esm/api/fungibleAsset.mjs +1 -1
  57. package/dist/esm/api/general.d.mts +1 -1
  58. package/dist/esm/api/general.mjs +1 -1
  59. package/dist/esm/api/index.d.mts +3 -3
  60. package/dist/esm/api/index.mjs +1 -1
  61. package/dist/esm/api/keyless.d.mts +3 -3
  62. package/dist/esm/api/keyless.mjs +1 -1
  63. package/dist/esm/api/object.d.mts +1 -1
  64. package/dist/esm/api/object.mjs +1 -1
  65. package/dist/esm/api/staking.d.mts +1 -1
  66. package/dist/esm/api/staking.mjs +1 -1
  67. package/dist/esm/api/table.d.mts +1 -1
  68. package/dist/esm/api/table.mjs +1 -1
  69. package/dist/esm/api/transaction.d.mts +21 -19
  70. package/dist/esm/api/transaction.mjs +1 -1
  71. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  72. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  73. package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
  74. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  75. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  76. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  77. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  78. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  79. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  80. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  81. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  82. package/dist/esm/api/utils.d.mts +1 -1
  83. package/dist/esm/api/utils.mjs +1 -1
  84. package/dist/esm/bcs/consts.d.mts +1 -1
  85. package/dist/esm/bcs/deserializer.d.mts +1 -1
  86. package/dist/esm/bcs/index.d.mts +1 -1
  87. package/dist/esm/bcs/index.mjs +1 -1
  88. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
  89. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  90. package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
  91. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  92. package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
  93. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  94. package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
  95. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  96. package/dist/esm/bcs/serializer.d.mts +1 -1
  97. package/dist/esm/bcs/serializer.mjs +1 -1
  98. package/dist/esm/{chunk-LDK76MDN.mjs → chunk-226FBOWQ.mjs} +2 -2
  99. package/dist/esm/{chunk-Q4KYBAYN.mjs → chunk-2DQRUJUC.mjs} +2 -2
  100. package/dist/esm/chunk-2EBXCCLB.mjs +2 -0
  101. package/dist/esm/chunk-2EBXCCLB.mjs.map +1 -0
  102. package/dist/esm/{chunk-R7PCBRRT.mjs → chunk-2YA4KQUV.mjs} +2 -2
  103. package/dist/esm/{chunk-POQ4FT4E.mjs → chunk-3ZC6F5SJ.mjs} +2 -2
  104. package/dist/esm/{chunk-X4IR6WX6.mjs → chunk-4KEZEYCV.mjs} +2 -2
  105. package/dist/esm/chunk-6T2OBPIF.mjs +4 -0
  106. package/dist/esm/chunk-6T2OBPIF.mjs.map +1 -0
  107. package/dist/esm/{chunk-2VBY2V4Z.mjs → chunk-A5H5VKUI.mjs} +2 -2
  108. package/dist/esm/{chunk-NWP2VEMB.mjs → chunk-DPHBSAZQ.mjs} +2 -2
  109. package/dist/esm/{chunk-CD3EZCI5.mjs → chunk-F4RJMSAW.mjs} +2 -2
  110. package/dist/esm/{chunk-UYG4XVVO.mjs → chunk-FAOLAKLJ.mjs} +2 -2
  111. package/dist/esm/{chunk-5LMLIRGK.mjs → chunk-GJYLYE6R.mjs} +2 -2
  112. package/dist/esm/{chunk-C2KVLMPH.mjs → chunk-GYYSHYO5.mjs} +2 -2
  113. package/dist/esm/{chunk-ASFFADWS.mjs → chunk-IEW452EO.mjs} +2 -2
  114. package/dist/esm/chunk-IZF6POVR.mjs +4 -0
  115. package/dist/esm/chunk-IZF6POVR.mjs.map +1 -0
  116. package/dist/esm/chunk-KKPH2JUV.mjs +2 -0
  117. package/dist/esm/chunk-KKPH2JUV.mjs.map +1 -0
  118. package/dist/esm/{chunk-F4LHBGG2.mjs → chunk-LVZ7QMUH.mjs} +2 -2
  119. package/dist/esm/{chunk-T32P4APJ.mjs → chunk-MKTR4U2R.mjs} +2 -2
  120. package/dist/esm/{chunk-EIWPAECI.mjs → chunk-NHRPXEUE.mjs} +2 -2
  121. package/dist/esm/{chunk-YTFJ5W7U.mjs → chunk-NNXTS2GB.mjs} +2 -2
  122. package/dist/esm/{chunk-UPHD2B4I.mjs → chunk-NPWYZVHE.mjs} +2 -2
  123. package/dist/esm/{chunk-KOVWYU53.mjs → chunk-NTMFADQ7.mjs} +2 -2
  124. package/dist/esm/{chunk-A7SQEK23.mjs → chunk-QE5MOGUI.mjs} +2 -2
  125. package/dist/esm/chunk-RB2GC7FW.mjs +2 -0
  126. package/dist/esm/chunk-RUKFK3OC.mjs +2 -0
  127. package/dist/esm/chunk-RUKFK3OC.mjs.map +1 -0
  128. package/dist/esm/chunk-RYCI4VKO.mjs +2 -0
  129. package/dist/esm/{chunk-AUGTNOKZ.mjs.map → chunk-RYCI4VKO.mjs.map} +1 -1
  130. package/dist/esm/{chunk-TSPG5VED.mjs → chunk-RZNP3WG4.mjs} +2 -2
  131. package/dist/esm/{chunk-2VHA77EO.mjs → chunk-TBIK7DML.mjs} +2 -2
  132. package/dist/esm/chunk-UVNAHETD.mjs +2 -0
  133. package/dist/esm/{chunk-YJVBGKWM.mjs.map → chunk-UVNAHETD.mjs.map} +1 -1
  134. package/dist/esm/{chunk-E3DHFXN4.mjs → chunk-WOPHK7LB.mjs} +2 -2
  135. package/dist/esm/{chunk-H2T2SU5O.mjs → chunk-WZZ7PJ3X.mjs} +2 -2
  136. package/dist/esm/{chunk-QRW7MQDA.mjs → chunk-ZOSOF6ST.mjs} +2 -2
  137. package/dist/esm/cli/index.d.mts +1 -1
  138. package/dist/esm/cli/index.mjs +1 -1
  139. package/dist/esm/cli/localNode.mjs +1 -1
  140. package/dist/esm/cli/move.d.mts +1 -1
  141. package/dist/esm/client/core.d.mts +1 -1
  142. package/dist/esm/client/core.mjs +1 -1
  143. package/dist/esm/client/get.d.mts +1 -1
  144. package/dist/esm/client/get.mjs +1 -1
  145. package/dist/esm/client/index.d.mts +1 -1
  146. package/dist/esm/client/index.mjs +1 -1
  147. package/dist/esm/client/post.d.mts +1 -1
  148. package/dist/esm/client/post.mjs +1 -1
  149. package/dist/esm/core/account/index.d.mts +1 -1
  150. package/dist/esm/core/account/index.mjs +1 -1
  151. package/dist/esm/core/account/utils/address.d.mts +1 -1
  152. package/dist/esm/core/account/utils/address.mjs +1 -1
  153. package/dist/esm/core/account/utils/index.d.mts +1 -1
  154. package/dist/esm/core/account/utils/index.mjs +1 -1
  155. package/dist/esm/core/accountAddress.d.mts +1 -1
  156. package/dist/esm/core/accountAddress.mjs +1 -1
  157. package/dist/esm/core/authenticationKey.d.mts +1 -1
  158. package/dist/esm/core/authenticationKey.mjs +1 -1
  159. package/dist/esm/core/crypto/abstraction.d.mts +1 -1
  160. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  161. package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
  162. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  163. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  164. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  165. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  166. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  167. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
  168. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  169. package/dist/esm/core/crypto/index.d.mts +2 -2
  170. package/dist/esm/core/crypto/index.mjs +1 -1
  171. package/dist/esm/core/crypto/keyless.d.mts +2 -2
  172. package/dist/esm/core/crypto/keyless.mjs +1 -1
  173. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  174. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  175. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  176. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  177. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  178. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  179. package/dist/esm/core/crypto/proof.d.mts +1 -1
  180. package/dist/esm/core/crypto/proof.mjs +1 -1
  181. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  182. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  183. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  184. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  185. package/dist/esm/core/crypto/secp256r1.d.mts +1 -1
  186. package/dist/esm/core/crypto/secp256r1.mjs +1 -1
  187. package/dist/esm/core/crypto/signature.d.mts +1 -1
  188. package/dist/esm/core/crypto/signature.mjs +1 -1
  189. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  190. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  191. package/dist/esm/core/crypto/types.d.mts +1 -1
  192. package/dist/esm/core/crypto/utils.d.mts +1 -1
  193. package/dist/esm/core/crypto/utils.mjs +1 -1
  194. package/dist/esm/core/hex.d.mts +1 -1
  195. package/dist/esm/core/index.d.mts +2 -2
  196. package/dist/esm/core/index.mjs +1 -1
  197. package/dist/esm/errors/index.d.mts +1 -1
  198. package/dist/esm/errors/index.mjs +1 -1
  199. package/dist/esm/{federatedKeyless-BYLu31Sa.d.mts → federatedKeyless-Cuo0IGJ6.d.mts} +1 -1
  200. package/dist/esm/index.d.mts +3 -3
  201. package/dist/esm/index.mjs +1 -1
  202. package/dist/esm/internal/abstraction.d.mts +1 -1
  203. package/dist/esm/internal/abstraction.mjs +1 -1
  204. package/dist/esm/internal/account.d.mts +2 -2
  205. package/dist/esm/internal/account.mjs +1 -1
  206. package/dist/esm/internal/ans.d.mts +1 -1
  207. package/dist/esm/internal/ans.mjs +1 -1
  208. package/dist/esm/internal/coin.d.mts +1 -1
  209. package/dist/esm/internal/coin.mjs +1 -1
  210. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  211. package/dist/esm/internal/digitalAsset.mjs +1 -1
  212. package/dist/esm/internal/faucet.d.mts +1 -1
  213. package/dist/esm/internal/faucet.mjs +1 -1
  214. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  215. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  216. package/dist/esm/internal/general.d.mts +1 -1
  217. package/dist/esm/internal/general.mjs +1 -1
  218. package/dist/esm/internal/keyless.d.mts +3 -3
  219. package/dist/esm/internal/keyless.mjs +1 -1
  220. package/dist/esm/internal/object.d.mts +1 -1
  221. package/dist/esm/internal/object.mjs +1 -1
  222. package/dist/esm/internal/staking.d.mts +1 -1
  223. package/dist/esm/internal/staking.mjs +1 -1
  224. package/dist/esm/internal/table.d.mts +1 -1
  225. package/dist/esm/internal/table.mjs +1 -1
  226. package/dist/esm/internal/transaction.d.mts +1 -1
  227. package/dist/esm/internal/transaction.mjs +1 -1
  228. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  229. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  230. package/dist/esm/internal/utils/index.d.mts +1 -1
  231. package/dist/esm/internal/utils/index.mjs +1 -1
  232. package/dist/esm/internal/utils/utils.d.mts +1 -1
  233. package/dist/esm/internal/utils/utils.mjs +1 -1
  234. package/dist/esm/internal/view.d.mts +1 -1
  235. package/dist/esm/internal/view.mjs +1 -1
  236. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  237. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  238. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  239. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  240. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  241. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  242. package/dist/esm/transactions/index.d.mts +1 -1
  243. package/dist/esm/transactions/index.mjs +1 -1
  244. package/dist/esm/transactions/instances/chainId.d.mts +1 -1
  245. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  246. package/dist/esm/transactions/instances/identifier.d.mts +1 -1
  247. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  248. package/dist/esm/transactions/instances/index.d.mts +1 -1
  249. package/dist/esm/transactions/instances/index.mjs +1 -1
  250. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  251. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  252. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
  253. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  254. package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
  255. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  256. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  257. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  258. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  259. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  260. package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
  261. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  262. package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
  263. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  264. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  265. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  266. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  267. package/dist/esm/transactions/management/index.d.mts +2 -2
  268. package/dist/esm/transactions/management/index.mjs +1 -1
  269. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  270. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  271. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  272. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  273. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  274. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  275. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  276. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  277. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  278. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  279. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  280. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  281. package/dist/esm/transactions/typeTag/index.d.mts +1 -1
  282. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  283. package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
  284. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  285. package/dist/esm/transactions/types.d.mts +1 -1
  286. package/dist/esm/types/index.d.mts +1 -1
  287. package/dist/esm/types/index.mjs +1 -1
  288. package/dist/esm/types/types.d.mts +1 -1
  289. package/dist/esm/utils/helpers.d.mts +1 -1
  290. package/dist/esm/utils/helpers.mjs +1 -1
  291. package/dist/esm/utils/index.d.mts +1 -1
  292. package/dist/esm/utils/index.mjs +1 -1
  293. package/dist/esm/utils/normalizeBundle.d.mts +1 -1
  294. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  295. package/dist/esm/version.d.mts +1 -1
  296. package/dist/esm/version.mjs +1 -1
  297. package/package.json +1 -1
  298. package/src/api/transaction.ts +19 -17
  299. package/src/bcs/serializable/movePrimitives.ts +21 -15
  300. package/src/bcs/serializable/moveStructs.ts +5 -5
  301. package/src/bcs/serializer.ts +19 -0
  302. package/src/core/accountAddress.ts +3 -3
  303. package/src/transactions/transactionBuilder/remoteAbi.ts +10 -14
  304. package/src/version.ts +1 -1
  305. package/dist/common/chunk-2VR6ONNW.js +0 -4
  306. package/dist/common/chunk-2VR6ONNW.js.map +0 -1
  307. package/dist/esm/chunk-5HHC2YG4.mjs +0 -2
  308. package/dist/esm/chunk-66F7RP7K.mjs +0 -2
  309. package/dist/esm/chunk-66F7RP7K.mjs.map +0 -1
  310. package/dist/esm/chunk-6CD6PDFJ.mjs +0 -4
  311. package/dist/esm/chunk-6CD6PDFJ.mjs.map +0 -1
  312. package/dist/esm/chunk-AUGTNOKZ.mjs +0 -2
  313. package/dist/esm/chunk-BT742BFQ.mjs +0 -2
  314. package/dist/esm/chunk-BT742BFQ.mjs.map +0 -1
  315. package/dist/esm/chunk-FDHHQUS3.mjs +0 -4
  316. package/dist/esm/chunk-FDHHQUS3.mjs.map +0 -1
  317. package/dist/esm/chunk-WFZFTRRS.mjs +0 -2
  318. package/dist/esm/chunk-WFZFTRRS.mjs.map +0 -1
  319. package/dist/esm/chunk-YJVBGKWM.mjs +0 -2
  320. /package/dist/esm/{chunk-LDK76MDN.mjs.map → chunk-226FBOWQ.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-Q4KYBAYN.mjs.map → chunk-2DQRUJUC.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-R7PCBRRT.mjs.map → chunk-2YA4KQUV.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-POQ4FT4E.mjs.map → chunk-3ZC6F5SJ.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-X4IR6WX6.mjs.map → chunk-4KEZEYCV.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-2VBY2V4Z.mjs.map → chunk-A5H5VKUI.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-NWP2VEMB.mjs.map → chunk-DPHBSAZQ.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-CD3EZCI5.mjs.map → chunk-F4RJMSAW.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-UYG4XVVO.mjs.map → chunk-FAOLAKLJ.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-5LMLIRGK.mjs.map → chunk-GJYLYE6R.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-C2KVLMPH.mjs.map → chunk-GYYSHYO5.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-ASFFADWS.mjs.map → chunk-IEW452EO.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-F4LHBGG2.mjs.map → chunk-LVZ7QMUH.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-T32P4APJ.mjs.map → chunk-MKTR4U2R.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-EIWPAECI.mjs.map → chunk-NHRPXEUE.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-YTFJ5W7U.mjs.map → chunk-NNXTS2GB.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-UPHD2B4I.mjs.map → chunk-NPWYZVHE.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-KOVWYU53.mjs.map → chunk-NTMFADQ7.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-A7SQEK23.mjs.map → chunk-QE5MOGUI.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-5HHC2YG4.mjs.map → chunk-RB2GC7FW.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-TSPG5VED.mjs.map → chunk-RZNP3WG4.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-2VHA77EO.mjs.map → chunk-TBIK7DML.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-E3DHFXN4.mjs.map → chunk-WOPHK7LB.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-H2T2SU5O.mjs.map → chunk-WZZ7PJ3X.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-QRW7MQDA.mjs.map → chunk-ZOSOF6ST.mjs.map} +0 -0
@@ -0,0 +1,2 @@
1
+ import{a as r,b as t,d as B,f as s}from"./chunk-RUKFK3OC.mjs";import{a as l,b as n,c as o,d as z,e as u,f as c,g as d,h as I,i as p,j as U,k as v,l as m,m as S,n as F,o as h,p as A,q as b,r as y}from"./chunk-X2TPNKLV.mjs";var N=class i extends r{constructor(e){super(),B(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new a(e.deserializeU256())}static deserialize(e){return new i(e.deserializeBool())}},_=class i extends r{constructor(e){super(),s(e,0,l),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new i(e.deserializeU8())}},g=class i extends r{constructor(e){super(),s(e,0,n),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new i(e.deserializeU16())}},M=class i extends r{constructor(e){super(),s(e,0,o),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new i(e.deserializeU32())}},x=class i extends r{constructor(e){super(),s(e,BigInt(0),z),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new i(e.deserializeU64())}},T=class i extends r{constructor(e){super(),s(e,BigInt(0),u),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new i(e.deserializeU128())}},a=class i extends r{constructor(e){super(),s(e,BigInt(0),c),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new i(e.deserializeU256())}},E=class i extends r{constructor(e){super(),s(e,d,I),this.value=e}serialize(e){e.serializeI8(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(10),e.serialize(this)}static deserialize(e){return new i(e.deserializeI8())}},D=class i extends r{constructor(e){super(),s(e,p,U),this.value=e}serialize(e){e.serializeI16(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(11),e.serialize(this)}static deserialize(e){return new i(e.deserializeI16())}},w=class i extends r{constructor(e){super(),s(e,v,m),this.value=e}serialize(e){e.serializeI32(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(12),e.serialize(this)}static deserialize(e){return new i(e.deserializeI32())}},X=class i extends r{constructor(e){super(),s(e,S,F),this.value=BigInt(e)}serialize(e){e.serializeI64(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(13),e.serialize(this)}static deserialize(e){return new i(e.deserializeI64())}},R=class i extends r{constructor(e){super(),s(e,h,A),this.value=BigInt(e)}serialize(e){e.serializeI128(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(14),e.serialize(this)}static deserialize(e){return new i(e.deserializeI128())}},G=class i extends r{constructor(e){super(),s(e,b,y),this.value=BigInt(e)}serialize(e){e.serializeI256(this.value)}serializeForEntryFunction(e){t(e,this)}serializeForScriptFunction(e){e.serializeU32AsUleb128(15),e.serialize(this)}static deserialize(e){return new i(e.deserializeI256())}};export{N as a,_ as b,g as c,M as d,x as e,T as f,a as g,E as h,D as i,w as j,X as k,R as l,G as m};
2
+ //# sourceMappingURL=chunk-KKPH2JUV.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bcs/serializable/movePrimitives.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\nimport {\n MAX_U128_BIG_INT,\n MAX_U16_NUMBER,\n MAX_U32_NUMBER,\n MAX_U64_BIG_INT,\n MAX_U8_NUMBER,\n MAX_U256_BIG_INT,\n MIN_I8_NUMBER,\n MAX_I8_NUMBER,\n MIN_I16_NUMBER,\n MAX_I16_NUMBER,\n MIN_I32_NUMBER,\n MAX_I32_NUMBER,\n MIN_I64_BIG_INT,\n MAX_I64_BIG_INT,\n MIN_I128_BIG_INT,\n MAX_I128_BIG_INT,\n MIN_I256_BIG_INT,\n MAX_I256_BIG_INT,\n} from \"../consts\";\nimport { Deserializer } from \"../deserializer\";\nimport {\n Serializable,\n Serializer,\n ensureBoolean,\n serializeEntryFunctionBytesCompat,\n validateNumberInRange,\n} from \"../serializer\";\nimport { TransactionArgument } from \"../../transactions/instances/transactionArgument\";\nimport { AnyNumber, Uint16, Uint32, Uint8, Int8, Int16, Int32, ScriptTransactionArgumentVariants } from \"../../types\";\n\n/**\n * Represents a boolean value that can be serialized and deserialized.\n * This class extends the Serializable class and provides methods to serialize\n * the boolean value for different contexts, such as entry functions and script functions.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class Bool extends Serializable implements TransactionArgument {\n public readonly value: boolean;\n\n /**\n * Constructs a new instance with a specified value.\n * This ensures that the value is validated to be within the acceptable range.\n *\n * @param value - The number to be validated and assigned, which must be between 0 and MAX_U256_BIG_INT.\n * @group Implementation\n * @category BCS\n */\n constructor(value: boolean) {\n super();\n\n /**\n * Ensures that the provided value is of type boolean.\n * This function throws an error if the value is not a boolean, helping to enforce type safety in your code.\n *\n * @param value - The value to be checked for boolean type.\n * @throws {Error} Throws an error if the value is not a boolean.\n * @group Implementation\n * @category BCS\n */\n ensureBoolean(value);\n this.value = value;\n }\n\n /**\n * Serializes the value using the provided serializer.\n * This function is essential for converting the value 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 BCS\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBool(this.value);\n }\n\n /**\n * Serializes the current instance for use in an entry function by converting it to a byte sequence.\n * This allows the instance to be properly formatted for serialization in transactions.\n * Uses serializeAsBytes when available, with a fallback for older Serializer versions.\n *\n * @param serializer - The serializer instance used to serialize the byte sequence.\n * @group Implementation\n * @category BCS\n */\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n /**\n * Serializes the current instance for use in a script function.\n * This allows for the conversion of the instance into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer used to perform the serialization.\n * @group Implementation\n * @category BCS\n */\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.Bool);\n serializer.serialize(this);\n }\n\n /**\n * Deserializes a U256 value from the provided deserializer.\n *\n * @param deserializer - The deserializer instance used to read the U256 data.\n * @group Implementation\n * @category BCS\n */\n\n deserialize(deserializer: Deserializer) {\n return new U256(deserializer.deserializeU256());\n }\n\n static deserialize(deserializer: Deserializer): Bool {\n return new Bool(deserializer.deserializeBool());\n }\n}\n\n/**\n * Represents an unsigned 8-bit integer (U8) value.\n * This class extends the Serializable class and provides methods for serialization and deserialization of U8 values.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U8 extends Serializable implements TransactionArgument {\n public readonly value: Uint8;\n\n constructor(value: Uint8) {\n super();\n validateNumberInRange(value, 0, MAX_U8_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU8(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U8);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U8 {\n return new U8(deserializer.deserializeU8());\n }\n}\n\n/**\n * Represents a 16-bit unsigned integer (U16) value.\n * This class extends the Serializable class and provides methods for serialization\n * and deserialization of the U16 value.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U16 extends Serializable implements TransactionArgument {\n public readonly value: Uint16;\n\n constructor(value: Uint16) {\n super();\n validateNumberInRange(value, 0, MAX_U16_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU16(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U16);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U16 {\n return new U16(deserializer.deserializeU16());\n }\n}\n\n/**\n * Represents a 32-bit unsigned integer (U32) that can be serialized and deserialized.\n * This class ensures that the value is within the valid range for a U32.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U32 extends Serializable implements TransactionArgument {\n public readonly value: Uint32;\n\n constructor(value: Uint32) {\n super();\n validateNumberInRange(value, 0, MAX_U32_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU32(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U32);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U32 {\n return new U32(deserializer.deserializeU32());\n }\n}\n\n/**\n * Represents a 64-bit unsigned integer (U64) and provides methods for serialization.\n *\n * This class ensures that the value is within the valid range for a U64 and provides\n * functionality to serialize the value for various use cases, including entry functions\n * and script functions.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U64 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, BigInt(0), MAX_U64_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU64(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U64);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U64 {\n return new U64(deserializer.deserializeU64());\n }\n}\n\n/**\n * Represents a 128-bit unsigned integer value.\n * This class provides methods for serialization and deserialization\n * of U128 values, ensuring that the values are within the valid range.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U128 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, BigInt(0), MAX_U128_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU128(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U128);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U128 {\n return new U128(deserializer.deserializeU128());\n }\n}\n\n/**\n * Represents a 256-bit unsigned integer (U256) that extends the Serializable class.\n * This class provides methods for serialization and deserialization of U256 values,\n * ensuring that the values are within the valid range.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class U256 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, BigInt(0), MAX_U256_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeU256(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.U256);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): U256 {\n return new U256(deserializer.deserializeU256());\n }\n}\n\n/**\n * Represents an 8-bit signed integer (I8) value.\n * This class extends the Serializable class and provides methods for serialization and deserialization of I8 values.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class I8 extends Serializable implements TransactionArgument {\n public readonly value: Int8;\n\n constructor(value: Int8) {\n super();\n validateNumberInRange(value, MIN_I8_NUMBER, MAX_I8_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeI8(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I8);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): I8 {\n return new I8(deserializer.deserializeI8());\n }\n}\n\n/**\n * Represents a 16-bit signed integer (I16) value.\n * This class extends the Serializable class and provides methods for serialization\n * and deserialization of the I16 value.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class I16 extends Serializable implements TransactionArgument {\n public readonly value: Int16;\n\n constructor(value: Int16) {\n super();\n validateNumberInRange(value, MIN_I16_NUMBER, MAX_I16_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeI16(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I16);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): I16 {\n return new I16(deserializer.deserializeI16());\n }\n}\n\n/**\n * Represents a 32-bit signed integer (I32) that can be serialized and deserialized.\n * This class ensures that the value is within the valid range for an I32.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class I32 extends Serializable implements TransactionArgument {\n public readonly value: Int32;\n\n constructor(value: Int32) {\n super();\n validateNumberInRange(value, MIN_I32_NUMBER, MAX_I32_NUMBER);\n this.value = value;\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeI32(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I32);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): I32 {\n return new I32(deserializer.deserializeI32());\n }\n}\n\n/**\n * Represents a 64-bit signed integer (I64) and provides methods for serialization.\n *\n * This class ensures that the value is within the valid range for an I64 and provides\n * functionality to serialize the value for various use cases, including entry functions\n * and script functions.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class I64 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, MIN_I64_BIG_INT, MAX_I64_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeI64(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I64);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): I64 {\n return new I64(deserializer.deserializeI64());\n }\n}\n\n/**\n * Represents a 128-bit signed integer value.\n * This class provides methods for serialization and deserialization\n * of I128 values, ensuring that the values are within the valid range.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class I128 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, MIN_I128_BIG_INT, MAX_I128_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeI128(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I128);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): I128 {\n return new I128(deserializer.deserializeI128());\n }\n}\n\n/**\n * Represents a 256-bit signed integer (I256) that extends the Serializable class.\n * This class provides methods for serialization and deserialization of I256 values,\n * ensuring that the values are within the valid range.\n *\n * @extends Serializable\n * @group Implementation\n * @category BCS\n */\nexport class I256 extends Serializable implements TransactionArgument {\n public readonly value: bigint;\n\n constructor(value: AnyNumber) {\n super();\n validateNumberInRange(value, MIN_I256_BIG_INT, MAX_I256_BIG_INT);\n this.value = BigInt(value);\n }\n\n serialize(serializer: Serializer): void {\n serializer.serializeI256(this.value);\n }\n\n serializeForEntryFunction(serializer: Serializer): void {\n serializeEntryFunctionBytesCompat(serializer, this);\n }\n\n serializeForScriptFunction(serializer: Serializer): void {\n serializer.serializeU32AsUleb128(ScriptTransactionArgumentVariants.I256);\n serializer.serialize(this);\n }\n\n static deserialize(deserializer: Deserializer): I256 {\n return new I256(deserializer.deserializeI256());\n }\n}\n"],"mappings":"8NA0CO,IAAMA,EAAN,MAAMC,UAAaC,CAA4C,CAWpE,YAAYC,EAAgB,CAC1B,MAAM,EAWNC,EAAcD,CAAK,EACnB,KAAK,MAAQA,CACf,CAUA,UAAUE,EAA8B,CACtCA,EAAW,cAAc,KAAK,KAAK,CACrC,CAWA,0BAA0BA,EAA8B,CACtDC,EAAkCD,EAAY,IAAI,CACpD,CAUA,2BAA2BA,EAA8B,CACvDA,EAAW,uBAA4D,EACvEA,EAAW,UAAU,IAAI,CAC3B,CAUA,YAAYE,EAA4B,CACtC,OAAO,IAAIC,EAAKD,EAAa,gBAAgB,CAAC,CAChD,CAEA,OAAO,YAAYA,EAAkC,CACnD,OAAO,IAAIN,EAAKM,EAAa,gBAAgB,CAAC,CAChD,CACF,EAUaE,EAAN,MAAMC,UAAWR,CAA4C,CAGlE,YAAYC,EAAc,CACxB,MAAM,EACNQ,EAAsBR,EAAO,EAAGS,CAAa,EAC7C,KAAK,MAAQT,CACf,CAEA,UAAUE,EAA8B,CACtCA,EAAW,YAAY,KAAK,KAAK,CACnC,CAEA,0BAA0BA,EAA8B,CACtDC,EAAkCD,EAAY,IAAI,CACpD,CAEA,2BAA2BA,EAA8B,CACvDA,EAAW,uBAA0D,EACrEA,EAAW,UAAU,IAAI,CAC3B,CAEA,OAAO,YAAYE,EAAgC,CACjD,OAAO,IAAIG,EAAGH,EAAa,cAAc,CAAC,CAC5C,CACF,EAWaM,EAAN,MAAMC,UAAYZ,CAA4C,CAGnE,YAAYC,EAAe,CACzB,MAAM,EACNQ,EAAsBR,EAAO,EAAGY,CAAc,EAC9C,KAAK,MAAQZ,CACf,CAEA,UAAUE,EAA8B,CACtCA,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Q,EAAsBR,EAAO0C,EAAkBC,CAAgB,EAC/D,KAAK,MAAQ,OAAO3C,CAAK,CAC3B,CAEA,UAAUE,EAA8B,CACtCA,EAAW,cAAc,KAAK,KAAK,CACrC,CAEA,0BAA0BA,EAA8B,CACtDC,EAAkCD,EAAY,IAAI,CACpD,CAEA,2BAA2BA,EAA8B,CACvDA,EAAW,wBAA4D,EACvEA,EAAW,UAAU,IAAI,CAC3B,CAEA,OAAO,YAAYE,EAAkC,CACnD,OAAO,IAAIqC,EAAKrC,EAAa,gBAAgB,CAAC,CAChD,CACF,EAWawC,EAAN,MAAMC,UAAa9C,CAA4C,CAGpE,YAAYC,EAAkB,CAC5B,MAAM,EACNQ,EAAsBR,EAAO8C,EAAkBC,CAAgB,EAC/D,KAAK,MAAQ,OAAO/C,CAAK,CAC3B,CAEA,UAAUE,EAA8B,CACtCA,EAAW,cAAc,KAAK,KAAK,CACrC,CAEA,0BAA0BA,EAA8B,CACtDC,EAAkCD,EAAY,IAAI,CACpD,CAEA,2BAA2BA,EAA8B,CACvDA,EAAW,wBAA4D,EACvEA,EAAW,UAAU,IAAI,CAC3B,CAEA,OAAO,YAAYE,EAAkC,CACnD,OAAO,IAAIyC,EAAKzC,EAAa,gBAAgB,CAAC,CAChD,CACF","names":["Bool","_Bool","Serializable","value","ensureBoolean","serializer","serializeEntryFunctionBytesCompat","deserializer","U256","U8","_U8","validateNumberInRange","MAX_U8_NUMBER","U16","_U16","MAX_U16_NUMBER","U32","_U32","MAX_U32_NUMBER","U64","_U64","MAX_U64_BIG_INT","U128","_U128","MAX_U128_BIG_INT","_U256","MAX_U256_BIG_INT","I8","_I8","MIN_I8_NUMBER","MAX_I8_NUMBER","I16","_I16","MIN_I16_NUMBER","MAX_I16_NUMBER","I32","_I32","MIN_I32_NUMBER","MAX_I32_NUMBER","I64","_I64","MIN_I64_BIG_INT","MAX_I64_BIG_INT","I128","_I128","MIN_I128_BIG_INT","MAX_I128_BIG_INT","I256","_I256","MIN_I256_BIG_INT","MAX_I256_BIG_INT"]}
@@ -1,2 +1,2 @@
1
- import{b as o}from"./chunk-5LMLIRGK.mjs";import{b as r}from"./chunk-STY74NUA.mjs";var a=class a{static formatPrivateKey(e,p){let i=a.AIP80_PREFIXES[p],t=e;return typeof t=="string"&&t.startsWith(i)&&(t=t.split("-")[2]),`${i}${r.fromHexInput(t).toString()}`}static parseHexInput(e,p,i){let t,n=a.AIP80_PREFIXES[p];if(typeof e=="string")if(!i&&!e.startsWith(n))t=r.fromHexInput(e),i!==!1&&o("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(n))t=r.fromHexString(e.split("-")[2]);else throw i?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else t=r.fromHexInput(e);return t}};a.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-",secp256r1:"secp256r1-priv-"};var s=a;export{s as a};
2
- //# sourceMappingURL=chunk-F4LHBGG2.mjs.map
1
+ import{b as o}from"./chunk-GJYLYE6R.mjs";import{b as r}from"./chunk-STY74NUA.mjs";var a=class a{static formatPrivateKey(e,p){let i=a.AIP80_PREFIXES[p],t=e;return typeof t=="string"&&t.startsWith(i)&&(t=t.split("-")[2]),`${i}${r.fromHexInput(t).toString()}`}static parseHexInput(e,p,i){let t,n=a.AIP80_PREFIXES[p];if(typeof e=="string")if(!i&&!e.startsWith(n))t=r.fromHexInput(e),i!==!1&&o("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(n))t=r.fromHexString(e.split("-")[2]);else throw i?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else t=r.fromHexInput(e);return t}};a.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-",secp256r1:"secp256r1-priv-"};var s=a;export{s as a};
2
+ //# sourceMappingURL=chunk-LVZ7QMUH.mjs.map
@@ -1,2 +1,2 @@
1
- import{n as u,x as n}from"./chunk-G5OONGWS.mjs";import{a as c}from"./chunk-ODNZJSOC.mjs";import{b as i}from"./chunk-2VHA77EO.mjs";import{c as p}from"./chunk-NWP2VEMB.mjs";var g=10*1e3;async function m(e){let{aptosConfig:o}=e,s=`ledger-info-${o.network}`;return c(async()=>{let{data:t}=await i({aptosConfig:o,originMethod:"getLedgerInfo",path:""});return t},s,g)()}async function T(e){let{aptosConfig:o,limit:s}=e;return(await a({aptosConfig:o,query:{query:u,variables:{limit:s}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function a(e){let{aptosConfig:o,query:s,originMethod:t}=e,{data:r}=await p({aptosConfig:o,originMethod:t??"queryIndexer",path:"",body:s,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(e){let{aptosConfig:o}=e;return(await a({aptosConfig:o,query:{query:n},originMethod:"getProcessorStatuses"})).processor_status}async function q(e){let o=await f({aptosConfig:e.aptosConfig});return BigInt(o[0].last_success_version)}async function P(e){let{aptosConfig:o,processorType:s}=e;return(await a({aptosConfig:o,query:{query:n,variables:{where_condition:{processor:{_eq:s}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{m as a,T as b,a as c,f as d,q as e,P as f};
2
- //# sourceMappingURL=chunk-T32P4APJ.mjs.map
1
+ import{n as u,x as n}from"./chunk-G5OONGWS.mjs";import{a as c}from"./chunk-ODNZJSOC.mjs";import{b as i}from"./chunk-TBIK7DML.mjs";import{c as p}from"./chunk-DPHBSAZQ.mjs";var g=10*1e3;async function m(e){let{aptosConfig:o}=e,s=`ledger-info-${o.network}`;return c(async()=>{let{data:t}=await i({aptosConfig:o,originMethod:"getLedgerInfo",path:""});return t},s,g)()}async function T(e){let{aptosConfig:o,limit:s}=e;return(await a({aptosConfig:o,query:{query:u,variables:{limit:s}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function a(e){let{aptosConfig:o,query:s,originMethod:t}=e,{data:r}=await p({aptosConfig:o,originMethod:t??"queryIndexer",path:"",body:s,overrides:{WITH_CREDENTIALS:!1}});return r}async function f(e){let{aptosConfig:o}=e;return(await a({aptosConfig:o,query:{query:n},originMethod:"getProcessorStatuses"})).processor_status}async function q(e){let o=await f({aptosConfig:e.aptosConfig});return BigInt(o[0].last_success_version)}async function P(e){let{aptosConfig:o,processorType:s}=e;return(await a({aptosConfig:o,query:{query:n,variables:{where_condition:{processor:{_eq:s}}}},originMethod:"getProcessorStatus"})).processor_status[0]}export{m as a,T as b,a as c,f as d,q as e,P as f};
2
+ //# sourceMappingURL=chunk-MKTR4U2R.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as r}from"./chunk-66F7RP7K.mjs";import{b as t}from"./chunk-STY74NUA.mjs";var o=class extends r{toUint8Array(){return this.bcsToBytes()}toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
- //# sourceMappingURL=chunk-EIWPAECI.mjs.map
1
+ import{a as r}from"./chunk-RUKFK3OC.mjs";import{b as t}from"./chunk-STY74NUA.mjs";var o=class extends r{toUint8Array(){return this.bcsToBytes()}toString(){let i=this.toUint8Array();return t.fromHexInput(i).toString()}};export{o as a};
2
+ //# sourceMappingURL=chunk-NHRPXEUE.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as d}from"./chunk-ODNZJSOC.mjs";import{b as s}from"./chunk-2VHA77EO.mjs";import{b as r}from"./chunk-FDHHQUS3.mjs";async function g(o){let{aptosConfig:e,accountAddress:t}=o,{data:n}=await s({aptosConfig:e,originMethod:"getInfo",path:`accounts/${r.from(t).toString()}`});return n}async function f(o){return o.options?.ledgerVersion!==void 0?c(o):d(async()=>c(o),`module-${o.accountAddress}-${o.moduleName}`,1e3*60*5)()}async function c(o){let{aptosConfig:e,accountAddress:t,moduleName:n,options:i}=o,{data:u}=await s({aptosConfig:e,originMethod:"getModule",path:`accounts/${r.from(t).toString()}/module/${n}`,params:{ledger_version:i?.ledgerVersion}});return u}export{g as a,f as b};
2
- //# sourceMappingURL=chunk-YTFJ5W7U.mjs.map
1
+ import{a as d}from"./chunk-ODNZJSOC.mjs";import{b as s}from"./chunk-TBIK7DML.mjs";import{b as r}from"./chunk-6T2OBPIF.mjs";async function g(o){let{aptosConfig:e,accountAddress:t}=o,{data:n}=await s({aptosConfig:e,originMethod:"getInfo",path:`accounts/${r.from(t).toString()}`});return n}async function f(o){return o.options?.ledgerVersion!==void 0?c(o):d(async()=>c(o),`module-${o.accountAddress}-${o.moduleName}`,1e3*60*5)()}async function c(o){let{aptosConfig:e,accountAddress:t,moduleName:n,options:i}=o,{data:u}=await s({aptosConfig:e,originMethod:"getModule",path:`accounts/${r.from(t).toString()}/module/${n}`,params:{ledger_version:i?.ledgerVersion}});return u}export{g as a,f as b};
2
+ //# sourceMappingURL=chunk-NNXTS2GB.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as u,c as r}from"./chunk-WFZFTRRS.mjs";import{e as t}from"./chunk-BT742BFQ.mjs";import{b as o}from"./chunk-FDHHQUS3.mjs";import{a as i}from"./chunk-66F7RP7K.mjs";var c=class extends i{constructor(e){super();this.accountAddress=o.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new t(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=u.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
- //# sourceMappingURL=chunk-UPHD2B4I.mjs.map
1
+ import{a as u,c as r}from"./chunk-2EBXCCLB.mjs";import{e as t}from"./chunk-KKPH2JUV.mjs";import{b as o}from"./chunk-6T2OBPIF.mjs";import{a as i}from"./chunk-RUKFK3OC.mjs";var c=class extends i{constructor(e){super();this.accountAddress=o.ONE;this.moduleName=new r("account");this.structName=new r("RotationProofChallenge");this.sequenceNumber=new t(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=u.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};export{c as a};
2
+ //# sourceMappingURL=chunk-NPWYZVHE.mjs.map
@@ -1,2 +1,2 @@
1
- import{h as e}from"./chunk-H2T2SU5O.mjs";async function i(o){o.minimumLedgerVersion!==void 0&&await e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:o.processorType})}export{i as a};
2
- //# sourceMappingURL=chunk-KOVWYU53.mjs.map
1
+ import{h as e}from"./chunk-WZZ7PJ3X.mjs";async function i(o){o.minimumLedgerVersion!==void 0&&await e({aptosConfig:o.config,minimumLedgerVersion:o.minimumLedgerVersion,processorType:o.processorType})}export{i as a};
2
+ //# sourceMappingURL=chunk-NTMFADQ7.mjs.map
@@ -1,2 +1,2 @@
1
- import{c as r}from"./chunk-5LMLIRGK.mjs";import{spawn as c}from"child_process";import l from"tree-kill";import{platform as h}from"os";var e=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.extraArgs=[];this.showStdout=t?.showStdout??!0,this.extraArgs=t?.extraArgs??[]}async stop(){await new Promise((t,o)=>{this.process?.pid&&l(this.process.pid,s=>{s?o(s):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let o=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api",...this.extraArgs],s=h(),i={env:{...process.env,ENABLE_KEYLESS_DEFAULT:"1"},...s==="win32"&&{shell:!0}};this.process=c("npx",o,i),this.process.stdout?.on("data",a=>{let n=a.toString();this.showStdout&&console.log(n)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),o=Date.now()/1e3,s=o;for(;!t&&o+this.MAXIMUM_WAIT_TIME_SEC>s;)await r(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{e as a};
2
- //# sourceMappingURL=chunk-A7SQEK23.mjs.map
1
+ import{c as r}from"./chunk-GJYLYE6R.mjs";import{spawn as c}from"child_process";import l from"tree-kill";import{platform as h}from"os";var e=class{constructor(t){this.MAXIMUM_WAIT_TIME_SEC=75;this.READINESS_ENDPOINT="http://127.0.0.1:8070/";this.showStdout=!0;this.process=null;this.extraArgs=[];this.showStdout=t?.showStdout??!0,this.extraArgs=t?.extraArgs??[]}async stop(){await new Promise((t,o)=>{this.process?.pid&&l(this.process.pid,s=>{s?o(s):t(!0)})})}async run(){await this.checkIfProcessIsUp()||(this.start(),await this.waitUntilProcessIsUp())}start(){let o=["aptos","node","run-localnet","--force-restart","--assume-yes","--with-indexer-api",...this.extraArgs],s=h(),i={env:{...process.env,ENABLE_KEYLESS_DEFAULT:"1"},...s==="win32"&&{shell:!0}};this.process=c("npx",o,i),this.process.stdout?.on("data",a=>{let n=a.toString();this.showStdout&&console.log(n)})}async waitUntilProcessIsUp(){let t=await this.checkIfProcessIsUp(),o=Date.now()/1e3,s=o;for(;!t&&o+this.MAXIMUM_WAIT_TIME_SEC>s;)await r(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{e as a};
2
+ //# sourceMappingURL=chunk-QE5MOGUI.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a}from"./chunk-RUKFK3OC.mjs";var e=class extends a{};export{e as a};
2
+ //# sourceMappingURL=chunk-RB2GC7FW.mjs.map
@@ -0,0 +1,2 @@
1
+ import{m as E}from"./chunk-TAHLOBRG.mjs";import{b as x}from"./chunk-STY74NUA.mjs";import{a as y,b as c,c as l,d as h,e as u,f as U,g as b,h as z,i as g,j as A,k as p,l as _,m as w,n as d,o as N,p as m,q as T,r as M}from"./chunk-X2TPNKLV.mjs";import{a as n}from"./chunk-KDMSOCZY.mjs";var R=class{bcsToBytes(){let e=new s;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return x.fromHexInput(e)}toStringWithoutPrefix(){return this.bcsToHex().toStringWithoutPrefix()}toString(){return`0x${this.toStringWithoutPrefix()}`}};function $(r,e){if(typeof r.serializeAsBytes=="function")r.serializeAsBytes(e);else{let i=e.bcsToBytes();r.serializeBytes(i)}}var V=256,B=[],X=8;function W(){let r=B.pop();return r?(r.reset(),r):new s}function F(r){B.length<X&&B.push(r)}var s=class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.dataView=new DataView(this.buffer),this.offset=0}ensureBufferWillHandleSize(e){let i=this.offset+e;if(this.buffer.byteLength>=i)return;let t=Math.max(Math.floor(this.buffer.byteLength*1.5),i+V),a=new ArrayBuffer(t);new Uint8Array(a).set(new Uint8Array(this.buffer,0,this.offset)),this.buffer=a,this.dataView=new DataView(this.buffer)}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,i,t){this.ensureBufferWillHandleSize(i),e.apply(this.dataView,[this.offset,t,!0]),this.offset+=i}serializeStr(e){this.serializeBytes(E.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){S(e);let i=e?1:0;this.appendToBuffer(new Uint8Array([i]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let i=BigInt(e)&BigInt(l),t=BigInt(e)>>BigInt(32);this.serializeU32(Number(i)),this.serializeU32(Number(t))}serializeU128(e){let i=BigInt(e)&h,t=BigInt(e)>>BigInt(64);this.serializeU64(i),this.serializeU64(t)}serializeU256(e){let i=BigInt(e)&u,t=BigInt(e)>>BigInt(128);this.serializeU128(i),this.serializeU128(t)}serializeI8(e){this.serializeWithFunction(DataView.prototype.setInt8,1,e)}serializeI16(e){this.serializeWithFunction(DataView.prototype.setInt16,2,e)}serializeI32(e){this.serializeWithFunction(DataView.prototype.setInt32,4,e)}serializeI64(e){let i=BigInt(e),t=i<0?(BigInt(1)<<BigInt(64))+i:i,a=t&BigInt(l),f=t>>BigInt(32);this.serializeU32(Number(a)),this.serializeU32(Number(f))}serializeI128(e){let i=BigInt(e),t=i<0?(BigInt(1)<<BigInt(128))+i:i,a=t&h,f=t>>BigInt(64);this.serializeU64(a),this.serializeU64(f)}serializeI256(e){let i=BigInt(e),t=i<0?(BigInt(1)<<BigInt(256))+i:i,a=t&u,f=t>>BigInt(128);this.serializeU128(a),this.serializeU128(f)}serializeU32AsUleb128(e){let i=e,t=[];for(;i>>>7;)t.push(i&127|128),i>>>=7;t.push(i),this.appendToBuffer(new Uint8Array(t))}toUint8Array(){return new Uint8Array(this.buffer,0,this.offset).slice()}reset(){this.offset>0&&new Uint8Array(this.buffer,0,this.offset).fill(0),this.offset=0}getOffset(){return this.offset}toUint8ArrayView(){return new Uint8Array(this.buffer,0,this.offset)}serialize(e){e.serialize(this)}serializeAsBytes(e){let i=W();try{e.serialize(i);let t=i.toUint8ArrayView();this.serializeBytes(t)}finally{F(i)}}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(i=>{i.serialize(this)})}serializeOption(e,i){let t=e!==void 0;this.serializeBool(t),t&&(typeof e=="string"?this.serializeStr(e):e instanceof Uint8Array?i!==void 0?this.serializeFixedBytes(e):this.serializeBytes(e):e.serialize(this))}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};n([o(0,y)],s.prototype,"serializeU8",1),n([o(0,c)],s.prototype,"serializeU16",1),n([o(0,l)],s.prototype,"serializeU32",1),n([o(BigInt(0),h)],s.prototype,"serializeU64",1),n([o(BigInt(0),u)],s.prototype,"serializeU128",1),n([o(BigInt(0),U)],s.prototype,"serializeU256",1),n([o(b,z)],s.prototype,"serializeI8",1),n([o(g,A)],s.prototype,"serializeI16",1),n([o(p,_)],s.prototype,"serializeI32",1),n([o(w,d)],s.prototype,"serializeI64",1),n([o(N,m)],s.prototype,"serializeI128",1),n([o(T,M)],s.prototype,"serializeI256",1),n([o(0,l)],s.prototype,"serializeU32AsUleb128",1);function S(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var D=(r,e,i)=>`${r} is out of range: [${e}, ${i}]`;function G(r,e,i){let t=BigInt(r);if(t>BigInt(i)||t<BigInt(e))throw new Error(D(r,e,i))}function o(r,e){return(i,t,a)=>{let f=a.value;return a.value=function(I){return G(I,r,e),f.apply(this,[I])},a}}export{R as a,$ as b,s as c,S as d,D as e,G as f};
2
+ //# sourceMappingURL=chunk-RUKFK3OC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/bcs/serializer.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n MAX_U128_BIG_INT,\n MAX_U16_NUMBER,\n MAX_U32_NUMBER,\n MAX_U64_BIG_INT,\n MAX_U8_NUMBER,\n MAX_U256_BIG_INT,\n MIN_I8_NUMBER,\n MAX_I8_NUMBER,\n MIN_I16_NUMBER,\n MAX_I16_NUMBER,\n MIN_I32_NUMBER,\n MAX_I32_NUMBER,\n MIN_I64_BIG_INT,\n MAX_I64_BIG_INT,\n MIN_I128_BIG_INT,\n MAX_I128_BIG_INT,\n MIN_I256_BIG_INT,\n MAX_I256_BIG_INT,\n} from \"./consts\";\nimport { Hex } from \"../core/hex\";\nimport { AnyNumber, Uint16, Uint32, Uint8 } from \"../types\";\nimport { TEXT_ENCODER } from \"../utils/const\";\n\n/**\n * This class serves as a base class for all serializable types. It facilitates\n * composable serialization of complex types and enables the serialization of\n * instances to their BCS (Binary Canonical Serialization) representation.\n * @group Implementation\n * @category BCS\n */\nexport abstract class Serializable {\n abstract serialize(serializer: Serializer): void;\n\n /**\n * Serializes a `Serializable` value to its BCS representation.\n * This function is the TypeScript SDK equivalent of `bcs::to_bytes` in Move.\n * @returns the BCS representation of the Serializable instance as a byte buffer.\n * @group Implementation\n * @category BCS\n */\n bcsToBytes(): Uint8Array {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n /**\n * Converts the BCS-serialized bytes of a value into a Hex instance.\n * This function provides a Hex representation of the BCS-serialized data for easier handling and manipulation.\n * @returns A Hex instance with the BCS-serialized bytes loaded into its underlying Uint8Array.\n * @group Implementation\n * @category BCS\n */\n bcsToHex(): Hex {\n const bcsBytes = this.bcsToBytes();\n return Hex.fromHexInput(bcsBytes);\n }\n\n /**\n * Returns the hex string representation of the `Serializable` value without the 0x prefix.\n * @returns the hex format as a string without `0x` prefix.\n */\n toStringWithoutPrefix(): string {\n return this.bcsToHex().toStringWithoutPrefix();\n }\n\n /**\n * Returns the hex string representation of the `Serializable` value with the 0x prefix.\n * @returns the hex formatas a string prefixed by `0x`.\n */\n toString(): string {\n return `0x${this.toStringWithoutPrefix()}`;\n }\n}\n\n/**\n * Serialize a Serializable value as length-prefixed bytes into a Serializer,\n * with backwards compatibility for older Serializer implementations that lack\n * the `serializeAsBytes` method. This is critical for cross-version compatibility\n * when SDK objects built with a newer SDK are serialized by an older SDK's Serializer\n * (e.g., wallet extensions bundling an older SDK version).\n *\n * @param serializer - The serializer to write into (may be from any SDK version).\n * @param value - The Serializable value to serialize as bytes.\n */\nexport function serializeEntryFunctionBytesCompat(serializer: Serializer, value: Serializable): void {\n if (typeof (serializer as { serializeAsBytes?: unknown }).serializeAsBytes === \"function\") {\n serializer.serializeAsBytes(value);\n } else {\n const bcsBytes = value.bcsToBytes();\n serializer.serializeBytes(bcsBytes);\n }\n}\n\n/**\n * Minimum buffer growth increment to avoid too many small reallocations.\n */\nconst MIN_BUFFER_GROWTH = 256;\n\n/**\n * Pool of reusable Serializer instances for temporary serialization operations.\n * This reduces allocations when using serializeAsBytes() repeatedly.\n */\nconst serializerPool: Serializer[] = [];\nconst MAX_POOL_SIZE = 8;\n\n/**\n * Acquires a Serializer from the pool or creates a new one.\n * @internal\n */\nfunction acquireSerializer(): Serializer {\n const serializer = serializerPool.pop();\n if (serializer) {\n serializer.reset();\n return serializer;\n }\n return new Serializer();\n}\n\n/**\n * Returns a Serializer to the pool for reuse.\n * @internal\n */\nfunction releaseSerializer(serializer: Serializer): void {\n if (serializerPool.length < MAX_POOL_SIZE) {\n serializerPool.push(serializer);\n }\n}\n\n/**\n * A class for serializing various data types into a binary format.\n * It provides methods to serialize strings, bytes, numbers, and other serializable objects\n * using the Binary Coded Serialization (BCS) layout. The serialized data can be retrieved as a\n * Uint8Array.\n * @group Implementation\n * @category BCS\n */\nexport class Serializer {\n private buffer: ArrayBuffer;\n\n private offset: number;\n\n /**\n * Reusable DataView instance to reduce allocations during serialization.\n * Recreated when buffer is resized.\n */\n private dataView: DataView;\n\n /**\n * Constructs a serializer with a buffer of size `length` bytes, 64 bytes by default.\n * The `length` must be greater than 0.\n *\n * @param length - The size of the buffer in bytes.\n * @group Implementation\n * @category BCS\n */\n constructor(length: number = 64) {\n if (length <= 0) {\n throw new Error(\"Length needs to be greater than 0\");\n }\n this.buffer = new ArrayBuffer(length);\n this.dataView = new DataView(this.buffer);\n this.offset = 0;\n }\n\n /**\n * Ensures that the internal buffer can accommodate the specified number of bytes.\n * This function dynamically resizes the buffer using a growth factor of 1.5x with\n * a minimum growth increment to balance memory usage and reallocation frequency.\n *\n * @param bytes - The number of bytes to ensure the buffer can handle.\n * @group Implementation\n * @category BCS\n */\n private ensureBufferWillHandleSize(bytes: number) {\n const requiredSize = this.offset + bytes;\n if (this.buffer.byteLength >= requiredSize) {\n return;\n }\n\n // Calculate new size: max of (1.5x current size) or (current + required + MIN_GROWTH)\n // Using 1.5x instead of 2x provides better memory efficiency\n const growthSize = Math.max(Math.floor(this.buffer.byteLength * 1.5), requiredSize + MIN_BUFFER_GROWTH);\n\n const newBuffer = new ArrayBuffer(growthSize);\n new Uint8Array(newBuffer).set(new Uint8Array(this.buffer, 0, this.offset));\n this.buffer = newBuffer;\n this.dataView = new DataView(this.buffer);\n }\n\n /**\n * Appends the specified values to the buffer, ensuring that the buffer can accommodate the new data.\n *\n * @param {Uint8Array} values - The values to be appended to the buffer.\n * @group Implementation\n * @category BCS\n */\n protected appendToBuffer(values: Uint8Array) {\n this.ensureBufferWillHandleSize(values.length);\n new Uint8Array(this.buffer, this.offset).set(values);\n this.offset += values.length;\n }\n\n /**\n * Serializes a value into the buffer using the provided function, ensuring the buffer can accommodate the size.\n * Uses the cached DataView instance for better performance.\n *\n * @param fn - The function to serialize the value, which takes a byte offset, the value to serialize, and an optional little-endian flag.\n * @param fn.byteOffset - The byte offset at which to write the value.\n * @param fn.value - The numeric value to serialize into the buffer.\n * @param fn.littleEndian - Optional flag indicating whether to use little-endian byte order (defaults to true).\n * @group Implementation\n * @category BCS\n */\n // TODO: JSDoc bytesLength and value\n private serializeWithFunction(\n fn: (byteOffset: number, value: number, littleEndian?: boolean) => void,\n bytesLength: number,\n value: number,\n ) {\n this.ensureBufferWillHandleSize(bytesLength);\n fn.apply(this.dataView, [this.offset, value, true]);\n this.offset += bytesLength;\n }\n\n /**\n * Serializes a string. UTF8 string is supported.\n * The number of bytes in the string content is serialized first, as a uleb128-encoded u32 integer.\n * Then the string content is serialized as UTF8 encoded bytes.\n *\n * BCS layout for \"string\": string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n *\n * @param value - The string to serialize.\n *\n * @example\n * ```typescript\n * const serializer = new Serializer();\n * serializer.serializeStr(\"1234abcd\");\n * assert(serializer.toUint8Array() === new Uint8Array([8, 49, 50, 51, 52, 97, 98, 99, 100]));\n * ```\n * @group Implementation\n * @category BCS\n */\n serializeStr(value: string) {\n this.serializeBytes(TEXT_ENCODER.encode(value));\n }\n\n /**\n * Serializes an array of bytes.\n *\n * This function encodes the length of the byte array as a u32 integer in uleb128 format, followed by the byte array itself.\n * BCS layout for \"bytes\": bytes_length | bytes\n * where bytes_length is a u32 integer encoded as a uleb128 integer, equal to the length of the bytes array.\n * @param value - The byte array to serialize.\n * @group Implementation\n * @category BCS\n */\n serializeBytes(value: Uint8Array) {\n this.serializeU32AsUleb128(value.length);\n this.appendToBuffer(value);\n }\n\n /**\n * Serializes an array of bytes with a known length, allowing for efficient deserialization without needing to serialize the\n * length itself.\n * When deserializing, the number of bytes to deserialize needs to be passed in.\n\n * @param value - The Uint8Array to be serialized.\n * @group Implementation\n * @category BCS\n */\n serializeFixedBytes(value: Uint8Array) {\n this.appendToBuffer(value);\n }\n\n /**\n * Serializes a boolean value into a byte representation.\n *\n * The BCS layout for a boolean uses one byte, where \"0x01\" represents true and \"0x00\" represents false.\n *\n * @param value - The boolean value to serialize.\n * @group Implementation\n * @category BCS\n */\n serializeBool(value: boolean) {\n /**\n * Ensures that the provided value is a boolean.\n * This function throws an error if the value is not a boolean, helping to enforce type safety in your code.\n *\n * @param value - The value to be checked for boolean type.\n * @throws {Error} Throws an error if the value is not a boolean.\n * @group Implementation\n * @category BCS\n */\n ensureBoolean(value);\n const byteValue = value ? 1 : 0;\n this.appendToBuffer(new Uint8Array([byteValue]));\n }\n\n /**\n * Serializes a Uint8 value and appends it to the buffer.\n * BCS layout for \"uint8\": One byte. Binary format in little-endian representation.\n *\n * @param value - The Uint8 value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(0, MAX_U8_NUMBER)\n serializeU8(value: Uint8) {\n this.appendToBuffer(new Uint8Array([value]));\n }\n\n /**\n * Serializes a uint16 number.\n *\n * @group Implementation\n * @category BCS\n\n */\n\n /**\n * Serializes a 16-bit unsigned integer value into a binary format.\n * BCS layout for \"uint16\": Two bytes. Binary format in little-endian representation.\n *\n * @param value - The 16-bit unsigned integer value to serialize.\n * @example\n * ```typescript\n * const serializer = new Serializer();\n * serializer.serializeU16(4660);\n * assert(serializer.toUint8Array() === new Uint8Array([0x34, 0x12]));\n * ```\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(0, MAX_U16_NUMBER)\n serializeU16(value: Uint16) {\n this.serializeWithFunction(DataView.prototype.setUint16, 2, value);\n }\n\n /**\n * Serializes a 32-bit unsigned integer value into a binary format.\n * This function is useful for encoding data that needs to be stored or transmitted in a compact form.\n * @example\n * ```typescript\n * const serializer = new Serializer();\n * serializer.serializeU32(305419896);\n * assert(serializer.toUint8Array() === new Uint8Array([0x78, 0x56, 0x34, 0x12]));\n * ```\n * @param value - The 32-bit unsigned integer value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(0, MAX_U32_NUMBER)\n serializeU32(value: Uint32) {\n this.serializeWithFunction(DataView.prototype.setUint32, 4, value);\n }\n\n /**\n * Serializes a 64-bit unsigned integer into a format suitable for storage or transmission.\n * This function breaks down the value into two 32-bit components and writes them in little-endian order.\n *\n * @param value - The 64-bit unsigned integer to serialize, represented as a number.\n * @example\n * ```ts\n * const serializer = new Serializer();\n * serializer.serializeU64(1311768467750121216);\n * assert(serializer.toUint8Array() === new Uint8Array([0x00, 0xEF, 0xCD, 0xAB, 0x78, 0x56, 0x34, 0x12]));\n * ```\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(BigInt(0), MAX_U64_BIG_INT)\n serializeU64(value: AnyNumber) {\n const low = BigInt(value) & BigInt(MAX_U32_NUMBER);\n const high = BigInt(value) >> BigInt(32);\n\n // write little endian number\n this.serializeU32(Number(low));\n this.serializeU32(Number(high));\n }\n\n /**\n * Serializes a U128 value into a format suitable for storage or transmission.\n *\n * @param value - The U128 value to serialize, represented as a number.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(BigInt(0), MAX_U128_BIG_INT)\n serializeU128(value: AnyNumber) {\n const low = BigInt(value) & MAX_U64_BIG_INT;\n const high = BigInt(value) >> BigInt(64);\n\n // write little endian number\n this.serializeU64(low);\n this.serializeU64(high);\n }\n\n /**\n * Serializes a U256 value into a byte representation.\n * This function is essential for encoding large numbers in a compact format suitable for transmission or storage.\n *\n * @param value - The U256 value to serialize, represented as an AnyNumber.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(BigInt(0), MAX_U256_BIG_INT)\n serializeU256(value: AnyNumber) {\n const low = BigInt(value) & MAX_U128_BIG_INT;\n const high = BigInt(value) >> BigInt(128);\n\n // write little endian number\n this.serializeU128(low);\n this.serializeU128(high);\n }\n\n /**\n * Serializes an 8-bit signed integer value.\n * BCS layout for \"int8\": One byte. Binary format in little-endian representation.\n *\n * @param value - The 8-bit signed integer value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(MIN_I8_NUMBER, MAX_I8_NUMBER)\n serializeI8(value: number) {\n this.serializeWithFunction(DataView.prototype.setInt8, 1, value);\n }\n\n /**\n * Serializes a 16-bit signed integer value into a binary format.\n * BCS layout for \"int16\": Two bytes. Binary format in little-endian representation.\n *\n * @param value - The 16-bit signed integer value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(MIN_I16_NUMBER, MAX_I16_NUMBER)\n serializeI16(value: number) {\n this.serializeWithFunction(DataView.prototype.setInt16, 2, value);\n }\n\n /**\n * Serializes a 32-bit signed integer value into a binary format.\n *\n * @param value - The 32-bit signed integer value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(MIN_I32_NUMBER, MAX_I32_NUMBER)\n serializeI32(value: number) {\n this.serializeWithFunction(DataView.prototype.setInt32, 4, value);\n }\n\n /**\n * Serializes a 64-bit signed integer into a format suitable for storage or transmission.\n * This function uses two's complement representation for negative values.\n *\n * @param value - The 64-bit signed integer to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(MIN_I64_BIG_INT, MAX_I64_BIG_INT)\n serializeI64(value: AnyNumber) {\n const val = BigInt(value);\n // Convert to unsigned representation using two's complement\n const unsigned = val < 0 ? (BigInt(1) << BigInt(64)) + val : val;\n const low = unsigned & BigInt(MAX_U32_NUMBER);\n const high = unsigned >> BigInt(32);\n\n // write little endian number\n this.serializeU32(Number(low));\n this.serializeU32(Number(high));\n }\n\n /**\n * Serializes a 128-bit signed integer value.\n *\n * @param value - The 128-bit signed integer value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(MIN_I128_BIG_INT, MAX_I128_BIG_INT)\n serializeI128(value: AnyNumber) {\n const val = BigInt(value);\n // Convert to unsigned representation using two's complement\n const unsigned = val < 0 ? (BigInt(1) << BigInt(128)) + val : val;\n const low = unsigned & MAX_U64_BIG_INT;\n const high = unsigned >> BigInt(64);\n\n // write little endian number\n this.serializeU64(low);\n this.serializeU64(high);\n }\n\n /**\n * Serializes a 256-bit signed integer value.\n *\n * @param value - The 256-bit signed integer value to serialize.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(MIN_I256_BIG_INT, MAX_I256_BIG_INT)\n serializeI256(value: AnyNumber) {\n const val = BigInt(value);\n // Convert to unsigned representation using two's complement\n const unsigned = val < 0 ? (BigInt(1) << BigInt(256)) + val : val;\n const low = unsigned & MAX_U128_BIG_INT;\n const high = unsigned >> BigInt(128);\n\n // write little endian number\n this.serializeU128(low);\n this.serializeU128(high);\n }\n\n /**\n * Serializes a 32-bit unsigned integer as a variable-length ULEB128 encoded byte array.\n * BCS uses uleb128 encoding in two cases: (1) lengths of variable-length sequences and (2) tags of enum values\n *\n * @param val - The 32-bit unsigned integer value to be serialized.\n * @group Implementation\n * @category BCS\n */\n @checkNumberRange(0, MAX_U32_NUMBER)\n serializeU32AsUleb128(val: Uint32) {\n let value = val;\n const valueArray = [];\n while (value >>> 7 !== 0) {\n valueArray.push((value & 0x7f) | 0x80);\n value >>>= 7;\n }\n valueArray.push(value);\n this.appendToBuffer(new Uint8Array(valueArray));\n }\n\n /**\n * Returns the buffered bytes as a Uint8Array.\n *\n * This function allows you to retrieve the byte representation of the buffer up to the current offset.\n * For better performance, returns a view when the buffer is exactly the right size, or copies\n * only the used portion otherwise.\n *\n * @returns Uint8Array - The byte array representation of the buffer.\n * @group Implementation\n * @category BCS\n */\n toUint8Array(): Uint8Array {\n // Return a copy of only the used portion of the buffer\n // Using subarray + slice pattern for efficiency\n return new Uint8Array(this.buffer, 0, this.offset).slice();\n }\n\n /**\n * Resets the serializer to its initial state, allowing the buffer to be reused.\n * This clears the buffer contents to prevent data leakage between uses.\n *\n * @group Implementation\n * @category BCS\n */\n reset(): void {\n // Clear buffer contents to prevent data leakage when reusing pooled serializers\n // Only clear the portion that was used (up to offset) for efficiency\n if (this.offset > 0) {\n new Uint8Array(this.buffer, 0, this.offset).fill(0);\n }\n this.offset = 0;\n }\n\n /**\n * Returns the current number of bytes written to the serializer.\n *\n * @returns The number of bytes written.\n * @group Implementation\n * @category BCS\n */\n getOffset(): number {\n return this.offset;\n }\n\n /**\n * Returns a view of the serialized bytes without copying.\n * WARNING: The returned view is only valid until the next write operation.\n * Use toUint8Array() if you need a persistent copy.\n *\n * @returns A Uint8Array view of the buffer (not a copy).\n * @group Implementation\n * @category BCS\n */\n toUint8ArrayView(): Uint8Array {\n return new Uint8Array(this.buffer, 0, this.offset);\n }\n\n /**\n * Serializes a `Serializable` value, facilitating composable serialization.\n *\n * @param value The Serializable value to serialize.\n *\n * @returns the serializer instance\n * @group Implementation\n * @category BCS\n */\n serialize<T extends Serializable>(value: T): void {\n // NOTE: The `serialize` method called by `value` is defined in `value`'s\n // Serializable interface, not the one defined in this class.\n value.serialize(this);\n }\n\n /**\n * Serializes a Serializable value as a byte array with a length prefix.\n * This is the optimized pattern for entry function argument serialization.\n *\n * Instead of:\n * ```typescript\n * const bcsBytes = value.bcsToBytes(); // Creates new Serializer, copies bytes\n * serializer.serializeBytes(bcsBytes);\n * ```\n *\n * Use:\n * ```typescript\n * serializer.serializeAsBytes(value); // Uses pooled Serializer, avoids extra copy\n * ```\n *\n * This method uses a pooled Serializer instance to reduce allocations and\n * directly appends the serialized bytes with a length prefix.\n *\n * @param value - The Serializable value to serialize as bytes.\n * @group Implementation\n * @category BCS\n */\n serializeAsBytes<T extends Serializable>(value: T): void {\n // Acquire a pooled serializer for temporary use\n const tempSerializer = acquireSerializer();\n\n try {\n // Serialize the value to the temporary serializer\n value.serialize(tempSerializer);\n\n // Get the serialized bytes (as a view to avoid copying)\n const bytes = tempSerializer.toUint8ArrayView();\n\n // Serialize with length prefix to this serializer\n this.serializeBytes(bytes);\n } finally {\n // Return the serializer to the pool for reuse\n releaseSerializer(tempSerializer);\n }\n }\n\n /**\n * Serializes an array of BCS Serializable values to a serializer instance.\n * The bytes are added to the serializer instance's byte buffer.\n *\n * @param values The array of BCS Serializable values\n * @example\n * const addresses = new Array<AccountAddress>(\n * AccountAddress.from(\"0x1\"),\n * AccountAddress.from(\"0x2\"),\n * AccountAddress.from(\"0xa\"),\n * AccountAddress.from(\"0xb\"),\n * );\n * const serializer = new Serializer();\n * serializer.serializeVector(addresses);\n * const serializedBytes = serializer.toUint8Array();\n * // serializedBytes is now the BCS-serialized bytes\n * // The equivalent value in Move would be:\n * // `bcs::to_bytes(&vector<address> [@0x1, @0x2, @0xa, @0xb])`;\n * @group Implementation\n * @category BCS\n */\n serializeVector<T extends Serializable>(values: Array<T>): void {\n this.serializeU32AsUleb128(values.length);\n values.forEach((item) => {\n item.serialize(this);\n });\n }\n\n /**\n * Serializes an optional value which can be a Serializable, string, or Uint8Array.\n * For strings and Uint8Arrays, it uses the appropriate serialization method.\n *\n * @param value The value to serialize (Serializable, string, Uint8Array, or undefined)\n * @param len Optional fixed length for Uint8Array serialization. If provided, uses serializeFixedBytes instead of serializeBytes\n *\n * @example\n * ```typescript\n * const serializer = new Serializer();\n * serializer.serializeOption(\"hello\"); // Serializes optional string\n * serializer.serializeOption(new Uint8Array([1, 2, 3])); // Serializes optional bytes\n * serializer.serializeOption(new Uint8Array([1, 2, 3]), 3); // Serializes optional fixed-length bytes\n * serializer.serializeOption(new AccountAddress(...)); // Serializes optional Serializable\n * serializer.serializeOption(undefined); // Serializes none case\n * ```\n * @group Implementation\n * @category BCS\n */\n serializeOption<T extends Serializable | string | Uint8Array>(value?: T, len?: number): void {\n const hasValue = value !== undefined;\n this.serializeBool(hasValue);\n if (hasValue) {\n if (typeof value === \"string\") {\n this.serializeStr(value);\n } else if (value instanceof Uint8Array) {\n if (len !== undefined) {\n this.serializeFixedBytes(value);\n } else {\n this.serializeBytes(value);\n }\n } else {\n value.serialize(this);\n }\n }\n }\n\n /**\n * @deprecated use `serializeOption` instead.\n * Serializes an optional string, supporting UTF8 encoding.\n * The function encodes the existence of the string first, followed by the length and content if it exists.\n *\n * BCS layout for optional \"string\": 1 | string_length | string_content\n * where string_length is a u32 integer encoded as a uleb128 integer, equal to the number of bytes in string_content.\n * BCS layout for undefined: 0\n *\n * @param value - The optional string to serialize. If undefined, it will serialize as 0.\n * @group Implementation\n * @category BCS\n */\n serializeOptionStr(value?: string): void {\n if (value === undefined) {\n this.serializeU32AsUleb128(0);\n } else {\n this.serializeU32AsUleb128(1);\n this.serializeStr(value);\n }\n }\n}\n\n/**\n * @group Implementation\n * @category BCS\n */\nexport function ensureBoolean(value: unknown): asserts value is boolean {\n if (typeof value !== \"boolean\") {\n throw new Error(`${value} is not a boolean value`);\n }\n}\n/**\n * @group Implementation\n * @category BCS\n */\nexport const outOfRangeErrorMessage = (value: AnyNumber, min: AnyNumber, max: AnyNumber) =>\n `${value} is out of range: [${min}, ${max}]`;\n\n/**\n * Validates that a given number is within a specified range.\n * This function throws an error if the value is outside the defined minimum and maximum bounds.\n *\n * @param value - The number to validate.\n * @param minValue - The minimum allowable value (inclusive).\n * @param maxValue - The maximum allowable value (inclusive).\n * @group Implementation\n * @category BCS\n */\nexport function validateNumberInRange<T extends AnyNumber>(value: T, minValue: T, maxValue: T) {\n const valueBigInt = BigInt(value);\n if (valueBigInt > BigInt(maxValue) || valueBigInt < BigInt(minValue)) {\n throw new Error(outOfRangeErrorMessage(value, minValue, maxValue));\n }\n}\n\n/**\n * A decorator that validates that the input argument for a function is within a specified range.\n * This ensures that the function is only called with valid input values, preventing potential errors.\n *\n * @param minValue - The input argument must be greater than or equal to this value.\n * @param maxValue - The input argument must be less than or equal to this value.\n * @group Implementation\n * @category BCS\n */\nfunction checkNumberRange<T extends AnyNumber>(minValue: T, maxValue: T) {\n return (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => {\n const childFunction = descriptor.value;\n\n descriptor.value = function deco(value: AnyNumber) {\n validateNumberInRange(value, minValue, maxValue);\n return childFunction.apply(this, [value]);\n };\n\n return descriptor;\n };\n}\n"],"mappings":"2RAkCO,IAAeA,EAAf,KAA4B,CAUjC,YAAyB,CACvB,IAAMC,EAAa,IAAIC,EACvB,YAAK,UAAUD,CAAU,EAClBA,EAAW,aAAa,CACjC,CASA,UAAgB,CACd,IAAME,EAAW,KAAK,WAAW,EACjC,OAAOC,EAAI,aAAaD,CAAQ,CAClC,CAMA,uBAAgC,CAC9B,OAAO,KAAK,SAAS,EAAE,sBAAsB,CAC/C,CAMA,UAAmB,CACjB,MAAO,KAAK,KAAK,sBAAsB,CAAC,EAC1C,CACF,EAYO,SAASE,EAAkCJ,EAAwBK,EAA2B,CACnG,GAAI,OAAQL,EAA8C,kBAAqB,WAC7EA,EAAW,iBAAiBK,CAAK,MAC5B,CACL,IAAMH,EAAWG,EAAM,WAAW,EAClCL,EAAW,eAAeE,CAAQ,CACpC,CACF,CAKA,IAAMI,EAAoB,IAMpBC,EAA+B,CAAC,EAChCC,EAAgB,EAMtB,SAASC,GAAgC,CACv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AA,CADCC,EAAiBI,EAAeC,CAAa,GAhSnCvC,EAiSX,2BAaAiC,EAAA,CADCC,EAAiBM,EAAgBC,CAAc,GA7SrCzC,EA8SX,4BAYAiC,EAAA,CADCC,EAAiBQ,EAAgBC,CAAc,GAzTrC3C,EA0TX,4BAaAiC,EAAA,CADCC,EAAiBU,EAAiBC,CAAe,GAtUvC7C,EAuUX,4BAoBAiC,EAAA,CADCC,EAAiBY,EAAkBC,CAAgB,GA1VzC/C,EA2VX,6BAoBAiC,EAAA,CADCC,EAAiBc,EAAkBC,CAAgB,GA9WzCjD,EA+WX,6BAqBAiC,EAAA,CADCC,EAAiB,EAAGZ,CAAc,GAnYxBtB,EAoYX,qCAwNK,SAASmB,EAAcf,EAA0C,CACtE,GAAI,OAAOA,GAAU,UACnB,MAAM,IAAI,MAAM,GAAGA,CAAK,yBAAyB,CAErD,CAKO,IAAM8C,EAAyB,CAAC9C,EAAkB+C,EAAgBC,IACvE,GAAGhD,CAAK,sBAAsB+C,CAAG,KAAKC,CAAG,IAYpC,SAASC,EAA2CjD,EAAUkD,EAAaC,EAAa,CAC7F,IAAMC,EAAc,OAAOpD,CAAK,EAChC,GAAIoD,EAAc,OAAOD,CAAQ,GAAKC,EAAc,OAAOF,CAAQ,EACjE,MAAM,IAAI,MAAMJ,EAAuB9C,EAAOkD,EAAUC,CAAQ,CAAC,CAErE,CAWA,SAASrB,EAAsCoB,EAAaC,EAAa,CACvE,MAAO,CAACE,EAAiBC,EAAqBC,IAAmC,CAC/E,IAAMC,EAAgBD,EAAW,MAEjC,OAAAA,EAAW,MAAQ,SAAcvD,EAAkB,CACjD,OAAAiD,EAAsBjD,EAAOkD,EAAUC,CAAQ,EACxCK,EAAc,MAAM,KAAM,CAACxD,CAAK,CAAC,CAC1C,EAEOuD,CACT,CACF","names":["Serializable","serializer","Serializer","bcsBytes","Hex","serializeEntryFunctionBytesCompat","value","MIN_BUFFER_GROWTH","serializerPool","MAX_POOL_SIZE","acquireSerializer","releaseSerializer","length","bytes","requiredSize","growthSize","newBuffer","values","fn","bytesLength","TEXT_ENCODER","ensureBoolean","byteValue","low","MAX_U32_NUMBER","high","MAX_U64_BIG_INT","MAX_U128_BIG_INT","val","unsigned","valueArray","tempSerializer","item","len","hasValue","__decorateClass","checkNumberRange","MAX_U8_NUMBER","MAX_U16_NUMBER","MAX_U256_BIG_INT","MIN_I8_NUMBER","MAX_I8_NUMBER","MIN_I16_NUMBER","MAX_I16_NUMBER","MIN_I32_NUMBER","MAX_I32_NUMBER","MIN_I64_BIG_INT","MAX_I64_BIG_INT","MIN_I128_BIG_INT","MAX_I128_BIG_INT","MIN_I256_BIG_INT","MAX_I256_BIG_INT","outOfRangeErrorMessage","min","max","validateNumberInRange","minValue","maxValue","valueBigInt","target","propertyKey","descriptor","childFunction"]}
@@ -0,0 +1,2 @@
1
+ var o="6.3.1";export{o as a};
2
+ //# sourceMappingURL=chunk-RYCI4VKO.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"6.2.0\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
1
+ {"version":3,"sources":["../../src/version.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * The current version of the SDK\n *\n * hardcoded for now, we would want to have it injected dynamically\n */\nexport const VERSION = \"6.3.1\";\n"],"mappings":"AAQO,IAAMA,EAAU","names":["VERSION"]}
@@ -1,2 +1,2 @@
1
- import{b as c}from"./chunk-FDHHQUS3.mjs";import{a as o}from"./chunk-66F7RP7K.mjs";import{b as n}from"./chunk-STY74NUA.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new c(this.data.toUint8Array())}};r.LENGTH=32;var s=r;export{s as a};
2
- //# sourceMappingURL=chunk-TSPG5VED.mjs.map
1
+ import{b as c}from"./chunk-6T2OBPIF.mjs";import{a as o}from"./chunk-RUKFK3OC.mjs";import{b as n}from"./chunk-STY74NUA.mjs";import{sha3_256 as d}from"@noble/hashes/sha3";var r=class r extends o{constructor(t){super();let{data:e}=t,i=n.fromHexInput(e);if(i.toUint8Array().length!==r.LENGTH)throw new Error(`Authentication Key length should be ${r.LENGTH}`);this.data=i}serialize(t){t.serializeFixedBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeFixedBytes(r.LENGTH);return new r({data:e})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(t){let{scheme:e,input:i}=t,u=n.fromHexInput(i).toUint8Array(),h=new Uint8Array([...u,e]),a=d.create();a.update(h);let y=a.digest();return new r({data:y})}static fromPublicKeyAndScheme(t){let{publicKey:e}=t;return e.authKey()}static fromPublicKey(t){let{publicKey:e}=t;return e.authKey()}derivedAddress(){return new c(this.data.toUint8Array())}};r.LENGTH=32;var s=r;export{s as a};
2
+ //# sourceMappingURL=chunk-RZNP3WG4.mjs.map
@@ -1,2 +1,2 @@
1
- import{b as u}from"./chunk-Q4KYBAYN.mjs";async function i(e){let{aptosConfig:t,overrides:s,params:r,contentType:n,acceptType:a,path:p,originMethod:o,type:R}=e,d=t.getRequestUrl(R);return u({url:d,method:"GET",originMethod:o,path:p,contentType:n,acceptType:a,params:r,overrides:{...t.clientConfig,...s}},t,e.type)}async function l(e){let{aptosConfig:t}=e;return i({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){return i({...e,type:"Pepper"})}async function q(e){let t=[],s,r=e.params;do{let n=await i({type:"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=t.concat(n.data),r.start=s}while(s!=null);return t}async function A(e){let t=[],s,r=e.params,n=r.limit;do{let{response:a,cursor:p}=await c({...e});if(s=p,t=t.concat(a.data),e?.params&&(e.params.start=s),n!==void 0){let o=n-t.length;if(o<=0)break;r.limit=o}}while(s!=null);return t}async function c(e){let t={};typeof e.params?.cursor=="string"&&(t.start=e.params.cursor),typeof e.params?.limit=="number"&&(t.limit=e.params.limit);let s=await i({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:t,overrides:e.overrides}),r=s.headers["x-aptos-cursor"]??void 0;return{response:s,cursor:r}}export{i as a,l as b,y as c,q as d,A as e,c as f};
2
- //# sourceMappingURL=chunk-2VHA77EO.mjs.map
1
+ import{b as u}from"./chunk-2DQRUJUC.mjs";async function i(e){let{aptosConfig:t,overrides:s,params:r,contentType:n,acceptType:a,path:p,originMethod:o,type:R}=e,d=t.getRequestUrl(R);return u({url:d,method:"GET",originMethod:o,path:p,contentType:n,acceptType:a,params:r,overrides:{...t.clientConfig,...s}},t,e.type)}async function l(e){let{aptosConfig:t}=e;return i({...e,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...e.overrides,HEADERS:{...t.clientConfig?.HEADERS,...t.fullnodeConfig?.HEADERS}}})}async function y(e){return i({...e,type:"Pepper"})}async function q(e){let t=[],s,r=e.params;do{let n=await i({type:"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=t.concat(n.data),r.start=s}while(s!=null);return t}async function A(e){let t=[],s,r=e.params,n=r.limit;do{let{response:a,cursor:p}=await c({...e});if(s=p,t=t.concat(a.data),e?.params&&(e.params.start=s),n!==void 0){let o=n-t.length;if(o<=0)break;r.limit=o}}while(s!=null);return t}async function c(e){let t={};typeof e.params?.cursor=="string"&&(t.start=e.params.cursor),typeof e.params?.limit=="number"&&(t.limit=e.params.limit);let s=await i({type:"Fullnode",aptosConfig:e.aptosConfig,originMethod:e.originMethod,path:e.path,params:t,overrides:e.overrides}),r=s.headers["x-aptos-cursor"]??void 0;return{response:s,cursor:r}}export{i as a,l as b,y as c,q as d,A as e,c as f};
2
+ //# sourceMappingURL=chunk-TBIK7DML.mjs.map
@@ -0,0 +1,2 @@
1
+ import{a as l}from"./chunk-LVZ7QMUH.mjs";import{a as h}from"./chunk-NHRPXEUE.mjs";import{a as x}from"./chunk-A5H5VKUI.mjs";import{a as m}from"./chunk-RZNP3WG4.mjs";import{c}from"./chunk-RUKFK3OC.mjs";import{b as n}from"./chunk-STY74NUA.mjs";import{sha3_256 as A}from"@noble/hashes/sha3";import{p256 as y}from"@noble/curves/nist";var s=class s extends x{constructor(e){super();this.keyType="secp256r1";let r=n.fromHexInput(e),i=r.toUint8Array().length;if(i!==s.LENGTH&&i!==s.COMPRESSED_LENGTH)throw new Error(`PublicKey length should be ${s.LENGTH} or ${s.COMPRESSED_LENGTH}, received ${i}`);if(i===s.COMPRESSED_LENGTH){let u=y.ProjectivePoint.fromHex(r.toUint8Array());this.key=n.fromHexInput(u.toRawBytes(!1))}else this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}bcsToBytes(){let e=new c;return this.serialize(e),e.toUint8Array()}verifySignature(e){let{message:r,signature:i}=e,u=n.fromHexInput(r).toUint8Array(),f=A(u),U=i.toUint8Array();return y.verify(U,f,this.toUint8Array())}async verifySignatureAsync(e){return this.verifySignature({message:e.message,signature:e.signature})}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new s(r)}static load(e){let r=e.deserializeBytes();return new s(r)}static isInstance(e){return"key"in e&&e.key?.data?.length===s.LENGTH&&"keyType"in e&&e.keyType==="secp256r1"}authKey(){let e=new c;return e.serializeU32AsUleb128(2),e.serializeFixedBytes(this.bcsToBytes()),m.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}};s.LENGTH=65,s.COMPRESSED_LENGTH=33;var g=s,a=class a extends l{constructor(t,e){super();let r=l.parseHexInput(t,"secp256r1",e),i=r.toUint8Array().length;if(i!==a.LENGTH)throw new Error(`PrivateKey length should be ${a.LENGTH}, received ${i}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return l.formatPrivateKey(this.key.toString(),"secp256r1")}toHexString(){return this.key.toString()}sign(t){let e=n.fromHexInput(t),r=A(e.toUint8Array()),i=y.sign(r,this.key.toUint8Array());return new p(i.toCompactRawBytes())}serialize(t){t.serializeBytes(this.toUint8Array())}static deserialize(t){let e=t.deserializeBytes();return new a(e)}static generate(){let t=y.utils.randomPrivateKey();return new a(t)}publicKey(){let t=y.getPublicKey(this.key.toUint8Array(),!1);return new g(t)}};a.LENGTH=32;var H=a,S=class d extends h{constructor(t,e,r){super(),this.signature=n.fromHexInput(t),this.authenticatorData=n.fromHexInput(e),this.clientDataJSON=n.fromHexInput(r)}toUint8Array(){return this.signature.toUint8Array()}serialize(t){t.serializeU32AsUleb128(0),t.serializeBytes(this.signature.toUint8Array()),t.serializeBytes(this.authenticatorData.toUint8Array()),t.serializeBytes(this.clientDataJSON.toUint8Array())}bcsToBytes(){let t=new c;return this.serialize(t),t.toUint8Array()}bcsToHex(){return n.fromHexInput(this.bcsToBytes())}toStringWithoutPrefix(){return n.fromHexInput(this.bcsToBytes()).toString()}static deserialize(t){let e=t.deserializeUleb128AsU32();if(e!==0)throw new Error(`Invalid id for WebAuthnSignature: ${e}`);let r=t.deserializeBytes(),i=t.deserializeBytes(),u=t.deserializeBytes();return new d(r,i,u)}},o=class o extends h{constructor(t){super();let e=n.fromHexInput(t),r=e.toUint8Array().length;if(r!==o.LENGTH)throw new Error(`Signature length should be ${o.LENGTH}, received ${r}`);let i=y.Signature.fromCompact(e.toUint8Array()).normalizeS().toCompactRawBytes();this.data=n.fromHexInput(i)}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(t){t.serializeBytes(this.data.toUint8Array())}static deserialize(t){let e=t.deserializeBytes();return new o(e)}};o.LENGTH=64;var p=o;export{g as a,H as b,S as c,p as d};
2
+ //# sourceMappingURL=chunk-UVNAHETD.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/core/crypto/secp256r1.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 } from \"@noble/hashes/sha3\";\nimport { p256 } from \"@noble/curves/nist\";\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport {\n HexInput,\n PrivateKeyVariants,\n SigningScheme as AuthenticationKeyScheme,\n AnyPublicKeyVariant,\n} from \"../../types\";\nimport { PublicKey, VerifySignatureAsyncArgs } from \"./publicKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { Signature } from \"./signature\";\nimport { AuthenticationKey } from \"../authenticationKey\";\n\n/**\n * Represents a Secp256r1 ECDSA public key.\n *\n * @extends PublicKey\n * @property LENGTH - The length of the Secp256r1 public key in bytes.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1PublicKey extends PublicKey {\n // Secp256r1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.\n static readonly LENGTH: number = 65;\n\n // If it's compressed, it is only 33 bytes\n static readonly COMPRESSED_LENGTH: number = 33;\n\n // Hex value of the public key\n private readonly key: Hex;\n\n // Identifier to distinguish from Secp256k1PublicKey\n public readonly keyType: string = \"secp256r1\";\n\n /**\n * Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array.\n * This constructor validates the length of the provided public key data.\n *\n * @param hexInput - A HexInput (string or Uint8Array) representing the public key data.\n * @throws Error if the length of the public key data is not equal to Secp256r1PublicKey.LENGTH or COMPRESSED_LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const keyLength = hex.toUint8Array().length;\n if (keyLength !== Secp256r1PublicKey.LENGTH && keyLength !== Secp256r1PublicKey.COMPRESSED_LENGTH) {\n throw new Error(\n `PublicKey length should be ${Secp256r1PublicKey.LENGTH} or ${Secp256r1PublicKey.COMPRESSED_LENGTH}, received ${keyLength}`,\n );\n }\n\n if (keyLength === Secp256r1PublicKey.COMPRESSED_LENGTH) {\n const point = p256.ProjectivePoint.fromHex(hex.toUint8Array());\n this.key = Hex.fromHexInput(point.toRawBytes(false));\n } else {\n this.key = hex;\n }\n }\n\n /**\n * Get the data as a Uint8Array representation.\n *\n * @returns Uint8Array representation of the data.\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the public key as a hex string with the 0x prefix.\n *\n * @returns string representation of the public key.\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.key.toString();\n }\n\n /**\n * Converts the public key to BCS (Binary Canonical Serialization) bytes.\n * This function serializes the public key data into a byte array format suitable for transmission or storage.\n *\n * @returns Uint8Array representation of the serialized public key.\n * @group Implementation\n * @category Serialization\n */\n bcsToBytes() {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n /**\n * Verifies a Secp256r1 signature against the public key.\n *\n * This function checks the validity of a signature for a given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify against the public key.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n\n const msgHex = Hex.fromHexInput(message).toUint8Array();\n const sha3Message = sha3_256(msgHex);\n const rawSignature = signature.toUint8Array();\n\n return p256.verify(rawSignature, sha3Message, this.toUint8Array());\n }\n\n /**\n * Note: Secp256r1Signatures can be verified synchronously.\n *\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of Secp256r1Signature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {\n return this.verifySignature({ message: args.message, signature: args.signature });\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1PublicKey from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1PublicKey object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PublicKey(bytes);\n }\n\n /**\n * Loads a Secp256r1PublicKey from the provided deserializer.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static load(deserializer: Deserializer): Secp256r1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PublicKey(bytes);\n }\n\n /**\n * Determines if the provided public key is a valid instance of a Secp256r1 public key.\n * This function checks for the presence of a \"key\" property and validates the length of the key data.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Secp256r1 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Secp256r1PublicKey {\n return (\n \"key\" in publicKey &&\n (publicKey.key as any)?.data?.length === Secp256r1PublicKey.LENGTH &&\n \"keyType\" in publicKey &&\n (publicKey as any).keyType === \"secp256r1\"\n );\n }\n\n /**\n * Generates an authentication key from the public key using the Secp256r1 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Secp256r1);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n}\n\n/**\n * Represents a Secp256r1 ECDSA private key, providing functionality to create, sign messages,\n * derive public keys, and serialize/deserialize the key.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1PrivateKey extends PrivateKey {\n /**\n * Length of Secp256r1 ecdsa private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The private key bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: Hex;\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Secp256r1, strict);\n const keyLength = privateKeyHex.toUint8Array().length;\n if (keyLength !== Secp256r1PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Secp256r1PrivateKey.LENGTH}, received ${keyLength}`);\n }\n\n this.key = privateKeyHex;\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the private key as a string representation.\n *\n * @returns string representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return PrivateKey.formatPrivateKey(this.key.toString(), PrivateKeyVariants.Secp256r1);\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toHexString(): string {\n return this.key.toString();\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a cryptographic signature for the provided message.\n *\n * @param message - A message in HexInput format to be signed.\n * @returns Signature - The generated signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Secp256r1Signature {\n const msgHex = Hex.fromHexInput(message);\n const sha3Message = sha3_256(msgHex.toUint8Array());\n const signature = p256.sign(sha3Message, this.key.toUint8Array());\n return new Secp256r1Signature(signature.toCompactRawBytes());\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1PrivateKey from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1PrivateKey object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PrivateKey(bytes);\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Secp256r1PrivateKey - A newly generated Secp256r1 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Secp256r1PrivateKey {\n const hexInput = p256.utils.randomPrivateKey();\n return new Secp256r1PrivateKey(hexInput);\n }\n\n /**\n * Derive the Secp256r1PublicKey from this private key.\n *\n * @returns Secp256r1PublicKey The derived public key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Secp256r1PublicKey {\n const bytes = p256.getPublicKey(this.key.toUint8Array(), false);\n return new Secp256r1PublicKey(bytes);\n }\n}\n\nexport class WebAuthnSignature extends Signature {\n signature: Hex;\n\n authenticatorData: Hex;\n\n clientDataJSON: Hex;\n\n constructor(signature: HexInput, authenticatorData: HexInput, clientDataJSON: HexInput) {\n super();\n this.signature = Hex.fromHexInput(signature);\n this.authenticatorData = Hex.fromHexInput(authenticatorData);\n this.clientDataJSON = Hex.fromHexInput(clientDataJSON);\n }\n\n toUint8Array() {\n return this.signature.toUint8Array();\n }\n\n serialize(serializer: Serializer) {\n serializer.serializeU32AsUleb128(0);\n serializer.serializeBytes(this.signature.toUint8Array());\n serializer.serializeBytes(this.authenticatorData.toUint8Array());\n serializer.serializeBytes(this.clientDataJSON.toUint8Array());\n }\n\n bcsToBytes() {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n bcsToHex() {\n return Hex.fromHexInput(this.bcsToBytes());\n }\n\n toStringWithoutPrefix() {\n return Hex.fromHexInput(this.bcsToBytes()).toString();\n }\n\n static deserialize(deserializer: Deserializer) {\n const id = deserializer.deserializeUleb128AsU32();\n if (id !== 0) {\n throw new Error(`Invalid id for WebAuthnSignature: ${id}`);\n }\n const signature = deserializer.deserializeBytes();\n const authenticatorData = deserializer.deserializeBytes();\n const clientDataJSON = deserializer.deserializeBytes();\n return new WebAuthnSignature(signature, authenticatorData, clientDataJSON);\n }\n}\n\n/**\n * Represents a signature of a message signed using a Secp256r1 ECDSA private key.\n *\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1Signature extends Signature {\n /**\n * Secp256r1 ecdsa signatures are 256-bit.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly data: Hex;\n\n /**\n * Create a new Signature instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const signatureLength = hex.toUint8Array().length;\n if (signatureLength !== Secp256r1Signature.LENGTH) {\n throw new Error(`Signature length should be ${Secp256r1Signature.LENGTH}, received ${signatureLength}`);\n }\n const signature = p256.Signature.fromCompact(hex.toUint8Array()).normalizeS().toCompactRawBytes();\n this.data = Hex.fromHexInput(signature);\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n /**\n * Get the signature as a hex string with the 0x prefix.\n *\n * @returns string representation of the signature\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.data.toString();\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1Signature from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1Signature {\n const hex = deserializer.deserializeBytes();\n return new Secp256r1Signature(hex);\n }\n}\n"],"mappings":"sPAGA,OAAS,YAAAA,MAAgB,qBACzB,OAAS,QAAAC,MAAY,qBAsBd,IAAMC,EAAN,MAAMA,UAA2BC,CAAU,CAsBhD,YAAYC,EAAoB,CAC9B,MAAM,EAZR,KAAgB,QAAkB,YAchC,IAAMC,EAAMC,EAAI,aAAaF,CAAQ,EAC/BG,EAAYF,EAAI,aAAa,EAAE,OACrC,GAAIE,IAAcL,EAAmB,QAAUK,IAAcL,EAAmB,kBAC9E,MAAM,IAAI,MACR,8BAA8BA,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gC,IAAoBD,EAAmB,OACzC,MAAM,IAAI,MAAM,8BAA8BA,EAAmB,MAAM,cAAcC,CAAe,EAAE,EAExG,IAAMvB,EAAYL,EAAK,UAAU,YAAYJ,EAAI,aAAa,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAChG,KAAK,KAAOC,EAAI,aAAaQ,CAAS,CACxC,CASA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CASA,UAAmB,CACjB,OAAO,KAAK,KAAK,SAAS,CAC5B,CAUA,UAAUJ,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAUA,OAAO,YAAYS,EAAgD,CACjE,IAAMd,EAAMc,EAAa,iBAAiB,EAC1C,OAAO,IAAIiB,EAAmB/B,CAAG,CACnC,CACF,EAjFa+B,EAMK,OAAS,GANpB,IAAMR,EAANQ","names":["sha3_256","p256","_Secp256r1PublicKey","PublicKey","hexInput","hex","Hex","keyLength","point","p256","serializer","Serializer","args","message","signature","msgHex","sha3Message","sha3_256","rawSignature","deserializer","bytes","publicKey","AuthenticationKey","Secp256r1PublicKey","_Secp256r1PrivateKey","PrivateKey","strict","privateKeyHex","Secp256r1Signature","Secp256r1PrivateKey","WebAuthnSignature","_WebAuthnSignature","Signature","authenticatorData","clientDataJSON","id","_Secp256r1Signature","signatureLength"]}
1
+ {"version":3,"sources":["../../src/core/crypto/secp256r1.ts"],"sourcesContent":["// Copyright © Aptos Foundation\n// SPDX-License-Identifier: Apache-2.0\n\nimport { sha3_256 } from \"@noble/hashes/sha3\";\nimport { p256 } from \"@noble/curves/nist\";\nimport { Deserializer, Serializer } from \"../../bcs\";\nimport { Hex } from \"../hex\";\nimport {\n HexInput,\n PrivateKeyVariants,\n SigningScheme as AuthenticationKeyScheme,\n AnyPublicKeyVariant,\n} from \"../../types\";\nimport { PublicKey, VerifySignatureAsyncArgs } from \"./publicKey\";\nimport { PrivateKey } from \"./privateKey\";\nimport { Signature } from \"./signature\";\nimport { AuthenticationKey } from \"../authenticationKey\";\n\n/**\n * Represents a Secp256r1 ECDSA public key.\n *\n * @extends PublicKey\n * @property LENGTH - The length of the Secp256r1 public key in bytes.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1PublicKey extends PublicKey {\n // Secp256r1 ecdsa public keys contain a prefix indicating compression and two 32-byte coordinates.\n static readonly LENGTH: number = 65;\n\n // If it's compressed, it is only 33 bytes\n static readonly COMPRESSED_LENGTH: number = 33;\n\n // Hex value of the public key\n private readonly key: Hex;\n\n // Identifier to distinguish from Secp256k1PublicKey\n public readonly keyType: string = \"secp256r1\";\n\n /**\n * Create a new PublicKey instance from a HexInput, which can be a string or Uint8Array.\n * This constructor validates the length of the provided public key data.\n *\n * @param hexInput - A HexInput (string or Uint8Array) representing the public key data.\n * @throws Error if the length of the public key data is not equal to Secp256r1PublicKey.LENGTH or COMPRESSED_LENGTH.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const keyLength = hex.toUint8Array().length;\n if (keyLength !== Secp256r1PublicKey.LENGTH && keyLength !== Secp256r1PublicKey.COMPRESSED_LENGTH) {\n throw new Error(\n `PublicKey length should be ${Secp256r1PublicKey.LENGTH} or ${Secp256r1PublicKey.COMPRESSED_LENGTH}, received ${keyLength}`,\n );\n }\n\n if (keyLength === Secp256r1PublicKey.COMPRESSED_LENGTH) {\n const point = p256.ProjectivePoint.fromHex(hex.toUint8Array());\n this.key = Hex.fromHexInput(point.toRawBytes(false));\n } else {\n this.key = hex;\n }\n }\n\n /**\n * Get the data as a Uint8Array representation.\n *\n * @returns Uint8Array representation of the data.\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the public key as a hex string with the 0x prefix.\n *\n * @returns string representation of the public key.\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.key.toString();\n }\n\n /**\n * Converts the public key to BCS (Binary Canonical Serialization) bytes.\n * This function serializes the public key data into a byte array format suitable for transmission or storage.\n *\n * @returns Uint8Array representation of the serialized public key.\n * @group Implementation\n * @category Serialization\n */\n bcsToBytes() {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n /**\n * Verifies a Secp256r1 signature against the public key.\n *\n * This function checks the validity of a signature for a given message.\n *\n * @param args - The arguments for verifying the signature.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify against the public key.\n * @group Implementation\n * @category Serialization\n */\n verifySignature(args: { message: HexInput; signature: Signature }): boolean {\n const { message, signature } = args;\n\n const msgHex = Hex.fromHexInput(message).toUint8Array();\n const sha3Message = sha3_256(msgHex);\n const rawSignature = signature.toUint8Array();\n\n return p256.verify(rawSignature, sha3Message, this.toUint8Array());\n }\n\n /**\n * Note: Secp256r1Signatures can be verified synchronously.\n *\n * Verifies the provided signature against the given message.\n * This function helps ensure the integrity and authenticity of the message by confirming that the signature is valid.\n *\n * @param args - The arguments for signature verification.\n * @param args.message - The message that was signed.\n * @param args.signature - The signature to verify, which must be an instance of Secp256r1Signature.\n * @returns A boolean indicating whether the signature is valid for the given message.\n * @group Implementation\n * @category Serialization\n */\n async verifySignatureAsync(args: VerifySignatureAsyncArgs): Promise<boolean> {\n return this.verifySignature({ message: args.message, signature: args.signature });\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.key.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1PublicKey from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1PublicKey object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PublicKey(bytes);\n }\n\n /**\n * Loads a Secp256r1PublicKey from the provided deserializer.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static load(deserializer: Deserializer): Secp256r1PublicKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PublicKey(bytes);\n }\n\n /**\n * Determines if the provided public key is a valid instance of a Secp256r1 public key.\n * This function checks for the presence of a \"key\" property and validates the length of the key data.\n *\n * @param publicKey - The public key to validate.\n * @returns A boolean indicating whether the public key is a valid Secp256r1 public key.\n * @group Implementation\n * @category Serialization\n */\n static isInstance(publicKey: PublicKey): publicKey is Secp256r1PublicKey {\n return (\n \"key\" in publicKey &&\n (publicKey.key as any)?.data?.length === Secp256r1PublicKey.LENGTH &&\n \"keyType\" in publicKey &&\n (publicKey as any).keyType === \"secp256r1\"\n );\n }\n\n /**\n * Generates an authentication key from the public key using the Secp256r1 scheme.\n * This function is essential for creating a secure authentication key that can be used for further cryptographic operations.\n *\n * @returns {AuthenticationKey} The generated authentication key.\n * @group Implementation\n * @category Serialization\n */\n authKey(): AuthenticationKey {\n const serializer = new Serializer();\n serializer.serializeU32AsUleb128(AnyPublicKeyVariant.Secp256r1);\n serializer.serializeFixedBytes(this.bcsToBytes());\n return AuthenticationKey.fromSchemeAndBytes({\n scheme: AuthenticationKeyScheme.SingleKey,\n input: serializer.toUint8Array(),\n });\n }\n}\n\n/**\n * Represents a Secp256r1 ECDSA private key, providing functionality to create, sign messages,\n * derive public keys, and serialize/deserialize the key.\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1PrivateKey extends PrivateKey {\n /**\n * Length of Secp256r1 ecdsa private key\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH: number = 32;\n\n /**\n * The private key bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly key: Hex;\n\n /**\n * Create a new PrivateKey instance from a Uint8Array or String.\n *\n * [Read about AIP-80](https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md)\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @param strict If true, private key must AIP-80 compliant.\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput, strict?: boolean) {\n super();\n\n const privateKeyHex = PrivateKey.parseHexInput(hexInput, PrivateKeyVariants.Secp256r1, strict);\n const keyLength = privateKeyHex.toUint8Array().length;\n if (keyLength !== Secp256r1PrivateKey.LENGTH) {\n throw new Error(`PrivateKey length should be ${Secp256r1PrivateKey.LENGTH}, received ${keyLength}`);\n }\n\n this.key = privateKeyHex;\n }\n\n /**\n * Get the private key in bytes (Uint8Array).\n *\n * @returns\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.key.toUint8Array();\n }\n\n /**\n * Get the private key as a string representation.\n *\n * @returns string representation of the private key\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return PrivateKey.formatPrivateKey(this.key.toString(), PrivateKeyVariants.Secp256r1);\n }\n\n /**\n * Get the private key as a hex string with the 0x prefix.\n *\n * @returns string representation of the private key.\n */\n toHexString(): string {\n return this.key.toString();\n }\n\n /**\n * Sign the given message with the private key.\n * This function generates a cryptographic signature for the provided message.\n *\n * @param message - A message in HexInput format to be signed.\n * @returns Signature - The generated signature for the provided message.\n * @group Implementation\n * @category Serialization\n */\n sign(message: HexInput): Secp256r1Signature {\n const msgHex = Hex.fromHexInput(message);\n const sha3Message = sha3_256(msgHex.toUint8Array());\n const signature = p256.sign(sha3Message, this.key.toUint8Array());\n return new Secp256r1Signature(signature.toCompactRawBytes());\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1PrivateKey from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1PrivateKey object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1PrivateKey {\n const bytes = deserializer.deserializeBytes();\n return new Secp256r1PrivateKey(bytes);\n }\n\n /**\n * Generate a new random private key.\n *\n * @returns Secp256r1PrivateKey - A newly generated Secp256r1 private key.\n * @group Implementation\n * @category Serialization\n */\n static generate(): Secp256r1PrivateKey {\n const hexInput = p256.utils.randomPrivateKey();\n return new Secp256r1PrivateKey(hexInput);\n }\n\n /**\n * Derive the Secp256r1PublicKey from this private key.\n *\n * @returns Secp256r1PublicKey The derived public key.\n * @group Implementation\n * @category Serialization\n */\n publicKey(): Secp256r1PublicKey {\n const bytes = p256.getPublicKey(this.key.toUint8Array(), false);\n return new Secp256r1PublicKey(bytes);\n }\n}\n\nexport class WebAuthnSignature extends Signature {\n signature: Hex;\n\n authenticatorData: Hex;\n\n clientDataJSON: Hex;\n\n constructor(signature: HexInput, authenticatorData: HexInput, clientDataJSON: HexInput) {\n super();\n this.signature = Hex.fromHexInput(signature);\n this.authenticatorData = Hex.fromHexInput(authenticatorData);\n this.clientDataJSON = Hex.fromHexInput(clientDataJSON);\n }\n\n toUint8Array() {\n return this.signature.toUint8Array();\n }\n\n serialize(serializer: Serializer) {\n serializer.serializeU32AsUleb128(0);\n serializer.serializeBytes(this.signature.toUint8Array());\n serializer.serializeBytes(this.authenticatorData.toUint8Array());\n serializer.serializeBytes(this.clientDataJSON.toUint8Array());\n }\n\n bcsToBytes() {\n const serializer = new Serializer();\n this.serialize(serializer);\n return serializer.toUint8Array();\n }\n\n bcsToHex() {\n return Hex.fromHexInput(this.bcsToBytes());\n }\n\n toStringWithoutPrefix() {\n return Hex.fromHexInput(this.bcsToBytes()).toString();\n }\n\n static deserialize(deserializer: Deserializer) {\n const id = deserializer.deserializeUleb128AsU32();\n if (id !== 0) {\n throw new Error(`Invalid id for WebAuthnSignature: ${id}`);\n }\n const signature = deserializer.deserializeBytes();\n const authenticatorData = deserializer.deserializeBytes();\n const clientDataJSON = deserializer.deserializeBytes();\n return new WebAuthnSignature(signature, authenticatorData, clientDataJSON);\n }\n}\n\n/**\n * Represents a signature of a message signed using a Secp256r1 ECDSA private key.\n *\n * @group Implementation\n * @category Serialization\n */\nexport class Secp256r1Signature extends Signature {\n /**\n * Secp256r1 ecdsa signatures are 256-bit.\n * @group Implementation\n * @category Serialization\n */\n static readonly LENGTH = 64;\n\n /**\n * The signature bytes\n * @private\n * @group Implementation\n * @category Serialization\n */\n private readonly data: Hex;\n\n /**\n * Create a new Signature instance from a Uint8Array or String.\n *\n * @param hexInput A HexInput (string or Uint8Array)\n * @group Implementation\n * @category Serialization\n */\n constructor(hexInput: HexInput) {\n super();\n\n const hex = Hex.fromHexInput(hexInput);\n const signatureLength = hex.toUint8Array().length;\n if (signatureLength !== Secp256r1Signature.LENGTH) {\n throw new Error(`Signature length should be ${Secp256r1Signature.LENGTH}, received ${signatureLength}`);\n }\n const signature = p256.Signature.fromCompact(hex.toUint8Array()).normalizeS().toCompactRawBytes();\n this.data = Hex.fromHexInput(signature);\n }\n\n /**\n * Get the signature in bytes (Uint8Array).\n *\n * @returns Uint8Array representation of the signature\n * @group Implementation\n * @category Serialization\n */\n toUint8Array(): Uint8Array {\n return this.data.toUint8Array();\n }\n\n /**\n * Get the signature as a hex string with the 0x prefix.\n *\n * @returns string representation of the signature\n * @group Implementation\n * @category Serialization\n */\n toString(): string {\n return this.data.toString();\n }\n\n /**\n * Serializes the data into a byte array using the provided serializer.\n * This function is essential for converting data into a format suitable for transmission or storage.\n *\n * @param serializer - The serializer instance used to convert the data.\n * @group Implementation\n * @category Serialization\n */\n serialize(serializer: Serializer): void {\n serializer.serializeBytes(this.data.toUint8Array());\n }\n\n /**\n * Deserializes a Secp256r1Signature from the provided deserializer.\n * This function allows you to reconstruct a Secp256r1Signature object from its serialized byte representation.\n *\n * @param deserializer - The deserializer instance used to read the serialized data.\n * @group Implementation\n * @category Serialization\n */\n static deserialize(deserializer: Deserializer): Secp256r1Signature {\n const hex = deser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AAM,IAAI,MAAM,qCAAqCA,CAAE,EAAE,EAE3D,IAAMrB,EAAYK,EAAa,iBAAiB,EAC1Cc,EAAoBd,EAAa,iBAAiB,EAClDe,EAAiBf,EAAa,iBAAiB,EACrD,OAAO,IAAIY,EAAkBjB,EAAWmB,EAAmBC,CAAc,CAC3E,CACF,EAQaE,EAAN,MAAMA,UAA2BJ,CAAU,CAuBhD,YAAY5B,EAAoB,CAC9B,MAAM,EAEN,IAAMC,EAAMC,EAAI,aAAaF,CAAQ,EAC/BiC,EAAkBhC,EAAI,aAAa,EAAE,OAC3C,GAAIgC,IAAoBD,EAAmB,OACzC,MAAM,IAAI,MAAM,8BAA8BA,EAAmB,MAAM,cAAcC,CAAe,EAAE,EAExG,IAAMvB,EAAYL,EAAK,UAAU,YAAYJ,EAAI,aAAa,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAChG,KAAK,KAAOC,EAAI,aAAaQ,CAAS,CACxC,CASA,cAA2B,CACzB,OAAO,KAAK,KAAK,aAAa,CAChC,CASA,UAAmB,CACjB,OAAO,KAAK,KAAK,SAAS,CAC5B,CAUA,UAAUJ,EAA8B,CACtCA,EAAW,eAAe,KAAK,KAAK,aAAa,CAAC,CACpD,CAUA,OAAO,YAAYS,EAAgD,CACjE,IAAMd,EAAMc,EAAa,iBAAiB,EAC1C,OAAO,IAAIiB,EAAmB/B,CAAG,CACnC,CACF,EAjFa+B,EAMK,OAAS,GANpB,IAAMR,EAANQ","names":["sha3_256","p256","_Secp256r1PublicKey","PublicKey","hexInput","hex","Hex","keyLength","point","p256","serializer","Serializer","args","message","signature","msgHex","sha3Message","sha3_256","rawSignature","deserializer","bytes","publicKey","AuthenticationKey","Secp256r1PublicKey","_Secp256r1PrivateKey","PrivateKey","strict","privateKeyHex","Secp256r1Signature","Secp256r1PrivateKey","WebAuthnSignature","_WebAuthnSignature","Signature","authenticatorData","clientDataJSON","id","_Secp256r1Signature","signatureLength"]}
@@ -1,2 +1,2 @@
1
- import{a as i}from"./chunk-CD3EZCI5.mjs";import{a as r}from"./chunk-66F7RP7K.mjs";var t=class l extends r{constructor(e){super(),this.value=new i(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,s){let a=i.deserialize(e,s);return new l(a.value)}};export{t as a};
2
- //# sourceMappingURL=chunk-E3DHFXN4.mjs.map
1
+ import{a as i}from"./chunk-F4RJMSAW.mjs";import{a as r}from"./chunk-RUKFK3OC.mjs";var t=class l extends r{constructor(e){super(),this.value=new i(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,s){let a=i.deserialize(e,s);return new l(a.value)}};export{t as a};
2
+ //# sourceMappingURL=chunk-WOPHK7LB.mjs.map
@@ -1,2 +1,2 @@
1
- import{e as x,f as B}from"./chunk-T32P4APJ.mjs";import{a as k}from"./chunk-ODNZJSOC.mjs";import{b as f,d as A}from"./chunk-2VHA77EO.mjs";import{e as b}from"./chunk-ASFFADWS.mjs";import{c as d}from"./chunk-5LMLIRGK.mjs";import{e as C}from"./chunk-TAHLOBRG.mjs";async function H(o){let{aptosConfig:n,options:t}=o;return A({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function W(o){let{aptosConfig:n}=o;return k(async()=>{let{data:t}=await f({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function O(o){let{aptosConfig:n,ledgerVersion:t}=o,{data:s}=await f({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return s}async function y(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await f({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return s}async function q(o){let{aptosConfig:n,transactionHash:t}=o;try{return(await y({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(s){if(s?.status===404)return!0;throw s}}async function R(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await f({aptosConfig:n,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return s}async function z(o){let{aptosConfig:n,transactionHash:t,options:s}=o,r=s?.timeoutSecs??20,u=s?.checkSuccess??!0,e=!0,p=0,i,g,l=200,h=1.5;function c(a){if(!(a instanceof b)||(g=a,a.status!==404&&a.status>=400&&a.status<500))throw a}try{i=await y({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction"}catch(a){c(a)}if(e){let a=Date.now();try{i=await R({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction"}catch(w){c(w)}p=(Date.now()-a)/1e3}for(;e&&!(p>=r);){try{if(i=await y({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction",!e)break}catch(a){c(a)}await d(l),p+=l/1e3,l*=h}if(i===void 0)throw g||new m(`Fetching transaction ${t} failed and timed out after ${r} seconds`,i);if(i.type==="pending_transaction")throw new m(`Transaction ${t} timed out in pending state after ${r} seconds`,i);if(!u)return i;if(!i.success)throw new T(`Transaction ${t} failed with an error: ${i.vm_status}`,i);return i}async function U(o){let{aptosConfig:n,processorType:t}=o,s=BigInt(o.minimumLedgerVersion),r=3e3,u=Date.now(),e=BigInt(-1);for(;e<s;){if(Date.now()-u>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?e=await x({aptosConfig:n}):e=(await B({aptosConfig:n,processorType:t})).last_success_version,e>=s)break;await d(200)}}var m=class extends Error{constructor(n,t){super(n),this.lastSubmittedTransaction=t}},T=class extends Error{constructor(n,t){super(n),this.transaction=t}};async function X(o){let{aptosConfig:n,ledgerVersion:t,options:s}=o,{data:r}=await f({aptosConfig:n,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:s?.withTransactions}});return P({block:r,...o})}async function j(o){let{aptosConfig:n,blockHeight:t,options:s}=o,{data:r}=await f({aptosConfig:n,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:s?.withTransactions}});return P({block:r,...o})}async function P(o){let{aptosConfig:n,block:t,options:s}=o;if(s?.withTransactions){t.transactions=t.transactions??[];let r=t.transactions[t.transactions.length-1],u=BigInt(t.first_version),e=BigInt(t.last_version),p=r?.version,i;if(p===void 0?i=u-1n:i=BigInt(p),i===e)return t;let g=[],l=100n;for(let c=i+1n;c<e;c+=BigInt(100))g.push(H({aptosConfig:n,options:{offset:c,limit:Math.min(Number(l),Number(e-c+1n))}}));let h=await Promise.all(g);for(let c of h)t.transactions.push(...c)}return t}export{H as a,W as b,O as c,y as d,q as e,R as f,z as g,U as h,m as i,T as j,X as k,j as l};
2
- //# sourceMappingURL=chunk-H2T2SU5O.mjs.map
1
+ import{e as x,f as B}from"./chunk-MKTR4U2R.mjs";import{a as k}from"./chunk-ODNZJSOC.mjs";import{b as f,d as A}from"./chunk-TBIK7DML.mjs";import{e as b}from"./chunk-IEW452EO.mjs";import{c as d}from"./chunk-GJYLYE6R.mjs";import{e as C}from"./chunk-TAHLOBRG.mjs";async function H(o){let{aptosConfig:n,options:t}=o;return A({aptosConfig:n,originMethod:"getTransactions",path:"transactions",params:{start:t?.offset,limit:t?.limit}})}async function W(o){let{aptosConfig:n}=o;return k(async()=>{let{data:t}=await f({aptosConfig:n,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${n.network}`,1e3*60*5)()}async function O(o){let{aptosConfig:n,ledgerVersion:t}=o,{data:s}=await f({aptosConfig:n,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return s}async function y(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await f({aptosConfig:n,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return s}async function q(o){let{aptosConfig:n,transactionHash:t}=o;try{return(await y({aptosConfig:n,transactionHash:t})).type==="pending_transaction"}catch(s){if(s?.status===404)return!0;throw s}}async function R(o){let{aptosConfig:n,transactionHash:t}=o,{data:s}=await f({aptosConfig:n,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return s}async function z(o){let{aptosConfig:n,transactionHash:t,options:s}=o,r=s?.timeoutSecs??20,u=s?.checkSuccess??!0,e=!0,p=0,i,g,l=200,h=1.5;function c(a){if(!(a instanceof b)||(g=a,a.status!==404&&a.status>=400&&a.status<500))throw a}try{i=await y({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction"}catch(a){c(a)}if(e){let a=Date.now();try{i=await R({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction"}catch(w){c(w)}p=(Date.now()-a)/1e3}for(;e&&!(p>=r);){try{if(i=await y({aptosConfig:n,transactionHash:t}),e=i.type==="pending_transaction",!e)break}catch(a){c(a)}await d(l),p+=l/1e3,l*=h}if(i===void 0)throw g||new m(`Fetching transaction ${t} failed and timed out after ${r} seconds`,i);if(i.type==="pending_transaction")throw new m(`Transaction ${t} timed out in pending state after ${r} seconds`,i);if(!u)return i;if(!i.success)throw new T(`Transaction ${t} failed with an error: ${i.vm_status}`,i);return i}async function U(o){let{aptosConfig:n,processorType:t}=o,s=BigInt(o.minimumLedgerVersion),r=3e3,u=Date.now(),e=BigInt(-1);for(;e<s;){if(Date.now()-u>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?e=await x({aptosConfig:n}):e=(await B({aptosConfig:n,processorType:t})).last_success_version,e>=s)break;await d(200)}}var m=class extends Error{constructor(n,t){super(n),this.lastSubmittedTransaction=t}},T=class extends Error{constructor(n,t){super(n),this.transaction=t}};async function X(o){let{aptosConfig:n,ledgerVersion:t,options:s}=o,{data:r}=await f({aptosConfig:n,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:s?.withTransactions}});return P({block:r,...o})}async function j(o){let{aptosConfig:n,blockHeight:t,options:s}=o,{data:r}=await f({aptosConfig:n,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:s?.withTransactions}});return P({block:r,...o})}async function P(o){let{aptosConfig:n,block:t,options:s}=o;if(s?.withTransactions){t.transactions=t.transactions??[];let r=t.transactions[t.transactions.length-1],u=BigInt(t.first_version),e=BigInt(t.last_version),p=r?.version,i;if(p===void 0?i=u-1n:i=BigInt(p),i===e)return t;let g=[],l=100n;for(let c=i+1n;c<e;c+=BigInt(100))g.push(H({aptosConfig:n,options:{offset:c,limit:Math.min(Number(l),Number(e-c+1n))}}));let h=await Promise.all(g);for(let c of h)t.transactions.push(...c)}return t}export{H as a,W as b,O as c,y as d,q as e,R as f,z as g,U as h,m as i,T as j,X as k,j as l};
2
+ //# sourceMappingURL=chunk-WZZ7PJ3X.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as s}from"./chunk-EIWPAECI.mjs";import{b as o}from"./chunk-2VBY2V4Z.mjs";import{a as t}from"./chunk-TSPG5VED.mjs";import{b as i}from"./chunk-STY74NUA.mjs";var n=class e extends s{constructor(r){super(),this.value=i.fromHexInput(r).toUint8Array()}serialize(r){r.serializeBytes(this.value)}static deserialize(r){return new e(r.deserializeBytes())}},a=class extends o{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{n as a,a as b};
2
- //# sourceMappingURL=chunk-QRW7MQDA.mjs.map
1
+ import{a as s}from"./chunk-NHRPXEUE.mjs";import{b as o}from"./chunk-A5H5VKUI.mjs";import{a as t}from"./chunk-RZNP3WG4.mjs";import{b as i}from"./chunk-STY74NUA.mjs";var n=class e extends s{constructor(r){super(),this.value=i.fromHexInput(r).toUint8Array()}serialize(r){r.serializeBytes(this.value)}static deserialize(r){return new e(r.deserializeBytes())}},a=class extends o{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{n as a,a as b};
2
+ //# sourceMappingURL=chunk-ZOSOF6ST.mjs.map
@@ -1,7 +1,7 @@
1
1
  export { LocalNode } from './localNode.mjs';
2
2
  export { Move } from './move.mjs';
3
3
  import 'node:child_process';
4
- import '../account-Dg0ejXHy.mjs';
4
+ import '../account-sIOs_9XJ.mjs';
5
5
  import '../types/indexer.mjs';
6
6
  import '../types/generated/operations.mjs';
7
7
  import '../types/generated/types.mjs';
@@ -1,2 +1,2 @@
1
- import{a as o}from"../chunk-A7SQEK23.mjs";import{a as r}from"../chunk-44MMFX5F.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-KDMSOCZY.mjs";export{o as LocalNode,r as Move};
1
+ import{a as o}from"../chunk-QE5MOGUI.mjs";import{a as r}from"../chunk-44MMFX5F.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-KDMSOCZY.mjs";export{o as LocalNode,r as Move};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-A7SQEK23.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-KDMSOCZY.mjs";export{a as LocalNode};
1
+ import{a}from"../chunk-QE5MOGUI.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-KDMSOCZY.mjs";export{a as LocalNode};
2
2
  //# sourceMappingURL=localNode.mjs.map
@@ -1,4 +1,4 @@
1
- import { b as AccountAddress } from '../account-Dg0ejXHy.mjs';
1
+ import { b as AccountAddress } from '../account-sIOs_9XJ.mjs';
2
2
  import { Network } from '../utils/apiEndpoints.mjs';
3
3
  import '../types/indexer.mjs';
4
4
  import '../types/generated/operations.mjs';
@@ -1,4 +1,4 @@
1
- import { y as AptosRequest, x as AptosConfig, z as AptosResponse, N as ClientRequest, K as Client, O as ClientResponse } from '../account-Dg0ejXHy.mjs';
1
+ import { y as AptosRequest, x as AptosConfig, z as AptosResponse, N as ClientRequest, K as Client, O as ClientResponse } from '../account-sIOs_9XJ.mjs';
2
2
  import { AptosApiType } from '../utils/const.mjs';
3
3
  import '../types/indexer.mjs';
4
4
  import '../types/generated/operations.mjs';
@@ -1,2 +1,2 @@
1
- import{a,b}from"../chunk-Q4KYBAYN.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-ASFFADWS.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-WFZFTRRS.mjs";import"../chunk-BT742BFQ.mjs";import"../chunk-E3DHFXN4.mjs";import"../chunk-CD3EZCI5.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-AUGTNOKZ.mjs";import"../chunk-KDMSOCZY.mjs";export{b as aptosRequest,a as request};
1
+ import{a,b}from"../chunk-2DQRUJUC.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-IEW452EO.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-2EBXCCLB.mjs";import"../chunk-WOPHK7LB.mjs";import"../chunk-F4RJMSAW.mjs";import"../chunk-KKPH2JUV.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-RYCI4VKO.mjs";import"../chunk-KDMSOCZY.mjs";export{b as aptosRequest,a as request};
2
2
  //# sourceMappingURL=core.mjs.map
@@ -1,4 +1,4 @@
1
- import { x as AptosConfig, b1 as MimeType, p as AnyNumber, L as ClientConfig, z as AptosResponse } from '../account-Dg0ejXHy.mjs';
1
+ import { x as AptosConfig, b1 as MimeType, p as AnyNumber, L as ClientConfig, z as AptosResponse } from '../account-sIOs_9XJ.mjs';
2
2
  import { AptosApiType } from '../utils/const.mjs';
3
3
  import '../types/indexer.mjs';
4
4
  import '../types/generated/operations.mjs';
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f}from"../chunk-2VHA77EO.mjs";import"../chunk-Q4KYBAYN.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-ASFFADWS.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-WFZFTRRS.mjs";import"../chunk-BT742BFQ.mjs";import"../chunk-E3DHFXN4.mjs";import"../chunk-CD3EZCI5.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-AUGTNOKZ.mjs";import"../chunk-KDMSOCZY.mjs";export{a as get,b as getAptosFullNode,c as getAptosPepperService,f as getPageWithObfuscatedCursor,d as paginateWithCursor,e as paginateWithObfuscatedCursor};
1
+ import{a,b,c,d,e,f}from"../chunk-TBIK7DML.mjs";import"../chunk-2DQRUJUC.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-IEW452EO.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-2EBXCCLB.mjs";import"../chunk-WOPHK7LB.mjs";import"../chunk-F4RJMSAW.mjs";import"../chunk-KKPH2JUV.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-RYCI4VKO.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,7 +1,7 @@
1
1
  export { aptosRequest, request } from './core.mjs';
2
2
  export { GetAptosRequestOptions, GetRequestOptions, get, getAptosFullNode, getAptosPepperService, getPageWithObfuscatedCursor, paginateWithCursor, paginateWithObfuscatedCursor } from './get.mjs';
3
3
  export { PostAptosRequestOptions, PostRequestOptions, post, postAptosFaucet, postAptosFullNode, postAptosIndexer, postAptosPepperService, postAptosProvingService } from './post.mjs';
4
- import '../account-Dg0ejXHy.mjs';
4
+ import '../account-sIOs_9XJ.mjs';
5
5
  import '../types/indexer.mjs';
6
6
  import '../types/generated/operations.mjs';
7
7
  import '../types/generated/types.mjs';
@@ -1,2 +1,2 @@
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-2VHA77EO.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n}from"../chunk-NWP2VEMB.mjs";import{a,b}from"../chunk-Q4KYBAYN.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-ASFFADWS.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-WFZFTRRS.mjs";import"../chunk-BT742BFQ.mjs";import"../chunk-E3DHFXN4.mjs";import"../chunk-CD3EZCI5.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-AUGTNOKZ.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};
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-TBIK7DML.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n}from"../chunk-DPHBSAZQ.mjs";import{a,b}from"../chunk-2DQRUJUC.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-IEW452EO.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-2EBXCCLB.mjs";import"../chunk-WOPHK7LB.mjs";import"../chunk-F4RJMSAW.mjs";import"../chunk-KKPH2JUV.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-RYCI4VKO.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,4 +1,4 @@
1
- import { x as AptosConfig, b1 as MimeType, p as AnyNumber, L as ClientConfig, z as AptosResponse } from '../account-Dg0ejXHy.mjs';
1
+ import { x as AptosConfig, b1 as MimeType, p as AnyNumber, L as ClientConfig, z as AptosResponse } from '../account-sIOs_9XJ.mjs';
2
2
  import { AptosApiType } from '../utils/const.mjs';
3
3
  import '../types/indexer.mjs';
4
4
  import '../types/generated/operations.mjs';
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f}from"../chunk-NWP2VEMB.mjs";import"../chunk-Q4KYBAYN.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-ASFFADWS.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-WFZFTRRS.mjs";import"../chunk-BT742BFQ.mjs";import"../chunk-E3DHFXN4.mjs";import"../chunk-CD3EZCI5.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-5LMLIRGK.mjs";import"../chunk-C2KVLMPH.mjs";import"../chunk-FDHHQUS3.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-66F7RP7K.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-AUGTNOKZ.mjs";import"../chunk-KDMSOCZY.mjs";export{a as post,d as postAptosFaucet,b as postAptosFullNode,c as postAptosIndexer,e as postAptosPepperService,f as postAptosProvingService};
1
+ import{a,b,c,d,e,f}from"../chunk-DPHBSAZQ.mjs";import"../chunk-2DQRUJUC.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-ITZN23GU.mjs";import"../chunk-IEW452EO.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-2EBXCCLB.mjs";import"../chunk-WOPHK7LB.mjs";import"../chunk-F4RJMSAW.mjs";import"../chunk-KKPH2JUV.mjs";import"../chunk-M65PXVDO.mjs";import"../chunk-P5HCJN3A.mjs";import"../chunk-GJYLYE6R.mjs";import"../chunk-GYYSHYO5.mjs";import"../chunk-6T2OBPIF.mjs";import"../chunk-DE5K76I2.mjs";import"../chunk-Q5ESW36C.mjs";import"../chunk-NP2IAUME.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-RUKFK3OC.mjs";import"../chunk-TAHLOBRG.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-X2TPNKLV.mjs";import"../chunk-RYCI4VKO.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,5 +1,5 @@
1
1
  export { createObjectAddress, createResourceAddress, createTokenAddress, createUserDerivedObjectAddress } from './utils/address.mjs';
2
- import '../../account-Dg0ejXHy.mjs';
2
+ import '../../account-sIOs_9XJ.mjs';
3
3
  import '../../types/indexer.mjs';
4
4
  import '../../types/generated/operations.mjs';
5
5
  import '../../types/generated/types.mjs';
@@ -1,2 +1,2 @@
1
- import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import{a,b,c,d}from"../../chunk-C2KVLMPH.mjs";import"../../chunk-FDHHQUS3.mjs";import"../../chunk-DE5K76I2.mjs";import"../../chunk-NP2IAUME.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-Q5ESW36C.mjs";import"../../chunk-66F7RP7K.mjs";import"../../chunk-TAHLOBRG.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-X2TPNKLV.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as createObjectAddress,b as createResourceAddress,d as createTokenAddress,c as createUserDerivedObjectAddress};
1
+ import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import{a,b,c,d}from"../../chunk-GYYSHYO5.mjs";import"../../chunk-6T2OBPIF.mjs";import"../../chunk-DE5K76I2.mjs";import"../../chunk-Q5ESW36C.mjs";import"../../chunk-NP2IAUME.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-RUKFK3OC.mjs";import"../../chunk-TAHLOBRG.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-X2TPNKLV.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as createObjectAddress,b as createResourceAddress,d as createTokenAddress,c as createUserDerivedObjectAddress};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +1,4 @@
1
- import { b as AccountAddress } from '../../../account-Dg0ejXHy.mjs';
1
+ import { b as AccountAddress } from '../../../account-sIOs_9XJ.mjs';
2
2
  import '../../../types/indexer.mjs';
3
3
  import '../../../types/generated/operations.mjs';
4
4
  import '../../../types/generated/types.mjs';