@aptos-labs/ts-sdk 1.16.0-zeta.0 → 1.16.0-zeta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/dist/common/{accountAddress-BtD_TE5q.d.ts → accountAddress-YfW6h4Ja.d.ts} +57 -11
  2. package/dist/common/{chunk-VLEH6QBR.js → chunk-HPZUSDYP.js} +1 -1
  3. package/dist/common/{chunk-VLEH6QBR.js.map → chunk-HPZUSDYP.js.map} +1 -1
  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 +199 -87
  7. package/dist/common/index.js +27 -27
  8. package/dist/common/index.js.map +1 -1
  9. package/dist/esm/account/Account.mjs +1 -1
  10. package/dist/esm/account/Ed25519Account.mjs +1 -1
  11. package/dist/esm/account/EphemeralKeyPair.d.mts +4 -4
  12. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  13. package/dist/esm/account/KeylessAccount.d.mts +69 -23
  14. package/dist/esm/account/KeylessAccount.mjs +1 -1
  15. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  16. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  17. package/dist/esm/account/index.d.mts +3 -4
  18. package/dist/esm/account/index.mjs +1 -1
  19. package/dist/esm/api/account.mjs +1 -1
  20. package/dist/esm/api/ans.mjs +1 -1
  21. package/dist/esm/api/aptos.d.mts +5 -5
  22. package/dist/esm/api/aptos.mjs +1 -1
  23. package/dist/esm/api/aptosConfig.mjs +1 -1
  24. package/dist/esm/api/coin.mjs +1 -1
  25. package/dist/esm/api/digitalAsset.mjs +1 -1
  26. package/dist/esm/api/event.mjs +1 -1
  27. package/dist/esm/api/faucet.mjs +1 -1
  28. package/dist/esm/api/fungibleAsset.mjs +1 -1
  29. package/dist/esm/api/general.mjs +1 -1
  30. package/dist/esm/api/index.d.mts +5 -5
  31. package/dist/esm/api/index.mjs +1 -1
  32. package/dist/esm/api/keyless.d.mts +15 -11
  33. package/dist/esm/api/keyless.mjs +1 -1
  34. package/dist/esm/api/staking.mjs +1 -1
  35. package/dist/esm/api/table.mjs +1 -1
  36. package/dist/esm/api/transaction.mjs +1 -1
  37. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  39. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  40. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  41. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  42. package/dist/esm/api/utils.mjs +1 -1
  43. package/dist/esm/bcs/deserializer.d.mts +14 -8
  44. package/dist/esm/bcs/deserializer.mjs +1 -1
  45. package/dist/esm/bcs/index.mjs +1 -1
  46. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  47. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  48. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  49. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  50. package/dist/esm/bcs/serializer.d.mts +40 -0
  51. package/dist/esm/bcs/serializer.mjs +1 -1
  52. package/dist/esm/{chunk-4KEEUDZA.mjs → chunk-27PC47S7.mjs} +2 -2
  53. package/dist/esm/{chunk-W36IQO5K.mjs → chunk-2NGHKNUS.mjs} +2 -2
  54. package/dist/esm/{chunk-N466X3S6.mjs → chunk-37FFZSIM.mjs} +2 -2
  55. package/dist/esm/{chunk-VT6XJSRO.mjs → chunk-3IFR6T3V.mjs} +1 -1
  56. package/dist/esm/chunk-3IFR6T3V.mjs.map +1 -0
  57. package/dist/esm/chunk-3RJZNUCQ.mjs +2 -0
  58. package/dist/esm/{chunk-Z2ZR4PTF.mjs → chunk-472OGHMG.mjs} +2 -2
  59. package/dist/esm/chunk-4TDMJQOJ.mjs +2 -0
  60. package/dist/esm/chunk-4TDMJQOJ.mjs.map +1 -0
  61. package/dist/esm/{chunk-STYDBDYL.mjs → chunk-4VPCPASN.mjs} +2 -2
  62. package/dist/esm/{chunk-M7HZOQ6A.mjs → chunk-5YH2YL3L.mjs} +2 -2
  63. package/dist/esm/{chunk-EPTCPBVW.mjs → chunk-6DFVM2W6.mjs} +2 -2
  64. package/dist/esm/{chunk-LEBJNW6Y.mjs → chunk-6FK6OA37.mjs} +2 -2
  65. package/dist/esm/{chunk-FBLSW5TB.mjs → chunk-6GGHUBUA.mjs} +2 -2
  66. package/dist/esm/{chunk-3FVRXELT.mjs → chunk-7BW2N4IE.mjs} +2 -2
  67. package/dist/esm/{chunk-NCDP26DV.mjs → chunk-7JLHN655.mjs} +2 -2
  68. package/dist/esm/{chunk-SBQRBBRS.mjs → chunk-7XRUPEQ4.mjs} +2 -2
  69. package/dist/esm/{chunk-Q3AUNZDW.mjs → chunk-B76XCRLH.mjs} +2 -2
  70. package/dist/esm/{chunk-MTLETLKV.mjs → chunk-BO44HPGU.mjs} +2 -2
  71. package/dist/esm/{chunk-QZRWRX6P.mjs → chunk-CVCM46UN.mjs} +2 -2
  72. package/dist/esm/{chunk-QZRWRX6P.mjs.map → chunk-CVCM46UN.mjs.map} +1 -1
  73. package/dist/esm/{chunk-HGZGTBA4.mjs → chunk-DPWEHSHH.mjs} +2 -2
  74. package/dist/esm/{chunk-LQH7T3TE.mjs → chunk-E4XMEVB7.mjs} +2 -2
  75. package/dist/esm/{chunk-7STYQ5ZE.mjs → chunk-EFMAZTIM.mjs} +2 -2
  76. package/dist/esm/{chunk-NQMF46E5.mjs → chunk-EQN6FVO7.mjs} +2 -2
  77. package/dist/esm/{chunk-T23OVRNF.mjs → chunk-F3ZVWLDH.mjs} +2 -2
  78. package/dist/esm/{chunk-F5C4SZZ7.mjs → chunk-FF4L66LJ.mjs} +2 -2
  79. package/dist/esm/{chunk-EB7AI4B4.mjs → chunk-FGGRPEQ3.mjs} +2 -2
  80. package/dist/esm/{chunk-IEZO4PIG.mjs → chunk-FIG65OJD.mjs} +2 -2
  81. package/dist/esm/chunk-FLALKQIK.mjs +2 -0
  82. package/dist/esm/{chunk-JKZHPY24.mjs.map → chunk-FLALKQIK.mjs.map} +1 -1
  83. package/dist/esm/{chunk-UDU5L4XH.mjs → chunk-FUKWM4HL.mjs} +2 -2
  84. package/dist/esm/{chunk-C3L4ETUF.mjs → chunk-GRHLQDHF.mjs} +2 -2
  85. package/dist/esm/{chunk-MGOHPDX4.mjs → chunk-GSCM444Z.mjs} +2 -2
  86. package/dist/esm/{chunk-T6OEZ4KP.mjs → chunk-GTUBZWAF.mjs} +2 -2
  87. package/dist/esm/chunk-GY6LFCB2.mjs +2 -0
  88. package/dist/esm/chunk-GY6LFCB2.mjs.map +1 -0
  89. package/dist/esm/{chunk-UWI5D7FD.mjs → chunk-H4AGIUGI.mjs} +2 -2
  90. package/dist/esm/{chunk-3Y6JNFPD.mjs → chunk-HZOBRRQP.mjs} +2 -2
  91. package/dist/esm/chunk-I7GRECEJ.mjs +2 -0
  92. package/dist/esm/{chunk-CNH2RAJQ.mjs.map → chunk-I7GRECEJ.mjs.map} +1 -1
  93. package/dist/esm/{chunk-6RBUXB5I.mjs → chunk-IBN7ETCB.mjs} +2 -2
  94. package/dist/esm/{chunk-KFUOOBMJ.mjs → chunk-IGMXAPHY.mjs} +2 -2
  95. package/dist/esm/{chunk-TEJ7BXJK.mjs → chunk-IPSITJFX.mjs} +2 -2
  96. package/dist/esm/chunk-IVVWQKCF.mjs +2 -0
  97. package/dist/esm/chunk-IVVWQKCF.mjs.map +1 -0
  98. package/dist/esm/{chunk-NC5HHEEM.mjs → chunk-IXFYYWAC.mjs} +2 -2
  99. package/dist/esm/{chunk-REBMGDZ5.mjs → chunk-J6VDYVNB.mjs} +2 -2
  100. package/dist/esm/{chunk-Y5BON557.mjs → chunk-JKRWCFUQ.mjs} +2 -2
  101. package/dist/esm/{chunk-I5JWDZIP.mjs → chunk-JOXU5RWH.mjs} +2 -2
  102. package/dist/esm/chunk-JOXU5RWH.mjs.map +1 -0
  103. package/dist/esm/{chunk-IJE5YSXW.mjs → chunk-JWGG6XFS.mjs} +2 -2
  104. package/dist/esm/{chunk-MWN63XBE.mjs → chunk-K2KJX32L.mjs} +2 -2
  105. package/dist/esm/chunk-KCRCX6BL.mjs +2 -0
  106. package/dist/esm/chunk-KCRCX6BL.mjs.map +1 -0
  107. package/dist/esm/chunk-KGHBTSDR.mjs +2 -0
  108. package/dist/esm/chunk-KGHBTSDR.mjs.map +1 -0
  109. package/dist/esm/{chunk-6KNAIXZ3.mjs → chunk-KMVSI4PC.mjs} +2 -2
  110. package/dist/esm/chunk-KNMQU2TA.mjs +2 -0
  111. package/dist/esm/chunk-KNMQU2TA.mjs.map +1 -0
  112. package/dist/esm/{chunk-Y33VGXNI.mjs → chunk-KSSJ3CT5.mjs} +2 -2
  113. package/dist/esm/{chunk-EIRSA5UU.mjs → chunk-KUMZXNMD.mjs} +2 -2
  114. package/dist/esm/{chunk-NWWXZ7EW.mjs → chunk-L5CPAOUM.mjs} +2 -2
  115. package/dist/esm/{chunk-EADBYPUD.mjs → chunk-LMEJ5K6B.mjs} +2 -2
  116. package/dist/esm/chunk-LYOUEPDG.mjs +2 -0
  117. package/dist/esm/chunk-LYOUEPDG.mjs.map +1 -0
  118. package/dist/esm/{chunk-WAXCU6D6.mjs → chunk-MEOGVBMZ.mjs} +2 -2
  119. package/dist/esm/{chunk-3VGX3TXH.mjs → chunk-MLX6DFMR.mjs} +2 -2
  120. package/dist/esm/{chunk-KKP4FBWZ.mjs → chunk-MX5Z3EHG.mjs} +2 -2
  121. package/dist/esm/{chunk-MWUJCP27.mjs → chunk-NW3WUTTD.mjs} +2 -2
  122. package/dist/esm/{chunk-YHO2EBXH.mjs → chunk-NW6LGHE7.mjs} +2 -2
  123. package/dist/esm/{chunk-ZCCYHFPK.mjs → chunk-OJL36Q4H.mjs} +2 -2
  124. package/dist/esm/{chunk-LO7B3CWN.mjs → chunk-OJUFU5TJ.mjs} +2 -2
  125. package/dist/esm/{chunk-ONIYM7IU.mjs → chunk-PAY7N36H.mjs} +2 -2
  126. package/dist/esm/{chunk-RUSWW265.mjs → chunk-PHEA3NOJ.mjs} +2 -2
  127. package/dist/esm/{chunk-OX5GWFHX.mjs → chunk-PUP6XMAV.mjs} +2 -2
  128. package/dist/esm/{chunk-A3UVZHDJ.mjs → chunk-PWYL5QZP.mjs} +2 -2
  129. package/dist/esm/{chunk-JM2B5E2I.mjs → chunk-Q6LFIZ3L.mjs} +1 -1
  130. package/dist/esm/chunk-Q6LFIZ3L.mjs.map +1 -0
  131. package/dist/esm/{chunk-JCDZ2WXX.mjs → chunk-QHB5A5YP.mjs} +1 -1
  132. package/dist/esm/chunk-QHB5A5YP.mjs.map +1 -0
  133. package/dist/esm/{chunk-UFJGYMEB.mjs → chunk-R4KIZ2FK.mjs} +2 -2
  134. package/dist/esm/{chunk-6M53MDWB.mjs → chunk-RTO3YBWQ.mjs} +2 -2
  135. package/dist/esm/{chunk-OT37OTT7.mjs → chunk-RURI53PG.mjs} +2 -2
  136. package/dist/esm/{chunk-5RRZMXND.mjs → chunk-RX5SPT5S.mjs} +2 -2
  137. package/dist/esm/{chunk-4USAUOCE.mjs → chunk-RYRID5HT.mjs} +2 -2
  138. package/dist/esm/{chunk-Z6JERVLX.mjs → chunk-SBEZ64HG.mjs} +2 -2
  139. package/dist/esm/{chunk-C34M4T77.mjs → chunk-SNDFJWYM.mjs} +2 -2
  140. package/dist/esm/chunk-T4HO5JMQ.mjs +2 -0
  141. package/dist/esm/chunk-T4HO5JMQ.mjs.map +1 -0
  142. package/dist/esm/{chunk-7H3HRFVM.mjs → chunk-T5YEMU53.mjs} +2 -2
  143. package/dist/esm/{chunk-ZNEBMSNC.mjs → chunk-TUCCV62K.mjs} +2 -2
  144. package/dist/esm/{chunk-7QGIAVW4.mjs → chunk-UBON2G6Y.mjs} +2 -2
  145. package/dist/esm/{chunk-TVRJ3M7B.mjs → chunk-UMLUOYFK.mjs} +1 -1
  146. package/dist/esm/{chunk-TVRJ3M7B.mjs.map → chunk-UMLUOYFK.mjs.map} +1 -1
  147. package/dist/esm/chunk-VCAURUJ3.mjs +2 -0
  148. package/dist/esm/chunk-VCAURUJ3.mjs.map +1 -0
  149. package/dist/esm/chunk-VJ3OBIFQ.mjs +2 -0
  150. package/dist/esm/chunk-VJ3OBIFQ.mjs.map +1 -0
  151. package/dist/esm/{chunk-COW5IGYC.mjs → chunk-WA2NTBYY.mjs} +2 -2
  152. package/dist/esm/{chunk-UO5LUYGO.mjs → chunk-XGDLSWBF.mjs} +2 -2
  153. package/dist/esm/{chunk-EU6CX56Q.mjs → chunk-XH33BXEY.mjs} +2 -2
  154. package/dist/esm/{chunk-PYUU4OEL.mjs → chunk-XVZBWW46.mjs} +2 -2
  155. package/dist/esm/chunk-YBXQVY7N.mjs +2 -0
  156. package/dist/esm/{chunk-N7CE244N.mjs.map → chunk-YBXQVY7N.mjs.map} +1 -1
  157. package/dist/esm/{chunk-MKUAW7KW.mjs → chunk-YDNOKWV3.mjs} +2 -2
  158. package/dist/esm/{chunk-W637YAND.mjs → chunk-YRUF6N3U.mjs} +2 -2
  159. package/dist/esm/cli/index.mjs +1 -1
  160. package/dist/esm/cli/localNode.mjs +1 -1
  161. package/dist/esm/client/core.mjs +1 -1
  162. package/dist/esm/client/get.d.mts +6 -0
  163. package/dist/esm/client/get.mjs +1 -1
  164. package/dist/esm/client/index.mjs +1 -1
  165. package/dist/esm/client/post.d.mts +6 -0
  166. package/dist/esm/client/post.mjs +1 -1
  167. package/dist/esm/core/account/index.mjs +1 -1
  168. package/dist/esm/core/account/utils/address.mjs +1 -1
  169. package/dist/esm/core/account/utils/index.mjs +1 -1
  170. package/dist/esm/core/accountAddress.mjs +1 -1
  171. package/dist/esm/core/authenticationKey.mjs +1 -1
  172. package/dist/esm/core/crypto/cryptoHasher.d.mts +21 -0
  173. package/dist/esm/core/crypto/cryptoHasher.mjs +2 -0
  174. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  175. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  176. package/dist/esm/core/crypto/index.d.mts +2 -1
  177. package/dist/esm/core/crypto/index.mjs +1 -1
  178. package/dist/esm/core/crypto/keyless.d.mts +52 -8
  179. package/dist/esm/core/crypto/keyless.mjs +1 -1
  180. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  181. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  182. package/dist/esm/core/crypto/poseidon.d.mts +14 -2
  183. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  184. package/dist/esm/core/crypto/proof.mjs +1 -1
  185. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  186. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  187. package/dist/esm/core/crypto/signature.mjs +1 -1
  188. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  189. package/dist/esm/core/index.d.mts +2 -1
  190. package/dist/esm/core/index.mjs +1 -1
  191. package/dist/esm/index.d.mts +6 -5
  192. package/dist/esm/index.mjs +1 -1
  193. package/dist/esm/internal/account.mjs +1 -1
  194. package/dist/esm/internal/ans.mjs +1 -1
  195. package/dist/esm/internal/coin.mjs +1 -1
  196. package/dist/esm/internal/digitalAsset.mjs +1 -1
  197. package/dist/esm/internal/event.mjs +1 -1
  198. package/dist/esm/internal/faucet.mjs +1 -1
  199. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  200. package/dist/esm/internal/general.mjs +1 -1
  201. package/dist/esm/internal/keyless.d.mts +10 -9
  202. package/dist/esm/internal/keyless.mjs +1 -1
  203. package/dist/esm/internal/staking.mjs +1 -1
  204. package/dist/esm/internal/table.mjs +1 -1
  205. package/dist/esm/internal/transaction.mjs +1 -1
  206. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  207. package/dist/esm/internal/view.mjs +1 -1
  208. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  209. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  210. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  211. package/dist/esm/transactions/index.d.mts +1 -2
  212. package/dist/esm/transactions/index.mjs +1 -1
  213. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  214. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  215. package/dist/esm/transactions/instances/index.mjs +1 -1
  216. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  217. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  218. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  219. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  220. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  221. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  222. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  223. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  224. package/dist/esm/transactions/management/index.mjs +1 -1
  225. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  226. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  227. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -2
  228. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  229. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  230. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -11
  231. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  232. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  233. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  234. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  235. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  236. package/dist/esm/types/index.d.mts +2 -2
  237. package/dist/esm/types/index.mjs +1 -1
  238. package/dist/esm/types/keyless.d.mts +37 -1
  239. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  240. package/dist/esm/utils/helpers.mjs +1 -1
  241. package/dist/esm/utils/index.mjs +1 -1
  242. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  243. package/dist/esm/version.d.mts +1 -1
  244. package/dist/esm/version.mjs +1 -1
  245. package/package.json +1 -2
  246. package/src/account/EphemeralKeyPair.ts +6 -6
  247. package/src/account/KeylessAccount.ts +72 -66
  248. package/src/api/keyless.ts +13 -4
  249. package/src/bcs/deserializer.ts +14 -8
  250. package/src/bcs/serializer.ts +40 -0
  251. package/src/client/core.ts +4 -8
  252. package/src/client/get.ts +6 -0
  253. package/src/client/post.ts +6 -0
  254. package/src/core/crypto/cryptoHasher.ts +16 -0
  255. package/src/core/crypto/keyless.ts +155 -23
  256. package/src/core/crypto/poseidon.ts +19 -8
  257. package/src/internal/keyless.ts +83 -15
  258. package/src/internal/transactionSubmission.ts +2 -2
  259. package/src/transactions/transactionBuilder/signingMessage.ts +0 -13
  260. package/src/transactions/transactionBuilder/transactionBuilder.ts +4 -2
  261. package/src/types/index.ts +2 -2
  262. package/src/types/keyless.ts +36 -0
  263. package/src/utils/apiEndpoints.ts +5 -3
  264. package/src/utils/helpers.ts +0 -1
  265. package/src/version.ts +1 -1
  266. package/dist/esm/bcs/cryptoHasher.d.mts +0 -15
  267. package/dist/esm/bcs/cryptoHasher.mjs +0 -2
  268. package/dist/esm/chunk-5ADNWXP2.mjs +0 -2
  269. package/dist/esm/chunk-5ADNWXP2.mjs.map +0 -1
  270. package/dist/esm/chunk-5V2RGYYK.mjs +0 -2
  271. package/dist/esm/chunk-5V2RGYYK.mjs.map +0 -1
  272. package/dist/esm/chunk-5YI2GEG5.mjs +0 -2
  273. package/dist/esm/chunk-5YI2GEG5.mjs.map +0 -1
  274. package/dist/esm/chunk-CNH2RAJQ.mjs +0 -2
  275. package/dist/esm/chunk-I5JWDZIP.mjs.map +0 -1
  276. package/dist/esm/chunk-JCDZ2WXX.mjs.map +0 -1
  277. package/dist/esm/chunk-JKZHPY24.mjs +0 -2
  278. package/dist/esm/chunk-JM2B5E2I.mjs.map +0 -1
  279. package/dist/esm/chunk-KPZDC5ZE.mjs +0 -2
  280. package/dist/esm/chunk-KPZDC5ZE.mjs.map +0 -1
  281. package/dist/esm/chunk-LECNIPW7.mjs +0 -2
  282. package/dist/esm/chunk-LECNIPW7.mjs.map +0 -1
  283. package/dist/esm/chunk-N7CE244N.mjs +0 -2
  284. package/dist/esm/chunk-R2P2XANA.mjs +0 -2
  285. package/dist/esm/chunk-R2P2XANA.mjs.map +0 -1
  286. package/dist/esm/chunk-UTXJOB3O.mjs +0 -2
  287. package/dist/esm/chunk-VT6XJSRO.mjs.map +0 -1
  288. package/dist/esm/chunk-W4IWORPF.mjs +0 -2
  289. package/dist/esm/chunk-W4IWORPF.mjs.map +0 -1
  290. package/dist/esm/chunk-WDE54GRQ.mjs +0 -2
  291. package/dist/esm/chunk-WDE54GRQ.mjs.map +0 -1
  292. package/dist/esm/chunk-YZPQVZ7S.mjs +0 -2
  293. package/dist/esm/chunk-YZPQVZ7S.mjs.map +0 -1
  294. package/dist/esm/chunk-ZUQJLFR2.mjs +0 -2
  295. package/dist/esm/chunk-ZUQJLFR2.mjs.map +0 -1
  296. package/src/bcs/cryptoHasher.ts +0 -6
  297. /package/dist/esm/{chunk-4KEEUDZA.mjs.map → chunk-27PC47S7.mjs.map} +0 -0
  298. /package/dist/esm/{chunk-W36IQO5K.mjs.map → chunk-2NGHKNUS.mjs.map} +0 -0
  299. /package/dist/esm/{chunk-N466X3S6.mjs.map → chunk-37FFZSIM.mjs.map} +0 -0
  300. /package/dist/esm/{chunk-UTXJOB3O.mjs.map → chunk-3RJZNUCQ.mjs.map} +0 -0
  301. /package/dist/esm/{chunk-Z2ZR4PTF.mjs.map → chunk-472OGHMG.mjs.map} +0 -0
  302. /package/dist/esm/{chunk-STYDBDYL.mjs.map → chunk-4VPCPASN.mjs.map} +0 -0
  303. /package/dist/esm/{chunk-M7HZOQ6A.mjs.map → chunk-5YH2YL3L.mjs.map} +0 -0
  304. /package/dist/esm/{chunk-EPTCPBVW.mjs.map → chunk-6DFVM2W6.mjs.map} +0 -0
  305. /package/dist/esm/{chunk-LEBJNW6Y.mjs.map → chunk-6FK6OA37.mjs.map} +0 -0
  306. /package/dist/esm/{chunk-FBLSW5TB.mjs.map → chunk-6GGHUBUA.mjs.map} +0 -0
  307. /package/dist/esm/{chunk-3FVRXELT.mjs.map → chunk-7BW2N4IE.mjs.map} +0 -0
  308. /package/dist/esm/{chunk-NCDP26DV.mjs.map → chunk-7JLHN655.mjs.map} +0 -0
  309. /package/dist/esm/{chunk-SBQRBBRS.mjs.map → chunk-7XRUPEQ4.mjs.map} +0 -0
  310. /package/dist/esm/{chunk-Q3AUNZDW.mjs.map → chunk-B76XCRLH.mjs.map} +0 -0
  311. /package/dist/esm/{chunk-MTLETLKV.mjs.map → chunk-BO44HPGU.mjs.map} +0 -0
  312. /package/dist/esm/{chunk-HGZGTBA4.mjs.map → chunk-DPWEHSHH.mjs.map} +0 -0
  313. /package/dist/esm/{chunk-LQH7T3TE.mjs.map → chunk-E4XMEVB7.mjs.map} +0 -0
  314. /package/dist/esm/{chunk-7STYQ5ZE.mjs.map → chunk-EFMAZTIM.mjs.map} +0 -0
  315. /package/dist/esm/{chunk-NQMF46E5.mjs.map → chunk-EQN6FVO7.mjs.map} +0 -0
  316. /package/dist/esm/{chunk-T23OVRNF.mjs.map → chunk-F3ZVWLDH.mjs.map} +0 -0
  317. /package/dist/esm/{chunk-F5C4SZZ7.mjs.map → chunk-FF4L66LJ.mjs.map} +0 -0
  318. /package/dist/esm/{chunk-EB7AI4B4.mjs.map → chunk-FGGRPEQ3.mjs.map} +0 -0
  319. /package/dist/esm/{chunk-IEZO4PIG.mjs.map → chunk-FIG65OJD.mjs.map} +0 -0
  320. /package/dist/esm/{chunk-UDU5L4XH.mjs.map → chunk-FUKWM4HL.mjs.map} +0 -0
  321. /package/dist/esm/{chunk-C3L4ETUF.mjs.map → chunk-GRHLQDHF.mjs.map} +0 -0
  322. /package/dist/esm/{chunk-MGOHPDX4.mjs.map → chunk-GSCM444Z.mjs.map} +0 -0
  323. /package/dist/esm/{chunk-T6OEZ4KP.mjs.map → chunk-GTUBZWAF.mjs.map} +0 -0
  324. /package/dist/esm/{chunk-UWI5D7FD.mjs.map → chunk-H4AGIUGI.mjs.map} +0 -0
  325. /package/dist/esm/{chunk-3Y6JNFPD.mjs.map → chunk-HZOBRRQP.mjs.map} +0 -0
  326. /package/dist/esm/{chunk-6RBUXB5I.mjs.map → chunk-IBN7ETCB.mjs.map} +0 -0
  327. /package/dist/esm/{chunk-KFUOOBMJ.mjs.map → chunk-IGMXAPHY.mjs.map} +0 -0
  328. /package/dist/esm/{chunk-TEJ7BXJK.mjs.map → chunk-IPSITJFX.mjs.map} +0 -0
  329. /package/dist/esm/{chunk-NC5HHEEM.mjs.map → chunk-IXFYYWAC.mjs.map} +0 -0
  330. /package/dist/esm/{chunk-REBMGDZ5.mjs.map → chunk-J6VDYVNB.mjs.map} +0 -0
  331. /package/dist/esm/{chunk-Y5BON557.mjs.map → chunk-JKRWCFUQ.mjs.map} +0 -0
  332. /package/dist/esm/{chunk-IJE5YSXW.mjs.map → chunk-JWGG6XFS.mjs.map} +0 -0
  333. /package/dist/esm/{chunk-MWN63XBE.mjs.map → chunk-K2KJX32L.mjs.map} +0 -0
  334. /package/dist/esm/{chunk-6KNAIXZ3.mjs.map → chunk-KMVSI4PC.mjs.map} +0 -0
  335. /package/dist/esm/{chunk-Y33VGXNI.mjs.map → chunk-KSSJ3CT5.mjs.map} +0 -0
  336. /package/dist/esm/{chunk-EIRSA5UU.mjs.map → chunk-KUMZXNMD.mjs.map} +0 -0
  337. /package/dist/esm/{chunk-NWWXZ7EW.mjs.map → chunk-L5CPAOUM.mjs.map} +0 -0
  338. /package/dist/esm/{chunk-EADBYPUD.mjs.map → chunk-LMEJ5K6B.mjs.map} +0 -0
  339. /package/dist/esm/{chunk-WAXCU6D6.mjs.map → chunk-MEOGVBMZ.mjs.map} +0 -0
  340. /package/dist/esm/{chunk-3VGX3TXH.mjs.map → chunk-MLX6DFMR.mjs.map} +0 -0
  341. /package/dist/esm/{chunk-KKP4FBWZ.mjs.map → chunk-MX5Z3EHG.mjs.map} +0 -0
  342. /package/dist/esm/{chunk-MWUJCP27.mjs.map → chunk-NW3WUTTD.mjs.map} +0 -0
  343. /package/dist/esm/{chunk-YHO2EBXH.mjs.map → chunk-NW6LGHE7.mjs.map} +0 -0
  344. /package/dist/esm/{chunk-ZCCYHFPK.mjs.map → chunk-OJL36Q4H.mjs.map} +0 -0
  345. /package/dist/esm/{chunk-LO7B3CWN.mjs.map → chunk-OJUFU5TJ.mjs.map} +0 -0
  346. /package/dist/esm/{chunk-ONIYM7IU.mjs.map → chunk-PAY7N36H.mjs.map} +0 -0
  347. /package/dist/esm/{chunk-RUSWW265.mjs.map → chunk-PHEA3NOJ.mjs.map} +0 -0
  348. /package/dist/esm/{chunk-OX5GWFHX.mjs.map → chunk-PUP6XMAV.mjs.map} +0 -0
  349. /package/dist/esm/{chunk-A3UVZHDJ.mjs.map → chunk-PWYL5QZP.mjs.map} +0 -0
  350. /package/dist/esm/{chunk-UFJGYMEB.mjs.map → chunk-R4KIZ2FK.mjs.map} +0 -0
  351. /package/dist/esm/{chunk-6M53MDWB.mjs.map → chunk-RTO3YBWQ.mjs.map} +0 -0
  352. /package/dist/esm/{chunk-OT37OTT7.mjs.map → chunk-RURI53PG.mjs.map} +0 -0
  353. /package/dist/esm/{chunk-5RRZMXND.mjs.map → chunk-RX5SPT5S.mjs.map} +0 -0
  354. /package/dist/esm/{chunk-4USAUOCE.mjs.map → chunk-RYRID5HT.mjs.map} +0 -0
  355. /package/dist/esm/{chunk-Z6JERVLX.mjs.map → chunk-SBEZ64HG.mjs.map} +0 -0
  356. /package/dist/esm/{chunk-C34M4T77.mjs.map → chunk-SNDFJWYM.mjs.map} +0 -0
  357. /package/dist/esm/{chunk-7H3HRFVM.mjs.map → chunk-T5YEMU53.mjs.map} +0 -0
  358. /package/dist/esm/{chunk-ZNEBMSNC.mjs.map → chunk-TUCCV62K.mjs.map} +0 -0
  359. /package/dist/esm/{chunk-7QGIAVW4.mjs.map → chunk-UBON2G6Y.mjs.map} +0 -0
  360. /package/dist/esm/{chunk-COW5IGYC.mjs.map → chunk-WA2NTBYY.mjs.map} +0 -0
  361. /package/dist/esm/{chunk-UO5LUYGO.mjs.map → chunk-XGDLSWBF.mjs.map} +0 -0
  362. /package/dist/esm/{chunk-EU6CX56Q.mjs.map → chunk-XH33BXEY.mjs.map} +0 -0
  363. /package/dist/esm/{chunk-PYUU4OEL.mjs.map → chunk-XVZBWW46.mjs.map} +0 -0
  364. /package/dist/esm/{chunk-MKUAW7KW.mjs.map → chunk-YDNOKWV3.mjs.map} +0 -0
  365. /package/dist/esm/{chunk-W637YAND.mjs.map → chunk-YRUF6N3U.mjs.map} +0 -0
  366. /package/dist/esm/{bcs → core/crypto}/cryptoHasher.mjs.map +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkVLEH6QBRjs = require('./chunk-VLEH6QBR.js');var hn=255,Tn=65535,xe=4294967295,Fe=18446744073709551615n,Nt=340282366920938463463374607431768211455n,bn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var te=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeOptionStr(){if(this.deserializeUleb128AsU32()===1)return this.deserializeStr()}deserializeOption(t){if(this.deserializeUleb128AsU32()===1)return this.deserialize(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<xe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>xe)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<e;i+=1)r.push(this.deserialize(t));return r}};var _utils = require('@noble/hashes/utils');var V=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Ws=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Ws||{}),l= exports.Hex =class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new V("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new V("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){throw new V(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromHexString(t)}static isValid(t){try{return n.fromHexString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _4 => _4.message])}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var d=class{bcsToBytes(){let t=new Q;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return l.fromHexInput(t)}},Q= exports.Serializer =class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let i=new DataView(this.buffer,this.offset);t.apply(i,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){dr(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(xe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Fe,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Nt,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}serializeOption(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),t.serialize(this))}serializeOptionStr(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(t))}};_chunkVLEH6QBRjs.a.call(void 0, [Me(0,hn)],Q.prototype,"serializeU8",1),_chunkVLEH6QBRjs.a.call(void 0, [Me(0,Tn)],Q.prototype,"serializeU16",1),_chunkVLEH6QBRjs.a.call(void 0, [Me(0,xe)],Q.prototype,"serializeU32",1),_chunkVLEH6QBRjs.a.call(void 0, [Me(BigInt(0),Fe)],Q.prototype,"serializeU64",1),_chunkVLEH6QBRjs.a.call(void 0, [Me(BigInt(0),Nt)],Q.prototype,"serializeU128",1),_chunkVLEH6QBRjs.a.call(void 0, [Me(BigInt(0),bn)],Q.prototype,"serializeU256",1),_chunkVLEH6QBRjs.a.call(void 0, [Me(0,xe)],Q.prototype,"serializeU32AsUleb128",1);function dr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var js=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function Re(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(js(n,t,e))}function Me(n,t){return(e,r,i)=>{let o=i.value;return i.value=function(a){return Re(a,n,t),o.apply(this,[a])},i}}var qe=class n extends d{constructor(e){super();this.value=l.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let i=e.deserializeFixedBytes(r);return new n(i)}};var wn=class n extends d{constructor(e){super();this.value=new qe(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let i=qe.deserialize(e,r);return new n(i.value)}};var Sn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(Sn||{}),ci= exports.TypeTagVariants =(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g[g.Reference=254]="Reference",g[g.Generic=255]="Generic",g))(ci||{}),Bt= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p))(Bt||{}),ui= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(ui||{}),pi= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(pi||{}),di= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(di||{}),li= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(li||{}),lr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(lr||{}),gi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(gi||{}),gr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(gr||{}),mi= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(mi||{}),mr= exports.EphemeralCertificateVariant =(t=>(t[t.ZkProof=0]="ZkProof",t))(mr||{}),yr= exports.ZkpVariant =(t=>(t[t.Groth16=0]="Groth16",t))(yr||{}),fr= exports.TransactionResponseType =(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s.Validator="validator_transaction",s))(fr||{});function au(n){return n.type==="pending_transaction"}function cu(n){return n.type==="user_transaction"}function uu(n){return n.type==="genesis_transaction"}function pu(n){return n.type==="block_metadata_transaction"}function du(n){return n.type==="state_checkpoint_transaction"}function lu(n){return n.type==="validator_transaction"}function gu(n){return"signature"in n&&n.signature==="ed25519_signature"}function mu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function yu(n){return n.type==="multi_agent_signature"}function fu(n){return n.type==="fee_payer_signature"}function Au(n){return n.type==="multi_ed25519_signature"}var Xs=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Xs||{}),yi= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(yi||{}),Ys= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Ys||{}),fe= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(fe||{}),Ar= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Ar||{}),Zs= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Zs||{});var E=class n extends d{constructor(e){super();dr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},O= exports.U8 =class n extends d{constructor(e){super();Re(e,0,hn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},ne= exports.U16 =class n extends d{constructor(e){super();Re(e,0,Tn),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},re= exports.U32 =class n extends d{constructor(e){super();Re(e,0,xe),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},G= exports.U64 =class n extends d{constructor(e){super();Re(e,BigInt(0),Fe),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},de= exports.U128 =class n extends d{constructor(e){super();Re(e,BigInt(0),Nt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},le= exports.U256 =class n extends d{constructor(e){super();Re(e,BigInt(0),bn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var T=class n extends d{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof O)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=l.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(i=>new O(i)))}static U16(e){return new n(e.map(r=>new ne(r)))}static U32(e){return new n(e.map(r=>new re(r)))}static U64(e){return new n(e.map(r=>new G(r)))}static U128(e){return new n(e.map(r=>new de(r)))}static U256(e){return new n(e.map(r=>new le(r)))}static Bool(e){return new n(e.map(r=>new E(r)))}static MoveString(e){return new n(e.map(r=>new b(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1)o.push(r.deserialize(e));return new n(o)}},b= exports.MoveString =class n extends d{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);T.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},ze= exports.MoveOption =class n extends d{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new T([e]):this.vec=new T([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new O(e):void 0)}static U16(e){return new n(e!=null?new ne(e):void 0)}static U32(e){return new n(e!=null?new re(e):void 0)}static U64(e){return new n(e!=null?new G(e):void 0)}static U128(e){return new n(e!=null?new de(e):void 0)}static U256(e){return new n(e!=null?new le(e):void 0)}static Bool(e){return new n(e!=null?new E(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,r){let i=T.deserialize(e,r);return new n(i.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ea=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ea||{}),w=class w extends d{constructor(e){super();if(e.length!==w.LENGTH)throw new V("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(w.LENGTH);return new w(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new V("Hex string must start with a leading 0x.","leading_zero_x_required");let r=w.fromString(e);if(e.length!==w.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new V(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new V(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new V("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new V("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let i;try{i=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(o){throw new V(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new w(i)}static from(e){return e instanceof w?e:e instanceof Uint8Array?new w(e):w.fromString(e)}static fromStrict(e){return e instanceof w?e:e instanceof Uint8Array?new w(e):w.fromStringStrict(e)}static isValid(e){try{return e.strict?w.fromStrict(e.input):w.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,i)=>r===e.data[i])}};w.LENGTH=32,w.LONG_STRING_LENGTH=64,w.ZERO=w.from("0x0"),w.ONE=w.from("0x1"),w.TWO=w.from("0x2"),w.THREE=w.from("0x3"),w.FOUR=w.from("0x4");var u=w;var De=class De extends d{constructor(e){super();let{data:r}=e,i=l.fromHexInput(r);if(i.toUint8Array().length!==De.LENGTH)throw new Error(`Authentication Key length should be ${De.LENGTH}`);this.data=i}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(De.LENGTH);return new De({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:r,input:i}=e,o=l.fromHexInput(i).toUint8Array(),s=new Uint8Array([...o,r]),a=_sha3.sha3_256.create();a.update(s);let c=a.digest();return new De({data:c})}static fromPublicKeyAndScheme(e){let{publicKey:r}=e;return r.authKey()}static fromPublicKey(e){let{publicKey:r}=e;return r.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};De.LENGTH=32;var F=De;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ai = _interopRequireWildcard(_bip39);var ia=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,oa= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,sa= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(sa||{}),hi= exports.HARDENED_OFFSET =2147483648;function Ti(n){return oa.test(n)}function bi(n){return ia.test(n)}var hr=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},wi= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return hr(t,s)},aa=n=>n.replace("'",""),Si= exports.splitPath =n=>n.split("/").slice(1).map(aa),xn= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Ai.mnemonicToSeedSync(t)};var $e=class extends d{toString(){let t=this.toUint8Array();return l.fromHexInput(t).toString()}},ie= exports.AccountPublicKey =class extends $e{};var K=class extends d{toString(){let t=this.toUint8Array();return l.fromHexInput(t).toString()}};var st=n=>typeof n=="string"?l.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var xi=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16],Le=class Le extends ie{constructor(e){super();let r=l.fromHexInput(e);if(r.toUint8Array().length!==Le.LENGTH)throw new Error(`PublicKey length should be ${Le.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof S))return!1;let o=st(r),s=l.fromHexInput(o).toUint8Array(),a=i.toUint8Array(),c=this.key.toUint8Array();return i.isCanonicalSignature()?_ed25519.ed25519.verify(a,s,c):!1}authKey(){return F.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Le(r)}static isPublicKey(e){return e instanceof Le}};Le.LENGTH=32;var v=Le,oe=class oe extends d{constructor(e){super();let r=l.fromHexInput(e);if(r.toUint8Array().length!==oe.LENGTH)throw new Error(`PrivateKey length should be ${oe.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new oe(e)}static fromDerivationPath(e,r){if(!bi(e))throw new Error(`Invalid derivation path ${e}`);return oe.fromDerivationPathInner(e,xn(r))}static fromDerivationPathInner(e,r,i=hi){let{key:o,chainCode:s}=hr(oe.SLIP_0010_SEED,r),a=Si(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,m)=>wi(p,m+i),{key:o,chainCode:s});return new oe(c)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new v(e)}sign(e){let r=st(e),i=l.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new S(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new oe(r)}static isPrivateKey(e){return e instanceof oe}};oe.LENGTH=32,oe.SLIP_0010_SEED="ed25519 seed";var q=oe,at=class at extends K{constructor(e){super();let r=l.fromHexInput(e);if(r.toUint8Array().length!==at.LENGTH)throw new Error(`Signature length should be ${at.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new at(r)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let r=e.length-1;r>=0;r-=1){if(e[r]<xi[r])return!0;if(e[r]>xi[r])return!1}return!1}};at.LENGTH=64;var S=at;var se=class se extends ie{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>se.MAX_KEYS||r.length<se.MIN_KEYS)throw new Error(`Must have between ${se.MIN_KEYS} and ${se.MAX_KEYS} public keys, inclusive`);if(i<se.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${se.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof He))return!1;let o=[];for(let s=0;s<4;s+=1)for(let a=0;a<8;a+=1)if((i.bitmap[s]&1<<7-a)!==0){let p=s*8+a;o.push(p)}if(o.length!==i.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(o.length<this.threshold)throw new Error("Not enough signatures");for(let s=0;s<o.length;s+=1)if(!this.publicKeys[o[s]].verifySignature({message:r,signature:i.signatures[s]}))return!1;return!0}authKey(){return F.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*v.LENGTH+1);return this.publicKeys.forEach((r,i)=>{e.set(r.toUint8Array(),i*v.LENGTH)}),e[this.publicKeys.length*v.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r[r.length-1],o=[];for(let s=0;s<r.length-1;s+=v.LENGTH){let a=s;o.push(new v(r.subarray(a,a+v.LENGTH)))}return new se({publicKeys:o,threshold:i})}};se.MAX_KEYS=32,se.MIN_KEYS=2,se.MIN_THRESHOLD=1;var ct=se,X=class X extends K{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>X.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${X.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=X.createBitmap({bits:i});else{if(i.length!==X.BITMAP_LEN)throw new Error(`"bitmap" length should be ${X.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*S.LENGTH+X.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*S.LENGTH)}),e.set(this.bitmap,this.signatures.length*S.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r.subarray(r.length-4),o=[];for(let s=0;s<r.length-i.length;s+=S.LENGTH){let a=s;o.push(new S(r.subarray(a,a+S.LENGTH)))}return new X({signatures:o,bitmap:i})}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(a>=X.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${X.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");if(c>0&&a<=r[c-1])throw new Error("The bits need to be sorted in ascending order.");s.add(a);let p=Math.floor(a/8),m=o[p];m|=i>>a%8,o[p]=m}),o}};X.MAX_SIGNATURES_SUPPORTED=32,X.BITMAP_LEN=4;var He=X;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ve=class Ve extends $e{constructor(e){super();let r=l.fromHexInput(e);if(r.toUint8Array().length!==Ve.LENGTH)throw new Error(`PublicKey length should be ${Ve.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof _e))return!1;let o=st(r),s=l.fromHexInput(o).toUint8Array(),a=_sha3.sha3_256.call(void 0, s),c=i.toUint8Array();return _secp256k1.secp256k1.verify(c,a,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ve(r)}static isPublicKey(e){return e instanceof Ve}};Ve.LENGTH=65;var he=Ve,Ae=class Ae extends d{constructor(e){super();let r=l.fromHexInput(e);if(r.toUint8Array().length!==Ae.LENGTH)throw new Error(`PrivateKey length should be ${Ae.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Ae(e)}static fromDerivationPath(e,r){if(!Ti(e))throw new Error(`Invalid derivation path ${e}`);return Ae.fromDerivationPathInner(e,xn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new Ae(i)}sign(e){let r=st(e),i=l.fromHexInput(r),o=_sha3.sha3_256.call(void 0, i.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new _e(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new he(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ae(r)}static isPrivateKey(e){return e instanceof Ae}};Ae.LENGTH=32;var Qe=Ae,ut=class ut extends K{constructor(e){super();let r=l.fromHexInput(e);if(r.toUint8Array().length!==ut.LENGTH)throw new Error(`Signature length should be ${ut.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ut(r)}};ut.LENGTH=64;var _e=ut;var We=class n extends $e{constructor(e){super();let r=e.constructor.name;switch(r){case v.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:i}=e;return this.publicKey.verifySignature({message:r,signature:i})}serialize(e){if(this.publicKey instanceof v)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}},ge= exports.EphemeralSignature =class n extends K{constructor(e){super();let r=e.constructor.name;switch(r){case S.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=l.fromHexInput(e),i=new te(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof S)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(S.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var va=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Pi=31,Pa=16,vi=(Pa-1)*Pi;function Pn(n,t){let r=new TextEncoder().encode(n);return Ca(r,t)}function Ca(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=Tr(n,t);return Gt(e)}function Ea(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=Ra(n,t);return Ia(e)}function Tr(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return Ea(n,t).concat([BigInt(n.length)])}function Ia(n){if(n.length>vi)throw new Error(`Can't pack more than ${vi}. Was given ${n.length} bytes`);return Ua(n,Pi).map(t=>Ot(t))}function Ua(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Ot(n){let t=BigInt(0);for(let e=n.length-1;e>=0;e-=1)t=t<<BigInt(8)|BigInt(n[e]);return t}function Ci(n,t){let e=new Uint8Array(t);for(let r=0;r<t;r+=1)e[r]=Number(n&BigInt(255)),n>>=BigInt(8);return e}function Ra(n,t){if(t<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let e=new Uint8Array(t);e.set(n);for(let r=n.length;r<t;r+=1)e[r]=0;return e}function Gt(n){let t=va[n.length-1];if(t)return t(n);throw new Error(`Unable to hash input of length ${n.length}`)}var Cn=class extends d{toString(){let t=this.bcsToBytes();return l.fromHexInput(t).toString()}};var Mt=1e7,za= exports.MAX_AUD_VAL_BYTES =120,Da= exports.MAX_UID_KEY_BYTES =30,ka= exports.MAX_UID_VAL_BYTES =330,Td= exports.MAX_ISS_VAL_BYTES =120,bd= exports.MAX_EXTRA_FIELD_BYTES =350,wd= exports.MAX_JWT_HEADER_B64_BYTES =300,Sd= exports.MAX_COMMITED_EPK_BYTES =93,ve=class ve extends ie{constructor(e,r){super();let i=l.fromHexInput(r).toUint8Array();if(i.length!==ve.ID_COMMITMENT_LENGTH)throw new Error(`Address seed length in bytes should be ${ve.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new Q;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),F.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new ve(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new ve(r,i)}static isPublicKey(e){return e instanceof ve}static create(e){return Ei(e),new ve(e.iss,Ei(e))}};ve.ID_COMMITMENT_LENGTH=32;var me=ve;function Ei(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Ot(l.fromHexInput(i).toUint8Array()),Pn(r,za),Pn(e,ka),Pn(t,Da)];return Ci(Gt(o),me.ID_COMMITMENT_LENGTH)}var je=class n extends K{constructor(e){super();let{jwtHeader:r,ephemeralCertificate:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.ephemeralCertificate=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let r=pt.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=We.deserialize(e),a=ge.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:o,ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static load(e){let r=pt.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=We.deserialize(e),a=ge.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:o,ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static isSignature(e){return e instanceof n}},pt= exports.EphemeralCertificate =class n extends K{constructor(e,r){super();this.signature=e,this.variant=r}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(ke.deserialize(e),r);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},Ft= exports.Groth16Zkp =class n extends Cn{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=l.fromHexInput(r).toUint8Array(),this.b=l.fromHexInput(i).toUint8Array(),this.c=l.fromHexInput(o).toUint8Array()}serialize(e){e.serializeFixedBytes(this.a),e.serializeFixedBytes(this.b),e.serializeFixedBytes(this.c)}static deserialize(e){let r=e.deserializeFixedBytes(32),i=e.deserializeFixedBytes(64),o=e.deserializeFixedBytes(32);return new n({a:r,b:i,c:o})}},dt= exports.ZkProof =class n extends d{constructor(e,r){super();this.proof=e,this.variant=r}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(Ft.deserialize(e),r);default:throw new Error(`Unknown variant index for ZkProof: ${r}`)}}},ke= exports.ZeroKnowledgeSig =class n extends K{constructor(e){super();let{proof:r,expHorizonSecs:i=BigInt(Mt),trainingWheelsSignature:o,extraField:s,overrideAudVal:a}=e;this.proof=r,this.expHorizonSecs=i,this.trainingWheelsSignature=o,this.extraField=s,this.overrideAudVal=a}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new te(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let r=dt.deserialize(e),i=e.deserializeU64(),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(ge);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}static load(e){let r=dt.deserialize(e),i=e.deserializeU64(),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(ge);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}};var k=class n extends ie{constructor(e){super();if(this.publicKey=e,e instanceof v)this.variant=0;else if(e instanceof he)this.variant=1;else if(e instanceof me)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof N?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return F.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=v.deserialize(e);break;case 1:i=he.deserialize(e);break;case 3:i=me.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new n(i)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof v}isSecp256k1PublicKey(){return this.publicKey instanceof he}},N= exports.AnySignature =class n extends K{constructor(e){super();if(this.signature=e,e instanceof S)this.variant=0;else if(e instanceof _e)this.variant=1;else if(e instanceof je)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=S.deserialize(e);break;case 1:i=_e.deserialize(e);break;case 3:i=je.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(i)}};function Ka(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var lt=class n extends ie{constructor(e){super();let{publicKeys:r,signaturesRequired:i}=e;if(i<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<i)throw new Error(`Provided ${r.length} public keys is smaller than the ${i} required signatures`);this.publicKeys=r.map(o=>o instanceof k?o:new k(o)),this.signaturesRequired=i}verifySignature(e){throw new Error("not implemented")}authKey(){return F.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(k),i=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:i})}createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let p=Math.floor(a/8),m=o[p];m|=i>>a%8,o[p]=m}),o}getIndex(e){let r=e instanceof k?e:new k(e),i=this.publicKeys.findIndex(o=>o.toString()===r.toString());if(i!==-1)return i;throw new Error("Public key not found in MultiKey")}},Y=class Y extends K{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Y.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(s=>s instanceof N?s:new N(s)),!(i instanceof Uint8Array))this.bitmap=Y.createBitmap({bits:i});else{if(i.length!==Y.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Y.BITMAP_LEN}`);this.bitmap=i}let o=this.bitmap.reduce((s,a)=>s+Ka(a),0);if(o!==this.signatures.length)throw new Error(`Expecting ${o} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Y.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),p=o[c];p|=i>>a%8,o[c]=p}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(N),i=e.deserializeBytes();return new Y({signatures:r,bitmap:i})}};Y.BITMAP_LEN=4,Y.MAX_SIGNATURES_SUPPORTED=Y.BITMAP_LEN*8;var Xe=Y;var $=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ye.load(t);case 1:return En.load(t);case 2:return L.load(t);case 3:return Ye.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof ye}isMultiEd25519(){return this instanceof En}isSingleKey(){return this instanceof L}isMultiKey(){return this instanceof Ye}},ye= exports.AccountAuthenticatorEd25519 =class n extends ${constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=v.deserialize(e),i=S.deserialize(e);return new n(r,i)}},En= exports.AccountAuthenticatorMultiEd25519 =class n extends ${constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=ct.deserialize(e),i=He.deserialize(e);return new n(r,i)}},L= exports.AccountAuthenticatorSingleKey =class n extends ${constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=k.deserialize(e),i=N.deserialize(e);return new n(r,i)}},Ye= exports.AccountAuthenticatorMultiKey =class n extends ${constructor(e,r){super();this.public_keys=e,this.signatures=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let r=lt.deserialize(e),i=Xe.deserialize(e);return new n(r,i)}};var qt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(qt||{}),Ii= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Ui= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,In= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Un= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Ri= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",br= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ze= exports.ProcessorType =(a=>(a.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",a.DEFAULT="default_processor",a.EVENTS_PROCESSOR="events_processor",a.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",a.STAKE_PROCESSOR="stake_processor",a.TOKEN_V2_PROCESSOR="token_v2_processor",a.USER_TRANSACTION_PROCESSOR="user_transaction_processor",a))(Ze||{});var gt=class n extends d{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var R=class n extends d{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var $t=class n extends d{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(r[0]),new R(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e);return new n(r,i)}};var z=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return M.load(t);case 1:return Te.load(t);case 2:return W.load(t);case 3:return ft.load(t);case 4:return Z.load(t);case 5:return ht.load(t);case 6:return P.load(t);case 7:return y.load(t);case 8:return mt.load(t);case 9:return yt.load(t);case 10:return At.load(t);case 255:return D.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof M}isAddress(){return this instanceof Z}isGeneric(){return this instanceof D}isSigner(){return this instanceof ht}isVector(){return this instanceof P}isStruct(){return this instanceof y}isU8(){return this instanceof Te}isU16(){return this instanceof mt}isU32(){return this instanceof yt}isU64(){return this instanceof W}isU128(){return this instanceof ft}isU256(){return this instanceof At}},M= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Te= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},mt= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},yt= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},W= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},ft= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},At= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},Z= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},ht= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},Rn= exports.TypeTagReference =class n extends z{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=z.deserialize(e);return new n(r)}},D= exports.TypeTagGeneric =class n extends z{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},P= exports.TypeTagVector =class n extends z{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new Te)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=z.deserialize(e);return new n(r)}},y= exports.TypeTagStruct =class n extends z{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Pe.deserialize(e);return new n(r)}isTypeTag(e,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Pe= exports.StructTag =class n extends d{constructor(e,r,i,o){super();this.address=e,this.moduleName=r,this.name=i,this.typeArgs=o}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e),o=R.deserialize(e),s=e.deserializeVector(z);return new n(r,i,o,s)}};function zl(){return new Pe(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function x(){return new Pe(u.ONE,new R("string"),new R("String"),[])}function Dl(n){return new Pe(u.ONE,new R("option"),new R("Option"),[n])}function J(n){return new Pe(u.ONE,new R("object"),new R("Object"),[n])}function Na(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return O.deserialize(n);case 1:return G.deserialize(n);case 2:return de.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,O);case 5:return E.deserialize(n);case 6:return ne.deserialize(n);case 7:return re.deserialize(n);case 8:return le.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Je=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Lt.load(t);case 2:return Ht.load(t);case 3:return Vt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Lt= exports.TransactionPayloadScript =class n extends Je{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Qt.deserialize(e);return new n(r)}},Ht= exports.TransactionPayloadEntryFunction =class n extends Je{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=et.deserialize(e);return new n(r)}},Vt= exports.TransactionPayloadMultiSig =class n extends Je{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Wt.deserialize(e);return new n(r)}},et= exports.EntryFunction =class n{constructor(t,e,r,i){this.module_name=t,this.function_name=e,this.type_args=r,this.args=i}static build(t,e,r,i){return new n($t.fromStr(t),new R(e),r,i)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=$t.deserialize(t),r=R.deserialize(t),i=t.deserializeVector(z),o=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=t.deserializeUleb128AsU32(),p=wn.deserialize(t,c);s.push(p)}return new n(e,r,i,s)}},Qt= exports.Script =class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(z),i=t.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Na(t);o.push(a)}return new n(e,r,o)}},Wt= exports.MultiSig =class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=u.deserialize(t),r=t.deserializeBool(),i;return r&&(i=jt.deserialize(t)),new n(e,i)}},jt= exports.MultiSigTransactionPayload =class n extends d{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(et.deserialize(e))}};var ae=class n extends d{constructor(e,r,i,o,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=i,this.max_gas_amount=o,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=e.deserializeU64(),o=Je.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=gt.deserialize(e);return new n(r,i,o,s,a,c,p)}},zn= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return tt.load(t);case 1:return nt.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},tt= exports.MultiAgentRawTransaction =class n extends zn{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=ae.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},nt= exports.FeePayerRawTransaction =class n extends zn{constructor(e,r,i){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=i}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=ae.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Dn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new G(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=T.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)}};var Ce=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Tt.load(t);case 1:return wr.load(t);case 2:return bt.load(t);case 3:return wt.load(t);case 4:return St.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Tt= exports.TransactionAuthenticatorEd25519 =class n extends Ce{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=v.deserialize(e),i=S.deserialize(e);return new n(r,i)}},wr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Ce{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=ct.deserialize(e),i=He.deserialize(e);return new n(r,i)}},bt= exports.TransactionAuthenticatorMultiAgent =class n extends Ce{constructor(e,r,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=$.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector($);return new n(r,i,o)}},wt= exports.TransactionAuthenticatorFeePayer =class n extends Ce{constructor(e,r,i,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i,this.fee_payer=o}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=$.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector($),s=u.deserialize(e),a=$.deserialize(e),c={address:s,authenticator:a};return new n(r,i,o,c)}},St= exports.TransactionAuthenticatorSingleSender =class n extends Ce{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=$.deserialize(e);return new n(r)}};var rt=class n extends d{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=ae.deserialize(e),i=Ce.deserialize(e);return new n(r,i)}};var kn=class n extends d{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=ae.deserialize(e),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(r,o)}};var Kn=class n extends d{constructor(e,r,i){super();this.rawTransaction=e,this.feePayerAddress=i,this.secondarySignerAddresses=r}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=ae.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Sr(n){return n.feePayerAddress?new nt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new tt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Nn(n,t){let e=_sha3.sha3_256.create();if(!t.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${t}`);e.update(t);let r=e.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function zi(n){return Nn(n.bcsToBytes(),n.domainSeparator)}function xt(n){let t=Sr(n);return n.feePayerAddress?Nn(t.bcsToBytes(),br):n.secondarySignerAddresses?Nn(t.bcsToBytes(),br):Nn(t.bcsToBytes(),Ri)}var _t=class n{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=q.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,i=q.fromDerivationPath(e,r);return new n({privateKey:i})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new ye(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new ye(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(xt(t))}};var vt=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new k(e.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(t={}){let{scheme:e=0}=t,r;switch(e){case 0:r=q.generate();break;case 2:r=Qe.generate();break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:r})}static fromDerivationPath(t){let{scheme:e=0,path:r,mnemonic:i}=t,o;switch(e){case 0:o=q.fromDerivationPath(r,i);break;case 2:o=Qe.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:o})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new L(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new L(this.publicKey,this.signTransaction(t))}sign(t){return new N(this.privateKey.sign(t))}signTransaction(t){return this.sign(xt(t))}};var Ke=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?_t.generate():vt.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:i=!0}=t;return e instanceof q&&i?new _t({privateKey:e,address:r}):new vt({privateKey:e,address:r})}static fromPrivateKeyAndAddress(t){return this.fromPrivateKey(t)}static fromDerivationPath(t){let{scheme:e=0,mnemonic:r,path:i,legacy:o=!0}=t;return e===0&&o?_t.fromDerivationPath({mnemonic:r,path:i}):vt.fromDerivationPath({scheme:e,mnemonic:r,path:i})}static authKey(t){let{publicKey:e}=t;return e.authKey()}verifySignature(t){return this.publicKey.verifySignature(t)}};var Pt=class Pt extends d{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new We(r.publicKey()),this.expiryDateSecs=i||BigInt(_chunkVLEH6QBRjs.d.call(void 0, _chunkVLEH6QBRjs.c.call(void 0, )+Mt)),this.blinder=o!==void 0?l.fromHexInput(o).toUint8Array():Ga(),this.nonce=this.generateNonce()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=q.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let o=e.deserializeU64(),s=e.deserializeFixedBytes(31);return new Pt({privateKey:i,expiryDateSecs:o,blinder:s})}static fromBytes(e){return Pt.deserialize(new te(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _8 => _8.scheme])){case 0:default:r=q.generate()}return new Pt({privateKey:r,expiryDateSecs:_optionalChain([e, 'optionalAccess', _9 => _9.expiryDateSecs])})}generateNonce(){let e=Tr(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(Ot(this.blinder)),Gt(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new ge(this.privateKey.sign(e))}};Pt.BLINDER_LENGTH=31;var Xt=Pt;function Ga(){return _utils.randomBytes.call(void 0, Xt.BLINDER_LENGTH)}var _jwtdecode = require('jwt-decode');var _jwksrsa = require('jwks-rsa');var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Bn=class extends d{};var qa={"https://accounts.google.com":"https://www.googleapis.com/oauth2/v3/certs"},$a= exports.KeylessErrorType =(o=>(o[o.JWK_EXPIRED=0]="JWK_EXPIRED",o[o.EPK_EXPIRED=1]="EPK_EXPIRED",o[o.PROOF_NOT_FOUND=2]="PROOF_NOT_FOUND",o[o.UNKNOWN_INVALID_SIGNATURE=3]="UNKNOWN_INVALID_SIGNATURE",o[o.UNKNOWN=4]="UNKNOWN",o))($a||{}),Yt= exports.KeylessError =class n extends Error{constructor(e){super();this.type=e}static async fromAptosApiError(e,r){return e.data.message.includes("INVALID_SIGNATURE")?r.isExpired()?new n(1):await r.checkJwkValidity()?new n(3):new n(0):new n(4)}},Ne=class Ne extends d{constructor(e){super();let{address:r,ephemeralKeyPair:i,uidKey:o,uidVal:s,aud:a,pepper:c,proofOrFetcher:p,proofFetchCallback:m,jwt:_}=e;if(this.ephemeralKeyPair=i,this.publicKey=me.create(e),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=_,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof ke)this.proof=p;else{if(m===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async g=>{await m(g),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let U=l.fromHexInput(c).toUint8Array();if(U.length!==Ne.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Ne.PEPPER_LENGTH}`);this.pepper=U,this.isJwtValid=!0}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeFixedBytes(31),s=Xt.deserialize(e),a=ke.deserialize(e);return Ne.fromJWTAndProof({proof:a,pepper:o,uidKey:i,jwt:r,ephemeralKeyPair:s})}isExpired(){return this.ephemeralKeyPair.isExpired()}async checkJwkValidity(){if(!this.isJwtValid)return!1;let e=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0}),r=new (0, _jwksrsa.JwksClient)({jwksUri:qa[this.publicKey.iss]});try{return await r.getSigningKey(e.kid),!0}catch (e2){return this.isJwtValid=!1,!1}}signWithAuthenticator(e){let r=new N(this.sign(e)),i=new k(this.publicKey);return new L(i,r)}signTransactionWithAuthenticator(e){let r=new N(this.signTransaction(e)),i=new k(this.publicKey);return new L(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new Yt(1);if(this.proof===void 0)throw new Yt(2);if(!this.isJwtValid)throw new Yt(0);let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new je({jwtHeader:_chunkVLEH6QBRjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new pt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=Sr(e),i=new xr(r,this.proof.proof),o=zi(i);return this.sign(o)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return Ne.deserialize(new te(e))}static fromJWTAndProof(e){let{proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,proofFetchCallback:a}=e,c=_nullishCoalesce(e.uidKey, () => ("sub")),p=_jwtdecode.jwtDecode.call(void 0, i),m=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let _=p.aud,U=p[c];return new Ne({proofOrFetcher:r,ephemeralKeyPair:o,iss:m,uidKey:c,uidVal:U,aud:_,pepper:s,jwt:i,proofFetchCallback:a})}};Ne.PEPPER_LENGTH=31;var be=Ne,xr= exports.TransactionAndProof =class extends Bn{constructor(e,r){super();this.transaction=e,this.proof=r,this.domainSeparator="APTOS::TransactionAndProof"}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}};var On=class n{constructor(t){let{multiKey:e,signers:r}=t;this.publicKey=e,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let i=[];for(let s of r)i.push(this.publicKey.getIndex(s.publicKey));let o=r.map((s,a)=>[s,i[a]]);o.sort((s,a)=>s[1]-a[1]),this.signers=o.map(s=>s[0]),this.signerIndicies=o.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:i})}static fromPublicKeysAndSigners(t){let{publicKeys:e,signaturesRequired:r,signers:i}=t,o=new lt({publicKeys:e,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(t){return t instanceof n}signWithAuthenticator(t){return new Ye(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new Ye(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof be);await Promise.all(t.filter(e=>e.proof instanceof Promise).map(e=>e.proof))}sign(t){let e=[];for(let r of this.signers)e.push(r.sign(t));return new Xe({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new Xe({signatures:e,bitmap:this.signaturesBitmap})}verifySignature(t){let{message:e,signature:r}=t;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:e,signature:s}))return!1}return!0}};var ce=class extends Error{constructor(e,r,i){super(i);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var ki="1.16.0-zeta.0";var Ki={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Ni= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Bi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},_r= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"http://127.0.0.1:8000/v0"},vr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"http://127.0.0.1:8083/v0"},Pr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Pr||{}),Cr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},fy= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function Oi(n,t){let e=t.bcsToBytes(),r=new te(e);return n.deserialize(r)}var Gi={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function La(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _10 => _10.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${ki}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _11 => _11.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _12 => _12.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _13 => _13.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _14 => _14.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function Gn(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await La({...n,url:o},t.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new ce(n,a,`Error: ${a.data}`);if(e==="Indexer"){let p=a.data;if(p.errors)throw new ce(n,a,_nullishCoalesce(`Indexer error: ${p.errors[0].message}`, () => (`Indexer unhandled Error ${s.status} : ${s.statusText}`)));a.data=p.data}if(a.status>=200&&a.status<300)return a;if(a.status>=500)throw new ce(n,a,`${s.data}`);if(t.isPepperServiceRequest(r)||t.isProverServiceRequest(r))throw new ce(n,a,`${s.data}`);let c;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?c=JSON.stringify(a.data):a.status in Gi?c=Gi[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ce(n,a,`${e} error: ${c}`)}async function Er(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Gn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function ee(n){let{aptosConfig:t}=n;return Er({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _15 => _15.clientConfig, 'optionalAccess', _16 => _16.HEADERS]),..._optionalChain([t, 'access', _17 => _17.fullnodeConfig, 'optionalAccess', _18 => _18.HEADERS])}}})}async function Oy(n){return Er({...n,type:"Pepper"})}async function Ct(n){let t=[],e,r=n.params;do{let i=await Er({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=i.headers["x-aptos-cursor"],delete i.headers,t.push(...i.data),r.start=e}while(e!=null);return t}async function Zt(n){let{type:t,originMethod:e,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,m=c.getRequestUrl(t);return Gn({url:m,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function it(n){let{aptosConfig:t}=n;return Zt({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _19 => _19.clientConfig, 'optionalAccess', _20 => _20.HEADERS]),..._optionalChain([t, 'access', _21 => _21.fullnodeConfig, 'optionalAccess', _22 => _22.HEADERS])}}})}async function Fi(n){let{aptosConfig:t}=n;return Zt({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _23 => _23.clientConfig, 'optionalAccess', _24 => _24.HEADERS]),..._optionalChain([t, 'access', _25 => _25.indexerConfig, 'optionalAccess', _26 => _26.HEADERS])}}})}async function Mi(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _27 => _27.clientConfig, 'optionalAccess', _28 => delete _28.API_KEY]),Zt({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _29 => _29.clientConfig, 'optionalAccess', _30 => _30.HEADERS]),..._optionalChain([e, 'access', _31 => _31.faucetConfig, 'optionalAccess', _32 => _32.HEADERS])}}})}async function qi(n){return Zt({...n,type:"Pepper"})}async function $i(n){return Zt({...n,type:"Prover"})}var Ha=`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkHPZUSDYPjs = require('./chunk-HPZUSDYP.js');var bn=255,wn=65535,xe=4294967295,$e=18446744073709551615n,Ot=340282366920938463463374607431768211455n,Sn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var te=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeOptionStr(){if(this.deserializeUleb128AsU32()===1)return this.deserializeStr()}deserializeOption(t){if(this.deserializeUleb128AsU32()===1)return this.deserialize(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<xe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>xe)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<e;i+=1)r.push(this.deserialize(t));return r}};var _utils = require('@noble/hashes/utils');var Q=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Ys=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Ys||{}),g= exports.Hex =class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new Q("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new Q("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){throw new Q(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromHexString(t)}static isValid(t){try{return n.fromHexString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _4 => _4.message])}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var d=class{bcsToBytes(){let t=new W;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},W= exports.Serializer =class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let i=new DataView(this.buffer,this.offset);t.apply(i,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){gr(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(xe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&$e,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Ot,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}serializeOption(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),t.serialize(this))}serializeOptionStr(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(t))}};_chunkHPZUSDYPjs.a.call(void 0, [Ve(0,bn)],W.prototype,"serializeU8",1),_chunkHPZUSDYPjs.a.call(void 0, [Ve(0,wn)],W.prototype,"serializeU16",1),_chunkHPZUSDYPjs.a.call(void 0, [Ve(0,xe)],W.prototype,"serializeU32",1),_chunkHPZUSDYPjs.a.call(void 0, [Ve(BigInt(0),$e)],W.prototype,"serializeU64",1),_chunkHPZUSDYPjs.a.call(void 0, [Ve(BigInt(0),Ot)],W.prototype,"serializeU128",1),_chunkHPZUSDYPjs.a.call(void 0, [Ve(BigInt(0),Sn)],W.prototype,"serializeU256",1),_chunkHPZUSDYPjs.a.call(void 0, [Ve(0,xe)],W.prototype,"serializeU32AsUleb128",1);function gr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Zs=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function Ge(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Zs(n,t,e))}function Ve(n,t){return(e,r,i)=>{let o=i.value;return i.value=function(a){return Ge(a,n,t),o.apply(this,[a])},i}}var He=class n extends d{constructor(e){super();this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let i=e.deserializeFixedBytes(r);return new n(i)}};var xn=class n extends d{constructor(e){super();this.value=new He(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let i=He.deserialize(e,r);return new n(i.value)}};var _n=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(_n||{}),li= exports.TypeTagVariants =(l=>(l[l.Bool=0]="Bool",l[l.U8=1]="U8",l[l.U64=2]="U64",l[l.U128=3]="U128",l[l.Address=4]="Address",l[l.Signer=5]="Signer",l[l.Vector=6]="Vector",l[l.Struct=7]="Struct",l[l.U16=8]="U16",l[l.U32=9]="U32",l[l.U256=10]="U256",l[l.Reference=254]="Reference",l[l.Generic=255]="Generic",l))(li||{}),Ft= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p))(Ft||{}),gi= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(gi||{}),mi= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(mi||{}),yi= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(yi||{}),fi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(fi||{}),mr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(mr||{}),Ai= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(Ai||{}),yr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(yr||{}),hi= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(hi||{}),fr= exports.EphemeralCertificateVariant =(t=>(t[t.ZkProof=0]="ZkProof",t))(fr||{}),Ar= exports.ZkpVariant =(t=>(t[t.Groth16=0]="Groth16",t))(Ar||{}),hr= exports.TransactionResponseType =(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s.Validator="validator_transaction",s))(hr||{});function uu(n){return n.type==="pending_transaction"}function pu(n){return n.type==="user_transaction"}function du(n){return n.type==="genesis_transaction"}function lu(n){return n.type==="block_metadata_transaction"}function gu(n){return n.type==="state_checkpoint_transaction"}function mu(n){return n.type==="validator_transaction"}function yu(n){return"signature"in n&&n.signature==="ed25519_signature"}function fu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Au(n){return n.type==="multi_agent_signature"}function hu(n){return n.type==="fee_payer_signature"}function Tu(n){return n.type==="multi_ed25519_signature"}var Js=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Js||{}),Ti= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(Ti||{}),ea= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(ea||{}),fe= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(fe||{}),Tr= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Tr||{}),ta= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(ta||{});var E=class n extends d{constructor(e){super();gr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},N= exports.U8 =class n extends d{constructor(e){super();Ge(e,0,bn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},ne= exports.U16 =class n extends d{constructor(e){super();Ge(e,0,wn),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},re= exports.U32 =class n extends d{constructor(e){super();Ge(e,0,xe),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends d{constructor(e){super();Ge(e,BigInt(0),$e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},de= exports.U128 =class n extends d{constructor(e){super();Ge(e,BigInt(0),Ot),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},le= exports.U256 =class n extends d{constructor(e){super();Ge(e,BigInt(0),Sn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var T=class n extends d{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof N)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=g.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(i=>new N(i)))}static U16(e){return new n(e.map(r=>new ne(r)))}static U32(e){return new n(e.map(r=>new re(r)))}static U64(e){return new n(e.map(r=>new O(r)))}static U128(e){return new n(e.map(r=>new de(r)))}static U256(e){return new n(e.map(r=>new le(r)))}static Bool(e){return new n(e.map(r=>new E(r)))}static MoveString(e){return new n(e.map(r=>new b(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1)o.push(r.deserialize(e));return new n(o)}},b= exports.MoveString =class n extends d{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);T.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},ke= exports.MoveOption =class n extends d{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new T([e]):this.vec=new T([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new N(e):void 0)}static U16(e){return new n(e!=null?new ne(e):void 0)}static U32(e){return new n(e!=null?new re(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new de(e):void 0)}static U256(e){return new n(e!=null?new le(e):void 0)}static Bool(e){return new n(e!=null?new E(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,r){let i=T.deserialize(e,r);return new n(i.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ra=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ra||{}),w=class w extends d{constructor(e){super();if(e.length!==w.LENGTH)throw new Q("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(w.LENGTH);return new w(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new Q("Hex string must start with a leading 0x.","leading_zero_x_required");let r=w.fromString(e);if(e.length!==w.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new Q(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new Q(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new Q("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new Q("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let i;try{i=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(o){throw new Q(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new w(i)}static from(e){return e instanceof w?e:e instanceof Uint8Array?new w(e):w.fromString(e)}static fromStrict(e){return e instanceof w?e:e instanceof Uint8Array?new w(e):w.fromStringStrict(e)}static isValid(e){try{return e.strict?w.fromStrict(e.input):w.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,i)=>r===e.data[i])}};w.LENGTH=32,w.LONG_STRING_LENGTH=64,w.ZERO=w.from("0x0"),w.ONE=w.from("0x1"),w.TWO=w.from("0x2"),w.THREE=w.from("0x3"),w.FOUR=w.from("0x4");var u=w;var Ke=class Ke extends d{constructor(e){super();let{data:r}=e,i=g.fromHexInput(r);if(i.toUint8Array().length!==Ke.LENGTH)throw new Error(`Authentication Key length should be ${Ke.LENGTH}`);this.data=i}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Ke.LENGTH);return new Ke({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:r,input:i}=e,o=g.fromHexInput(i).toUint8Array(),s=new Uint8Array([...o,r]),a=_sha3.sha3_256.create();a.update(s);let c=a.digest();return new Ke({data:c})}static fromPublicKeyAndScheme(e){let{publicKey:r}=e;return r.authKey()}static fromPublicKey(e){let{publicKey:r}=e;return r.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};Ke.LENGTH=32;var F=Ke;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var wi = _interopRequireWildcard(_bip39);var aa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,ca= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,ua= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(ua||{}),Si= exports.HARDENED_OFFSET =2147483648;function xi(n){return ca.test(n)}function _i(n){return aa.test(n)}var br=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},vi= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return br(t,s)},pa=n=>n.replace("'",""),Pi= exports.splitPath =n=>n.split("/").slice(1).map(pa),vn= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return wi.mnemonicToSeedSync(t)};var Le=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}},ie= exports.AccountPublicKey =class extends Le{};var K=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}};var dt=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Ci=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16],Qe=class Qe extends ie{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Qe.LENGTH)throw new Error(`PublicKey length should be ${Qe.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof S))return!1;let o=dt(r),s=g.fromHexInput(o).toUint8Array(),a=i.toUint8Array(),c=this.key.toUint8Array();return i.isCanonicalSignature()?_ed25519.ed25519.verify(a,s,c):!1}authKey(){return F.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Qe(r)}static isPublicKey(e){return e instanceof Qe}};Qe.LENGTH=32;var x=Qe,oe=class oe extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==oe.LENGTH)throw new Error(`PrivateKey length should be ${oe.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new oe(e)}static fromDerivationPath(e,r){if(!_i(e))throw new Error(`Invalid derivation path ${e}`);return oe.fromDerivationPathInner(e,vn(r))}static fromDerivationPathInner(e,r,i=Si){let{key:o,chainCode:s}=br(oe.SLIP_0010_SEED,r),a=Pi(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,m)=>vi(p,m+i),{key:o,chainCode:s});return new oe(c)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new x(e)}sign(e){let r=dt(e),i=g.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new S(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new oe(r)}static isPrivateKey(e){return e instanceof oe}};oe.LENGTH=32,oe.SLIP_0010_SEED="ed25519 seed";var $=oe,lt=class lt extends K{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==lt.LENGTH)throw new Error(`Signature length should be ${lt.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new lt(r)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let r=e.length-1;r>=0;r-=1){if(e[r]<Ci[r])return!0;if(e[r]>Ci[r])return!1}return!1}};lt.LENGTH=64;var S=lt;var se=class se extends ie{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>se.MAX_KEYS||r.length<se.MIN_KEYS)throw new Error(`Must have between ${se.MIN_KEYS} and ${se.MAX_KEYS} public keys, inclusive`);if(i<se.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${se.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof We))return!1;let o=[];for(let s=0;s<4;s+=1)for(let a=0;a<8;a+=1)if((i.bitmap[s]&1<<7-a)!==0){let p=s*8+a;o.push(p)}if(o.length!==i.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(o.length<this.threshold)throw new Error("Not enough signatures");for(let s=0;s<o.length;s+=1)if(!this.publicKeys[o[s]].verifySignature({message:r,signature:i.signatures[s]}))return!1;return!0}authKey(){return F.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*x.LENGTH+1);return this.publicKeys.forEach((r,i)=>{e.set(r.toUint8Array(),i*x.LENGTH)}),e[this.publicKeys.length*x.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r[r.length-1],o=[];for(let s=0;s<r.length-1;s+=x.LENGTH){let a=s;o.push(new x(r.subarray(a,a+x.LENGTH)))}return new se({publicKeys:o,threshold:i})}};se.MAX_KEYS=32,se.MIN_KEYS=2,se.MIN_THRESHOLD=1;var gt=se,Y=class Y extends K{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Y.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=Y.createBitmap({bits:i});else{if(i.length!==Y.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Y.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*S.LENGTH+Y.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*S.LENGTH)}),e.set(this.bitmap,this.signatures.length*S.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r.subarray(r.length-4),o=[];for(let s=0;s<r.length-i.length;s+=S.LENGTH){let a=s;o.push(new S(r.subarray(a,a+S.LENGTH)))}return new Y({signatures:o,bitmap:i})}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(a>=Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Y.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");if(c>0&&a<=r[c-1])throw new Error("The bits need to be sorted in ascending order.");s.add(a);let p=Math.floor(a/8),m=o[p];m|=i>>a%8,o[p]=m}),o}};Y.MAX_SIGNATURES_SUPPORTED=32,Y.BITMAP_LEN=4;var We=Y;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var je=class je extends Le{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==je.LENGTH)throw new Error(`PublicKey length should be ${je.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof _e))return!1;let o=dt(r),s=g.fromHexInput(o).toUint8Array(),a=_sha3.sha3_256.call(void 0, s),c=i.toUint8Array();return _secp256k1.secp256k1.verify(c,a,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new je(r)}static isPublicKey(e){return e instanceof je}};je.LENGTH=65;var he=je,Ae=class Ae extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Ae.LENGTH)throw new Error(`PrivateKey length should be ${Ae.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Ae(e)}static fromDerivationPath(e,r){if(!xi(e))throw new Error(`Invalid derivation path ${e}`);return Ae.fromDerivationPathInner(e,vn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new Ae(i)}sign(e){let r=dt(e),i=g.fromHexInput(r),o=_sha3.sha3_256.call(void 0, i.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new _e(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new he(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ae(r)}static isPrivateKey(e){return e instanceof Ae}};Ae.LENGTH=32;var Xe=Ae,mt=class mt extends K{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==mt.LENGTH)throw new Error(`Signature length should be ${mt.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new mt(r)}};mt.LENGTH=64;var _e=mt;var De=class n extends Le{constructor(e){super();let r=e.constructor.name;switch(r){case x.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:i}=e;return this.publicKey.verifySignature({message:r,signature:i})}serialize(e){if(this.publicKey instanceof x)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(x.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}},ae= exports.EphemeralSignature =class n extends K{constructor(e){super();let r=e.constructor.name;switch(r){case S.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=g.fromHexInput(e),i=new te(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof S)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(S.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var wr=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Ui=31,Ea=16,Ii=(Ea-1)*Ui;function En(n,t){let r=new TextEncoder().encode(n);return Ia(r,t)}function Ia(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=Sr(n,t);return qt(e)}function Ua(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=Ga(n,t);return Ra(e)}function Sr(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return Ua(n,t).concat([BigInt(n.length)])}function Ra(n){if(n.length>Ii)throw new Error(`Can't pack more than ${Ii}. Was given ${n.length} bytes`);return za(n,Ui).map(t=>Mt(t))}function za(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Mt(n){let t=BigInt(0);for(let e=n.length-1;e>=0;e-=1)t=t<<BigInt(8)|BigInt(n[e]);return t}function Ri(n,t){let e=new Uint8Array(t);for(let r=0;r<t;r+=1)e[r]=Number(n&BigInt(255)),n>>=BigInt(8);return e}function Ga(n,t){if(t<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let e=new Uint8Array(t);e.set(n);for(let r=n.length;r<t;r+=1)e[r]=0;return e}function qt(n){if(n.length>wr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${wr.length}`);return wr[n.length-1](n)}var In=class extends d{toString(){let t=this.bcsToBytes();return g.fromHexInput(t).toString()}};var $t=1e7,ka= exports.MAX_AUD_VAL_BYTES =120,Ka= exports.MAX_UID_KEY_BYTES =30,Da= exports.MAX_UID_VAL_BYTES =330,Sd= exports.MAX_ISS_VAL_BYTES =120,xd= exports.MAX_EXTRA_FIELD_BYTES =350,_d= exports.MAX_JWT_HEADER_B64_BYTES =300,vd= exports.MAX_COMMITED_EPK_BYTES =93,ve=class ve extends ie{constructor(e,r){super();let i=g.fromHexInput(r).toUint8Array();if(i.length!==ve.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${ve.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new W;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),F.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new ve(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new ve(r,i)}static isPublicKey(e){return e instanceof ve}static create(e){return zi(e),new ve(e.iss,zi(e))}};ve.ID_COMMITMENT_LENGTH=32;var ge=ve;function zi(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Mt(g.fromHexInput(i).toUint8Array()),En(r,ka),En(e,Da),En(t,Ka)];return Ri(qt(o),ge.ID_COMMITMENT_LENGTH)}var Je=class n extends K{constructor(e){super();let{jwtHeader:r,ephemeralCertificate:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.ephemeralCertificate=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let r=Ye.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=De.deserialize(e),a=ae.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:Number(o),ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static load(e){let r=Ye.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=De.deserialize(e),a=ae.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:Number(o),ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new Ye(new Ce({proof:new et(new yt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0)}),0),expiryDateSecs:0,ephemeralPublicKey:new De(new x(new Uint8Array(32))),ephemeralSignature:new ae(new S(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},Ye= exports.EphemeralCertificate =class n extends K{constructor(e,r){super();this.signature=e,this.variant=r}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(Ce.deserialize(e),r);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},Pe=class n extends d{constructor(e){super();if(this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let r=e.deserializeFixedBytes(32);return new n(r)}},Ze=class n extends d{constructor(e){super();if(this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let r=e.deserializeFixedBytes(64);return new n(r)}},yt= exports.Groth16Zkp =class n extends In{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=new Pe(r),this.b=new Ze(i),this.c=new Pe(o)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let r=Pe.deserialize(e).bcsToBytes(),i=Ze.deserialize(e).bcsToBytes(),o=Pe.deserialize(e).bcsToBytes();return new n({a:r,b:i,c:o})}},et= exports.ZkProof =class n extends d{constructor(e,r){super();this.proof=e,this.variant=r}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(yt.deserialize(e),r);default:throw new Error(`Unknown variant index for ZkProof: ${r}`)}}},Ce= exports.ZeroKnowledgeSig =class n extends K{constructor(e){super();let{proof:r,expHorizonSecs:i=BigInt($t),trainingWheelsSignature:o,extraField:s,overrideAudVal:a}=e;this.proof=r,this.expHorizonSecs=i,this.trainingWheelsSignature=o,this.extraField=s,this.overrideAudVal=a}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new te(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let r=et.deserialize(e),i=e.deserializeU64(),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(ae);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}static load(e){let r=et.deserialize(e),i=e.deserializeU64(),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(ae);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}},Un= exports.KeylessConfiguration =class n{constructor(t,e){this.verficationKey=t,this.maxExpHorizonSecs=e}static create(t,e){return new n(new xr({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2}),e)}},xr=class n{constructor(t){let{alphaG1:e,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=t;this.alphaG1=new Pe(e),this.betaG2=new Ze(r),this.deltaG2=new Ze(i),this.gammaAbcG1=[new Pe(o[0]),new Pe(o[1])],this.gammaG2=new Ze(s)}static fromGroth16VerificationKeyResponse(t){return new n({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2})}};var k=class n extends ie{constructor(e){super();if(this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof he)this.variant=1;else if(e instanceof ge)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof D?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return F.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=x.deserialize(e);break;case 1:i=he.deserialize(e);break;case 3:i=ge.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new n(i)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof x}isSecp256k1PublicKey(){return this.publicKey instanceof he}},D= exports.AnySignature =class n extends K{constructor(e){super();if(this.signature=e,e instanceof S)this.variant=0;else if(e instanceof _e)this.variant=1;else if(e instanceof Je)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=S.deserialize(e);break;case 1:i=_e.deserialize(e);break;case 3:i=Je.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(i)}};function Ba(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var ft=class n extends ie{constructor(e){super();let{publicKeys:r,signaturesRequired:i}=e;if(i<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<i)throw new Error(`Provided ${r.length} public keys is smaller than the ${i} required signatures`);this.publicKeys=r.map(o=>o instanceof k?o:new k(o)),this.signaturesRequired=i}verifySignature(e){throw new Error("not implemented")}authKey(){return F.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(k),i=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:i})}createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let p=Math.floor(a/8),m=o[p];m|=i>>a%8,o[p]=m}),o}getIndex(e){let r=e instanceof k?e:new k(e),i=this.publicKeys.findIndex(o=>o.toString()===r.toString());if(i!==-1)return i;throw new Error("Public key not found in MultiKey")}},Z=class Z extends K{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>Z.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Z.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(s=>s instanceof D?s:new D(s)),!(i instanceof Uint8Array))this.bitmap=Z.createBitmap({bits:i});else{if(i.length!==Z.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Z.BITMAP_LEN}`);this.bitmap=i}let o=this.bitmap.reduce((s,a)=>s+Ba(a),0);if(o!==this.signatures.length)throw new Error(`Expecting ${o} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=Z.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Z.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),p=o[c];p|=i>>a%8,o[c]=p}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(D),i=e.deserializeBytes();return new Z({signatures:r,bitmap:i})}};Z.BITMAP_LEN=4,Z.MAX_SIGNATURES_SUPPORTED=Z.BITMAP_LEN*8;var tt=Z;var V=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return me.load(t);case 1:return Rn.load(t);case 2:return H.load(t);case 3:return nt.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof me}isMultiEd25519(){return this instanceof Rn}isSingleKey(){return this instanceof H}isMultiKey(){return this instanceof nt}},me= exports.AccountAuthenticatorEd25519 =class n extends V{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=x.deserialize(e),i=S.deserialize(e);return new n(r,i)}},Rn= exports.AccountAuthenticatorMultiEd25519 =class n extends V{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=gt.deserialize(e),i=We.deserialize(e);return new n(r,i)}},H= exports.AccountAuthenticatorSingleKey =class n extends V{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=k.deserialize(e),i=D.deserialize(e);return new n(r,i)}},nt= exports.AccountAuthenticatorMultiKey =class n extends V{constructor(e,r){super();this.public_keys=e,this.signatures=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let r=ft.deserialize(e),i=tt.deserialize(e);return new n(r,i)}};var Vt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Vt||{}),Gi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,ki= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,zn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Gn= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Ki= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",_r= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",rt= exports.ProcessorType =(a=>(a.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",a.DEFAULT="default_processor",a.EVENTS_PROCESSOR="events_processor",a.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",a.STAKE_PROCESSOR="stake_processor",a.TOKEN_V2_PROCESSOR="token_v2_processor",a.USER_TRANSACTION_PROCESSOR="user_transaction_processor",a))(rt||{});var At=class n extends d{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var R=class n extends d{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var Ht=class n extends d{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(r[0]),new R(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e);return new n(r,i)}};var z=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return M.load(t);case 1:return Te.load(t);case 2:return j.load(t);case 3:return bt.load(t);case 4:return J.load(t);case 5:return St.load(t);case 6:return v.load(t);case 7:return y.load(t);case 8:return ht.load(t);case 9:return Tt.load(t);case 10:return wt.load(t);case 255:return G.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof M}isAddress(){return this instanceof J}isGeneric(){return this instanceof G}isSigner(){return this instanceof St}isVector(){return this instanceof v}isStruct(){return this instanceof y}isU8(){return this instanceof Te}isU16(){return this instanceof ht}isU32(){return this instanceof Tt}isU64(){return this instanceof j}isU128(){return this instanceof bt}isU256(){return this instanceof wt}},M= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Te= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},ht= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Tt= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},j= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},bt= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},wt= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},J= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},St= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},kn= exports.TypeTagReference =class n extends z{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=z.deserialize(e);return new n(r)}},G= exports.TypeTagGeneric =class n extends z{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},v= exports.TypeTagVector =class n extends z{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new Te)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=z.deserialize(e);return new n(r)}},y= exports.TypeTagStruct =class n extends z{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Ee.deserialize(e);return new n(r)}isTypeTag(e,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Ee= exports.StructTag =class n extends d{constructor(e,r,i,o){super();this.address=e,this.moduleName=r,this.name=i,this.typeArgs=o}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e),o=R.deserialize(e),s=e.deserializeVector(z);return new n(r,i,o,s)}};function Kl(){return new Ee(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function _(){return new Ee(u.ONE,new R("string"),new R("String"),[])}function Dl(n){return new Ee(u.ONE,new R("option"),new R("Option"),[n])}function ee(n){return new Ee(u.ONE,new R("object"),new R("Object"),[n])}function Na(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return N.deserialize(n);case 1:return O.deserialize(n);case 2:return de.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,N);case 5:return E.deserialize(n);case 6:return ne.deserialize(n);case 7:return re.deserialize(n);case 8:return le.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var it=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Lt.load(t);case 2:return Qt.load(t);case 3:return Wt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Lt= exports.TransactionPayloadScript =class n extends it{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=jt.deserialize(e);return new n(r)}},Qt= exports.TransactionPayloadEntryFunction =class n extends it{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=ot.deserialize(e);return new n(r)}},Wt= exports.TransactionPayloadMultiSig =class n extends it{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Xt.deserialize(e);return new n(r)}},ot= exports.EntryFunction =class n{constructor(t,e,r,i){this.module_name=t,this.function_name=e,this.type_args=r,this.args=i}static build(t,e,r,i){return new n(Ht.fromStr(t),new R(e),r,i)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Ht.deserialize(t),r=R.deserialize(t),i=t.deserializeVector(z),o=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=t.deserializeUleb128AsU32(),p=xn.deserialize(t,c);s.push(p)}return new n(e,r,i,s)}},jt= exports.Script =class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(z),i=t.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Na(t);o.push(a)}return new n(e,r,o)}},Xt= exports.MultiSig =class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=u.deserialize(t),r=t.deserializeBool(),i;return r&&(i=Yt.deserialize(t)),new n(e,i)}},Yt= exports.MultiSigTransactionPayload =class n extends d{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(ot.deserialize(e))}};var ce=class n extends d{constructor(e,r,i,o,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=i,this.max_gas_amount=o,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=e.deserializeU64(),o=it.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=At.deserialize(e);return new n(r,i,o,s,a,c,p)}},Kn= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return st.load(t);case 1:return at.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},st= exports.MultiAgentRawTransaction =class n extends Kn{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=ce.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},at= exports.FeePayerRawTransaction =class n extends Kn{constructor(e,r,i){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=i}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=ce.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Dn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new O(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=T.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)}};var Ie=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return xt.load(t);case 1:return vr.load(t);case 2:return _t.load(t);case 3:return vt.load(t);case 4:return Pt.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},xt= exports.TransactionAuthenticatorEd25519 =class n extends Ie{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=x.deserialize(e),i=S.deserialize(e);return new n(r,i)}},vr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Ie{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=gt.deserialize(e),i=We.deserialize(e);return new n(r,i)}},_t= exports.TransactionAuthenticatorMultiAgent =class n extends Ie{constructor(e,r,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=V.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(V);return new n(r,i,o)}},vt= exports.TransactionAuthenticatorFeePayer =class n extends Ie{constructor(e,r,i,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i,this.fee_payer=o}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=V.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(V),s=u.deserialize(e),a=V.deserialize(e),c={address:s,authenticator:a};return new n(r,i,o,c)}},Pt= exports.TransactionAuthenticatorSingleSender =class n extends Ie{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=V.deserialize(e);return new n(r)}};var ct=class n extends d{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=ce.deserialize(e),i=Ie.deserialize(e);return new n(r,i)}};var Bn=class n extends d{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=ce.deserialize(e),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(r,o)}};var Nn=class n extends d{constructor(e,r,i){super();this.rawTransaction=e,this.feePayerAddress=i,this.secondarySignerAddresses=r}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=ce.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Pr(n){return n.feePayerAddress?new at(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new st(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Zt(n,t){let e=_sha3.sha3_256.create();if(!t.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${t}`);e.update(t);let r=e.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Ct(n){let t=Pr(n);return n.feePayerAddress?Zt(t.bcsToBytes(),_r):n.secondarySignerAddresses?Zt(t.bcsToBytes(),_r):Zt(t.bcsToBytes(),Ki)}var Et=class n{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=$.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,i=$.fromDerivationPath(e,r);return new n({privateKey:i})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new me(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new me(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(Ct(t))}};var It=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new k(e.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(t={}){let{scheme:e=0}=t,r;switch(e){case 0:r=$.generate();break;case 2:r=Xe.generate();break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:r})}static fromDerivationPath(t){let{scheme:e=0,path:r,mnemonic:i}=t,o;switch(e){case 0:o=$.fromDerivationPath(r,i);break;case 2:o=Xe.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:o})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new H(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new H(this.publicKey,this.signTransaction(t))}sign(t){return new D(this.privateKey.sign(t))}signTransaction(t){return this.sign(Ct(t))}};var Be=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?Et.generate():It.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:i=!0}=t;return e instanceof $&&i?new Et({privateKey:e,address:r}):new It({privateKey:e,address:r})}static fromPrivateKeyAndAddress(t){return this.fromPrivateKey(t)}static fromDerivationPath(t){let{scheme:e=0,mnemonic:r,path:i,legacy:o=!0}=t;return e===0&&o?Et.fromDerivationPath({mnemonic:r,path:i}):It.fromDerivationPath({scheme:e,mnemonic:r,path:i})}static authKey(t){let{publicKey:e}=t;return e.authKey()}verifySignature(t){return this.publicKey.verifySignature(t)}};var Ut=class Ut extends d{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new De(r.publicKey()),this.expiryDateSecs=i||_chunkHPZUSDYPjs.d.call(void 0, _chunkHPZUSDYPjs.c.call(void 0, )+$t),this.blinder=o!==void 0?g.fromHexInput(o).toUint8Array():Ma(),this.nonce=this.generateNonce()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=$.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let o=e.deserializeU64(),s=e.deserializeFixedBytes(31);return new Ut({privateKey:i,expiryDateSecs:Number(o),blinder:s})}static fromBytes(e){return Ut.deserialize(new te(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _8 => _8.scheme])){case 0:default:r=$.generate()}return new Ut({privateKey:r,expiryDateSecs:_optionalChain([e, 'optionalAccess', _9 => _9.expiryDateSecs])})}generateNonce(){let e=Sr(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(Mt(this.blinder)),qt(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new ae(this.privateKey.sign(e))}};Ut.BLINDER_LENGTH=31;var Jt=Ut;function Ma(){return _utils.randomBytes.call(void 0, Jt.BLINDER_LENGTH)}var _jwtdecode = require('jwt-decode');var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var On=class extends d{hash(){return Zt(this.bcsToBytes(),this.domainSeparator)}};var ty={"https://accounts.google.com":"https://www.googleapis.com/oauth2/v3/certs"},Ne=class Ne extends d{constructor(e){super();let{address:r,ephemeralKeyPair:i,uidKey:o,uidVal:s,aud:a,pepper:c,proofOrFetcher:p,proofFetchCallback:m,jwt:P}=e;if(this.ephemeralKeyPair=i,this.publicKey=ge.create(e),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=P,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof Ce)this.proof=p;else{if(m===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async l=>{await m(l),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let U=g.fromHexInput(c).toUint8Array();if(U.length!==Ne.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Ne.PEPPER_LENGTH}`);this.pepper=U,this.isJwtValid=!0}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeFixedBytes(31),s=Jt.deserialize(e),a=Ce.deserialize(e);return Ne.fromJWTAndProof({proof:a,pepper:o,uidKey:i,jwt:r,ephemeralKeyPair:s})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let r=new D(this.sign(e)),i=new k(this.publicKey);return new H(i,r)}signTransactionWithAuthenticator(e){let r=new D(this.signTransaction(e)),i=new k(this.publicKey);return new H(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new Je({jwtHeader:_chunkHPZUSDYPjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Ye(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=Pr(e),o=new Cr(r,this.proof.proof).hash();return this.sign(o)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return Ne.deserialize(new te(e))}static fromJWTAndProof(e){let{proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,proofFetchCallback:a}=e,c=_nullishCoalesce(e.uidKey, () => ("sub")),p=_jwtdecode.jwtDecode.call(void 0, i),m=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let P=p.aud,U=p[c];return new Ne({proofOrFetcher:r,ephemeralKeyPair:o,iss:m,uidKey:c,uidVal:U,aud:P,pepper:s,jwt:i,proofFetchCallback:a})}};Ne.PEPPER_LENGTH=31;var be=Ne,Cr= exports.TransactionAndProof =class extends On{constructor(e,r){super();this.transaction=e,this.proof=r,this.domainSeparator="APTOS::TransactionAndProof"}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}};var Fn=class n{constructor(t){let{multiKey:e,signers:r}=t;this.publicKey=e,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let i=[];for(let s of r)i.push(this.publicKey.getIndex(s.publicKey));let o=r.map((s,a)=>[s,i[a]]);o.sort((s,a)=>s[1]-a[1]),this.signers=o.map(s=>s[0]),this.signerIndicies=o.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:i})}static fromPublicKeysAndSigners(t){let{publicKeys:e,signaturesRequired:r,signers:i}=t,o=new ft({publicKeys:e,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(t){return t instanceof n}signWithAuthenticator(t){return new nt(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new nt(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof be);await Promise.all(t.filter(e=>e.proof instanceof Promise).map(e=>e.proof))}sign(t){let e=[];for(let r of this.signers)e.push(r.sign(t));return new tt({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new tt({signatures:e,bitmap:this.signaturesBitmap})}verifySignature(t){let{message:e,signature:r}=t;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:e,signature:s}))return!1}return!0}};var ye=class extends Error{constructor(e,r,i){super(i);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var Di="1.16.0-zeta.2";var Bi={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Ni= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Oi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},Er= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},Ir= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://prover.keyless.devnet.aptoslabs.com/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Ur= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Ur||{}),Rr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Ty= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function Fi(n,t){let e=t.bcsToBytes(),r=new te(e);return n.deserialize(r)}var Mi={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Va(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _10 => _10.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Di}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _11 => _11.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _12 => _12.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _13 => _13.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _14 => _14.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function Mn(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Va({...n,url:o},t.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new ye(n,a,`Error: ${a.data}`);if(e==="Indexer"){let p=a.data;if(p.errors)throw new ye(n,a,_nullishCoalesce(`Indexer error: ${p.errors[0].message}`, () => (`Indexer unhandled Error ${s.status} : ${s.statusText}`)));a.data=p.data}else if((e==="Pepper"||e==="Prover")&&a.status>=500)throw new ye(n,a,`${s.data}`);if(a.status>=200&&a.status<300)return a;let c;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?c=JSON.stringify(a.data):a.status in Mi?c=Mi[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ye(n,a,`${e} error: ${c}`)}async function zr(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Mn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function q(n){let{aptosConfig:t}=n;return zr({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _15 => _15.clientConfig, 'optionalAccess', _16 => _16.HEADERS]),..._optionalChain([t, 'access', _17 => _17.fullnodeConfig, 'optionalAccess', _18 => _18.HEADERS])}}})}async function My(n){return zr({...n,type:"Pepper"})}async function Rt(n){let t=[],e,r=n.params;do{let i=await zr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=i.headers["x-aptos-cursor"],delete i.headers,t.push(...i.data),r.start=e}while(e!=null);return t}async function en(n){let{type:t,originMethod:e,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,m=c.getRequestUrl(t);return Mn({url:m,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function ut(n){let{aptosConfig:t}=n;return en({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _19 => _19.clientConfig, 'optionalAccess', _20 => _20.HEADERS]),..._optionalChain([t, 'access', _21 => _21.fullnodeConfig, 'optionalAccess', _22 => _22.HEADERS])}}})}async function qi(n){let{aptosConfig:t}=n;return en({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _23 => _23.clientConfig, 'optionalAccess', _24 => _24.HEADERS]),..._optionalChain([t, 'access', _25 => _25.indexerConfig, 'optionalAccess', _26 => _26.HEADERS])}}})}async function $i(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _27 => _27.clientConfig, 'optionalAccess', _28 => delete _28.API_KEY]),en({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _29 => _29.clientConfig, 'optionalAccess', _30 => _30.HEADERS]),..._optionalChain([e, 'access', _31 => _31.faucetConfig, 'optionalAccess', _32 => _32.HEADERS])}}})}async function Vi(n){return en({...n,type:"Pepper"})}async function Hi(n){return en({...n,type:"Prover"})}var Ha=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -16,7 +16,7 @@
16
16
  transaction_version
17
17
  type
18
18
  }
19
- `,Va=`
19
+ `,La=`
20
20
  fragment AnsTokenFragment on current_aptos_names {
21
21
  domain
22
22
  expiration_timestamp
@@ -26,7 +26,7 @@
26
26
  is_primary
27
27
  owner_address
28
28
  }
29
- `,Fn=`
29
+ `,qn=`
30
30
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
31
31
  token_standard
32
32
  token_properties_mutated_v1
@@ -83,7 +83,7 @@
83
83
  }
84
84
  }
