@aptos-labs/ts-sdk 1.2.0 → 1.3.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 (242) hide show
  1. package/README.md +35 -7
  2. package/dist/browser/index.d.ts +15 -14
  3. package/dist/browser/index.global.js +2 -2
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +15 -14
  6. package/dist/common/index.js +2 -2
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.mjs +1 -1
  10. package/dist/esm/api/aptos.mjs +1 -1
  11. package/dist/esm/api/coin.mjs +1 -1
  12. package/dist/esm/api/digitalAsset.mjs +1 -1
  13. package/dist/esm/api/event.mjs +1 -1
  14. package/dist/esm/api/faucet.mjs +1 -1
  15. package/dist/esm/api/fungibleAsset.mjs +1 -1
  16. package/dist/esm/api/general.mjs +1 -1
  17. package/dist/esm/api/index.mjs +1 -1
  18. package/dist/esm/api/staking.mjs +1 -1
  19. package/dist/esm/api/transaction.mjs +1 -1
  20. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  21. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  22. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  23. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  24. package/dist/esm/api/utils.mjs +1 -1
  25. package/dist/esm/bcs/consts.mjs +1 -1
  26. package/dist/esm/bcs/deserializer.mjs +1 -1
  27. package/dist/esm/bcs/index.mjs +1 -1
  28. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  29. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  30. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  31. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  32. package/dist/esm/bcs/serializer.mjs +1 -1
  33. package/dist/esm/chunk-2MH57VSA.mjs +2 -0
  34. package/dist/esm/chunk-2MH57VSA.mjs.map +1 -0
  35. package/dist/esm/{chunk-3TCHSIX5.mjs → chunk-2QV6HI3M.mjs} +2 -2
  36. package/dist/esm/{chunk-CFOIMAJF.mjs → chunk-526UH53R.mjs} +2 -2
  37. package/dist/esm/{chunk-CFOIMAJF.mjs.map → chunk-526UH53R.mjs.map} +1 -1
  38. package/dist/esm/chunk-56CNRT2K.mjs +2 -0
  39. package/dist/esm/chunk-56CNRT2K.mjs.map +1 -0
  40. package/dist/esm/{chunk-YR3ZVJBF.mjs → chunk-5I4AJ6KA.mjs} +2 -2
  41. package/dist/esm/{chunk-OT6XSVB2.mjs → chunk-5M7VRRAU.mjs} +2 -2
  42. package/dist/esm/{chunk-J7VKEBBQ.mjs → chunk-5SU5YHP2.mjs} +2 -2
  43. package/dist/esm/{chunk-SGRMOG3X.mjs → chunk-63764T3K.mjs} +2 -2
  44. package/dist/esm/{chunk-DV6TMIRK.mjs → chunk-6EUKJGSP.mjs} +2 -2
  45. package/dist/esm/{chunk-UDMADMVO.mjs → chunk-6IFMQ5AS.mjs} +2 -2
  46. package/dist/esm/{chunk-AWEUIMRQ.mjs → chunk-754CLAXM.mjs} +2 -2
  47. package/dist/esm/{chunk-NRGN7EFM.mjs → chunk-7D5LHQNS.mjs} +2 -2
  48. package/dist/esm/{chunk-ZTNSWIML.mjs → chunk-7IGH7N52.mjs} +2 -2
  49. package/dist/esm/{chunk-NWEQD6JS.mjs → chunk-7LEBWRPP.mjs} +2 -2
  50. package/dist/esm/{chunk-UPQSJD25.mjs → chunk-7POEROH7.mjs} +2 -2
  51. package/dist/esm/{chunk-GSBXTPCS.mjs → chunk-AA4ETD22.mjs} +2 -2
  52. package/dist/esm/{chunk-XWWW2V74.mjs → chunk-B2ZKW23W.mjs} +2 -2
  53. package/dist/esm/{chunk-DIXTONIO.mjs → chunk-B7FGGGWZ.mjs} +2 -2
  54. package/dist/esm/{chunk-EX2EBRNH.mjs → chunk-BVQXUADY.mjs} +2 -2
  55. package/dist/esm/{chunk-I77JNEEH.mjs → chunk-CKWHFVGW.mjs} +2 -2
  56. package/dist/esm/{chunk-7QI27CQO.mjs → chunk-E6NGWPZM.mjs} +2 -2
  57. package/dist/esm/{chunk-NHB2SPSA.mjs → chunk-EK7YYYKL.mjs} +2 -2
  58. package/dist/esm/{chunk-I7EF66RZ.mjs → chunk-ERWQOVBF.mjs} +2 -2
  59. package/dist/esm/{chunk-47UUK4Y5.mjs → chunk-F7CR75CJ.mjs} +2 -2
  60. package/dist/esm/{chunk-O7HXE2B5.mjs → chunk-F7MOQC7Z.mjs} +2 -2
  61. package/dist/esm/{chunk-EZGQODGD.mjs → chunk-FBFMQZTM.mjs} +2 -2
  62. package/dist/esm/{chunk-ZOFYHCU4.mjs → chunk-FIO7MFHJ.mjs} +2 -2
  63. package/dist/esm/{chunk-SBIT6S4D.mjs → chunk-FP5DPRYL.mjs} +2 -2
  64. package/dist/esm/{chunk-B5DL5P23.mjs → chunk-GIM5LIAP.mjs} +2 -2
  65. package/dist/esm/chunk-HGC2PEHW.mjs +2 -0
  66. package/dist/esm/{chunk-6ZC3SZE6.mjs.map → chunk-HGC2PEHW.mjs.map} +1 -1
  67. package/dist/esm/{chunk-HXJHVTIU.mjs → chunk-HI6QP2FB.mjs} +2 -2
  68. package/dist/esm/{chunk-RFYP3V47.mjs → chunk-I7WRJY7K.mjs} +2 -2
  69. package/dist/esm/{chunk-J733CDF2.mjs → chunk-IHCIKE42.mjs} +2 -2
  70. package/dist/esm/{chunk-7YRPYQ7C.mjs → chunk-IZ4H63EF.mjs} +2 -2
  71. package/dist/esm/{chunk-JXVSO6IA.mjs → chunk-J2CXWDE7.mjs} +2 -2
  72. package/dist/esm/{chunk-4TMEKWN2.mjs → chunk-KVTWA3N3.mjs} +2 -2
  73. package/dist/esm/{chunk-XE5NXBGH.mjs → chunk-KZID24G2.mjs} +2 -2
  74. package/dist/esm/{chunk-ULKNPUPO.mjs → chunk-M7PXZWVX.mjs} +2 -2
  75. package/dist/esm/{chunk-K2LNHGV5.mjs → chunk-MSQ5V3EF.mjs} +2 -2
  76. package/dist/esm/{chunk-6GSEQAP3.mjs → chunk-N4RBQZ2B.mjs} +2 -2
  77. package/dist/esm/{chunk-BCTD22UJ.mjs → chunk-NI7GRYCP.mjs} +2 -2
  78. package/dist/esm/{chunk-7YT7GFC2.mjs → chunk-NWRKJFHV.mjs} +2 -2
  79. package/dist/esm/{chunk-QJPQWNVJ.mjs → chunk-O57QZZF2.mjs} +2 -2
  80. package/dist/esm/{chunk-AEGZ42XG.mjs → chunk-OZ3JUNJX.mjs} +2 -2
  81. package/dist/esm/chunk-PAY4TBCF.mjs +2 -0
  82. package/dist/esm/chunk-PAY4TBCF.mjs.map +1 -0
  83. package/dist/esm/{chunk-4SUSQ6FW.mjs → chunk-PPTG6BDV.mjs} +2 -2
  84. package/dist/esm/{chunk-GTZAXATL.mjs → chunk-QKTV6AZ7.mjs} +2 -2
  85. package/dist/esm/{chunk-D3U253BW.mjs → chunk-RNO5ZG3C.mjs} +2 -2
  86. package/dist/esm/{chunk-JJDQALR6.mjs → chunk-RSOBVX62.mjs} +2 -2
  87. package/dist/esm/{chunk-R2PCVD75.mjs → chunk-RYX746TE.mjs} +2 -2
  88. package/dist/esm/{chunk-I62T5OCN.mjs → chunk-S4QKXXBT.mjs} +2 -2
  89. package/dist/esm/{chunk-SS7YTDGF.mjs → chunk-SBMJNU2O.mjs} +2 -2
  90. package/dist/esm/{chunk-6P75FCI4.mjs → chunk-T2P2T3OS.mjs} +2 -2
  91. package/dist/esm/{chunk-WAUU2XNO.mjs → chunk-TKRPOJH3.mjs} +2 -2
  92. package/dist/esm/{chunk-TQ3QAVBU.mjs → chunk-U2YE33UN.mjs} +2 -2
  93. package/dist/esm/{chunk-3R3RC6HA.mjs → chunk-UCHGKGCF.mjs} +2 -2
  94. package/dist/esm/{chunk-KEOLTOML.mjs → chunk-UFMUQN35.mjs} +2 -2
  95. package/dist/esm/{chunk-QW2MOIZP.mjs → chunk-UNSMG2E5.mjs} +2 -2
  96. package/dist/esm/chunk-V6JFR2CB.mjs +2 -0
  97. package/dist/esm/chunk-VO2CATMP.mjs +2 -0
  98. package/dist/esm/chunk-VO2CATMP.mjs.map +1 -0
  99. package/dist/esm/{chunk-NANOXAUV.mjs → chunk-VRSUCKJA.mjs} +2 -2
  100. package/dist/esm/{chunk-VJ3ZN43A.mjs → chunk-YVSIS6BA.mjs} +2 -2
  101. package/dist/esm/{chunk-7SMTJUHH.mjs → chunk-ZFIMVSCR.mjs} +2 -2
  102. package/dist/esm/{chunk-UVAYKM6H.mjs → chunk-ZLYF5TLK.mjs} +2 -2
  103. package/dist/esm/cli/index.d.mts +2 -0
  104. package/dist/esm/cli/index.mjs +2 -0
  105. package/dist/esm/cli/index.mjs.map +1 -0
  106. package/dist/esm/cli/localNode.d.mts +37 -0
  107. package/dist/esm/cli/localNode.mjs +2 -0
  108. package/dist/esm/cli/localNode.mjs.map +1 -0
  109. package/dist/esm/client/core.mjs +1 -1
  110. package/dist/esm/client/get.mjs +1 -1
  111. package/dist/esm/client/index.mjs +1 -1
  112. package/dist/esm/client/post.mjs +1 -1
  113. package/dist/esm/core/account.mjs +1 -1
  114. package/dist/esm/core/accountAddress.mjs +1 -1
  115. package/dist/esm/core/authenticationKey.mjs +1 -1
  116. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  117. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  118. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  119. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  120. package/dist/esm/core/crypto/index.mjs +1 -1
  121. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  122. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  123. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  124. package/dist/esm/core/index.mjs +1 -1
  125. package/dist/esm/index.d.mts +1 -1
  126. package/dist/esm/index.mjs +1 -1
  127. package/dist/esm/internal/account.d.mts +1 -1
  128. package/dist/esm/internal/account.mjs +1 -1
  129. package/dist/esm/internal/ans.mjs +1 -1
  130. package/dist/esm/internal/coin.mjs +1 -1
  131. package/dist/esm/internal/digitalAsset.d.mts +2 -1
  132. package/dist/esm/internal/digitalAsset.mjs +1 -1
  133. package/dist/esm/internal/event.mjs +1 -1
  134. package/dist/esm/internal/faucet.mjs +1 -1
  135. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  136. package/dist/esm/internal/general.mjs +1 -1
  137. package/dist/esm/internal/staking.mjs +1 -1
  138. package/dist/esm/internal/transaction.mjs +1 -1
  139. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  140. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  141. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  142. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  143. package/dist/esm/transactions/index.d.mts +1 -1
  144. package/dist/esm/transactions/index.mjs +1 -1
  145. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  146. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  147. package/dist/esm/transactions/instances/index.d.mts +1 -1
  148. package/dist/esm/transactions/instances/index.mjs +1 -1
  149. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  150. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  151. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  152. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  153. package/dist/esm/transactions/instances/transactionPayload.d.mts +7 -7
  154. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  155. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  156. package/dist/esm/transactions/management/index.mjs +1 -1
  157. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  158. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  159. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  160. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  161. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -3
  162. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  163. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  164. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  165. package/dist/esm/transactions/types.d.mts +5 -5
  166. package/dist/esm/version.d.mts +1 -1
  167. package/dist/esm/version.mjs +1 -1
  168. package/package.json +18 -16
  169. package/src/bcs/consts.ts +9 -7
  170. package/src/cli/index.ts +1 -0
  171. package/src/cli/localNode.ts +105 -0
  172. package/src/internal/digitalAsset.ts +4 -4
  173. package/src/transactions/instances/transactionPayload.ts +14 -12
  174. package/src/transactions/transactionBuilder/transactionBuilder.ts +7 -7
  175. package/src/transactions/types.ts +5 -5
  176. package/src/version.ts +1 -1
  177. package/dist/esm/chunk-6ZC3SZE6.mjs +0 -2
  178. package/dist/esm/chunk-DNDWTM7A.mjs +0 -2
  179. package/dist/esm/chunk-DNDWTM7A.mjs.map +0 -1
  180. package/dist/esm/chunk-IA2CIVWP.mjs +0 -2
  181. package/dist/esm/chunk-IA2CIVWP.mjs.map +0 -1
  182. package/dist/esm/chunk-KBWYFDSS.mjs +0 -2
  183. package/dist/esm/chunk-L6DJOGKE.mjs +0 -2
  184. package/dist/esm/chunk-L6DJOGKE.mjs.map +0 -1
  185. /package/dist/esm/{chunk-3TCHSIX5.mjs.map → chunk-2QV6HI3M.mjs.map} +0 -0
  186. /package/dist/esm/{chunk-YR3ZVJBF.mjs.map → chunk-5I4AJ6KA.mjs.map} +0 -0
  187. /package/dist/esm/{chunk-OT6XSVB2.mjs.map → chunk-5M7VRRAU.mjs.map} +0 -0
  188. /package/dist/esm/{chunk-J7VKEBBQ.mjs.map → chunk-5SU5YHP2.mjs.map} +0 -0
  189. /package/dist/esm/{chunk-SGRMOG3X.mjs.map → chunk-63764T3K.mjs.map} +0 -0
  190. /package/dist/esm/{chunk-DV6TMIRK.mjs.map → chunk-6EUKJGSP.mjs.map} +0 -0
  191. /package/dist/esm/{chunk-UDMADMVO.mjs.map → chunk-6IFMQ5AS.mjs.map} +0 -0
  192. /package/dist/esm/{chunk-AWEUIMRQ.mjs.map → chunk-754CLAXM.mjs.map} +0 -0
  193. /package/dist/esm/{chunk-NRGN7EFM.mjs.map → chunk-7D5LHQNS.mjs.map} +0 -0
  194. /package/dist/esm/{chunk-ZTNSWIML.mjs.map → chunk-7IGH7N52.mjs.map} +0 -0
  195. /package/dist/esm/{chunk-NWEQD6JS.mjs.map → chunk-7LEBWRPP.mjs.map} +0 -0
  196. /package/dist/esm/{chunk-UPQSJD25.mjs.map → chunk-7POEROH7.mjs.map} +0 -0
  197. /package/dist/esm/{chunk-GSBXTPCS.mjs.map → chunk-AA4ETD22.mjs.map} +0 -0
  198. /package/dist/esm/{chunk-XWWW2V74.mjs.map → chunk-B2ZKW23W.mjs.map} +0 -0
  199. /package/dist/esm/{chunk-DIXTONIO.mjs.map → chunk-B7FGGGWZ.mjs.map} +0 -0
  200. /package/dist/esm/{chunk-EX2EBRNH.mjs.map → chunk-BVQXUADY.mjs.map} +0 -0
  201. /package/dist/esm/{chunk-I77JNEEH.mjs.map → chunk-CKWHFVGW.mjs.map} +0 -0
  202. /package/dist/esm/{chunk-7QI27CQO.mjs.map → chunk-E6NGWPZM.mjs.map} +0 -0
  203. /package/dist/esm/{chunk-NHB2SPSA.mjs.map → chunk-EK7YYYKL.mjs.map} +0 -0
  204. /package/dist/esm/{chunk-I7EF66RZ.mjs.map → chunk-ERWQOVBF.mjs.map} +0 -0
  205. /package/dist/esm/{chunk-47UUK4Y5.mjs.map → chunk-F7CR75CJ.mjs.map} +0 -0
  206. /package/dist/esm/{chunk-O7HXE2B5.mjs.map → chunk-F7MOQC7Z.mjs.map} +0 -0
  207. /package/dist/esm/{chunk-EZGQODGD.mjs.map → chunk-FBFMQZTM.mjs.map} +0 -0
  208. /package/dist/esm/{chunk-ZOFYHCU4.mjs.map → chunk-FIO7MFHJ.mjs.map} +0 -0
  209. /package/dist/esm/{chunk-SBIT6S4D.mjs.map → chunk-FP5DPRYL.mjs.map} +0 -0
  210. /package/dist/esm/{chunk-B5DL5P23.mjs.map → chunk-GIM5LIAP.mjs.map} +0 -0
  211. /package/dist/esm/{chunk-HXJHVTIU.mjs.map → chunk-HI6QP2FB.mjs.map} +0 -0
  212. /package/dist/esm/{chunk-RFYP3V47.mjs.map → chunk-I7WRJY7K.mjs.map} +0 -0
  213. /package/dist/esm/{chunk-J733CDF2.mjs.map → chunk-IHCIKE42.mjs.map} +0 -0
  214. /package/dist/esm/{chunk-7YRPYQ7C.mjs.map → chunk-IZ4H63EF.mjs.map} +0 -0
  215. /package/dist/esm/{chunk-JXVSO6IA.mjs.map → chunk-J2CXWDE7.mjs.map} +0 -0
  216. /package/dist/esm/{chunk-4TMEKWN2.mjs.map → chunk-KVTWA3N3.mjs.map} +0 -0
  217. /package/dist/esm/{chunk-XE5NXBGH.mjs.map → chunk-KZID24G2.mjs.map} +0 -0
  218. /package/dist/esm/{chunk-ULKNPUPO.mjs.map → chunk-M7PXZWVX.mjs.map} +0 -0
  219. /package/dist/esm/{chunk-K2LNHGV5.mjs.map → chunk-MSQ5V3EF.mjs.map} +0 -0
  220. /package/dist/esm/{chunk-6GSEQAP3.mjs.map → chunk-N4RBQZ2B.mjs.map} +0 -0
  221. /package/dist/esm/{chunk-BCTD22UJ.mjs.map → chunk-NI7GRYCP.mjs.map} +0 -0
  222. /package/dist/esm/{chunk-7YT7GFC2.mjs.map → chunk-NWRKJFHV.mjs.map} +0 -0
  223. /package/dist/esm/{chunk-QJPQWNVJ.mjs.map → chunk-O57QZZF2.mjs.map} +0 -0
  224. /package/dist/esm/{chunk-AEGZ42XG.mjs.map → chunk-OZ3JUNJX.mjs.map} +0 -0
  225. /package/dist/esm/{chunk-4SUSQ6FW.mjs.map → chunk-PPTG6BDV.mjs.map} +0 -0
  226. /package/dist/esm/{chunk-GTZAXATL.mjs.map → chunk-QKTV6AZ7.mjs.map} +0 -0
  227. /package/dist/esm/{chunk-D3U253BW.mjs.map → chunk-RNO5ZG3C.mjs.map} +0 -0
  228. /package/dist/esm/{chunk-JJDQALR6.mjs.map → chunk-RSOBVX62.mjs.map} +0 -0
  229. /package/dist/esm/{chunk-R2PCVD75.mjs.map → chunk-RYX746TE.mjs.map} +0 -0
  230. /package/dist/esm/{chunk-I62T5OCN.mjs.map → chunk-S4QKXXBT.mjs.map} +0 -0
  231. /package/dist/esm/{chunk-SS7YTDGF.mjs.map → chunk-SBMJNU2O.mjs.map} +0 -0
  232. /package/dist/esm/{chunk-6P75FCI4.mjs.map → chunk-T2P2T3OS.mjs.map} +0 -0
  233. /package/dist/esm/{chunk-WAUU2XNO.mjs.map → chunk-TKRPOJH3.mjs.map} +0 -0
  234. /package/dist/esm/{chunk-TQ3QAVBU.mjs.map → chunk-U2YE33UN.mjs.map} +0 -0
  235. /package/dist/esm/{chunk-3R3RC6HA.mjs.map → chunk-UCHGKGCF.mjs.map} +0 -0
  236. /package/dist/esm/{chunk-KEOLTOML.mjs.map → chunk-UFMUQN35.mjs.map} +0 -0
  237. /package/dist/esm/{chunk-QW2MOIZP.mjs.map → chunk-UNSMG2E5.mjs.map} +0 -0
  238. /package/dist/esm/{chunk-KBWYFDSS.mjs.map → chunk-V6JFR2CB.mjs.map} +0 -0
  239. /package/dist/esm/{chunk-NANOXAUV.mjs.map → chunk-VRSUCKJA.mjs.map} +0 -0
  240. /package/dist/esm/{chunk-VJ3ZN43A.mjs.map → chunk-YVSIS6BA.mjs.map} +0 -0
  241. /package/dist/esm/{chunk-7SMTJUHH.mjs.map → chunk-ZFIMVSCR.mjs.map} +0 -0
  242. /package/dist/esm/{chunk-UVAYKM6H.mjs.map → chunk-ZLYF5TLK.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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var zs=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var N=(n,t,e,r)=>{for(var o=r>1?void 0:r?ks(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(o=(r?i(t,e,o):i(o))||o);return r&&o&&zs(t,e,o),o};var oe=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var pr="1.2.0";var xn=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(xn||{}),dr= 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))(dr||{}),gt= 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))(gt||{}),lr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(lr||{}),gr= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(gr||{}),mr= exports.TransactionAuthenticatorVariant =(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(mr||{}),yr= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(yr||{}),Ar= exports.AnyPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ar||{}),fr= exports.AnySignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(fr||{}),vn= 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))(vn||{});function Ui(n){return n.type==="pending_transaction"}function Ii(n){return n.type==="user_transaction"}function Ei(n){return n.type==="genesis_transaction"}function Ri(n){return n.type==="block_metadata_transaction"}function zi(n){return n.type==="state_checkpoint_transaction"}function ki(n){return"signature"in n&&n.signature==="ed25519_signature"}function Ni(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Oi(n){return n.type==="multi_agent_signature"}function Gi(n){return n.type==="fee_payer_signature"}function Di(n){return n.type==="multi_ed25519_signature"}var Ns=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Ns||{}),Os= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Os||{}),Gs= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Gs||{}),mt= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(mt||{}),hr= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(hr||{}),Ds= exports.DeriveScheme =(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(Ds||{});var Tr={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 Ms(n,t){let{url:e,method:r,body:o,contentType:s,params:i,overrides:a}=n,c={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${pr}`,"content-type":_nullishCoalesce(s, () => ("application/json"))};return _optionalChain([a, 'optionalAccess', _3 => _3.AUTH_TOKEN])&&e.includes("faucet")&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _4 => _4.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _5 => _5.API_KEY])&&!e.includes("faucet")&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _6 => _6.API_KEY])}`),t.provider({url:e,method:r,body:o,params:i,headers:c,overrides:a})}async function Gt(n,t){let{url:e,path:r}=n,o=`${e}/${_nullishCoalesce(r, () => (""))}`,s=await Ms({...n,url:o},t.client),i={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let c=i.data;if(c.errors)throw new oe(n,i,_nullishCoalesce(c.errors[0].message, () => (`Unhandled Error ${s.status} : ${s.statusText}`)));i.data=c.data}if(i.status>=200&&i.status<300)return i;let a;throw i&&i.data&&"message"in i.data&&"error_code"in i.data?a=JSON.stringify(i.data):i.status in Tr?a=Tr[i.status]:a=`Unhandled Error ${i.status} : ${i.statusText}`,new oe(n,i,a)}var Cn={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},br= exports.NetworkToNodeAPI ={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},wr= 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"},Dt= exports.Network =(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(Dt||{}),Pn= exports.NetworkToChainId ={mainnet:1,testnet:2},Xi= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Mt=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))(Mt||{}),_r= exports.DEFAULT_NETWORK ="devnet",Sr= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,xr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Bt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ft= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",vr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Un= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Oe= 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))(Oe||{});async function Cr(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:s,path:i,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Gt({url:p,method:"GET",originMethod:a,path:i,contentType:_optionalChain([o, 'optionalAccess', _7 => _7.valueOf, 'call', _8 => _8()]),acceptType:_optionalChain([s, 'optionalAccess', _9 => _9.valueOf, 'call', _10 => _10()]),params:r,overrides:{...t.clientConfig,...e}},t)}async function D(n){return Cr({...n,type:0})}async function Ge(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await Cr({type:0,aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function In(n){let{type:t,originMethod:e,path:r,body:o,acceptType:s,contentType:i,params:a,aptosConfig:c,overrides:p}=n,g=c.getRequestUrl(t);return Gt({url:g,method:"POST",originMethod:e,path:r,body:o,contentType:_optionalChain([i, 'optionalAccess', _11 => _11.valueOf, 'call', _12 => _12()]),acceptType:_optionalChain([s, 'optionalAccess', _13 => _13.valueOf, 'call', _14 => _14()]),params:a,overrides:{...c.clientConfig,...p}},c)}async function De(n){return In({...n,type:0})}async function Pr(n){return In({...n,type:1})}async function Ur(n){return In({...n,type:2})}var _utils = require('@noble/hashes/utils');var qt=2**8-1,Kt=2**16-1,se=2**32-1,Ee=BigInt(2)**BigInt(64)-BigInt(1),yt=BigInt(2)**BigInt(128)-BigInt(1),$t=BigInt(2)**BigInt(256)-BigInt(1);var O=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var qs=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(qs||{}),f= 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 fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new O("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 O("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 O(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _15 => _15.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _16 => _16.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _17 => _17.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 j;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return f.fromHexInput(t)}},j= 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 o=new DataView(this.buffer,this.offset);t.apply(o,[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){En(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(se),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Ee,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&yt,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)})}};N([Re(0,qt)],j.prototype,"serializeU8",1),N([Re(0,Kt)],j.prototype,"serializeU16",1),N([Re(0,se)],j.prototype,"serializeU32",1),N([Re(BigInt(0),Ee)],j.prototype,"serializeU64",1),N([Re(BigInt(0),yt)],j.prototype,"serializeU128",1),N([Re(BigInt(0),$t)],j.prototype,"serializeU256",1),N([Re(0,se)],j.prototype,"serializeU32AsUleb128",1);function En(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 me(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Ks(n,t,e))}function Re(n,t){return(e,r,o)=>{let s=o.value;return o.value=function(a){return me(a,n,t),s.apply(this,[a])},o}}var Ls=(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))(Ls||{}),T=class T extends d{constructor(e){super();if(e.length!==T.LENGTH)throw new O("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(T.LENGTH);return new T(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new O("Hex string must start with a leading 0x.","leading_zero_x_required");let r=T.fromString(e);if(e.length!==T.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new O(`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 O(`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 O("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new O("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(s){throw new O(`Hex characters are invalid: ${_optionalChain([s, 'optionalAccess', _18 => _18.message])}`,"invalid_hex_chars")}return new T(o)}static from(e){return e instanceof T?e:e instanceof Uint8Array?new T(e):T.fromString(e)}static fromStrict(e){return e instanceof T?e:e instanceof Uint8Array?new T(e):T.fromStringStrict(e)}static isValid(e){try{return e.strict?T.fromStrict(e.input):T.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _19 => _19.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _20 => _20.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};T.LENGTH=32,T.LONG_STRING_LENGTH=64,T.ZERO=T.from("0x0"),T.ONE=T.from("0x1"),T.TWO=T.from("0x2"),T.THREE=T.from("0x3"),T.FOUR=T.from("0x4");var u=T;var _sha3 = require('@noble/hashes/sha3');var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var Er=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<se;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>se)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 o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var ze=class n extends d{constructor(e){super();this.value=f.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let o=e.deserializeFixedBytes(r);return new n(o)}};var Lt=class n extends d{constructor(e){super();this.value=new ze(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=ze.deserialize(e,r);return new n(o.value)}};var P=class n extends d{constructor(e){super();En(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())}},R= exports.U8 =class n extends d{constructor(e){super();me(e,0,qt),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())}},$= exports.U16 =class n extends d{constructor(e){super();me(e,0,Kt),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())}},L= exports.U32 =class n extends d{constructor(e){super();me(e,0,se),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())}},E= exports.U64 =class n extends d{constructor(e){super();me(e,BigInt(0),Ee),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())}},V= exports.U128 =class n extends d{constructor(e){super();me(e,BigInt(0),yt),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())}},H= exports.U256 =class n extends d{constructor(e){super();me(e,BigInt(0),$t),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 b=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 R)&&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 o=f.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new R(o)))}static U16(e){return new n(e.map(r=>new $(r)))}static U32(e){return new n(e.map(r=>new L(r)))}static U64(e){return new n(e.map(r=>new E(r)))}static U128(e){return new n(e.map(r=>new V(r)))}static U256(e){return new n(e.map(r=>new H(r)))}static Bool(e){return new n(e.map(r=>new P(r)))}static MoveString(e){return new n(e.map(r=>new z(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1)s.push(r.deserialize(e));return new n(s)}},z= 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);b.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},ye= exports.MoveOption =class n extends d{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new b([e]):this.vec=new b([]),[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 R(e):void 0)}static U16(e){return new n(e!=null?new $(e):void 0)}static U32(e){return new n(e!=null?new L(e):void 0)}static U64(e){return new n(e!=null?new E(e):void 0)}static U128(e){return new n(e!=null?new V(e):void 0)}static U256(e){return new n(e!=null?new H(e):void 0)}static Bool(e){return new n(e!=null?new P(e):void 0)}static MoveString(e){return new n(e!=null?new z(e):void 0)}static deserialize(e,r){let o=b.deserialize(e,r);return new n(o.values[0])}};var M=class extends d{},Me= exports.PrivateKey =class extends d{},X= exports.Signature =class extends d{};var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Rr = _interopRequireWildcard(_bip39);var Qs=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Ws= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,js= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(js||{}),zr= exports.HARDENED_OFFSET =2147483648;function kr(n){return Ws.test(n)}function Nr(n){return Qs.test(n)}var Rn=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Or= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),s=new Uint8Array([0]),i=new Uint8Array([...s,...n,...o]);return Rn(t,i)},Xs=n=>n.replace("'",""),Gr= exports.splitPath =n=>n.split("/").slice(1).map(Xs),Vt= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Rr.mnemonicToSeedSync(t)};var Ae=class Ae extends M{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==Ae.LENGTH)throw new Error(`PublicKey length should be ${Ae.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=f.fromHexInput(r).toUint8Array(),i=o.toUint8Array();return _tweetnacl2.default.sign.detached.verify(s,i,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ae(r)}static load(e){let r=e.deserializeBytes();return new Ae(r)}static isPublicKey(e){return e instanceof Ae}};Ae.LENGTH=32;var w=Ae,k=class k extends Me{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==k.LENGTH)throw new Error(`PrivateKey length should be ${k.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,k.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,k.LENGTH)}toString(){return f.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=f.fromHexInput(e),o=_tweetnacl2.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new U(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new k(r)}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new k(e.secretKey.slice(0,k.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new w(e)}static fromDerivationPath(e,r){if(!Nr(e))throw new Error(`Invalid derivation path ${e}`);return k.fromDerivationPathInner(e,Vt(r))}static fromDerivationPathInner(e,r,o=zr){let{key:s,chainCode:i}=Rn(k.SLIP_0010_SEED,r),a=Gr(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,g)=>Or(p,g+o),{key:s,chainCode:i});return new k(c)}static isPrivateKey(e){return e instanceof k}};k.LENGTH=32,k.SLIP_0010_SEED="ed25519 seed";var he=k,fe=class fe extends X{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==fe.LENGTH)throw new Error(`Signature length should be ${fe.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new fe(r)}static load(e){let r=e.deserializeBytes();return new fe(r)}static isSignature(e){return e instanceof fe}};fe.LENGTH=64;var U=fe;var B=class B extends M{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>B.MAX_KEYS||r.length<B.MIN_KEYS)throw new Error(`Must have between ${B.MIN_KEYS} and ${B.MAX_KEYS} public keys, inclusive`);if(o<B.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${B.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*w.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*w.LENGTH)}),e[this.publicKeys.length*w.LENGTH]=this.threshold,e}toString(){return f.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],s=[];for(let i=0;i<r.length-1;i+=w.LENGTH){let a=i;s.push(new w(r.subarray(a,a+w.LENGTH)))}return new B({publicKeys:s,threshold:o})}};B.MAX_KEYS=32,B.MIN_KEYS=2,B.MIN_THRESHOLD=1;var Y=B,F=class F extends X{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==F.BITMAP_LEN)throw new Error(`"bitmap" length should be ${F.BITMAP_LEN}`);if(r.length>F.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${F.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*U.LENGTH+F.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*U.LENGTH)}),e.set(this.bitmap,this.signatures.length*U.LENGTH),e}toString(){return f.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach(a=>{if(a>=F.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${F.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(a))throw new Error("Duplicate bits detected.");i.add(a);let c=Math.floor(a/8),p=s[c];p|=o>>a%8,s[c]=p}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),s=[];for(let i=0;i<r.length-o.length;i+=U.LENGTH){let a=i;s.push(new U(r.subarray(a,a+U.LENGTH)))}return new F({signatures:s,bitmap:o})}};F.MAX_SIGNATURES_SUPPORTED=32,F.BITMAP_LEN=4;var Be=F;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Te=class Te extends M{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==Te.LENGTH)throw new Error(`PublicKey length should be ${Te.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=f.fromHexInput(r).toUint8Array(),i=_sha3.sha3_256.call(void 0, s),a=o.toUint8Array();return _secp256k1.secp256k1.verify(a,i,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Te(r)}static load(e){let r=e.deserializeBytes();return new Te(r)}static isPublicKey(e){return e instanceof Te}};Te.LENGTH=65;var Q=Te,Z=class Z extends Me{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==Z.LENGTH)throw new Error(`PrivateKey length should be ${Z.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=f.fromHexInput(e),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());return new _e(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Z(r)}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Z(e)}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Q(e)}static fromDerivationPath(e,r){if(!kr(e))throw new Error(`Invalid derivation path ${e}`);return Z.fromDerivationPathInner(e,Vt(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new Z(o)}static isPrivateKey(e){return e instanceof Z}};Z.LENGTH=32;var we=Z,be=class be extends X{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==be.LENGTH)throw new Error(`Signature length should be ${be.LENGTH}, recieved ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new be(r)}static load(e){let r=e.deserializeBytes();return new be(r)}static isSignature(e){return e instanceof be}};be.LENGTH=64;var _e=be;var x=class n extends M{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:r,signature:o}=e;return this.publicKey.verifySignature({message:r,signature:o})}serialize(e){if(this.publicKey instanceof w)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Q)e.serializeU32AsUleb128(1),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(w.load(e));case 1:return new n(Q.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof w}isSecp256k1PublicKey(){return this.publicKey instanceof Q}};var Fe=class n extends M{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);let s=[];r.forEach(i=>{i instanceof x?s.push(i):s.push(new x(i))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=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(i.has(a))throw new Error(`Duplicate bit ${a} detected.`);i.add(a);let p=Math.floor(a/8),g=s[p];g|=o>>a%8,s[p]=g}),s}toString(){return f.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(x),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var ie=class ie extends d{constructor(e){super();let{data:r}=e,o=f.fromHexInput(r);if(o.toUint8Array().length!==ie.LENGTH)throw new Error(`Authentication Key length should be ${ie.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(ie.LENGTH);return new ie({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:r,scheme:o}=e,s;switch(o){case 3:case 2:{let c=r.bcsToBytes();s=new Uint8Array([...c,o]);break}case 0:case 1:{let c=r.toUint8Array(),p=f.fromHexInput(c).toUint8Array();s=new Uint8Array([...p,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let i=_sha3.sha3_256.create();i.update(s);let a=i.digest();return new ie({data:a})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof w)o=0 .valueOf();else if(r instanceof Y)o=1 .valueOf();else if(r instanceof x)o=2 .valueOf();else if(r instanceof Fe)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return ie.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new u(this.data.toUint8Array())}};ie.LENGTH=32;var J=ie;var Se=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,s=_nullishCoalesce(o, () => (!0));if(this.publicKey=e.publicKey(),this.publicKey instanceof w)s?this.signingScheme=0:(this.publicKey=new x(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Y)this.signingScheme=1;else if(this.publicKey instanceof Q)this.publicKey=new x(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=r}static generate(t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _21 => _21.legacy]), () => (!0)),r,o;switch(_optionalChain([t, 'optionalAccess', _22 => _22.scheme])){case 2:r=we.generate(),o=new x(r.publicKey());break;default:r=he.generate(),e===!1?o=new x(r.publicKey()):o=r.publicKey()}let i=J.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:i,legacy:_optionalChain([t, 'optionalAccess', _23 => _23.legacy])})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=_nullishCoalesce(r, () => (!0)),s;if(e instanceof we)s=new x(e.publicKey());else if(e instanceof he)o?s=e.publicKey():s=new x(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let a=J.fromPublicKey({publicKey:s}).derivedAddress();return new n({privateKey:e,address:a,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:r,legacy:o}=t;return new n({privateKey:e,address:r,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:r,scheme:o,legacy:s}=t,i;switch(o){case 2:i=we.fromDerivationPath(e,r);break;case 0:i=he.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:i,legacy:s})}static authKey(t){let{publicKey:e}=t;return J.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=f.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Js=`
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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var zs=Object.defineProperty;var ks=Object.getOwnPropertyDescriptor;var N=(n,t,e,r)=>{for(var o=r>1?void 0:r?ks(t,e):t,s=n.length-1,i;s>=0;s--)(i=n[s])&&(o=(r?i(t,e,o):i(o))||o);return r&&o&&zs(t,e,o),o};var oe=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var pr="1.3.0";var xn=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(xn||{}),dr= 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))(dr||{}),gt= 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))(gt||{}),lr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(lr||{}),gr= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(gr||{}),mr= exports.TransactionAuthenticatorVariant =(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(mr||{}),yr= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(yr||{}),Ar= exports.AnyPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ar||{}),fr= exports.AnySignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(fr||{}),vn= 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))(vn||{});function Ui(n){return n.type==="pending_transaction"}function Ii(n){return n.type==="user_transaction"}function Ei(n){return n.type==="genesis_transaction"}function Ri(n){return n.type==="block_metadata_transaction"}function zi(n){return n.type==="state_checkpoint_transaction"}function ki(n){return"signature"in n&&n.signature==="ed25519_signature"}function Ni(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Oi(n){return n.type==="multi_agent_signature"}function Gi(n){return n.type==="fee_payer_signature"}function Di(n){return n.type==="multi_ed25519_signature"}var Ns=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Ns||{}),Os= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Os||{}),Gs= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Gs||{}),mt= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(mt||{}),hr= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(hr||{}),Ds= exports.DeriveScheme =(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(Ds||{});var Tr={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 Ms(n,t){let{url:e,method:r,body:o,contentType:s,params:i,overrides:a}=n,c={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${pr}`,"content-type":_nullishCoalesce(s, () => ("application/json"))};return _optionalChain([a, 'optionalAccess', _3 => _3.AUTH_TOKEN])&&e.includes("faucet")&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _4 => _4.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _5 => _5.API_KEY])&&!e.includes("faucet")&&(c.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _6 => _6.API_KEY])}`),t.provider({url:e,method:r,body:o,params:i,headers:c,overrides:a})}async function Gt(n,t){let{url:e,path:r}=n,o=`${e}/${_nullishCoalesce(r, () => (""))}`,s=await Ms({...n,url:o},t.client),i={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let c=i.data;if(c.errors)throw new oe(n,i,_nullishCoalesce(c.errors[0].message, () => (`Unhandled Error ${s.status} : ${s.statusText}`)));i.data=c.data}if(i.status>=200&&i.status<300)return i;let a;throw i&&i.data&&"message"in i.data&&"error_code"in i.data?a=JSON.stringify(i.data):i.status in Tr?a=Tr[i.status]:a=`Unhandled Error ${i.status} : ${i.statusText}`,new oe(n,i,a)}var Cn={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},br= exports.NetworkToNodeAPI ={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},wr= 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"},Dt= exports.Network =(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(Dt||{}),Pn= exports.NetworkToChainId ={mainnet:1,testnet:2},Xi= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Mt=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))(Mt||{}),_r= exports.DEFAULT_NETWORK ="devnet",Sr= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,xr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Bt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ft= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",vr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Un= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Oe= 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))(Oe||{});async function Cr(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:s,path:i,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Gt({url:p,method:"GET",originMethod:a,path:i,contentType:_optionalChain([o, 'optionalAccess', _7 => _7.valueOf, 'call', _8 => _8()]),acceptType:_optionalChain([s, 'optionalAccess', _9 => _9.valueOf, 'call', _10 => _10()]),params:r,overrides:{...t.clientConfig,...e}},t)}async function D(n){return Cr({...n,type:0})}async function Ge(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await Cr({type:0,aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function In(n){let{type:t,originMethod:e,path:r,body:o,acceptType:s,contentType:i,params:a,aptosConfig:c,overrides:p}=n,g=c.getRequestUrl(t);return Gt({url:g,method:"POST",originMethod:e,path:r,body:o,contentType:_optionalChain([i, 'optionalAccess', _11 => _11.valueOf, 'call', _12 => _12()]),acceptType:_optionalChain([s, 'optionalAccess', _13 => _13.valueOf, 'call', _14 => _14()]),params:a,overrides:{...c.clientConfig,...p}},c)}async function De(n){return In({...n,type:0})}async function Pr(n){return In({...n,type:1})}async function Ur(n){return In({...n,type:2})}var _utils = require('@noble/hashes/utils');var qt=255,Kt=65535,se=4294967295,Ee=18446744073709551615n,yt=340282366920938463463374607431768211455n,$t=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var O=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var qs=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(qs||{}),f= 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 fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new O("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 O("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 O(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _15 => _15.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _16 => _16.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _17 => _17.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 j;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return f.fromHexInput(t)}},j= 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 o=new DataView(this.buffer,this.offset);t.apply(o,[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){En(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(se),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Ee,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&yt,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)})}};N([Re(0,qt)],j.prototype,"serializeU8",1),N([Re(0,Kt)],j.prototype,"serializeU16",1),N([Re(0,se)],j.prototype,"serializeU32",1),N([Re(BigInt(0),Ee)],j.prototype,"serializeU64",1),N([Re(BigInt(0),yt)],j.prototype,"serializeU128",1),N([Re(BigInt(0),$t)],j.prototype,"serializeU256",1),N([Re(0,se)],j.prototype,"serializeU32AsUleb128",1);function En(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 me(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Ks(n,t,e))}function Re(n,t){return(e,r,o)=>{let s=o.value;return o.value=function(a){return me(a,n,t),s.apply(this,[a])},o}}var Ls=(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))(Ls||{}),T=class T extends d{constructor(e){super();if(e.length!==T.LENGTH)throw new O("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(T.LENGTH);return new T(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new O("Hex string must start with a leading 0x.","leading_zero_x_required");let r=T.fromString(e);if(e.length!==T.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new O(`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 O(`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 O("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new O("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(s){throw new O(`Hex characters are invalid: ${_optionalChain([s, 'optionalAccess', _18 => _18.message])}`,"invalid_hex_chars")}return new T(o)}static from(e){return e instanceof T?e:e instanceof Uint8Array?new T(e):T.fromString(e)}static fromStrict(e){return e instanceof T?e:e instanceof Uint8Array?new T(e):T.fromStringStrict(e)}static isValid(e){try{return e.strict?T.fromStrict(e.input):T.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _19 => _19.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _20 => _20.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};T.LENGTH=32,T.LONG_STRING_LENGTH=64,T.ZERO=T.from("0x0"),T.ONE=T.from("0x1"),T.TWO=T.from("0x2"),T.THREE=T.from("0x3"),T.FOUR=T.from("0x4");var u=T;var _sha3 = require('@noble/hashes/sha3');var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var Er=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<se;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>se)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 o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var ze=class n extends d{constructor(e){super();this.value=f.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let o=e.deserializeFixedBytes(r);return new n(o)}};var Lt=class n extends d{constructor(e){super();this.value=new ze(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=ze.deserialize(e,r);return new n(o.value)}};var P=class n extends d{constructor(e){super();En(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())}},R= exports.U8 =class n extends d{constructor(e){super();me(e,0,qt),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())}},$= exports.U16 =class n extends d{constructor(e){super();me(e,0,Kt),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())}},L= exports.U32 =class n extends d{constructor(e){super();me(e,0,se),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())}},E= exports.U64 =class n extends d{constructor(e){super();me(e,BigInt(0),Ee),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())}},V= exports.U128 =class n extends d{constructor(e){super();me(e,BigInt(0),yt),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())}},H= exports.U256 =class n extends d{constructor(e){super();me(e,BigInt(0),$t),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 b=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 R)&&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 o=f.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new R(o)))}static U16(e){return new n(e.map(r=>new $(r)))}static U32(e){return new n(e.map(r=>new L(r)))}static U64(e){return new n(e.map(r=>new E(r)))}static U128(e){return new n(e.map(r=>new V(r)))}static U256(e){return new n(e.map(r=>new H(r)))}static Bool(e){return new n(e.map(r=>new P(r)))}static MoveString(e){return new n(e.map(r=>new z(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1)s.push(r.deserialize(e));return new n(s)}},z= 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);b.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},ye= exports.MoveOption =class n extends d{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new b([e]):this.vec=new b([]),[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 R(e):void 0)}static U16(e){return new n(e!=null?new $(e):void 0)}static U32(e){return new n(e!=null?new L(e):void 0)}static U64(e){return new n(e!=null?new E(e):void 0)}static U128(e){return new n(e!=null?new V(e):void 0)}static U256(e){return new n(e!=null?new H(e):void 0)}static Bool(e){return new n(e!=null?new P(e):void 0)}static MoveString(e){return new n(e!=null?new z(e):void 0)}static deserialize(e,r){let o=b.deserialize(e,r);return new n(o.values[0])}};var M=class extends d{},Me= exports.PrivateKey =class extends d{},X= exports.Signature =class extends d{};var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Rr = _interopRequireWildcard(_bip39);var Qs=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Ws= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,js= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(js||{}),zr= exports.HARDENED_OFFSET =2147483648;function kr(n){return Ws.test(n)}function Nr(n){return Qs.test(n)}var Rn=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Or= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),s=new Uint8Array([0]),i=new Uint8Array([...s,...n,...o]);return Rn(t,i)},Xs=n=>n.replace("'",""),Gr= exports.splitPath =n=>n.split("/").slice(1).map(Xs),Vt= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Rr.mnemonicToSeedSync(t)};var Ae=class Ae extends M{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==Ae.LENGTH)throw new Error(`PublicKey length should be ${Ae.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=f.fromHexInput(r).toUint8Array(),i=o.toUint8Array();return _tweetnacl2.default.sign.detached.verify(s,i,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ae(r)}static load(e){let r=e.deserializeBytes();return new Ae(r)}static isPublicKey(e){return e instanceof Ae}};Ae.LENGTH=32;var w=Ae,k=class k extends Me{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==k.LENGTH)throw new Error(`PrivateKey length should be ${k.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,k.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,k.LENGTH)}toString(){return f.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=f.fromHexInput(e),o=_tweetnacl2.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new U(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new k(r)}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new k(e.secretKey.slice(0,k.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new w(e)}static fromDerivationPath(e,r){if(!Nr(e))throw new Error(`Invalid derivation path ${e}`);return k.fromDerivationPathInner(e,Vt(r))}static fromDerivationPathInner(e,r,o=zr){let{key:s,chainCode:i}=Rn(k.SLIP_0010_SEED,r),a=Gr(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,g)=>Or(p,g+o),{key:s,chainCode:i});return new k(c)}static isPrivateKey(e){return e instanceof k}};k.LENGTH=32,k.SLIP_0010_SEED="ed25519 seed";var he=k,fe=class fe extends X{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==fe.LENGTH)throw new Error(`Signature length should be ${fe.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new fe(r)}static load(e){let r=e.deserializeBytes();return new fe(r)}static isSignature(e){return e instanceof fe}};fe.LENGTH=64;var U=fe;var B=class B extends M{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>B.MAX_KEYS||r.length<B.MIN_KEYS)throw new Error(`Must have between ${B.MIN_KEYS} and ${B.MAX_KEYS} public keys, inclusive`);if(o<B.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${B.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*w.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*w.LENGTH)}),e[this.publicKeys.length*w.LENGTH]=this.threshold,e}toString(){return f.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],s=[];for(let i=0;i<r.length-1;i+=w.LENGTH){let a=i;s.push(new w(r.subarray(a,a+w.LENGTH)))}return new B({publicKeys:s,threshold:o})}};B.MAX_KEYS=32,B.MIN_KEYS=2,B.MIN_THRESHOLD=1;var Y=B,F=class F extends X{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==F.BITMAP_LEN)throw new Error(`"bitmap" length should be ${F.BITMAP_LEN}`);if(r.length>F.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${F.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*U.LENGTH+F.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*U.LENGTH)}),e.set(this.bitmap,this.signatures.length*U.LENGTH),e}toString(){return f.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=new Set;return r.forEach(a=>{if(a>=F.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${F.MAX_SIGNATURES_SUPPORTED-1}.`);if(i.has(a))throw new Error("Duplicate bits detected.");i.add(a);let c=Math.floor(a/8),p=s[c];p|=o>>a%8,s[c]=p}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),s=[];for(let i=0;i<r.length-o.length;i+=U.LENGTH){let a=i;s.push(new U(r.subarray(a,a+U.LENGTH)))}return new F({signatures:s,bitmap:o})}};F.MAX_SIGNATURES_SUPPORTED=32,F.BITMAP_LEN=4;var Be=F;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Te=class Te extends M{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==Te.LENGTH)throw new Error(`PublicKey length should be ${Te.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,s=f.fromHexInput(r).toUint8Array(),i=_sha3.sha3_256.call(void 0, s),a=o.toUint8Array();return _secp256k1.secp256k1.verify(a,i,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Te(r)}static load(e){let r=e.deserializeBytes();return new Te(r)}static isPublicKey(e){return e instanceof Te}};Te.LENGTH=65;var Q=Te,Z=class Z extends Me{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==Z.LENGTH)throw new Error(`PrivateKey length should be ${Z.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=f.fromHexInput(e),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());return new _e(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Z(r)}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Z(e)}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Q(e)}static fromDerivationPath(e,r){if(!kr(e))throw new Error(`Invalid derivation path ${e}`);return Z.fromDerivationPathInner(e,Vt(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new Z(o)}static isPrivateKey(e){return e instanceof Z}};Z.LENGTH=32;var we=Z,be=class be extends X{constructor(e){super();let r=f.fromHexInput(e);if(r.toUint8Array().length!==be.LENGTH)throw new Error(`Signature length should be ${be.LENGTH}, recieved ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new be(r)}static load(e){let r=e.deserializeBytes();return new be(r)}static isSignature(e){return e instanceof be}};be.LENGTH=64;var _e=be;var x=class n extends M{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:r,signature:o}=e;return this.publicKey.verifySignature({message:r,signature:o})}serialize(e){if(this.publicKey instanceof w)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof Q)e.serializeU32AsUleb128(1),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(w.load(e));case 1:return new n(Q.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof w}isSecp256k1PublicKey(){return this.publicKey instanceof Q}};var Fe=class n extends M{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);let s=[];r.forEach(i=>{i instanceof x?s.push(i):s.push(new x(i))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,s=new Uint8Array([0,0,0,0]),i=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(i.has(a))throw new Error(`Duplicate bit ${a} detected.`);i.add(a);let p=Math.floor(a/8),g=s[p];g|=o>>a%8,s[p]=g}),s}toString(){return f.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(x),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var ie=class ie extends d{constructor(e){super();let{data:r}=e,o=f.fromHexInput(r);if(o.toUint8Array().length!==ie.LENGTH)throw new Error(`Authentication Key length should be ${ie.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(ie.LENGTH);return new ie({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:r,scheme:o}=e,s;switch(o){case 3:case 2:{let c=r.bcsToBytes();s=new Uint8Array([...c,o]);break}case 0:case 1:{let c=r.toUint8Array(),p=f.fromHexInput(c).toUint8Array();s=new Uint8Array([...p,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let i=_sha3.sha3_256.create();i.update(s);let a=i.digest();return new ie({data:a})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof w)o=0 .valueOf();else if(r instanceof Y)o=1 .valueOf();else if(r instanceof x)o=2 .valueOf();else if(r instanceof Fe)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return ie.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new u(this.data.toUint8Array())}};ie.LENGTH=32;var J=ie;var Se=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,s=_nullishCoalesce(o, () => (!0));if(this.publicKey=e.publicKey(),this.publicKey instanceof w)s?this.signingScheme=0:(this.publicKey=new x(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Y)this.signingScheme=1;else if(this.publicKey instanceof Q)this.publicKey=new x(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=r}static generate(t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _21 => _21.legacy]), () => (!0)),r,o;switch(_optionalChain([t, 'optionalAccess', _22 => _22.scheme])){case 2:r=we.generate(),o=new x(r.publicKey());break;default:r=he.generate(),e===!1?o=new x(r.publicKey()):o=r.publicKey()}let i=J.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:i,legacy:_optionalChain([t, 'optionalAccess', _23 => _23.legacy])})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=_nullishCoalesce(r, () => (!0)),s;if(e instanceof we)s=new x(e.publicKey());else if(e instanceof he)o?s=e.publicKey():s=new x(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let a=J.fromPublicKey({publicKey:s}).derivedAddress();return new n({privateKey:e,address:a,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:r,legacy:o}=t;return new n({privateKey:e,address:r,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:r,scheme:o,legacy:s}=t,i;switch(o){case 2:i=we.fromDerivationPath(e,r);break;case 0:i=he.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:i,legacy:s})}static authKey(t){let{publicKey:e}=t;return J.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=f.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Js=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -423,5 +423,5 @@
423
423
  }
424
424
  }
425
425
  }
426
- `;async function jt(n){let{aptosConfig:t}=n,{data:e}=await D({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function to(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await D({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _24 => _24.withTransactions])}});return o}async function no(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await D({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _25 => _25.withTransactions])}});return o}async function Xt(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await De({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _26 => _26.ledgerVersion])},body:r})).data}async function xe(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await De({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _27 => _27.ledgerVersion])},body:{function:e.function,type_arguments:_nullishCoalesce(e.typeArguments, () => ([])),arguments:_nullishCoalesce(e.functionArguments, () => ([]))}});return o}async function ro(n){let{aptosConfig:t,limit:e}=n;return(await m({aptosConfig:t,query:{query:Hr,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function m(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await Pr({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function ti(n){let{aptosConfig:t}=n;return(await m({aptosConfig:t,query:{query:kn},originMethod:"getProcessorStatuses"})).processor_status}async function Yt(n){let t=await ti({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Zt(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await m({aptosConfig:t,query:{query:kn,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var On=new Map;function Ke(n,t,e){return async(...r)=>{if(On.has(t)){let{value:s,timestamp:i}=On.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await n(...r);return On.set(t,{value:o,timestamp:Date.now()}),o}}var ae=class n extends X{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof U)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof _e)e.serializeU32AsUleb128(1),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(U.load(e));case 1:return new n(_e.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function ee(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await D({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function io(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ge({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _28 => _28.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _29 => _29.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _30 => _30.limit]), () => (1e3))}})}async function Jt(n){return _optionalChain([n, 'access', _31 => _31.options, 'optionalAccess', _32 => _32.ledgerVersion])!==void 0?oo(n):Ke(async()=>oo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function oo(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:s}=await D({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])}});return s}async function ao(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ge({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _34 => _34.offset]),limit:_optionalChain([r, 'optionalAccess', _35 => _35.limit])}})}async function co(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ge({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _36 => _36.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _37 => _37.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _38 => _38.limit]), () => (999))}})}async function Gn(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:s}=await D({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _39 => _39.ledgerVersion])}});return s.data}async function Dn(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await Gn({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:s}}=o,i=u.from(e);try{let a=await Xt({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof oe&&a.data.error_code==="table_item_not_found")return i;throw a}}async function uo(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},i=await m({aptosConfig:t,query:{query:Lr,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function po(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _40 => _40.tokenStandard])&&(s.token_standard={_eq:_optionalChain([r, 'optionalAccess', _41 => _41.tokenStandard])});let i={query:Kr,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _42 => _42.offset]),limit:_optionalChain([r, 'optionalAccess', _43 => _43.limit]),order_by:_optionalChain([r, 'optionalAccess', _44 => _44.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function lo(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,s=u.from(e).toStringLong(),i=u.from(r).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _45 => _45.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _46 => _46.tokenStandard])});let c={query:$r,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _47 => _47.offset]),limit:_optionalChain([o, 'optionalAccess', _48 => _48.limit]),order_by:_optionalChain([o, 'optionalAccess', _49 => _49.orderBy])}};return(await m({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function go(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _50 => _50.tokenStandard])&&(s.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _51 => _51.tokenStandard])}});let i={query:Fr,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _52 => _52.offset]),limit:_optionalChain([r, 'optionalAccess', _53 => _53.limit]),order_by:_optionalChain([r, 'optionalAccess', _54 => _54.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function mo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),s=await m({aptosConfig:t,query:{query:Vr,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function yo(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=u.from(e).toStringLong(),s=await Mn({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return s[0]?s[0].amount:0}async function Mn(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=u.from(e).toStringLong(),s={..._optionalChain([r, 'optionalAccess', _55 => _55.where]),owner_address:{_eq:o}},i={query:Br,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([r, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([r, 'optionalAccess', _58 => _58.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ao(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),s=await m({aptosConfig:t,query:{query:Mr,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function fo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:u.from(e).toStringLong()}},i={query:qr,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.limit]),order_by:_optionalChain([r, 'optionalAccess', _61 => _61.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function ho(n){let{aptosConfig:t,privateKey:e}=n,r=new x(e.publicKey());if(e instanceof we){let s=J.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Se.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof he){let o=J.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await so({authKey:o,aptosConfig:t})){let c=o.derivedAddress();return Se.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!1})}let i=J.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await so({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Se.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function so(n){let{aptosConfig:t,authKey:e}=n,r=await Dn({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await ee({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function ve(n){return new Promise(t=>{setTimeout(t,n)})}async function To(n){let{aptosConfig:t,options:e}=n;return Ge({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _62 => _62.offset]),limit:_optionalChain([e, 'optionalAccess', _63 => _63.limit])}})}async function tn(n){let{aptosConfig:t}=n;return Ke(async()=>{let{data:e}=await D({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function bo(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await D({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function nn(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await D({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function wo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await nn({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _64 => _64.status])===404)return!0;throw r}}async function $e(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.timeoutSecs]), () => (Bt)),s=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _66 => _66.checkSuccess]), () => (!0)),i=!0,a=0,c,p,g=200,C=1.5;for(;i&&!(a>=o);){try{if(c=await nn({aptosConfig:t,transactionHash:e}),i=c.type==="pending_transaction",!i)break}catch(A){if(!(A instanceof oe)||(p=A,A.status!==404&&A.status>=400&&A.status<500))throw A}await ve(g),a+=g/1e3,g*=C}if(c===void 0)throw p||new en(`Fetching transaction ${e} failed and timed out after ${o} seconds`,c);if(c.type==="pending_transaction")throw new en(`Transaction ${e} timed out in pending state after ${o} seconds`,c);if(!s)return c;if(!c.success)throw new Bn(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function rn(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,s=new Date().getTime(),i=BigInt(-1);for(;i<r;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?i=await Yt({aptosConfig:t}):i=(await Zt({aptosConfig:t,processorType:e})).last_success_version,i>=r)break;await ve(200)}}var en=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Bn=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function h(n){n.minimumLedgerVersion!==void 0&&await rn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var At=class{constructor(t){this.config=t}async getAccountInfo(t){return ee({aptosConfig:this.config,...t})}async getAccountModules(t){return io({aptosConfig:this.config,...t})}async getAccountModule(t){return Jt({aptosConfig:this.config,...t})}async getAccountTransactions(t){return ao({aptosConfig:this.config,...t})}async getAccountResources(t){return co({aptosConfig:this.config,...t})}async getAccountResource(t){return Gn({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Dn({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),uo({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),po({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),lo({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),go({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),mo({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Mn({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ao({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Ft,...t})}async getAccountCoinAmount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),yo({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),fo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return ho({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var on=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _67 => _67.network]), () => (_r)),this.fullnode=_optionalChain([t, 'optionalAccess', _68 => _68.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _69 => _69.faucet]),this.indexer=_optionalChain([t, 'optionalAccess', _70 => _70.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _71 => _71.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _72 => _72.clientConfig]), () => ({}))}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return br[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return wr[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Cn[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Cn[this.network]===t}};var sn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new z("account");this.structName=new z("RotationProofChallenge");this.sequenceNumber=new E(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=b.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 G=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ce.load(t);case 1:return an.load(t);case 2:return te.load(t);case 3:return Le.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof ce}isMultiEd25519(){return this instanceof an}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof Le}},ce= exports.AccountAuthenticatorEd25519 =class n extends G{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=w.deserialize(e),o=U.deserialize(e);return new n(r,o)}},an= exports.AccountAuthenticatorMultiEd25519 =class n extends G{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=Y.deserialize(e),o=Be.deserialize(e);return new n(r,o)}},te= exports.AccountAuthenticatorSingleKey =class n extends G{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=x.deserialize(e),o=ae.deserialize(e);return new n(r,o)}},Le= exports.AccountAuthenticatorMultiKey =class n extends G{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=Fe.deserialize(e),o=e.deserializeVector(ae),s=e.deserializeBytes();return new n(r,o,s)}};var ue=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Ve.load(t);case 1:return Fn.load(t);case 2:return He.load(t);case 3:return Qe.load(t);case 4:return We.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Ve= exports.TransactionAuthenticatorEd25519 =class n extends ue{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=w.deserialize(e),o=U.deserialize(e);return new n(r,o)}},Fn= exports.TransactionAuthenticatorMultiEd25519 =class n extends ue{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=Y.deserialize(e),o=Be.deserialize(e);return new n(r,o)}},He= exports.TransactionAuthenticatorMultiAgent =class n extends ue{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}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=G.deserialize(e),o=e.deserializeVector(u),s=e.deserializeVector(G);return new n(r,o,s)}},Qe= exports.TransactionAuthenticatorFeePayer =class n extends ue{constructor(e,r,o,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=s}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=G.deserialize(e),o=e.deserializeVector(u),s=e.deserializeVector(G),i=u.deserialize(e),a=G.deserialize(e),c={address:i,authenticator:a};return new n(r,o,s,c)}},We= exports.TransactionAuthenticatorSingleSender =class n extends ue{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=G.deserialize(e);return new n(r)}};var je=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 v=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 ft=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 v(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),o=v.deserialize(e);return new n(r,o)}};var I=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Xe.load(t);case 1:return Ye.load(t);case 2:return et.load(t);case 3:return tt.load(t);case 4:return rt.load(t);case 5:return ke.load(t);case 6:return st.load(t);case 7:return Ce.load(t);case 8:return Ze.load(t);case 9:return Je.load(t);case 10:return nt.load(t);case 255:return ot.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof Xe}isAddress(){return this instanceof rt}isGeneric(){return this instanceof ot}isSigner(){return this instanceof ke}isVector(){return this instanceof st}isStruct(){return this instanceof Ce}isU8(){return this instanceof Ye}isU16(){return this instanceof Ze}isU32(){return this instanceof Je}isU64(){return this instanceof et}isU128(){return this instanceof tt}isU256(){return this instanceof nt}},Xe= exports.TypeTagBool =class n extends I{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Ye= exports.TypeTagU8 =class n extends I{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Ze= exports.TypeTagU16 =class n extends I{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Je= exports.TypeTagU32 =class n extends I{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},et= exports.TypeTagU64 =class n extends I{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},tt= exports.TypeTagU128 =class n extends I{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},nt= exports.TypeTagU256 =class n extends I{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},rt= exports.TypeTagAddress =class n extends I{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},ke= exports.TypeTagSigner =class n extends I{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},cn= exports.TypeTagReference =class n extends I{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=I.deserialize(e);return new n(r)}},ot= exports.TypeTagGeneric =class n extends I{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)}},st= exports.TypeTagVector =class n extends I{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=I.deserialize(e);return new n(r)}},Ce= exports.TypeTagStruct =class n extends I{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=pe.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},pe= exports.StructTag =class n extends d{constructor(e,r,o,s){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=s}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),o=v.deserialize(e),s=v.deserialize(e),i=e.deserializeVector(I);return new n(r,o,s,i)}};function fd(){return new pe(u.ONE,new v("aptos_coin"),new v("AptosCoin"),[])}function hd(){return new pe(u.ONE,new v("string"),new v("String"),[])}function Td(n){return new pe(u.ONE,new v("option"),new v("Option"),[n])}function bd(n){return new pe(u.ONE,new v("object"),new v("Object"),[n])}function ri(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return R.deserialize(n);case 1:return E.deserialize(n);case 2:return V.deserialize(n);case 3:return u.deserialize(n);case 4:return b.deserialize(n,R);case 5:return P.deserialize(n);case 6:return $.deserialize(n);case 7:return L.deserialize(n);case 8:return H.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Ne=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ht.load(t);case 2:return Tt.load(t);case 3:return bt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},ht= exports.TransactionPayloadScript =class n extends Ne{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=wt.deserialize(e);return new n(r)}},Tt= exports.TransactionPayloadEntryFunction =class n extends Ne{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=it.deserialize(e);return new n(r)}},bt= exports.TransactionPayloadMultisig =class n extends Ne{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=_t.deserialize(e);return new n(r)}},it= exports.EntryFunction =class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(ft.fromStr(t),new v(e),r,o)}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=ft.deserialize(t),r=v.deserialize(t),o=t.deserializeVector(I),s=t.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<s;a+=1){let c=t.deserializeUleb128AsU32(),p=Lt.deserialize(t,c);i.push(p)}return new n(e,r,o,i)}},wt= 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(I),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let a=ri(t);s.push(a)}return new n(e,r,s)}},_t= 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(),o;return r&&(o=St.deserialize(t)),new n(e,o)}},St= exports.MultisigTransactionPayload =class n{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new n(it.deserialize(t))}};var W=class n extends d{constructor(e,r,o,s,i,a,c){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=i,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),o=e.deserializeU64(),s=Ne.deserialize(e),i=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=je.deserialize(e);return new n(r,o,s,i,a,c,p)}},un= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return de.load(t);case 1:return le.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},de= 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=W.deserialize(e),o=e.deserializeVector(u);return new n(r,o)}},le= exports.FeePayerRawTransaction =class n extends un{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}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=W.deserialize(e),o=e.deserializeVector(u),s=u.deserialize(e);return new n(r,o,s)}};var ne=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=W.deserialize(e),o=ue.deserialize(e);return new n(r,o)}};function _o(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function So(n){return!!n.match(/\s/)}function oi(n){return!!n.match(/^T[0-9]+$/)}function si(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!So(r))break}return e}var ii=(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))(ii||{}),_= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function xt(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _73 => _73.allowGenerics]), () => (!1)),r=[],o=[],s=[],i=0,a="",c=1;for(;i<n.length;){let p=n[i];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:s}),a="",s=[],c=1;else if(p===">"){if(a!==""){let Ie=pn(a,o,e);s.push(Ie)}let g=r.pop();if(g===void 0)throw new _(n,"unexpected '>'");if(c!==s.length)throw new _(n,"type argument count doesn't match expected amount");let{savedStr:C,savedTypes:A,savedExpectedTypes:l}=g;o=s,s=A,a=C,c=l}else if(p===","){if(a.length!==0){let g=pn(a,o,e);o=[],s.push(g),a="",c+=1}}else if(So(p)){let g=!1;if(a.length!==0){let A=pn(a,o,e);o=[],s.push(A),a="",g=!0}i=si(n,i);let C=n[i];if(i<n.length&&g&&C!==","&&C!==">")throw new _(n,"unexpected whitespace character");continue}else a+=p;i+=1}if(r.length>0)throw new _(n,"no matching '>' for '<'");switch(s.length){case 0:return pn(a,o,e);case 1:if(a==="")return s[0];throw new _(n,"unexpected ','");default:throw new _(n,"unexpected whitespace character")}}function pn(n,t,e){switch(n){case"&signer":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new cn(new ke);case"signer":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new ke;case"bool":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Xe;case"address":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new rt;case"u8":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Ye;case"u16":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Ze;case"u32":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Je;case"u64":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new et;case"u128":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new tt;case"u256":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new nt;case"vector":if(t.length!==1)throw new _(n,"vector type expected to have exactly one type argument");return new st(t[0]);default:if(oi(n)){if(e)return new ot(Number(n.split("T")[1]));throw new _(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new _(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new _(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!_o(r[1]))throw new _(n,"module name must only contain alphanumeric or '_' characters");if(!_o(r[2]))throw new _(n,"struct name must only contain alphanumeric or '_' characters");return new Ce(new pe(u.fromString(r[0]),new v(r[1]),new v(r[2]),t))}}function xo(n){return typeof n=="boolean"}function at(n){return typeof n=="string"}function dn(n){return typeof n=="number"}function ln(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function vo(n){return n==null}function Co(n){return qn(n)||$n(n)||Ln(n)||Vn(n)||Hn(n)||Qn(n)||Wn(n)||gn(n)||Kn(n)||ai(n)||n instanceof b||n instanceof ye}function qn(n){return n instanceof P}function gn(n){return n instanceof u}function Kn(n){return n instanceof z}function ai(n){return n instanceof ze}function $n(n){return n instanceof R}function Ln(n){return n instanceof $}function Vn(n){return n instanceof L}function Hn(n){return n instanceof E}function Qn(n){return n instanceof V}function Wn(n){return n instanceof H}function jn(n){return"bytecode"in n}function S(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Po(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Xn(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}var ci=new TextEncoder;function Uo(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _74 => _74.map, 'call', _75 => _75(t=>at(t)?xt(t):t)]), () => ([]))}async function Io(n,t,e,r){let s=await _asyncOptionalChain([(await Jt({aptosConfig:r,accountAddress:n,moduleName:t})), 'access', async _76 => _76.abi, 'optionalAccess', async _77 => _77.exposed_functions, 'access', async _78 => _78.find, 'call', async _79 => _79(c=>c.name===e)]);if(!s)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let i=Po(s),a=[];for(let c=i;c<s.params.length;c+=1)a.push(xt(s.params[c],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:a}}function Eo(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let s=t.parameters[r];return ct(e,s,r,o)}function ct(n,t,e,r){return Co(n)?(Yn(t,n,e),n):ui(n,t,e,r)}function ui(n,t,e,r){if(t.isBool()){if(xo(n))return new P(n);S("boolean",e)}if(t.isAddress()){if(at(n))return u.fromString(n);S("string | AccountAddress",e)}if(t.isU8()){if(dn(n))return new R(n);S("number",e)}if(t.isU16()){if(dn(n))return new $(n);S("number",e)}if(t.isU32()){if(dn(n))return new L(n);S("number",e)}if(t.isU64()){if(ln(n))return new E(BigInt(n));S("bigint | number | string",e)}if(t.isU128()){if(ln(n))return new V(BigInt(n));S("bigint | number | string",e)}if(t.isU256()){if(ln(n))return new H(BigInt(n));S("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return ct(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(at(n))return b.U8(ci.encode(n));if(n instanceof Uint8Array)return b.U8(n);if(n instanceof ArrayBuffer)return b.U8(new Uint8Array(n))}if(Array.isArray(n))return new b(n.map(o=>ct(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(at(n))return new z(n);S("string",e)}if(t.isObject()){if(at(n))return u.fromString(n);S("string | AccountAddress",e)}if(t.isOption())return vo(n)?new ye(null):new ye(ct(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 Yn(n,t,e){if(n.isBool()){if(qn(t))return;S("Bool",e)}if(n.isAddress()){if(gn(t))return;S("AccountAddress",e)}if(n.isU8()){if($n(t))return;S("U8",e)}if(n.isU16()){if(Ln(t))return;S("U16",e)}if(n.isU32()){if(Vn(t))return;S("U32",e)}if(n.isU64()){if(Hn(t))return;S("U64",e)}if(n.isU128()){if(Qn(t))return;S("U128",e)}if(n.isU256()){if(Wn(t))return;S("U256",e)}if(n.isVector()){if(t instanceof b){t.values.length>0&&Yn(n.value,t.values[0],e);return}S("MoveVector",e)}if(n instanceof Ce){if(n.isString()){if(Kn(t))return;S("MoveString",e)}if(n.isObject()){if(gn(t))return;S("AccountAddress",e)}if(n.isOption()){if(t instanceof ye){t.value!==void 0&&Yn(n.value.typeArgs[0],t.value,e);return}S("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function yn(n){if(jn(n))return Ro(n);let{moduleAddress:t,moduleName:e,functionName:r}=Xn(n.function),o=await Ke(async()=>Io(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return di(n,o)}function di(n,t){if(jn(n))return Ro(n);let{moduleAddress:e,moduleName:r,functionName:o}=Xn(n.function),s=Uo(n.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let i=n.functionArguments.map((c,p)=>Eo(n.function,t,c,p,s));if(i.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${i.length}`);let a=it.build(`${e}::${r}`,o,s,i);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new bt(new _t(c,new St(a)))}return new Tt(a)}function Ro(n){return new ht(new wt(f.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function li(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=_optionalChain([o, 'optionalAccess', _80 => _80.accountSequenceNumber])!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):ee({aptosConfig:t,accountAddress:e}),i=Pn[t.network]?Promise.resolve({chain_id:Pn[t.network]}):jt({aptosConfig:t}),a=_optionalChain([o, 'optionalAccess', _81 => _81.gasUnitPrice])?Promise.resolve({gas_estimate:o.gasUnitPrice}):tn({aptosConfig:t}),[{sequence_number:c},{chain_id:p},{gas_estimate:g}]=await Promise.all([s,i,a]),{maxGasAmount:C,gasUnitPrice:A,expireTimestamp:l}={maxGasAmount:_optionalChain([o, 'optionalAccess', _82 => _82.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(Sr),gasUnitPrice:BigInt(g),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+xr),...o};return new W(u.from(e),BigInt(c),r,BigInt(C),BigInt(A),BigInt(l),new je(p))}async function Zn(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=await li({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let i=_nullishCoalesce(_optionalChain([n, 'access', _83 => _83.secondarySignerAddresses, 'optionalAccess', _84 => _84.map, 'call', _85 => _85(a=>u.from(a))]), () => ([]));return{rawTransaction:s,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}function zo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,s=mn(t);if(e.feePayerAddress){let a=new le(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(C=>mn(C)));let p=mn(o),g=new Qe(s,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new ne(a.raw_txn,g).bcsToBytes()}if(e.secondarySignerAddresses){let a=new de(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(g=>mn(g));let p=new He(s,e.secondarySignerAddresses,c);return new ne(a.raw_txn,p).bcsToBytes()}let i;if(s instanceof ce)i=new Ve(s.public_key,s.signature);else if(s instanceof te)i=new We(s);else throw new Error("Invalid public key");return new ne(e.rawTransaction,i).bcsToBytes()}function mn(n){if(n instanceof x){if(n.publicKey instanceof w)return new te(n,new ae(new U(new Uint8Array(64))));if(n.publicKey instanceof Q)return new te(n,new ae(new _e(new Uint8Array(64))))}return new ce(new w(n.toUint8Array()),new U(new Uint8Array(64)))}function ko(n){let{signer:t,transaction:e}=n,r=Jn(e),o=t.sign(r);switch(t.signingScheme){case 0:return new ce(new w(t.publicKey.toUint8Array()),new U(o.toUint8Array()));case 2:if(!x.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new te(t.publicKey,new ae(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function No(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,s=Oo(t);if((r||o)&&(s instanceof de||s instanceof le))return gi(s,e,r,o);if(e instanceof ce&&s instanceof W){let i=new Ve(e.public_key,e.signature);return new ne(s,i).bcsToBytes()}if((e instanceof te||e instanceof Le)&&s instanceof W){let i=new We(e);return new ne(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Oo(n){return n.feePayerAddress?new le(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new de(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function gi(n,t,e,r){if(n instanceof le){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new Qe(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:e});return new ne(n.raw_txn,o).bcsToBytes()}if(n instanceof de){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new He(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new ne(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function Jn(n){let t=Oo(n),e=_sha3.sha3_256.create();if(t instanceof W)e.update(vr);else if(t instanceof de)e.update(Un);else if(t instanceof le)e.update(Un);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(r.length+o.length);return s.set(r),s.set(o,r.length),s}async function y(n){let t=await mi(n);return yi(n,t)}async function mi(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?(r=e,o=await yn(r)):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await yn(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await yn(r)),o}async function yi(n,t){let{aptosConfig:e,sender:r,options:o}=n,s;if(Ai(n)&&(s=u.ZERO.toString()),fi(n)){let{secondarySignerAddresses:i}=n;return Zn({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return Zn({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:s})}function Ai(n){return n.withFeePayer===!0}function fi(n){return"secondarySignerAddresses"in n}function Go(n){let{transaction:t}=n;return Jn(t)}function An(n){return ko({...n})}async function er(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=n,a=zo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:c}=await De({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _86 => _86.options, 'optionalAccess', _87 => _87.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _88 => _88.options, 'optionalAccess', _89 => _89.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _90 => _90.options, 'optionalAccess', _91 => _91.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function fn(n){let{aptosConfig:t}=n,e=No({...n}),{data:r}=await De({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function vt(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=An({signer:e,transaction:r});return fn({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function Do(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:s}=n,i=o.map(c=>b.U8(c));return await y({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[b.U8(r),new b(i)]},options:s})}async function Mo(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await ee({aptosConfig:t,accountAddress:e.accountAddress}),s=Se.fromPrivateKey({privateKey:r,legacy:!0}),a=new sn({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),c=e.sign(a),p=s.sign(a),g=await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new R(e.signingScheme.valueOf()),b.U8(e.publicKey.toUint8Array()),new R(s.signingScheme.valueOf()),b.U8(s.publicKey.toUint8Array()),b.U8(c.toUint8Array()),b.U8(p.toUint8Array())]}});return await vt({aptosConfig:t,signer:e,transaction:g})}async function Bo(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:s,options:i}=n,a=_nullishCoalesce(s, () => (Ft));return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[a],functionArguments:[r,o]},options:i})}var Ct=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Bo({aptosConfig:this.config,...t})}};var Pe={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String"},q="0x4::token::Token";async function Fo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await m({aptosConfig:t,query:{query:eo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function qo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await m({aptosConfig:t,query:{query:Nn,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Ko(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s={query:Nn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _92 => _92.offset]),limit:_optionalChain([r, 'optionalAccess', _93 => _93.limit]),order_by:_optionalChain([r, 'optionalAccess', _94 => _94.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function $o(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,o={token_data_id:{_eq:u.from(e).toStringLong()}},s={query:Jr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _95 => _95.offset]),limit:_optionalChain([r, 'optionalAccess', _96 => _96.limit]),order_by:_optionalChain([r, 'optionalAccess', _97 => _97.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}async function Lo(n){let{aptosConfig:t,options:e,creator:r}=n;return await y({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new z(n.description),new E(_nullishCoalesce(n.maxSupply, () => (Ee))),new z(n.name),new z(n.uri),new P(_nullishCoalesce(n.mutableDescription, () => (!0))),new P(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new P(_nullishCoalesce(n.mutableURI, () => (!0))),new P(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new P(_nullishCoalesce(n.mutableTokenName, () => (!0))),new P(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new P(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new P(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new P(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new E(_nullishCoalesce(n.royaltyNumerator, () => (0))),new E(_nullishCoalesce(n.royaltyDenominator, () => (1)))]},options:e})}async function tr(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,s=u.from(e),i={collection_name:{_eq:r},creator_address:{_eq:s.toStringLong()}};return _optionalChain([o, 'optionalAccess', _98 => _98.tokenStandard])&&(i.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _99 => _99.tokenStandard]), () => ("v2"))}),(await m({aptosConfig:t,query:{query:Qr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Vo(n){return(await tr(n)).collection_id}async function Ho(n){let{aptosConfig:t,options:e,creator:r,collection:o,description:s,name:i,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:g}=n,C=_optionalChain([p, 'optionalAccess', _100 => _100.map, 'call', _101 => _101(l=>Pe[l])]);return await y({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[o,s,i,a,_nullishCoalesce(c, () => ([])),_nullishCoalesce(C, () => ([])),is(_nullishCoalesce(g, () => ([])),_nullishCoalesce(C, () => ([])))]},options:e})}async function Qo(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[r,o]},options:i})}async function Wo(n){let{aptosConfig:t,account:e,collection:r,description:o,name:s,uri:i,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:g,options:C}=n;if(_optionalChain([c, 'optionalAccess', _102 => _102.length])!==_optionalChain([g, 'optionalAccess', _103 => _103.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _104 => _104.length])!==_optionalChain([g, 'optionalAccess', _105 => _105.length]))throw new Error("Property types and property values counts do not match");let A=_optionalChain([p, 'optionalAccess', _106 => _106.map, 'call', _107 => _107(Ie=>Pe[Ie])]);return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,s,i,_nullishCoalesce(c, () => ([])),_nullishCoalesce(A, () => ([])),is(_nullishCoalesce(g, () => ([])),_nullishCoalesce(A, () => ([]))),a]},options:C})}async function jo(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(o, () => (q))],functionArguments:[r]},options:s})}async function Xo(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(o, () => (q))],functionArguments:[r]},options:s})}async function Yo(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(o, () => (q))],functionArguments:[r]},options:s})}async function Zo(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function Jo(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function es(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function ts(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (q))],functionArguments:[i,r,Pe[o],nr(s,Pe[o])]},options:c})}async function ns(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function rs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (q))],functionArguments:[i,r,Pe[o],nr(s,Pe[o])]},options:c})}async function os(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (q)),Pe[o]],functionArguments:[i,r,s]},options:c})}async function ss(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (q)),Pe[o]],functionArguments:[i,r,s]},options:c})}function is(n,t){let e=new Array;return t.forEach((r,o)=>{e.push(nr(n[o],r))}),e}function nr(n,t){let e=xt(t);return ct(n,e,0,[]).bcsToBytes()}var Pt=class{constructor(t){this.config=t}async getCollectionData(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),tr({aptosConfig:this.config,...t})}async getCollectionId(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Vo({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Fo({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),qo({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),$o({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return Lo({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return Ho({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return Qo({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return Wo({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return jo({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return Xo({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return Yo({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return Zo({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return Jo({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return es({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return ts({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return ns({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return rs({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return os({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return ss({aptosConfig:this.config,...t})}};async function as(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,s={account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}};return hn({aptosConfig:e,options:{where:s}})}async function cs(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:_optionalChain([o, 'optionalAccess', _108 => _108.orderBy])};return hn({aptosConfig:e,options:a})}async function hn(n){let{aptosConfig:t,options:e}=n,r={query:Xr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _109 => _109.where]),offset:_optionalChain([e, 'optionalAccess', _110 => _110.offset]),limit:_optionalChain([e, 'optionalAccess', _111 => _111.limit]),order_by:_optionalChain([e, 'optionalAccess', _112 => _112.orderBy])}};return(await m({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var Ut=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),as({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),cs({aptosConfig:this.config,...t})}async getEvents(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _113 => _113.minimumLedgerVersion]),processorType:"events_processor"}),hn({aptosConfig:this.config,...t})}};async function us(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,s=_optionalChain([o, 'optionalAccess', _114 => _114.timeoutSecs])||Bt,{data:i}=await Ur({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=i.txn_hashes[0],c=await $e({aptosConfig:t,transactionHash:a,options:{timeoutSecs:s,checkSuccess:_optionalChain([o, 'optionalAccess', _115 => _115.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var It=class{constructor(t){this.config=t}async fundAccount(t){let e=await us({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _116 => _116.options, 'optionalAccess', _117 => _117.waitForIndexer])!==!1&&await rn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function rr(n){let{aptosConfig:t,options:e}=n,r={query:Zr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _118 => _118.where]),limit:_optionalChain([e, 'optionalAccess', _119 => _119.limit]),offset:_optionalChain([e, 'optionalAccess', _120 => _120.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function ps(n){let{aptosConfig:t,options:e}=n,r={query:Yr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _121 => _121.where]),limit:_optionalChain([e, 'optionalAccess', _122 => _122.limit]),offset:_optionalChain([e, 'optionalAccess', _123 => _123.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function ds(n){let{aptosConfig:t,options:e}=n,r={query:Wr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _124 => _124.where]),limit:_optionalChain([e, 'optionalAccess', _125 => _125.limit]),offset:_optionalChain([e, 'optionalAccess', _126 => _126.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function ls(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,s]},options:i})}var Et=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _127 => _127.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),rr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _128 => _128.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await rr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _129 => _129.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ps({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _130 => _130.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ds({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return ls({aptosConfig:this.config,...t})}};var Rt=class{constructor(t){this.config=t}async getLedgerInfo(){return jt({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return to({aptosConfig:this.config,...t})}async getBlockByHeight(t){return no({aptosConfig:this.config,...t})}async getTableItem(t){return Xt({aptosConfig:this.config,...t})}async view(t){return xe({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return ro({aptosConfig:this.config,...t})}async queryIndexer(t){return m({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Yt({aptosConfig:this.config})}async getProcessorStatus(t){return Zt({aptosConfig:this.config,processorType:t})}};var gs=["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 ms(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ue(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(!ms(t))throw new Error(`${t} is not valid. ${gs}`);if(e&&!ms(e))throw new Error(`${e} is not valid. ${gs}`);return{domainName:e||t,subdomainName:e?t:void 0}}var hi="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Ti={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:hi,custom:null,devnet:null};function ge(n){let t=Ti[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var bi=n=>({vec:[n]}),wi=()=>({vec:[]}),or=n=>n!=null?bi(n):wi(),Tn=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function ys(n){let{aptosConfig:t,name:e}=n,r=ge(t),{domainName:o,subdomainName:s}=Ue(e),i=await xe({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,or(s)]}}),a=Tn(i[0]);return a?u.from(a).toString():void 0}async function As(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:s,toAddress:i,options:a,transferable:c}=n,p=ge(t),{domainName:g,subdomainName:C}=Ue(r),A=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(C&&!A)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(A&&!C)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let ur=_nullishCoalesce(e.years, () => (1));if(ur!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Rs=ur*31536e3;return await y({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[g,Rs,s,i]},options:a})}if(!C)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await sr({aptosConfig:t,name:g});if(!l)throw new Error("The domain does not exist");let Ie=e.policy==="subdomain:independent"?e.expirationDate:l;if(Ie>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await y({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[g,C,Math.round(Ie/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,s,i]},options:a})}async function sr(n){let{aptosConfig:t,name:e}=n,r=ge(t),{domainName:o,subdomainName:s}=Ue(e);try{let i=await xe({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,or(s)]}});return Number(i[0])*1e3}catch (e2){return}}async function fs(n){let{aptosConfig:t,address:e}=n,r=ge(t),o=await xe({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),s=Tn(o[1]),i=Tn(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function hs(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,s=ge(t);if(!r)return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:a}=Ue(r);return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:o})}async function Ts(n){let{aptosConfig:t,name:e}=n,r=ge(t),{domainName:o,subdomainName:s}=Ue(e),i=await xe({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,or(s)]}}),a=Tn(i[0]);return a?u.from(a).toString():void 0}async function bs(n){let{aptosConfig:t,sender:e,name:r,address:o,options:s}=n,i=ge(t),{domainName:a,subdomainName:c}=Ue(r);return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,c,o]},options:s})}async function ws(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Ue(e),a=(await m({aptosConfig:t,query:{query:qe,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=zt(a)),a}async function _s(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ir({aptosConfig:t});return(await m({aptosConfig:t,originMethod:"getAccountNames",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _131 => _131.limit]),offset:_optionalChain([e, 'optionalAccess', _132 => _132.offset]),order_by:_optionalChain([e, 'optionalAccess', _133 => _133.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _134 => _134.options, 'optionalAccess', _135 => _135.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(zt)}async function Ss(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ir({aptosConfig:t});return(await m({aptosConfig:t,originMethod:"getAccountDomains",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _136 => _136.limit]),offset:_optionalChain([e, 'optionalAccess', _137 => _137.offset]),order_by:_optionalChain([e, 'optionalAccess', _138 => _138.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _139 => _139.options, 'optionalAccess', _140 => _140.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(zt)}async function xs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ir({aptosConfig:t});return(await m({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _141 => _141.limit]),offset:_optionalChain([e, 'optionalAccess', _142 => _142.offset]),order_by:_optionalChain([e, 'optionalAccess', _143 => _143.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _144 => _144.options, 'optionalAccess', _145 => _145.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(zt)}async function vs(n){let{aptosConfig:t,options:e,domain:r}=n;return(await m({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _146 => _146.limit]),offset:_optionalChain([e, 'optionalAccess', _147 => _147.offset]),order_by:_optionalChain([e, 'optionalAccess', _148 => _148.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _149 => _149.options, 'optionalAccess', _150 => _150.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(zt)}async function ir(n){let{aptosConfig:t}=n,e=ge(t),[r]=await xe({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function Cs(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:s}=n,i=ge(t),a=o*31536e3,{domainName:c,subdomainName:p}=Ue(r);if(p)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[c,a]},options:s})}function zt(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var kt=class{constructor(t){this.config=t}async getOwnerAddress(t){return ys({aptosConfig:this.config,...t})}async getExpiration(t){return sr({aptosConfig:this.config,...t})}async getTargetAddress(t){return Ts({aptosConfig:this.config,...t})}async setTargetAddress(t){return bs({aptosConfig:this.config,...t})}async getPrimaryName(t){return fs({aptosConfig:this.config,...t})}async setPrimaryName(t){return hs({aptosConfig:this.config,...t})}async registerName(t){return As({aptosConfig:this.config,...t})}async renewDomain(t){return Cs({aptosConfig:this.config,...t})}async getName(t){return ws({aptosConfig:this.config,...t})}async getAccountNames(t){return _s({aptosConfig:this.config,...t})}async getAccountDomains(t){return Ss({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return xs({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return vs({aptosConfig:this.config,...t})}};async function Ps(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),s=await m({aptosConfig:t,query:{query:zn,variables:{where_condition:{pool_address:{_eq:r}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function Us(n){let{aptosConfig:t,options:e}=n,r={query:zn,variables:{order_by:_optionalChain([e, 'optionalAccess', _151 => _151.orderBy])}};return(await m({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Is(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:jr,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await m({aptosConfig:t,query:o})).delegated_staking_activities}var Nt=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _152 => _152.minimumLedgerVersion]),processorType:"stake_processor"}),Ps({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _153 => _153.minimumLedgerVersion]),processorType:"stake_processor"}),Us({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _154 => _154.minimumLedgerVersion]),processorType:"stake_processor"}),Is({aptosConfig:this.config,...t})}};var bn=()=>Math.floor(Date.now()/1e3),wn= exports.AccountSequenceNumber =class{constructor(t,e,r,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await ve(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=bn();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await ve(this.sleepTime),bn()-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 ee({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await ee({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 ve(this.sleepTime);this.lock=!0;try{await this.update();let t=bn();for(;this.lastUncommintedNumber!==this.currentNumber;)bn()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await ve(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 ut=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _155 => _155.pendingDequeue, 'access', _156 => _156.shift, 'call', _157 => _157(), 'optionalAccess', _158 => _158.resolve, 'call', _159 => _159(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 pt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},pt=class extends Error{};var Es="fulfilled",_n= exports.TransactionWorker =class{constructor(t,e,r=30,o=100,s=10){this.taskQueue=new ut;this.transactionsQueue=new ut;this.outstandingTransactions=new ut;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new wn(t,e,r,o,s)}async submitNextTransaction(){try{for(;;){if(this.transactionsQueue.isEmpty())return;let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let r=vt({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([r,t])}}catch(t){if(t instanceof pt)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[r,o]=await this.outstandingTransactions.dequeue();for(t.push(r),e.push(o);!this.outstandingTransactions.isEmpty();)[r,o]=await this.outstandingTransactions.dequeue(),t.push(r),e.push(o);let s=await Promise.allSettled(t);for(let i=0;i<s.length&&i<e.length;i+=1){let a=s[i];o=e[i],a.status===Es?(this.sentTransactions.push([a.value.hash,o,null]),await this.checkTransaction(a,o)):this.sentTransactions.push([a.status,o,a.reason])}}}catch(t){if(t instanceof pt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let r=[];r.push($e({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(r);for(let s=0;s<o.length;s+=1){let i=o[s];i.status===Es?this.executedTransactions.push([i.value.hash,e,null]):this.executedTransactions.push([i.status,e,i.reason])}}catch(r){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${r}`)}}async push(t,e){await this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[r,o]=await this.transactionsQueue.dequeue();return await y({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:r,options:{...o,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}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 Sn=class{constructor(t){this.config=t}async simple(t){return y({aptosConfig:this.config,...t})}async multiAgent(t){return y({aptosConfig:this.config,...t})}};function ar(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}function cr(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var dt=class{constructor(t){this.config=t}async simple(t){return er({aptosConfig:this.config,...t})}async multiAgent(t){return er({aptosConfig:this.config,...t})}};N([cr],dt.prototype,"simple",1),N([cr],dt.prototype,"multiAgent",1);var lt=class{constructor(t){this.config=t}async simple(t){return fn({aptosConfig:this.config,...t})}async multiAgent(t){return fn({aptosConfig:this.config,...t})}};N([ar],lt.prototype,"simple",1),N([ar],lt.prototype,"multiAgent",1);var Ot=class{constructor(t){this.config=t,this.build=new Sn(this.config),this.simulate=new dt(this.config),this.submit=new lt(this.config)}async getTransactions(t){return To({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return bo({aptosConfig:this.config,...t})}async getTransactionByHash(t){return nn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return wo({aptosConfig:this.config,...t})}async waitForTransaction(t){return $e({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return tn({aptosConfig:this.config})}getSigningMessage(t){return Go(t)}async publishPackageTransaction(t){return Do({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Mo({aptosConfig:this.config,...t})}sign(t){return An({...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,An({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t,s=new _n(this.config,e);s.start();for(let i of r)await s.push(i,o)}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return vt({aptosConfig:this.config,signer:e,transaction:r})}};var K=class{constructor(t){this.config=new on(t),this.account=new At(this.config),this.ans=new kt(this.config),this.coin=new Ct(this.config),this.digitalAsset=new Pt(this.config),this.event=new Ut(this.config),this.faucet=new It(this.config),this.fungibleAsset=new Et(this.config),this.general=new Rt(this.config),this.staking=new Nt(this.config),this.transaction=new Ot(this.config)}};function re(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...s){return this[e][r](...s)},Object.defineProperty(n.prototype,r,o))})}re(K,At,"account");re(K,kt,"ans");re(K,Ct,"coin");re(K,Pt,"digitalAsset");re(K,Ut,"event");re(K,It,"faucet");re(K,Et,"fungibleAsset");re(K,Rt,"general");re(K,Nt,"staking");re(K,Ot,"transaction");exports.APTOS_BIP44_REGEX = Ws; exports.APTOS_COIN = Ft; exports.APTOS_HARDENED_REGEX = Qs; exports.Account = Se; exports.AccountAddress = u; exports.AccountAuthenticator = G; exports.AccountAuthenticatorEd25519 = ce; exports.AccountAuthenticatorMultiEd25519 = an; exports.AccountAuthenticatorMultiKey = Le; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = yr; exports.AccountSequenceNumber = wn; exports.AddressInvalidReason = Ls; exports.AnyPublicKey = x; exports.AnyPublicKeyVariant = Ar; exports.AnySignature = ae; exports.AnySignatureVariant = fr; exports.Aptos = K; exports.AptosApiError = oe; exports.AptosApiType = Mt; exports.AptosConfig = on; exports.AuthenticationKey = J; exports.Bool = P; exports.CKDPriv = Or; exports.ChainId = je; exports.DEFAULT_MAX_GAS_AMOUNT = Sr; exports.DEFAULT_NETWORK = _r; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = xr; exports.DEFAULT_TXN_TIMEOUT_SEC = Bt; exports.DeriveScheme = Ds; exports.Deserializer = Er; exports.Ed25519PrivateKey = he; exports.Ed25519PublicKey = w; exports.Ed25519Signature = U; exports.EntryFunction = it; exports.EntryFunctionBytes = Lt; exports.FeePayerRawTransaction = le; exports.FixedBytes = ze; exports.HARDENED_OFFSET = zr; exports.Hex = f; exports.HexInvalidReason = qs; exports.Identifier = v; exports.KeyType = js; exports.MimeType = xn; exports.ModuleId = ft; exports.MoveAbility = Os; exports.MoveFunctionVisibility = Ns; exports.MoveOption = ye; exports.MoveString = z; exports.MoveVector = b; exports.MultiAgentRawTransaction = de; exports.MultiEd25519PublicKey = Y; exports.MultiEd25519Signature = Be; exports.MultiKey = Fe; exports.MultiSig = _t; exports.MultisigTransactionPayload = St; exports.Network = Dt; exports.NetworkToChainId = Pn; exports.NetworkToFaucetAPI = wr; exports.NetworkToIndexerAPI = Cn; exports.NetworkToNetworkName = Xi; exports.NetworkToNodeAPI = br; exports.ParsingError = O; exports.PrivateKey = Me; exports.ProcessorType = Oe; exports.PublicKey = M; exports.RAW_TRANSACTION_SALT = vr; exports.RAW_TRANSACTION_WITH_DATA_SALT = Un; exports.RawTransaction = W; exports.RawTransactionWithData = un; exports.RoleType = Gs; exports.RotationProofChallenge = sn; exports.Script = wt; exports.ScriptTransactionArgumentVariants = gt; exports.Secp256k1PrivateKey = we; exports.Secp256k1PublicKey = Q; exports.Secp256k1Signature = _e; exports.Serializable = d; exports.Serializer = j; exports.Signature = X; exports.SignedTransaction = ne; exports.SigningScheme = mt; exports.SigningSchemeInput = hr; exports.StructTag = pe; exports.TransactionAuthenticator = ue; exports.TransactionAuthenticatorEd25519 = Ve; exports.TransactionAuthenticatorFeePayer = Qe; exports.TransactionAuthenticatorMultiAgent = He; exports.TransactionAuthenticatorMultiEd25519 = Fn; exports.TransactionAuthenticatorSingleSender = We; exports.TransactionAuthenticatorVariant = mr; exports.TransactionPayload = Ne; exports.TransactionPayloadEntryFunction = Tt; exports.TransactionPayloadMultisig = bt; exports.TransactionPayloadScript = ht; exports.TransactionPayloadVariants = lr; exports.TransactionResponseType = vn; exports.TransactionVariants = gr; exports.TransactionWorker = _n; exports.TypeTag = I; exports.TypeTagAddress = rt; exports.TypeTagBool = Xe; exports.TypeTagGeneric = ot; exports.TypeTagParserError = _; exports.TypeTagParserErrorType = ii; exports.TypeTagReference = cn; exports.TypeTagSigner = ke; exports.TypeTagStruct = Ce; exports.TypeTagU128 = tt; exports.TypeTagU16 = Ze; exports.TypeTagU256 = nt; exports.TypeTagU32 = Je; exports.TypeTagU64 = et; exports.TypeTagU8 = Ye; exports.TypeTagVariants = dr; exports.TypeTagVector = st; exports.U128 = V; exports.U16 = $; exports.U256 = H; exports.U32 = L; exports.U64 = E; exports.U8 = R; exports.aptosCoinStructTag = fd; exports.aptosRequest = Gt; exports.buildTransaction = Zn; exports.checkOrConvertArgument = ct; exports.convertArgument = Eo; exports.deriveKey = Rn; exports.deriveTransactionType = Oo; exports.deserializeFromScriptArgument = ri; exports.ensureBoolean = En; exports.fetchEntryFunctionAbi = Io; exports.findFirstNonSignerArg = Po; exports.generateMultiSignersSignedTransaction = gi; exports.generateRawTransaction = li; exports.generateSignedTransaction = No; exports.generateSignedTransactionForSimulation = zo; exports.generateSigningMessage = Jn; exports.generateTransactionPayload = yn; exports.generateTransactionPayloadWithABI = di; exports.get = Cr; exports.getAptosFullNode = D; exports.getAuthenticatorForSimulation = mn; exports.getFunctionParts = Xn; exports.isBcsAddress = gn; exports.isBcsBool = qn; exports.isBcsFixedBytes = ai; exports.isBcsString = Kn; exports.isBcsU128 = Qn; exports.isBcsU16 = Ln; exports.isBcsU256 = Wn; exports.isBcsU32 = Vn; exports.isBcsU64 = Hn; exports.isBcsU8 = $n; exports.isBlockMetadataTransactionResponse = Ri; exports.isBool = xo; exports.isEd25519Signature = ki; exports.isEncodedEntryFunctionArgument = Co; exports.isFeePayerSignature = Gi; exports.isGenesisTransactionResponse = Ei; exports.isLargeNumber = ln; exports.isMultiAgentSignature = Oi; exports.isMultiEd25519Signature = Di; exports.isNull = vo; exports.isNumber = dn; exports.isPendingTransactionResponse = Ui; exports.isScriptDataInput = jn; exports.isSecp256k1Signature = Ni; exports.isStateCheckpointTransactionResponse = zi; exports.isString = at; exports.isUserTransactionResponse = Ii; exports.isValidBIP44Path = kr; exports.isValidHardenedPath = Nr; exports.mnemonicToSeed = Vt; exports.objectStructTag = bd; exports.optionStructTag = Td; exports.outOfRangeErrorMessage = Ks; exports.paginateWithCursor = Ge; exports.parseTypeTag = xt; exports.post = In; exports.postAptosFaucet = Ur; exports.postAptosFullNode = De; exports.postAptosIndexer = Pr; exports.request = Ms; exports.sign = ko; exports.splitPath = Gr; exports.standardizeTypeTags = Uo; exports.stringStructTag = hd; exports.throwTypeMismatch = S; exports.validateNumberInRange = me;
426
+ `;async function jt(n){let{aptosConfig:t}=n,{data:e}=await D({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function to(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await D({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _24 => _24.withTransactions])}});return o}async function no(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await D({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _25 => _25.withTransactions])}});return o}async function Xt(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await De({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _26 => _26.ledgerVersion])},body:r})).data}async function xe(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await De({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _27 => _27.ledgerVersion])},body:{function:e.function,type_arguments:_nullishCoalesce(e.typeArguments, () => ([])),arguments:_nullishCoalesce(e.functionArguments, () => ([]))}});return o}async function ro(n){let{aptosConfig:t,limit:e}=n;return(await m({aptosConfig:t,query:{query:Hr,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function m(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await Pr({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function ti(n){let{aptosConfig:t}=n;return(await m({aptosConfig:t,query:{query:kn},originMethod:"getProcessorStatuses"})).processor_status}async function Yt(n){let t=await ti({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Zt(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await m({aptosConfig:t,query:{query:kn,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var On=new Map;function Ke(n,t,e){return async(...r)=>{if(On.has(t)){let{value:s,timestamp:i}=On.get(t);if(e===void 0||Date.now()-i<=e)return s}let o=await n(...r);return On.set(t,{value:o,timestamp:Date.now()}),o}}var ae=class n extends X{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof U)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof _e)e.serializeU32AsUleb128(1),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(U.load(e));case 1:return new n(_e.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function ee(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await D({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function io(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ge({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _28 => _28.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _29 => _29.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _30 => _30.limit]), () => (1e3))}})}async function Jt(n){return _optionalChain([n, 'access', _31 => _31.options, 'optionalAccess', _32 => _32.ledgerVersion])!==void 0?oo(n):Ke(async()=>oo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function oo(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:s}=await D({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])}});return s}async function ao(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ge({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _34 => _34.offset]),limit:_optionalChain([r, 'optionalAccess', _35 => _35.limit])}})}async function co(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ge({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _36 => _36.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _37 => _37.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _38 => _38.limit]), () => (999))}})}async function Gn(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:s}=await D({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _39 => _39.ledgerVersion])}});return s.data}async function Dn(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await Gn({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:s}}=o,i=u.from(e);try{let a=await Xt({aptosConfig:t,handle:s,data:{key:i.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof oe&&a.data.error_code==="table_item_not_found")return i;throw a}}async function uo(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},i=await m({aptosConfig:t,query:{query:Lr,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return i.current_token_ownerships_v2_aggregate.aggregate?i.current_token_ownerships_v2_aggregate.aggregate.count:0}async function po(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _40 => _40.tokenStandard])&&(s.token_standard={_eq:_optionalChain([r, 'optionalAccess', _41 => _41.tokenStandard])});let i={query:Kr,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _42 => _42.offset]),limit:_optionalChain([r, 'optionalAccess', _43 => _43.limit]),order_by:_optionalChain([r, 'optionalAccess', _44 => _44.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function lo(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,s=u.from(e).toStringLong(),i=u.from(r).toStringLong(),a={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:i}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _45 => _45.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _46 => _46.tokenStandard])});let c={query:$r,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _47 => _47.offset]),limit:_optionalChain([o, 'optionalAccess', _48 => _48.limit]),order_by:_optionalChain([o, 'optionalAccess', _49 => _49.orderBy])}};return(await m({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function go(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _50 => _50.tokenStandard])&&(s.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _51 => _51.tokenStandard])}});let i={query:Fr,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _52 => _52.offset]),limit:_optionalChain([r, 'optionalAccess', _53 => _53.limit]),order_by:_optionalChain([r, 'optionalAccess', _54 => _54.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function mo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),s=await m({aptosConfig:t,query:{query:Vr,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function yo(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=u.from(e).toStringLong(),s=await Mn({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return s[0]?s[0].amount:0}async function Mn(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=u.from(e).toStringLong(),s={..._optionalChain([r, 'optionalAccess', _55 => _55.where]),owner_address:{_eq:o}},i={query:Br,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([r, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([r, 'optionalAccess', _58 => _58.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ao(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),s=await m({aptosConfig:t,query:{query:Mr,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function fo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,s={owner_address:{_eq:u.from(e).toStringLong()}},i={query:qr,variables:{where_condition:s,offset:_optionalChain([r, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.limit]),order_by:_optionalChain([r, 'optionalAccess', _61 => _61.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getAccountOwnedObjects"})).current_objects}async function ho(n){let{aptosConfig:t,privateKey:e}=n,r=new x(e.publicKey());if(e instanceof we){let s=J.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return Se.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof he){let o=J.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await so({authKey:o,aptosConfig:t})){let c=o.derivedAddress();return Se.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!1})}let i=J.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await so({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Se.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function so(n){let{aptosConfig:t,authKey:e}=n,r=await Dn({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await ee({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function ve(n){return new Promise(t=>{setTimeout(t,n)})}async function To(n){let{aptosConfig:t,options:e}=n;return Ge({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _62 => _62.offset]),limit:_optionalChain([e, 'optionalAccess', _63 => _63.limit])}})}async function tn(n){let{aptosConfig:t}=n;return Ke(async()=>{let{data:e}=await D({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function bo(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await D({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function nn(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await D({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function wo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await nn({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _64 => _64.status])===404)return!0;throw r}}async function $e(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.timeoutSecs]), () => (Bt)),s=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _66 => _66.checkSuccess]), () => (!0)),i=!0,a=0,c,p,g=200,C=1.5;for(;i&&!(a>=o);){try{if(c=await nn({aptosConfig:t,transactionHash:e}),i=c.type==="pending_transaction",!i)break}catch(A){if(!(A instanceof oe)||(p=A,A.status!==404&&A.status>=400&&A.status<500))throw A}await ve(g),a+=g/1e3,g*=C}if(c===void 0)throw p||new en(`Fetching transaction ${e} failed and timed out after ${o} seconds`,c);if(c.type==="pending_transaction")throw new en(`Transaction ${e} timed out in pending state after ${o} seconds`,c);if(!s)return c;if(!c.success)throw new Bn(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function rn(n){let{aptosConfig:t,processorType:e}=n,r=BigInt(n.minimumLedgerVersion),o=3e3,s=new Date().getTime(),i=BigInt(-1);for(;i<r;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?i=await Yt({aptosConfig:t}):i=(await Zt({aptosConfig:t,processorType:e})).last_success_version,i>=r)break;await ve(200)}}var en=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Bn=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function h(n){n.minimumLedgerVersion!==void 0&&await rn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var At=class{constructor(t){this.config=t}async getAccountInfo(t){return ee({aptosConfig:this.config,...t})}async getAccountModules(t){return io({aptosConfig:this.config,...t})}async getAccountModule(t){return Jt({aptosConfig:this.config,...t})}async getAccountTransactions(t){return ao({aptosConfig:this.config,...t})}async getAccountResources(t){return co({aptosConfig:this.config,...t})}async getAccountResource(t){return Gn({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Dn({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),uo({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),po({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),lo({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),go({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),mo({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Mn({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Ao({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:Ft,...t})}async getAccountCoinAmount(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),yo({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),fo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return ho({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var on=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _67 => _67.network]), () => (_r)),this.fullnode=_optionalChain([t, 'optionalAccess', _68 => _68.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _69 => _69.faucet]),this.indexer=_optionalChain([t, 'optionalAccess', _70 => _70.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _71 => _71.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _72 => _72.clientConfig]), () => ({}))}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return br[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return wr[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Cn[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Cn[this.network]===t}};var sn=class extends d{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new z("account");this.structName=new z("RotationProofChallenge");this.sequenceNumber=new E(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=b.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 G=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ce.load(t);case 1:return an.load(t);case 2:return te.load(t);case 3:return Le.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof ce}isMultiEd25519(){return this instanceof an}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof Le}},ce= exports.AccountAuthenticatorEd25519 =class n extends G{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=w.deserialize(e),o=U.deserialize(e);return new n(r,o)}},an= exports.AccountAuthenticatorMultiEd25519 =class n extends G{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=Y.deserialize(e),o=Be.deserialize(e);return new n(r,o)}},te= exports.AccountAuthenticatorSingleKey =class n extends G{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=x.deserialize(e),o=ae.deserialize(e);return new n(r,o)}},Le= exports.AccountAuthenticatorMultiKey =class n extends G{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=Fe.deserialize(e),o=e.deserializeVector(ae),s=e.deserializeBytes();return new n(r,o,s)}};var ue=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Ve.load(t);case 1:return Fn.load(t);case 2:return He.load(t);case 3:return Qe.load(t);case 4:return We.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Ve= exports.TransactionAuthenticatorEd25519 =class n extends ue{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=w.deserialize(e),o=U.deserialize(e);return new n(r,o)}},Fn= exports.TransactionAuthenticatorMultiEd25519 =class n extends ue{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=Y.deserialize(e),o=Be.deserialize(e);return new n(r,o)}},He= exports.TransactionAuthenticatorMultiAgent =class n extends ue{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}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=G.deserialize(e),o=e.deserializeVector(u),s=e.deserializeVector(G);return new n(r,o,s)}},Qe= exports.TransactionAuthenticatorFeePayer =class n extends ue{constructor(e,r,o,s){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=s}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=G.deserialize(e),o=e.deserializeVector(u),s=e.deserializeVector(G),i=u.deserialize(e),a=G.deserialize(e),c={address:i,authenticator:a};return new n(r,o,s,c)}},We= exports.TransactionAuthenticatorSingleSender =class n extends ue{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=G.deserialize(e);return new n(r)}};var je=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 v=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 ft=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 v(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),o=v.deserialize(e);return new n(r,o)}};var I=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Xe.load(t);case 1:return Ye.load(t);case 2:return et.load(t);case 3:return tt.load(t);case 4:return rt.load(t);case 5:return ke.load(t);case 6:return st.load(t);case 7:return Ce.load(t);case 8:return Ze.load(t);case 9:return Je.load(t);case 10:return nt.load(t);case 255:return ot.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof Xe}isAddress(){return this instanceof rt}isGeneric(){return this instanceof ot}isSigner(){return this instanceof ke}isVector(){return this instanceof st}isStruct(){return this instanceof Ce}isU8(){return this instanceof Ye}isU16(){return this instanceof Ze}isU32(){return this instanceof Je}isU64(){return this instanceof et}isU128(){return this instanceof tt}isU256(){return this instanceof nt}},Xe= exports.TypeTagBool =class n extends I{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Ye= exports.TypeTagU8 =class n extends I{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Ze= exports.TypeTagU16 =class n extends I{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Je= exports.TypeTagU32 =class n extends I{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},et= exports.TypeTagU64 =class n extends I{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},tt= exports.TypeTagU128 =class n extends I{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},nt= exports.TypeTagU256 =class n extends I{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},rt= exports.TypeTagAddress =class n extends I{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},ke= exports.TypeTagSigner =class n extends I{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},cn= exports.TypeTagReference =class n extends I{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=I.deserialize(e);return new n(r)}},ot= exports.TypeTagGeneric =class n extends I{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)}},st= exports.TypeTagVector =class n extends I{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=I.deserialize(e);return new n(r)}},Ce= exports.TypeTagStruct =class n extends I{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=pe.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},pe= exports.StructTag =class n extends d{constructor(e,r,o,s){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=s}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),o=v.deserialize(e),s=v.deserialize(e),i=e.deserializeVector(I);return new n(r,o,s,i)}};function fd(){return new pe(u.ONE,new v("aptos_coin"),new v("AptosCoin"),[])}function hd(){return new pe(u.ONE,new v("string"),new v("String"),[])}function Td(n){return new pe(u.ONE,new v("option"),new v("Option"),[n])}function bd(n){return new pe(u.ONE,new v("object"),new v("Object"),[n])}function ri(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return R.deserialize(n);case 1:return E.deserialize(n);case 2:return V.deserialize(n);case 3:return u.deserialize(n);case 4:return b.deserialize(n,R);case 5:return P.deserialize(n);case 6:return $.deserialize(n);case 7:return L.deserialize(n);case 8:return H.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Ne=class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ht.load(t);case 2:return Tt.load(t);case 3:return bt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},ht= exports.TransactionPayloadScript =class n extends Ne{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=wt.deserialize(e);return new n(r)}},Tt= exports.TransactionPayloadEntryFunction =class n extends Ne{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=it.deserialize(e);return new n(r)}},bt= exports.TransactionPayloadMultiSig =class n extends Ne{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=_t.deserialize(e);return new n(r)}},it= exports.EntryFunction =class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(ft.fromStr(t),new v(e),r,o)}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=ft.deserialize(t),r=v.deserialize(t),o=t.deserializeVector(I),s=t.deserializeUleb128AsU32(),i=new Array;for(let a=0;a<s;a+=1){let c=t.deserializeUleb128AsU32(),p=Lt.deserialize(t,c);i.push(p)}return new n(e,r,o,i)}},wt= 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(I),o=t.deserializeUleb128AsU32(),s=new Array;for(let i=0;i<o;i+=1){let a=ri(t);s.push(a)}return new n(e,r,s)}},_t= 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(),o;return r&&(o=St.deserialize(t)),new n(e,o)}},St= 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(it.deserialize(e))}};var W=class n extends d{constructor(e,r,o,s,i,a,c){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=i,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),o=e.deserializeU64(),s=Ne.deserialize(e),i=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=je.deserialize(e);return new n(r,o,s,i,a,c,p)}},un= exports.RawTransactionWithData =class extends d{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return de.load(t);case 1:return le.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},de= 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=W.deserialize(e),o=e.deserializeVector(u);return new n(r,o)}},le= exports.FeePayerRawTransaction =class n extends un{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}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=W.deserialize(e),o=e.deserializeVector(u),s=u.deserialize(e);return new n(r,o,s)}};var ne=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=W.deserialize(e),o=ue.deserialize(e);return new n(r,o)}};function _o(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function So(n){return!!n.match(/\s/)}function oi(n){return!!n.match(/^T[0-9]+$/)}function si(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!So(r))break}return e}var ii=(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))(ii||{}),_= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function xt(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _73 => _73.allowGenerics]), () => (!1)),r=[],o=[],s=[],i=0,a="",c=1;for(;i<n.length;){let p=n[i];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:s}),a="",s=[],c=1;else if(p===">"){if(a!==""){let Ie=pn(a,o,e);s.push(Ie)}let g=r.pop();if(g===void 0)throw new _(n,"unexpected '>'");if(c!==s.length)throw new _(n,"type argument count doesn't match expected amount");let{savedStr:C,savedTypes:A,savedExpectedTypes:l}=g;o=s,s=A,a=C,c=l}else if(p===","){if(a.length!==0){let g=pn(a,o,e);o=[],s.push(g),a="",c+=1}}else if(So(p)){let g=!1;if(a.length!==0){let A=pn(a,o,e);o=[],s.push(A),a="",g=!0}i=si(n,i);let C=n[i];if(i<n.length&&g&&C!==","&&C!==">")throw new _(n,"unexpected whitespace character");continue}else a+=p;i+=1}if(r.length>0)throw new _(n,"no matching '>' for '<'");switch(s.length){case 0:return pn(a,o,e);case 1:if(a==="")return s[0];throw new _(n,"unexpected ','");default:throw new _(n,"unexpected whitespace character")}}function pn(n,t,e){switch(n){case"&signer":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new cn(new ke);case"signer":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new ke;case"bool":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Xe;case"address":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new rt;case"u8":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Ye;case"u16":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Ze;case"u32":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new Je;case"u64":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new et;case"u128":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new tt;case"u256":if(t.length>0)throw new _(n,"primitive types not expected to have type arguments");return new nt;case"vector":if(t.length!==1)throw new _(n,"vector type expected to have exactly one type argument");return new st(t[0]);default:if(oi(n)){if(e)return new ot(Number(n.split("T")[1]));throw new _(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new _(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new _(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!_o(r[1]))throw new _(n,"module name must only contain alphanumeric or '_' characters");if(!_o(r[2]))throw new _(n,"struct name must only contain alphanumeric or '_' characters");return new Ce(new pe(u.fromString(r[0]),new v(r[1]),new v(r[2]),t))}}function xo(n){return typeof n=="boolean"}function at(n){return typeof n=="string"}function dn(n){return typeof n=="number"}function ln(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function vo(n){return n==null}function Co(n){return qn(n)||$n(n)||Ln(n)||Vn(n)||Hn(n)||Qn(n)||Wn(n)||gn(n)||Kn(n)||ai(n)||n instanceof b||n instanceof ye}function qn(n){return n instanceof P}function gn(n){return n instanceof u}function Kn(n){return n instanceof z}function ai(n){return n instanceof ze}function $n(n){return n instanceof R}function Ln(n){return n instanceof $}function Vn(n){return n instanceof L}function Hn(n){return n instanceof E}function Qn(n){return n instanceof V}function Wn(n){return n instanceof H}function jn(n){return"bytecode"in n}function S(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Po(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Xn(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}var ci=new TextEncoder;function Uo(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _74 => _74.map, 'call', _75 => _75(t=>at(t)?xt(t):t)]), () => ([]))}async function Io(n,t,e,r){let s=await _asyncOptionalChain([(await Jt({aptosConfig:r,accountAddress:n,moduleName:t})), 'access', async _76 => _76.abi, 'optionalAccess', async _77 => _77.exposed_functions, 'access', async _78 => _78.find, 'call', async _79 => _79(c=>c.name===e)]);if(!s)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let i=Po(s),a=[];for(let c=i;c<s.params.length;c+=1)a.push(xt(s.params[c],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:a}}function Eo(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let s=t.parameters[r];return ct(e,s,r,o)}function ct(n,t,e,r){return Co(n)?(Yn(t,n,e),n):ui(n,t,e,r)}function ui(n,t,e,r){if(t.isBool()){if(xo(n))return new P(n);S("boolean",e)}if(t.isAddress()){if(at(n))return u.fromString(n);S("string | AccountAddress",e)}if(t.isU8()){if(dn(n))return new R(n);S("number",e)}if(t.isU16()){if(dn(n))return new $(n);S("number",e)}if(t.isU32()){if(dn(n))return new L(n);S("number",e)}if(t.isU64()){if(ln(n))return new E(BigInt(n));S("bigint | number | string",e)}if(t.isU128()){if(ln(n))return new V(BigInt(n));S("bigint | number | string",e)}if(t.isU256()){if(ln(n))return new H(BigInt(n));S("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return ct(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(at(n))return b.U8(ci.encode(n));if(n instanceof Uint8Array)return b.U8(n);if(n instanceof ArrayBuffer)return b.U8(new Uint8Array(n))}if(Array.isArray(n))return new b(n.map(o=>ct(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(at(n))return new z(n);S("string",e)}if(t.isObject()){if(at(n))return u.fromString(n);S("string | AccountAddress",e)}if(t.isOption())return vo(n)?new ye(null):new ye(ct(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 Yn(n,t,e){if(n.isBool()){if(qn(t))return;S("Bool",e)}if(n.isAddress()){if(gn(t))return;S("AccountAddress",e)}if(n.isU8()){if($n(t))return;S("U8",e)}if(n.isU16()){if(Ln(t))return;S("U16",e)}if(n.isU32()){if(Vn(t))return;S("U32",e)}if(n.isU64()){if(Hn(t))return;S("U64",e)}if(n.isU128()){if(Qn(t))return;S("U128",e)}if(n.isU256()){if(Wn(t))return;S("U256",e)}if(n.isVector()){if(t instanceof b){t.values.length>0&&Yn(n.value,t.values[0],e);return}S("MoveVector",e)}if(n instanceof Ce){if(n.isString()){if(Kn(t))return;S("MoveString",e)}if(n.isObject()){if(gn(t))return;S("AccountAddress",e)}if(n.isOption()){if(t instanceof ye){t.value!==void 0&&Yn(n.value.typeArgs[0],t.value,e);return}S("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function yn(n){if(jn(n))return Ro(n);let{moduleAddress:t,moduleName:e,functionName:r}=Xn(n.function),o=await Ke(async()=>Io(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return di(n,o)}function di(n,t){if(jn(n))return Ro(n);let{moduleAddress:e,moduleName:r,functionName:o}=Xn(n.function),s=Uo(n.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let i=n.functionArguments.map((c,p)=>Eo(n.function,t,c,p,s));if(i.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${i.length}`);let a=it.build(`${e}::${r}`,o,s,i);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new bt(new _t(c,new St(a)))}return new Tt(a)}function Ro(n){return new ht(new wt(f.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function li(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=_optionalChain([o, 'optionalAccess', _80 => _80.accountSequenceNumber])!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):ee({aptosConfig:t,accountAddress:e}),i=Pn[t.network]?Promise.resolve({chain_id:Pn[t.network]}):jt({aptosConfig:t}),a=_optionalChain([o, 'optionalAccess', _81 => _81.gasUnitPrice])?Promise.resolve({gas_estimate:o.gasUnitPrice}):tn({aptosConfig:t}),[{sequence_number:c},{chain_id:p},{gas_estimate:g}]=await Promise.all([s,i,a]),{maxGasAmount:C,gasUnitPrice:A,expireTimestamp:l}={maxGasAmount:_optionalChain([o, 'optionalAccess', _82 => _82.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(Sr),gasUnitPrice:BigInt(g),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+xr),...o};return new W(u.from(e),BigInt(c),r,BigInt(C),BigInt(A),BigInt(l),new je(p))}async function Zn(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,s=await li({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let i=_nullishCoalesce(_optionalChain([n, 'access', _83 => _83.secondarySignerAddresses, 'optionalAccess', _84 => _84.map, 'call', _85 => _85(a=>u.from(a))]), () => ([]));return{rawTransaction:s,secondarySignerAddresses:i,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}function zo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,s=mn(t);if(e.feePayerAddress){let a=new le(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(C=>mn(C)));let p=mn(o),g=new Qe(s,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new ne(a.raw_txn,g).bcsToBytes()}if(e.secondarySignerAddresses){let a=new de(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(g=>mn(g));let p=new He(s,e.secondarySignerAddresses,c);return new ne(a.raw_txn,p).bcsToBytes()}let i;if(s instanceof ce)i=new Ve(s.public_key,s.signature);else if(s instanceof te)i=new We(s);else throw new Error("Invalid public key");return new ne(e.rawTransaction,i).bcsToBytes()}function mn(n){if(n instanceof x){if(n.publicKey instanceof w)return new te(n,new ae(new U(new Uint8Array(64))));if(n.publicKey instanceof Q)return new te(n,new ae(new _e(new Uint8Array(64))))}return new ce(new w(n.toUint8Array()),new U(new Uint8Array(64)))}function ko(n){let{signer:t,transaction:e}=n,r=Jn(e),o=t.sign(r);switch(t.signingScheme){case 0:return new ce(new w(t.publicKey.toUint8Array()),new U(o.toUint8Array()));case 2:if(!x.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new te(t.publicKey,new ae(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function No(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,s=Oo(t);if((r||o)&&(s instanceof de||s instanceof le))return gi(s,e,r,o);if(e instanceof ce&&s instanceof W){let i=new Ve(e.public_key,e.signature);return new ne(s,i).bcsToBytes()}if((e instanceof te||e instanceof Le)&&s instanceof W){let i=new We(e);return new ne(s,i).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Oo(n){return n.feePayerAddress?new le(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new de(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function gi(n,t,e,r){if(n instanceof le){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new Qe(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:e});return new ne(n.raw_txn,o).bcsToBytes()}if(n instanceof de){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new He(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new ne(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function Jn(n){let t=Oo(n),e=_sha3.sha3_256.create();if(t instanceof W)e.update(vr);else if(t instanceof de)e.update(Un);else if(t instanceof le)e.update(Un);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(r.length+o.length);return s.set(r),s.set(o,r.length),s}async function y(n){let t=await mi(n);return yi(n,t)}async function mi(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?(r=e,o=await yn(r)):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await yn(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await yn(r)),o}async function yi(n,t){let{aptosConfig:e,sender:r,options:o}=n,s;if(Ai(n)&&(s=u.ZERO.toString()),fi(n)){let{secondarySignerAddresses:i}=n;return Zn({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:i,feePayerAddress:s})}return Zn({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:s})}function Ai(n){return n.withFeePayer===!0}function fi(n){return"secondarySignerAddresses"in n}function Go(n){let{transaction:t}=n;return Jn(t)}function An(n){return ko({...n})}async function er(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}=n,a=zo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:i}),{data:c}=await De({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _86 => _86.options, 'optionalAccess', _87 => _87.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _88 => _88.options, 'optionalAccess', _89 => _89.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _90 => _90.options, 'optionalAccess', _91 => _91.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function fn(n){let{aptosConfig:t}=n,e=No({...n}),{data:r}=await De({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function vt(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=An({signer:e,transaction:r});return fn({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function Do(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:s}=n,i=o.map(c=>b.U8(c));return await y({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[b.U8(r),new b(i)]},options:s})}async function Mo(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await ee({aptosConfig:t,accountAddress:e.accountAddress}),s=Se.fromPrivateKey({privateKey:r,legacy:!0}),a=new sn({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),c=e.sign(a),p=s.sign(a),g=await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new R(e.signingScheme.valueOf()),b.U8(e.publicKey.toUint8Array()),new R(s.signingScheme.valueOf()),b.U8(s.publicKey.toUint8Array()),b.U8(c.toUint8Array()),b.U8(p.toUint8Array())]}});return await vt({aptosConfig:t,signer:e,transaction:g})}async function Bo(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:s,options:i}=n,a=_nullishCoalesce(s, () => (Ft));return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[a],functionArguments:[r,o]},options:i})}var Ct=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Bo({aptosConfig:this.config,...t})}};var Pe={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},q="0x4::token::Token";async function Fo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await m({aptosConfig:t,query:{query:eo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function qo(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await m({aptosConfig:t,query:{query:Nn,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Ko(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s={query:Nn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _92 => _92.offset]),limit:_optionalChain([r, 'optionalAccess', _93 => _93.limit]),order_by:_optionalChain([r, 'optionalAccess', _94 => _94.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function $o(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,o={token_data_id:{_eq:u.from(e).toStringLong()}},s={query:Jr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _95 => _95.offset]),limit:_optionalChain([r, 'optionalAccess', _96 => _96.limit]),order_by:_optionalChain([r, 'optionalAccess', _97 => _97.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getDigitalAssetActivity"})).token_activities_v2}async function Lo(n){let{aptosConfig:t,options:e,creator:r}=n;return await y({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new z(n.description),new E(_nullishCoalesce(n.maxSupply, () => (Ee))),new z(n.name),new z(n.uri),new P(_nullishCoalesce(n.mutableDescription, () => (!0))),new P(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new P(_nullishCoalesce(n.mutableURI, () => (!0))),new P(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new P(_nullishCoalesce(n.mutableTokenName, () => (!0))),new P(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new P(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new P(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new P(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new E(_nullishCoalesce(n.royaltyNumerator, () => (0))),new E(_nullishCoalesce(n.royaltyDenominator, () => (1)))]},options:e})}async function tr(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,s=u.from(e),i={collection_name:{_eq:r},creator_address:{_eq:s.toStringLong()}};return _optionalChain([o, 'optionalAccess', _98 => _98.tokenStandard])&&(i.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _99 => _99.tokenStandard]), () => ("v2"))}),(await m({aptosConfig:t,query:{query:Qr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Vo(n){return(await tr(n)).collection_id}async function Ho(n){let{aptosConfig:t,options:e,creator:r,collection:o,description:s,name:i,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:g}=n,C=_optionalChain([p, 'optionalAccess', _100 => _100.map, 'call', _101 => _101(l=>Pe[l])]);return await y({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[o,s,i,a,_nullishCoalesce(c, () => ([])),_nullishCoalesce(C, () => ([])),is(_nullishCoalesce(g, () => ([])),_nullishCoalesce(C, () => ([])))]},options:e})}async function Qo(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[r,o]},options:i})}async function Wo(n){let{aptosConfig:t,account:e,collection:r,description:o,name:s,uri:i,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:g,options:C}=n;if(_optionalChain([c, 'optionalAccess', _102 => _102.length])!==_optionalChain([g, 'optionalAccess', _103 => _103.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _104 => _104.length])!==_optionalChain([g, 'optionalAccess', _105 => _105.length]))throw new Error("Property types and property values counts do not match");let A=_optionalChain([p, 'optionalAccess', _106 => _106.map, 'call', _107 => _107(Ie=>Pe[Ie])]);return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,o,s,i,_nullishCoalesce(c, () => ([])),_nullishCoalesce(A, () => ([])),is(_nullishCoalesce(g, () => ([])),_nullishCoalesce(A, () => ([]))),a]},options:C})}async function jo(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(o, () => (q))],functionArguments:[r]},options:s})}async function Xo(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(o, () => (q))],functionArguments:[r]},options:s})}async function Yo(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:o,options:s}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(o, () => (q))],functionArguments:[r]},options:s})}async function Zo(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function Jo(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function es(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function ts(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (q))],functionArguments:[i,r,Pe[o],nr(s,Pe[o])]},options:c})}async function ns(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:o,digitalAssetType:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(s, () => (q))],functionArguments:[o,r]},options:i})}async function rs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (q))],functionArguments:[i,r,Pe[o],nr(s,Pe[o])]},options:c})}async function os(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (q)),Pe[o]],functionArguments:[i,r,s]},options:c})}async function ss(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:o,propertyValue:s,digitalAssetAddress:i,digitalAssetType:a,options:c}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (q)),Pe[o]],functionArguments:[i,r,s]},options:c})}function is(n,t){let e=new Array;return t.forEach((r,o)=>{e.push(nr(n[o],r))}),e}function nr(n,t){let e=xt(t);return ct(n,e,0,[]).bcsToBytes()}var Pt=class{constructor(t){this.config=t}async getCollectionData(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),tr({aptosConfig:this.config,...t})}async getCollectionId(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Vo({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Fo({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),qo({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),$o({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return Lo({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return Ho({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return Qo({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return Wo({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return jo({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return Xo({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return Yo({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return Zo({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return Jo({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return es({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return ts({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return ns({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return rs({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return os({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return ss({aptosConfig:this.config,...t})}};async function as(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,s={account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}};return hn({aptosConfig:e,options:{where:s}})}async function cs(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,a={where:{account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}},pagination:o,orderBy:_optionalChain([o, 'optionalAccess', _108 => _108.orderBy])};return hn({aptosConfig:e,options:a})}async function hn(n){let{aptosConfig:t,options:e}=n,r={query:Xr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _109 => _109.where]),offset:_optionalChain([e, 'optionalAccess', _110 => _110.offset]),limit:_optionalChain([e, 'optionalAccess', _111 => _111.limit]),order_by:_optionalChain([e, 'optionalAccess', _112 => _112.orderBy])}};return(await m({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var Ut=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),as({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await h({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),cs({aptosConfig:this.config,...t})}async getEvents(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _113 => _113.minimumLedgerVersion]),processorType:"events_processor"}),hn({aptosConfig:this.config,...t})}};async function us(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,s=_optionalChain([o, 'optionalAccess', _114 => _114.timeoutSecs])||Bt,{data:i}=await Ur({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=i.txn_hashes[0],c=await $e({aptosConfig:t,transactionHash:a,options:{timeoutSecs:s,checkSuccess:_optionalChain([o, 'optionalAccess', _115 => _115.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var It=class{constructor(t){this.config=t}async fundAccount(t){let e=await us({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _116 => _116.options, 'optionalAccess', _117 => _117.waitForIndexer])!==!1&&await rn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function rr(n){let{aptosConfig:t,options:e}=n,r={query:Zr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _118 => _118.where]),limit:_optionalChain([e, 'optionalAccess', _119 => _119.limit]),offset:_optionalChain([e, 'optionalAccess', _120 => _120.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function ps(n){let{aptosConfig:t,options:e}=n,r={query:Yr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _121 => _121.where]),limit:_optionalChain([e, 'optionalAccess', _122 => _122.limit]),offset:_optionalChain([e, 'optionalAccess', _123 => _123.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function ds(n){let{aptosConfig:t,options:e}=n,r={query:Wr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _124 => _124.where]),limit:_optionalChain([e, 'optionalAccess', _125 => _125.limit]),offset:_optionalChain([e, 'optionalAccess', _126 => _126.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function ls(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:s,options:i}=n;return await y({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,s]},options:i})}var Et=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _127 => _127.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),rr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _128 => _128.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await rr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _129 => _129.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ps({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _130 => _130.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ds({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return ls({aptosConfig:this.config,...t})}};var Rt=class{constructor(t){this.config=t}async getLedgerInfo(){return jt({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return to({aptosConfig:this.config,...t})}async getBlockByHeight(t){return no({aptosConfig:this.config,...t})}async getTableItem(t){return Xt({aptosConfig:this.config,...t})}async view(t){return xe({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return ro({aptosConfig:this.config,...t})}async queryIndexer(t){return m({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Yt({aptosConfig:this.config})}async getProcessorStatus(t){return Zt({aptosConfig:this.config,processorType:t})}};var gs=["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 ms(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ue(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(!ms(t))throw new Error(`${t} is not valid. ${gs}`);if(e&&!ms(e))throw new Error(`${e} is not valid. ${gs}`);return{domainName:e||t,subdomainName:e?t:void 0}}var hi="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Ti={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:hi,custom:null,devnet:null};function ge(n){let t=Ti[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var bi=n=>({vec:[n]}),wi=()=>({vec:[]}),or=n=>n!=null?bi(n):wi(),Tn=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function ys(n){let{aptosConfig:t,name:e}=n,r=ge(t),{domainName:o,subdomainName:s}=Ue(e),i=await xe({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,or(s)]}}),a=Tn(i[0]);return a?u.from(a).toString():void 0}async function As(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:s,toAddress:i,options:a,transferable:c}=n,p=ge(t),{domainName:g,subdomainName:C}=Ue(r),A=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(C&&!A)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(A&&!C)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let ur=_nullishCoalesce(e.years, () => (1));if(ur!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Rs=ur*31536e3;return await y({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[g,Rs,s,i]},options:a})}if(!C)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await sr({aptosConfig:t,name:g});if(!l)throw new Error("The domain does not exist");let Ie=e.policy==="subdomain:independent"?e.expirationDate:l;if(Ie>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await y({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[g,C,Math.round(Ie/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,s,i]},options:a})}async function sr(n){let{aptosConfig:t,name:e}=n,r=ge(t),{domainName:o,subdomainName:s}=Ue(e);try{let i=await xe({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,or(s)]}});return Number(i[0])*1e3}catch (e2){return}}async function fs(n){let{aptosConfig:t,address:e}=n,r=ge(t),o=await xe({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),s=Tn(o[1]),i=Tn(o[0]);if(s)return[i,s].filter(Boolean).join(".")}async function hs(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,s=ge(t);if(!r)return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:i,subdomainName:a}=Ue(r);return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[i,a]},options:o})}async function Ts(n){let{aptosConfig:t,name:e}=n,r=ge(t),{domainName:o,subdomainName:s}=Ue(e),i=await xe({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,or(s)]}}),a=Tn(i[0]);return a?u.from(a).toString():void 0}async function bs(n){let{aptosConfig:t,sender:e,name:r,address:o,options:s}=n,i=ge(t),{domainName:a,subdomainName:c}=Ue(r);return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_target_addr`,functionArguments:[a,c,o]},options:s})}async function ws(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Ue(e),a=(await m({aptosConfig:t,query:{query:qe,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=zt(a)),a}async function _s(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ir({aptosConfig:t});return(await m({aptosConfig:t,originMethod:"getAccountNames",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _131 => _131.limit]),offset:_optionalChain([e, 'optionalAccess', _132 => _132.offset]),order_by:_optionalChain([e, 'optionalAccess', _133 => _133.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _134 => _134.options, 'optionalAccess', _135 => _135.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(zt)}async function Ss(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ir({aptosConfig:t});return(await m({aptosConfig:t,originMethod:"getAccountDomains",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _136 => _136.limit]),offset:_optionalChain([e, 'optionalAccess', _137 => _137.offset]),order_by:_optionalChain([e, 'optionalAccess', _138 => _138.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _139 => _139.options, 'optionalAccess', _140 => _140.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(zt)}async function xs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ir({aptosConfig:t});return(await m({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _141 => _141.limit]),offset:_optionalChain([e, 'optionalAccess', _142 => _142.offset]),order_by:_optionalChain([e, 'optionalAccess', _143 => _143.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _144 => _144.options, 'optionalAccess', _145 => _145.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(zt)}async function vs(n){let{aptosConfig:t,options:e,domain:r}=n;return(await m({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:qe,variables:{limit:_optionalChain([e, 'optionalAccess', _146 => _146.limit]),offset:_optionalChain([e, 'optionalAccess', _147 => _147.offset]),order_by:_optionalChain([e, 'optionalAccess', _148 => _148.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _149 => _149.options, 'optionalAccess', _150 => _150.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(zt)}async function ir(n){let{aptosConfig:t}=n,e=ge(t),[r]=await xe({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function Cs(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:s}=n,i=ge(t),a=o*31536e3,{domainName:c,subdomainName:p}=Ue(r);if(p)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await y({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::renew_domain`,functionArguments:[c,a]},options:s})}function zt(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var kt=class{constructor(t){this.config=t}async getOwnerAddress(t){return ys({aptosConfig:this.config,...t})}async getExpiration(t){return sr({aptosConfig:this.config,...t})}async getTargetAddress(t){return Ts({aptosConfig:this.config,...t})}async setTargetAddress(t){return bs({aptosConfig:this.config,...t})}async getPrimaryName(t){return fs({aptosConfig:this.config,...t})}async setPrimaryName(t){return hs({aptosConfig:this.config,...t})}async registerName(t){return As({aptosConfig:this.config,...t})}async renewDomain(t){return Cs({aptosConfig:this.config,...t})}async getName(t){return ws({aptosConfig:this.config,...t})}async getAccountNames(t){return _s({aptosConfig:this.config,...t})}async getAccountDomains(t){return Ss({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return xs({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return vs({aptosConfig:this.config,...t})}};async function Ps(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),s=await m({aptosConfig:t,query:{query:zn,variables:{where_condition:{pool_address:{_eq:r}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function Us(n){let{aptosConfig:t,options:e}=n,r={query:zn,variables:{order_by:_optionalChain([e, 'optionalAccess', _151 => _151.orderBy])}};return(await m({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Is(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:jr,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await m({aptosConfig:t,query:o})).delegated_staking_activities}var Nt=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _152 => _152.minimumLedgerVersion]),processorType:"stake_processor"}),Ps({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _153 => _153.minimumLedgerVersion]),processorType:"stake_processor"}),Us({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await h({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _154 => _154.minimumLedgerVersion]),processorType:"stake_processor"}),Is({aptosConfig:this.config,...t})}};var bn=()=>Math.floor(Date.now()/1e3),wn= exports.AccountSequenceNumber =class{constructor(t,e,r,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await ve(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=bn();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await ve(this.sleepTime),bn()-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 ee({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await ee({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 ve(this.sleepTime);this.lock=!0;try{await this.update();let t=bn();for(;this.lastUncommintedNumber!==this.currentNumber;)bn()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await ve(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 ut=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _155 => _155.pendingDequeue, 'access', _156 => _156.shift, 'call', _157 => _157(), 'optionalAccess', _158 => _158.resolve, 'call', _159 => _159(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 pt("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},pt=class extends Error{};var Es="fulfilled",_n= exports.TransactionWorker =class{constructor(t,e,r=30,o=100,s=10){this.taskQueue=new ut;this.transactionsQueue=new ut;this.outstandingTransactions=new ut;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new wn(t,e,r,o,s)}async submitNextTransaction(){try{for(;;){if(this.transactionsQueue.isEmpty())return;let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let r=vt({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([r,t])}}catch(t){if(t instanceof pt)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[r,o]=await this.outstandingTransactions.dequeue();for(t.push(r),e.push(o);!this.outstandingTransactions.isEmpty();)[r,o]=await this.outstandingTransactions.dequeue(),t.push(r),e.push(o);let s=await Promise.allSettled(t);for(let i=0;i<s.length&&i<e.length;i+=1){let a=s[i];o=e[i],a.status===Es?(this.sentTransactions.push([a.value.hash,o,null]),await this.checkTransaction(a,o)):this.sentTransactions.push([a.status,o,a.reason])}}}catch(t){if(t instanceof pt)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let r=[];r.push($e({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(r);for(let s=0;s<o.length;s+=1){let i=o[s];i.status===Es?this.executedTransactions.push([i.value.hash,e,null]):this.executedTransactions.push([i.status,e,i.reason])}}catch(r){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${r}`)}}async push(t,e){await this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[r,o]=await this.transactionsQueue.dequeue();return await y({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:r,options:{...o,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}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 Sn=class{constructor(t){this.config=t}async simple(t){return y({aptosConfig:this.config,...t})}async multiAgent(t){return y({aptosConfig:this.config,...t})}};function ar(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}function cr(n,t,e){let r=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var dt=class{constructor(t){this.config=t}async simple(t){return er({aptosConfig:this.config,...t})}async multiAgent(t){return er({aptosConfig:this.config,...t})}};N([cr],dt.prototype,"simple",1),N([cr],dt.prototype,"multiAgent",1);var lt=class{constructor(t){this.config=t}async simple(t){return fn({aptosConfig:this.config,...t})}async multiAgent(t){return fn({aptosConfig:this.config,...t})}};N([ar],lt.prototype,"simple",1),N([ar],lt.prototype,"multiAgent",1);var Ot=class{constructor(t){this.config=t,this.build=new Sn(this.config),this.simulate=new dt(this.config),this.submit=new lt(this.config)}async getTransactions(t){return To({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return bo({aptosConfig:this.config,...t})}async getTransactionByHash(t){return nn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return wo({aptosConfig:this.config,...t})}async waitForTransaction(t){return $e({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return tn({aptosConfig:this.config})}getSigningMessage(t){return Go(t)}async publishPackageTransaction(t){return Do({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Mo({aptosConfig:this.config,...t})}sign(t){return An({...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,An({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t,s=new _n(this.config,e);s.start();for(let i of r)await s.push(i,o)}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return vt({aptosConfig:this.config,signer:e,transaction:r})}};var K=class{constructor(t){this.config=new on(t),this.account=new At(this.config),this.ans=new kt(this.config),this.coin=new Ct(this.config),this.digitalAsset=new Pt(this.config),this.event=new Ut(this.config),this.faucet=new It(this.config),this.fungibleAsset=new Et(this.config),this.general=new Rt(this.config),this.staking=new Nt(this.config),this.transaction=new Ot(this.config)}};function re(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...s){return this[e][r](...s)},Object.defineProperty(n.prototype,r,o))})}re(K,At,"account");re(K,kt,"ans");re(K,Ct,"coin");re(K,Pt,"digitalAsset");re(K,Ut,"event");re(K,It,"faucet");re(K,Et,"fungibleAsset");re(K,Rt,"general");re(K,Nt,"staking");re(K,Ot,"transaction");exports.APTOS_BIP44_REGEX = Ws; exports.APTOS_COIN = Ft; exports.APTOS_HARDENED_REGEX = Qs; exports.Account = Se; exports.AccountAddress = u; exports.AccountAuthenticator = G; exports.AccountAuthenticatorEd25519 = ce; exports.AccountAuthenticatorMultiEd25519 = an; exports.AccountAuthenticatorMultiKey = Le; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = yr; exports.AccountSequenceNumber = wn; exports.AddressInvalidReason = Ls; exports.AnyPublicKey = x; exports.AnyPublicKeyVariant = Ar; exports.AnySignature = ae; exports.AnySignatureVariant = fr; exports.Aptos = K; exports.AptosApiError = oe; exports.AptosApiType = Mt; exports.AptosConfig = on; exports.AuthenticationKey = J; exports.Bool = P; exports.CKDPriv = Or; exports.ChainId = je; exports.DEFAULT_MAX_GAS_AMOUNT = Sr; exports.DEFAULT_NETWORK = _r; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = xr; exports.DEFAULT_TXN_TIMEOUT_SEC = Bt; exports.DeriveScheme = Ds; exports.Deserializer = Er; exports.Ed25519PrivateKey = he; exports.Ed25519PublicKey = w; exports.Ed25519Signature = U; exports.EntryFunction = it; exports.EntryFunctionBytes = Lt; exports.FeePayerRawTransaction = le; exports.FixedBytes = ze; exports.HARDENED_OFFSET = zr; exports.Hex = f; exports.HexInvalidReason = qs; exports.Identifier = v; exports.KeyType = js; exports.MimeType = xn; exports.ModuleId = ft; exports.MoveAbility = Os; exports.MoveFunctionVisibility = Ns; exports.MoveOption = ye; exports.MoveString = z; exports.MoveVector = b; exports.MultiAgentRawTransaction = de; exports.MultiEd25519PublicKey = Y; exports.MultiEd25519Signature = Be; exports.MultiKey = Fe; exports.MultiSig = _t; exports.MultiSigTransactionPayload = St; exports.Network = Dt; exports.NetworkToChainId = Pn; exports.NetworkToFaucetAPI = wr; exports.NetworkToIndexerAPI = Cn; exports.NetworkToNetworkName = Xi; exports.NetworkToNodeAPI = br; exports.ParsingError = O; exports.PrivateKey = Me; exports.ProcessorType = Oe; exports.PublicKey = M; exports.RAW_TRANSACTION_SALT = vr; exports.RAW_TRANSACTION_WITH_DATA_SALT = Un; exports.RawTransaction = W; exports.RawTransactionWithData = un; exports.RoleType = Gs; exports.RotationProofChallenge = sn; exports.Script = wt; exports.ScriptTransactionArgumentVariants = gt; exports.Secp256k1PrivateKey = we; exports.Secp256k1PublicKey = Q; exports.Secp256k1Signature = _e; exports.Serializable = d; exports.Serializer = j; exports.Signature = X; exports.SignedTransaction = ne; exports.SigningScheme = mt; exports.SigningSchemeInput = hr; exports.StructTag = pe; exports.TransactionAuthenticator = ue; exports.TransactionAuthenticatorEd25519 = Ve; exports.TransactionAuthenticatorFeePayer = Qe; exports.TransactionAuthenticatorMultiAgent = He; exports.TransactionAuthenticatorMultiEd25519 = Fn; exports.TransactionAuthenticatorSingleSender = We; exports.TransactionAuthenticatorVariant = mr; exports.TransactionPayload = Ne; exports.TransactionPayloadEntryFunction = Tt; exports.TransactionPayloadMultiSig = bt; exports.TransactionPayloadScript = ht; exports.TransactionPayloadVariants = lr; exports.TransactionResponseType = vn; exports.TransactionVariants = gr; exports.TransactionWorker = _n; exports.TypeTag = I; exports.TypeTagAddress = rt; exports.TypeTagBool = Xe; exports.TypeTagGeneric = ot; exports.TypeTagParserError = _; exports.TypeTagParserErrorType = ii; exports.TypeTagReference = cn; exports.TypeTagSigner = ke; exports.TypeTagStruct = Ce; exports.TypeTagU128 = tt; exports.TypeTagU16 = Ze; exports.TypeTagU256 = nt; exports.TypeTagU32 = Je; exports.TypeTagU64 = et; exports.TypeTagU8 = Ye; exports.TypeTagVariants = dr; exports.TypeTagVector = st; exports.U128 = V; exports.U16 = $; exports.U256 = H; exports.U32 = L; exports.U64 = E; exports.U8 = R; exports.aptosCoinStructTag = fd; exports.aptosRequest = Gt; exports.buildTransaction = Zn; exports.checkOrConvertArgument = ct; exports.convertArgument = Eo; exports.deriveKey = Rn; exports.deriveTransactionType = Oo; exports.deserializeFromScriptArgument = ri; exports.ensureBoolean = En; exports.fetchEntryFunctionAbi = Io; exports.findFirstNonSignerArg = Po; exports.generateMultiSignersSignedTransaction = gi; exports.generateRawTransaction = li; exports.generateSignedTransaction = No; exports.generateSignedTransactionForSimulation = zo; exports.generateSigningMessage = Jn; exports.generateTransactionPayload = yn; exports.generateTransactionPayloadWithABI = di; exports.get = Cr; exports.getAptosFullNode = D; exports.getAuthenticatorForSimulation = mn; exports.getFunctionParts = Xn; exports.isBcsAddress = gn; exports.isBcsBool = qn; exports.isBcsFixedBytes = ai; exports.isBcsString = Kn; exports.isBcsU128 = Qn; exports.isBcsU16 = Ln; exports.isBcsU256 = Wn; exports.isBcsU32 = Vn; exports.isBcsU64 = Hn; exports.isBcsU8 = $n; exports.isBlockMetadataTransactionResponse = Ri; exports.isBool = xo; exports.isEd25519Signature = ki; exports.isEncodedEntryFunctionArgument = Co; exports.isFeePayerSignature = Gi; exports.isGenesisTransactionResponse = Ei; exports.isLargeNumber = ln; exports.isMultiAgentSignature = Oi; exports.isMultiEd25519Signature = Di; exports.isNull = vo; exports.isNumber = dn; exports.isPendingTransactionResponse = Ui; exports.isScriptDataInput = jn; exports.isSecp256k1Signature = Ni; exports.isStateCheckpointTransactionResponse = zi; exports.isString = at; exports.isUserTransactionResponse = Ii; exports.isValidBIP44Path = kr; exports.isValidHardenedPath = Nr; exports.mnemonicToSeed = Vt; exports.objectStructTag = bd; exports.optionStructTag = Td; exports.outOfRangeErrorMessage = Ks; exports.paginateWithCursor = Ge; exports.parseTypeTag = xt; exports.post = In; exports.postAptosFaucet = Ur; exports.postAptosFullNode = De; exports.postAptosIndexer = Pr; exports.request = Ms; exports.sign = ko; exports.splitPath = Gr; exports.standardizeTypeTags = Uo; exports.stringStructTag = hd; exports.throwTypeMismatch = S; exports.validateNumberInRange = me;
427
427
  //# sourceMappingURL=index.js.map