@aptos-labs/ts-sdk 1.13.3-zeta.3 → 1.14.0-zeta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (288) hide show
  1. package/dist/common/accountAddress-NPQwRmxn.d.ts +2121 -0
  2. package/dist/common/cli/index.d.ts +94 -1
  3. package/dist/common/cli/index.js +1 -1
  4. package/dist/common/cli/index.js.map +1 -1
  5. package/dist/common/index.d.ts +243 -2236
  6. package/dist/common/index.js +25 -25
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/{Ed25519Account-8gJF5t3F.d.mts → Ed25519Account-9zBaZEnp.d.mts} +76 -7
  9. package/dist/esm/account/Account.d.mts +1 -1
  10. package/dist/esm/account/Account.mjs +1 -1
  11. package/dist/esm/account/Ed25519Account.d.mts +1 -1
  12. package/dist/esm/account/Ed25519Account.mjs +1 -1
  13. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  14. package/dist/esm/account/KeylessAccount.d.mts +5 -4
  15. package/dist/esm/account/KeylessAccount.mjs +1 -1
  16. package/dist/esm/account/MultiKeyAccount.d.mts +67 -32
  17. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  18. package/dist/esm/account/SingleKeyAccount.d.mts +1 -1
  19. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  20. package/dist/esm/account/index.d.mts +4 -4
  21. package/dist/esm/account/index.mjs +1 -1
  22. package/dist/esm/api/account.d.mts +1 -1
  23. package/dist/esm/api/account.mjs +1 -1
  24. package/dist/esm/api/ans.d.mts +1 -1
  25. package/dist/esm/api/ans.mjs +1 -1
  26. package/dist/esm/api/aptos.d.mts +3 -3
  27. package/dist/esm/api/aptos.mjs +1 -1
  28. package/dist/esm/api/aptosConfig.mjs +1 -1
  29. package/dist/esm/api/coin.mjs +1 -1
  30. package/dist/esm/api/digitalAsset.d.mts +1 -1
  31. package/dist/esm/api/digitalAsset.mjs +1 -1
  32. package/dist/esm/api/event.mjs +1 -1
  33. package/dist/esm/api/faucet.mjs +1 -1
  34. package/dist/esm/api/fungibleAsset.d.mts +1 -1
  35. package/dist/esm/api/fungibleAsset.mjs +1 -1
  36. package/dist/esm/api/general.mjs +1 -1
  37. package/dist/esm/api/index.d.mts +3 -3
  38. package/dist/esm/api/index.mjs +1 -1
  39. package/dist/esm/api/keyless.d.mts +8 -8
  40. package/dist/esm/api/keyless.mjs +1 -1
  41. package/dist/esm/api/staking.mjs +1 -1
  42. package/dist/esm/api/transaction.d.mts +1 -1
  43. package/dist/esm/api/transaction.mjs +1 -1
  44. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  45. package/dist/esm/api/transactionSubmission/management.d.mts +1 -1
  46. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  47. package/dist/esm/api/transactionSubmission/sign.d.mts +1 -1
  48. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  49. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  50. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  51. package/dist/esm/api/utils.mjs +1 -1
  52. package/dist/esm/{chunk-5U2HUO5I.mjs → chunk-25N7RLBW.mjs} +2 -2
  53. package/dist/esm/{chunk-5U2HUO5I.mjs.map → chunk-25N7RLBW.mjs.map} +1 -1
  54. package/dist/esm/chunk-32355KGV.mjs +2 -0
  55. package/dist/esm/chunk-32355KGV.mjs.map +1 -0
  56. package/dist/esm/{chunk-DBHUQJV6.mjs → chunk-3OELNIC6.mjs} +2 -2
  57. package/dist/esm/chunk-3U5VRZLS.mjs +2 -0
  58. package/dist/esm/{chunk-S5HG2QUD.mjs.map → chunk-3U5VRZLS.mjs.map} +1 -1
  59. package/dist/esm/chunk-43WARVT3.mjs +2 -0
  60. package/dist/esm/{chunk-PGN46FRK.mjs.map → chunk-43WARVT3.mjs.map} +1 -1
  61. package/dist/esm/chunk-56NB52W6.mjs +2 -0
  62. package/dist/esm/chunk-56NB52W6.mjs.map +1 -0
  63. package/dist/esm/{chunk-ZB4QCXPI.mjs → chunk-5DW2AJPI.mjs} +2 -2
  64. package/dist/esm/{chunk-ID5XEMNJ.mjs → chunk-5QWUIVAQ.mjs} +2 -2
  65. package/dist/esm/{chunk-WTVN3XGK.mjs → chunk-6456EI2E.mjs} +2 -2
  66. package/dist/esm/{chunk-DCALFAYP.mjs → chunk-65UZZNN2.mjs} +2 -2
  67. package/dist/esm/{chunk-EEZ7W4FY.mjs → chunk-6LOTZ4GY.mjs} +2 -2
  68. package/dist/esm/{chunk-DFWISQYQ.mjs → chunk-6SHLLRJA.mjs} +2 -2
  69. package/dist/esm/{chunk-NJAV2RSI.mjs → chunk-73Y4NTDU.mjs} +2 -2
  70. package/dist/esm/chunk-7PSX4LCV.mjs +2 -0
  71. package/dist/esm/{chunk-IY76OUEM.mjs.map → chunk-7PSX4LCV.mjs.map} +1 -1
  72. package/dist/esm/chunk-7Q2NVO5M.mjs +2 -0
  73. package/dist/esm/chunk-7Q2NVO5M.mjs.map +1 -0
  74. package/dist/esm/chunk-C5UVSNZW.mjs +2 -0
  75. package/dist/esm/chunk-C5UVSNZW.mjs.map +1 -0
  76. package/dist/esm/{chunk-JDYILQSI.mjs → chunk-CLVAGDXO.mjs} +2 -2
  77. package/dist/esm/{chunk-Q5YW4VKH.mjs → chunk-D22EMNIY.mjs} +2 -2
  78. package/dist/esm/{chunk-X5HARDBD.mjs → chunk-DLTC6PJP.mjs} +2 -2
  79. package/dist/esm/{chunk-UIHUFI4D.mjs → chunk-EKABTHUZ.mjs} +2 -2
  80. package/dist/esm/chunk-EOMDZYSJ.mjs +2 -0
  81. package/dist/esm/chunk-EOMDZYSJ.mjs.map +1 -0
  82. package/dist/esm/{chunk-OEGY3D5Z.mjs → chunk-FKSACFCB.mjs} +2 -2
  83. package/dist/esm/{chunk-7NX7LTJJ.mjs → chunk-G4XSNSOT.mjs} +2 -2
  84. package/dist/esm/{chunk-I5NLKA3M.mjs → chunk-H3TFQ7K4.mjs} +2 -2
  85. package/dist/esm/{chunk-6M6XXPQQ.mjs → chunk-H6LYW7HG.mjs} +2 -2
  86. package/dist/esm/{chunk-R7BAM2G6.mjs → chunk-HCGWCB5E.mjs} +2 -2
  87. package/dist/esm/{chunk-XHPLLMR5.mjs → chunk-HXSW6X7K.mjs} +2 -2
  88. package/dist/esm/{chunk-QW55WEXU.mjs → chunk-IXYXFDJZ.mjs} +2 -2
  89. package/dist/esm/{chunk-J7BN4K72.mjs → chunk-J7J7ZTBF.mjs} +2 -2
  90. package/dist/esm/chunk-JVKMQ64G.mjs +2 -0
  91. package/dist/esm/{chunk-ALPPGXXW.mjs.map → chunk-JVKMQ64G.mjs.map} +1 -1
  92. package/dist/esm/{chunk-TISS3UCO.mjs → chunk-KWNBC5MF.mjs} +2 -2
  93. package/dist/esm/chunk-LDQ6JFEF.mjs +2 -0
  94. package/dist/esm/chunk-LDQ6JFEF.mjs.map +1 -0
  95. package/dist/esm/chunk-NGNETNK2.mjs +2 -0
  96. package/dist/esm/chunk-NGNETNK2.mjs.map +1 -0
  97. package/dist/esm/{chunk-EJPL4WP3.mjs → chunk-NKCZ4KGO.mjs} +2 -2
  98. package/dist/esm/chunk-NMECYE3D.mjs +2 -0
  99. package/dist/esm/chunk-NMECYE3D.mjs.map +1 -0
  100. package/dist/esm/{chunk-IERPDC22.mjs → chunk-NNW6HWIO.mjs} +2 -2
  101. package/dist/esm/{chunk-ZGTJMNZG.mjs → chunk-O34EOOVF.mjs} +2 -2
  102. package/dist/esm/{chunk-7JNPSNL6.mjs → chunk-OBEVVLF7.mjs} +2 -2
  103. package/dist/esm/{chunk-Z2ZV7SJI.mjs → chunk-OLGSIKFB.mjs} +2 -2
  104. package/dist/esm/{chunk-3X7RN4TM.mjs → chunk-OZC3FCJP.mjs} +2 -2
  105. package/dist/esm/{chunk-XQ2CSNQG.mjs → chunk-PINF6ZWP.mjs} +2 -2
  106. package/dist/esm/{chunk-DMKFITUM.mjs → chunk-PJXRQBF6.mjs} +2 -2
  107. package/dist/esm/{chunk-VIJBWYHD.mjs → chunk-QHVZL3LZ.mjs} +2 -2
  108. package/dist/esm/{chunk-MHANMSFM.mjs → chunk-QNHDS64I.mjs} +2 -2
  109. package/dist/esm/{chunk-5UDWQC3F.mjs → chunk-RBPGL6YB.mjs} +2 -2
  110. package/dist/esm/{chunk-4Z22B5FW.mjs → chunk-RTSEMQCK.mjs} +2 -2
  111. package/dist/esm/{chunk-5CY6DMOC.mjs → chunk-SRPTQ4VV.mjs} +2 -2
  112. package/dist/esm/{chunk-FEXAWES4.mjs → chunk-TXMPXZBG.mjs} +2 -2
  113. package/dist/esm/{chunk-H7A56KXV.mjs → chunk-UGIJHLL3.mjs} +2 -2
  114. package/dist/esm/{chunk-PTIZKRON.mjs → chunk-UVOU6BW2.mjs} +2 -2
  115. package/dist/esm/{chunk-C7ZUHEPR.mjs → chunk-V7P6MLSY.mjs} +2 -2
  116. package/dist/esm/{chunk-XVHMGCDZ.mjs → chunk-VJJN3GFD.mjs} +2 -2
  117. package/dist/esm/{chunk-FJTNAGMR.mjs → chunk-WOLIXKOK.mjs} +2 -2
  118. package/dist/esm/{chunk-YXRZEUT6.mjs → chunk-WVIPPU2C.mjs} +2 -2
  119. package/dist/esm/chunk-XCR3YNHW.mjs +2 -0
  120. package/dist/esm/chunk-XCR3YNHW.mjs.map +1 -0
  121. package/dist/esm/{chunk-SWIHAMDH.mjs → chunk-XMFPKHB5.mjs} +2 -2
  122. package/dist/esm/{chunk-WPVBC4JS.mjs → chunk-XN4SQWI5.mjs} +2 -2
  123. package/dist/esm/chunk-XN4SQWI5.mjs.map +1 -0
  124. package/dist/esm/{chunk-PEUK5XJE.mjs → chunk-Z5KKUXYI.mjs} +2 -2
  125. package/dist/esm/chunk-ZM436N3W.mjs +2 -0
  126. package/dist/esm/chunk-ZM436N3W.mjs.map +1 -0
  127. package/dist/esm/cli/index.d.mts +12 -0
  128. package/dist/esm/cli/index.mjs +1 -1
  129. package/dist/esm/cli/move.d.mts +105 -0
  130. package/dist/esm/cli/move.mjs +2 -0
  131. package/dist/esm/cli/move.mjs.map +1 -0
  132. package/dist/esm/client/core.mjs +1 -1
  133. package/dist/esm/client/get.mjs +1 -1
  134. package/dist/esm/client/index.mjs +1 -1
  135. package/dist/esm/client/post.mjs +1 -1
  136. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  137. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  138. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  139. package/dist/esm/core/crypto/index.d.mts +1 -1
  140. package/dist/esm/core/crypto/index.mjs +1 -1
  141. package/dist/esm/core/crypto/keyless.mjs +1 -1
  142. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  143. package/dist/esm/core/crypto/multiKey.d.mts +9 -3
  144. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  145. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  146. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  147. package/dist/esm/core/index.d.mts +1 -1
  148. package/dist/esm/core/index.mjs +1 -1
  149. package/dist/esm/index.d.mts +5 -5
  150. package/dist/esm/index.mjs +1 -1
  151. package/dist/esm/internal/account.d.mts +1 -1
  152. package/dist/esm/internal/account.mjs +1 -1
  153. package/dist/esm/internal/ans.d.mts +1 -1
  154. package/dist/esm/internal/ans.mjs +1 -1
  155. package/dist/esm/internal/coin.mjs +1 -1
  156. package/dist/esm/internal/digitalAsset.d.mts +1 -1
  157. package/dist/esm/internal/digitalAsset.mjs +1 -1
  158. package/dist/esm/internal/event.mjs +1 -1
  159. package/dist/esm/internal/faucet.mjs +1 -1
  160. package/dist/esm/internal/fungibleAsset.d.mts +1 -1
  161. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  162. package/dist/esm/internal/general.mjs +1 -1
  163. package/dist/esm/internal/keyless.d.mts +2 -2
  164. package/dist/esm/internal/keyless.mjs +1 -1
  165. package/dist/esm/internal/staking.mjs +1 -1
  166. package/dist/esm/internal/transaction.mjs +1 -1
  167. package/dist/esm/internal/transactionSubmission.d.mts +1 -1
  168. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  169. package/dist/esm/internal/view.mjs +1 -1
  170. package/dist/esm/transactions/authenticator/account.d.mts +3 -3
  171. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  172. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  173. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  174. package/dist/esm/transactions/index.d.mts +1 -1
  175. package/dist/esm/transactions/index.mjs +1 -1
  176. package/dist/esm/transactions/instances/index.mjs +1 -1
  177. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  178. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  179. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  180. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  181. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  182. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  183. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +1 -1
  184. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  185. package/dist/esm/transactions/management/index.d.mts +1 -1
  186. package/dist/esm/transactions/management/index.mjs +1 -1
  187. package/dist/esm/transactions/management/transactionWorker.d.mts +1 -1
  188. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  189. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  190. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  191. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  192. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  193. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +26 -1
  194. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  195. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -13
  196. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  197. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  198. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  199. package/dist/esm/utils/apiEndpoints.d.mts +0 -1
  200. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  201. package/dist/esm/utils/index.mjs +1 -1
  202. package/dist/esm/version.d.mts +1 -1
  203. package/dist/esm/version.mjs +1 -1
  204. package/package.json +1 -1
  205. package/src/account/Account.ts +19 -5
  206. package/src/account/Ed25519Account.ts +35 -5
  207. package/src/account/KeylessAccount.ts +11 -7
  208. package/src/account/MultiKeyAccount.ts +95 -32
  209. package/src/account/SingleKeyAccount.ts +35 -5
  210. package/src/account/index.ts +1 -1
  211. package/src/cli/index.ts +1 -0
  212. package/src/cli/move.ts +183 -0
  213. package/src/core/crypto/hdKey.ts +5 -5
  214. package/src/core/crypto/multiKey.ts +18 -17
  215. package/src/internal/ans.ts +0 -1
  216. package/src/internal/fungibleAsset.ts +1 -1
  217. package/src/internal/transactionSubmission.ts +1 -1
  218. package/src/transactions/authenticator/account.ts +4 -4
  219. package/src/transactions/transactionBuilder/signingMessage.ts +33 -10
  220. package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -51
  221. package/src/utils/apiEndpoints.ts +0 -6
  222. package/src/version.ts +1 -1
  223. package/dist/esm/chunk-5RBI4QWR.mjs +0 -2
  224. package/dist/esm/chunk-5RBI4QWR.mjs.map +0 -1
  225. package/dist/esm/chunk-ALPPGXXW.mjs +0 -2
  226. package/dist/esm/chunk-CHBG3GY5.mjs +0 -2
  227. package/dist/esm/chunk-CHBG3GY5.mjs.map +0 -1
  228. package/dist/esm/chunk-HHYQZBJO.mjs +0 -2
  229. package/dist/esm/chunk-HHYQZBJO.mjs.map +0 -1
  230. package/dist/esm/chunk-IY76OUEM.mjs +0 -2
  231. package/dist/esm/chunk-KGJITNRZ.mjs +0 -2
  232. package/dist/esm/chunk-KGJITNRZ.mjs.map +0 -1
  233. package/dist/esm/chunk-LIPZPOQG.mjs +0 -2
  234. package/dist/esm/chunk-LIPZPOQG.mjs.map +0 -1
  235. package/dist/esm/chunk-PGN46FRK.mjs +0 -2
  236. package/dist/esm/chunk-PXIIS7JA.mjs +0 -2
  237. package/dist/esm/chunk-PXIIS7JA.mjs.map +0 -1
  238. package/dist/esm/chunk-S5HG2QUD.mjs +0 -2
  239. package/dist/esm/chunk-UQ65W433.mjs +0 -2
  240. package/dist/esm/chunk-UQ65W433.mjs.map +0 -1
  241. package/dist/esm/chunk-WPVBC4JS.mjs.map +0 -1
  242. package/dist/esm/chunk-XS4XZVGH.mjs +0 -2
  243. package/dist/esm/chunk-XS4XZVGH.mjs.map +0 -1
  244. package/dist/esm/chunk-ZADLGPN7.mjs +0 -2
  245. package/dist/esm/chunk-ZADLGPN7.mjs.map +0 -1
  246. /package/dist/esm/{chunk-DBHUQJV6.mjs.map → chunk-3OELNIC6.mjs.map} +0 -0
  247. /package/dist/esm/{chunk-ZB4QCXPI.mjs.map → chunk-5DW2AJPI.mjs.map} +0 -0
  248. /package/dist/esm/{chunk-ID5XEMNJ.mjs.map → chunk-5QWUIVAQ.mjs.map} +0 -0
  249. /package/dist/esm/{chunk-WTVN3XGK.mjs.map → chunk-6456EI2E.mjs.map} +0 -0
  250. /package/dist/esm/{chunk-DCALFAYP.mjs.map → chunk-65UZZNN2.mjs.map} +0 -0
  251. /package/dist/esm/{chunk-EEZ7W4FY.mjs.map → chunk-6LOTZ4GY.mjs.map} +0 -0
  252. /package/dist/esm/{chunk-DFWISQYQ.mjs.map → chunk-6SHLLRJA.mjs.map} +0 -0
  253. /package/dist/esm/{chunk-NJAV2RSI.mjs.map → chunk-73Y4NTDU.mjs.map} +0 -0
  254. /package/dist/esm/{chunk-JDYILQSI.mjs.map → chunk-CLVAGDXO.mjs.map} +0 -0
  255. /package/dist/esm/{chunk-Q5YW4VKH.mjs.map → chunk-D22EMNIY.mjs.map} +0 -0
  256. /package/dist/esm/{chunk-X5HARDBD.mjs.map → chunk-DLTC6PJP.mjs.map} +0 -0
  257. /package/dist/esm/{chunk-UIHUFI4D.mjs.map → chunk-EKABTHUZ.mjs.map} +0 -0
  258. /package/dist/esm/{chunk-OEGY3D5Z.mjs.map → chunk-FKSACFCB.mjs.map} +0 -0
  259. /package/dist/esm/{chunk-7NX7LTJJ.mjs.map → chunk-G4XSNSOT.mjs.map} +0 -0
  260. /package/dist/esm/{chunk-I5NLKA3M.mjs.map → chunk-H3TFQ7K4.mjs.map} +0 -0
  261. /package/dist/esm/{chunk-6M6XXPQQ.mjs.map → chunk-H6LYW7HG.mjs.map} +0 -0
  262. /package/dist/esm/{chunk-R7BAM2G6.mjs.map → chunk-HCGWCB5E.mjs.map} +0 -0
  263. /package/dist/esm/{chunk-XHPLLMR5.mjs.map → chunk-HXSW6X7K.mjs.map} +0 -0
  264. /package/dist/esm/{chunk-QW55WEXU.mjs.map → chunk-IXYXFDJZ.mjs.map} +0 -0
  265. /package/dist/esm/{chunk-J7BN4K72.mjs.map → chunk-J7J7ZTBF.mjs.map} +0 -0
  266. /package/dist/esm/{chunk-TISS3UCO.mjs.map → chunk-KWNBC5MF.mjs.map} +0 -0
  267. /package/dist/esm/{chunk-EJPL4WP3.mjs.map → chunk-NKCZ4KGO.mjs.map} +0 -0
  268. /package/dist/esm/{chunk-IERPDC22.mjs.map → chunk-NNW6HWIO.mjs.map} +0 -0
  269. /package/dist/esm/{chunk-ZGTJMNZG.mjs.map → chunk-O34EOOVF.mjs.map} +0 -0
  270. /package/dist/esm/{chunk-7JNPSNL6.mjs.map → chunk-OBEVVLF7.mjs.map} +0 -0
  271. /package/dist/esm/{chunk-Z2ZV7SJI.mjs.map → chunk-OLGSIKFB.mjs.map} +0 -0
  272. /package/dist/esm/{chunk-3X7RN4TM.mjs.map → chunk-OZC3FCJP.mjs.map} +0 -0
  273. /package/dist/esm/{chunk-XQ2CSNQG.mjs.map → chunk-PINF6ZWP.mjs.map} +0 -0
  274. /package/dist/esm/{chunk-DMKFITUM.mjs.map → chunk-PJXRQBF6.mjs.map} +0 -0
  275. /package/dist/esm/{chunk-VIJBWYHD.mjs.map → chunk-QHVZL3LZ.mjs.map} +0 -0
  276. /package/dist/esm/{chunk-MHANMSFM.mjs.map → chunk-QNHDS64I.mjs.map} +0 -0
  277. /package/dist/esm/{chunk-5UDWQC3F.mjs.map → chunk-RBPGL6YB.mjs.map} +0 -0
  278. /package/dist/esm/{chunk-4Z22B5FW.mjs.map → chunk-RTSEMQCK.mjs.map} +0 -0
  279. /package/dist/esm/{chunk-5CY6DMOC.mjs.map → chunk-SRPTQ4VV.mjs.map} +0 -0
  280. /package/dist/esm/{chunk-FEXAWES4.mjs.map → chunk-TXMPXZBG.mjs.map} +0 -0
  281. /package/dist/esm/{chunk-H7A56KXV.mjs.map → chunk-UGIJHLL3.mjs.map} +0 -0
  282. /package/dist/esm/{chunk-PTIZKRON.mjs.map → chunk-UVOU6BW2.mjs.map} +0 -0
  283. /package/dist/esm/{chunk-C7ZUHEPR.mjs.map → chunk-V7P6MLSY.mjs.map} +0 -0
  284. /package/dist/esm/{chunk-XVHMGCDZ.mjs.map → chunk-VJJN3GFD.mjs.map} +0 -0
  285. /package/dist/esm/{chunk-FJTNAGMR.mjs.map → chunk-WOLIXKOK.mjs.map} +0 -0
  286. /package/dist/esm/{chunk-YXRZEUT6.mjs.map → chunk-WVIPPU2C.mjs.map} +0 -0
  287. /package/dist/esm/{chunk-SWIHAMDH.mjs.map → chunk-XMFPKHB5.mjs.map} +0 -0
  288. /package/dist/esm/{chunk-PEUK5XJE.mjs.map → chunk-Z5KKUXYI.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 _chunkKSEUZTKYjs = require('./chunk-KSEUZTKY.js');var mn=255,yn=65535,be=4294967295,qe=18446744073709551615n,Ot=340282366920938463463374607431768211455n,fn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var ge=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)}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<be;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>be)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 zs=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(zs||{}),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 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 D;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},D= 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){ur(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(be),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&qe,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))}};_chunkKSEUZTKYjs.a.call(void 0, [$e(0,mn)],D.prototype,"serializeU8",1),_chunkKSEUZTKYjs.a.call(void 0, [$e(0,yn)],D.prototype,"serializeU16",1),_chunkKSEUZTKYjs.a.call(void 0, [$e(0,be)],D.prototype,"serializeU32",1),_chunkKSEUZTKYjs.a.call(void 0, [$e(BigInt(0),qe)],D.prototype,"serializeU64",1),_chunkKSEUZTKYjs.a.call(void 0, [$e(BigInt(0),Ot)],D.prototype,"serializeU128",1),_chunkKSEUZTKYjs.a.call(void 0, [$e(BigInt(0),fn)],D.prototype,"serializeU256",1),_chunkKSEUZTKYjs.a.call(void 0, [$e(0,be)],D.prototype,"serializeU32AsUleb128",1);function ur(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ks=(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(ks(n,t,e))}function $e(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 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 An=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 hn=(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))(hn||{}),ei= 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))(ei||{}),Nt= 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))(Nt||{}),ti= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(ti||{}),ni= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(ni||{}),ri= 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))(ri||{}),ii= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(ii||{}),pr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(pr||{}),oi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(oi||{}),dr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(dr||{}),si= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(si||{}),ai= exports.EphemeralCertificate =(e=>(e[e.ZkProof=0]="ZkProof",e[e.OpenIdSignature=1]="OpenIdSignature",e))(ai||{}),lr= 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))(lr||{});function Qc(n){return n.type==="pending_transaction"}function Wc(n){return n.type==="user_transaction"}function jc(n){return n.type==="genesis_transaction"}function Xc(n){return n.type==="block_metadata_transaction"}function Yc(n){return n.type==="state_checkpoint_transaction"}function Zc(n){return n.type==="validator_transaction"}function Jc(n){return"signature"in n&&n.signature==="ed25519_signature"}function eu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function tu(n){return n.type==="multi_agent_signature"}function nu(n){return n.type==="fee_payer_signature"}function ru(n){return n.type==="multi_ed25519_signature"}var Ds=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Ds||{}),ci= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(ci||{}),Bs= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Bs||{}),me= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(me||{}),Tn= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Tn||{}),Os= 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))(Os||{});var R=class n extends d{constructor(e){super();ur(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())}},K= exports.U8 =class n extends d{constructor(e){super();Re(e,0,mn),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())}},oe= exports.U16 =class n extends d{constructor(e){super();Re(e,0,yn),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())}},se= exports.U32 =class n extends d{constructor(e){super();Re(e,0,be),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())}},N= exports.U64 =class n extends d{constructor(e){super();Re(e,BigInt(0),qe),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())}},ae= exports.U128 =class n extends d{constructor(e){super();Re(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())}},ce= exports.U256 =class n extends d{constructor(e){super();Re(e,BigInt(0),fn),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 K)&&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 K(i)))}static U16(e){return new n(e.map(r=>new oe(r)))}static U32(e){return new n(e.map(r=>new se(r)))}static U64(e){return new n(e.map(r=>new N(r)))}static U128(e){return new n(e.map(r=>new ae(r)))}static U256(e){return new n(e.map(r=>new ce(r)))}static Bool(e){return new n(e.map(r=>new R(r)))}static MoveString(e){return new n(e.map(r=>new w(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)}},w= 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 K(e):void 0)}static U16(e){return new n(e!=null?new oe(e):void 0)}static U32(e){return new n(e!=null?new se(e):void 0)}static U64(e){return new n(e!=null?new N(e):void 0)}static U128(e){return new n(e!=null?new ae(e):void 0)}static U256(e){return new n(e!=null?new ce(e):void 0)}static Bool(e){return new n(e!=null?new R(e):void 0)}static MoveString(e){return new n(e!=null?new w(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 Ks=(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))(Ks||{}),x=class x extends d{constructor(e){super();if(e.length!==x.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(x.LENGTH);return new x(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=x.fromString(e);if(e.length!==x.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 x(i)}static from(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromString(e)}static fromStrict(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromStringStrict(e)}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.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])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4");var u=x;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 pi = _interopRequireWildcard(_bip39);var qs=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,$s= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Lu= exports.APTOS_BIP44_DEFAULT_DERIVATION_PATH ="m/44'/637'/0'/0'/0'",Hs= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(Hs||{}),gr= exports.HARDENED_OFFSET =2147483648;function mr(n){return $s.test(n)}function yr(n){return qs.test(n)}var di=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Vs= 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 di(t,s)},Ls=n=>n.replace("'",""),Qs= exports.splitPath =n=>n.split("/").slice(1).map(Ls);function bn(n,t,e,r=gr){if(r===gr&&!yr(n))throw new Error(`Invalid hardened derivation path ${n}`);if(r!==gr&&!mr(n))throw new Error(`Invalid derivation path ${n}`);let{key:i,chainCode:o}=di(t,e),s=Qs(n).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Vs(c,p+r),{key:i,chainCode:o});return a}var wn=n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return pi.mnemonicToSeedSync(t)};var Ve=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}},te= exports.AccountPublicKey =class extends Ve{};var B=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}};var ct=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var li=[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 te{constructor(e){super();let r=g.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 P))return!1;let o=ct(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 Le(r)}static isPublicKey(e){return e instanceof Le}};Le.LENGTH=32;var v=Le,ue=class ue extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==ue.LENGTH)throw new Error(`PrivateKey length should be ${ue.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new ue(e)}static fromDerivationPath(e,r){if(!yr(e))throw new Error(`Invalid derivation path ${e}`);return new ue(bn(e,ue.SLIP_0010_SEED,wn(r)))}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new v(e)}sign(e){let r=ct(e),i=g.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new P(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 ue(r)}static isPrivateKey(e){return e instanceof ue}};ue.LENGTH=32,ue.SLIP_0010_SEED="ed25519 seed";var M=ue,ut=class ut extends B{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==ut.LENGTH)throw new Error(`Signature length should be ${ut.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)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let r=e.length-1;r>=0;r-=1){if(e[r]<li[r])return!0;if(e[r]>li[r])return!1}return!1}};ut.LENGTH=64;var P=ut;var ne=class ne extends te{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>ne.MAX_KEYS||r.length<ne.MIN_KEYS)throw new Error(`Must have between ${ne.MIN_KEYS} and ${ne.MAX_KEYS} public keys, inclusive`);if(i<ne.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${ne.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof Qe))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 ne({publicKeys:o,threshold:i})}};ne.MAX_KEYS=32,ne.MIN_KEYS=2,ne.MIN_THRESHOLD=1;var pt=ne,j=class j extends B{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>j.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${j.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=j.createBitmap({bits:i});else{if(i.length!==j.BITMAP_LEN)throw new Error(`"bitmap" length should be ${j.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*P.LENGTH+j.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*P.LENGTH)}),e.set(this.bitmap,this.signatures.length*P.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+=P.LENGTH){let a=s;o.push(new P(r.subarray(a,a+P.LENGTH)))}return new j({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>=j.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${j.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}};j.MAX_SIGNATURES_SUPPORTED=32,j.BITMAP_LEN=4;var Qe=j;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var We=class We extends Ve{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==We.LENGTH)throw new Error(`PublicKey length should be ${We.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof Ye))return!1;let o=ct(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 We(r)}static isPublicKey(e){return e instanceof We}};We.LENGTH=65;var je=We,ye=class ye extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==ye.LENGTH)throw new Error(`PrivateKey length should be ${ye.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new ye(e)}static fromDerivationPath(e,r){if(!mr(e))throw new Error(`Invalid derivation path ${e}`);return ye.fromDerivationPathInner(e,wn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new ye(i)}sign(e){let r=ct(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 Ye(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new je(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 ye(r)}static isPrivateKey(e){return e instanceof ye}};ye.LENGTH=32;var Xe=ye,dt=class dt extends B{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==dt.LENGTH)throw new Error(`Signature length should be ${dt.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 dt(r)}};dt.LENGTH=64;var Ye=dt;var Ze=class n extends Ve{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()}toString(){return this.bcsToHex().toString()}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}isEd25519(){return this.publicKey instanceof v}},pe= exports.EphemeralSignature =class n extends B{constructor(e){super();let r=e.constructor.name;switch(r){case P.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}static fromHex(e){let r=g.fromHexInput(e),i=new ge(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof P)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(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var da=[_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],yi=31,la=16,mi=(la-1)*yi;function _n(n,t){let r=new TextEncoder().encode(n);return ga(r,t)}function ga(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=fr(n,t);return Ft(e)}function ma(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=Aa(n,t);return ya(e)}function fr(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return ma(n,t).concat([BigInt(n.length)])}function ya(n){if(n.length>mi)throw new Error(`Can't pack more than ${mi}. Was given ${n.length} bytes`);return fa(n,yi).map(t=>Kt(t))}function fa(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Kt(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 fi(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 Aa(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 Ft(n){let t=da[n.length-1];if(t)return t(n);throw new Error(`Unable to hash input of length ${n.length}`)}var Gt=1e7,ha= exports.MAX_AUD_VAL_BYTES =120,Ta= exports.MAX_UID_KEY_BYTES =30,ba= exports.MAX_UID_VAL_BYTES =330,rd= exports.MAX_ISS_VAL_BYTES =120,id= exports.MAX_EXTRA_FIELD_BYTES =350,od= exports.MAX_JWT_HEADER_B64_BYTES =300,sd= exports.MAX_COMMITED_EPK_BYTES =93,we=class we extends te{constructor(e,r){super();let i=g.fromHexInput(r).toUint8Array();if(i.length!==we.ADDRESS_SEED_LENGTH)throw new Error(`Address seed length in bytes should be ${we.ADDRESS_SEED_LENGTH}`);this.iss=e,this.addressSeed=i}authKey(){let e=new D;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){return!0}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.addressSeed)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new we(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new we(r,i)}static isPublicKey(e){return e instanceof we}static create(e){return vn(e),new we(e.iss,vn(e))}};we.ADDRESS_SEED_LENGTH=32;var De=we;function vn(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Kt(g.fromHexInput(i).toUint8Array()),_n(r,ha),_n(e,ba),_n(t,Ta)];return fi(Ft(o),De.ADDRESS_SEED_LENGTH)}var Je=class n extends B{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof gt)e.serializeU32AsUleb128(1),this.signature.serialize(e);else if(this.signature instanceof Se)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Not a valid OIDB signature")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(Se.load(e));case 1:return new n(gt.load(e));default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},lt= exports.Groth16Zkp =class n extends d{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=g.fromHexInput(r).toUint8Array(),this.b=g.fromHexInput(i).toUint8Array(),this.c=g.fromHexInput(o).toUint8Array()}toUint8Array(){let e=new D;return this.serialize(e),e.toUint8Array()}serialize(e){e.serializeU32AsUleb128(0),e.serializeFixedBytes(this.a),e.serializeFixedBytes(this.b),e.serializeFixedBytes(this.c)}static deserialize(e){e.deserializeUleb128AsU32();let r=e.deserializeFixedBytes(32),i=e.deserializeFixedBytes(64),o=e.deserializeFixedBytes(32);return new n({a:r,b:i,c:o})}},Se= exports.SignedGroth16Signature =class n extends B{constructor(e){super();let{proof:r,expHorizonSecs:i=BigInt(Gt),trainingWheelsSignature:o,extraField:s,overrideAudVal:a}=e;this.proof=r,this.expHorizonSecs=i,this.trainingWheelsSignature=o,this.extraField=s,this.overrideAudVal=a}toUint8Array(){let e=new D;return this.serialize(e),e.toUint8Array()}toString(){return this.toString()}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=lt.deserialize(e),i=e.deserializeU64(),s=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,c=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,[p]=e.deserializeVector(pe);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:p,extraField:s,overrideAudVal:c})}static load(e){let r=lt.deserialize(e),i=e.deserializeU64(),s=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,c=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,[p]=e.deserializeVector(pe);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:p,extraField:s,overrideAudVal:c})}},gt= exports.OpenIdSignature =class n extends B{constructor(e){super();let{jwtSignature:r,uidKey:i,jwtPayloadJson:o,epkBlinder:s,pepper:a,overrideAudValue:c}=e;this.jwtSignature=r,this.jwtPayloadJson=o,this.uidKey=_nullishCoalesce(i, () => ("sub")),this.epkBlinder=s,this.pepper=a,this.overrideAudValue=c}toUint8Array(){return this.epkBlinder}toString(){return this.toString()}serialize(e){e.serializeStr(this.jwtSignature),e.serializeStr(this.jwtPayloadJson),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.epkBlinder),e.serializeFixedBytes(this.pepper),e.serializeOptionStr(this.overrideAudValue)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=e.deserializeFixedBytes(31),p=e.deserializeUleb128AsU32()?e.deserializeStr():void 0;return new n({jwtSignature:r,jwtPayloadJson:i,uidKey:o,epkBlinder:s,pepper:a,overrideAudValue:p})}static load(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=e.deserializeFixedBytes(31),p=e.deserializeUleb128AsU32()?e.deserializeStr():void 0;return new n({jwtSignature:r,jwtPayloadJson:i,uidKey:o,epkBlinder:s,pepper:a,overrideAudValue:p})}static isSignature(e){return e instanceof n}},Be= exports.KeylessSignature =class n extends B{constructor(e){super();let{jwtHeader:r,openIdSignatureOrZkProof:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.openIdSignatureOrZkProof=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.ephemeralSignature.toUint8Array()}toString(){return this.toString()}serialize(e){this.openIdSignatureOrZkProof.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let r=Je.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=Ze.deserialize(e),a=pe.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:o,openIdSignatureOrZkProof:r,ephemeralPublicKey:s,ephemeralSignature:a})}static load(e){let r=e.deserializeStr(),i=e.deserializeU64(),o=Je.deserialize(e),s=Ze.deserialize(e),a=pe.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:i,openIdSignatureOrZkProof:o,ephemeralPublicKey:s,ephemeralSignature:a})}static isSignature(e){return e instanceof n}};var O=class n extends te{constructor(e){super();if(this.publicKey=e,e instanceof v)this.variant=0;else if(e instanceof je)this.variant=1;else if(e instanceof De)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return i instanceof q?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=je.deserialize(e);break;case 3:i=De.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 je}},q= exports.AnySignature =class n extends B{constructor(e){super();if(this.signature=e,e instanceof P)this.variant=0;else if(e instanceof Ye)this.variant=1;else if(e instanceof Be)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=P.deserialize(e);break;case 1:i=Ye.deserialize(e);break;case 3:i=Be.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(i)}};function Ai(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var mt=class n extends te{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 O?o:new O(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(O),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 O?e:new O(e),i=this.publicKeys.findIndex(o=>o.toString()===r.toString());if(i!==-1)return i;throw new Error("Public key not found in MultiKey")}},X=class X extends B{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.map(s=>s instanceof q?s:new q(s)),!(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}let o=this.bitmap.reduce((s,a)=>s+Ai(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>=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.");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.deserializeBytes(),i=r.reduce((s,a)=>s+Ai(a),0),o=[];for(let s=0;s<i;s+=1){let a=q.deserialize(e);o.push(a)}return new X({signatures:o,bitmap:r})}};X.BITMAP_LEN=4,X.MAX_SIGNATURES_SUPPORTED=X.BITMAP_LEN*8;var et=X;var $=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return fe.load(t);case 1:return Pn.load(t);case 2:return de.load(t);case 3:return yt.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof fe}isMultiEd25519(){return this instanceof Pn}isSingleKey(){return this instanceof de}isMultiKey(){return this instanceof yt}},fe= 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=P.deserialize(e);return new n(r,i)}},Pn= 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=pt.deserialize(e),i=Qe.deserialize(e);return new n(r,i)}},de= 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=O.deserialize(e),i=q.deserialize(e);return new n(r,i)}},yt= 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=mt.deserialize(e),i=et.deserialize(e);return new n(r,i)}};var Mt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Mt||{}),hi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Ti= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Cn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,En= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",bi= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",wi= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",ft= 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))(ft||{});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 U=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 qt=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 U(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=U.deserialize(e);return new n(r,i)}};var z=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return G.load(t);case 1:return Ae.load(t);case 2:return L.load(t);case 3:return bt.load(t);case 4:return Y.load(t);case 5:return tt.load(t);case 6:return C.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 k.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof G}isAddress(){return this instanceof Y}isGeneric(){return this instanceof k}isSigner(){return this instanceof tt}isVector(){return this instanceof C}isStruct(){return this instanceof y}isU8(){return this instanceof Ae}isU16(){return this instanceof ht}isU32(){return this instanceof Tt}isU64(){return this instanceof L}isU128(){return this instanceof bt}isU256(){return this instanceof wt}},G= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Ae= 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}},L= 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}},Y= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},tt= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},In= 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)}},k= 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)}},C= exports.TypeTagVector =class n extends z{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new Ae)}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=xe.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")}},xe= 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=U.deserialize(e),o=U.deserialize(e),s=e.deserializeVector(z);return new n(r,i,o,s)}};function fl(){return new xe(u.ONE,new U("aptos_coin"),new U("AptosCoin"),[])}function _(){return new xe(u.ONE,new U("string"),new U("String"),[])}function Al(n){return new xe(u.ONE,new U("option"),new U("Option"),[n])}function Z(n){return new xe(u.ONE,new U("object"),new U("Object"),[n])}function wa(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return K.deserialize(n);case 1:return N.deserialize(n);case 2:return ae.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,K);case 5:return R.deserialize(n);case 6:return oe.deserialize(n);case 7:return se.deserialize(n);case 8:return ce.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var nt=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return $t.load(t);case 2:return Ht.load(t);case 3:return Vt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},$t= exports.TransactionPayloadScript =class n extends nt{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Lt.deserialize(e);return new n(r)}},Ht= exports.TransactionPayloadEntryFunction =class n extends nt{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=rt.deserialize(e);return new n(r)}},Vt= exports.TransactionPayloadMultiSig =class n extends nt{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=Qt.deserialize(e);return new n(r)}},rt= 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(qt.fromStr(t),new U(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=qt.deserialize(t),r=U.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=An.deserialize(t,c);s.push(p)}return new n(e,r,i,s)}},Lt= 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=wa(t);o.push(a)}return new n(e,r,o)}},Qt= 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=Wt.deserialize(t)),new n(e,i)}},Wt= 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(rt.deserialize(e))}};var Q=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=nt.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)}},Un= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return _e.load(t);case 1:return ve.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},_e= exports.MultiAgentRawTransaction =class n extends Un{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=Q.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},ve= exports.FeePayerRawTransaction =class n extends Un{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=Q.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Rn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new w("account");this.structName=new w("RotationProofChallenge");this.sequenceNumber=new N(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 Pe=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return St.load(t);case 1:return Ar.load(t);case 2:return it.load(t);case 3:return ot.load(t);case 4:return xt.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},St= exports.TransactionAuthenticatorEd25519 =class n extends Pe{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=P.deserialize(e);return new n(r,i)}},Ar= exports.TransactionAuthenticatorMultiEd25519 =class n extends Pe{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=pt.deserialize(e),i=Qe.deserialize(e);return new n(r,i)}},it= exports.TransactionAuthenticatorMultiAgent =class n extends Pe{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)}},ot= exports.TransactionAuthenticatorFeePayer =class n extends Pe{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)}},xt= exports.TransactionAuthenticatorSingleSender =class n extends Pe{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 Ce=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=Q.deserialize(e),i=Pe.deserialize(e);return new n(r,i)}};var zn=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=Q.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=Q.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Dn(n){return n.feePayerAddress?new ve(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new _e(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function jt(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 Eg(n){return jt(n.bcsToBytes(),n.constructor.name)}function Oe(n){let t=Dn(n);if(t instanceof Q)return jt(t.bcsToBytes(),bi);if(t instanceof _e||t instanceof ve)return jt(t.bcsToBytes(),wi);throw new Error(`Unknown transaction type to sign on: ${t}`)}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=M.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,i=M.fromDerivationPath(e,r);return new n({privateKey:i})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){let e=this.privateKey.sign(Oe(t));return new fe(this.publicKey,e)}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(Oe(t))}};var vt=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new O(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=M.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=M.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){let e=this.sign(Oe(t));return new de(this.publicKey,e)}sign(t){return new q(this.privateKey.sign(t))}signTransaction(t){return this.sign(Oe(t))}};var Ne=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 M&&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 _jwtdecode = require('jwt-decode');var _base64 = require('base-64');var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Bn=class n extends d{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new Ze(r.publicKey()),this.expiryDateSecs=i||BigInt(Pa(va()+Gt)),this.blinder=o!==void 0?g.fromHexInput(o).toUint8Array():_a(),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=M.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let o=e.deserializeU64(),s=e.deserializeFixedBytes(31);return new n({privateKey:i,expiryDateSecs:o,blinder:s})}static fromBytes(e){return n.deserialize(new ge(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _8 => _8.scheme])){case 0:default:r=M.generate()}return new n({privateKey:r})}generateNonce(){let e=fr(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(Kt(this.blinder)),Ft(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new pe(this.privateKey.sign(e))}};function _a(){return _utils.randomBytes.call(void 0, 31)}function va(){return Math.floor(new Date().getTime()/1e3)}function Pa(n){let t=new Date(n*1e3);return t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),Math.floor(t.getTime()/1e3)}function Ua(n){let t=n.replace(/-/g,"+").replace(/_/g,"/"),e=t+"==".substring(0,(3-t.length%3)%3);return _base64.decode.call(void 0, e)}var he=class he{constructor(t){let{address:e,ephemeralKeyPair:r,iss:i,uidKey:o,uidVal:s,aud:a,pepper:c,proofOrFetcher:p,proofFetchCallback:m,jwt:S}=t;this.ephemeralKeyPair=r;let A=vn(t);if(this.publicKey=new De(i,A),this.accountAddress=e?u.from(e):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=S,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof Se)this.proof=p;else{if(m===void 0)throw new Error("Must provide callback");this.emitter.on("proofFetchFinish",async W=>{await m(W),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let l=g.fromHexInput(c).toUint8Array();if(l.length!==he.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${he.PEPPER_LENGTH}`);this.pepper=l}async init(t){try{this.proof=await t,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(e){e instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:e.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(t){if(t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(t)}static deserialize(t){let e=t.deserializeStr(),r=t.deserializeStr(),i=t.deserializeFixedBytes(31),o=Bn.deserialize(t),s=Se.deserialize(t);return he.fromJWTAndProof({proof:s,pepper:i,uidKey:r,jwt:e,ephemeralKeyPair:o})}isExpired(){return this.ephemeralKeyPair.isExpired()}bcsToBytes(){let t=new D;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}signWithAuthenticator(t){let e=Dn(t),r=new q(this.sign(e.bcsToBytes())),i=new O(this.publicKey);return new de(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(t){let{expiryDateSecs:e}=this.ephemeralKeyPair,r=Math.floor(new Date().getTime()/1e3);if(e<r)throw new Error("Ephemeral key pair is expired.");if(this.proof===void 0)throw new Error("Proof not found");let i=this.jwt.split(".")[0],o=this.ephemeralKeyPair.getPublicKey(),s=new D;s.serializeFixedBytes(g.fromHexInput(t).toUint8Array()),s.serializeOption(this.proof.proof);let a=jt(s.toUint8Array(),"APTOS::TransactionAndProof"),c=this.ephemeralKeyPair.sign(a);return new Be({jwtHeader:Ua(i),openIdSignatureOrZkProof:new Je(this.proof),expiryDateSecs:e,ephemeralPublicKey:o,ephemeralSignature:c})}signTransaction(t){let e=Dn(t);return this.sign(e.bcsToBytes())}signWithOpenIdSignature(t){let[e,r,i]=this.jwt.split("."),o=new gt({jwtSignature:i,jwtPayloadJson:r,uidKey:this.uidKey,epkBlinder:this.ephemeralKeyPair.blinder,pepper:this.pepper}),{expiryDateSecs:s}=this.ephemeralKeyPair,a=this.ephemeralKeyPair.getPublicKey(),c=this.ephemeralKeyPair.sign(t);return new Be({jwtHeader:e,openIdSignatureOrZkProof:new Je(o),expiryDateSecs:s,ephemeralPublicKey:a,ephemeralSignature:c})}verifySignature(t){return!0}static fromBytes(t){return he.deserialize(new ge(t))}static fromJWTAndProof(t){let{proof:e,jwt:r,ephemeralKeyPair:i,pepper:o,proofFetchCallback:s}=t,a=_nullishCoalesce(t.uidKey, () => ("sub")),c=_jwtdecode.jwtDecode.call(void 0, r),p=c.iss;if(typeof c.aud!="string")throw new Error("aud was not found or an array of values");let m=c.aud,S=c[a];return new he({proofOrFetcher:e,ephemeralKeyPair:i,iss:p,uidKey:a,uidVal:S,aud:m,pepper:o,jwt:r,proofFetchCallback:s})}static fromDerivationPath(t,e){return bn(t,he.SLIP_0010_SEED,e)}};he.PEPPER_LENGTH=31,he.SLIP_0010_SEED="32 bytes";var Ke=he;var On=class n{constructor(t){let{multiKey:e,signers:r}=t;this.publicKey=e,this.signers=r,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let i=[];for(let o of r)i.push(this.publicKey.getIndex(o.publicKey));this.signaturesBitmap=this.publicKey.createBitmap({bits:i})}static fromPublicKeysAndSigners(t){let{publicKeys:e,signaturesRequired:r,signers:i}=t,o=new mt({publicKeys:e,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(t){return t instanceof n}signWithAuthenticator(t){return new yt(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof Ke);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 et({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new et({signatures:e,bitmap:this.signaturesBitmap})}verifySignature(t){return!0}};var re=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 Si="1.13.3-zeta.3";var xi={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",randomnet:"https://indexer-randomnet.hasura.app/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},_i= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",randomnet:"https://fullnode.random.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},vi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",randomnet:"https://faucet.random.aptoslabs.com",local:"http://127.0.0.1:8081"},hr= exports.NetworkToPepperAPI ={mainnet:"mainnet not yet ready, requires sdk upgrade",testnet:"https://pepper.keyless.testnet.aptoslabs.com/v0",devnet:"https://pepper.keyless.devnet.aptoslabs.com/v0",local:"https://pepper.keyless.devnet.aptoslabs.com/v0"},Tr= exports.NetworkToProverAPI ={mainnet:"mainnet not yet ready, requires sdk upgrade",testnet:"https://prover.keyless.testnet.aptoslabs.com/v0",devnet:"https://prover.keyless.devnet.aptoslabs.com/v0",local:"https://prover.keyless.devnet.aptoslabs.com/v0"},br= exports.Network =(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.RANDOMNET="randomnet",s.LOCAL="local",s.CUSTOM="custom",s))(br||{}),wr= exports.NetworkToChainId ={mainnet:1,testnet:2,randomnet:70,local:4},Qm= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",randomnet:"randomnet",local:"local",custom:"custom"};function Pi(n,t){let e=t.bcsToBytes(),r=new ge(e);return n.deserialize(r)}var Ci={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 Ra(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _9 => _9.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Si}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _10 => _10.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _11 => _11.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _12 => _12.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _13 => _13.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function Nn(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Ra({...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 re(n,a,`Error: ${a.data}`);if(e==="Indexer"){let p=a.data;if(p.errors)throw new re(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 re(n,a,`${s.data}`);if(t.isPepperServiceRequest(r))throw new re(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 Ci?c=Ci[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new re(n,a,`${e} error: ${c}`)}async function Sr(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Nn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function J(n){let{aptosConfig:t}=n;return Sr({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _14 => _14.clientConfig, 'optionalAccess', _15 => _15.HEADERS]),..._optionalChain([t, 'access', _16 => _16.fullnodeConfig, 'optionalAccess', _17 => _17.HEADERS])}}})}async function yy(n){return Sr({...n,type:"Pepper"})}async function Pt(n){let t=[],e,r=n.params;do{let i=await Sr({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 Xt(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 Nn({url:m,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function st(n){let{aptosConfig:t}=n;return Xt({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _18 => _18.clientConfig, 'optionalAccess', _19 => _19.HEADERS]),..._optionalChain([t, 'access', _20 => _20.fullnodeConfig, 'optionalAccess', _21 => _21.HEADERS])}}})}async function Ei(n){let{aptosConfig:t}=n;return Xt({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _22 => _22.clientConfig, 'optionalAccess', _23 => _23.HEADERS]),..._optionalChain([t, 'access', _24 => _24.indexerConfig, 'optionalAccess', _25 => _25.HEADERS])}}})}async function Ii(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _26 => _26.clientConfig, 'optionalAccess', _27 => delete _27.API_KEY]),Xt({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _28 => _28.clientConfig, 'optionalAccess', _29 => _29.HEADERS]),..._optionalChain([e, 'access', _30 => _30.faucetConfig, 'optionalAccess', _31 => _31.HEADERS])}}})}async function Ui(n){return Xt({...n,type:"Pepper"})}async function Ri(n){return Xt({...n,type:"Prover"})}var za=`
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 _chunkKSEUZTKYjs = require('./chunk-KSEUZTKY.js');var yn=255,mn=65535,be=4294967295,Me=18446744073709551615n,Ot=340282366920938463463374607431768211455n,fn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var ye=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)}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<be;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>be)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 L=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Us=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Us||{}),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 L("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 L("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 L(`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 D;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},D= 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){ur(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(be),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Me,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))}};_chunkKSEUZTKYjs.a.call(void 0, [qe(0,yn)],D.prototype,"serializeU8",1),_chunkKSEUZTKYjs.a.call(void 0, [qe(0,mn)],D.prototype,"serializeU16",1),_chunkKSEUZTKYjs.a.call(void 0, [qe(0,be)],D.prototype,"serializeU32",1),_chunkKSEUZTKYjs.a.call(void 0, [qe(BigInt(0),Me)],D.prototype,"serializeU64",1),_chunkKSEUZTKYjs.a.call(void 0, [qe(BigInt(0),Ot)],D.prototype,"serializeU128",1),_chunkKSEUZTKYjs.a.call(void 0, [qe(BigInt(0),fn)],D.prototype,"serializeU256",1),_chunkKSEUZTKYjs.a.call(void 0, [qe(0,be)],D.prototype,"serializeU32AsUleb128",1);function ur(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Rs=(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(Rs(n,t,e))}function qe(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 $e=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 An=class n extends d{constructor(e){super();this.value=new $e(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let i=$e.deserialize(e,r);return new n(i.value)}};var hn=(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))(hn||{}),Zr= 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))(Zr||{}),Nt= 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))(Nt||{}),Jr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Jr||{}),ei= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(ei||{}),ti= 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))(ti||{}),ni= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(ni||{}),pr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(pr||{}),ri= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(ri||{}),dr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(dr||{}),ii= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(ii||{}),oi= exports.EphemeralCertificate =(e=>(e[e.ZkProof=0]="ZkProof",e[e.OpenIdSignature=1]="OpenIdSignature",e))(oi||{}),lr= 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))(lr||{});function Qc(n){return n.type==="pending_transaction"}function Wc(n){return n.type==="user_transaction"}function jc(n){return n.type==="genesis_transaction"}function Xc(n){return n.type==="block_metadata_transaction"}function Yc(n){return n.type==="state_checkpoint_transaction"}function Zc(n){return n.type==="validator_transaction"}function Jc(n){return"signature"in n&&n.signature==="ed25519_signature"}function eu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function tu(n){return n.type==="multi_agent_signature"}function nu(n){return n.type==="fee_payer_signature"}function ru(n){return n.type==="multi_ed25519_signature"}var zs=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(zs||{}),si= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(si||{}),ks= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(ks||{}),me= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(me||{}),Tn= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Tn||{}),Ds= 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))(Ds||{});var R=class n extends d{constructor(e){super();ur(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())}},F= exports.U8 =class n extends d{constructor(e){super();Re(e,0,yn),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())}},se= exports.U16 =class n extends d{constructor(e){super();Re(e,0,mn),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())}},ae= exports.U32 =class n extends d{constructor(e){super();Re(e,0,be),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();Re(e,BigInt(0),Me),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())}},ce= exports.U128 =class n extends d{constructor(e){super();Re(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())}},ue= exports.U256 =class n extends d{constructor(e){super();Re(e,BigInt(0),fn),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 F)&&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 F(i)))}static U16(e){return new n(e.map(r=>new se(r)))}static U32(e){return new n(e.map(r=>new ae(r)))}static U64(e){return new n(e.map(r=>new O(r)))}static U128(e){return new n(e.map(r=>new ce(r)))}static U256(e){return new n(e.map(r=>new ue(r)))}static Bool(e){return new n(e.map(r=>new R(r)))}static MoveString(e){return new n(e.map(r=>new S(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)}},S= 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 F(e):void 0)}static U16(e){return new n(e!=null?new se(e):void 0)}static U32(e){return new n(e!=null?new ae(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 ce(e):void 0)}static U256(e){return new n(e!=null?new ue(e):void 0)}static Bool(e){return new n(e!=null?new R(e):void 0)}static MoveString(e){return new n(e!=null?new S(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 Ks=(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))(Ks||{}),x=class x extends d{constructor(e){super();if(e.length!==x.LENGTH)throw new L("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(x.LENGTH);return new x(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new L("Hex string must start with a leading 0x.","leading_zero_x_required");let r=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new L(`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 L(`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 L("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new L("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 L(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(i)}static from(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromString(e)}static fromStrict(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromStringStrict(e)}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.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])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4");var u=x;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 G=ke;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var ci = _interopRequireWildcard(_bip39);var Gs=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Ms= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Lu= exports.APTOS_BIP44_DEFAULT_DERIVATION_PATH ="m/44'/637'/0'/0'/0'",qs= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(qs||{}),$s= exports.HARDENED_OFFSET =2147483648;function ui(n){return Ms.test(n)}function pi(n){return Gs.test(n)}var di=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Hs= 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 di(t,s)},Vs=n=>n.replace("'",""),Ls= exports.splitPath =n=>n.split("/").slice(1).map(Vs);function bn(n,t,e,r=$s){let{key:i,chainCode:o}=di(t,e),s=Ls(n).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>Hs(c,p+r),{key:i,chainCode:o});return a}var wn=n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return ci.mnemonicToSeedSync(t)};var He=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}},te= exports.AccountPublicKey =class extends He{};var B=class extends d{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}};var st=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var li=[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],Ve=class Ve extends te{constructor(e){super();let r=g.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 P))return!1;let o=st(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 G.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 Ve(r)}static isPublicKey(e){return e instanceof Ve}};Ve.LENGTH=32;var _=Ve,pe=class pe extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==pe.LENGTH)throw new Error(`PrivateKey length should be ${pe.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new pe(e)}static fromDerivationPath(e,r){if(!pi(e))throw new Error(`Invalid derivation path ${e}`);return new pe(bn(e,pe.SLIP_0010_SEED,wn(r)))}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let r=st(e),i=g.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new P(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 pe(r)}static isPrivateKey(e){return e instanceof pe}};pe.LENGTH=32,pe.SLIP_0010_SEED="ed25519 seed";var q=pe,at=class at extends B{constructor(e){super();let r=g.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]<li[r])return!0;if(e[r]>li[r])return!1}return!1}};at.LENGTH=64;var P=at;var ne=class ne extends te{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>ne.MAX_KEYS||r.length<ne.MIN_KEYS)throw new Error(`Must have between ${ne.MIN_KEYS} and ${ne.MAX_KEYS} public keys, inclusive`);if(i<ne.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${ne.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof Le))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 G.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*_.LENGTH+1);return this.publicKeys.forEach((r,i)=>{e.set(r.toUint8Array(),i*_.LENGTH)}),e[this.publicKeys.length*_.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+=_.LENGTH){let a=s;o.push(new _(r.subarray(a,a+_.LENGTH)))}return new ne({publicKeys:o,threshold:i})}};ne.MAX_KEYS=32,ne.MIN_KEYS=2,ne.MIN_THRESHOLD=1;var ct=ne,j=class j extends B{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>j.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${j.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=j.createBitmap({bits:i});else{if(i.length!==j.BITMAP_LEN)throw new Error(`"bitmap" length should be ${j.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*P.LENGTH+j.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*P.LENGTH)}),e.set(this.bitmap,this.signatures.length*P.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+=P.LENGTH){let a=s;o.push(new P(r.subarray(a,a+P.LENGTH)))}return new j({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>=j.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${j.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),y=o[p];y|=i>>a%8,o[p]=y}),o}};j.MAX_SIGNATURES_SUPPORTED=32,j.BITMAP_LEN=4;var Le=j;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Qe=class Qe extends He{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 Se))return!1;let o=st(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 Qe(r)}static isPublicKey(e){return e instanceof Qe}};Qe.LENGTH=65;var we=Qe,fe=class fe extends d{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==fe.LENGTH)throw new Error(`PrivateKey length should be ${fe.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new fe(e)}static fromDerivationPath(e,r){if(!ui(e))throw new Error(`Invalid derivation path ${e}`);return fe.fromDerivationPathInner(e,wn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new fe(i)}sign(e){let r=st(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 Se(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new we(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 fe(r)}static isPrivateKey(e){return e instanceof fe}};fe.LENGTH=32;var We=fe,ut=class ut extends B{constructor(e){super();let r=g.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 Se=ut;var je=class n extends He{constructor(e){super();let r=e.constructor.name;switch(r){case _.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}toString(){return this.bcsToHex().toString()}verifySignature(e){let{message:r,signature:i}=e;return this.publicKey.verifySignature({message:r,signature:i})}serialize(e){if(this.publicKey instanceof _)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(_.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof _}},de= exports.EphemeralSignature =class n extends B{constructor(e){super();let r=e.constructor.name;switch(r){case P.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}static fromHex(e){let r=g.fromHexInput(e),i=new ye(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof P)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(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var pa=[_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],mi=31,da=16,yi=(da-1)*mi;function _n(n,t){let r=new TextEncoder().encode(n);return la(r,t)}function la(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=gr(n,t);return Gt(e)}function ga(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=fa(n,t);return ya(e)}function gr(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return ga(n,t).concat([BigInt(n.length)])}function ya(n){if(n.length>yi)throw new Error(`Can't pack more than ${yi}. Was given ${n.length} bytes`);return ma(n,mi).map(t=>Ft(t))}function ma(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Ft(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 fi(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 fa(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=pa[n.length-1];if(t)return t(n);throw new Error(`Unable to hash input of length ${n.length}`)}var Mt=1e7,Aa= exports.MAX_AUD_VAL_BYTES =120,ha= exports.MAX_UID_KEY_BYTES =30,Ta= exports.MAX_UID_VAL_BYTES =330,rd= exports.MAX_ISS_VAL_BYTES =120,id= exports.MAX_EXTRA_FIELD_BYTES =350,od= exports.MAX_JWT_HEADER_B64_BYTES =300,sd= exports.MAX_COMMITED_EPK_BYTES =93,xe=class xe extends te{constructor(e,r){super();let i=g.fromHexInput(r).toUint8Array();if(i.length!==xe.ADDRESS_SEED_LENGTH)throw new Error(`Address seed length in bytes should be ${xe.ADDRESS_SEED_LENGTH}`);this.iss=e,this.addressSeed=i}authKey(){let e=new D;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),G.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){return!0}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.addressSeed)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new xe(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new xe(r,i)}static isPublicKey(e){return e instanceof xe}static create(e){return vn(e),new xe(e.iss,vn(e))}};xe.ADDRESS_SEED_LENGTH=32;var De=xe;function vn(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Ft(g.fromHexInput(i).toUint8Array()),_n(r,Aa),_n(e,Ta),_n(t,ha)];return fi(Gt(o),De.ADDRESS_SEED_LENGTH)}var Xe=class n extends B{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof dt)e.serializeU32AsUleb128(1),this.signature.serialize(e);else if(this.signature instanceof _e)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Not a valid OIDB signature")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(_e.load(e));case 1:return new n(dt.load(e));default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},pt= exports.Groth16Zkp =class n extends d{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=g.fromHexInput(r).toUint8Array(),this.b=g.fromHexInput(i).toUint8Array(),this.c=g.fromHexInput(o).toUint8Array()}toUint8Array(){let e=new D;return this.serialize(e),e.toUint8Array()}serialize(e){e.serializeU32AsUleb128(0),e.serializeFixedBytes(this.a),e.serializeFixedBytes(this.b),e.serializeFixedBytes(this.c)}static deserialize(e){e.deserializeUleb128AsU32();let r=e.deserializeFixedBytes(32),i=e.deserializeFixedBytes(64),o=e.deserializeFixedBytes(32);return new n({a:r,b:i,c:o})}},_e= exports.SignedGroth16Signature =class n extends B{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(){let e=new D;return this.serialize(e),e.toUint8Array()}toString(){return this.toString()}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=pt.deserialize(e),i=e.deserializeU64(),s=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,c=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,[p]=e.deserializeVector(de);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:p,extraField:s,overrideAudVal:c})}static load(e){let r=pt.deserialize(e),i=e.deserializeU64(),s=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,c=e.deserializeUleb128AsU32()?e.deserializeStr():void 0,[p]=e.deserializeVector(de);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:p,extraField:s,overrideAudVal:c})}},dt= exports.OpenIdSignature =class n extends B{constructor(e){super();let{jwtSignature:r,uidKey:i,jwtPayloadJson:o,epkBlinder:s,pepper:a,overrideAudValue:c}=e;this.jwtSignature=r,this.jwtPayloadJson=o,this.uidKey=_nullishCoalesce(i, () => ("sub")),this.epkBlinder=s,this.pepper=a,this.overrideAudValue=c}toUint8Array(){return this.epkBlinder}toString(){return this.toString()}serialize(e){e.serializeStr(this.jwtSignature),e.serializeStr(this.jwtPayloadJson),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.epkBlinder),e.serializeFixedBytes(this.pepper),e.serializeOptionStr(this.overrideAudValue)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=e.deserializeFixedBytes(31),p=e.deserializeUleb128AsU32()?e.deserializeStr():void 0;return new n({jwtSignature:r,jwtPayloadJson:i,uidKey:o,epkBlinder:s,pepper:a,overrideAudValue:p})}static load(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeFixedBytes(31),a=e.deserializeFixedBytes(31),p=e.deserializeUleb128AsU32()?e.deserializeStr():void 0;return new n({jwtSignature:r,jwtPayloadJson:i,uidKey:o,epkBlinder:s,pepper:a,overrideAudValue:p})}static isSignature(e){return e instanceof n}},Be= exports.KeylessSignature =class n extends B{constructor(e){super();let{jwtHeader:r,openIdSignatureOrZkProof:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.openIdSignatureOrZkProof=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.ephemeralSignature.toUint8Array()}toString(){return this.toString()}serialize(e){this.openIdSignatureOrZkProof.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let r=Xe.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=je.deserialize(e),a=de.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:o,openIdSignatureOrZkProof:r,ephemeralPublicKey:s,ephemeralSignature:a})}static load(e){let r=e.deserializeStr(),i=e.deserializeU64(),o=Xe.deserialize(e),s=je.deserialize(e),a=de.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:i,openIdSignatureOrZkProof:o,ephemeralPublicKey:s,ephemeralSignature:a})}static isSignature(e){return e instanceof n}};var K=class n extends te{constructor(e){super();if(this.publicKey=e,e instanceof _)this.variant=0;else if(e instanceof we)this.variant=1;else if(e instanceof De)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 G.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=_.deserialize(e);break;case 1:i=we.deserialize(e);break;case 3:i=De.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 _}isSecp256k1PublicKey(){return this.publicKey instanceof we}},N= exports.AnySignature =class n extends B{constructor(e){super();if(this.signature=e,e instanceof P)this.variant=0;else if(e instanceof Se)this.variant=1;else if(e instanceof Be)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=P.deserialize(e);break;case 1:i=Se.deserialize(e);break;case 3:i=Be.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 lt=class n extends te{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 G.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),y=o[p];y|=i>>a%8,o[p]=y}),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")}},X=class X extends B{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.map(s=>s instanceof N?s:new N(s)),!(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}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>=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.");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 X({signatures:r,bitmap:i})}};X.BITMAP_LEN=4,X.MAX_SIGNATURES_SUPPORTED=X.BITMAP_LEN*8;var Ye=X;var $=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return le.load(t);case 1:return Pn.load(t);case 2:return Q.load(t);case 3:return Ze.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof le}isMultiEd25519(){return this instanceof Pn}isSingleKey(){return this instanceof Q}isMultiKey(){return this instanceof Ze}},le= 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=_.deserialize(e),i=P.deserialize(e);return new n(r,i)}},Pn= 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=Le.deserialize(e);return new n(r,i)}},Q= 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)}},Ze= 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=Ye.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||{}),Ai= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,hi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Cn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,En= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Ti= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",yr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",gt= 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))(gt||{});var yt=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 U=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 U(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=U.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 Ae.load(t);case 2:return W.load(t);case 3:return At.load(t);case 4:return Y.load(t);case 5:return Je.load(t);case 6:return C.load(t);case 7:return m.load(t);case 8:return mt.load(t);case 9:return ft.load(t);case 10:return ht.load(t);case 255:return k.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof M}isAddress(){return this instanceof Y}isGeneric(){return this instanceof k}isSigner(){return this instanceof Je}isVector(){return this instanceof C}isStruct(){return this instanceof m}isU8(){return this instanceof Ae}isU16(){return this instanceof mt}isU32(){return this instanceof ft}isU64(){return this instanceof W}isU128(){return this instanceof At}isU256(){return this instanceof ht}},M= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Ae= 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}},ft= 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}},At= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},ht= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},Y= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},Je= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},In= 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)}},k= 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)}},C= exports.TypeTagVector =class n extends z{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new Ae)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=z.deserialize(e);return new n(r)}},m= 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=ve.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")}},ve= 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=U.deserialize(e),o=U.deserialize(e),s=e.deserializeVector(z);return new n(r,i,o,s)}};function fl(){return new ve(u.ONE,new U("aptos_coin"),new U("AptosCoin"),[])}function v(){return new ve(u.ONE,new U("string"),new U("String"),[])}function Al(n){return new ve(u.ONE,new U("option"),new U("Option"),[n])}function Z(n){return new ve(u.ONE,new U("object"),new U("Object"),[n])}function wa(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return F.deserialize(n);case 1:return O.deserialize(n);case 2:return ce.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,F);case 5:return R.deserialize(n);case 6:return se.deserialize(n);case 7:return ae.deserialize(n);case 8:return ue.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var et=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Ht.load(t);case 2:return Vt.load(t);case 3:return Lt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Ht= exports.TransactionPayloadScript =class n extends et{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)}},Vt= exports.TransactionPayloadEntryFunction =class n extends et{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=tt.deserialize(e);return new n(r)}},Lt= exports.TransactionPayloadMultiSig =class n extends et{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)}},tt= 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 U(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=U.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=An.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=wa(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(tt.deserialize(e))}};var re=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=et.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=yt.deserialize(e);return new n(r,i,o,s,a,c,p)}},Un= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return nt.load(t);case 1:return rt.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},nt= exports.MultiAgentRawTransaction =class n extends Un{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=re.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},rt= exports.FeePayerRawTransaction =class n extends Un{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=re.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Rn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new S("account");this.structName=new S("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 Pe=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Tt.load(t);case 1:return mr.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 Pe{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=_.deserialize(e),i=P.deserialize(e);return new n(r,i)}},mr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Pe{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=Le.deserialize(e);return new n(r,i)}},bt= exports.TransactionAuthenticatorMultiAgent =class n extends Pe{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 Pe{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 Pe{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 it=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=re.deserialize(e),i=Pe.deserialize(e);return new n(r,i)}};var zn=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=re.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=re.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Dn(n){return n.feePayerAddress?new rt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new nt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function xt(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 Eg(n){return xt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function _t(n){let t=Dn(n);return n.feePayerAddress?xt(t.bcsToBytes(),yr):n.secondarySignerAddresses?xt(t.bcsToBytes(),yr):xt(t.bcsToBytes(),Ti)}var vt=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 le(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new le(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(_t(t))}};var Pt=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=We.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=We.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 Q(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new Q(this.publicKey,this.signTransaction(t))}sign(t){return new N(this.privateKey.sign(t))}signTransaction(t){return this.sign(_t(t))}};var Ke=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?vt.generate():Pt.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:i=!0}=t;return e instanceof q&&i?new vt({privateKey:e,address:r}):new Pt({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?vt.fromDerivationPath({mnemonic:r,path:i}):Pt.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 Bn=class n extends d{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new je(r.publicKey()),this.expiryDateSecs=i||BigInt(Pa(va()+Mt)),this.blinder=o!==void 0?g.fromHexInput(o).toUint8Array():_a(),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 n({privateKey:i,expiryDateSecs:o,blinder:s})}static fromBytes(e){return n.deserialize(new ye(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _8 => _8.scheme])){case 0:default:r=q.generate()}return new n({privateKey:r})}generateNonce(){let e=gr(this.publicKey.bcsToBytes(),93);return e.push(BigInt(this.expiryDateSecs)),e.push(Ft(this.blinder)),Gt(e).toString()}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new de(this.privateKey.sign(e))}};function _a(){return _utils.randomBytes.call(void 0, 31)}function va(){return Math.floor(new Date().getTime()/1e3)}function Pa(n){let t=new Date(n*1e3);return t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),Math.floor(t.getTime()/1e3)}var _jwtdecode = require('jwt-decode');var _base64 = require('base-64');var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function Ua(n){let t=n.replace(/-/g,"+").replace(/_/g,"/"),e=t+"==".substring(0,(3-t.length%3)%3);return _base64.decode.call(void 0, e)}var he=class he extends d{constructor(e){super();let{address:r,ephemeralKeyPair:i,iss:o,uidKey:s,uidVal:a,aud:c,pepper:p,proofOrFetcher:y,proofFetchCallback:w,jwt:A}=e;this.ephemeralKeyPair=i;let l=vn(e);if(this.publicKey=new De(o,l),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=A,this.emitter=new _eventemitter32.default,this.proofOrPromise=y,y instanceof _e)this.proof=y;else{if(w===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async Ie=>{await w(Ie),this.emitter.removeAllListeners()}),this.init(y)}this.signingScheme=2;let H=g.fromHexInput(p).toUint8Array();if(H.length!==he.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${he.PEPPER_LENGTH}`);this.pepper=H}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=Bn.deserialize(e),a=_e.deserialize(e);return he.fromJWTAndProof({proof:a,pepper:o,uidKey:i,jwt:r,ephemeralKeyPair:s})}isExpired(){return this.ephemeralKeyPair.isExpired()}bcsToBytes(){let e=new D;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return g.fromHexInput(e)}signWithAuthenticator(e){let r=new N(this.sign(e)),i=new K(this.publicKey);return new Q(i,r)}signTransactionWithAuthenticator(e){let r=Dn(e),i=new N(this.sign(r.bcsToBytes())),o=new K(this.publicKey);return new Q(o,i)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair,i=Math.floor(new Date().getTime()/1e3);if(r<i)throw new Error("Ephemeral key pair is expired.");if(this.proof===void 0)throw new Error("Proof not found");let o=this.jwt.split(".")[0],s=this.ephemeralKeyPair.getPublicKey(),a=new D;a.serializeFixedBytes(g.fromHexInput(e).toUint8Array()),a.serializeOption(this.proof.proof);let c=xt(a.toUint8Array(),"APTOS::TransactionAndProof"),p=this.ephemeralKeyPair.sign(c);return new Be({jwtHeader:Ua(o),openIdSignatureOrZkProof:new Xe(this.proof),expiryDateSecs:r,ephemeralPublicKey:s,ephemeralSignature:p})}signTransaction(e){let r=Dn(e);return this.sign(r.bcsToBytes())}signWithOpenIdSignature(e){let[r,i,o]=this.jwt.split("."),s=new dt({jwtSignature:o,jwtPayloadJson:i,uidKey:this.uidKey,epkBlinder:this.ephemeralKeyPair.blinder,pepper:this.pepper}),{expiryDateSecs:a}=this.ephemeralKeyPair,c=this.ephemeralKeyPair.getPublicKey(),p=this.ephemeralKeyPair.sign(e);return new Be({jwtHeader:r,openIdSignatureOrZkProof:new Xe(s),expiryDateSecs:a,ephemeralPublicKey:c,ephemeralSignature:p})}verifySignature(e){return!0}static fromBytes(e){return he.deserialize(new ye(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),y=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let w=p.aud,A=p[c];return new he({proofOrFetcher:r,ephemeralKeyPair:o,iss:y,uidKey:c,uidVal:A,aud:w,pepper:s,jwt:i,proofFetchCallback:a})}static fromDerivationPath(e,r){return bn(e,he.SLIP_0010_SEED,r)}};he.PEPPER_LENGTH=31,he.SLIP_0010_SEED="32 bytes";var Oe=he;var Kn=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 Ze(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new Ze(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let t=this.signers.filter(e=>e instanceof Oe);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 Ye({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new Ye({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 ie=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 bi="1.14.0-zeta.0";var wi={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"},Si= 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"},xi= 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"},fr= exports.NetworkToPepperAPI ={mainnet:"mainnet not yet ready, requires sdk upgrade",testnet:"https://pepper.keyless.testnet.aptoslabs.com/v0",devnet:"https://pepper.keyless.devnet.aptoslabs.com/v0",local:"https://pepper.keyless.devnet.aptoslabs.com/v0"},Ar= exports.NetworkToProverAPI ={mainnet:"mainnet not yet ready, requires sdk upgrade",testnet:"https://prover.keyless.testnet.aptoslabs.com/v0",devnet:"https://prover.keyless.devnet.aptoslabs.com/v0",local:"https://prover.keyless.devnet.aptoslabs.com/v0"},hr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(hr||{}),Tr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Ly= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function _i(n,t){let e=t.bcsToBytes(),r=new ye(e);return n.deserialize(r)}var vi={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 Ra(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _9 => _9.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${bi}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _10 => _10.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _11 => _11.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _12 => _12.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _13 => _13.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function On(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Ra({...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 ie(n,a,`Error: ${a.data}`);if(e==="Indexer"){let p=a.data;if(p.errors)throw new ie(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 ie(n,a,`${s.data}`);if(t.isPepperServiceRequest(r))throw new ie(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 vi?c=vi[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ie(n,a,`${e} error: ${c}`)}async function br(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return On({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function J(n){let{aptosConfig:t}=n;return br({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _14 => _14.clientConfig, 'optionalAccess', _15 => _15.HEADERS]),..._optionalChain([t, 'access', _16 => _16.fullnodeConfig, 'optionalAccess', _17 => _17.HEADERS])}}})}async function ym(n){return br({...n,type:"Pepper"})}async function Ct(n){let t=[],e,r=n.params;do{let i=await br({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 Xt(n){let{type:t,originMethod:e,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,y=c.getRequestUrl(t);return On({url:y,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function ot(n){let{aptosConfig:t}=n;return Xt({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _18 => _18.clientConfig, 'optionalAccess', _19 => _19.HEADERS]),..._optionalChain([t, 'access', _20 => _20.fullnodeConfig, 'optionalAccess', _21 => _21.HEADERS])}}})}async function Pi(n){let{aptosConfig:t}=n;return Xt({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _22 => _22.clientConfig, 'optionalAccess', _23 => _23.HEADERS]),..._optionalChain([t, 'access', _24 => _24.indexerConfig, 'optionalAccess', _25 => _25.HEADERS])}}})}async function Ci(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _26 => _26.clientConfig, 'optionalAccess', _27 => delete _27.API_KEY]),Xt({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _28 => _28.clientConfig, 'optionalAccess', _29 => _29.HEADERS]),..._optionalChain([e, 'access', _30 => _30.faucetConfig, 'optionalAccess', _31 => _31.HEADERS])}}})}async function Ei(n){return Xt({...n,type:"Pepper"})}async function Ii(n){return Xt({...n,type:"Prover"})}var za=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -26,7 +26,7 @@
26
26
  is_primary
27
27
  owner_address
28
28
  }