85
85
  }
86
- `,Hi=`
86
+ `,Qi=`
87
87
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
88
88
  current_fungible_asset_balances(
89
89
  where: $where_condition
@@ -116,7 +116,7 @@
116
116
  }
117
117
  }
118
118
  }
119
- `,Vi=`
119
+ `,Wi=`
120
120
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
121
121
  current_collection_ownership_v2_view(
122
122
  where: $where_condition
@@ -150,7 +150,7 @@
150
150
  single_token_uri
151
151
  }
152
152
  }
153
- `,Qi=`
153
+ `,ji=`
154
154
  query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
155
155
  current_objects(
156
156
  where: $where_condition
@@ -167,7 +167,7 @@
167
167
  is_deleted
168
168
  }
169
169
  }
170
- `,Wi=`
170
+ `,Xi=`
171
171
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
172
172
  current_token_ownerships_v2(
173
173
  where: $where_condition
@@ -178,7 +178,7 @@
178
178
  ...CurrentTokenOwnershipFields
179
179
  }
180
180
  }
181
- ${Fn}`,Wy=`
181
+ ${qn}`,Yy=`
182
182
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
183
183
  current_token_ownerships_v2(
184
184
  where: $where_condition
@@ -189,7 +189,7 @@
189
189
  ...CurrentTokenOwnershipFields
190
190
  }