29
- `,Kn=`
29
+ `,Nn=`
30
30
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
31
31
  token_standard
32
32
  token_properties_mutated_v1
@@ -73,7 +73,7 @@
73
73
  }
74
74
  }
75
75
  }
76
- `,zi=`
76
+ `,Ui=`
77
77
  query getAccountCoinsCount($address: String) {
78
78
  current_fungible_asset_balances_aggregate(
79
79
  where: {owner_address: {_eq: $address}}
@@ -83,7 +83,7 @@
83
83
  }
84
84
  }
85
85
  }
86
- `,ki=`
86
+ `,Ri=`
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
- `,Di=`
119
+ `,zi=`
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
- `,Bi=`
153
+ `,ki=`
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
- `,Oi=`
170
+ `,Di=`
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
- ${Kn}`,vy=`
181
+ ${Nn}`,_m=`
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
- ${Kn}`,Ni=`
192
+ ${Nn}`,Bi=`
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
- ${Kn}`,Ki=`
203
+ ${Nn}`,Ki=`
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
- `,Fi=`
215
+ `,Oi=`
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
- `,Gi=`
223
+ `,Ni=`
224
224
  query getChainTopUserTransactions($limit: Int) {
225
225
  user_transactions(limit: $limit, order_by: {version: desc}) {
226
226
  version
227
227
  }
228
228
  }