191
191
  }
192
- ${Fn}`,ji=`
192
+ ${qn}`,Yi=`
193
193
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
194
194
  current_token_ownerships_v2(
195
195
  where: $where_condition
@@ -200,7 +200,7 @@
200
200
  ...CurrentTokenOwnershipFields
201
201
  }
202
202
  }
203
- ${Fn}`,Xi=`
203
+ ${qn}`,Zi=`
204
204
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
205
205
  current_token_ownerships_v2_aggregate(
206
206
  where: $where_condition
@@ -212,7 +212,7 @@
212
212
  }
213
213
  }
214
214
  }
215
- `,Yi=`
215
+ `,Ji=`
216
216
  query getAccountTransactionsCount($address: String) {
217
217
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
218
218
  aggregate {
@@ -220,13 +220,13 @@
220
220
  }
221
221
  }
222
222
  }
223
- `,Zi=`
223
+ `,eo=`
224
224
  query getChainTopUserTransactions($limit: Int) {
225
225
  user_transactions(limit: $limit, order_by: {version: desc}) {
226
226
  version
227
227
  }
228
228
  }
229
- `,Ir=`
229
+ `,Gr=`
230
230
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
231
231
  current_collections_v2(where: $where_condition) {
232
232
  collection_id
@@ -245,7 +245,7 @@
245
245
  uri
246
246
  }