229
- `,xr=`
229
+ `,wr=`
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
- `,Mi=`
248
+ `,Fi=`
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
- `,qi=`
266
+ `,Gi=`
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
- `,$i=`
279
+ `,Mi=`
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
- `,Hi=`
298
+ `,qi=`
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
- `,Vi=`
323
+ `,$i=`
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
- `,Ct=`
340
+ `,Et=`
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
- ${ka}`,_r=`
351
+ ${ka}`,Sr=`
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
- `,vr=`
358
+ `,xr=`
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
- `,Li=`
366
+ `,Hi=`
367
367
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
368
368
  token_activities_v2(
369
369
  where: $where_condition
@@ -374,7 +374,7 @@
374
374
  ...TokenActivitiesFields
375
375
  }
376
376
  }
377
- ${za}`,Pr=`
377
+ ${za}`,_r=`
378
378
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
379
379
  current_token_ownerships_v2(
380
380
  where: $where_condition
@@ -385,7 +385,7 @@
385
385
  ...CurrentTokenOwnershipFields
386
386
  }
387
387
  }
388
- ${Kn}`,Qi=`
388
+ ${Nn}`,Vi=`
389
389
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
390
390
  current_token_datas_v2(
391
391
  where: $where_condition
@@ -425,5 +425,5 @@
425
425
  }