247
247
  }
248
- `,Ji=`
248
+ `,to=`
249
249
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
250
250
  current_fungible_asset_balances(
251
251
  where: $where_condition
@@ -263,7 +263,7 @@
263
263
  token_standard
264
264
  }
265
265
  }
266
- `,eo=`
266
+ `,no=`
267
267
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
268
268
  delegated_staking_activities(
269
269
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -276,7 +276,7 @@
276
276
  transaction_version
277
277
  }
278
278
  }
279
- `,to=`
279
+ `,ro=`
280
280
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
281
281
  events(
282
282
  where: $where_condition
@@ -295,7 +295,7 @@
295
295
  indexed_type
296
296
  }
297
297
  }
298
- `,no=`
298
+ `,io=`
299
299
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
300
300
  fungible_asset_activities(
301
301
  where: $where_condition
@@ -320,7 +320,7 @@
320
320
  type
321
321
  }
322
322
  }
323
- `,ro=`
323
+ `,oo=`
324
324
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
325
325
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
326
326
  icon_uri
@@ -337,7 +337,7 @@
337
337
  token_standard
338
338
  }
339
339
  }
340
- `,Et=`
340
+ `,zt=`
341
341
  query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
342
342
  current_aptos_names(
343
343
  limit: $limit
@@ -348,14 +348,14 @@
348
348
  ...AnsTokenFragment
349
349
  }
350
350
  }
351
- ${Va}`,Ur=`
351
+ ${La}`,kr=`
352
352
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
353
353
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
354
354
  num_active_delegator
355
355
  pool_address
356
356
  }
357
357
  }
358
- `,Rr=`
358
+ `,Kr=`
359
359
  query getProcessorStatus($where_condition: processor_status_bool_exp) {
360
360
  processor_status(where: $where_condition) {
361
361
  last_success_version
@@ -363,7 +363,7 @@
363
363
  last_updated
364
364
  }
365
365
  }
366
- `,io=`
366
+ `,so=`
367
367
  query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
368
368
  table_items(
369
369
  where: $where_condition
@@ -379,7 +379,7 @@
379
379
  write_set_change_index
380
380
  }
381
381
  }
382
- `,oo=`
382
+ `,ao=`
383
383
  query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
384
384
  table_metadatas(
385
385
  where: $where_condition
@@ -392,7 +392,7 @@
392
392
  value_type
393
393
  }
394
394
  }
395
- `,so=`
395
+ `,co=`
396
396
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
397
397
  token_activities_v2(
398
398
  where: $where_condition
@@ -403,7 +403,7 @@
403
403
  ...TokenActivitiesFields
404
404
  }
405
405
  }
406
- ${Ha}`,zr=`
406
+ ${Ha}`,Dr=`
407
407
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
408
408
  current_token_ownerships_v2(
409
409
  where: $where_condition
@@ -414,7 +414,7 @@
414
414
  ...CurrentTokenOwnershipFields
415
415
  }
416
416
  }
417
- ${Fn}`,ao=`
417
+ ${qn}`,uo=`
418
418
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
419
419
  current_token_datas_v2(
420
420
  where: $where_condition
@@ -454,5 +454,5 @@
454
454
  }
455
455
  }
456
456
  }