426
426
  }
427
427
  }
428
- `;async function Fn(n){let{aptosConfig:t}=n,{data:e}=await J({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Wi(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await J({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _32 => _32.withTransactions])}});return i}async function ji(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await J({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _33 => _33.withTransactions])}});return i}async function Gn(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await st({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _34 => _34.ledgerVersion])},body:r})).data}async function Xi(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:Gi,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await Ei({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function Da(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:vr},originMethod:"getProcessorStatuses"})).processor_status}async function Mn(n){let t=await Da({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function qn(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:vr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var Cr=new Map;function Et(n,t,e){return async(...r)=>{if(Cr.has(t)){let{value:o,timestamp:s}=Cr.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return Cr.set(t,{value:i,timestamp:Date.now()}),i}}async function Te(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await J({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function Ji(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Pt({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _35 => _35.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _36 => _36.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _37 => _37.limit]), () => (1e3))}})}async function $n(n){return _optionalChain([n, 'access', _38 => _38.options, 'optionalAccess', _39 => _39.ledgerVersion])!==void 0?Yi(n):Et(async()=>Yi(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Yi(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await J({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _40 => _40.ledgerVersion])}});return o}async function eo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Pt({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _41 => _41.offset]),limit:_optionalChain([r, 'optionalAccess', _42 => _42.limit])}})}async function to(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Pt({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _43 => _43.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _44 => _44.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _45 => _45.limit]), () => (999))}})}async function Er(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await J({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _46 => _46.ledgerVersion])}});return o.data}async function Ir(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await Er({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Gn({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 re&&a.data.error_code==="table_item_not_found")return s;throw a}}async function no(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:Ki,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 ro(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _47 => _47.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _48 => _48.tokenStandard])});let s={query:Oi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _49 => _49.offset]),limit:_optionalChain([r, 'optionalAccess', _50 => _50.limit]),order_by:_optionalChain([r, 'optionalAccess', _51 => _51.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function io(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', _52 => _52.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _53 => _53.tokenStandard])});let c={query:Ni,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _54 => _54.offset]),limit:_optionalChain([i, 'optionalAccess', _55 => _55.limit]),order_by:_optionalChain([i, 'optionalAccess', _56 => _56.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function oo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _58 => _58.tokenStandard])}});let s={query:Di,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.limit]),order_by:_optionalChain([r, 'optionalAccess', _61 => _61.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function so(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Fi,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ao(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,i=u.from(e).toStringLong(),o=await Ur({aptosConfig:t,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Ur(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _62 => _62.where]),owner_address:{_eq:i}},s={query:ki,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([r, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([r, 'optionalAccess', _65 => _65.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:zi,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 uo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:Bi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _66 => _66.offset]),limit:_optionalChain([r, 'optionalAccess', _67 => _67.limit]),order_by:_optionalChain([r, 'optionalAccess', _68 => _68.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function po(n){let{aptosConfig:t,privateKey:e}=n,r=new O(e.publicKey());if(e instanceof Xe){let o=F.fromPublicKey({publicKey:r}).derivedAddress();return Ne.fromPrivateKey({privateKey:e,address:o})}if(e instanceof M){let i=F.fromPublicKey({publicKey:r});if(await Zi({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Ne.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=F.fromPublicKey({publicKey:r.publicKey});if(await Zi({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return Ne.fromPrivateKey({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Zi(n){let{aptosConfig:t,authKey:e}=n,r=await Ir({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await Te({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 lo(n){let{aptosConfig:t,options:e}=n;return Pt({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([e, 'optionalAccess', _70 => _70.limit])}})}async function Vn(n){let{aptosConfig:t}=n;return Et(async()=>{let{data:e}=await J({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function go(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await J({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Yt(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await J({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function mo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Yt({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _71 => _71.status])===404)return!0;throw r}}async function Ba(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await J({aptosConfig:t,path:`transactions/wait_by_hash/${e}`,originMethod:"longWaitForTransaction"});return r}async function It(n){let{aptosConfig:t,transactionHash:e,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _72 => _72.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.checkSuccess]), () => (!0)),s=!0,a=0,c,p,m=200,S=1.5;function A(l){if(!(l instanceof re)||(p=l,l.status!==404&&l.status>=400&&l.status<500))throw l}try{c=await Yt({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(l){A(l)}if(s){let l=Date.now();try{c=await Ba({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(W){A(W)}a=(Date.now()-l)/1e3}for(;s&&!(a>=i);){try{if(c=await Yt({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(l){A(l)}await _chunkKSEUZTKYjs.b.call(void 0, m),a+=m/1e3,m*=S}if(c===void 0)throw p||new Hn(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Hn(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Rr(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function Ln(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 Mn({aptosConfig:t}):s=(await qn({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkKSEUZTKYjs.b.call(void 0, 200)}}var Hn=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Rr=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function b(n){n.minimumLedgerVersion!==void 0&&await Ln({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var Zt=class{constructor(t){this.config=t}async getAccountInfo(t){return Te({aptosConfig:this.config,...t})}async getAccountModules(t){return Ji({aptosConfig:this.config,...t})}async getAccountModule(t){return $n({aptosConfig:this.config,...t})}async getAccountTransactions(t){return eo({aptosConfig:this.config,...t})}async getAccountResources(t){return to({aptosConfig:this.config,...t})}async getAccountResource(t){return Er({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Ir({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),no({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ro({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),io({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),oo({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),so({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ur({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),co({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:En,...t})}async getAccountCoinAmount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ao({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),uo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return po({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Qn=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _74 => _74.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _75 => _75.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _76 => _76.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _77 => _77.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _78 => _78.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _79 => _79.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _80 => _80.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _81 => _81.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _82 => _82.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _83 => _83.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _84 => _84.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 _i[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 vi[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 xi[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 hr[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 Tr[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return hr[this.network]===t}isProverServiceRequest(t){return Tr[this.network]===t}};function yo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function fo(n){return!!n.match(/\s/)}function Na(n){return!!n.match(/^T[0-9]+$/)}function Ka(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!fo(r))break}return e}var Fa=(A=>(A.InvalidTypeTag="unknown type",A.UnexpectedGenericType="unexpected generic type",A.UnexpectedTypeArgumentClose="unexpected '>'",A.UnexpectedWhitespaceCharacter="unexpected whitespace character",A.UnexpectedComma="unexpected ','",A.TypeArgumentCountMismatch="type argument count doesn't match expected amount",A.MissingTypeArgumentClose="no matching '>' for '<'",A.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",A.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",A.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",A.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",A.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",A))(Fa||{}),E= 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', _85 => _85.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 W=Wn(a,i,e);o.push(W)}let m=r.pop();if(m===void 0)throw new E(n,"unexpected '>'");if(c!==o.length)throw new E(n,"type argument count doesn't match expected amount");let{savedStr:S,savedTypes:A,savedExpectedTypes:l}=m;i=o,o=A,a=S,c=l}else if(p===","){if(a.length!==0){let m=Wn(a,i,e);i=[],o.push(m),a="",c+=1}}else if(fo(p)){let m=!1;if(a.length!==0){let A=Wn(a,i,e);i=[],o.push(A),a="",m=!0}s=Ka(n,s);let S=n[s];if(s<n.length&&m&&S!==","&&S!==">")throw new E(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new E(n,"no matching '>' for '<'");switch(o.length){case 0:return Wn(a,i,e);case 1:if(a==="")return o[0];throw new E(n,"unexpected ','");default:throw new E(n,"unexpected whitespace character")}}function Wn(n,t,e){switch(n){case"&signer":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new In(new tt);case"signer":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new tt;case"bool":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new G;case"address":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new Y;case"u8":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new Ae;case"u16":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new ht;case"u32":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new Tt;case"u64":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new L;case"u128":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new bt;case"u256":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new wt;case"vector":if(t.length!==1)throw new E(n,"vector type expected to have exactly one type argument");return new C(t[0]);default:if(Na(n)){if(e)return new k(Number(n.split("T")[1]));throw new E(n,"unexpected generic type")}if(!n.match(/:/))throw new E(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new E(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!yo(r[1]))throw new E(n,"module name must only contain alphanumeric or '_' characters");if(!yo(r[2]))throw new E(n,"struct name must only contain alphanumeric or '_' characters");return new y(new xe(u.fromString(r[0]),new U(r[1]),new U(r[2]),t))}}function Ao(n){return typeof n=="boolean"}function Ut(n){return typeof n=="string"}function jn(n){return typeof n=="number"}function Xn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ho(n){return n==null}function To(n){return zr(n)||Dr(n)||Br(n)||Or(n)||Nr(n)||Kr(n)||Fr(n)||Yn(n)||kr(n)||Ga(n)||n instanceof T||n instanceof ze}function zr(n){return n instanceof R}function Yn(n){return n instanceof u}function kr(n){return n instanceof w}function Ga(n){return n instanceof He}function Dr(n){return n instanceof K}function Br(n){return n instanceof oe}function Or(n){return n instanceof se}function Nr(n){return n instanceof N}function Kr(n){return n instanceof ae}function Fr(n){return n instanceof ce}function bo(n){return"bytecode"in n}function I(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function wo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Jt(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 Ma=new TextEncoder;function Mr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _86 => _86.map, 'call', _87 => _87(t=>Ut(t)?Ee(t):t)]), () => ([]))}async function So(n,t,e,r){let i=await $n({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function xo(n,t,e,r){let i=await So(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=wo(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 _o(n,t,e,r){let i=await So(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 To(n)?(Gr(t,n,e),n):qa(n,t,e,r)}function qa(n,t,e,r){if(t.isBool()){if(Ao(n))return new R(n);I("boolean",e)}if(t.isAddress()){if(Ut(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isU8()){if(jn(n))return new K(n);I("number",e)}if(t.isU16()){if(jn(n))return new oe(n);I("number",e)}if(t.isU32()){if(jn(n))return new se(n);I("number",e)}if(t.isU64()){if(Xn(n))return new N(BigInt(n));I("bigint | number | string",e)}if(t.isU128()){if(Xn(n))return new ae(BigInt(n));I("bigint | number | string",e)}if(t.isU256()){if(Xn(n))return new ce(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(Ut(n))return T.U8(Ma.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(Ut(n))return new w(n);I("string",e)}if(t.isObject()){if(Ut(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isOption())return ho(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 Gr(n,t,e){if(n.isBool()){if(zr(t))return;I("Bool",e)}if(n.isAddress()){if(Yn(t))return;I("AccountAddress",e)}if(n.isU8()){if(Dr(t))return;I("U8",e)}if(n.isU16()){if(Br(t))return;I("U16",e)}if(n.isU32()){if(Or(t))return;I("U32",e)}if(n.isU64()){if(Nr(t))return;I("U64",e)}if(n.isU128()){if(Kr(t))return;I("U128",e)}if(n.isU256()){if(Fr(t))return;I("U256",e)}if(n.isVector()){if(t instanceof T){t.values.length>0&&Gr(n.value,t.values[0],e);return}I("MoveVector",e)}if(n instanceof y){if(n.isString()){if(kr(t))return;I("MoveString",e)}if(n.isObject()){if(Yn(t))return;I("AccountAddress",e)}if(n.isOption()){if(t instanceof ze){t.value!==void 0&&Gr(n.value.typeArgs[0],t.value,e);return}I("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function Jn(n){if(bo(n))return La(n);let{moduleAddress:t,moduleName:e,functionName:r}=Jt(n.function),i=await Eo({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:xo});return Ha({...n,abi:i})}function Ha(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=Jt(n.function),o=Mr(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=rt.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Vt(new Qt(c,new Wt(a)))}return new Ht(a)}async function vo(n){let{moduleAddress:t,moduleName:e,functionName:r}=Jt(n.function),i=await Eo({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:_o});return Va({abi:i,...n})}function Va(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=Jt(n.function),o=Mr(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', _88 => _88.functionArguments, 'optionalAccess', _89 => _89.map, 'call', _90 => _90((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 rt.build(`${e}::${r}`,i,o,s)}function La(n){return new $t(new Lt(g.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Qa(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>wr[t.network]?{chainId:wr[t.network]}:{chainId:(await Fn({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _91 => _91.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Vn({aptosConfig:t})).gas_estimate},c=async()=>{let at=async()=>_optionalChain([i, 'optionalAccess', _92 => _92.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Te({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await at()}catch (e2){return 0}else return at()},[{chainId:p},{gasEstimate:m},S]=await Promise.all([s(),a(),c()]),{maxGasAmount:A,gasUnitPrice:l,expireTimestamp:W}={maxGasAmount:_optionalChain([i, 'optionalAccess', _93 => _93.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _94 => _94.gasUnitPrice]), () => (BigInt(m))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _95 => _95.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new Q(u.from(e),BigInt(S),r,BigInt(A),BigInt(l),BigInt(W),new At(p))}async function $r(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await Qa({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _96 => _96.secondarySignerAddresses, 'optionalAccess', _97 => _97.map, 'call', _98 => _98(c=>u.from(c))]), () => ([]));return new kn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new zn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Po(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=Zn(t);if(e.feePayerAddress){let a=new ve(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(S=>Zn(S)));let p=Zn(i),m=new ot(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new Ce(a.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let a=new _e(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(m=>Zn(m));let p=new it(o,e.secondarySignerAddresses,c);return new Ce(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof fe)s=new St(o.public_key,o.signature);else if(o instanceof de)s=new xt(o);else throw new Error("Invalid public key");return new Ce(e.rawTransaction,s).bcsToBytes()}function Zn(n){return n instanceof O?new de(n,new q(new P(new Uint8Array(64)))):new fe(new v(n.toUint8Array()),new P(new Uint8Array(64)))}function Hr(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=Pi($,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 ot(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 it(i,t.secondarySignerAddresses,r)}else i instanceof fe?o=new St(i.public_key,i.signature):o=new xt(i);return new Ce(t.rawTransaction,o).bcsToBytes()}function Co(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var Wa=Co(["APTOS::Transaction"]);function Wf(n){let t=Hr(n);return new g(Co([Wa,new Uint8Array([0]),t])).toString()}function jf(n,t,e,r){if(n instanceof ve){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let i=new ot(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:e});return new Ce(n.raw_txn,i).bcsToBytes()}if(n instanceof _e){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let i=new it(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new Ce(n.raw_txn,i).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}async function Eo({key:n,moduleAddress:t,moduleName:e,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Et(async()=>s(t,e,r,i),`${n}-${i.network}-${t}-${e}-${r}`,1e3*60*5)()}async function h(n){let t=await ja(n);return Xa(n,t)}async function ja(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await Jn(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await Jn(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await Jn(r)),i}async function Xa(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(Ya(n)&&(o=u.ZERO.toString()),Za(n)){let{secondarySignerAddresses:s}=n;return $r({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return $r({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function Ya(n){return n.withFeePayer===!0}function Za(n){return"secondarySignerAddresses"in n}function Io(n){let{transaction:t}=n;return Oe(t)}function er(n){let{signer:t,transaction:e}=n;return t.signWithAuthenticator(e)}async function Vr(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Po({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await st({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _99 => _99.options, 'optionalAccess', _100 => _100.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _101 => _101.options, 'optionalAccess', _102 => _102.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _103 => _103.options, 'optionalAccess', _104 => _104.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function tr(n){let{aptosConfig:t}=n,e=Hr({...n}),{data:r}=await st({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function en(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof Ke||e instanceof On)&&await e.waitForProofFetch();let i=er({signer:e,transaction:r});return tr({aptosConfig:t,transaction:r,senderAuthenticator:i})}var Ja={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function Uo(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:Ja},options:o})}var ec={typeParameters:[],parameters:[new Ae,C.u8(),new Ae,C.u8(),C.u8(),C.u8()]};async function Ro(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await Te({aptosConfig:t,accountAddress:e.accountAddress}),o=Ne.fromPrivateKey({privateKey:r,legacy:!0}),a=new Rn({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 K(e.signingScheme),T.U8(e.publicKey.toUint8Array()),new K(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:ec}});return en({aptosConfig:t,signer:e,transaction:m})}var tc={typeParameters:[{constraints:[]}],parameters:[new Y,new L]};async function zo(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, () => (En))],functionArguments:[r,i],abi:tc},options:s})}var tn=class{constructor(t){this.config=t}async transferCoinTransaction(t){return zo({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>"},ie="0x4::token::Token";async function ko(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:Qi,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Do(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:Pr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Bo(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:Pr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _105 => _105.offset]),limit:_optionalChain([r, 'optionalAccess', _106 => _106.limit]),order_by:_optionalChain([r, 'optionalAccess', _107 => _107.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Oo(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:Li,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _108 => _108.offset]),limit:_optionalChain([r, 'optionalAccess', _109 => _109.limit]),order_by:_optionalChain([r, 'optionalAccess', _110 => _110.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var nc={typeParameters:[],parameters:[new y(_()),new L,new y(_()),new y(_()),new G,new G,new G,new G,new G,new G,new G,new G,new G,new L,new L]};async function No(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 w(n.description),new N(_nullishCoalesce(n.maxSupply, () => (qe))),new w(n.name),new w(n.uri),new R(_nullishCoalesce(n.mutableDescription, () => (!0))),new R(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new R(_nullishCoalesce(n.mutableURI, () => (!0))),new R(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new R(_nullishCoalesce(n.mutableTokenName, () => (!0))),new R(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new R(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new R(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new R(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new N(_nullishCoalesce(n.royaltyNumerator, () => (0))),new N(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:nc},options:e})}async function Lr(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', _111 => _111.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _112 => _112.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:t,query:{query:xr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Ko(n){let{aptosConfig:t,collectionId:e}=n,i={collection_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:xr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Fo(n){return(await Lr(n)).collection_id}var rc={typeParameters:[],parameters:[new y(_()),new y(_()),new y(_()),new y(_()),new C(new y(_())),new C(new y(_())),new C(C.u8())]};async function Go(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:m}=n,S=_optionalChain([p, 'optionalAccess', _113 => _113.map, 'call', _114 => _114(A=>Fe[A])]);return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new w(i),new w(o),new w(s),new w(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(S, () => ([]))),es(_nullishCoalesce(m, () => ([])),_nullishCoalesce(S, () => ([])))],abi:rc},options:e})}var ic={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new Y]};async function Mo(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, () => (ie))],functionArguments:[u.from(r),u.from(i)],abi:ic},options:s})}var oc={typeParameters:[],parameters:[new y(_()),new y(_()),new y(_()),new y(_()),new C(new y(_())),new C(new y(_())),new C(C.u8()),new Y]};async function qo(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:m,options:S}=n;if(_optionalChain([c, 'optionalAccess', _115 => _115.length])!==_optionalChain([m, 'optionalAccess', _116 => _116.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _117 => _117.length])!==_optionalChain([m, 'optionalAccess', _118 => _118.length]))throw new Error("Property types and property values counts do not match");let A=_optionalChain([p, 'optionalAccess', _119 => _119.map, 'call', _120 => _120(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(A, () => ([]))),es(_nullishCoalesce(m, () => ([])),_nullishCoalesce(A, () => ([]))),a],abi:oc},options:S})}var sc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0)))]};async function $o(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, () => (ie))],functionArguments:[u.from(r)],abi:sc},options:o})}var ac={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0)))]};async function Ho(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, () => (ie))],functionArguments:[r],abi:ac},options:o})}var cc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0)))]};async function Vo(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, () => (ie))],functionArguments:[r],abi:cc},options:o})}var uc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new y(_())]};async function Lo(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, () => (ie))],functionArguments:[u.from(i),new w(r)],abi:uc},options:s})}var pc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new y(_())]};async function Qo(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, () => (ie))],functionArguments:[u.from(i),new w(r)],abi:pc},options:s})}var dc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new y(_())]};async function Wo(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, () => (ie))],functionArguments:[u.from(i),new w(r)],abi:dc},options:s})}var lc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new y(_()),new y(_()),C.u8()]};async function jo(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, () => (ie))],functionArguments:[u.from(s),new w(r),new w(Fe[i]),T.U8(Qr(o,Fe[i]))],abi:lc},options:c})}var gc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new y(_())]};async function Xo(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, () => (ie))],functionArguments:[u.from(i),new w(r)],abi:gc},options:s})}var mc={typeParameters:[{constraints:["key"]}],parameters:[new y(Z(new k(0))),new y(_()),new y(_()),C.u8()]};async function Yo(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, () => (ie))],functionArguments:[u.from(s),new w(r),new w(Fe[i]),Qr(o,Fe[i])],abi:mc},options:c})}var yc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(Z(new k(0))),new y(_()),new k(1)]};async function Zo(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, () => (ie)),Fe[i]],functionArguments:[u.from(s),new w(r),o],abi:yc},options:c})}var fc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(Z(new k(0))),new y(_()),new k(1)]};async function Jo(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, () => (ie)),Fe[i]],functionArguments:[u.from(s),new w(r),o],abi:fc},options:c})}function es(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(Qr(n[i],r))}),e}function Qr(n,t){let e=Ee(t);return Rt(n,e,0,[]).bcsToBytes()}var nn=class{constructor(t){this.config=t}async getCollectionData(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Lr({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...t})}async getCollectionId(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Fo({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ko({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Do({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Bo({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Oo({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return No({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return Go({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return Mo({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return qo({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return $o({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return Ho({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return Vo({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return Lo({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return Qo({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return Wo({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return jo({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return Xo({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return Yo({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return Zo({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return Jo({aptosConfig:this.config,...t})}};var ts=300,Ac=n=>{if(n&&n.length>ts)throw new Error(`Event type length exceeds the maximum length of ${ts}`)};async function ns(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', _121 => _121.orderBy])};return rn({aptosConfig:t,options:o})}async function rs(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', _122 => _122.orderBy])};return rn({aptosConfig:e,options:a})}async function is(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', _123 => _123.orderBy])};return rn({aptosConfig:e,options:a})}async function rn(n){let{aptosConfig:t,options:e}=n;Ac(_optionalChain([e, 'optionalAccess', _124 => _124.where, 'optionalAccess', _125 => _125.indexed_type, 'optionalAccess', _126 => _126._eq]));let r={query:$i,variables:{where_condition:_optionalChain([e, 'optionalAccess', _127 => _127.where]),offset:_optionalChain([e, 'optionalAccess', _128 => _128.offset]),limit:_optionalChain([e, 'optionalAccess', _129 => _129.limit]),order_by:_optionalChain([e, 'optionalAccess', _130 => _130.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var on=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ns({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),rs({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),is({aptosConfig:this.config,...t})}async getEvents(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _131 => _131.minimumLedgerVersion]),processorType:"events_processor"}),rn({aptosConfig:this.config,...t})}};async function os(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _132 => _132.timeoutSecs])||20,{data:s}=await Ii({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await It({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _133 => _133.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var sn=class{constructor(t){this.config=t}async fundAccount(t){let e=await os({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _134 => _134.options, 'optionalAccess', _135 => _135.waitForIndexer])!==!1&&await Ln({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function Wr(n){let{aptosConfig:t,options:e}=n,r={query:Vi,variables:{where_condition:_optionalChain([e, 'optionalAccess', _136 => _136.where]),limit:_optionalChain([e, 'optionalAccess', _137 => _137.limit]),offset:_optionalChain([e, 'optionalAccess', _138 => _138.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:Hi,variables:{where_condition:_optionalChain([e, 'optionalAccess', _139 => _139.where]),limit:_optionalChain([e, 'optionalAccess', _140 => _140.limit]),offset:_optionalChain([e, 'optionalAccess', _141 => _141.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function as(n){let{aptosConfig:t,options:e}=n,r={query:Mi,variables:{where_condition:_optionalChain([e, 'optionalAccess', _142 => _142.where]),limit:_optionalChain([e, 'optionalAccess', _143 => _143.limit]),offset:_optionalChain([e, 'optionalAccess', _144 => _144.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var hc={typeParameters:[],parameters:[Ee("0x1::object::Object"),new Y,new L]};async function cs(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:hc},options:s})}var an=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _145 => _145.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Wr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _146 => _146.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Wr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _147 => _147.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ss({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _148 => _148.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),as({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return cs({aptosConfig:this.config,...t})}};async function Ge(n){let{aptosConfig:t,payload:e,options:r}=n,i=await vo({...e,aptosConfig:t}),o=new D;i.serialize(o);let s=o.toUint8Array(),{data:a}=await st({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _149 => _149.ledgerVersion])},body:s});return a}var cn=class{constructor(t){this.config=t}async getLedgerInfo(){return Fn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Wi({aptosConfig:this.config,...t})}async getBlockByHeight(t){return ji({aptosConfig:this.config,...t})}async getTableItem(t){return Gn({aptosConfig:this.config,...t})}async view(t){return Ge({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Xi({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Mn({aptosConfig:this.config})}async getProcessorStatus(t){return qn({aptosConfig:this.config,processorType:t})}};var us=["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 Me(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. ${us}`);if(e&&!ps(e))throw new Error(`${e} is not valid. ${us}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Tc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",bc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Tc,custom:null,devnet:null,randomnet:null};function Ie(n){let t=bc[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var nr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function ds(n){let{aptosConfig:t,name:e}=n,r=Ie(t),{domainName:i,subdomainName:o}=Me(e),s=await Ge({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=nr(s[0]);return a?u.from(a):void 0}async function ls(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:S}=Me(r),A=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(S&&!A)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(A&&!S)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let cr=_nullishCoalesce(e.years, () => (1));if(cr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Is=cr*31536e3;return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[m,Is,o,s]},options:a})}if(!S)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await jr({aptosConfig:t,name:m});if(!l)throw new Error("The domain does not exist");let W=e.policy==="subdomain:independent"?e.expirationDate:l;if(W>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,S,Math.round(W/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function jr(n){let{aptosConfig:t,name:e}=n,r=Ie(t),{domainName:i,subdomainName:o}=Me(e);try{let s=await Ge({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e3){return}}async function gs(n){let{aptosConfig:t,address:e}=n,r=Ie(t),i=await Ge({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=nr(i[1]),s=nr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function ms(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}=Me(r);return await h({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function ys(n){let{aptosConfig:t,name:e}=n,r=Ie(t),{domainName:i,subdomainName:o}=Me(e),s=await Ge({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=nr(s[0]);return a?u.from(a):void 0}async function fs(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=Ie(t),{domainName:a,subdomainName:c}=Me(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 As(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:i=""}=Me(e),a=(await f({aptosConfig:t,query:{query:Ct,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=un(a)),a}async function hs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await Xr({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ct,variables:{limit:_optionalChain([e, 'optionalAccess', _150 => _150.limit]),offset:_optionalChain([e, 'optionalAccess', _151 => _151.offset]),order_by:_optionalChain([e, 'optionalAccess', _152 => _152.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _153 => _153.options, 'optionalAccess', _154 => _154.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(un)}async function Ts(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await Xr({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ct,variables:{limit:_optionalChain([e, 'optionalAccess', _155 => _155.limit]),offset:_optionalChain([e, 'optionalAccess', _156 => _156.offset]),order_by:_optionalChain([e, 'optionalAccess', _157 => _157.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _158 => _158.options, 'optionalAccess', _159 => _159.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(un)}async function bs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await Xr({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ct,variables:{limit:_optionalChain([e, 'optionalAccess', _160 => _160.limit]),offset:_optionalChain([e, 'optionalAccess', _161 => _161.offset]),order_by:_optionalChain([e, 'optionalAccess', _162 => _162.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _163 => _163.options, 'optionalAccess', _164 => _164.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(un)}async function ws(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ct,variables:{limit:_optionalChain([e, 'optionalAccess', _165 => _165.limit]),offset:_optionalChain([e, 'optionalAccess', _166 => _166.offset]),order_by:_optionalChain([e, 'optionalAccess', _167 => _167.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _168 => _168.options, 'optionalAccess', _169 => _169.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(un)}async function Xr(n){let{aptosConfig:t}=n,e=Ie(t),[r]=await Ge({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 Ss(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=Ie(t),a=i*31536e3,{domainName:c,subdomainName:p}=Me(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 un(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var pn=class{constructor(t){this.config=t}async getOwnerAddress(t){return ds({aptosConfig:this.config,...t})}async getExpiration(t){return jr({aptosConfig:this.config,...t})}async getTargetAddress(t){return ys({aptosConfig:this.config,...t})}async setTargetAddress(t){return fs({aptosConfig:this.config,...t})}async getPrimaryName(t){return gs({aptosConfig:this.config,...t})}async setPrimaryName(t){return ms({aptosConfig:this.config,...t})}async registerName(t){return ls({aptosConfig:this.config,...t})}async renewDomain(t){return Ss({aptosConfig:this.config,...t})}async getName(t){return As({aptosConfig:this.config,...t})}async getAccountNames(t){return hs({aptosConfig:this.config,...t})}async getAccountDomains(t){return Ts({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return bs({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return ws({aptosConfig:this.config,...t})}};async function xs(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:_r,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 _s(n){let{aptosConfig:t,options:e}=n,r={query:_r,variables:{order_by:_optionalChain([e, 'optionalAccess', _170 => _170.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function vs(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:qi,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var dn=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _171 => _171.minimumLedgerVersion]),processorType:"stake_processor"}),xs({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _172 => _172.minimumLedgerVersion]),processorType:"stake_processor"}),_s({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _173 => _173.minimumLedgerVersion]),processorType:"stake_processor"}),vs({aptosConfig:this.config,...t})}};var rr=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 Yr(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 Zr(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 Vr({aptosConfig:this.config,...t})}async multiAgent(t){return Vr({aptosConfig:this.config,...t})}};_chunkKSEUZTKYjs.a.call(void 0, [Zr],zt.prototype,"simple",1),_chunkKSEUZTKYjs.a.call(void 0, [Zr],zt.prototype,"multiAgent",1);var kt=class{constructor(t){this.config=t}async simple(t){return tr({aptosConfig:this.config,...t})}async multiAgent(t){return tr({aptosConfig:this.config,...t})}};_chunkKSEUZTKYjs.a.call(void 0, [Yr],kt.prototype,"simple",1),_chunkKSEUZTKYjs.a.call(void 0, [Yr],kt.prototype,"multiAgent",1);var ir=()=>Math.floor(Date.now()/1e3),or= 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 _chunkKSEUZTKYjs.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=ir();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkKSEUZTKYjs.b.call(void 0, this.sleepTime),ir()-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 Te({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await Te({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 _chunkKSEUZTKYjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=ir();for(;this.lastUncommintedNumber!==this.currentNumber;)ir()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkKSEUZTKYjs.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 Dt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _174 => _174.pendingDequeue, 'access', _175 => _175.shift, 'call', _176 => _176(), 'optionalAccess', _177 => _177.resolve, 'call', _178 => _178(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 Bt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Bt=class extends Error{};var Ps="fulfilled",Cs= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Cs||{}),sr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(e,r,i=30,o=100,s=10){super();this.taskQueue=new Dt;this.transactionsQueue=new Dt;this.outstandingTransactions=new Dt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new or(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=en({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,e])}}catch(e){if(e instanceof Bt)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===Ps?(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 Bt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let i=[];i.push(It({aptosConfig:this.aptosConfig,transactionHash:e.value.hash,options:{timeoutSecs:3}}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Ps?(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 ar=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new sr(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 ln=class{constructor(t){this.config=t,this.build=new rr(this.config),this.simulate=new zt(this.config),this.submit=new kt(this.config),this.batch=new ar(this.config)}async getTransactions(t){return lo({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return go({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Yt({aptosConfig:this.config,...t})}async isPendingTransaction(t){return mo({aptosConfig:this.config,...t})}async waitForTransaction(t){return It({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Vn({aptosConfig:this.config})}getSigningMessage(t){return Io(t)}async publishPackageTransaction(t){return Uo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Ro({aptosConfig:this.config,...t})}sign(t){return er({...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,er({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 en({aptosConfig:this.config,signer:e,transaction:r})}};async function Jr(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:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Ui({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function _c(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i,uidKey:o,extraFieldKey:s}=n,a=_jwtdecode.jwtDecode.call(void 0, e),c;if(s){let W=a[s];c=`"${s}":"${W}",`}let p={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:Number(r.expiryDateSecs),exp_horizon_secs:Gt,pepper:g.fromHexInput(i).toStringWithoutPrefix(),extra_field:s,uid_key:o||"sub"},{data:m}=await Ri({aptosConfig:t,path:"prove",body:p,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),S=m.proof,A=new lt({a:S.a,b:S.b,c:S.c});return new Se({proof:A,extraField:c,trainingWheelsSignature:pe.fromHex(m.training_wheels_signature)})}async function Es(n){let{proofFetchCallback:t}=n,{pepper:e}=n;if(e===void 0)e=await Jr(n);else if(g.fromHexInput(e).toUint8Array().length!==31)throw new Error("Pepper needs to be 31 bytes");let r=_c({...n,pepper:e}),i=t?r:await r;return Ke.fromJWTAndProof({...n,proof:i,pepper:e,proofFetchCallback:t})}var gn=class{constructor(t){this.config=t}async getPepper(t){return Jr({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return Es({aptosConfig:this.config,...t})}};var ee=class{constructor(t){this.config=new Qn(t),this.account=new Zt(this.config),this.ans=new pn(this.config),this.coin=new tn(this.config),this.digitalAsset=new nn(this.config),this.event=new on(this.config),this.faucet=new sn(this.config),this.fungibleAsset=new an(this.config),this.general=new cn(this.config),this.staking=new dn(this.config),this.transaction=new ln(this.config),this.keyless=new gn(this.config)}};function le(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))})}le(ee,Zt,"account");le(ee,pn,"ans");le(ee,tn,"coin");le(ee,nn,"digitalAsset");le(ee,on,"event");le(ee,sn,"faucet");le(ee,an,"fungibleAsset");le(ee,cn,"general");le(ee,dn,"staking");le(ee,ln,"transaction");le(ee,gn,"keyless");exports.APTOS_BIP44_DEFAULT_DERIVATION_PATH = Lu; exports.APTOS_BIP44_REGEX = $s; exports.APTOS_COIN = En; exports.APTOS_HARDENED_REGEX = qs; exports.Account = Ne; exports.AccountAddress = u; exports.AccountAuthenticator = $; exports.AccountAuthenticatorEd25519 = fe; exports.AccountAuthenticatorMultiEd25519 = Pn; exports.AccountAuthenticatorMultiKey = yt; exports.AccountAuthenticatorSingleKey = de; exports.AccountAuthenticatorVariant = ii; exports.AccountPublicKey = te; exports.AccountSequenceNumber = or; exports.AddressInvalidReason = Ks; exports.AnyPublicKey = O; exports.AnyPublicKeyVariant = pr; exports.AnySignature = q; exports.AnySignatureVariant = oi; exports.Aptos = ee; exports.AptosApiError = re; exports.AptosApiType = Mt; exports.AptosConfig = Qn; exports.AuthenticationKey = F; exports.Bool = R; exports.CKDPriv = Vs; exports.ChainId = At; exports.DEFAULT_MAX_GAS_AMOUNT = hi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Ti; exports.DEFAULT_TXN_TIMEOUT_SEC = Cn; exports.DeriveScheme = Os; exports.Deserializer = ge; exports.EPK_HORIZON_SECS = Gt; exports.Ed25519Account = _t; exports.Ed25519PrivateKey = M; exports.Ed25519PublicKey = v; exports.Ed25519Signature = P; exports.EntryFunction = rt; exports.EntryFunctionBytes = An; exports.EphemeralCertificate = ai; exports.EphemeralKeyPair = Bn; exports.EphemeralPublicKey = Ze; exports.EphemeralPublicKeyVariant = dr; exports.EphemeralSignature = pe; exports.EphemeralSignatureVariant = si; exports.FeePayerRawTransaction = ve; exports.FixedBytes = He; exports.Groth16Zkp = lt; exports.HARDENED_OFFSET = gr; exports.Hex = g; exports.HexInvalidReason = zs; exports.Identifier = U; exports.KeyType = Hs; exports.KeylessAccount = Ke; exports.KeylessPublicKey = De; exports.KeylessSignature = Be; exports.MAX_AUD_VAL_BYTES = ha; exports.MAX_COMMITED_EPK_BYTES = sd; exports.MAX_EXTRA_FIELD_BYTES = id; exports.MAX_ISS_VAL_BYTES = rd; exports.MAX_JWT_HEADER_B64_BYTES = od; exports.MAX_UID_KEY_BYTES = Ta; exports.MAX_UID_VAL_BYTES = ba; exports.MimeType = hn; exports.ModuleId = qt; exports.MoveAbility = ci; exports.MoveFunctionVisibility = Ds; exports.MoveOption = ze; exports.MoveString = w; exports.MoveVector = T; exports.MultiAgentRawTransaction = _e; exports.MultiAgentTransaction = kn; exports.MultiEd25519PublicKey = pt; exports.MultiEd25519Signature = Qe; exports.MultiKey = mt; exports.MultiKeyAccount = On; exports.MultiSig = Qt; exports.MultiSigTransactionPayload = Wt; exports.MultiSignature = et; exports.Network = br; exports.NetworkToChainId = wr; exports.NetworkToFaucetAPI = vi; exports.NetworkToIndexerAPI = xi; exports.NetworkToNetworkName = Qm; exports.NetworkToNodeAPI = _i; exports.NetworkToPepperAPI = hr; exports.NetworkToProverAPI = Tr; exports.OpenIdSignature = gt; exports.OpenIdSignatureOrZkProof = Je; exports.ParsingError = V; exports.ProcessorType = ft; exports.PublicKey = Ve; exports.RAW_TRANSACTION_SALT = bi; exports.RAW_TRANSACTION_WITH_DATA_SALT = wi; exports.RawTransaction = Q; exports.RawTransactionWithData = Un; exports.RoleType = Bs; exports.RotationProofChallenge = Rn; exports.Script = Lt; exports.ScriptTransactionArgumentVariants = Nt; exports.Secp256k1PrivateKey = Xe; exports.Secp256k1PublicKey = je; exports.Secp256k1Signature = Ye; exports.Serializable = d; exports.Serializer = D; exports.Signature = B; exports.SignedGroth16Signature = Se; exports.SignedTransaction = Ce; exports.SigningScheme = me; exports.SigningSchemeInput = Tn; exports.SimpleTransaction = zn; exports.SingleKeyAccount = vt; exports.StructTag = xe; exports.TransactionAuthenticator = Pe; exports.TransactionAuthenticatorEd25519 = St; exports.TransactionAuthenticatorFeePayer = ot; exports.TransactionAuthenticatorMultiAgent = it; exports.TransactionAuthenticatorMultiEd25519 = Ar; exports.TransactionAuthenticatorSingleSender = xt; exports.TransactionAuthenticatorVariant = ri; exports.TransactionPayload = nt; exports.TransactionPayloadEntryFunction = Ht; exports.TransactionPayloadMultiSig = Vt; exports.TransactionPayloadScript = $t; exports.TransactionPayloadVariants = ti; exports.TransactionResponseType = lr; exports.TransactionVariants = ni; exports.TransactionWorker = sr; exports.TransactionWorkerEventsEnum = Cs; exports.TypeTag = z; exports.TypeTagAddress = Y; exports.TypeTagBool = G; exports.TypeTagGeneric = k; exports.TypeTagParserError = E; exports.TypeTagParserErrorType = Fa; exports.TypeTagReference = In; exports.TypeTagSigner = tt; exports.TypeTagStruct = y; exports.TypeTagU128 = bt; exports.TypeTagU16 = ht; exports.TypeTagU256 = wt; exports.TypeTagU32 = Tt; exports.TypeTagU64 = L; exports.TypeTagU8 = Ae; exports.TypeTagVariants = ei; exports.TypeTagVector = C; exports.U128 = ae; exports.U16 = oe; exports.U256 = ce; exports.U32 = se; exports.U64 = N; exports.U8 = K; exports.aptosCoinStructTag = fl; exports.aptosRequest = Nn; exports.buildTransaction = $r; exports.checkOrConvertArgument = Rt; exports.computeAddressSeed = vn; exports.convertArgument = qr; exports.deriveKey = di; exports.deriveTransactionType = Dn; exports.deserializeFromScriptArgument = wa; exports.ensureBoolean = ur; exports.fetchEntryFunctionAbi = xo; exports.fetchFunctionAbi = So; exports.fetchViewFunctionAbi = _o; exports.findFirstNonSignerArg = wo; exports.fromDerivationPath = bn; exports.generateMultiSignersSignedTransaction = jf; exports.generateRawTransaction = Qa; exports.generateSignedTransaction = Hr; exports.generateSignedTransactionForSimulation = Po; exports.generateSigningMessage = jt; exports.generateSigningMessageForSerializable = Eg; exports.generateSigningMessageForTransaction = Oe; exports.generateTransactionPayload = Jn; exports.generateTransactionPayloadWithABI = Ha; exports.generateUserTransactionHash = Wf; exports.generateViewFunctionPayload = vo; exports.generateViewFunctionPayloadWithABI = Va; exports.get = Sr; exports.getAptosFullNode = J; exports.getAptosPepperService = yy; exports.getAuthenticatorForSimulation = Zn; exports.getFunctionParts = Jt; exports.hashValues = Co; exports.isBcsAddress = Yn; exports.isBcsBool = zr; exports.isBcsFixedBytes = Ga; exports.isBcsString = kr; exports.isBcsU128 = Kr; exports.isBcsU16 = Br; exports.isBcsU256 = Fr; exports.isBcsU32 = Or; exports.isBcsU64 = Nr; exports.isBcsU8 = Dr; exports.isBlockMetadataTransactionResponse = Xc; exports.isBool = Ao; exports.isEd25519Signature = Jc; exports.isEncodedEntryFunctionArgument = To; exports.isFeePayerSignature = nu; exports.isGenesisTransactionResponse = jc; exports.isLargeNumber = Xn; exports.isMultiAgentSignature = tu; exports.isMultiEd25519Signature = ru; exports.isNull = ho; exports.isNumber = jn; exports.isPendingTransactionResponse = Qc; exports.isScriptDataInput = bo; exports.isSecp256k1Signature = eu; exports.isStateCheckpointTransactionResponse = Yc; exports.isString = Ut; exports.isUserTransactionResponse = Wc; exports.isValidBIP44Path = mr; exports.isValidHardenedPath = yr; exports.isValidatorTransactionResponse = Zc; exports.mnemonicToSeed = wn; exports.normalizeBundle = Pi; exports.objectStructTag = Z; exports.optionStructTag = Al; exports.outOfRangeErrorMessage = ks; exports.paginateWithCursor = Pt; exports.parseTypeTag = Ee; exports.post = Xt; exports.postAptosFaucet = Ii; exports.postAptosFullNode = st; exports.postAptosIndexer = Ei; exports.postAptosPepperService = Ui; exports.postAptosProvingService = Ri; exports.promiseFulfilledStatus = Ps; exports.request = Ra; exports.splitPath = Qs; exports.standardizeTypeTags = Mr; exports.stringStructTag = _; exports.throwTypeMismatch = I; exports.validateNumberInRange = Re;
428
+ `;async function Fn(n){let{aptosConfig:t}=n,{data:e}=await J({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Li(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await J({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _32 => _32.withTransactions])}});return i}async function Qi(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await J({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _33 => _33.withTransactions])}});return i}async function Gn(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await ot({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _34 => _34.ledgerVersion])},body:r})).data}async function Wi(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:Ni,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await Pi({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function Da(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:xr},originMethod:"getProcessorStatuses"})).processor_status}async function Mn(n){let t=await Da({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function qn(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:xr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}var vr=new Map;function It(n,t,e){return async(...r)=>{if(vr.has(t)){let{value:o,timestamp:s}=vr.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return vr.set(t,{value:i,timestamp:Date.now()}),i}}async function Te(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await J({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function Yi(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', _35 => _35.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _36 => _36.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _37 => _37.limit]), () => (1e3))}})}async function $n(n){return _optionalChain([n, 'access', _38 => _38.options, 'optionalAccess', _39 => _39.ledgerVersion])!==void 0?ji(n):It(async()=>ji(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function ji(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await J({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _40 => _40.ledgerVersion])}});return o}async function Zi(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', _41 => _41.offset]),limit:_optionalChain([r, 'optionalAccess', _42 => _42.limit])}})}async function Ji(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', _43 => _43.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _44 => _44.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _45 => _45.limit]), () => (999))}})}async function Pr(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await J({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _46 => _46.ledgerVersion])}});return o.data}async function Cr(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await Pr({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Gn({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 ie&&a.data.error_code==="table_item_not_found")return s;throw a}}async function eo(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:Ki,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 to(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _47 => _47.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _48 => _48.tokenStandard])});let s={query:Di,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _49 => _49.offset]),limit:_optionalChain([r, 'optionalAccess', _50 => _50.limit]),order_by:_optionalChain([r, 'optionalAccess', _51 => _51.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function no(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', _52 => _52.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _53 => _53.tokenStandard])});let c={query:Bi,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _54 => _54.offset]),limit:_optionalChain([i, 'optionalAccess', _55 => _55.limit]),order_by:_optionalChain([i, 'optionalAccess', _56 => _56.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function ro(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _58 => _58.tokenStandard])}});let s={query:zi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.limit]),order_by:_optionalChain([r, 'optionalAccess', _61 => _61.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function io(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Oi,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function oo(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,i=u.from(e).toStringLong(),o=await Er({aptosConfig:t,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Er(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _62 => _62.where]),owner_address:{_eq:i}},s={query:Ri,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([r, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([r, 'optionalAccess', _65 => _65.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function so(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Ui,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 ao(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:ki,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _66 => _66.offset]),limit:_optionalChain([r, 'optionalAccess', _67 => _67.limit]),order_by:_optionalChain([r, 'optionalAccess', _68 => _68.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 We){let o=G.fromPublicKey({publicKey:r}).derivedAddress();return Ke.fromPrivateKey({privateKey:e,address:o})}if(e instanceof q){let i=G.fromPublicKey({publicKey:r});if(await Xi({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Ke.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=G.fromPublicKey({publicKey:r.publicKey});if(await Xi({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 Xi(n){let{aptosConfig:t,authKey:e}=n,r=await Cr({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await Te({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 Ct({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([e, 'optionalAccess', _70 => _70.limit])}})}async function Vn(n){let{aptosConfig:t}=n;return It(async()=>{let{data:e}=await J({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function po(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await J({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Yt(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await J({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function lo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Yt({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _71 => _71.status])===404)return!0;throw r}}async function Ba(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await J({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', _72 => _72.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.checkSuccess]), () => (!0)),s=!0,a=0,c,p,y=200,w=1.5;function A(l){if(!(l instanceof ie)||(p=l,l.status!==404&&l.status>=400&&l.status<500))throw l}try{c=await Yt({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(l){A(l)}if(s){let l=Date.now();try{c=await Ba({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(H){A(H)}a=(Date.now()-l)/1e3}for(;s&&!(a>=i);){try{if(c=await Yt({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(l){A(l)}await _chunkKSEUZTKYjs.b.call(void 0, y),a+=y/1e3,y*=w}if(c===void 0)throw p||new Hn(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Hn(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Ir(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function Ln(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 Mn({aptosConfig:t}):s=(await qn({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkKSEUZTKYjs.b.call(void 0, 200)}}var Hn=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Ir=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function b(n){n.minimumLedgerVersion!==void 0&&await Ln({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var Zt=class{constructor(t){this.config=t}async getAccountInfo(t){return Te({aptosConfig:this.config,...t})}async getAccountModules(t){return Yi({aptosConfig:this.config,...t})}async getAccountModule(t){return $n({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Zi({aptosConfig:this.config,...t})}async getAccountResources(t){return Ji({aptosConfig:this.config,...t})}async getAccountResource(t){return Pr({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Cr({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),eo({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),to({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),no({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ro({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),io({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Er({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),so({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:En,...t})}async getAccountCoinAmount(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),oo({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),ao({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 Qn=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _74 => _74.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _75 => _75.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _76 => _76.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _77 => _77.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _78 => _78.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _79 => _79.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _80 => _80.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _81 => _81.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _82 => _82.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _83 => _83.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _84 => _84.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 Si[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 xi[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 wi[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 fr[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 Ar[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return fr[this.network]===t}isProverServiceRequest(t){return Ar[this.network]===t}};function go(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function yo(n){return!!n.match(/\s/)}function Oa(n){return!!n.match(/^T[0-9]+$/)}function Na(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!yo(r))break}return e}var Fa=(A=>(A.InvalidTypeTag="unknown type",A.UnexpectedGenericType="unexpected generic type",A.UnexpectedTypeArgumentClose="unexpected '>'",A.UnexpectedWhitespaceCharacter="unexpected whitespace character",A.UnexpectedComma="unexpected ','",A.TypeArgumentCountMismatch="type argument count doesn't match expected amount",A.MissingTypeArgumentClose="no matching '>' for '<'",A.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",A.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",A.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",A.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",A.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",A))(Fa||{}),E= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Ce(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _85 => _85.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 H=Wn(a,i,e);o.push(H)}let y=r.pop();if(y===void 0)throw new E(n,"unexpected '>'");if(c!==o.length)throw new E(n,"type argument count doesn't match expected amount");let{savedStr:w,savedTypes:A,savedExpectedTypes:l}=y;i=o,o=A,a=w,c=l}else if(p===","){if(a.length!==0){let y=Wn(a,i,e);i=[],o.push(y),a="",c+=1}}else if(yo(p)){let y=!1;if(a.length!==0){let A=Wn(a,i,e);i=[],o.push(A),a="",y=!0}s=Na(n,s);let w=n[s];if(s<n.length&&y&&w!==","&&w!==">")throw new E(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new E(n,"no matching '>' for '<'");switch(o.length){case 0:return Wn(a,i,e);case 1:if(a==="")return o[0];throw new E(n,"unexpected ','");default:throw new E(n,"unexpected whitespace character")}}function Wn(n,t,e){switch(n){case"&signer":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new In(new Je);case"signer":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new Je;case"bool":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new M;case"address":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new Y;case"u8":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new Ae;case"u16":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new mt;case"u32":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new ft;case"u64":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new W;case"u128":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new At;case"u256":if(t.length>0)throw new E(n,"primitive types not expected to have type arguments");return new ht;case"vector":if(t.length!==1)throw new E(n,"vector type expected to have exactly one type argument");return new C(t[0]);default:if(Oa(n)){if(e)return new k(Number(n.split("T")[1]));throw new E(n,"unexpected generic type")}if(!n.match(/:/))throw new E(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new E(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!go(r[1]))throw new E(n,"module name must only contain alphanumeric or '_' characters");if(!go(r[2]))throw new E(n,"struct name must only contain alphanumeric or '_' characters");return new m(new ve(u.fromString(r[0]),new U(r[1]),new U(r[2]),t))}}function mo(n){return typeof n=="boolean"}function Rt(n){return typeof n=="string"}function jn(n){return typeof n=="number"}function Xn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function fo(n){return n==null}function Ao(n){return Ur(n)||zr(n)||kr(n)||Dr(n)||Br(n)||Kr(n)||Or(n)||Yn(n)||Rr(n)||Ga(n)||n instanceof T||n instanceof ze}function Ur(n){return n instanceof R}function Yn(n){return n instanceof u}function Rr(n){return n instanceof S}function Ga(n){return n instanceof $e}function zr(n){return n instanceof F}function kr(n){return n instanceof se}function Dr(n){return n instanceof ae}function Br(n){return n instanceof O}function Kr(n){return n instanceof ce}function Or(n){return n instanceof ue}function ho(n){return"bytecode"in n}function I(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function To(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Jt(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 Ma=new TextEncoder;function Fr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _86 => _86.map, 'call', _87 => _87(t=>Rt(t)?Ce(t):t)]), () => ([]))}async function bo(n,t,e,r){let i=await $n({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function wo(n,t,e,r){let i=await bo(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=To(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ce(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function So(n,t,e,r){let i=await bo(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(Ce(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ce(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Gr(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 zt(e,o,r,i)}function zt(n,t,e,r){return Ao(n)?(Nr(t,n,e),n):qa(n,t,e,r)}function qa(n,t,e,r){if(t.isBool()){if(mo(n))return new R(n);I("boolean",e)}if(t.isAddress()){if(Rt(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isU8()){if(jn(n))return new F(n);I("number",e)}if(t.isU16()){if(jn(n))return new se(n);I("number",e)}if(t.isU32()){if(jn(n))return new ae(n);I("number",e)}if(t.isU64()){if(Xn(n))return new O(BigInt(n));I("bigint | number | string",e)}if(t.isU128()){if(Xn(n))return new ce(BigInt(n));I("bigint | number | string",e)}if(t.isU256()){if(Xn(n))return new ue(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 zt(n,r[i],e,r)}if(t.isVector()){if(t.value.isU8()){if(Rt(n))return T.U8(Ma.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=>zt(i,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(Rt(n))return new S(n);I("string",e)}if(t.isObject()){if(Rt(n))return u.fromString(n);I("string | AccountAddress",e)}if(t.isOption())return fo(n)?new ze(null):new ze(zt(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 Nr(n,t,e){if(n.isBool()){if(Ur(t))return;I("Bool",e)}if(n.isAddress()){if(Yn(t))return;I("AccountAddress",e)}if(n.isU8()){if(zr(t))return;I("U8",e)}if(n.isU16()){if(kr(t))return;I("U16",e)}if(n.isU32()){if(Dr(t))return;I("U32",e)}if(n.isU64()){if(Br(t))return;I("U64",e)}if(n.isU128()){if(Kr(t))return;I("U128",e)}if(n.isU256()){if(Or(t))return;I("U256",e)}if(n.isVector()){if(t instanceof T){t.values.length>0&&Nr(n.value,t.values[0],e);return}I("MoveVector",e)}if(n instanceof m){if(n.isString()){if(Rr(t))return;I("MoveString",e)}if(n.isObject()){if(Yn(t))return;I("AccountAddress",e)}if(n.isOption()){if(t instanceof ze){t.value!==void 0&&Nr(n.value.typeArgs[0],t.value,e);return}I("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function Jn(n){if(ho(n))return La(n);let{moduleAddress:t,moduleName:e,functionName:r}=Jt(n.function),i=await Po({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:wo});return Ha({...n,abi:i})}function Ha(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=Jt(n.function),o=Fr(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)=>Gr(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=tt.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Lt(new Wt(c,new jt(a)))}return new Vt(a)}async function xo(n){let{moduleAddress:t,moduleName:e,functionName:r}=Jt(n.function),i=await Po({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:So});return Va({abi:i,...n})}function Va(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=Jt(n.function),o=Fr(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', _88 => _88.functionArguments, 'optionalAccess', _89 => _89.map, 'call', _90 => _90((a,c)=>Gr(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 tt.build(`${e}::${r}`,i,o,s)}function La(n){return new Ht(new Qt(g.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Qa(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Tr[t.network]?{chainId:Tr[t.network]}:{chainId:(await Fn({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _91 => _91.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Vn({aptosConfig:t})).gas_estimate},c=async()=>{let Ie=async()=>_optionalChain([i, 'optionalAccess', _92 => _92.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Te({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await Ie()}catch (e2){return 0}else return Ie()},[{chainId:p},{gasEstimate:y},w]=await Promise.all([s(),a(),c()]),{maxGasAmount:A,gasUnitPrice:l,expireTimestamp:H}={maxGasAmount:_optionalChain([i, 'optionalAccess', _93 => _93.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _94 => _94.gasUnitPrice]), () => (BigInt(y))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _95 => _95.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new re(u.from(e),BigInt(w),r,BigInt(A),BigInt(l),BigInt(H),new yt(p))}async function Mr(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await Qa({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _96 => _96.secondarySignerAddresses, 'optionalAccess', _97 => _97.map, 'call', _98 => _98(c=>u.from(c))]), () => ([]));return new kn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new zn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function _o(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=Zn(t);if(e.feePayerAddress){let a=new rt(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(w=>Zn(w)));let p=Zn(i),y=new wt(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new it(a.raw_txn,y).bcsToBytes()}if(e.secondarySignerAddresses){let a=new nt(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(y=>Zn(y));let p=new bt(o,e.secondarySignerAddresses,c);return new it(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof le)s=new Tt(o.public_key,o.signature);else if(o instanceof Q)s=new St(o);else throw new Error("Invalid public key");return new it(e.rawTransaction,s).bcsToBytes()}function Zn(n){if(n instanceof K){if(n.publicKey instanceof _)return new Q(n,new N(new P(new Uint8Array(64))));if(n.publicKey instanceof we)return new Q(n,new N(new Se(new Uint8Array(64))))}return new le(new _(n.toUint8Array()),new P(new Uint8Array(64)))}function qr(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=_i($,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 le?o=new Tt(i.public_key,i.signature):o=new St(i);return new it(t.rawTransaction,o).bcsToBytes()}function vo(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var Wa=vo(["APTOS::Transaction"]);function Qf(n){let t=qr(n);return new g(vo([Wa,new Uint8Array([0]),t])).toString()}async function Po({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 ja(n);return Xa(n,t)}async function ja(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await Jn(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await Jn(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await Jn(r)),i}async function Xa(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(Ya(n)&&(o=u.ZERO.toString()),Za(n)){let{secondarySignerAddresses:s}=n;return Mr({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Mr({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function Ya(n){return n.withFeePayer===!0}function Za(n){return"secondarySignerAddresses"in n}function Co(n){let{transaction:t}=n;return _t(t)}function er(n){let{signer:t,transaction:e}=n;return t.signTransactionWithAuthenticator(e)}async function $r(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=_o({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await ot({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _99 => _99.options, 'optionalAccess', _100 => _100.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _101 => _101.options, 'optionalAccess', _102 => _102.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _103 => _103.options, 'optionalAccess', _104 => _104.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function tr(n){let{aptosConfig:t}=n,e=qr({...n}),{data:r}=await ot({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function en(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof Oe||e instanceof Kn)&&await e.waitForProofFetch();let i=er({signer:e,transaction:r});return tr({aptosConfig:t,transaction:r,senderAuthenticator:i})}var Ja={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function Eo(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:Ja},options:o})}var ec={typeParameters:[],parameters:[new Ae,C.u8(),new Ae,C.u8(),C.u8(),C.u8()]};async function Io(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await Te({aptosConfig:t,accountAddress:e.accountAddress}),o=Ke.fromPrivateKey({privateKey:r,legacy:!0}),a=new Rn({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),y=await h({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new F(e.signingScheme),T.U8(e.publicKey.toUint8Array()),new F(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:ec}});return en({aptosConfig:t,signer:e,transaction:y})}var tc={typeParameters:[{constraints:[]}],parameters:[new Y,new W]};async function Uo(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, () => (En))],functionArguments:[r,i],abi:tc},options:s})}var tn=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Uo({aptosConfig:this.config,...t})}};var Ne={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},oe="0x4::token::Token";async function Ro(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:Vi,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:_r,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ko(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:_r,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _105 => _105.offset]),limit:_optionalChain([r, 'optionalAccess', _106 => _106.limit]),order_by:_optionalChain([r, 'optionalAccess', _107 => _107.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Do(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:Hi,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _108 => _108.offset]),limit:_optionalChain([r, 'optionalAccess', _109 => _109.limit]),order_by:_optionalChain([r, 'optionalAccess', _110 => _110.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var nc={typeParameters:[],parameters:[new m(v()),new W,new m(v()),new m(v()),new M,new M,new M,new M,new M,new M,new M,new M,new M,new W,new W]};async function Bo(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 S(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Me))),new S(n.name),new S(n.uri),new R(_nullishCoalesce(n.mutableDescription, () => (!0))),new R(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new R(_nullishCoalesce(n.mutableURI, () => (!0))),new R(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new R(_nullishCoalesce(n.mutableTokenName, () => (!0))),new R(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new R(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new R(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new R(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:nc},options:e})}async function Hr(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', _111 => _111.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _112 => _112.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:t,query:{query:wr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Ko(n){let{aptosConfig:t,collectionId:e}=n,i={collection_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:wr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Oo(n){return(await Hr(n)).collection_id}var rc={typeParameters:[],parameters:[new m(v()),new m(v()),new m(v()),new m(v()),new C(new m(v())),new C(new m(v())),new C(C.u8())]};async function No(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:y}=n,w=_optionalChain([p, 'optionalAccess', _113 => _113.map, 'call', _114 => _114(A=>Ne[A])]);return h({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new S(i),new S(o),new S(s),new S(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(w, () => ([]))),Zo(_nullishCoalesce(y, () => ([])),_nullishCoalesce(w, () => ([])))],abi:rc},options:e})}var ic={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new Y]};async function Fo(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, () => (oe))],functionArguments:[u.from(r),u.from(i)],abi:ic},options:s})}var oc={typeParameters:[],parameters:[new m(v()),new m(v()),new m(v()),new m(v()),new C(new m(v())),new C(new m(v())),new C(C.u8()),new Y]};async function Go(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:y,options:w}=n;if(_optionalChain([c, 'optionalAccess', _115 => _115.length])!==_optionalChain([y, 'optionalAccess', _116 => _116.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _117 => _117.length])!==_optionalChain([y, 'optionalAccess', _118 => _118.length]))throw new Error("Property types and property values counts do not match");let A=_optionalChain([p, 'optionalAccess', _119 => _119.map, 'call', _120 => _120(l=>Ne[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(A, () => ([]))),Zo(_nullishCoalesce(y, () => ([])),_nullishCoalesce(A, () => ([]))),a],abi:oc},options:w})}var sc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0)))]};async function Mo(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, () => (oe))],functionArguments:[u.from(r)],abi:sc},options:o})}var ac={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0)))]};async function qo(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, () => (oe))],functionArguments:[r],abi:ac},options:o})}var cc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0)))]};async function $o(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, () => (oe))],functionArguments:[r],abi:cc},options:o})}var uc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new m(v())]};async function Ho(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, () => (oe))],functionArguments:[u.from(i),new S(r)],abi:uc},options:s})}var pc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new m(v())]};async function Vo(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, () => (oe))],functionArguments:[u.from(i),new S(r)],abi:pc},options:s})}var dc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new m(v())]};async function Lo(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, () => (oe))],functionArguments:[u.from(i),new S(r)],abi:dc},options:s})}var lc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new m(v()),new m(v()),C.u8()]};async function Qo(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, () => (oe))],functionArguments:[u.from(s),new S(r),new S(Ne[i]),T.U8(Vr(o,Ne[i]))],abi:lc},options:c})}var gc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new m(v())]};async function Wo(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, () => (oe))],functionArguments:[u.from(i),new S(r)],abi:gc},options:s})}var yc={typeParameters:[{constraints:["key"]}],parameters:[new m(Z(new k(0))),new m(v()),new m(v()),C.u8()]};async function jo(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, () => (oe))],functionArguments:[u.from(s),new S(r),new S(Ne[i]),Vr(o,Ne[i])],abi:yc},options:c})}var mc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(Z(new k(0))),new m(v()),new k(1)]};async function Xo(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, () => (oe)),Ne[i]],functionArguments:[u.from(s),new S(r),o],abi:mc},options:c})}var fc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(Z(new k(0))),new m(v()),new k(1)]};async function Yo(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, () => (oe)),Ne[i]],functionArguments:[u.from(s),new S(r),o],abi:fc},options:c})}function Zo(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(Vr(n[i],r))}),e}function Vr(n,t){let e=Ce(t);return zt(n,e,0,[]).bcsToBytes()}var nn=class{constructor(t){this.config=t}async getCollectionData(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Hr({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...t})}async getCollectionId(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Oo({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ro({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),zo({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ko({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Do({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return Bo({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return No({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return Fo({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return Go({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return Mo({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return qo({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return $o({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return Ho({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return Vo({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return Lo({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return Qo({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return Wo({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return jo({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return Xo({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return Yo({aptosConfig:this.config,...t})}};var Jo=300,Ac=n=>{if(n&&n.length>Jo)throw new Error(`Event type length exceeds the maximum length of ${Jo}`)};async function es(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', _121 => _121.orderBy])};return rn({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', _122 => _122.orderBy])};return rn({aptosConfig:e,options:a})}async function ns(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', _123 => _123.orderBy])};return rn({aptosConfig:e,options:a})}async function rn(n){let{aptosConfig:t,options:e}=n;Ac(_optionalChain([e, 'optionalAccess', _124 => _124.where, 'optionalAccess', _125 => _125.indexed_type, 'optionalAccess', _126 => _126._eq]));let r={query:Mi,variables:{where_condition:_optionalChain([e, 'optionalAccess', _127 => _127.where]),offset:_optionalChain([e, 'optionalAccess', _128 => _128.offset]),limit:_optionalChain([e, 'optionalAccess', _129 => _129.limit]),order_by:_optionalChain([e, 'optionalAccess', _130 => _130.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var on=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),es({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ts({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await b({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ns({aptosConfig:this.config,...t})}async getEvents(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _131 => _131.minimumLedgerVersion]),processorType:"events_processor"}),rn({aptosConfig:this.config,...t})}};async function rs(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _132 => _132.timeoutSecs])||20,{data:s}=await Ci({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', _133 => _133.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var sn=class{constructor(t){this.config=t}async fundAccount(t){let e=await rs({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _134 => _134.options, 'optionalAccess', _135 => _135.waitForIndexer])!==!1&&await Ln({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function Lr(n){let{aptosConfig:t,options:e}=n,r={query:$i,variables:{where_condition:_optionalChain([e, 'optionalAccess', _136 => _136.where]),limit:_optionalChain([e, 'optionalAccess', _137 => _137.limit]),offset:_optionalChain([e, 'optionalAccess', _138 => _138.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function is(n){let{aptosConfig:t,options:e}=n,r={query:qi,variables:{where_condition:_optionalChain([e, 'optionalAccess', _139 => _139.where]),limit:_optionalChain([e, 'optionalAccess', _140 => _140.limit]),offset:_optionalChain([e, 'optionalAccess', _141 => _141.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function os(n){let{aptosConfig:t,options:e}=n,r={query:Fi,variables:{where_condition:_optionalChain([e, 'optionalAccess', _142 => _142.where]),limit:_optionalChain([e, 'optionalAccess', _143 => _143.limit]),offset:_optionalChain([e, 'optionalAccess', _144 => _144.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var hc={typeParameters:[{constraints:[]}],parameters:[Ce("0x1::object::Object"),new Y,new W]};async function ss(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:hc},options:s})}var an=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _145 => _145.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Lr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _146 => _146.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Lr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _147 => _147.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),is({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _148 => _148.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),os({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return ss({aptosConfig:this.config,...t})}};async function Fe(n){let{aptosConfig:t,payload:e,options:r}=n,i=await xo({...e,aptosConfig:t}),o=new D;i.serialize(o);let s=o.toUint8Array(),{data:a}=await ot({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _149 => _149.ledgerVersion])},body:s});return a}var cn=class{constructor(t){this.config=t}async getLedgerInfo(){return Fn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Li({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Qi({aptosConfig:this.config,...t})}async getTableItem(t){return Gn({aptosConfig:this.config,...t})}async view(t){return Fe({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Wi({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Mn({aptosConfig:this.config})}async getProcessorStatus(t){return qn({aptosConfig:this.config,processorType:t})}};var as=["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 cs(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(!cs(t))throw new Error(`${t} is not valid. ${as}`);if(e&&!cs(e))throw new Error(`${e} is not valid. ${as}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Tc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",bc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Tc,custom:null,devnet:null};function Ee(n){let t=bc[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var nr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function us(n){let{aptosConfig:t,name:e}=n,r=Ee(t),{domainName:i,subdomainName:o}=Ge(e),s=await Fe({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=nr(s[0]);return a?u.from(a):void 0}async function ps(n){let{aptosConfig:t,expiration:e,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=Ee(t),{domainName:y,subdomainName:w}=Ge(r),A=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(w&&!A)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(A&&!w)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let cr=_nullishCoalesce(e.years, () => (1));if(cr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Cs=cr*31536e3;return await h({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,Cs,o,s]},options:a})}if(!w)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await Qr({aptosConfig:t,name:y});if(!l)throw new Error("The domain does not exist");let H=e.policy==="subdomain:independent"?e.expirationDate:l;if(H>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:[y,w,Math.round(H/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function Qr(n){let{aptosConfig:t,name:e}=n,r=Ee(t),{domainName:i,subdomainName:o}=Ge(e);try{let s=await Fe({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e3){return}}async function ds(n){let{aptosConfig:t,address:e}=n,r=Ee(t),i=await Fe({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=nr(i[1]),s=nr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function ls(n){let{aptosConfig:t,sender:e,name:r,options:i}=n,o=Ee(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 gs(n){let{aptosConfig:t,name:e}=n,r=Ee(t),{domainName:i,subdomainName:o}=Ge(e),s=await Fe({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=nr(s[0]);return a?u.from(a):void 0}async function ys(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=Ee(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 ms(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=un(a)),a}async function fs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await Wr({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _150 => _150.limit]),offset:_optionalChain([e, 'optionalAccess', _151 => _151.offset]),order_by:_optionalChain([e, 'optionalAccess', _152 => _152.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _153 => _153.options, 'optionalAccess', _154 => _154.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(un)}async function As(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await Wr({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _155 => _155.limit]),offset:_optionalChain([e, 'optionalAccess', _156 => _156.offset]),order_by:_optionalChain([e, 'optionalAccess', _157 => _157.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _158 => _158.options, 'optionalAccess', _159 => _159.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(un)}async function hs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await Wr({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _160 => _160.limit]),offset:_optionalChain([e, 'optionalAccess', _161 => _161.offset]),order_by:_optionalChain([e, 'optionalAccess', _162 => _162.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _163 => _163.options, 'optionalAccess', _164 => _164.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(un)}async function Ts(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Et,variables:{limit:_optionalChain([e, 'optionalAccess', _165 => _165.limit]),offset:_optionalChain([e, 'optionalAccess', _166 => _166.offset]),order_by:_optionalChain([e, 'optionalAccess', _167 => _167.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _168 => _168.options, 'optionalAccess', _169 => _169.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(un)}async function Wr(n){let{aptosConfig:t}=n,e=Ee(t),[r]=await Fe({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 bs(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=Ee(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 un(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var pn=class{constructor(t){this.config=t}async getOwnerAddress(t){return us({aptosConfig:this.config,...t})}async getExpiration(t){return Qr({aptosConfig:this.config,...t})}async getTargetAddress(t){return gs({aptosConfig:this.config,...t})}async setTargetAddress(t){return ys({aptosConfig:this.config,...t})}async getPrimaryName(t){return ds({aptosConfig:this.config,...t})}async setPrimaryName(t){return ls({aptosConfig:this.config,...t})}async registerName(t){return ps({aptosConfig:this.config,...t})}async renewDomain(t){return bs({aptosConfig:this.config,...t})}async getName(t){return ms({aptosConfig:this.config,...t})}async getAccountNames(t){return fs({aptosConfig:this.config,...t})}async getAccountDomains(t){return As({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return hs({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Ts({aptosConfig:this.config,...t})}};async function ws(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Sr,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 Ss(n){let{aptosConfig:t,options:e}=n,r={query:Sr,variables:{order_by:_optionalChain([e, 'optionalAccess', _170 => _170.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function xs(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:Gi,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var dn=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _171 => _171.minimumLedgerVersion]),processorType:"stake_processor"}),ws({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _172 => _172.minimumLedgerVersion]),processorType:"stake_processor"}),Ss({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await b({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _173 => _173.minimumLedgerVersion]),processorType:"stake_processor"}),xs({aptosConfig:this.config,...t})}};var rr=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 jr(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 Xr(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 $r({aptosConfig:this.config,...t})}async multiAgent(t){return $r({aptosConfig:this.config,...t})}};_chunkKSEUZTKYjs.a.call(void 0, [Xr],kt.prototype,"simple",1),_chunkKSEUZTKYjs.a.call(void 0, [Xr],kt.prototype,"multiAgent",1);var Dt=class{constructor(t){this.config=t}async simple(t){return tr({aptosConfig:this.config,...t})}async multiAgent(t){return tr({aptosConfig:this.config,...t})}};_chunkKSEUZTKYjs.a.call(void 0, [jr],Dt.prototype,"simple",1),_chunkKSEUZTKYjs.a.call(void 0, [jr],Dt.prototype,"multiAgent",1);var ir=()=>Math.floor(Date.now()/1e3),or= 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 _chunkKSEUZTKYjs.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=ir();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkKSEUZTKYjs.b.call(void 0, this.sleepTime),ir()-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 Te({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await Te({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 _chunkKSEUZTKYjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=ir();for(;this.lastUncommintedNumber!==this.currentNumber;)ir()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkKSEUZTKYjs.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', _174 => _174.pendingDequeue, 'access', _175 => _175.shift, 'call', _176 => _176(), 'optionalAccess', _177 => _177.resolve, 'call', _178 => _178(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 _s="fulfilled",vs= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(vs||{}),sr= 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 or(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=en({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===_s?(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,options:{timeoutSecs:3}}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===_s?(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 ar=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new sr(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 ln=class{constructor(t){this.config=t,this.build=new rr(this.config),this.simulate=new kt(this.config),this.submit=new Dt(this.config),this.batch=new ar(this.config)}async getTransactions(t){return uo({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return po({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Yt({aptosConfig:this.config,...t})}async isPendingTransaction(t){return lo({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ut({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Vn({aptosConfig:this.config})}getSigningMessage(t){return Co(t)}async publishPackageTransaction(t){return Eo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Io({aptosConfig:this.config,...t})}sign(t){return er({...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,er({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 en({aptosConfig:this.config,signer:e,transaction:r})}};async function Yr(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:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Ei({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function _c(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i,uidKey:o,extraFieldKey:s}=n,a=_jwtdecode.jwtDecode.call(void 0, e),c;if(s){let H=a[s];c=`"${s}":"${H}",`}let p={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:Number(r.expiryDateSecs),exp_horizon_secs:Mt,pepper:g.fromHexInput(i).toStringWithoutPrefix(),extra_field:s,uid_key:o||"sub"},{data:y}=await Ii({aptosConfig:t,path:"prove",body:p,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),w=y.proof,A=new pt({a:w.a,b:w.b,c:w.c});return new _e({proof:A,extraField:c,trainingWheelsSignature:de.fromHex(y.training_wheels_signature)})}async function Ps(n){let{proofFetchCallback:t}=n,{pepper:e}=n;if(e===void 0)e=await Yr(n);else if(g.fromHexInput(e).toUint8Array().length!==31)throw new Error("Pepper needs to be 31 bytes");let r=_c({...n,pepper:e}),i=t?r:await r;return Oe.fromJWTAndProof({...n,proof:i,pepper:e,proofFetchCallback:t})}var gn=class{constructor(t){this.config=t}async getPepper(t){return Yr({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return Ps({aptosConfig:this.config,...t})}};var ee=class{constructor(t){this.config=new Qn(t),this.account=new Zt(this.config),this.ans=new pn(this.config),this.coin=new tn(this.config),this.digitalAsset=new nn(this.config),this.event=new on(this.config),this.faucet=new sn(this.config),this.fungibleAsset=new an(this.config),this.general=new cn(this.config),this.staking=new dn(this.config),this.transaction=new ln(this.config),this.keyless=new gn(this.config)}};function ge(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))})}ge(ee,Zt,"account");ge(ee,pn,"ans");ge(ee,tn,"coin");ge(ee,nn,"digitalAsset");ge(ee,on,"event");ge(ee,sn,"faucet");ge(ee,an,"fungibleAsset");ge(ee,cn,"general");ge(ee,dn,"staking");ge(ee,ln,"transaction");ge(ee,gn,"keyless");exports.APTOS_BIP44_DEFAULT_DERIVATION_PATH = Lu; exports.APTOS_BIP44_REGEX = Ms; exports.APTOS_COIN = En; exports.APTOS_HARDENED_REGEX = Gs; exports.Account = Ke; exports.AccountAddress = u; exports.AccountAuthenticator = $; exports.AccountAuthenticatorEd25519 = le; exports.AccountAuthenticatorMultiEd25519 = Pn; exports.AccountAuthenticatorMultiKey = Ze; exports.AccountAuthenticatorSingleKey = Q; exports.AccountAuthenticatorVariant = ni; exports.AccountPublicKey = te; exports.AccountSequenceNumber = or; exports.AddressInvalidReason = Ks; exports.AnyPublicKey = K; exports.AnyPublicKeyVariant = pr; exports.AnySignature = N; exports.AnySignatureVariant = ri; exports.Aptos = ee; exports.AptosApiError = ie; exports.AptosApiType = qt; exports.AptosConfig = Qn; exports.AuthenticationKey = G; exports.Bool = R; exports.CKDPriv = Hs; exports.ChainId = yt; exports.DEFAULT_MAX_GAS_AMOUNT = Ai; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = hi; exports.DEFAULT_TXN_TIMEOUT_SEC = Cn; exports.DeriveScheme = Ds; exports.Deserializer = ye; exports.EPK_HORIZON_SECS = Mt; exports.Ed25519Account = vt; exports.Ed25519PrivateKey = q; exports.Ed25519PublicKey = _; exports.Ed25519Signature = P; exports.EntryFunction = tt; exports.EntryFunctionBytes = An; exports.EphemeralCertificate = oi; exports.EphemeralKeyPair = Bn; exports.EphemeralPublicKey = je; exports.EphemeralPublicKeyVariant = dr; exports.EphemeralSignature = de; exports.EphemeralSignatureVariant = ii; exports.FeePayerRawTransaction = rt; exports.FixedBytes = $e; exports.Groth16Zkp = pt; exports.HARDENED_OFFSET = $s; exports.Hex = g; exports.HexInvalidReason = Us; exports.Identifier = U; exports.KeyType = qs; exports.KeylessAccount = Oe; exports.KeylessPublicKey = De; exports.KeylessSignature = Be; exports.MAX_AUD_VAL_BYTES = Aa; exports.MAX_COMMITED_EPK_BYTES = sd; exports.MAX_EXTRA_FIELD_BYTES = id; exports.MAX_ISS_VAL_BYTES = rd; exports.MAX_JWT_HEADER_B64_BYTES = od; exports.MAX_UID_KEY_BYTES = ha; exports.MAX_UID_VAL_BYTES = Ta; exports.MimeType = hn; exports.ModuleId = $t; exports.MoveAbility = si; exports.MoveFunctionVisibility = zs; exports.MoveOption = ze; exports.MoveString = S; exports.MoveVector = T; exports.MultiAgentRawTransaction = nt; exports.MultiAgentTransaction = kn; exports.MultiEd25519PublicKey = ct; exports.MultiEd25519Signature = Le; exports.MultiKey = lt; exports.MultiKeyAccount = Kn; exports.MultiKeySignature = Ye; exports.MultiSig = Wt; exports.MultiSigTransactionPayload = jt; exports.Network = hr; exports.NetworkToChainId = Tr; exports.NetworkToFaucetAPI = xi; exports.NetworkToIndexerAPI = wi; exports.NetworkToNetworkName = Ly; exports.NetworkToNodeAPI = Si; exports.NetworkToPepperAPI = fr; exports.NetworkToProverAPI = Ar; exports.OpenIdSignature = dt; exports.OpenIdSignatureOrZkProof = Xe; exports.ParsingError = L; exports.ProcessorType = gt; exports.PublicKey = He; exports.RAW_TRANSACTION_SALT = Ti; exports.RAW_TRANSACTION_WITH_DATA_SALT = yr; exports.RawTransaction = re; exports.RawTransactionWithData = Un; exports.RoleType = ks; exports.RotationProofChallenge = Rn; exports.Script = Qt; exports.ScriptTransactionArgumentVariants = Nt; exports.Secp256k1PrivateKey = We; exports.Secp256k1PublicKey = we; exports.Secp256k1Signature = Se; exports.Serializable = d; exports.Serializer = D; exports.Signature = B; exports.SignedGroth16Signature = _e; exports.SignedTransaction = it; exports.SigningScheme = me; exports.SigningSchemeInput = Tn; exports.SimpleTransaction = zn; exports.SingleKeyAccount = Pt; exports.StructTag = ve; exports.TransactionAuthenticator = Pe; exports.TransactionAuthenticatorEd25519 = Tt; exports.TransactionAuthenticatorFeePayer = wt; exports.TransactionAuthenticatorMultiAgent = bt; exports.TransactionAuthenticatorMultiEd25519 = mr; exports.TransactionAuthenticatorSingleSender = St; exports.TransactionAuthenticatorVariant = ti; exports.TransactionPayload = et; exports.TransactionPayloadEntryFunction = Vt; exports.TransactionPayloadMultiSig = Lt; exports.TransactionPayloadScript = Ht; exports.TransactionPayloadVariants = Jr; exports.TransactionResponseType = lr; exports.TransactionVariants = ei; exports.TransactionWorker = sr; exports.TransactionWorkerEventsEnum = vs; exports.TypeTag = z; exports.TypeTagAddress = Y; exports.TypeTagBool = M; exports.TypeTagGeneric = k; exports.TypeTagParserError = E; exports.TypeTagParserErrorType = Fa; exports.TypeTagReference = In; exports.TypeTagSigner = Je; exports.TypeTagStruct = m; exports.TypeTagU128 = At; exports.TypeTagU16 = mt; exports.TypeTagU256 = ht; exports.TypeTagU32 = ft; exports.TypeTagU64 = W; exports.TypeTagU8 = Ae; exports.TypeTagVariants = Zr; exports.TypeTagVector = C; exports.U128 = ce; exports.U16 = se; exports.U256 = ue; exports.U32 = ae; exports.U64 = O; exports.U8 = F; exports.aptosCoinStructTag = fl; exports.aptosRequest = On; exports.buildTransaction = Mr; exports.checkOrConvertArgument = zt; exports.computeAddressSeed = vn; exports.convertArgument = Gr; exports.deriveKey = di; exports.deriveTransactionType = Dn; exports.deserializeFromScriptArgument = wa; exports.ensureBoolean = ur; exports.fetchEntryFunctionAbi = wo; exports.fetchFunctionAbi = bo; exports.fetchViewFunctionAbi = So; exports.findFirstNonSignerArg = To; exports.fromDerivationPath = bn; exports.generateRawTransaction = Qa; exports.generateSignedTransaction = qr; exports.generateSignedTransactionForSimulation = _o; exports.generateSigningMessage = xt; exports.generateSigningMessageForSerializable = Eg; exports.generateSigningMessageForTransaction = _t; exports.generateTransactionPayload = Jn; exports.generateTransactionPayloadWithABI = Ha; exports.generateUserTransactionHash = Qf; exports.generateViewFunctionPayload = xo; exports.generateViewFunctionPayloadWithABI = Va; exports.get = br; exports.getAptosFullNode = J; exports.getAptosPepperService = ym; exports.getAuthenticatorForSimulation = Zn; exports.getFunctionParts = Jt; exports.hashValues = vo; exports.isBcsAddress = Yn; exports.isBcsBool = Ur; exports.isBcsFixedBytes = Ga; exports.isBcsString = Rr; exports.isBcsU128 = Kr; exports.isBcsU16 = kr; exports.isBcsU256 = Or; exports.isBcsU32 = Dr; exports.isBcsU64 = Br; exports.isBcsU8 = zr; exports.isBlockMetadataTransactionResponse = Xc; exports.isBool = mo; exports.isEd25519Signature = Jc; exports.isEncodedEntryFunctionArgument = Ao; exports.isFeePayerSignature = nu; exports.isGenesisTransactionResponse = jc; exports.isLargeNumber = Xn; exports.isMultiAgentSignature = tu; exports.isMultiEd25519Signature = ru; exports.isNull = fo; exports.isNumber = jn; exports.isPendingTransactionResponse = Qc; exports.isScriptDataInput = ho; exports.isSecp256k1Signature = eu; exports.isStateCheckpointTransactionResponse = Yc; exports.isString = Rt; exports.isUserTransactionResponse = Wc; exports.isValidBIP44Path = ui; exports.isValidHardenedPath = pi; exports.isValidatorTransactionResponse = Zc; exports.mnemonicToSeed = wn; exports.normalizeBundle = _i; exports.objectStructTag = Z; exports.optionStructTag = Al; exports.outOfRangeErrorMessage = Rs; exports.paginateWithCursor = Ct; exports.parseTypeTag = Ce; exports.post = Xt; exports.postAptosFaucet = Ci; exports.postAptosFullNode = ot; exports.postAptosIndexer = Pi; exports.postAptosPepperService = Ei; exports.postAptosProvingService = Ii; exports.promiseFulfilledStatus = _s; exports.request = Ra; exports.splitPath = Ls; exports.standardizeTypeTags = Fr; exports.stringStructTag = v; exports.throwTypeMismatch = I; exports.validateNumberInRange = Re;
429
429
  //# sourceMappingURL=index.js.map