457
- `;async function Mn(n){let{aptosConfig:t}=n,{data:e}=await ee({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function co(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await ee({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _33 => _33.withTransactions])}});return i}async function uo(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await ee({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _34 => _34.withTransactions])}});return i}async function po(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:Zi,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await Fi({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function Qa(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:Rr},originMethod:"getProcessorStatuses"})).processor_status}async function qn(n){let t=await Qa({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function $n(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:Rr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var Dr=new Map;function It(n,t,e){return async(...r)=>{if(Dr.has(t)){let{value:o,timestamp:s}=Dr.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return Dr.set(t,{value:i,timestamp:Date.now()}),i}}async function Ln(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await it({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _35 => _35.ledgerVersion])},body:r})).data}async function lo(n){let{aptosConfig:t,options:e}=n,r={query:io,variables:{where_condition:_optionalChain([e, 'optionalAccess', _36 => _36.where]),offset:_optionalChain([e, 'optionalAccess', _37 => _37.offset]),limit:_optionalChain([e, 'optionalAccess', _38 => _38.limit]),order_by:_optionalChain([e, 'optionalAccess', _39 => _39.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsData"})).table_items}async function go(n){let{aptosConfig:t,options:e}=n,r={query:oo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _40 => _40.where]),offset:_optionalChain([e, 'optionalAccess', _41 => _41.offset]),limit:_optionalChain([e, 'optionalAccess', _42 => _42.limit]),order_by:_optionalChain([e, 'optionalAccess', _43 => _43.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function we(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await ee({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function fo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ct({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _44 => _44.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _45 => _45.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _46 => _46.limit]), () => (1e3))}})}async function Hn(n){return _optionalChain([n, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.ledgerVersion])!==void 0?mo(n):It(async()=>mo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function mo(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await ee({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _49 => _49.ledgerVersion])}});return o}async function Ao(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ct({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _50 => _50.offset]),limit:_optionalChain([r, 'optionalAccess', _51 => _51.limit])}})}async function ho(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ct({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _52 => _52.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _53 => _53.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _54 => _54.limit]), () => (999))}})}async function kr(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await ee({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _55 => _55.ledgerVersion])}});return o.data}async function Kr(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await kr({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Ln({aptosConfig:t,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ce&&a.data.error_code==="table_item_not_found")return s;throw a}}async function To(n){let{aptosConfig:t,accountAddress:e}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:t,query:{query:Xi,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function bo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])});let s={query:Wi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function wo(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:i}=n,o=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _61 => _61.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _62 => _62.tokenStandard])});let c={query:ji,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([i, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([i, 'optionalAccess', _65 => _65.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function So(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _66 => _66.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _67 => _67.tokenStandard])}});let s={query:Vi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([r, 'optionalAccess', _69 => _69.limit]),order_by:_optionalChain([r, 'optionalAccess', _70 => _70.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function xo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Yi,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function _o(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,i=u.from(e).toStringLong(),o=await Nr({aptosConfig:t,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Nr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _71 => _71.where]),owner_address:{_eq:i}},s={query:Hi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_optionalChain([r, 'optionalAccess', _73 => _73.limit]),order_by:_optionalChain([r, 'optionalAccess', _74 => _74.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function vo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Li,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function Po(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:Qi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _75 => _75.offset]),limit:_optionalChain([r, 'optionalAccess', _76 => _76.limit]),order_by:_optionalChain([r, 'optionalAccess', _77 => _77.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Co(n){let{aptosConfig:t,privateKey:e}=n,r=new k(e.publicKey());if(e instanceof Qe){let o=F.fromPublicKey({publicKey:r}).derivedAddress();return Ke.fromPrivateKey({privateKey:e,address:o})}if(e instanceof q){let i=F.fromPublicKey({publicKey:r});if(await yo({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Ke.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=F.fromPublicKey({publicKey:r.publicKey});if(await yo({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return Ke.fromPrivateKey({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function yo(n){let{aptosConfig:t,authKey:e}=n,r=await Kr({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await we({aptosConfig:t,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Eo(n){let{aptosConfig:t,options:e}=n;return Ct({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([e, 'optionalAccess', _79 => _79.limit])}})}async function Qn(n){let{aptosConfig:t}=n;return It(async()=>{let{data:e}=await ee({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function Io(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await ee({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Jt(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await ee({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function Uo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Jt({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _80 => _80.status])===404)return!0;throw r}}async function Wa(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await ee({aptosConfig:t,path:`transactions/wait_by_hash/${e}`,originMethod:"longWaitForTransaction"});return r}async function Ut(n){let{aptosConfig:t,transactionHash:e,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.checkSuccess]), () => (!0)),s=!0,a=0,c,p,m=200,_=1.5;function U(g){if(!(g instanceof ce)||(p=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await Jt({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(g){U(g)}if(s){let g=Date.now();try{c=await Wa({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(C){U(C)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await Jt({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(g){U(g)}await _chunkVLEH6QBRjs.b.call(void 0, m),a+=m/1e3,m*=_}if(c===void 0)throw p||new Vn(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Vn(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Br(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function Wn(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?s=await qn({aptosConfig:t}):s=(await $n({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkVLEH6QBRjs.b.call(void 0, 200)}}var Vn=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Br=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function A(n){n.minimumLedgerVersion!==void 0&&await Wn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var en=class{constructor(t){this.config=t}async getAccountInfo(t){return we({aptosConfig:this.config,...t})}async getAccountModules(t){return fo({aptosConfig:this.config,...t})}async getAccountModule(t){return Hn({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Ao({aptosConfig:this.config,...t})}async getAccountResources(t){return ho({aptosConfig:this.config,...t})}async getAccountResource(t){return kr({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Kr({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),To({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),bo({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),wo({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),So({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),xo({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Nr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),vo({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Un,...t})}async getAccountCoinAmount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),_o({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),Po({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Co({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var jn=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _83 => _83.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _84 => _84.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _85 => _85.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _86 => _86.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _87 => _87.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _88 => _88.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _89 => _89.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _90 => _90.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _91 => _91.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _92 => _92.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _93 => _93.faucetConfig]), () => ({}))}getRequestUrl(t){switch(t){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Ni[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Bi[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Ki[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return _r[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return vr[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return _r[this.network]===t}isProverServiceRequest(t){return vr[this.network]===t}};function Ro(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function zo(n){return!!n.match(/\s/)}function Xa(n){return!!n.match(/^T[0-9]+$/)}function Ya(n){return!!n.match(/^&.+$/)}function Za(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function Ja(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!zo(r))break}return e}var ec=(C=>(C.InvalidTypeTag="unknown type",C.UnexpectedGenericType="unexpected generic type",C.UnexpectedTypeArgumentClose="unexpected '>'",C.UnexpectedWhitespaceCharacter="unexpected whitespace character",C.UnexpectedComma="unexpected ','",C.TypeArgumentCountMismatch="type argument count doesn't match expected amount",C.MissingTypeArgumentClose="no matching '>' for '<'",C.MissingTypeArgument="no type argument before ','",C.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",C.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",C.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",C.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",C.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",C.InvalidAddress="struct address must be valid",C))(ec||{}),B= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Ee(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _94 => _94.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let C=tn(a,i,e);o.push(C)}let m=r.pop();if(m===void 0)throw new B(n,"unexpected '>'");if(c!==o.length)throw new B(n,"type argument count doesn't match expected amount");let{savedStr:_,savedTypes:U,savedExpectedTypes:g}=m;i=o,o=U,a=_,c=g}else if(p===","){if(r.length===0)throw new B(n,"unexpected ','");if(a.length===0)throw new B(n,"no type argument before ','");let m=tn(a,i,e);i=[],o.push(m),a="",c+=1}else if(zo(p)){let m=!1;if(a.length!==0){let U=tn(a,i,e);i=[],o.push(U),a="",m=!0}s=Ja(n,s);let _=n[s];if(s<n.length&&m&&_!==","&&_!==">")throw new B(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new B(n,"no matching '>' for '<'");switch(o.length){case 0:return tn(a,i,e);case 1:if(a==="")return o[0];throw new B(n,"unexpected ','");default:throw new B(n,"unexpected whitespace character")}}function tn(n,t,e){let r=n.trim(),i=r.toLowerCase();if(Za(i)&&t.length>0)throw new B(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new ht;case"bool":return new M;case"address":return new Z;case"u8":return new Te;case"u16":return new mt;case"u32":return new yt;case"u64":return new W;case"u128":return new ft;case"u256":return new At;case"vector":if(t.length!==1)throw new B(n,"vector type expected to have exactly one type argument");return new P(t[0]);default:if(Ya(r)){let a=r.substring(1);return new Rn(tn(a,t,e))}if(Xa(r)){if(e)return new D(Number(r.split("T")[1]));throw new B(n,"unexpected generic type")}if(!r.match(/:/))throw new B(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new B(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e3){throw new B(n,"struct address must be valid")}if(!Ro(o[1]))throw new B(n,"module name must only contain alphanumeric or '_' characters");if(!Ro(o[2]))throw new B(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Pe(s,new R(o[1]),new R(o[2]),t))}}function Do(n){return typeof n=="boolean"}function Se(n){return typeof n=="string"}function Xn(n){return typeof n=="number"}function Yn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ko(n){return n==null}function Ko(n){return Or(n)||Fr(n)||Mr(n)||qr(n)||$r(n)||Lr(n)||Hr(n)||Zn(n)||Gr(n)||tc(n)||n instanceof T||n instanceof ze}function Or(n){return n instanceof E}function Zn(n){return n instanceof u}function Gr(n){return n instanceof b}function tc(n){return n instanceof qe}function Fr(n){return n instanceof O}function Mr(n){return n instanceof ne}function qr(n){return n instanceof re}function $r(n){return n instanceof G}function Lr(n){return n instanceof de}function Hr(n){return n instanceof le}function No(n){return"bytecode"in n}function I(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Bo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function nn(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],i=t[2];return{moduleAddress:e,moduleName:r,functionName:i}}var nc=new TextEncoder;function Jn(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _95 => _95.map, 'call', _96 => _96(t=>Se(t)?Ee(t):t)]), () => ([]))}async function Oo(n,t,e,r){let i=await Hn({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function Go(n,t,e,r){let i=await Oo(n,t,e,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let o=Bo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ee(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Fo(n,t,e,r){let i=await Oo(n,t,e,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${t}::${e}'`);if(!i.is_view)throw new Error(`'${n}::${t}::${e}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Ee(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ee(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Qr(n,t,e,r,i){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let o=t.parameters[r];return Rt(e,o,r,i)}function Rt(n,t,e,r){return Ko(n)?(Vr(t,n,e),n):rc(n,t,e,r)}function rc(n,t,e,r){if(t.isBool()){if(Do(n))return new E(n);if(Se(n)){if(n==="true")return new E(!0);if(n==="false")return new E(!1)}I("boolean",e)}if(t.isAddress()){if(Se(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isU8()){if(Xn(n))return new O(n);if(Se(n))return new O(Number.parseInt(n,10));I("number",e)}if(t.isU16()){if(Xn(n))return new ne(n);if(Se(n))return new ne(Number.parseInt(n,10));I("number",e)}if(t.isU32()){if(Xn(n))return new re(n);if(Se(n))return new re(Number.parseInt(n,10));I("number",e)}if(t.isU64()){if(Yn(n))return new G(BigInt(n));I("bigint | number | string",e)}if(t.isU128()){if(Yn(n))return new de(BigInt(n));I("bigint | number | string",e)}if(t.isU256()){if(Yn(n))return new le(BigInt(n));I("bigint | number | string",e)}if(t.isGeneric()){let i=t.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return Rt(n,r[i],e,r)}if(t.isVector()){if(t.value.isU8()){if(Se(n))return T.U8(nc.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(i=>Rt(i,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(Se(n))return new b(n);I("string",e)}if(t.isObject()){if(Se(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isOption())return ko(n)?new ze(null):new ze(Rt(n,t.value.typeArgs[0],e,r));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function Vr(n,t,e){if(n.isBool()){if(Or(t))return;I("Bool",e)}if(n.isAddress()){if(Zn(t))return;I("AccountAddress",e)}if(n.isU8()){if(Fr(t))return;I("U8",e)}if(n.isU16()){if(Mr(t))return;I("U16",e)}if(n.isU32()){if(qr(t))return;I("U32",e)}if(n.isU64()){if($r(t))return;I("U64",e)}if(n.isU128()){if(Lr(t))return;I("U128",e)}if(n.isU256()){if(Hr(t))return;I("U256",e)}if(n.isVector()){if(t instanceof T){t.values.length>0&&Vr(n.value,t.values[0],e);return}I("MoveVector",e)}if(n instanceof y){if(n.isString()){if(Gr(t))return;I("MoveString",e)}if(n.isObject()){if(Zn(t))return;I("AccountAddress",e)}if(n.isOption()){if(t instanceof ze){t.value!==void 0&&Vr(n.value.typeArgs[0],t.value,e);return}I("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function tr(n){if(No(n))return ac(n);let{moduleAddress:t,moduleName:e,functionName:r}=nn(n.function),i=await Lo({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Go});return oc({...n,abi:i})}function oc(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=nn(n.function),o=Jn(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>Qr(n.function,t,c,p,o));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);let a=et.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Vt(new Wt(c,new jt(a)))}return new Ht(a)}async function Mo(n){let{moduleAddress:t,moduleName:e,functionName:r}=nn(n.function),i=await Lo({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Fo});return sc({abi:i,...n})}function sc(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=nn(n.function),o=Jn(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _97 => _97.functionArguments, 'optionalAccess', _98 => _98.map, 'call', _99 => _99((a,c)=>Qr(n.function,t,a,c,o))]), () => ([]));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);return et.build(`${e}::${r}`,i,o,s)}function ac(n){return new Lt(new Qt(l.fromHexInput(n.bytecode).toUint8Array(),Jn(n.typeArguments),n.functionArguments))}async function cc(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Cr[t.network]?{chainId:Cr[t.network]}:{chainId:(await Mn({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _100 => _100.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Qn({aptosConfig:t})).gas_estimate},c=async()=>{let ot=async()=>_optionalChain([i, 'optionalAccess', _101 => _101.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await we({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await ot()}catch (e4){return 0}else return ot()},[{chainId:p},{gasEstimate:m},_]=await Promise.all([s(),a(),c()]),{maxGasAmount:U,gasUnitPrice:g,expireTimestamp:C}={maxGasAmount:_optionalChain([i, 'optionalAccess', _102 => _102.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _103 => _103.gasUnitPrice]), () => (BigInt(m))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _104 => _104.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ae(u.from(e),BigInt(_),r,BigInt(U),BigInt(g),BigInt(C),new gt(p))}async function Wr(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await cc({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _105 => _105.secondarySignerAddresses, 'optionalAccess', _106 => _106.map, 'call', _107 => _107(c=>u.from(c))]), () => ([]));return new Kn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new kn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function qo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=er(t);if(e.feePayerAddress){let a=new nt(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(_=>er(_)));let p=er(i),m=new wt(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new rt(a.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let a=new tt(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(m=>er(m));let p=new bt(o,e.secondarySignerAddresses,c);return new rt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof ye)s=new Tt(o.public_key,o.signature);else if(o instanceof L)s=new St(o);else throw new Error("Invalid public key");return new rt(e.rawTransaction,s).bcsToBytes()}function er(n){let t=n;if((t instanceof me||t instanceof he)&&(t=new k(t)),t instanceof k){if(t.publicKey instanceof v)return new L(t,new N(new S(new Uint8Array(64))));if(t.publicKey instanceof he)return new L(t,new N(new _e(new Uint8Array(64))));if(t.publicKey instanceof me)return new L(t,new N(new S(new Uint8Array(64))))}return new ye(new v(t.toUint8Array()),new S(new Uint8Array(64)))}function jr(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=Oi($,n.senderAuthenticator),o;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new wt(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new bt(i,t.secondarySignerAddresses,r)}else i instanceof ye?o=new Tt(i.public_key,i.signature):o=new St(i);return new rt(t.rawTransaction,o).bcsToBytes()}function $o(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var uc=$o(["APTOS::Transaction"]);function SA(n){let t=jr(n);return new l($o([uc,new Uint8Array([0]),t])).toString()}async function Lo({key:n,moduleAddress:t,moduleName:e,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:It(async()=>s(t,e,r,i),`${n}-${i.network}-${t}-${e}-${r}`,1e3*60*5)()}async function h(n){let t=await pc(n);return dc(n,t)}async function pc(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await tr(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await tr(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await tr(r)),i}async function dc(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(lc(n)&&(o=u.ZERO.toString()),gc(n)){let{secondarySignerAddresses:s}=n;return Wr({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Wr({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function lc(n){return n.withFeePayer===!0}function gc(n){return"secondarySignerAddresses"in n}function Ho(n){let{transaction:t}=n;return xt(t)}function nr(n){let{signer:t,transaction:e}=n;return t.signTransactionWithAuthenticator(e)}async function Xr(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=qo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await it({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _108 => _108.options, 'optionalAccess', _109 => _109.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _110 => _110.options, 'optionalAccess', _111 => _111.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function rr(n){let{aptosConfig:t}=n,e=jr({...n}),{data:r}=await it({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function rn(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof be||e instanceof On)&&await e.waitForProofFetch();let i=nr({signer:e,transaction:r});return rr({aptosConfig:t,transaction:r,senderAuthenticator:i})}var mc={typeParameters:[],parameters:[P.u8(),new P(P.u8())]};async function Vo(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>T.U8(a));return h({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:mc},options:o})}var yc={typeParameters:[],parameters:[new Te,P.u8(),new Te,P.u8(),P.u8(),P.u8()]};async function Qo(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await we({aptosConfig:t,accountAddress:e.accountAddress}),o=Ke.fromPrivateKey({privateKey:r,legacy:!0}),a=new Dn({sequenceNumber:BigInt(i.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=e.sign(a),p=o.sign(a),m=await h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new O(e.signingScheme),T.U8(e.publicKey.toUint8Array()),new O(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:yc}});return rn({aptosConfig:t,signer:e,transaction:m})}var fc={typeParameters:[{constraints:[]}],parameters:[new Z,new W]};async function Wo(n){let{aptosConfig:t,sender:e,recipient:r,amount:i,coinType:o,options:s}=n;return h({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Un))],functionArguments:[r,i],abi:fc},options:s})}var on=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Wo({aptosConfig:this.config,...t})}};var Be={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ue="0x4::token::Token";async function jo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:ao,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Xo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:t,query:{query:zr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Yo(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:zr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _114 => _114.offset]),limit:_optionalChain([r, 'optionalAccess', _115 => _115.limit]),order_by:_optionalChain([r, 'optionalAccess', _116 => _116.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Zo(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:so,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _117 => _117.offset]),limit:_optionalChain([r, 'optionalAccess', _118 => _118.limit]),order_by:_optionalChain([r, 'optionalAccess', _119 => _119.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Ac={typeParameters:[],parameters:[new y(x()),new W,new y(x()),new y(x()),new M,new M,new M,new M,new M,new M,new M,new M,new M,new W,new W]};async function Jo(n){let{aptosConfig:t,options:e,creator:r}=n;return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new G(_nullishCoalesce(n.maxSupply, () => (Fe))),new b(n.name),new b(n.uri),new E(_nullishCoalesce(n.mutableDescription, () => (!0))),new E(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new E(_nullishCoalesce(n.mutableURI, () => (!0))),new E(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new E(_nullishCoalesce(n.mutableTokenName, () => (!0))),new E(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new E(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new E(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new E(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new G(_nullishCoalesce(n.royaltyNumerator, () => (0))),new G(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Ac},options:e})}async function Yr(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:i}=n,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _120 => _120.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _121 => _121.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:t,query:{query:Ir,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function es(n){let{aptosConfig:t,collectionId:e}=n,i={collection_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:Ir,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ts(n){return(await Yr(n)).collection_id}var hc={typeParameters:[],parameters:[new y(x()),new y(x()),new y(x()),new y(x()),new P(new y(x())),new P(new y(x())),new P(P.u8())]};async function ns(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:m}=n,_=_optionalChain([p, 'optionalAccess', _122 => _122.map, 'call', _123 => _123(U=>Be[U])]);return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(i),new b(o),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(_, () => ([]))),fs(_nullishCoalesce(m, () => ([])),_nullishCoalesce(_, () => ([])))],abi:hc},options:e})}var Tc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new Z]};async function rs(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(r),u.from(i)],abi:Tc},options:s})}var bc={typeParameters:[],parameters:[new y(x()),new y(x()),new y(x()),new y(x()),new P(new y(x())),new P(new y(x())),new P(P.u8()),new Z]};async function is(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:m,options:_}=n;if(_optionalChain([c, 'optionalAccess', _124 => _124.length])!==_optionalChain([m, 'optionalAccess', _125 => _125.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _126 => _126.length])!==_optionalChain([m, 'optionalAccess', _127 => _127.length]))throw new Error("Property types and property values counts do not match");let U=_optionalChain([p, 'optionalAccess', _128 => _128.map, 'call', _129 => _129(g=>Be[g])]);return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(U, () => ([]))),fs(_nullishCoalesce(m, () => ([])),_nullishCoalesce(U, () => ([]))),a],abi:bc},options:_})}var wc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0)))]};async function os(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[u.from(r)],abi:wc},options:o})}var Sc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0)))]};async function ss(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:Sc},options:o})}var xc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0)))]};async function as(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:xc},options:o})}var _c={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new y(x())]};async function cs(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:_c},options:s})}var vc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new y(x())]};async function us(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:vc},options:s})}var Pc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new y(x())]};async function ps(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Pc},options:s})}var Cc={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new y(x()),new y(x()),P.u8()]};async function ds(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Be[i]),T.U8(Zr(o,Be[i]))],abi:Cc},options:c})}var Ec={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new y(x())]};async function ls(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ec},options:s})}var Ic={typeParameters:[{constraints:["key"]}],parameters:[new y(J(new D(0))),new y(x()),new y(x()),P.u8()]};async function gs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Be[i]),Zr(o,Be[i])],abi:Ic},options:c})}var Uc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(J(new D(0))),new y(x()),new D(1)]};async function ms(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Be[i]],functionArguments:[u.from(s),new b(r),o],abi:Uc},options:c})}var Rc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(J(new D(0))),new y(x()),new D(1)]};async function ys(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Be[i]],functionArguments:[u.from(s),new b(r),o],abi:Rc},options:c})}function fs(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(Zr(n[i],r))}),e}function Zr(n,t){let e=Ee(t);return Rt(n,e,0,[]).bcsToBytes()}var sn=class{constructor(t){this.config=t}async getCollectionData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Yr({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),es({aptosConfig:this.config,...t})}async getCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ts({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),jo({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Xo({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Yo({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return Jo({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return ns({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return rs({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return is({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return os({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return ss({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return as({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return cs({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return us({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return ps({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return ds({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return ls({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return gs({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return ms({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return ys({aptosConfig:this.config,...t})}};var As=300,zc=n=>{if(n&&n.length>As)throw new Error(`Event type length exceeds the maximum length of ${As}`)};async function hs(n){let{aptosConfig:t,eventType:e,options:r}=n,o={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:r,orderBy:_optionalChain([r, 'optionalAccess', _130 => _130.orderBy])};return an({aptosConfig:t,options:o})}async function Ts(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:i}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _131 => _131.orderBy])};return an({aptosConfig:e,options:a})}async function bs(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:i}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _132 => _132.orderBy])};return an({aptosConfig:e,options:a})}async function an(n){let{aptosConfig:t,options:e}=n;zc(_optionalChain([e, 'optionalAccess', _133 => _133.where, 'optionalAccess', _134 => _134.indexed_type, 'optionalAccess', _135 => _135._eq]));let r={query:to,variables:{where_condition:_optionalChain([e, 'optionalAccess', _136 => _136.where]),offset:_optionalChain([e, 'optionalAccess', _137 => _137.offset]),limit:_optionalChain([e, 'optionalAccess', _138 => _138.limit]),order_by:_optionalChain([e, 'optionalAccess', _139 => _139.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var cn=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),hs({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Ts({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),bs({aptosConfig:this.config,...t})}async getEvents(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _140 => _140.minimumLedgerVersion]),processorType:"events_processor"}),an({aptosConfig:this.config,...t})}};async function ws(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _141 => _141.timeoutSecs])||20,{data:s}=await Mi({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Ut({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _142 => _142.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var un=class{constructor(t){this.config=t}async fundAccount(t){let e=await ws({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _143 => _143.options, 'optionalAccess', _144 => _144.waitForIndexer])!==!1&&await Wn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function Jr(n){let{aptosConfig:t,options:e}=n,r={query:ro,variables:{where_condition:_optionalChain([e, 'optionalAccess', _145 => _145.where]),limit:_optionalChain([e, 'optionalAccess', _146 => _146.limit]),offset:_optionalChain([e, 'optionalAccess', _147 => _147.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ss(n){let{aptosConfig:t,options:e}=n,r={query:no,variables:{where_condition:_optionalChain([e, 'optionalAccess', _148 => _148.where]),limit:_optionalChain([e, 'optionalAccess', _149 => _149.limit]),offset:_optionalChain([e, 'optionalAccess', _150 => _150.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function xs(n){let{aptosConfig:t,options:e}=n,r={query:Ji,variables:{where_condition:_optionalChain([e, 'optionalAccess', _151 => _151.where]),limit:_optionalChain([e, 'optionalAccess', _152 => _152.limit]),offset:_optionalChain([e, 'optionalAccess', _153 => _153.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Dc={typeParameters:[{constraints:[]}],parameters:[Ee("0x1::object::Object"),new Z,new W]};async function _s(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Dc},options:s})}var pn=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _154 => _154.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Jr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _155 => _155.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Jr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _156 => _156.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ss({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _157 => _157.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),xs({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return _s({aptosConfig:this.config,...t})}};async function Oe(n){let{aptosConfig:t,payload:e,options:r}=n,i=await Mo({...e,aptosConfig:t}),o=new Q;i.serialize(o);let s=o.toUint8Array(),{data:a}=await it({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _158 => _158.ledgerVersion])},body:s});return a}var dn=class{constructor(t){this.config=t}async getLedgerInfo(){return Mn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return co({aptosConfig:this.config,...t})}async getBlockByHeight(t){return uo({aptosConfig:this.config,...t})}async view(t){return Oe({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return po({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return qn({aptosConfig:this.config})}async getProcessorStatus(t){return $n({aptosConfig:this.config,processorType:t})}};var vs=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Ps(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ge(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Ps(t))throw new Error(`${t} is not valid. ${vs}`);if(e&&!Ps(e))throw new Error(`${e} is not valid. ${vs}`);return{domainName:e||t,subdomainName:e?t:void 0}}var kc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Kc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:kc,custom:null,devnet:null};function Ie(n){let t=Kc[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var ir=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Cs(n){let{aptosConfig:t,name:e}=n,r=Ie(t),{domainName:i,subdomainName:o}=Ge(e),s=await Oe({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=ir(s[0]);return a?u.from(a):void 0}async function Es(n){let{aptosConfig:t,expiration:e,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=Ie(t),{domainName:m,subdomainName:_}=Ge(r),U=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(_&&!U)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(U&&!_)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let pr=_nullishCoalesce(e.years, () => (1));if(pr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Hs=pr*31536e3;return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[m,Hs,o,s]},options:a})}if(!_)throw new Error(`${e.policy} requires a subdomain to be provided.`);let g=await ei({aptosConfig:t,name:m});if(!g)throw new Error("The domain does not exist");let C=e.policy==="subdomain:independent"?e.expirationDate:g;if(C>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[m,_,Math.round(C/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function ei(n){let{aptosConfig:t,name:e}=n,r=Ie(t),{domainName:i,subdomainName:o}=Ge(e);try{let s=await Oe({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e5){return}}async function Is(n){let{aptosConfig:t,address:e}=n,r=Ie(t),i=await Oe({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=ir(i[1]),s=ir(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Us(n){let{aptosConfig:t,sender:e,name:r,options:i}=n,o=Ie(t);if(!r)return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Ge(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Rs(n){let{aptosConfig:t,name:e}=n,r=Ie(t),{domainName:i,subdomainName:o}=Ge(e),s=await Oe({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=ir(s[0]);return a?u.from(a):void 0}async function zs(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=Ie(t),{domainName:a,subdomainName:c}=Ge(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Ds(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:i=""}=Ge(e),a=(await f({aptosConfig:t,query:{query:Et,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=ln(a)),a}async function ks(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await ti({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _159 => _159.limit]),offset:_optionalChain([e, 'optionalAccess', _160 => _160.offset]),order_by:_optionalChain([e, 'optionalAccess', _161 => _161.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _162 => _162.options, 'optionalAccess', _163 => _163.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(ln)}async function Ks(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await ti({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _164 => _164.limit]),offset:_optionalChain([e, 'optionalAccess', _165 => _165.offset]),order_by:_optionalChain([e, 'optionalAccess', _166 => _166.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _167 => _167.options, 'optionalAccess', _168 => _168.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(ln)}async function Ns(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await ti({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _169 => _169.limit]),offset:_optionalChain([e, 'optionalAccess', _170 => _170.offset]),order_by:_optionalChain([e, 'optionalAccess', _171 => _171.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _172 => _172.options, 'optionalAccess', _173 => _173.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(ln)}async function Bs(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _174 => _174.limit]),offset:_optionalChain([e, 'optionalAccess', _175 => _175.offset]),order_by:_optionalChain([e, 'optionalAccess', _176 => _176.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _177 => _177.options, 'optionalAccess', _178 => _178.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(ln)}async function ti(n){let{aptosConfig:t}=n,e=Ie(t),[r]=await Oe({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function Os(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=Ie(t),a=i*31536e3,{domainName:c,subdomainName:p}=Ge(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function ln(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var gn=class{constructor(t){this.config=t}async getOwnerAddress(t){return Cs({aptosConfig:this.config,...t})}async getExpiration(t){return ei({aptosConfig:this.config,...t})}async getTargetAddress(t){return Rs({aptosConfig:this.config,...t})}async setTargetAddress(t){return zs({aptosConfig:this.config,...t})}async getPrimaryName(t){return Is({aptosConfig:this.config,...t})}async setPrimaryName(t){return Us({aptosConfig:this.config,...t})}async registerName(t){return Es({aptosConfig:this.config,...t})}async renewDomain(t){return Os({aptosConfig:this.config,...t})}async getName(t){return Ds({aptosConfig:this.config,...t})}async getAccountNames(t){return ks({aptosConfig:this.config,...t})}async getAccountDomains(t){return Ks({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Ns({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Bs({aptosConfig:this.config,...t})}};async function Gs(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Ur,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function Fs(n){let{aptosConfig:t,options:e}=n,r={query:Ur,variables:{order_by:_optionalChain([e, 'optionalAccess', _179 => _179.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Ms(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:eo,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var mn=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _180 => _180.minimumLedgerVersion]),processorType:"stake_processor"}),Gs({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _181 => _181.minimumLedgerVersion]),processorType:"stake_processor"}),Fs({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _182 => _182.minimumLedgerVersion]),processorType:"stake_processor"}),Ms({aptosConfig:this.config,...t})}};var or=class{constructor(t){this.config=t}async simple(t){return h({aptosConfig:this.config,...t})}async multiAgent(t){return h({aptosConfig:this.config,...t})}};function ni(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},e}function ri(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},e}var zt=class{constructor(t){this.config=t}async simple(t){return Xr({aptosConfig:this.config,...t})}async multiAgent(t){return Xr({aptosConfig:this.config,...t})}};_chunkVLEH6QBRjs.a.call(void 0, [ri],zt.prototype,"simple",1),_chunkVLEH6QBRjs.a.call(void 0, [ri],zt.prototype,"multiAgent",1);var Dt=class{constructor(t){this.config=t}async simple(t){return rr({aptosConfig:this.config,...t})}async multiAgent(t){return rr({aptosConfig:this.config,...t})}};_chunkVLEH6QBRjs.a.call(void 0, [ni],Dt.prototype,"simple",1),_chunkVLEH6QBRjs.a.call(void 0, [ni],Dt.prototype,"multiAgent",1);var sr=()=>Math.floor(Date.now()/1e3),ar= exports.AccountSequenceNumber =class{constructor(t,e,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=sr();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime),sr()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await we({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await we({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=sr();for(;this.lastUncommintedNumber!==this.currentNumber;)sr()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkVLEH6QBRjs.b.call(void 0, this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var kt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _183 => _183.pendingDequeue, 'access', _184 => _184.shift, 'call', _185 => _185(), 'optionalAccess', _186 => _186.resolve, 'call', _187 => _187(t)]);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Kt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Kt=class extends Error{};var qs="fulfilled",$s= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))($s||{}),cr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(e,r,i=30,o=100,s=10){super();this.taskQueue=new kt;this.transactionsQueue=new kt;this.outstandingTransactions=new kt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new ar(e,r,i,o,s)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let i=rn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,e])}}catch(e){if(e instanceof Kt)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(e.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),e.push(i),r.push(o);let s=await Promise.allSettled(e);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===qs?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(e){if(e instanceof Kt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let i=[];i.push(Ut({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===qs?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:e.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var ur=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new cr(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:i}=e;for(let o of r)this.transactionWorker.push(o,i)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:r,data:i,options:o}=e;this.start({sender:r}),this.push({data:i,options:o})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var yn=class{constructor(t){this.config=t,this.build=new or(this.config),this.simulate=new zt(this.config),this.submit=new Dt(this.config),this.batch=new ur(this.config)}async getTransactions(t){return Eo({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return Io({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Jt({aptosConfig:this.config,...t})}async isPendingTransaction(t){return Uo({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ut({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Qn({aptosConfig:this.config})}getSigningMessage(t){return Ho(t)}async publishPackageTransaction(t){return Vo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Qo({aptosConfig:this.config,...t})}sign(t){return nr({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,nr({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:i}=t;this.batch.forSingleAccount({sender:e,data:r,options:i})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return rn({aptosConfig:this.config,signer:e,transaction:r})}};var fn=class{constructor(t){this.config=t}async getTableItem(t){return Ln({aptosConfig:this.config,...t})}async getTableItemsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),lo({aptosConfig:this.config,...t})}async getTableItemsMetadata(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),go({aptosConfig:this.config,...t})}};async function ii(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,uidKey:i,derivationPath:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:Number(r.expiryDateSecs),epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await qi({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return l.fromHexInput(a.pepper).toUint8Array()}async function Oc(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i,uidKey:o,extraFieldKey:s}=n,a={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:Number(r.expiryDateSecs),exp_horizon_secs:Mt,pepper:l.fromHexInput(i).toStringWithoutPrefix(),extra_field:s,uid_key:o||"sub"},{data:c}=await $i({aptosConfig:t,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),p=c.proof,m=new Ft({a:p.a,b:p.b,c:p.c});return new ke({proof:new dt(m,0),trainingWheelsSignature:ge.fromHex(c.training_wheels_signature)})}async function Ls(n){let{proofFetchCallback:t}=n,{pepper:e}=n;if(e===void 0)e=await ii(n);else if(l.fromHexInput(e).toUint8Array().length!==be.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${be.PEPPER_LENGTH} bytes`);let r=Oc({...n,pepper:e}),i=t?r:await r;return be.fromJWTAndProof({...n,proof:i,pepper:e,proofFetchCallback:t})}var An=class{constructor(t){this.config=t}async getPepper(t){return ii({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return Ls({aptosConfig:this.config,...t})}};var j=class{constructor(t){this.config=new jn(t),this.account=new en(this.config),this.ans=new gn(this.config),this.coin=new on(this.config),this.digitalAsset=new sn(this.config),this.event=new cn(this.config),this.faucet=new un(this.config),this.fungibleAsset=new pn(this.config),this.general=new dn(this.config),this.staking=new mn(this.config),this.transaction=new yn(this.config),this.table=new fn(this.config),this.keyless=new An(this.config)}};function pe(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(t.prototype,r);i&&(i.value=function(...o){return this[e][r](...o)},Object.defineProperty(n.prototype,r,i))})}pe(j,en,"account");pe(j,gn,"ans");pe(j,on,"coin");pe(j,sn,"digitalAsset");pe(j,cn,"event");pe(j,un,"faucet");pe(j,pn,"fungibleAsset");pe(j,dn,"general");pe(j,mn,"staking");pe(j,yn,"transaction");pe(j,fn,"table");pe(j,An,"keyless");exports.APTOS_BIP44_REGEX = oa; exports.APTOS_COIN = Un; exports.APTOS_HARDENED_REGEX = ia; exports.Account = Ke; exports.AccountAddress = u; exports.AccountAuthenticator = $; exports.AccountAuthenticatorEd25519 = ye; exports.AccountAuthenticatorMultiEd25519 = En; exports.AccountAuthenticatorMultiKey = Ye; exports.AccountAuthenticatorSingleKey = L; exports.AccountAuthenticatorVariant = li; exports.AccountPublicKey = ie; exports.AccountSequenceNumber = ar; exports.AddressInvalidReason = ea; exports.AnyPublicKey = k; exports.AnyPublicKeyVariant = lr; exports.AnySignature = N; exports.AnySignatureVariant = gi; exports.Aptos = j; exports.AptosApiError = ce; exports.AptosApiType = qt; exports.AptosConfig = jn; exports.AuthenticationKey = F; exports.Bool = E; exports.CKDPriv = wi; exports.ChainId = gt; exports.DEFAULT_MAX_GAS_AMOUNT = Ii; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Ui; exports.DEFAULT_TXN_TIMEOUT_SEC = In; exports.DeriveScheme = Zs; exports.Deserializer = te; exports.EPK_HORIZON_SECS = Mt; exports.Ed25519Account = _t; exports.Ed25519PrivateKey = q; exports.Ed25519PublicKey = v; exports.Ed25519Signature = S; exports.EntryFunction = et; exports.EntryFunctionBytes = wn; exports.EphemeralCertificate = pt; exports.EphemeralCertificateVariant = mr; exports.EphemeralKeyPair = Xt; exports.EphemeralPublicKey = We; exports.EphemeralPublicKeyVariant = gr; exports.EphemeralSignature = ge; exports.EphemeralSignatureVariant = mi; exports.FeePayerRawTransaction = nt; exports.FixedBytes = qe; exports.Groth16Zkp = Ft; exports.HARDENED_OFFSET = hi; exports.Hex = l; exports.HexInvalidReason = Ws; exports.Identifier = R; exports.IssuerToJwkEndpoint = qa; exports.KeyType = sa; exports.KeylessAccount = be; exports.KeylessError = Yt; exports.KeylessErrorType = $a; exports.KeylessPublicKey = me; exports.KeylessSignature = je; exports.MAX_AUD_VAL_BYTES = za; exports.MAX_COMMITED_EPK_BYTES = Sd; exports.MAX_EXTRA_FIELD_BYTES = bd; exports.MAX_ISS_VAL_BYTES = Td; exports.MAX_JWT_HEADER_B64_BYTES = wd; exports.MAX_UID_KEY_BYTES = Da; exports.MAX_UID_VAL_BYTES = ka; exports.MimeType = Sn; exports.ModuleId = $t; exports.MoveAbility = yi; exports.MoveFunctionVisibility = Xs; exports.MoveOption = ze; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = tt; exports.MultiAgentTransaction = Kn; exports.MultiEd25519PublicKey = ct; exports.MultiEd25519Signature = He; exports.MultiKey = lt; exports.MultiKeyAccount = On; exports.MultiKeySignature = Xe; exports.MultiSig = Wt; exports.MultiSigTransactionPayload = jt; exports.Network = Pr; exports.NetworkToChainId = Cr; exports.NetworkToFaucetAPI = Bi; exports.NetworkToIndexerAPI = Ki; exports.NetworkToNetworkName = fy; exports.NetworkToNodeAPI = Ni; exports.NetworkToPepperAPI = _r; exports.NetworkToProverAPI = vr; exports.ParsingError = V; exports.ProcessorType = Ze; exports.PublicKey = $e; exports.RAW_TRANSACTION_SALT = Ri; exports.RAW_TRANSACTION_WITH_DATA_SALT = br; exports.RawTransaction = ae; exports.RawTransactionWithData = zn; exports.RoleType = Ys; exports.RotationProofChallenge = Dn; exports.Script = Qt; exports.ScriptTransactionArgumentVariants = Bt; exports.Secp256k1PrivateKey = Qe; exports.Secp256k1PublicKey = he; exports.Secp256k1Signature = _e; exports.Serializable = d; exports.Serializer = Q; exports.Signature = K; exports.SignedTransaction = rt; exports.SigningScheme = fe; exports.SigningSchemeInput = Ar; exports.SimpleTransaction = kn; exports.SingleKeyAccount = vt; exports.StructTag = Pe; exports.TransactionAndProof = xr; exports.TransactionAuthenticator = Ce; exports.TransactionAuthenticatorEd25519 = Tt; exports.TransactionAuthenticatorFeePayer = wt; exports.TransactionAuthenticatorMultiAgent = bt; exports.TransactionAuthenticatorMultiEd25519 = wr; exports.TransactionAuthenticatorSingleSender = St; exports.TransactionAuthenticatorVariant = di; exports.TransactionPayload = Je; exports.TransactionPayloadEntryFunction = Ht; exports.TransactionPayloadMultiSig = Vt; exports.TransactionPayloadScript = Lt; exports.TransactionPayloadVariants = ui; exports.TransactionResponseType = fr; exports.TransactionVariants = pi; exports.TransactionWorker = cr; exports.TransactionWorkerEventsEnum = $s; exports.TypeTag = z; exports.TypeTagAddress = Z; exports.TypeTagBool = M; exports.TypeTagGeneric = D; exports.TypeTagParserError = B; exports.TypeTagParserErrorType = ec; exports.TypeTagReference = Rn; exports.TypeTagSigner = ht; exports.TypeTagStruct = y; exports.TypeTagU128 = ft; exports.TypeTagU16 = mt; exports.TypeTagU256 = At; exports.TypeTagU32 = yt; exports.TypeTagU64 = W; exports.TypeTagU8 = Te; exports.TypeTagVariants = ci; exports.TypeTagVector = P; exports.U128 = de; exports.U16 = ne; exports.U256 = le; exports.U32 = re; exports.U64 = G; exports.U8 = O; exports.ZeroKnowledgeSig = ke; exports.ZkProof = dt; exports.ZkpVariant = yr; exports.aptosCoinStructTag = zl; exports.aptosRequest = Gn; exports.buildTransaction = Wr; exports.checkOrConvertArgument = Rt; exports.convertArgument = Qr; exports.deriveKey = hr; exports.deriveTransactionType = Sr; exports.deserializeFromScriptArgument = Na; exports.ensureBoolean = dr; exports.fetchEntryFunctionAbi = Go; exports.fetchFunctionAbi = Oo; exports.fetchViewFunctionAbi = Fo; exports.findFirstNonSignerArg = Bo; exports.generateRawTransaction = cc; exports.generateSignedTransaction = jr; exports.generateSignedTransactionForSimulation = qo; exports.generateSigningMessage = Nn; exports.generateSigningMessageForBcsCryptoHashable = zi; exports.generateSigningMessageForTransaction = xt; exports.generateTransactionPayload = tr; exports.generateTransactionPayloadWithABI = oc; exports.generateUserTransactionHash = SA; exports.generateViewFunctionPayload = Mo; exports.generateViewFunctionPayloadWithABI = sc; exports.get = Er; exports.getAptosFullNode = ee; exports.getAptosPepperService = Oy; exports.getAuthenticatorForSimulation = er; exports.getFunctionParts = nn; exports.hashValues = $o; exports.isBcsAddress = Zn; exports.isBcsBool = Or; exports.isBcsFixedBytes = tc; exports.isBcsString = Gr; exports.isBcsU128 = Lr; exports.isBcsU16 = Mr; exports.isBcsU256 = Hr; exports.isBcsU32 = qr; exports.isBcsU64 = $r; exports.isBcsU8 = Fr; exports.isBlockMetadataTransactionResponse = pu; exports.isBool = Do; exports.isEd25519Signature = gu; exports.isEncodedEntryFunctionArgument = Ko; exports.isFeePayerSignature = fu; exports.isGenesisTransactionResponse = uu; exports.isLargeNumber = Yn; exports.isMultiAgentSignature = yu; exports.isMultiEd25519Signature = Au; exports.isNull = ko; exports.isNumber = Xn; exports.isPendingTransactionResponse = au; exports.isScriptDataInput = No; exports.isSecp256k1Signature = mu; exports.isStateCheckpointTransactionResponse = du; exports.isString = Se; exports.isUserTransactionResponse = cu; exports.isValidBIP44Path = Ti; exports.isValidHardenedPath = bi; exports.isValidatorTransactionResponse = lu; exports.mnemonicToSeed = xn; exports.normalizeBundle = Oi; exports.objectStructTag = J; exports.optionStructTag = Dl; exports.outOfRangeErrorMessage = js; exports.paginateWithCursor = Ct; exports.parseTypeTag = Ee; exports.post = Zt; exports.postAptosFaucet = Mi; exports.postAptosFullNode = it; exports.postAptosIndexer = Fi; exports.postAptosPepperService = qi; exports.postAptosProvingService = $i; exports.promiseFulfilledStatus = qs; exports.request = La; exports.splitPath = Si; exports.standardizeTypeTags = Jn; exports.stringStructTag = x; exports.throwTypeMismatch = I; exports.validateNumberInRange = Re;
457
+ `;async function $n(n){let{aptosConfig:t}=n,{data:e}=await q({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function po(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await q({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _33 => _33.withTransactions])}});return i}async function lo(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await q({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _34 => _34.withTransactions])}});return i}async function go(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:eo,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await qi({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function Qa(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:Kr},originMethod:"getProcessorStatuses"})).processor_status}async function Vn(n){let t=await Qa({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Hn(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:Kr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var Br=new Map;function Oe(n,t,e){return async(...r)=>{if(Br.has(t)){let{value:o,timestamp:s}=Br.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return Br.set(t,{value:i,timestamp:Date.now()}),i}}async function Ln(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await ut({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _35 => _35.ledgerVersion])},body:r})).data}async function mo(n){let{aptosConfig:t,options:e}=n,r={query:so,variables:{where_condition:_optionalChain([e, 'optionalAccess', _36 => _36.where]),offset:_optionalChain([e, 'optionalAccess', _37 => _37.offset]),limit:_optionalChain([e, 'optionalAccess', _38 => _38.limit]),order_by:_optionalChain([e, 'optionalAccess', _39 => _39.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsData"})).table_items}async function yo(n){let{aptosConfig:t,options:e}=n,r={query:ao,variables:{where_condition:_optionalChain([e, 'optionalAccess', _40 => _40.where]),offset:_optionalChain([e, 'optionalAccess', _41 => _41.offset]),limit:_optionalChain([e, 'optionalAccess', _42 => _42.limit]),order_by:_optionalChain([e, 'optionalAccess', _43 => _43.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function we(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await q({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function ho(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rt({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _44 => _44.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _45 => _45.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _46 => _46.limit]), () => (1e3))}})}async function Qn(n){return _optionalChain([n, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.ledgerVersion])!==void 0?fo(n):Oe(async()=>fo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function fo(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await q({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _49 => _49.ledgerVersion])}});return o}async function To(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rt({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _50 => _50.offset]),limit:_optionalChain([r, 'optionalAccess', _51 => _51.limit])}})}async function bo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Rt({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _52 => _52.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _53 => _53.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _54 => _54.limit]), () => (999))}})}async function Nr(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await q({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _55 => _55.ledgerVersion])}});return o.data}async function Or(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await Nr({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Ln({aptosConfig:t,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ye&&a.data.error_code==="table_item_not_found")return s;throw a}}async function wo(n){let{aptosConfig:t,accountAddress:e}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:t,query:{query:Zi,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function So(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])});let s={query:Xi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function xo(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:i}=n,o=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _61 => _61.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _62 => _62.tokenStandard])});let c={query:Yi,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([i, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([i, 'optionalAccess', _65 => _65.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function _o(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _66 => _66.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _67 => _67.tokenStandard])}});let s={query:Wi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([r, 'optionalAccess', _69 => _69.limit]),order_by:_optionalChain([r, 'optionalAccess', _70 => _70.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function vo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Ji,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function Po(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,i=u.from(e).toStringLong(),o=await Fr({aptosConfig:t,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Fr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _71 => _71.where]),owner_address:{_eq:i}},s={query:Qi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_optionalChain([r, 'optionalAccess', _73 => _73.limit]),order_by:_optionalChain([r, 'optionalAccess', _74 => _74.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Co(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Li,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function Eo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:ji,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _75 => _75.offset]),limit:_optionalChain([r, 'optionalAccess', _76 => _76.limit]),order_by:_optionalChain([r, 'optionalAccess', _77 => _77.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Io(n){let{aptosConfig:t,privateKey:e}=n,r=new k(e.publicKey());if(e instanceof Xe){let o=F.fromPublicKey({publicKey:r}).derivedAddress();return Be.fromPrivateKey({privateKey:e,address:o})}if(e instanceof $){let i=F.fromPublicKey({publicKey:r});if(await Ao({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Be.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=F.fromPublicKey({publicKey:r.publicKey});if(await Ao({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return Be.fromPrivateKey({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Ao(n){let{aptosConfig:t,authKey:e}=n,r=await Or({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await we({aptosConfig:t,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Uo(n){let{aptosConfig:t,options:e}=n;return Rt({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([e, 'optionalAccess', _79 => _79.limit])}})}async function jn(n){let{aptosConfig:t}=n;return Oe(async()=>{let{data:e}=await q({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function Ro(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await q({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function tn(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await q({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function zo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await tn({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _80 => _80.status])===404)return!0;throw r}}async function Wa(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await q({aptosConfig:t,path:`transactions/wait_by_hash/${e}`,originMethod:"longWaitForTransaction"});return r}async function Gt(n){let{aptosConfig:t,transactionHash:e,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.checkSuccess]), () => (!0)),s=!0,a=0,c,p,m=200,P=1.5;function U(l){if(!(l instanceof ye)||(p=l,l.status!==404&&l.status>=400&&l.status<500))throw l}try{c=await tn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(l){U(l)}if(s){let l=Date.now();try{c=await Wa({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(C){U(C)}a=(Date.now()-l)/1e3}for(;s&&!(a>=i);){try{if(c=await tn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(l){U(l)}await _chunkHPZUSDYPjs.b.call(void 0, m),a+=m/1e3,m*=P}if(c===void 0)throw p||new Wn(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Wn(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Mr(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function Xn(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?s=await Vn({aptosConfig:t}):s=(await Hn({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkHPZUSDYPjs.b.call(void 0, 200)}}var Wn=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Mr=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function A(n){n.minimumLedgerVersion!==void 0&&await Xn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var nn=class{constructor(t){this.config=t}async getAccountInfo(t){return we({aptosConfig:this.config,...t})}async getAccountModules(t){return ho({aptosConfig:this.config,...t})}async getAccountModule(t){return Qn({aptosConfig:this.config,...t})}async getAccountTransactions(t){return To({aptosConfig:this.config,...t})}async getAccountResources(t){return bo({aptosConfig:this.config,...t})}async getAccountResource(t){return Nr({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Or({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),wo({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),So({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),xo({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),_o({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),vo({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Fr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Co({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Gn,...t})}async getAccountCoinAmount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Po({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),Eo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Io({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Yn=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _83 => _83.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _84 => _84.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _85 => _85.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _86 => _86.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _87 => _87.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _88 => _88.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _89 => _89.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _90 => _90.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _91 => _91.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _92 => _92.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _93 => _93.faucetConfig]), () => ({}))}getRequestUrl(t){switch(t){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Ni[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Oi[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Bi[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return Er[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return Ir[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return Er[this.network]===t}isProverServiceRequest(t){return Ir[this.network]===t}};function Go(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function ko(n){return!!n.match(/\s/)}function Xa(n){return!!n.match(/^T[0-9]+$/)}function Ya(n){return!!n.match(/^&.+$/)}function Za(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function Ja(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!ko(r))break}return e}var ec=(C=>(C.InvalidTypeTag="unknown type",C.UnexpectedGenericType="unexpected generic type",C.UnexpectedTypeArgumentClose="unexpected '>'",C.UnexpectedWhitespaceCharacter="unexpected whitespace character",C.UnexpectedComma="unexpected ','",C.TypeArgumentCountMismatch="type argument count doesn't match expected amount",C.MissingTypeArgumentClose="no matching '>' for '<'",C.MissingTypeArgument="no type argument before ','",C.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",C.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",C.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",C.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",C.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",C.InvalidAddress="struct address must be valid",C))(ec||{}),B= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Ue(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _94 => _94.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let C=rn(a,i,e);o.push(C)}let m=r.pop();if(m===void 0)throw new B(n,"unexpected '>'");if(c!==o.length)throw new B(n,"type argument count doesn't match expected amount");let{savedStr:P,savedTypes:U,savedExpectedTypes:l}=m;i=o,o=U,a=P,c=l}else if(p===","){if(r.length===0)throw new B(n,"unexpected ','");if(a.length===0)throw new B(n,"no type argument before ','");let m=rn(a,i,e);i=[],o.push(m),a="",c+=1}else if(ko(p)){let m=!1;if(a.length!==0){let U=rn(a,i,e);i=[],o.push(U),a="",m=!0}s=Ja(n,s);let P=n[s];if(s<n.length&&m&&P!==","&&P!==">")throw new B(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new B(n,"no matching '>' for '<'");switch(o.length){case 0:return rn(a,i,e);case 1:if(a==="")return o[0];throw new B(n,"unexpected ','");default:throw new B(n,"unexpected whitespace character")}}function rn(n,t,e){let r=n.trim(),i=r.toLowerCase();if(Za(i)&&t.length>0)throw new B(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new St;case"bool":return new M;case"address":return new J;case"u8":return new Te;case"u16":return new ht;case"u32":return new Tt;case"u64":return new j;case"u128":return new bt;case"u256":return new wt;case"vector":if(t.length!==1)throw new B(n,"vector type expected to have exactly one type argument");return new v(t[0]);default:if(Ya(r)){let a=r.substring(1);return new kn(rn(a,t,e))}if(Xa(r)){if(e)return new G(Number(r.split("T")[1]));throw new B(n,"unexpected generic type")}if(!r.match(/:/))throw new B(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new B(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new B(n,"struct address must be valid")}if(!Go(o[1]))throw new B(n,"module name must only contain alphanumeric or '_' characters");if(!Go(o[2]))throw new B(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Ee(s,new R(o[1]),new R(o[2]),t))}}function Ko(n){return typeof n=="boolean"}function Se(n){return typeof n=="string"}function Zn(n){return typeof n=="number"}function Jn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Do(n){return n==null}function Bo(n){return qr(n)||Vr(n)||Hr(n)||Lr(n)||Qr(n)||Wr(n)||jr(n)||er(n)||$r(n)||tc(n)||n instanceof T||n instanceof ke}function qr(n){return n instanceof E}function er(n){return n instanceof u}function $r(n){return n instanceof b}function tc(n){return n instanceof He}function Vr(n){return n instanceof N}function Hr(n){return n instanceof ne}function Lr(n){return n instanceof re}function Qr(n){return n instanceof O}function Wr(n){return n instanceof de}function jr(n){return n instanceof le}function No(n){return"bytecode"in n}function I(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Oo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function on(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],i=t[2];return{moduleAddress:e,moduleName:r,functionName:i}}var nc=new TextEncoder;function tr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _95 => _95.map, 'call', _96 => _96(t=>Se(t)?Ue(t):t)]), () => ([]))}async function Fo(n,t,e,r){let i=await Qn({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function Mo(n,t,e,r){let i=await Fo(n,t,e,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let o=Oo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ue(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function qo(n,t,e,r){let i=await Fo(n,t,e,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${t}::${e}'`);if(!i.is_view)throw new Error(`'${n}::${t}::${e}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Ue(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ue(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Yr(n,t,e,r,i){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let o=t.parameters[r];return kt(e,o,r,i)}function kt(n,t,e,r){return Bo(n)?(Xr(t,n,e),n):rc(n,t,e,r)}function rc(n,t,e,r){if(t.isBool()){if(Ko(n))return new E(n);if(Se(n)){if(n==="true")return new E(!0);if(n==="false")return new E(!1)}I("boolean",e)}if(t.isAddress()){if(Se(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isU8()){if(Zn(n))return new N(n);if(Se(n))return new N(Number.parseInt(n,10));I("number",e)}if(t.isU16()){if(Zn(n))return new ne(n);if(Se(n))return new ne(Number.parseInt(n,10));I("number",e)}if(t.isU32()){if(Zn(n))return new re(n);if(Se(n))return new re(Number.parseInt(n,10));I("number",e)}if(t.isU64()){if(Jn(n))return new O(BigInt(n));I("bigint | number | string",e)}if(t.isU128()){if(Jn(n))return new de(BigInt(n));I("bigint | number | string",e)}if(t.isU256()){if(Jn(n))return new le(BigInt(n));I("bigint | number | string",e)}if(t.isGeneric()){let i=t.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return kt(n,r[i],e,r)}if(t.isVector()){if(t.value.isU8()){if(Se(n))return T.U8(nc.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(i=>kt(i,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(Se(n))return new b(n);I("string",e)}if(t.isObject()){if(Se(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isOption())return Do(n)?new ke(null):new ke(kt(n,t.value.typeArgs[0],e,r));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function Xr(n,t,e){if(n.isBool()){if(qr(t))return;I("Bool",e)}if(n.isAddress()){if(er(t))return;I("AccountAddress",e)}if(n.isU8()){if(Vr(t))return;I("U8",e)}if(n.isU16()){if(Hr(t))return;I("U16",e)}if(n.isU32()){if(Lr(t))return;I("U32",e)}if(n.isU64()){if(Qr(t))return;I("U64",e)}if(n.isU128()){if(Wr(t))return;I("U128",e)}if(n.isU256()){if(jr(t))return;I("U256",e)}if(n.isVector()){if(t instanceof T){t.values.length>0&&Xr(n.value,t.values[0],e);return}I("MoveVector",e)}if(n instanceof y){if(n.isString()){if($r(t))return;I("MoveString",e)}if(n.isObject()){if(er(t))return;I("AccountAddress",e)}if(n.isOption()){if(t instanceof ke){t.value!==void 0&&Xr(n.value.typeArgs[0],t.value,e);return}I("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function rr(n){if(No(n))return ac(n);let{moduleAddress:t,moduleName:e,functionName:r}=on(n.function),i=await Lo({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Mo});return oc({...n,abi:i})}function oc(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=on(n.function),o=tr(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>Yr(n.function,t,c,p,o));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);let a=ot.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Wt(new Xt(c,new Yt(a)))}return new Qt(a)}async function $o(n){let{moduleAddress:t,moduleName:e,functionName:r}=on(n.function),i=await Lo({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:qo});return sc({abi:i,...n})}function sc(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=on(n.function),o=tr(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _97 => _97.functionArguments, 'optionalAccess', _98 => _98.map, 'call', _99 => _99((a,c)=>Yr(n.function,t,a,c,o))]), () => ([]));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);return ot.build(`${e}::${r}`,i,o,s)}function ac(n){return new Lt(new jt(g.fromHexInput(n.bytecode).toUint8Array(),tr(n.typeArguments),n.functionArguments))}async function cc(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Rr[t.network]?{chainId:Rr[t.network]}:{chainId:(await $n({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _100 => _100.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await jn({aptosConfig:t})).gas_estimate},c=async()=>{let pt=async()=>_optionalChain([i, 'optionalAccess', _101 => _101.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await we({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await pt()}catch (e3){return 0}else return pt()},[{chainId:p},{gasEstimate:m},P]=await Promise.all([s(),a(),c()]),{maxGasAmount:U,gasUnitPrice:l,expireTimestamp:C}={maxGasAmount:_optionalChain([i, 'optionalAccess', _102 => _102.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _103 => _103.gasUnitPrice]), () => (BigInt(m))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _104 => _104.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ce(u.from(e),BigInt(P),r,BigInt(U),BigInt(l),BigInt(C),new At(p))}async function Zr(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await cc({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _105 => _105.secondarySignerAddresses, 'optionalAccess', _106 => _106.map, 'call', _107 => _107(c=>u.from(c))]), () => ([]));return new Nn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Bn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Vo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=nr(t);if(e.feePayerAddress){let a=new at(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(P=>nr(P)));let p=nr(i),m=new vt(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new ct(a.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let a=new st(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(m=>nr(m));let p=new _t(o,e.secondarySignerAddresses,c);return new ct(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof me)s=new xt(o.public_key,o.signature);else if(o instanceof H)s=new Pt(o);else throw new Error("Invalid public key");return new ct(e.rawTransaction,s).bcsToBytes()}function nr(n){if((n instanceof ge||n instanceof he)&&(n=new k(n)),n instanceof k){if(n.publicKey instanceof x)return new H(n,new D(new S(new Uint8Array(64))));if(n.publicKey instanceof he)return new H(n,new D(new _e(new Uint8Array(64))));if(n.publicKey instanceof ge)return new H(n,new D(new S(new Uint8Array(64))))}return new me(new x(n.toUint8Array()),new S(new Uint8Array(64)))}function Jr(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=Fi(V,n.senderAuthenticator),o;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new vt(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new _t(i,t.secondarySignerAddresses,r)}else i instanceof me?o=new xt(i.public_key,i.signature):o=new Pt(i);return new ct(t.rawTransaction,o).bcsToBytes()}function Ho(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var uc=Ho(["APTOS::Transaction"]);function vA(n){let t=Jr(n);return new g(Ho([uc,new Uint8Array([0]),t])).toString()}async function Lo({key:n,moduleAddress:t,moduleName:e,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Oe(async()=>s(t,e,r,i),`${n}-${i.network}-${t}-${e}-${r}`,1e3*60*5)()}async function h(n){let t=await pc(n);return dc(n,t)}async function pc(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await rr(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await rr(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await rr(r)),i}async function dc(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(lc(n)&&(o=u.ZERO.toString()),gc(n)){let{secondarySignerAddresses:s}=n;return Zr({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Zr({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function lc(n){return n.withFeePayer===!0}function gc(n){return"secondarySignerAddresses"in n}function Qo(n){let{transaction:t}=n;return Ct(t)}function ir(n){let{signer:t,transaction:e}=n;return t.signTransactionWithAuthenticator(e)}async function ei(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Vo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await ut({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _108 => _108.options, 'optionalAccess', _109 => _109.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _110 => _110.options, 'optionalAccess', _111 => _111.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function or(n){let{aptosConfig:t}=n,e=Jr({...n}),{data:r}=await ut({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function sn(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof be||e instanceof Fn)&&await e.waitForProofFetch();let i=ir({signer:e,transaction:r});return or({aptosConfig:t,transaction:r,senderAuthenticator:i})}var mc={typeParameters:[],parameters:[v.u8(),new v(v.u8())]};async function Wo(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>T.U8(a));return h({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:mc},options:o})}var yc={typeParameters:[],parameters:[new Te,v.u8(),new Te,v.u8(),v.u8(),v.u8()]};async function jo(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await we({aptosConfig:t,accountAddress:e.accountAddress}),o=Be.fromPrivateKey({privateKey:r,legacy:!0}),a=new Dn({sequenceNumber:BigInt(i.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=e.sign(a),p=o.sign(a),m=await h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new N(e.signingScheme),T.U8(e.publicKey.toUint8Array()),new N(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:yc}});return sn({aptosConfig:t,signer:e,transaction:m})}var fc={typeParameters:[{constraints:[]}],parameters:[new J,new j]};async function Xo(n){let{aptosConfig:t,sender:e,recipient:r,amount:i,coinType:o,options:s}=n;return h({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Gn))],functionArguments:[r,i],abi:fc},options:s})}var an=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Xo({aptosConfig:this.config,...t})}};var Fe={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ue="0x4::token::Token";async function Yo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:uo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Zo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:t,query:{query:Dr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Jo(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:Dr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _114 => _114.offset]),limit:_optionalChain([r, 'optionalAccess', _115 => _115.limit]),order_by:_optionalChain([r, 'optionalAccess', _116 => _116.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function es(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:co,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _117 => _117.offset]),limit:_optionalChain([r, 'optionalAccess', _118 => _118.limit]),order_by:_optionalChain([r, 'optionalAccess', _119 => _119.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Ac={typeParameters:[],parameters:[new y(_()),new j,new y(_()),new y(_()),new M,new M,new M,new M,new M,new M,new M,new M,new M,new j,new j]};async function ts(n){let{aptosConfig:t,options:e,creator:r}=n;return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new O(_nullishCoalesce(n.maxSupply, () => ($e))),new b(n.name),new b(n.uri),new E(_nullishCoalesce(n.mutableDescription, () => (!0))),new E(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new E(_nullishCoalesce(n.mutableURI, () => (!0))),new E(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new E(_nullishCoalesce(n.mutableTokenName, () => (!0))),new E(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new E(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new E(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new E(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Ac},options:e})}async function ti(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:i}=n,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _120 => _120.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _121 => _121.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:t,query:{query:Gr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ns(n){let{aptosConfig:t,collectionId:e}=n,i={collection_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:Gr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function rs(n){return(await ti(n)).collection_id}var hc={typeParameters:[],parameters:[new y(_()),new y(_()),new y(_()),new y(_()),new v(new y(_())),new v(new y(_())),new v(v.u8())]};async function is(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:m}=n,P=_optionalChain([p, 'optionalAccess', _122 => _122.map, 'call', _123 => _123(U=>Fe[U])]);return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(i),new b(o),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(P, () => ([]))),hs(_nullishCoalesce(m, () => ([])),_nullishCoalesce(P, () => ([])))],abi:hc},options:e})}var Tc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new J]};async function os(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(r),u.from(i)],abi:Tc},options:s})}var bc={typeParameters:[],parameters:[new y(_()),new y(_()),new y(_()),new y(_()),new v(new y(_())),new v(new y(_())),new v(v.u8()),new J]};async function ss(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:m,options:P}=n;if(_optionalChain([c, 'optionalAccess', _124 => _124.length])!==_optionalChain([m, 'optionalAccess', _125 => _125.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _126 => _126.length])!==_optionalChain([m, 'optionalAccess', _127 => _127.length]))throw new Error("Property types and property values counts do not match");let U=_optionalChain([p, 'optionalAccess', _128 => _128.map, 'call', _129 => _129(l=>Fe[l])]);return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(U, () => ([]))),hs(_nullishCoalesce(m, () => ([])),_nullishCoalesce(U, () => ([]))),a],abi:bc},options:P})}var wc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0)))]};async function as(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[u.from(r)],abi:wc},options:o})}var Sc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0)))]};async function cs(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:Sc},options:o})}var xc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0)))]};async function us(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:xc},options:o})}var _c={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new y(_())]};async function ps(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:_c},options:s})}var vc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new y(_())]};async function ds(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:vc},options:s})}var Pc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new y(_())]};async function ls(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Pc},options:s})}var Cc={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new y(_()),new y(_()),v.u8()]};async function gs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Fe[i]),T.U8(ni(o,Fe[i]))],abi:Cc},options:c})}var Ec={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new y(_())]};async function ms(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ec},options:s})}var Ic={typeParameters:[{constraints:["key"]}],parameters:[new y(ee(new G(0))),new y(_()),new y(_()),v.u8()]};async function ys(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Fe[i]),ni(o,Fe[i])],abi:Ic},options:c})}var Uc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ee(new G(0))),new y(_()),new G(1)]};async function fs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Fe[i]],functionArguments:[u.from(s),new b(r),o],abi:Uc},options:c})}var Rc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ee(new G(0))),new y(_()),new G(1)]};async function As(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Fe[i]],functionArguments:[u.from(s),new b(r),o],abi:Rc},options:c})}function hs(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(ni(n[i],r))}),e}function ni(n,t){let e=Ue(t);return kt(n,e,0,[]).bcsToBytes()}var cn=class{constructor(t){this.config=t}async getCollectionData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ti({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ns({aptosConfig:this.config,...t})}async getCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),rs({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Yo({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Jo({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),es({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return ts({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return is({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return os({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return ss({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return as({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return cs({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return us({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return ps({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return ds({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return ls({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return gs({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return ms({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return ys({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return fs({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return As({aptosConfig:this.config,...t})}};var Ts=300,zc=n=>{if(n&&n.length>Ts)throw new Error(`Event type length exceeds the maximum length of ${Ts}`)};async function bs(n){let{aptosConfig:t,eventType:e,options:r}=n,o={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:e}},pagination:r,orderBy:_optionalChain([r, 'optionalAccess', _130 => _130.orderBy])};return un({aptosConfig:t,options:o})}async function ws(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:i}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _131 => _131.orderBy])};return un({aptosConfig:e,options:a})}async function Ss(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:i}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _132 => _132.orderBy])};return un({aptosConfig:e,options:a})}async function un(n){let{aptosConfig:t,options:e}=n;zc(_optionalChain([e, 'optionalAccess', _133 => _133.where, 'optionalAccess', _134 => _134.indexed_type, 'optionalAccess', _135 => _135._eq]));let r={query:ro,variables:{where_condition:_optionalChain([e, 'optionalAccess', _136 => _136.where]),offset:_optionalChain([e, 'optionalAccess', _137 => _137.offset]),limit:_optionalChain([e, 'optionalAccess', _138 => _138.limit]),order_by:_optionalChain([e, 'optionalAccess', _139 => _139.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var pn=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),bs({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ws({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Ss({aptosConfig:this.config,...t})}async getEvents(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _140 => _140.minimumLedgerVersion]),processorType:"events_processor"}),un({aptosConfig:this.config,...t})}};async function xs(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _141 => _141.timeoutSecs])||20,{data:s}=await $i({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Gt({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _142 => _142.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var dn=class{constructor(t){this.config=t}async fundAccount(t){let e=await xs({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _143 => _143.options, 'optionalAccess', _144 => _144.waitForIndexer])!==!1&&await Xn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function ri(n){let{aptosConfig:t,options:e}=n,r={query:oo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _145 => _145.where]),limit:_optionalChain([e, 'optionalAccess', _146 => _146.limit]),offset:_optionalChain([e, 'optionalAccess', _147 => _147.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function _s(n){let{aptosConfig:t,options:e}=n,r={query:io,variables:{where_condition:_optionalChain([e, 'optionalAccess', _148 => _148.where]),limit:_optionalChain([e, 'optionalAccess', _149 => _149.limit]),offset:_optionalChain([e, 'optionalAccess', _150 => _150.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function vs(n){let{aptosConfig:t,options:e}=n,r={query:to,variables:{where_condition:_optionalChain([e, 'optionalAccess', _151 => _151.where]),limit:_optionalChain([e, 'optionalAccess', _152 => _152.limit]),offset:_optionalChain([e, 'optionalAccess', _153 => _153.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Gc={typeParameters:[{constraints:[]}],parameters:[Ue("0x1::object::Object"),new J,new j]};async function Ps(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Gc},options:s})}var ln=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _154 => _154.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ri({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _155 => _155.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await ri({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _156 => _156.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),_s({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _157 => _157.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),vs({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Ps({aptosConfig:this.config,...t})}};async function Me(n){let{aptosConfig:t,payload:e,options:r}=n,i=await $o({...e,aptosConfig:t}),o=new W;i.serialize(o);let s=o.toUint8Array(),{data:a}=await ut({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _158 => _158.ledgerVersion])},body:s});return a}var gn=class{constructor(t){this.config=t}async getLedgerInfo(){return $n({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return po({aptosConfig:this.config,...t})}async getBlockByHeight(t){return lo({aptosConfig:this.config,...t})}async view(t){return Me({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return go({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Vn({aptosConfig:this.config})}async getProcessorStatus(t){return Hn({aptosConfig:this.config,processorType:t})}};var Cs=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Es(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function qe(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Es(t))throw new Error(`${t} is not valid. ${Cs}`);if(e&&!Es(e))throw new Error(`${e} is not valid. ${Cs}`);return{domainName:e||t,subdomainName:e?t:void 0}}var kc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Kc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:kc,custom:null,devnet:null};function Re(n){let t=Kc[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var sr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Is(n){let{aptosConfig:t,name:e}=n,r=Re(t),{domainName:i,subdomainName:o}=qe(e),s=await Me({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=sr(s[0]);return a?u.from(a):void 0}async function Us(n){let{aptosConfig:t,expiration:e,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=Re(t),{domainName:m,subdomainName:P}=qe(r),U=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(P&&!U)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(U&&!P)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let lr=_nullishCoalesce(e.years, () => (1));if(lr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Ws=lr*31536e3;return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[m,Ws,o,s]},options:a})}if(!P)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await ii({aptosConfig:t,name:m});if(!l)throw new Error("The domain does not exist");let C=e.policy==="subdomain:independent"?e.expirationDate:l;if(C>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[m,P,Math.round(C/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function ii(n){let{aptosConfig:t,name:e}=n,r=Re(t),{domainName:i,subdomainName:o}=qe(e);try{let s=await Me({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e4){return}}async function Rs(n){let{aptosConfig:t,address:e}=n,r=Re(t),i=await Me({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=sr(i[1]),s=sr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function zs(n){let{aptosConfig:t,sender:e,name:r,options:i}=n,o=Re(t);if(!r)return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=qe(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Gs(n){let{aptosConfig:t,name:e}=n,r=Re(t),{domainName:i,subdomainName:o}=qe(e),s=await Me({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=sr(s[0]);return a?u.from(a):void 0}async function ks(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=Re(t),{domainName:a,subdomainName:c}=qe(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Ks(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:i=""}=qe(e),a=(await f({aptosConfig:t,query:{query:zt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=mn(a)),a}async function Ds(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await oi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _159 => _159.limit]),offset:_optionalChain([e, 'optionalAccess', _160 => _160.offset]),order_by:_optionalChain([e, 'optionalAccess', _161 => _161.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _162 => _162.options, 'optionalAccess', _163 => _163.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(mn)}async function Bs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await oi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _164 => _164.limit]),offset:_optionalChain([e, 'optionalAccess', _165 => _165.offset]),order_by:_optionalChain([e, 'optionalAccess', _166 => _166.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _167 => _167.options, 'optionalAccess', _168 => _168.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(mn)}async function Ns(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await oi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _169 => _169.limit]),offset:_optionalChain([e, 'optionalAccess', _170 => _170.offset]),order_by:_optionalChain([e, 'optionalAccess', _171 => _171.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _172 => _172.options, 'optionalAccess', _173 => _173.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(mn)}async function Os(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:zt,variables:{limit:_optionalChain([e, 'optionalAccess', _174 => _174.limit]),offset:_optionalChain([e, 'optionalAccess', _175 => _175.offset]),order_by:_optionalChain([e, 'optionalAccess', _176 => _176.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _177 => _177.options, 'optionalAccess', _178 => _178.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(mn)}async function oi(n){let{aptosConfig:t}=n,e=Re(t),[r]=await Me({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function Fs(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=Re(t),a=i*31536e3,{domainName:c,subdomainName:p}=qe(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function mn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var yn=class{constructor(t){this.config=t}async getOwnerAddress(t){return Is({aptosConfig:this.config,...t})}async getExpiration(t){return ii({aptosConfig:this.config,...t})}async getTargetAddress(t){return Gs({aptosConfig:this.config,...t})}async setTargetAddress(t){return ks({aptosConfig:this.config,...t})}async getPrimaryName(t){return Rs({aptosConfig:this.config,...t})}async setPrimaryName(t){return zs({aptosConfig:this.config,...t})}async registerName(t){return Us({aptosConfig:this.config,...t})}async renewDomain(t){return Fs({aptosConfig:this.config,...t})}async getName(t){return Ks({aptosConfig:this.config,...t})}async getAccountNames(t){return Ds({aptosConfig:this.config,...t})}async getAccountDomains(t){return Bs({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Ns({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Os({aptosConfig:this.config,...t})}};async function Ms(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:kr,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function qs(n){let{aptosConfig:t,options:e}=n,r={query:kr,variables:{order_by:_optionalChain([e, 'optionalAccess', _179 => _179.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function $s(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:no,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var fn=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _180 => _180.minimumLedgerVersion]),processorType:"stake_processor"}),Ms({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _181 => _181.minimumLedgerVersion]),processorType:"stake_processor"}),qs({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _182 => _182.minimumLedgerVersion]),processorType:"stake_processor"}),$s({aptosConfig:this.config,...t})}};var ar=class{constructor(t){this.config=t}async simple(t){return h({aptosConfig:this.config,...t})}async multiAgent(t){return h({aptosConfig:this.config,...t})}};function si(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},e}function ai(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},e}var Kt=class{constructor(t){this.config=t}async simple(t){return ei({aptosConfig:this.config,...t})}async multiAgent(t){return ei({aptosConfig:this.config,...t})}};_chunkHPZUSDYPjs.a.call(void 0, [ai],Kt.prototype,"simple",1),_chunkHPZUSDYPjs.a.call(void 0, [ai],Kt.prototype,"multiAgent",1);var Dt=class{constructor(t){this.config=t}async simple(t){return or({aptosConfig:this.config,...t})}async multiAgent(t){return or({aptosConfig:this.config,...t})}};_chunkHPZUSDYPjs.a.call(void 0, [si],Dt.prototype,"simple",1),_chunkHPZUSDYPjs.a.call(void 0, [si],Dt.prototype,"multiAgent",1);var cr=()=>Math.floor(Date.now()/1e3),ur= exports.AccountSequenceNumber =class{constructor(t,e,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkHPZUSDYPjs.b.call(void 0, this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=cr();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkHPZUSDYPjs.b.call(void 0, this.sleepTime),cr()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await we({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await we({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkHPZUSDYPjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=cr();for(;this.lastUncommintedNumber!==this.currentNumber;)cr()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkHPZUSDYPjs.b.call(void 0, this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Bt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _183 => _183.pendingDequeue, 'access', _184 => _184.shift, 'call', _185 => _185(), 'optionalAccess', _186 => _186.resolve, 'call', _187 => _187(t)]);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Nt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Nt=class extends Error{};var Vs="fulfilled",Hs= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Hs||{}),pr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(e,r,i=30,o=100,s=10){super();this.taskQueue=new Bt;this.transactionsQueue=new Bt;this.outstandingTransactions=new Bt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new ur(e,r,i,o,s)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let i=sn({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,e])}}catch(e){if(e instanceof Nt)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(e.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),e.push(i),r.push(o);let s=await Promise.allSettled(e);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===Vs?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(e){if(e instanceof Nt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let i=[];i.push(Gt({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Vs?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:e.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var dr=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new pr(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:i}=e;for(let o of r)this.transactionWorker.push(o,i)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:r,data:i,options:o}=e;this.start({sender:r}),this.push({data:i,options:o})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var An=class{constructor(t){this.config=t,this.build=new ar(this.config),this.simulate=new Kt(this.config),this.submit=new Dt(this.config),this.batch=new dr(this.config)}async getTransactions(t){return Uo({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return Ro({aptosConfig:this.config,...t})}async getTransactionByHash(t){return tn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return zo({aptosConfig:this.config,...t})}async waitForTransaction(t){return Gt({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return jn({aptosConfig:this.config})}getSigningMessage(t){return Qo(t)}async publishPackageTransaction(t){return Wo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return jo({aptosConfig:this.config,...t})}sign(t){return ir({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,ir({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:i}=t;this.batch.forSingleAccount({sender:e,data:r,options:i})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return sn({aptosConfig:this.config,signer:e,transaction:r})}};var hn=class{constructor(t){this.config=t}async getTableItem(t){return Ln({aptosConfig:this.config,...t})}async getTableItemsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),mo({aptosConfig:this.config,...t})}async getTableItemsMetadata(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),yo({aptosConfig:this.config,...t})}};async function Ls(n){let{aptosConfig:t}=n;return Oe(async()=>{let e=await Nc(n),r=await Oc(n);return Un.create(r,Number(e.max_exp_horizon_secs))},`keyless-configuration-${t.network}`,1e3*60*5)()}async function Nc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Configuration",{data:i}=await q({aptosConfig:t,originMethod:"getKeylessConfiguration",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _188 => _188.ledgerVersion])}});return i.data}async function Oc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await q({aptosConfig:t,originMethod:"getGroth16VerificationKey",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _189 => _189.ledgerVersion])}});return i.data}async function ci(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,uidKey:i,derivationPath:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i||"sub",derivation_path:o},{data:a}=await Vi({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function Fc(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i,uidKey:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:$t,pepper:g.fromHexInput(i).toStringWithoutPrefix(),uid_key:o||"sub"};console.log(JSON.stringify(s));let{data:a}=await Hi({aptosConfig:t,path:"prove",body:s,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),c=a.proof,p=new yt({a:c.a,b:c.b,c:c.c});return new Ce({proof:new et(p,0),trainingWheelsSignature:ae.fromHex(a.training_wheels_signature)})}async function Qs(n){let{proofFetchCallback:t}=n,{pepper:e}=n;if(e===void 0?e=await ci(n):e=g.fromHexInput(e).toUint8Array(),e.length!==be.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${be.PEPPER_LENGTH} bytes`);let r=Fc({...n,pepper:e}),i=t?r:await r;return be.fromJWTAndProof({...n,proof:i,pepper:e,proofFetchCallback:t})}var Tn=class{constructor(t){this.config=t}async getKeylessConfig(t){return Ls({aptosConfig:this.config,options:t})}async getPepper(t){return ci({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return Qs({aptosConfig:this.config,...t})}};var X=class{constructor(t){this.config=new Yn(t),this.account=new nn(this.config),this.ans=new yn(this.config),this.coin=new an(this.config),this.digitalAsset=new cn(this.config),this.event=new pn(this.config),this.faucet=new dn(this.config),this.fungibleAsset=new ln(this.config),this.general=new gn(this.config),this.staking=new fn(this.config),this.transaction=new An(this.config),this.table=new hn(this.config),this.keyless=new Tn(this.config)}};function pe(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(t.prototype,r);i&&(i.value=function(...o){return this[e][r](...o)},Object.defineProperty(n.prototype,r,i))})}pe(X,nn,"account");pe(X,yn,"ans");pe(X,an,"coin");pe(X,cn,"digitalAsset");pe(X,pn,"event");pe(X,dn,"faucet");pe(X,ln,"fungibleAsset");pe(X,gn,"general");pe(X,fn,"staking");pe(X,An,"transaction");pe(X,hn,"table");pe(X,Tn,"keyless");exports.APTOS_BIP44_REGEX = ca; exports.APTOS_COIN = Gn; exports.APTOS_HARDENED_REGEX = aa; exports.Account = Be; exports.AccountAddress = u; exports.AccountAuthenticator = V; exports.AccountAuthenticatorEd25519 = me; exports.AccountAuthenticatorMultiEd25519 = Rn; exports.AccountAuthenticatorMultiKey = nt; exports.AccountAuthenticatorSingleKey = H; exports.AccountAuthenticatorVariant = fi; exports.AccountPublicKey = ie; exports.AccountSequenceNumber = ur; exports.AddressInvalidReason = ra; exports.AnyPublicKey = k; exports.AnyPublicKeyVariant = mr; exports.AnySignature = D; exports.AnySignatureVariant = Ai; exports.Aptos = X; exports.AptosApiError = ye; exports.AptosApiType = Vt; exports.AptosConfig = Yn; exports.AuthenticationKey = F; exports.Bool = E; exports.CKDPriv = vi; exports.ChainId = At; exports.DEFAULT_MAX_GAS_AMOUNT = Gi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = ki; exports.DEFAULT_TXN_TIMEOUT_SEC = zn; exports.DeriveScheme = ta; exports.Deserializer = te; exports.EPK_HORIZON_SECS = $t; exports.Ed25519Account = Et; exports.Ed25519PrivateKey = $; exports.Ed25519PublicKey = x; exports.Ed25519Signature = S; exports.EntryFunction = ot; exports.EntryFunctionBytes = xn; exports.EphemeralCertificate = Ye; exports.EphemeralCertificateVariant = fr; exports.EphemeralKeyPair = Jt; exports.EphemeralPublicKey = De; exports.EphemeralPublicKeyVariant = yr; exports.EphemeralSignature = ae; exports.EphemeralSignatureVariant = hi; exports.FeePayerRawTransaction = at; exports.FixedBytes = He; exports.Groth16Zkp = yt; exports.HARDENED_OFFSET = Si; exports.Hex = g; exports.HexInvalidReason = Ys; exports.Identifier = R; exports.IssuerToJwkEndpoint = ty; exports.KeyType = ua; exports.KeylessAccount = be; exports.KeylessConfiguration = Un; exports.KeylessPublicKey = ge; exports.KeylessSignature = Je; exports.MAX_AUD_VAL_BYTES = ka; exports.MAX_COMMITED_EPK_BYTES = vd; exports.MAX_EXTRA_FIELD_BYTES = xd; exports.MAX_ISS_VAL_BYTES = Sd; exports.MAX_JWT_HEADER_B64_BYTES = _d; exports.MAX_UID_KEY_BYTES = Ka; exports.MAX_UID_VAL_BYTES = Da; exports.MimeType = _n; exports.ModuleId = Ht; exports.MoveAbility = Ti; exports.MoveFunctionVisibility = Js; exports.MoveOption = ke; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = st; exports.MultiAgentTransaction = Nn; exports.MultiEd25519PublicKey = gt; exports.MultiEd25519Signature = We; exports.MultiKey = ft; exports.MultiKeyAccount = Fn; exports.MultiKeySignature = tt; exports.MultiSig = Xt; exports.MultiSigTransactionPayload = Yt; exports.Network = Ur; exports.NetworkToChainId = Rr; exports.NetworkToFaucetAPI = Oi; exports.NetworkToIndexerAPI = Bi; exports.NetworkToNetworkName = Ty; exports.NetworkToNodeAPI = Ni; exports.NetworkToPepperAPI = Er; exports.NetworkToProverAPI = Ir; exports.ParsingError = Q; exports.ProcessorType = rt; exports.PublicKey = Le; exports.RAW_TRANSACTION_SALT = Ki; exports.RAW_TRANSACTION_WITH_DATA_SALT = _r; exports.RawTransaction = ce; exports.RawTransactionWithData = Kn; exports.RoleType = ea; exports.RotationProofChallenge = Dn; exports.Script = jt; exports.ScriptTransactionArgumentVariants = Ft; exports.Secp256k1PrivateKey = Xe; exports.Secp256k1PublicKey = he; exports.Secp256k1Signature = _e; exports.Serializable = d; exports.Serializer = W; exports.Signature = K; exports.SignedTransaction = ct; exports.SigningScheme = fe; exports.SigningSchemeInput = Tr; exports.SimpleTransaction = Bn; exports.SingleKeyAccount = It; exports.StructTag = Ee; exports.TransactionAndProof = Cr; exports.TransactionAuthenticator = Ie; exports.TransactionAuthenticatorEd25519 = xt; exports.TransactionAuthenticatorFeePayer = vt; exports.TransactionAuthenticatorMultiAgent = _t; exports.TransactionAuthenticatorMultiEd25519 = vr; exports.TransactionAuthenticatorSingleSender = Pt; exports.TransactionAuthenticatorVariant = yi; exports.TransactionPayload = it; exports.TransactionPayloadEntryFunction = Qt; exports.TransactionPayloadMultiSig = Wt; exports.TransactionPayloadScript = Lt; exports.TransactionPayloadVariants = gi; exports.TransactionResponseType = hr; exports.TransactionVariants = mi; exports.TransactionWorker = pr; exports.TransactionWorkerEventsEnum = Hs; exports.TypeTag = z; exports.TypeTagAddress = J; exports.TypeTagBool = M; exports.TypeTagGeneric = G; exports.TypeTagParserError = B; exports.TypeTagParserErrorType = ec; exports.TypeTagReference = kn; exports.TypeTagSigner = St; exports.TypeTagStruct = y; exports.TypeTagU128 = bt; exports.TypeTagU16 = ht; exports.TypeTagU256 = wt; exports.TypeTagU32 = Tt; exports.TypeTagU64 = j; exports.TypeTagU8 = Te; exports.TypeTagVariants = li; exports.TypeTagVector = v; exports.U128 = de; exports.U16 = ne; exports.U256 = le; exports.U32 = re; exports.U64 = O; exports.U8 = N; exports.ZeroKnowledgeSig = Ce; exports.ZkProof = et; exports.ZkpVariant = Ar; exports.aptosCoinStructTag = Kl; exports.aptosRequest = Mn; exports.buildTransaction = Zr; exports.checkOrConvertArgument = kt; exports.convertArgument = Yr; exports.deriveKey = br; exports.deriveTransactionType = Pr; exports.deserializeFromScriptArgument = Na; exports.ensureBoolean = gr; exports.fetchEntryFunctionAbi = Mo; exports.fetchFunctionAbi = Fo; exports.fetchViewFunctionAbi = qo; exports.findFirstNonSignerArg = Oo; exports.generateRawTransaction = cc; exports.generateSignedTransaction = Jr; exports.generateSignedTransactionForSimulation = Vo; exports.generateSigningMessage = Zt; exports.generateSigningMessageForTransaction = Ct; exports.generateTransactionPayload = rr; exports.generateTransactionPayloadWithABI = oc; exports.generateUserTransactionHash = vA; exports.generateViewFunctionPayload = $o; exports.generateViewFunctionPayloadWithABI = sc; exports.get = zr; exports.getAptosFullNode = q; exports.getAptosPepperService = My; exports.getAuthenticatorForSimulation = nr; exports.getFunctionParts = on; exports.hashValues = Ho; exports.isBcsAddress = er; exports.isBcsBool = qr; exports.isBcsFixedBytes = tc; exports.isBcsString = $r; exports.isBcsU128 = Wr; exports.isBcsU16 = Hr; exports.isBcsU256 = jr; exports.isBcsU32 = Lr; exports.isBcsU64 = Qr; exports.isBcsU8 = Vr; exports.isBlockMetadataTransactionResponse = lu; exports.isBool = Ko; exports.isEd25519Signature = yu; exports.isEncodedEntryFunctionArgument = Bo; exports.isFeePayerSignature = hu; exports.isGenesisTransactionResponse = du; exports.isLargeNumber = Jn; exports.isMultiAgentSignature = Au; exports.isMultiEd25519Signature = Tu; exports.isNull = Do; exports.isNumber = Zn; exports.isPendingTransactionResponse = uu; exports.isScriptDataInput = No; exports.isSecp256k1Signature = fu; exports.isStateCheckpointTransactionResponse = gu; exports.isString = Se; exports.isUserTransactionResponse = pu; exports.isValidBIP44Path = xi; exports.isValidHardenedPath = _i; exports.isValidatorTransactionResponse = mu; exports.mnemonicToSeed = vn; exports.normalizeBundle = Fi; exports.objectStructTag = ee; exports.optionStructTag = Dl; exports.outOfRangeErrorMessage = Zs; exports.paginateWithCursor = Rt; exports.parseTypeTag = Ue; exports.post = en; exports.postAptosFaucet = $i; exports.postAptosFullNode = ut; exports.postAptosIndexer = qi; exports.postAptosPepperService = Vi; exports.postAptosProvingService = Hi; exports.promiseFulfilledStatus = Vs; exports.request = Va; exports.splitPath = Pi; exports.standardizeTypeTags = tr; exports.stringStructTag = _; exports.throwTypeMismatch = I; exports.validateNumberInRange = Ge;
458
458
  //# sourceMappingURL=index.js.map