@aptos-labs/ts-sdk 0.0.8 → 1.0.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 (229) hide show
  1. package/README.md +14 -14
  2. package/dist/browser/index.d.ts +20 -0
  3. package/dist/browser/index.global.js +24 -24
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +20 -0
  6. package/dist/common/index.js +23 -23
  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.d.mts +22 -2
  13. package/dist/esm/api/digitalAsset.mjs +1 -1
  14. package/dist/esm/api/event.mjs +1 -1
  15. package/dist/esm/api/faucet.mjs +1 -1
  16. package/dist/esm/api/fungibleAsset.mjs +1 -1
  17. package/dist/esm/api/general.mjs +1 -1
  18. package/dist/esm/api/index.mjs +1 -1
  19. package/dist/esm/api/staking.mjs +1 -1
  20. package/dist/esm/api/transaction.mjs +1 -1
  21. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  22. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  23. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  24. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  25. package/dist/esm/api/transactionSubmission.mjs +1 -1
  26. package/dist/esm/api/utils.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-26GRNGPL.mjs +2 -0
  34. package/dist/esm/chunk-26GRNGPL.mjs.map +1 -0
  35. package/dist/esm/{chunk-5UY5OKXR.mjs → chunk-2AMFCGJ3.mjs} +2 -2
  36. package/dist/esm/{chunk-UWXDXOFK.mjs → chunk-2X3FRUKX.mjs} +2 -2
  37. package/dist/esm/{chunk-VQ7LYNMD.mjs → chunk-32A35CPU.mjs} +2 -2
  38. package/dist/esm/{chunk-CJPCOS4R.mjs → chunk-3QS3MFWJ.mjs} +2 -2
  39. package/dist/esm/chunk-4FDIPWVB.mjs +2 -0
  40. package/dist/esm/chunk-4FDIPWVB.mjs.map +1 -0
  41. package/dist/esm/{chunk-AZUWHKN5.mjs → chunk-4K252UDE.mjs} +2 -2
  42. package/dist/esm/{chunk-RLG3WOTH.mjs → chunk-4XQ5IV6C.mjs} +2 -2
  43. package/dist/esm/{chunk-UW6HQ643.mjs → chunk-5HZKDT5C.mjs} +2 -2
  44. package/dist/esm/{chunk-OT2UDMUU.mjs → chunk-5IVRKK5V.mjs} +2 -2
  45. package/dist/esm/{chunk-SRGPSANH.mjs → chunk-5SRMD5C6.mjs} +2 -2
  46. package/dist/esm/{chunk-SO6EE5DX.mjs → chunk-5X46HDCI.mjs} +2 -2
  47. package/dist/esm/{chunk-73VWOS4Z.mjs → chunk-6DYNAFAP.mjs} +2 -2
  48. package/dist/esm/{chunk-HTI5LEST.mjs → chunk-6F4ACCCZ.mjs} +2 -2
  49. package/dist/esm/{chunk-53DS6NBQ.mjs → chunk-7B3VSBCX.mjs} +2 -2
  50. package/dist/esm/{chunk-CLJLQXFQ.mjs → chunk-7IY2Y73Q.mjs} +2 -2
  51. package/dist/esm/{chunk-F7EWDYTE.mjs → chunk-7QJYTQSU.mjs} +2 -2
  52. package/dist/esm/{chunk-KNMWDGP4.mjs → chunk-BA4TDBYB.mjs} +2 -2
  53. package/dist/esm/{chunk-Y6PVFMBS.mjs → chunk-BDTDWLGO.mjs} +2 -2
  54. package/dist/esm/chunk-C3Y52GHM.mjs +2 -0
  55. package/dist/esm/chunk-C3Y52GHM.mjs.map +1 -0
  56. package/dist/esm/{chunk-OBOOY2QD.mjs → chunk-CBAVJ5EN.mjs} +2 -2
  57. package/dist/esm/{chunk-GMG4VR3K.mjs → chunk-DBJTMCAG.mjs} +2 -2
  58. package/dist/esm/{chunk-OZZDXS26.mjs → chunk-DYJVDOBH.mjs} +2 -2
  59. package/dist/esm/chunk-EHJEK7FU.mjs +2 -0
  60. package/dist/esm/{chunk-TZ623H2V.mjs → chunk-ELWWME6B.mjs} +2 -2
  61. package/dist/esm/{chunk-PL2VA73L.mjs → chunk-F2GFSFPW.mjs} +2 -2
  62. package/dist/esm/{chunk-GXPGRCSW.mjs → chunk-F52GIFKT.mjs} +2 -2
  63. package/dist/esm/{chunk-QNTV5NMH.mjs → chunk-FGTQT7Q5.mjs} +2 -2
  64. package/dist/esm/{chunk-MWAMLQ25.mjs → chunk-GMOHGD73.mjs} +2 -2
  65. package/dist/esm/{chunk-RCM3K5JL.mjs → chunk-GQI3HWOB.mjs} +2 -2
  66. package/dist/esm/{chunk-2SAKPC5Q.mjs → chunk-HQ4DGB7L.mjs} +2 -2
  67. package/dist/esm/{chunk-F6K26WV5.mjs → chunk-IU5JZNH4.mjs} +2 -2
  68. package/dist/esm/{chunk-HC5VMNXA.mjs → chunk-KR5JAN32.mjs} +2 -2
  69. package/dist/esm/{chunk-5OPOJ43H.mjs → chunk-KVJ2KGMW.mjs} +2 -2
  70. package/dist/esm/{chunk-APSQ4M23.mjs → chunk-LBNMY7EM.mjs} +2 -2
  71. package/dist/esm/{chunk-GIZLK7M7.mjs → chunk-MNFGMNYS.mjs} +2 -2
  72. package/dist/esm/{chunk-WTGGCH34.mjs → chunk-N25GOEVL.mjs} +2 -2
  73. package/dist/esm/{chunk-XX2Z26FH.mjs → chunk-NBSXZKMQ.mjs} +2 -2
  74. package/dist/esm/{chunk-JI2BBZ2W.mjs → chunk-NFGAZSSK.mjs} +2 -2
  75. package/dist/esm/{chunk-CU2DINU4.mjs → chunk-NLONZHYT.mjs} +2 -2
  76. package/dist/esm/{chunk-FZ56IS3E.mjs → chunk-NMFS5KAE.mjs} +2 -2
  77. package/dist/esm/{chunk-ZFK7QD3B.mjs → chunk-NZ36UN4C.mjs} +2 -2
  78. package/dist/esm/{chunk-KZSJ5MFF.mjs → chunk-OWP2MKTX.mjs} +2 -2
  79. package/dist/esm/{chunk-QCBIJCU4.mjs → chunk-OXO3Z2MF.mjs} +2 -2
  80. package/dist/esm/{chunk-CL5B2QNS.mjs → chunk-PANYJULW.mjs} +2 -2
  81. package/dist/esm/{chunk-P5747ZYC.mjs → chunk-PEBXSNMJ.mjs} +2 -2
  82. package/dist/esm/{chunk-QEXAMHPU.mjs → chunk-PLY7MQKE.mjs} +2 -2
  83. package/dist/esm/{chunk-XMUUI6HG.mjs → chunk-PRKZ2KJ4.mjs} +2 -2
  84. package/dist/esm/{chunk-SSJQOXEP.mjs → chunk-PZ5JKQSP.mjs} +2 -2
  85. package/dist/esm/{chunk-NZSGGL25.mjs → chunk-Q3R3KKKP.mjs} +2 -2
  86. package/dist/esm/{chunk-3F5WV6US.mjs → chunk-RCYWJZR4.mjs} +2 -2
  87. package/dist/esm/chunk-TNUGIBLO.mjs +2 -0
  88. package/dist/esm/chunk-TNUGIBLO.mjs.map +1 -0
  89. package/dist/esm/{chunk-2YQXX64E.mjs → chunk-TTICPGX6.mjs} +2 -2
  90. package/dist/esm/{chunk-KKER5KL4.mjs → chunk-UES76WF2.mjs} +2 -2
  91. package/dist/esm/{chunk-G36AY4R7.mjs → chunk-UR5E2UDO.mjs} +2 -2
  92. package/dist/esm/{chunk-XITLXPBK.mjs → chunk-VMCFN5CT.mjs} +2 -2
  93. package/dist/esm/{chunk-EFRFDFS4.mjs → chunk-W44E6YAW.mjs} +2 -2
  94. package/dist/esm/chunk-W4JEP5GW.mjs +2 -0
  95. package/dist/esm/{chunk-SDPICQ5B.mjs.map → chunk-W4JEP5GW.mjs.map} +1 -1
  96. package/dist/esm/{chunk-5ZVCSKFX.mjs → chunk-WXISFVRU.mjs} +2 -2
  97. package/dist/esm/{chunk-GEZSEAL5.mjs → chunk-X7QBDRQR.mjs} +2 -2
  98. package/dist/esm/{chunk-CCXMVVXD.mjs → chunk-XKINEFAA.mjs} +2 -2
  99. package/dist/esm/chunk-XKINEFAA.mjs.map +1 -0
  100. package/dist/esm/{chunk-SGTFMSOG.mjs → chunk-Y5RQOXZH.mjs} +2 -2
  101. package/dist/esm/{chunk-ZJUDDSWN.mjs → chunk-ZKFDLJ2F.mjs} +2 -2
  102. package/dist/esm/client/core.mjs +1 -1
  103. package/dist/esm/client/get.mjs +1 -1
  104. package/dist/esm/client/index.mjs +1 -1
  105. package/dist/esm/client/post.mjs +1 -1
  106. package/dist/esm/core/account.mjs +1 -1
  107. package/dist/esm/core/accountAddress.mjs +1 -1
  108. package/dist/esm/core/authenticationKey.mjs +1 -1
  109. package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
  110. package/dist/esm/core/crypto/anySignature.mjs +1 -1
  111. package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
  112. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  113. package/dist/esm/core/crypto/index.mjs +1 -1
  114. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  115. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  116. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  117. package/dist/esm/core/index.mjs +1 -1
  118. package/dist/esm/index.mjs +1 -1
  119. package/dist/esm/internal/account.mjs +1 -1
  120. package/dist/esm/internal/ans.mjs +1 -1
  121. package/dist/esm/internal/coin.mjs +1 -1
  122. package/dist/esm/internal/digitalAsset.d.mts +11 -3
  123. package/dist/esm/internal/digitalAsset.mjs +1 -1
  124. package/dist/esm/internal/event.mjs +1 -1
  125. package/dist/esm/internal/faucet.mjs +1 -1
  126. package/dist/esm/internal/fungibleAsset.d.mts +10 -3
  127. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  128. package/dist/esm/internal/general.mjs +1 -1
  129. package/dist/esm/internal/staking.mjs +1 -1
  130. package/dist/esm/internal/transaction.mjs +1 -1
  131. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  132. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  133. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  134. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  135. package/dist/esm/transactions/index.mjs +1 -1
  136. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  137. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  138. package/dist/esm/transactions/instances/index.mjs +1 -1
  139. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  140. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  141. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  142. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  143. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  144. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  145. package/dist/esm/transactions/management/index.mjs +1 -1
  146. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  147. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  148. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  149. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  150. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  151. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  152. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  153. package/dist/esm/version.d.mts +1 -1
  154. package/dist/esm/version.mjs +1 -1
  155. package/package.json +1 -1
  156. package/src/api/digitalAsset.ts +26 -1
  157. package/src/internal/digitalAsset.ts +24 -0
  158. package/src/internal/fungibleAsset.ts +2 -2
  159. package/src/transactions/transactionBuilder/remoteAbi.ts +13 -5
  160. package/src/transactions/typeTag/index.ts +1 -0
  161. package/src/version.ts +1 -1
  162. package/dist/esm/chunk-5CUNY7X2.mjs +0 -2
  163. package/dist/esm/chunk-5CUNY7X2.mjs.map +0 -1
  164. package/dist/esm/chunk-CCXMVVXD.mjs.map +0 -1
  165. package/dist/esm/chunk-IELTCGLP.mjs +0 -2
  166. package/dist/esm/chunk-IELTCGLP.mjs.map +0 -1
  167. package/dist/esm/chunk-PXTMLJKO.mjs +0 -2
  168. package/dist/esm/chunk-SDPICQ5B.mjs +0 -2
  169. package/dist/esm/chunk-UKSA4H2O.mjs +0 -2
  170. package/dist/esm/chunk-UKSA4H2O.mjs.map +0 -1
  171. package/dist/esm/chunk-YN6UIVFB.mjs +0 -2
  172. package/dist/esm/chunk-YN6UIVFB.mjs.map +0 -1
  173. /package/dist/esm/{chunk-5UY5OKXR.mjs.map → chunk-2AMFCGJ3.mjs.map} +0 -0
  174. /package/dist/esm/{chunk-UWXDXOFK.mjs.map → chunk-2X3FRUKX.mjs.map} +0 -0
  175. /package/dist/esm/{chunk-VQ7LYNMD.mjs.map → chunk-32A35CPU.mjs.map} +0 -0
  176. /package/dist/esm/{chunk-CJPCOS4R.mjs.map → chunk-3QS3MFWJ.mjs.map} +0 -0
  177. /package/dist/esm/{chunk-AZUWHKN5.mjs.map → chunk-4K252UDE.mjs.map} +0 -0
  178. /package/dist/esm/{chunk-RLG3WOTH.mjs.map → chunk-4XQ5IV6C.mjs.map} +0 -0
  179. /package/dist/esm/{chunk-UW6HQ643.mjs.map → chunk-5HZKDT5C.mjs.map} +0 -0
  180. /package/dist/esm/{chunk-OT2UDMUU.mjs.map → chunk-5IVRKK5V.mjs.map} +0 -0
  181. /package/dist/esm/{chunk-SRGPSANH.mjs.map → chunk-5SRMD5C6.mjs.map} +0 -0
  182. /package/dist/esm/{chunk-SO6EE5DX.mjs.map → chunk-5X46HDCI.mjs.map} +0 -0
  183. /package/dist/esm/{chunk-73VWOS4Z.mjs.map → chunk-6DYNAFAP.mjs.map} +0 -0
  184. /package/dist/esm/{chunk-HTI5LEST.mjs.map → chunk-6F4ACCCZ.mjs.map} +0 -0
  185. /package/dist/esm/{chunk-53DS6NBQ.mjs.map → chunk-7B3VSBCX.mjs.map} +0 -0
  186. /package/dist/esm/{chunk-CLJLQXFQ.mjs.map → chunk-7IY2Y73Q.mjs.map} +0 -0
  187. /package/dist/esm/{chunk-F7EWDYTE.mjs.map → chunk-7QJYTQSU.mjs.map} +0 -0
  188. /package/dist/esm/{chunk-KNMWDGP4.mjs.map → chunk-BA4TDBYB.mjs.map} +0 -0
  189. /package/dist/esm/{chunk-Y6PVFMBS.mjs.map → chunk-BDTDWLGO.mjs.map} +0 -0
  190. /package/dist/esm/{chunk-OBOOY2QD.mjs.map → chunk-CBAVJ5EN.mjs.map} +0 -0
  191. /package/dist/esm/{chunk-GMG4VR3K.mjs.map → chunk-DBJTMCAG.mjs.map} +0 -0
  192. /package/dist/esm/{chunk-OZZDXS26.mjs.map → chunk-DYJVDOBH.mjs.map} +0 -0
  193. /package/dist/esm/{chunk-PXTMLJKO.mjs.map → chunk-EHJEK7FU.mjs.map} +0 -0
  194. /package/dist/esm/{chunk-TZ623H2V.mjs.map → chunk-ELWWME6B.mjs.map} +0 -0
  195. /package/dist/esm/{chunk-PL2VA73L.mjs.map → chunk-F2GFSFPW.mjs.map} +0 -0
  196. /package/dist/esm/{chunk-GXPGRCSW.mjs.map → chunk-F52GIFKT.mjs.map} +0 -0
  197. /package/dist/esm/{chunk-QNTV5NMH.mjs.map → chunk-FGTQT7Q5.mjs.map} +0 -0
  198. /package/dist/esm/{chunk-MWAMLQ25.mjs.map → chunk-GMOHGD73.mjs.map} +0 -0
  199. /package/dist/esm/{chunk-RCM3K5JL.mjs.map → chunk-GQI3HWOB.mjs.map} +0 -0
  200. /package/dist/esm/{chunk-2SAKPC5Q.mjs.map → chunk-HQ4DGB7L.mjs.map} +0 -0
  201. /package/dist/esm/{chunk-F6K26WV5.mjs.map → chunk-IU5JZNH4.mjs.map} +0 -0
  202. /package/dist/esm/{chunk-HC5VMNXA.mjs.map → chunk-KR5JAN32.mjs.map} +0 -0
  203. /package/dist/esm/{chunk-5OPOJ43H.mjs.map → chunk-KVJ2KGMW.mjs.map} +0 -0
  204. /package/dist/esm/{chunk-APSQ4M23.mjs.map → chunk-LBNMY7EM.mjs.map} +0 -0
  205. /package/dist/esm/{chunk-GIZLK7M7.mjs.map → chunk-MNFGMNYS.mjs.map} +0 -0
  206. /package/dist/esm/{chunk-WTGGCH34.mjs.map → chunk-N25GOEVL.mjs.map} +0 -0
  207. /package/dist/esm/{chunk-XX2Z26FH.mjs.map → chunk-NBSXZKMQ.mjs.map} +0 -0
  208. /package/dist/esm/{chunk-JI2BBZ2W.mjs.map → chunk-NFGAZSSK.mjs.map} +0 -0
  209. /package/dist/esm/{chunk-CU2DINU4.mjs.map → chunk-NLONZHYT.mjs.map} +0 -0
  210. /package/dist/esm/{chunk-FZ56IS3E.mjs.map → chunk-NMFS5KAE.mjs.map} +0 -0
  211. /package/dist/esm/{chunk-ZFK7QD3B.mjs.map → chunk-NZ36UN4C.mjs.map} +0 -0
  212. /package/dist/esm/{chunk-KZSJ5MFF.mjs.map → chunk-OWP2MKTX.mjs.map} +0 -0
  213. /package/dist/esm/{chunk-QCBIJCU4.mjs.map → chunk-OXO3Z2MF.mjs.map} +0 -0
  214. /package/dist/esm/{chunk-CL5B2QNS.mjs.map → chunk-PANYJULW.mjs.map} +0 -0
  215. /package/dist/esm/{chunk-P5747ZYC.mjs.map → chunk-PEBXSNMJ.mjs.map} +0 -0
  216. /package/dist/esm/{chunk-QEXAMHPU.mjs.map → chunk-PLY7MQKE.mjs.map} +0 -0
  217. /package/dist/esm/{chunk-XMUUI6HG.mjs.map → chunk-PRKZ2KJ4.mjs.map} +0 -0
  218. /package/dist/esm/{chunk-SSJQOXEP.mjs.map → chunk-PZ5JKQSP.mjs.map} +0 -0
  219. /package/dist/esm/{chunk-NZSGGL25.mjs.map → chunk-Q3R3KKKP.mjs.map} +0 -0
  220. /package/dist/esm/{chunk-3F5WV6US.mjs.map → chunk-RCYWJZR4.mjs.map} +0 -0
  221. /package/dist/esm/{chunk-2YQXX64E.mjs.map → chunk-TTICPGX6.mjs.map} +0 -0
  222. /package/dist/esm/{chunk-KKER5KL4.mjs.map → chunk-UES76WF2.mjs.map} +0 -0
  223. /package/dist/esm/{chunk-G36AY4R7.mjs.map → chunk-UR5E2UDO.mjs.map} +0 -0
  224. /package/dist/esm/{chunk-XITLXPBK.mjs.map → chunk-VMCFN5CT.mjs.map} +0 -0
  225. /package/dist/esm/{chunk-EFRFDFS4.mjs.map → chunk-W44E6YAW.mjs.map} +0 -0
  226. /package/dist/esm/{chunk-5ZVCSKFX.mjs.map → chunk-WXISFVRU.mjs.map} +0 -0
  227. /package/dist/esm/{chunk-GEZSEAL5.mjs.map → chunk-X7QBDRQR.mjs.map} +0 -0
  228. /package/dist/esm/{chunk-SGTFMSOG.mjs.map → chunk-Y5RQOXZH.mjs.map} +0 -0
  229. /package/dist/esm/{chunk-ZJUDDSWN.mjs.map → chunk-ZKFDLJ2F.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 Ai=Object.defineProperty;var hi=Object.getOwnPropertyDescriptor;var G=(n,t,e,r)=>{for(var o=r>1?void 0:r?hi(t,e):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(t,e,o):s(o))||o);return r&&o&&Ai(t,e,o),o};var re=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 cr="0.0.8";var xn=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(xn||{}),ur= exports.TypeTagVariants =(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g[g.Reference=254]="Reference",g[g.Generic=255]="Generic",g))(ur||{}),pt= exports.ScriptTransactionArgumentVariants =(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d))(pt||{}),dr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(dr||{}),pr= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(pr||{}),lr= exports.TransactionAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.SingleSender=4]="SingleSender",i))(lr||{}),gr= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(gr||{}),mr= exports.AnyPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(mr||{}),yr= exports.AnySignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(yr||{}),vn= exports.TransactionResponseType =(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(vn||{});function gs(n){return n.type==="pending_transaction"}function ms(n){return n.type==="user_transaction"}function ys(n){return n.type==="genesis_transaction"}function fs(n){return n.type==="block_metadata_transaction"}function As(n){return n.type==="state_checkpoint_transaction"}function hs(n){return"signature"in n&&n.signature==="ed25519_signature"}function Ts(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function bs(n){return n.type==="multi_agent_signature"}function ws(n){return n.type==="fee_payer_signature"}function _s(n){return n.type==="multi_ed25519_signature"}var Ti=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Ti||{}),bi= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(bi||{}),wi= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(wi||{}),lt= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(lt||{}),fr= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(fr||{}),_i= exports.DeriveScheme =(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(_i||{});var Ar={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 Si(n,t){let{url:e,method:r,body:o,contentType:i,params:s,overrides:a}=n,c={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-ts-sdk/${cr}`,"content-type":_nullishCoalesce(i, () => ("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:s,headers:c,overrides:a})}async function Gt(n,t){let{url:e,path:r}=n,o=`${e}/${_nullishCoalesce(r, () => (""))}`,i=await Si({...n,url:o},t.client),s={status:i.status,statusText:i.statusText,data:i.data,headers:i.headers,config:i.config,request:i.request,url:o};if(t.isIndexerRequest(e)){let c=s.data;if(c.errors)throw new re(n,s,_nullishCoalesce(c.errors[0].message, () => (`Unhandled Error ${i.status} : ${i.statusText}`)));s.data=c.data}if(s.status>=200&&s.status<300)return s;let a;throw s&&s.data&&"message"in s.data&&"error_code"in s.data?a=JSON.stringify(s.data):s.status in Ar?a=Ar[s.status]:a=`Unhandled Error ${s.status} : ${s.statusText}`,new re(n,s,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"},hr= 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"},Tr= 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"},Bt= exports.Network =(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Bt||{}),Pn= exports.NetworkToChainId ={mainnet:1,testnet:2},Os= 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||{}),br= exports.DEFAULT_NETWORK ="devnet",wr= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,_r= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Dt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ft= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Sr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Un= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",ze= exports.ProcessorType =(d=>(d.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",d.COIN_PROCESSOR="coin_processor",d.DEFAULT="default_processor",d.EVENTS_PROCESSOR="events_processor",d.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",d.STAKE_PROCESSOR="stake_processor",d.TOKEN_PROCESSOR="token_processor",d.TOKEN_V2_PROCESSOR="token_v2_processor",d.USER_TRANSACTION_PROCESSOR="user_transaction_processor",d))(ze||{});async function xr(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:c}=n,d=t.getRequestUrl(c);return Gt({url:d,method:"GET",originMethod:a,path:s,contentType:_optionalChain([o, 'optionalAccess', _7 => _7.valueOf, 'call', _8 => _8()]),acceptType:_optionalChain([i, 'optionalAccess', _9 => _9.valueOf, 'call', _10 => _10()]),params:r,overrides:{...t.clientConfig,...e}},t)}async function D(n){return xr({...n,type:0})}async function Oe(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await xr({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 En(n){let{type:t,originMethod:e,path:r,body:o,acceptType:i,contentType:s,params:a,aptosConfig:c,overrides:d}=n,f=c.getRequestUrl(t);return Gt({url:f,method:"POST",originMethod:e,path:r,body:o,contentType:_optionalChain([s, 'optionalAccess', _11 => _11.valueOf, 'call', _12 => _12()]),acceptType:_optionalChain([i, 'optionalAccess', _13 => _13.valueOf, 'call', _14 => _14()]),params:a,overrides:{...c.clientConfig,...d}},c)}async function Ge(n){return En({...n,type:0})}async function vr(n){return En({...n,type:1})}async function Cr(n){return En({...n,type:2})}var _utils = require('@noble/hashes/utils');var qt=2**8-1,Kt=2**16-1,oe=2**32-1,Pe=BigInt(2)**BigInt(64)-BigInt(1),gt=BigInt(2)**BigInt(128)-BigInt(1),$t=BigInt(2)**BigInt(256)-BigInt(1);var B=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Ci=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Ci||{}),m= 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 B("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 B("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 B(`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 p=class{bcsToBytes(){let t=new j;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return m.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){In(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(oe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Pe,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&gt,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)})}};G([Ue(0,qt)],j.prototype,"serializeU8",1),G([Ue(0,Kt)],j.prototype,"serializeU16",1),G([Ue(0,oe)],j.prototype,"serializeU32",1),G([Ue(BigInt(0),Pe)],j.prototype,"serializeU64",1),G([Ue(BigInt(0),gt)],j.prototype,"serializeU128",1),G([Ue(BigInt(0),$t)],j.prototype,"serializeU256",1),G([Ue(0,oe)],j.prototype,"serializeU32AsUleb128",1);function In(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Pi=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function ge(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Pi(n,t,e))}function Ue(n,t){return(e,r,o)=>{let i=o.value;return o.value=function(a){return ge(a,n,t),i.apply(this,[a])},o}}var Ei=(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))(Ei||{}),T=class T extends p{constructor(e){super();if(e.length!==T.LENGTH)throw new B("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 B("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 B(`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 B(`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 B("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new B("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(i){throw new B(`Hex characters are invalid: ${_optionalChain([i, '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 Ur=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<oe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>oe)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 Ee=class n extends p{constructor(e){super();this.value=m.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 p{constructor(e){super();this.value=new Ee(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=Ee.deserialize(e,r);return new n(o.value)}};var v=class n extends p{constructor(e){super();In(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},N= exports.U8 =class n extends p{constructor(e){super();ge(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 p{constructor(e){super();ge(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 p{constructor(e){super();ge(e,0,oe),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())}},I= exports.U64 =class n extends p{constructor(e){super();ge(e,BigInt(0),Pe),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())}},H= exports.U128 =class n extends p{constructor(e){super();ge(e,BigInt(0),gt),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())}},V= exports.U256 =class n extends p{constructor(e){super();ge(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 h=class n extends p{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof N)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=m.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 N(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 I(r)))}static U128(e){return new n(e.map(r=>new H(r)))}static U256(e){return new n(e.map(r=>new V(r)))}static Bool(e){return new n(e.map(r=>new v(r)))}static MoveString(e){return new n(e.map(r=>new E(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1)i.push(r.deserialize(e));return new n(i)}},E= exports.MoveString =class n extends p{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);h.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},me= exports.MoveOption =class n extends p{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new N(e):void 0)}static U16(e){return new n(e!=null?new $(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 I(e):void 0)}static U128(e){return new n(e!=null?new H(e):void 0)}static U256(e){return new n(e!=null?new V(e):void 0)}static Bool(e){return new n(e!=null?new v(e):void 0)}static MoveString(e){return new n(e!=null?new E(e):void 0)}static deserialize(e,r){let o=h.deserialize(e,r);return new n(o.values[0])}};var F=class extends p{},Be= exports.PrivateKey =class extends p{},X= exports.Signature =class extends p{};var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Er = _interopRequireWildcard(_bip39);var ki=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Ni= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,zi= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(zi||{}),Ir= exports.HARDENED_OFFSET =2147483648;function Rr(n){return Ni.test(n)}function kr(n){return ki.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)}},Nr= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),i=new Uint8Array([0]),s=new Uint8Array([...i,...n,...o]);return Rn(t,s)},Oi=n=>n.replace("'",""),zr= exports.splitPath =n=>n.split("/").slice(1).map(Oi),Ht= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Er.mnemonicToSeedSync(t)};var ye=class ye extends F{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==ye.LENGTH)throw new Error(`PublicKey length should be ${ye.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=m.fromHexInput(r).toUint8Array(),s=o.toUint8Array();return _tweetnacl2.default.sign.detached.verify(i,s,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ye(r)}static load(e){let r=e.deserializeBytes();return new ye(r)}static isPublicKey(e){return e instanceof ye}};ye.LENGTH=32;var b=ye,z=class z extends Be{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==z.LENGTH)throw new Error(`PrivateKey length should be ${z.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,z.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,z.LENGTH)}toString(){return m.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=m.fromHexInput(e),o=_tweetnacl2.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new C(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new z(r)}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new z(e.secretKey.slice(0,z.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new b(e)}static fromDerivationPath(e,r){if(!kr(e))throw new Error(`Invalid derivation path ${e}`);return z.fromDerivationPathInner(e,Ht(r))}static fromDerivationPathInner(e,r,o=Ir){let{key:i,chainCode:s}=Rn(z.SLIP_0010_SEED,r),a=zr(e).map(d=>parseInt(d,10)),{key:c}=a.reduce((d,f)=>Nr(d,f+o),{key:i,chainCode:s});return new z(c)}static isPrivateKey(e){return e instanceof z}};z.LENGTH=32,z.SLIP_0010_SEED="ed25519 seed";var Ae=z,fe=class fe extends X{constructor(e){super();let r=m.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 C=fe;var q=class q extends F{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>q.MAX_KEYS||r.length<q.MIN_KEYS)throw new Error(`Must have between ${q.MIN_KEYS} and ${q.MAX_KEYS} public keys, inclusive`);if(o<q.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${q.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*b.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*b.LENGTH)}),e[this.publicKeys.length*b.LENGTH]=this.threshold,e}toString(){return m.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],i=[];for(let s=0;s<r.length-1;s+=b.LENGTH){let a=s;i.push(new b(r.subarray(a,a+b.LENGTH)))}return new q({publicKeys:i,threshold:o})}};q.MAX_KEYS=32,q.MIN_KEYS=2,q.MIN_THRESHOLD=1;var Y=q,K=class K extends X{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==K.BITMAP_LEN)throw new Error(`"bitmap" length should be ${K.BITMAP_LEN}`);if(r.length>K.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${K.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*C.LENGTH+K.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*C.LENGTH)}),e.set(this.bitmap,this.signatures.length*C.LENGTH),e}toString(){return m.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=K.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${K.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),d=i[c];d|=o>>a%8,i[c]=d}),i}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),i=[];for(let s=0;s<r.length-o.length;s+=C.LENGTH){let a=s;i.push(new C(r.subarray(a,a+C.LENGTH)))}return new K({signatures:i,bitmap:o})}};K.MAX_SIGNATURES_SUPPORTED=32,K.BITMAP_LEN=4;var Me=K;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var he=class he extends F{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==he.LENGTH)throw new Error(`PublicKey length should be ${he.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=m.fromHexInput(r).toUint8Array(),s=_sha3.sha3_256.call(void 0, i),a=o.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new he(r)}static load(e){let r=e.deserializeBytes();return new he(r)}static isPublicKey(e){return e instanceof he}};he.LENGTH=65;var Q=he,Z=class Z extends Be{constructor(e){super();let r=m.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=m.fromHexInput(e),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());return new we(i.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(!Rr(e))throw new Error(`Invalid derivation path ${e}`);return Z.fromDerivationPathInner(e,Ht(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 be=Z,Te=class Te extends X{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==Te.LENGTH)throw new Error(`Signature length should be ${Te.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 Te(r)}static load(e){let r=e.deserializeBytes();return new Te(r)}static isSignature(e){return e instanceof Te}};Te.LENGTH=64;var we=Te;var S=class n extends F{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 b)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(b.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 b}isSecp256k1PublicKey(){return this.publicKey instanceof Q}};var De=class n extends F{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 i=[];r.forEach(s=>{s instanceof S?i.push(s):i.push(new S(s))}),this.publicKeys=i,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let d=Math.floor(a/8),f=i[d];f|=o>>a%8,i[d]=f}),i}toString(){return m.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(S),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var ie=class ie extends p{constructor(e){super();let{data:r}=e,o=m.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,i;switch(o){case 3:case 2:{let c=r.bcsToBytes();i=new Uint8Array([...c,o]);break}case 0:case 1:{let c=r.toUint8Array(),d=m.fromHexInput(c).toUint8Array();i=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new ie({data:a})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof b)o=0 .valueOf();else if(r instanceof Y)o=1 .valueOf();else if(r instanceof S)o=2 .valueOf();else if(r instanceof De)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 _e=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,i=_nullishCoalesce(o, () => (!0));if(this.publicKey=e.publicKey(),this.publicKey instanceof b)i?this.signingScheme=0:(this.publicKey=new S(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Y)this.signingScheme=1;else if(this.publicKey instanceof Q)this.publicKey=new S(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=be.generate(),o=new S(r.publicKey());break;default:r=Ae.generate(),e===!1?o=new S(r.publicKey()):o=r.publicKey()}let s=J.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:s,legacy:_optionalChain([t, 'optionalAccess', _23 => _23.legacy])})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=_nullishCoalesce(r, () => (!0)),i;if(e instanceof be)i=new S(e.publicKey());else if(e instanceof Ae)o?i=e.publicKey():i=new S(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let a=J.fromPublicKey({publicKey:i}).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:i}=t,s;switch(o){case 2:s=be.fromDerivationPath(e,r);break;case 0:s=Ae.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:s,legacy:i})}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=m.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Mi=`
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 Ti=Object.defineProperty;var bi=Object.getOwnPropertyDescriptor;var G=(n,t,e,r)=>{for(var o=r>1?void 0:r?bi(t,e):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(t,e,o):s(o))||o);return r&&o&&Ti(t,e,o),o};var re=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 ur="1.0.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 =(g=>(g[g.Bool=0]="Bool",g[g.U8=1]="U8",g[g.U64=2]="U64",g[g.U128=3]="U128",g[g.Address=4]="Address",g[g.Signer=5]="Signer",g[g.Vector=6]="Vector",g[g.Struct=7]="Struct",g[g.U16=8]="U16",g[g.U32=9]="U32",g[g.U256=10]="U256",g[g.Reference=254]="Reference",g[g.Generic=255]="Generic",g))(dr||{}),pt= exports.ScriptTransactionArgumentVariants =(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d))(pt||{}),pr= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(pr||{}),lr= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(lr||{}),gr= exports.TransactionAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.SingleSender=4]="SingleSender",i))(gr||{}),mr= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(mr||{}),yr= exports.AnyPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(yr||{}),fr= exports.AnySignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(fr||{}),vn= exports.TransactionResponseType =(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(vn||{});function ms(n){return n.type==="pending_transaction"}function ys(n){return n.type==="user_transaction"}function fs(n){return n.type==="genesis_transaction"}function As(n){return n.type==="block_metadata_transaction"}function hs(n){return n.type==="state_checkpoint_transaction"}function Ts(n){return"signature"in n&&n.signature==="ed25519_signature"}function bs(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function ws(n){return n.type==="multi_agent_signature"}function _s(n){return n.type==="fee_payer_signature"}function Ss(n){return n.type==="multi_ed25519_signature"}var wi=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(wi||{}),_i= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(_i||{}),Si= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Si||{}),lt= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(lt||{}),Ar= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Ar||{}),xi= exports.DeriveScheme =(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(xi||{});var hr={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 vi(n,t){let{url:e,method:r,body:o,contentType:i,params:s,overrides:a}=n,c={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-ts-sdk/${ur}`,"content-type":_nullishCoalesce(i, () => ("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:s,headers:c,overrides:a})}async function Gt(n,t){let{url:e,path:r}=n,o=`${e}/${_nullishCoalesce(r, () => (""))}`,i=await vi({...n,url:o},t.client),s={status:i.status,statusText:i.statusText,data:i.data,headers:i.headers,config:i.config,request:i.request,url:o};if(t.isIndexerRequest(e)){let c=s.data;if(c.errors)throw new re(n,s,_nullishCoalesce(c.errors[0].message, () => (`Unhandled Error ${i.status} : ${i.statusText}`)));s.data=c.data}if(s.status>=200&&s.status<300)return s;let a;throw s&&s.data&&"message"in s.data&&"error_code"in s.data?a=JSON.stringify(s.data):s.status in hr?a=hr[s.status]:a=`Unhandled Error ${s.status} : ${s.statusText}`,new re(n,s,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"},Tr= 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"},br= 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"},Bt= exports.Network =(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Bt||{}),Pn= exports.NetworkToChainId ={mainnet:1,testnet:2},Gs= 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||{}),wr= exports.DEFAULT_NETWORK ="devnet",_r= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Sr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Dt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ft= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",xr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Un= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",ze= exports.ProcessorType =(d=>(d.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",d.COIN_PROCESSOR="coin_processor",d.DEFAULT="default_processor",d.EVENTS_PROCESSOR="events_processor",d.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",d.STAKE_PROCESSOR="stake_processor",d.TOKEN_PROCESSOR="token_processor",d.TOKEN_V2_PROCESSOR="token_v2_processor",d.USER_TRANSACTION_PROCESSOR="user_transaction_processor",d))(ze||{});async function vr(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:c}=n,d=t.getRequestUrl(c);return Gt({url:d,method:"GET",originMethod:a,path:s,contentType:_optionalChain([o, 'optionalAccess', _7 => _7.valueOf, 'call', _8 => _8()]),acceptType:_optionalChain([i, 'optionalAccess', _9 => _9.valueOf, 'call', _10 => _10()]),params:r,overrides:{...t.clientConfig,...e}},t)}async function D(n){return vr({...n,type:0})}async function Oe(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await vr({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 En(n){let{type:t,originMethod:e,path:r,body:o,acceptType:i,contentType:s,params:a,aptosConfig:c,overrides:d}=n,f=c.getRequestUrl(t);return Gt({url:f,method:"POST",originMethod:e,path:r,body:o,contentType:_optionalChain([s, 'optionalAccess', _11 => _11.valueOf, 'call', _12 => _12()]),acceptType:_optionalChain([i, 'optionalAccess', _13 => _13.valueOf, 'call', _14 => _14()]),params:a,overrides:{...c.clientConfig,...d}},c)}async function Ge(n){return En({...n,type:0})}async function Cr(n){return En({...n,type:1})}async function Pr(n){return En({...n,type:2})}var _utils = require('@noble/hashes/utils');var qt=2**8-1,Kt=2**16-1,oe=2**32-1,Pe=BigInt(2)**BigInt(64)-BigInt(1),gt=BigInt(2)**BigInt(128)-BigInt(1),$t=BigInt(2)**BigInt(256)-BigInt(1);var B=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var Ui=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Ui||{}),m= 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 B("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 B("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 B(`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 p=class{bcsToBytes(){let t=new j;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return m.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){In(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(oe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Pe,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&gt,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)})}};G([Ue(0,qt)],j.prototype,"serializeU8",1),G([Ue(0,Kt)],j.prototype,"serializeU16",1),G([Ue(0,oe)],j.prototype,"serializeU32",1),G([Ue(BigInt(0),Pe)],j.prototype,"serializeU64",1),G([Ue(BigInt(0),gt)],j.prototype,"serializeU128",1),G([Ue(BigInt(0),$t)],j.prototype,"serializeU256",1),G([Ue(0,oe)],j.prototype,"serializeU32AsUleb128",1);function In(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Ei=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function ge(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Ei(n,t,e))}function Ue(n,t){return(e,r,o)=>{let i=o.value;return o.value=function(a){return ge(a,n,t),i.apply(this,[a])},o}}var Ri=(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))(Ri||{}),T=class T extends p{constructor(e){super();if(e.length!==T.LENGTH)throw new B("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 B("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 B(`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 B(`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 B("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new B("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(i){throw new B(`Hex characters are invalid: ${_optionalChain([i, '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<oe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>oe)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 Ee=class n extends p{constructor(e){super();this.value=m.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 p{constructor(e){super();this.value=new Ee(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=Ee.deserialize(e,r);return new n(o.value)}};var C=class n extends p{constructor(e){super();In(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},N= exports.U8 =class n extends p{constructor(e){super();ge(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 p{constructor(e){super();ge(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 p{constructor(e){super();ge(e,0,oe),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())}},I= exports.U64 =class n extends p{constructor(e){super();ge(e,BigInt(0),Pe),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())}},H= exports.U128 =class n extends p{constructor(e){super();ge(e,BigInt(0),gt),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())}},V= exports.U256 =class n extends p{constructor(e){super();ge(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 h=class n extends p{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof N)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=m.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 N(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 I(r)))}static U128(e){return new n(e.map(r=>new H(r)))}static U256(e){return new n(e.map(r=>new V(r)))}static Bool(e){return new n(e.map(r=>new C(r)))}static MoveString(e){return new n(e.map(r=>new E(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1)i.push(r.deserialize(e));return new n(i)}},E= exports.MoveString =class n extends p{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);h.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},me= exports.MoveOption =class n extends p{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new N(e):void 0)}static U16(e){return new n(e!=null?new $(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 I(e):void 0)}static U128(e){return new n(e!=null?new H(e):void 0)}static U256(e){return new n(e!=null?new V(e):void 0)}static Bool(e){return new n(e!=null?new C(e):void 0)}static MoveString(e){return new n(e!=null?new E(e):void 0)}static deserialize(e,r){let o=h.deserialize(e,r);return new n(o.values[0])}};var F=class extends p{},Be= exports.PrivateKey =class extends p{},X= exports.Signature =class extends p{};var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ir = _interopRequireWildcard(_bip39);var zi=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Oi= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Gi= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(Gi||{}),Rr= exports.HARDENED_OFFSET =2147483648;function kr(n){return Oi.test(n)}function Nr(n){return zi.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)}},zr= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),i=new Uint8Array([0]),s=new Uint8Array([...i,...n,...o]);return Rn(t,s)},Bi=n=>n.replace("'",""),Or= exports.splitPath =n=>n.split("/").slice(1).map(Bi),Ht= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Ir.mnemonicToSeedSync(t)};var ye=class ye extends F{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==ye.LENGTH)throw new Error(`PublicKey length should be ${ye.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=m.fromHexInput(r).toUint8Array(),s=o.toUint8Array();return _tweetnacl2.default.sign.detached.verify(i,s,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ye(r)}static load(e){let r=e.deserializeBytes();return new ye(r)}static isPublicKey(e){return e instanceof ye}};ye.LENGTH=32;var b=ye,z=class z extends Be{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==z.LENGTH)throw new Error(`PrivateKey length should be ${z.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,z.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,z.LENGTH)}toString(){return m.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=m.fromHexInput(e),o=_tweetnacl2.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new P(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new z(r)}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new z(e.secretKey.slice(0,z.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new b(e)}static fromDerivationPath(e,r){if(!Nr(e))throw new Error(`Invalid derivation path ${e}`);return z.fromDerivationPathInner(e,Ht(r))}static fromDerivationPathInner(e,r,o=Rr){let{key:i,chainCode:s}=Rn(z.SLIP_0010_SEED,r),a=Or(e).map(d=>parseInt(d,10)),{key:c}=a.reduce((d,f)=>zr(d,f+o),{key:i,chainCode:s});return new z(c)}static isPrivateKey(e){return e instanceof z}};z.LENGTH=32,z.SLIP_0010_SEED="ed25519 seed";var Ae=z,fe=class fe extends X{constructor(e){super();let r=m.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 P=fe;var q=class q extends F{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>q.MAX_KEYS||r.length<q.MIN_KEYS)throw new Error(`Must have between ${q.MIN_KEYS} and ${q.MAX_KEYS} public keys, inclusive`);if(o<q.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${q.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*b.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*b.LENGTH)}),e[this.publicKeys.length*b.LENGTH]=this.threshold,e}toString(){return m.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],i=[];for(let s=0;s<r.length-1;s+=b.LENGTH){let a=s;i.push(new b(r.subarray(a,a+b.LENGTH)))}return new q({publicKeys:i,threshold:o})}};q.MAX_KEYS=32,q.MIN_KEYS=2,q.MIN_THRESHOLD=1;var Y=q,K=class K extends X{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==K.BITMAP_LEN)throw new Error(`"bitmap" length should be ${K.BITMAP_LEN}`);if(r.length>K.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${K.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*P.LENGTH+K.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*P.LENGTH)}),e.set(this.bitmap,this.signatures.length*P.LENGTH),e}toString(){return m.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=K.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${K.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),d=i[c];d|=o>>a%8,i[c]=d}),i}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),i=[];for(let s=0;s<r.length-o.length;s+=P.LENGTH){let a=s;i.push(new P(r.subarray(a,a+P.LENGTH)))}return new K({signatures:i,bitmap:o})}};K.MAX_SIGNATURES_SUPPORTED=32,K.BITMAP_LEN=4;var Me=K;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var he=class he extends F{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==he.LENGTH)throw new Error(`PublicKey length should be ${he.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=m.fromHexInput(r).toUint8Array(),s=_sha3.sha3_256.call(void 0, i),a=o.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new he(r)}static load(e){let r=e.deserializeBytes();return new he(r)}static isPublicKey(e){return e instanceof he}};he.LENGTH=65;var Q=he,Z=class Z extends Be{constructor(e){super();let r=m.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=m.fromHexInput(e),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());return new we(i.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,Ht(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 be=Z,Te=class Te extends X{constructor(e){super();let r=m.fromHexInput(e);if(r.toUint8Array().length!==Te.LENGTH)throw new Error(`Signature length should be ${Te.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 Te(r)}static load(e){let r=e.deserializeBytes();return new Te(r)}static isSignature(e){return e instanceof Te}};Te.LENGTH=64;var we=Te;var S=class n extends F{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 b)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(b.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 b}isSecp256k1PublicKey(){return this.publicKey instanceof Q}};var De=class n extends F{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 i=[];r.forEach(s=>{s instanceof S?i.push(s):i.push(new S(s))}),this.publicKeys=i,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let d=Math.floor(a/8),f=i[d];f|=o>>a%8,i[d]=f}),i}toString(){return m.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(S),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var ie=class ie extends p{constructor(e){super();let{data:r}=e,o=m.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,i;switch(o){case 3:case 2:{let c=r.bcsToBytes();i=new Uint8Array([...c,o]);break}case 0:case 1:{let c=r.toUint8Array(),d=m.fromHexInput(c).toUint8Array();i=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new ie({data:a})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof b)o=0 .valueOf();else if(r instanceof Y)o=1 .valueOf();else if(r instanceof S)o=2 .valueOf();else if(r instanceof De)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 _e=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,i=_nullishCoalesce(o, () => (!0));if(this.publicKey=e.publicKey(),this.publicKey instanceof b)i?this.signingScheme=0:(this.publicKey=new S(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Y)this.signingScheme=1;else if(this.publicKey instanceof Q)this.publicKey=new S(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=be.generate(),o=new S(r.publicKey());break;default:r=Ae.generate(),e===!1?o=new S(r.publicKey()):o=r.publicKey()}let s=J.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:s,legacy:_optionalChain([t, 'optionalAccess', _23 => _23.legacy])})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=_nullishCoalesce(r, () => (!0)),i;if(e instanceof be)i=new S(e.publicKey());else if(e instanceof Ae)o?i=e.publicKey():i=new S(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let a=J.fromPublicKey({publicKey:i}).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:i}=t,s;switch(o){case 2:s=be.fromDerivationPath(e,r);break;case 0:s=Ae.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:s,legacy:i})}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=m.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Fi=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -16,7 +16,7 @@
16
16
  transaction_version
17
17
  type
18
18
  }
19
- `,Di=`
19
+ `,qi=`
20
20
  fragment AnsTokenFragment on current_aptos_names {
21
21
  domain
22
22
  expiration_timestamp
@@ -72,7 +72,7 @@
72
72
  }
73
73
  }
74
74
  }
75
- `,Gr=`
75
+ `,Br=`
76
76
  query getAccountCoinsCount($address: String) {
77
77
  current_fungible_asset_balances_aggregate(
78
78
  where: {owner_address: {_eq: $address}}
@@ -82,7 +82,7 @@
82
82
  }
83
83
  }
84
84
  }
85
- `,Br=`
85
+ `,Mr=`
86
86
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
87
87
  current_fungible_asset_balances(
88
88
  where: $where_condition
@@ -115,7 +115,7 @@
115
115
  }
116
116
  }
117
117
  }
118
- `,Mr=`
118
+ `,Dr=`
119
119
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
120
120
  current_collection_ownership_v2_view(
121
121
  where: $where_condition
@@ -149,7 +149,7 @@
149
149
  single_token_uri
150
150
  }
151
151
  }
152
- `,Dr=`
152
+ `,Fr=`
153
153
  query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
154
154
  current_objects(
155
155
  where: $where_condition
@@ -166,7 +166,7 @@
166
166
  is_deleted
167
167
  }
168
168
  }
169
- `,Fr=`
169
+ `,qr=`
170
170
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
171
171
  current_token_ownerships_v2(
172
172
  where: $where_condition
@@ -177,7 +177,7 @@
177
177
  ...CurrentTokenOwnershipFields
178
178
  }
179
179
  }
180
- ${Wt}`,jc=`
180
+ ${Wt}`,Xc=`
181
181
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
182
182
  current_token_ownerships_v2(
183
183
  where: $where_condition
@@ -188,7 +188,7 @@
188
188
  ...CurrentTokenOwnershipFields
189
189
  }
190
190
  }
191
- ${Wt}`,qr=`
191
+ ${Wt}`,Kr=`
192
192
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
193
193
  current_token_ownerships_v2(
194
194
  where: $where_condition
@@ -199,7 +199,7 @@
199
199
  ...CurrentTokenOwnershipFields
200
200
  }
201
201
  }
202
- ${Wt}`,Kr=`
202
+ ${Wt}`,$r=`
203
203
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
204
204
  current_token_ownerships_v2_aggregate(
205
205
  where: $where_condition
@@ -211,7 +211,7 @@
211
211
  }
212
212
  }
213
213
  }
214
- `,$r=`
214
+ `,Lr=`
215
215
  query getAccountTransactionsCount($address: String) {
216
216
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
217
217
  aggregate {
@@ -219,13 +219,13 @@
219
219
  }
220
220
  }
221
221
  }
222
- `,Lr=`
222
+ `,Hr=`
223
223
  query getChainTopUserTransactions($limit: Int) {
224
224
  user_transactions(limit: $limit, order_by: {version: desc}) {
225
225
  version
226
226
  }
227
227
  }
228
- `,Hr=`
228
+ `,Vr=`
229
229
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
230
230
  current_collections_v2(where: $where_condition) {
231
231
  collection_id
@@ -244,7 +244,7 @@
244
244
  uri
245
245
  }
246
246
  }
247
- `,Vr=`
247
+ `,Qr=`
248
248
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
249
249
  current_fungible_asset_balances(
250
250
  where: $where_condition
@@ -262,7 +262,7 @@
262
262
  token_standard
263
263
  }
264
264
  }
265
- `,Qr=`
265
+ `,Wr=`
266
266
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
267
267
  delegated_staking_activities(
268
268
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -275,7 +275,7 @@
275
275
  transaction_version
276
276
  }
277
277
  }
278
- `,Wr=`
278
+ `,jr=`
279
279
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
280
280
  events(
281
281
  where: $where_condition
@@ -294,7 +294,7 @@
294
294
  indexed_type
295
295
  }
296
296
  }
297
- `,jr=`
297
+ `,Xr=`
298
298
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
299
299
  fungible_asset_activities(
300
300
  where: $where_condition
@@ -319,7 +319,7 @@
319
319
  type
320
320
  }
321
321
  }
322
- `,Xr=`
322
+ `,Yr=`
323
323
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
324
324
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
325
325
  icon_uri
@@ -347,7 +347,7 @@
347
347
  ...AnsTokenFragment
348
348
  }
349
349
  }
350
- ${Di}`,kn=`
350
+ ${qi}`,kn=`
351
351
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
352
352
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
353
353
  num_active_delegator
@@ -362,7 +362,7 @@
362
362
  last_updated
363
363
  }
364
364
  }
365
- `,Yr=`
365
+ `,Zr=`
366
366
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
367
367
  token_activities_v2(
368
368
  where: $where_condition
@@ -373,7 +373,7 @@
373
373
  ...TokenActivitiesFields
374
374
  }
375
375
  }
376
- ${Mi}`,zn=`
376
+ ${Fi}`,zn=`
377
377
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
378
378
  current_token_ownerships_v2(
379
379
  where: $where_condition
@@ -384,7 +384,7 @@
384
384
  ...CurrentTokenOwnershipFields
385
385
  }
386
386
  }
387
- ${Wt}`,Zr=`
387
+ ${Wt}`,Jr=`
388
388
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
389
389
  current_token_datas_v2(
390
390
  where: $where_condition
@@ -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 Jr(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 eo(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 Ge({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _26 => _26.ledgerVersion])},body:r})).data}async function Se(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Ge({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 to(n){let{aptosConfig:t,limit:e}=n;return(await l({aptosConfig:t,query:{query:Lr,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function l(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await vr({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Fi(n){let{aptosConfig:t}=n;return(await l({aptosConfig:t,query:{query:Nn},originMethod:"getProcessorStatuses"})).processor_status}async function Yt(n){return(await Fi({aptosConfig:n.aptosConfig}))[0].last_success_version}async function Zt(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await l({aptosConfig:t,query:{query:Nn,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var On=new Map;function qe(n,t,e){return async(...r)=>{if(On.has(t)){let{value:i,timestamp:s}=On.get(t);if(e===void 0||Date.now()-s<=e)return i}let o=await n(...r);return On.set(t,{value:o,timestamp:Date.now()}),o}}var se=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 C)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof we)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(C.load(e));case 1:return new n(we.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 oo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Oe({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?no(n):qe(async()=>no(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function no(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:i}=await D({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])}});return i}async function io(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Oe({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 so(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Oe({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:i}=await D({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _39 => _39.ledgerVersion])}});return i.data}async function Bn(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:i}}=o,s=u.from(e);try{let a=await Xt({aptosConfig:t,handle:i,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof re&&a.data.error_code==="table_item_not_found")return s;throw a}}async function ao(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await l({aptosConfig:t,query:{query:Kr,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function co(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _40 => _40.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _41 => _41.tokenStandard])});let s={query:Fr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _42 => _42.offset]),limit:_optionalChain([r, 'optionalAccess', _43 => _43.limit]),order_by:_optionalChain([r, 'optionalAccess', _44 => _44.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function uo(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,i=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _45 => _45.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _46 => _46.tokenStandard])});let c={query:qr,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 l({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function po(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _50 => _50.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _51 => _51.tokenStandard])}});let s={query:Mr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _52 => _52.offset]),limit:_optionalChain([r, 'optionalAccess', _53 => _53.limit]),order_by:_optionalChain([r, 'optionalAccess', _54 => _54.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function lo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),i=await l({aptosConfig:t,query:{query:$r,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return i.account_transactions_aggregate.aggregate?i.account_transactions_aggregate.aggregate.count:0}async function Mn(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=u.from(e).toStringLong(),i=await Dn({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return i[0]?i[0].amount:0}async function Dn(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=u.from(e).toStringLong(),i={..._optionalChain([r, 'optionalAccess', _55 => _55.where]),owner_address:{_eq:o}},s={query:Br,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([r, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([r, 'optionalAccess', _58 => _58.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function go(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),i=await l({aptosConfig:t,query:{query:Gr,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function mo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()}},s={query:Dr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.limit]),order_by:_optionalChain([r, 'optionalAccess', _61 => _61.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function yo(n){let{aptosConfig:t,privateKey:e}=n,r=new S(e.publicKey());if(e instanceof be){let i=J.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return _e.fromPrivateKeyAndAddress({privateKey:e,address:i})}if(e instanceof Ae){let o=J.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await ro({authKey:o,aptosConfig:t})){let c=o.derivedAddress();return _e.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!1})}let s=J.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await ro({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return _e.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function ro(n){let{aptosConfig:t,authKey:e}=n,r=await Bn({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 xe(n){return new Promise(t=>{setTimeout(t,n)})}async function fo(n){let{aptosConfig:t,options:e}=n;return Oe({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 qe(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 Ao(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 ho(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 Ke(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.timeoutSecs]), () => (Dt)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _66 => _66.checkSuccess]), () => (!0)),s=!0,a=0,c,d,f=200,k=1.5;for(;s&&!(a>=o);){try{if(c=await nn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(A){if(!(A instanceof re)||(d=A,A.status!==404&&A.status>=400&&A.status<500))throw A}await xe(f),a+=f/1e3,f*=k}if(c===void 0)throw d||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(!i)return c;if(!c.success)throw new Fn(`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,i=new Date().getTime(),s=-1;for(;s<r;){if(new Date().getTime()-i>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?s=await Yt({aptosConfig:t}):s=(await Zt({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await xe(200)}}var en=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Fn=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function y(n){if(n.minimumLedgerVersion!==void 0){let t=[];for(let e of n.processorTypes)t.push(rn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:e}));await Promise.all(t)}}var mt=class{constructor(t){this.config=t}async getAccountInfo(t){return ee({aptosConfig:this.config,...t})}async getAccountModules(t){return oo({aptosConfig:this.config,...t})}async getAccountModule(t){return Jt({aptosConfig:this.config,...t})}async getAccountTransactions(t){return io({aptosConfig:this.config,...t})}async getAccountResources(t){return so({aptosConfig:this.config,...t})}async getAccountResource(t){return Gn({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Bn({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),ao({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),co({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),uo({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),po({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),lo({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Dn({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),go({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Mn({aptosConfig:this.config,coinType:Ft,...t})}async getAccountCoinAmount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Mn({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),mo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return yo({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]), () => (br)),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 hr[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 Tr[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 p{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new E("account");this.structName=new E("RotationProofChallenge");this.sequenceNumber=new I(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=h.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 M=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ae.load(t);case 1:return an.load(t);case 2:return te.load(t);case 3:return $e.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof ae}isMultiEd25519(){return this instanceof an}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof $e}},ae= exports.AccountAuthenticatorEd25519 =class n extends M{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=b.deserialize(e),o=C.deserialize(e);return new n(r,o)}},an= exports.AccountAuthenticatorMultiEd25519 =class n extends M{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=Me.deserialize(e);return new n(r,o)}},te= exports.AccountAuthenticatorSingleKey =class n extends M{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=S.deserialize(e),o=se.deserialize(e);return new n(r,o)}},$e= exports.AccountAuthenticatorMultiKey =class n extends M{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=De.deserialize(e),o=e.deserializeVector(se),i=e.deserializeBytes();return new n(r,o,i)}};var ce=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Le.load(t);case 1:return qn.load(t);case 2:return He.load(t);case 3:return Ve.load(t);case 4:return Qe.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Le= exports.TransactionAuthenticatorEd25519 =class n extends ce{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=b.deserialize(e),o=C.deserialize(e);return new n(r,o)}},qn= exports.TransactionAuthenticatorMultiEd25519 =class n extends ce{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Y.deserialize(e),o=Me.deserialize(e);return new n(r,o)}},He= exports.TransactionAuthenticatorMultiAgent =class n extends ce{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=M.deserialize(e),o=e.deserializeVector(u),i=e.deserializeVector(M);return new n(r,o,i)}},Ve= exports.TransactionAuthenticatorFeePayer =class n extends ce{constructor(e,r,o,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=i}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=M.deserialize(e),o=e.deserializeVector(u),i=e.deserializeVector(M),s=u.deserialize(e),a=M.deserialize(e),c={address:s,authenticator:a};return new n(r,o,i,c)}},Qe= exports.TransactionAuthenticatorSingleSender =class n extends ce{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=M.deserialize(e);return new n(r)}};var We=class n extends p{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var x=class n extends p{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var yt=class n extends p{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 x(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),o=x.deserialize(e);return new n(r,o)}};var P=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return je.load(t);case 1:return Xe.load(t);case 2:return Je.load(t);case 3:return et.load(t);case 4:return nt.load(t);case 5:return Ie.load(t);case 6:return ot.load(t);case 7:return ve.load(t);case 8:return Ye.load(t);case 9:return Ze.load(t);case 10:return tt.load(t);case 255:return rt.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof je}isAddress(){return this instanceof nt}isGeneric(){return this instanceof rt}isSigner(){return this instanceof Ie}isVector(){return this instanceof ot}isStruct(){return this instanceof ve}isU8(){return this instanceof Xe}isU16(){return this instanceof Ye}isU32(){return this instanceof Ze}isU64(){return this instanceof Je}isU128(){return this instanceof et}isU256(){return this instanceof tt}},je= exports.TypeTagBool =class n extends P{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Xe= exports.TypeTagU8 =class n extends P{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Ye= exports.TypeTagU16 =class n extends P{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Ze= exports.TypeTagU32 =class n extends P{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Je= exports.TypeTagU64 =class n extends P{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},et= exports.TypeTagU128 =class n extends P{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},tt= exports.TypeTagU256 =class n extends P{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},nt= exports.TypeTagAddress =class n extends P{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},Ie= exports.TypeTagSigner =class n extends P{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},cn= exports.TypeTagReference =class n extends P{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=P.deserialize(e);return new n(r)}},rt= exports.TypeTagGeneric =class n extends P{constructor(e){super();this.value=e}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)}},ot= exports.TypeTagVector =class n extends P{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=P.deserialize(e);return new n(r)}},ve= exports.TypeTagStruct =class n extends P{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=ue.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")}},ue= exports.StructTag =class n extends p{constructor(e,r,o,i){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=i}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=x.deserialize(e),i=x.deserialize(e),s=e.deserializeVector(P);return new n(r,o,i,s)}};function np(){return new ue(u.ONE,new x("aptos_coin"),new x("AptosCoin"),[])}function rp(){return new ue(u.ONE,new x("string"),new x("String"),[])}function op(n){return new ue(u.ONE,new x("option"),new x("Option"),[n])}function ip(n){return new ue(u.ONE,new x("object"),new x("Object"),[n])}function Ki(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return N.deserialize(n);case 1:return I.deserialize(n);case 2:return H.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,N);case 5:return v.deserialize(n);case 6:return $.deserialize(n);case 7:return L.deserialize(n);case 8:return V.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Re=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ft.load(t);case 2:return At.load(t);case 3:return ht.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},ft= exports.TransactionPayloadScript =class n extends Re{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Tt.deserialize(e);return new n(r)}},At= exports.TransactionPayloadEntryFunction =class n extends Re{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)}},ht= exports.TransactionPayloadMultisig =class n extends Re{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=bt.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(yt.fromStr(t),new x(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=yt.deserialize(t),r=x.deserialize(t),o=t.deserializeVector(P),i=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let c=t.deserializeUleb128AsU32(),d=Lt.deserialize(t,c);s.push(d)}return new n(e,r,o,s)}},Tt= 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(P),o=t.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=Ki(t);i.push(a)}return new n(e,r,i)}},bt= 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=wt.deserialize(t)),new n(e,o)}},wt= 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 p{constructor(e,r,o,i,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=u.deserialize(e),o=e.deserializeU64(),i=Re.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),d=We.deserialize(e);return new n(r,o,i,s,a,c,d)}},un= exports.RawTransactionWithData =class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return de.load(t);case 1:return pe.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)}},pe= 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),i=u.deserialize(e);return new n(r,o,i)}};var ne=class n extends p{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=ce.deserialize(e);return new n(r,o)}};function To(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function bo(n){return!!n.match(/\s/)}function $i(n){return!!n.match(/^T[0-9]+$/)}function Li(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!bo(r))break}return e}var Hi=(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))(Hi||{}),w= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Kn(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _73 => _73.allowGenerics]), () => (!1)),r=[],o=[],i=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:i}),a="",i=[],c=1;else if(d===">"){if(a!==""){let dt=dn(a,o,e);i.push(dt)}let f=r.pop();if(f===void 0)throw new w(n,"unexpected '>'");if(c!==i.length)throw new w(n,"type argument count doesn't match expected amount");let{savedStr:k,savedTypes:A,savedExpectedTypes:g}=f;o=i,i=A,a=k,c=g}else if(d===","){if(a.length!==0){let f=dn(a,o,e);o=[],i.push(f),a="",c+=1}}else if(bo(d)){let f=!1;if(a.length!==0){let A=dn(a,o,e);o=[],i.push(A),a="",f=!0}s=Li(n,s);let k=n[s];if(s<n.length&&f&&k!==","&&k!==">")throw new w(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new w(n,"no matching '>' for '<'");switch(i.length){case 0:return dn(a,o,e);case 1:if(a==="")return i[0];throw new w(n,"unexpected ','");default:throw new w(n,"unexpected whitespace character")}}function dn(n,t,e){switch(n){case"&signer":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new cn(new Ie);case"signer":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Ie;case"bool":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new je;case"address":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new nt;case"u8":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Xe;case"u16":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Ye;case"u32":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Ze;case"u64":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Je;case"u128":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new et;case"u256":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new tt;case"vector":if(t.length!==1)throw new w(n,"vector type expected to have exactly one type argument");return new ot(t[0]);default:if($i(n)){if(e)return new rt(Number(n.split("T")[1]));throw new w(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new w(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new w(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!To(r[1]))throw new w(n,"module name must only contain alphanumeric or '_' characters");if(!To(r[2]))throw new w(n,"struct name must only contain alphanumeric or '_' characters");return new ve(new ue(u.fromString(r[0]),new x(r[1]),new x(r[2]),t))}}function wo(n){return typeof n=="boolean"}function st(n){return typeof n=="string"}function pn(n){return typeof n=="number"}function ln(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function _o(n){return n==null}function So(n){return $n(n)||Hn(n)||Vn(n)||Qn(n)||Wn(n)||jn(n)||Xn(n)||gn(n)||Ln(n)||Vi(n)||n instanceof h||n instanceof me}function $n(n){return n instanceof v}function gn(n){return n instanceof u}function Ln(n){return n instanceof E}function Vi(n){return n instanceof Ee}function Hn(n){return n instanceof N}function Vn(n){return n instanceof $}function Qn(n){return n instanceof L}function Wn(n){return n instanceof I}function jn(n){return n instanceof H}function Xn(n){return n instanceof V}function Yn(n){return"bytecode"in n}function _(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function xo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Zn(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}}function vo(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _74 => _74.map, 'call', _75 => _75(t=>st(t)?Kn(t):t)]), () => ([]))}async function Co(n,t,e,r){let i=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(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let s=xo(i),a=[];for(let c=s;c<i.params.length;c+=1)a.push(Kn(i.params[c],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:a}}function Po(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let i=t.parameters[r];return mn(e,i,r,o)}function mn(n,t,e,r){return So(n)?(Wi(t,n,e),n):Qi(n,t,e,r)}function Qi(n,t,e,r){if(t.isBool()){if(wo(n))return new v(n);_("boolean",e)}if(t.isAddress()){if(st(n))return u.fromString(n);_("string",e)}if(t.isU8()){if(pn(n))return new N(n);_("number",e)}if(t.isU16()){if(pn(n))return new $(n);_("number",e)}if(t.isU32()){if(pn(n))return new L(n);_("number",e)}if(t.isU64()){if(ln(n))return new I(BigInt(n));_("bigint | number | string",e)}if(t.isU128()){if(ln(n))return new H(BigInt(n));_("bigint | number | string",e)}if(t.isU256()){if(ln(n))return new V(BigInt(n));_("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}`);mn(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(st(n))try{return h.U8(m.fromHexInput(n).toUint8Array())}catch (e2){throw new Error(`vector<u8> must be passed in as a hex string or a Uint8array, type '${t.toString()}'`)}if(n instanceof Uint8Array)return h.U8(n)}if(Array.isArray(n))return new h(n.map(o=>mn(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(st(n))return new E(n);_("string",e)}if(t.isObject()){if(st(n))return u.fromString(n);_("string",e)}if(t.isOption())return _o(n)?new me(null):new me(mn(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 Wi(n,t,e){if(n.isBool()){if($n(t))return;_("Bool",e)}if(n.isAddress()){if(gn(t))return;_("AccountAddress",e)}if(n.isU8()){if(Hn(t))return;_("U8",e)}if(n.isU16()){if(Vn(t))return;_("U16",e)}if(n.isU32()){if(Qn(t))return;_("U32",e)}if(n.isU64()){if(Wn(t))return;_("U64",e)}if(n.isU128()){if(jn(t))return;_("U128",e)}if(n.isU256()){if(Xn(t))return;_("U256",e)}if(n.isVector()){if(t instanceof h)return;_("MoveVector",e)}if(n instanceof ve){if(n.isString()){if(Ln(t))return;_("MoveString",e)}if(n.isObject()){if(gn(t))return;_("AccountAddress",e)}if(n.isOption()){if(t instanceof me)return;_("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function fn(n){if(Yn(n))return Uo(n);let{moduleAddress:t,moduleName:e,functionName:r}=Zn(n.function),o=await qe(async()=>Co(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Xi(n,o)}function Xi(n,t){if(Yn(n))return Uo(n);let{moduleAddress:e,moduleName:r,functionName:o}=Zn(n.function),i=vo(n.typeArguments);if(i.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${i.length}`);let s=n.functionArguments.map((c,d)=>Po(n.function,t,c,d,i));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${s.length}`);let a=it.build(`${e}::${r}`,o,i,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new ht(new bt(c,new wt(a)))}return new At(a)}function Uo(n){return new ft(new Tt(m.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Yi(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _80 => _80.accountSequenceNumber])!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):ee({aptosConfig:t,accountAddress:e}),s=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:d},{gas_estimate:f}]=await Promise.all([i,s,a]),{maxGasAmount:k,gasUnitPrice:A,expireTimestamp:g}={maxGasAmount:_optionalChain([o, 'optionalAccess', _82 => _82.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(wr),gasUnitPrice:BigInt(f),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+_r),...o};return new W(u.from(e),BigInt(c),r,BigInt(k),BigInt(A),BigInt(g),new We(d))}async function Jn(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=await Yi({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let s=_nullishCoalesce(_optionalChain([n, 'access', _83 => _83.secondarySignerAddresses, 'optionalAccess', _84 => _84.map, 'call', _85 => _85(a=>u.from(a))]), () => ([]));return{rawTransaction:i,secondarySignerAddresses:s,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}return{rawTransaction:i,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}function Eo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=yn(t);if(e.feePayerAddress){let a=new pe(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(k=>yn(k)));let d=yn(o),f=new Ve(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:d});return new ne(a.raw_txn,f).bcsToBytes()}if(e.secondarySignerAddresses){let a=new de(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(f=>yn(f));let d=new He(i,e.secondarySignerAddresses,c);return new ne(a.raw_txn,d).bcsToBytes()}let s;if(i instanceof ae)s=new Le(i.public_key,i.signature);else if(i instanceof te)s=new Qe(i);else throw new Error("Invalid public key");return new ne(e.rawTransaction,s).bcsToBytes()}function yn(n){if(n instanceof S){if(n.publicKey instanceof b)return new te(n,new se(new C(new Uint8Array(64))));if(n.publicKey instanceof Q)return new te(n,new se(new we(new Uint8Array(64))))}return new ae(new b(n.toUint8Array()),new C(new Uint8Array(64)))}function Io(n){let{signer:t,transaction:e}=n,r=er(e),o=t.sign(r);switch(t.signingScheme){case 0:return new ae(new b(t.publicKey.toUint8Array()),new C(o.toUint8Array()));case 2:if(!S.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new te(t.publicKey,new se(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function Ro(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,i=ko(t);if((r||o)&&(i instanceof de||i instanceof pe))return Zi(i,e,r,o);if(e instanceof ae&&i instanceof W){let s=new Le(e.public_key,e.signature);return new ne(i,s).bcsToBytes()}if((e instanceof te||e instanceof $e)&&i instanceof W){let s=new Qe(e);return new ne(i,s).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function ko(n){return n.feePayerAddress?new pe(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new de(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Zi(n,t,e,r){if(n instanceof pe){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new Ve(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 er(n){let t=ko(n),e=_sha3.sha3_256.create();if(t instanceof W)e.update(Sr);else if(t instanceof de)e.update(Un);else if(t instanceof pe)e.update(Un);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),i=new Uint8Array(r.length+o.length);return i.set(r),i.set(o,r.length),i}async function U(n){let t=await Ji(n);return es(n,t)}async function Ji(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?(r=e,o=await fn(r)):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await fn(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await fn(r)),o}async function es(n,t){let{aptosConfig:e,sender:r,options:o}=n,i;if(ts(n)&&(i=u.ZERO.toString()),ns(n)){let{secondarySignerAddresses:s}=n;return Jn({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:s,feePayerAddress:i})}return Jn({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:i})}function ts(n){return n.withFeePayer===!0}function ns(n){return"secondarySignerAddresses"in n}function No(n){let{transaction:t}=n;return er(t)}function An(n){return Io({...n})}async function tr(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=Eo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:c}=await Ge({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 hn(n){let{aptosConfig:t}=n,e=Ro({...n}),{data:r}=await Ge({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function _t(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=An({signer:e,transaction:r});return hn({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function zo(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(c=>h.U8(c));return await U({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)]},options:i})}async function Oo(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await ee({aptosConfig:t,accountAddress:e.accountAddress}),i=_e.fromPrivateKey({privateKey:r,legacy:!0}),a=new sn({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),c=e.sign(a),d=i.sign(a),f=await U({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new N(e.signingScheme.valueOf()),h.U8(e.publicKey.toUint8Array()),new N(i.signingScheme.valueOf()),h.U8(i.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(d.toUint8Array())]}});return await _t({aptosConfig:t,signer:e,transaction:f})}async function Go(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:i,options:s}=n,a=_nullishCoalesce(i, () => (Ft));return await U({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[a],functionArguments:[r,o]},options:s})}var St=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Go({aptosConfig:this.config,...t})}};async function Bo(n){let{aptosConfig:t,options:e,creator:r}=n;return await U({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new E(n.collection),new E(n.description),new E(n.name),new E(n.uri),h.MoveString([]),h.MoveString([]),new h([])]},options:e})}async function Mo(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await l({aptosConfig:t,query:{query:Zr,variables:{where_condition:r}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Do(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await l({aptosConfig:t,query:{query:zn,variables:{where_condition:r}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function Fo(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},i={query:zn,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 l({aptosConfig:t,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function qo(n){let{aptosConfig:t,tokenAddress:e,options:r}=n,o={token_data_id:{_eq:u.from(e).toStringLong()}},i={query:Yr,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 l({aptosConfig:t,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function Ko(n){let{aptosConfig:t,options:e,creator:r}=n;return await U({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new E(n.description),new I(_nullishCoalesce(n.maxSupply, () => (Pe))),new E(n.name),new E(n.uri),new v(_nullishCoalesce(n.mutableDescription, () => (!0))),new v(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new v(_nullishCoalesce(n.mutableURI, () => (!0))),new v(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new v(_nullishCoalesce(n.mutableTokenName, () => (!0))),new v(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new v(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new v(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new v(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new I(_nullishCoalesce(n.royaltyNumerator, () => (0))),new I(_nullishCoalesce(n.royaltyDenominator, () => (1)))]},options:e})}async function nr(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,i=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:i.toStringLong()}};return _optionalChain([o, 'optionalAccess', _98 => _98.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _99 => _99.tokenStandard]), () => ("v2"))}),(await l({aptosConfig:t,query:{query:Hr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function $o(n){return(await nr(n)).collection_id}var xt=class{constructor(t){this.config=t}async createCollectionTransaction(t){return Ko({aptosConfig:this.config,...t})}async getCollectionData(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(_optionalChain([t, 'access', _100 => _100.options, 'optionalAccess', _101 => _101.tokenStandard]))}),nr({aptosConfig:this.config,...t})}async getCollectionId(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(_optionalChain([t, 'access', _102 => _102.options, 'optionalAccess', _103 => _103.tokenStandard]))}),$o({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return Bo({aptosConfig:this.config,...t})}async getTokenData(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),Mo({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),Do({aptosConfig:this.config,...t})}async getOwnedTokens(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),Fo({aptosConfig:this.config,...t})}async getTokenActivity(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),qo({aptosConfig:this.config,...t})}};function at(n){switch(n){case"v1":return["token_processor"];case"v2":return["token_v2_processor"];default:return["token_processor","token_v2_processor"]}}async function Lo(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,i={account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}};return Tn({aptosConfig:e,options:{where:i}})}async function Ho(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', _104 => _104.orderBy])};return Tn({aptosConfig:e,options:a})}async function Tn(n){let{aptosConfig:t,options:e}=n,r={query:Wr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _105 => _105.where]),offset:_optionalChain([e, 'optionalAccess', _106 => _106.offset]),limit:_optionalChain([e, 'optionalAccess', _107 => _107.limit]),order_by:_optionalChain([e, 'optionalAccess', _108 => _108.orderBy])}};return(await l({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var vt=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["events_processor"]}),Lo({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["events_processor"]}),Ho({aptosConfig:this.config,...t})}async getEvents(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _109 => _109.minimumLedgerVersion]),processorTypes:["events_processor"]}),Tn({aptosConfig:this.config,...t})}};async function Vo(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _110 => _110.timeoutSecs])||Dt,{data:s}=await Cr({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Ke({aptosConfig:t,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _111 => _111.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Ct=class{constructor(t){this.config=t}async fundAccount(t){let e=await Vo({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.waitForIndexer])!==!1&&await rn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function rr(n){let{aptosConfig:t,options:e}=n,r={query:Xr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _114 => _114.where]),limit:_optionalChain([e, 'optionalAccess', _115 => _115.limit]),offset:_optionalChain([e, 'optionalAccess', _116 => _116.offset])}};return(await l({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Qo(n){let{aptosConfig:t,options:e}=n,r={query:jr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _117 => _117.where]),limit:_optionalChain([e, 'optionalAccess', _118 => _118.limit]),offset:_optionalChain([e, 'optionalAccess', _119 => _119.offset])}};return(await l({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Wo(n){let{aptosConfig:t,options:e}=n,r={query:Vr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _120 => _120.where]),limit:_optionalChain([e, 'optionalAccess', _121 => _121.limit]),offset:_optionalChain([e, 'optionalAccess', _122 => _122.offset])}};return(await l({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function jo(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:i,options:s}=n;return await U({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,i]},options:s})}var Pt=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _123 => _123.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),rr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _124 => _124.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),(await rr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _125 => _125.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),Qo({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _126 => _126.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),Wo({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return jo({aptosConfig:this.config,...t})}};var Ut=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 Jr({aptosConfig:this.config,...t})}async getBlockByHeight(t){return eo({aptosConfig:this.config,...t})}async getTableItem(t){return Xt({aptosConfig:this.config,...t})}async view(t){return Se({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return to({aptosConfig:this.config,...t})}async queryIndexer(t){return l({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Yt({aptosConfig:this.config})}async getProcessorStatus(t){return Zt({aptosConfig:this.config,processorType:t})}};var Xo=["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 Yo(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ce(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(!Yo(t))throw new Error(`${t} is not valid. ${Xo}`);if(e&&!Yo(e))throw new Error(`${e} is not valid. ${Xo}`);return{domainName:e||t,subdomainName:e?t:void 0}}var rs="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",os={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:rs,custom:null,devnet:null};function le(n){let t=os[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var is=n=>({vec:[n]}),ss=()=>({vec:[]}),or=n=>n!=null?is(n):ss(),bn=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Zo(n){let{aptosConfig:t,name:e}=n,r=le(t),{domainName:o,subdomainName:i}=Ce(e),s=await Se({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,or(i)]}}),a=bn(s[0]);return a?u.from(a).toString():void 0}async function Jo(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:c}=n,d=le(t),{domainName:f,subdomainName:k}=Ce(r),A=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(k&&!A)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(A&&!k)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let ar=_nullishCoalesce(e.years, () => (1));if(ar!==1)throw new Error("For now, names can only be registered for 1 year at a time");let fi=ar*31536e3;return await U({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[f,fi,i,s]},options:a})}if(!k)throw new Error(`${e.policy} requires a subdomain to be provided.`);let g=await ir({aptosConfig:t,name:f});if(!g)throw new Error("The domain does not exist");let dt=e.policy==="subdomain:independent"?e.expirationDate:g;if(dt>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await U({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[f,k,Math.round(dt/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,i,s]},options:a})}async function ir(n){let{aptosConfig:t,name:e}=n,r=le(t),{domainName:o,subdomainName:i}=Ce(e);try{let s=await Se({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,or(i)]}});return Number(s[0])*1e3}catch (e3){return}}async function ei(n){let{aptosConfig:t,address:e}=n,r=le(t),o=await Se({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),i=bn(o[1]),s=bn(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function ti(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,i=le(t);if(!r)return await U({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:s,subdomainName:a}=Ce(r);return await U({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function ni(n){let{aptosConfig:t,name:e}=n,r=le(t),{domainName:o,subdomainName:i}=Ce(e),s=await Se({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,or(i)]}}),a=bn(s[0]);return a?u.from(a).toString():void 0}async function ri(n){let{aptosConfig:t,sender:e,name:r,address:o,options:i}=n,s=le(t),{domainName:a,subdomainName:c}=Ce(r);return await U({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,o]},options:i})}async function oi(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Ce(e),a=(await l({aptosConfig:t,query:{query:Fe,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Et(a)),a}async function ii(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await sr({aptosConfig:t});return(await l({aptosConfig:t,originMethod:"getAccountNames",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _127 => _127.limit]),offset:_optionalChain([e, 'optionalAccess', _128 => _128.offset]),order_by:_optionalChain([e, 'optionalAccess', _129 => _129.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _130 => _130.options, 'optionalAccess', _131 => _131.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Et)}async function si(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await sr({aptosConfig:t});return(await l({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _132 => _132.limit]),offset:_optionalChain([e, 'optionalAccess', _133 => _133.offset]),order_by:_optionalChain([e, 'optionalAccess', _134 => _134.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Et)}async function ai(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await sr({aptosConfig:t});return(await l({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _137 => _137.limit]),offset:_optionalChain([e, 'optionalAccess', _138 => _138.offset]),order_by:_optionalChain([e, 'optionalAccess', _139 => _139.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _140 => _140.options, 'optionalAccess', _141 => _141.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Et)}async function ci(n){let{aptosConfig:t,options:e,domain:r}=n;return(await l({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _142 => _142.limit]),offset:_optionalChain([e, 'optionalAccess', _143 => _143.offset]),order_by:_optionalChain([e, 'optionalAccess', _144 => _144.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _145 => _145.options, 'optionalAccess', _146 => _146.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Et)}async function sr(n){let{aptosConfig:t}=n,e=le(t),[r]=await Se({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,i=()=>new Date;return new Date(i().setDate(i().getDate()-o)).toISOString()}async function ui(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:i}=n,s=le(t),a=o*31536e3,{domainName:c,subdomainName:d}=Ce(r);if(d)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await U({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:i})}function Et(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var It=class{constructor(t){this.config=t}async getOwnerAddress(t){return Zo({aptosConfig:this.config,...t})}async getExpiration(t){return ir({aptosConfig:this.config,...t})}async getTargetAddress(t){return ni({aptosConfig:this.config,...t})}async setTargetAddress(t){return ri({aptosConfig:this.config,...t})}async getPrimaryName(t){return ei({aptosConfig:this.config,...t})}async setPrimaryName(t){return ti({aptosConfig:this.config,...t})}async registerName(t){return Jo({aptosConfig:this.config,...t})}async renewDomain(t){return ui({aptosConfig:this.config,...t})}async getName(t){return oi({aptosConfig:this.config,...t})}async getAccountNames(t){return ii({aptosConfig:this.config,...t})}async getAccountDomains(t){return si({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return ai({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return ci({aptosConfig:this.config,...t})}};async function di(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),i=await l({aptosConfig:t,query:{query:kn,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function pi(n){let{aptosConfig:t,options:e}=n,r={query:kn,variables:{order_by:_optionalChain([e, 'optionalAccess', _147 => _147.orderBy])}};return(await l({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function li(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Qr,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await l({aptosConfig:t,query:o})).delegated_staking_activities}var Rt=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _148 => _148.minimumLedgerVersion]),processorTypes:["stake_processor"]}),di({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _149 => _149.minimumLedgerVersion]),processorTypes:["stake_processor"]}),pi({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _150 => _150.minimumLedgerVersion]),processorTypes:["stake_processor"]}),li({aptosConfig:this.config,...t})}};var kt=class{constructor(t){this.config=t}async getTransactions(t){return fo({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return Ao({aptosConfig:this.config,...t})}async getTransactionByHash(t){return nn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return ho({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ke({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return tn({aptosConfig:this.config})}getSigningMessage(t){return No(t)}};var wn=()=>Math.floor(Date.now()/1e3),_n= exports.AccountSequenceNumber =class{constructor(t,e,r,o,i){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=i}async nextSequenceNumber(){for(;this.lock;)await xe(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=wn();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await xe(this.sleepTime),wn()-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 xe(this.sleepTime);this.lock=!0;try{await this.update();let t=wn();for(;this.lastUncommintedNumber!==this.currentNumber;)wn()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await xe(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 ct=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _151 => _151.pendingDequeue, 'access', _152 => _152.shift, 'call', _153 => _153(), 'optionalAccess', _154 => _154.resolve, 'call', _155 => _155(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 ut("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},ut=class extends Error{};var gi="fulfilled",Sn= exports.TransactionWorker =class{constructor(t,e,r=30,o=100,i=10){this.taskQueue=new ct;this.transactionsQueue=new ct;this.outstandingTransactions=new ct;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new _n(t,e,r,o,i)}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=_t({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([r,t])}}catch(t){if(t instanceof ut)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 i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let a=i[s];o=e[s],a.status===gi?(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 ut)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let r=[];r.push(Ke({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(r);for(let i=0;i<o.length;i+=1){let s=o[i];s.status===gi?this.executedTransactions.push([s.value.hash,e,null]):this.executedTransactions.push([s.status,e,s.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 U({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 Nt=class{constructor(t){this.config=t}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t,i=new Sn(this.config,e);i.start();for(let s of r)await i.push(s,o)}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return _t({aptosConfig:this.config,signer:e,transaction:r})}async publishPackageTransaction(t){return zo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Oo({aptosConfig:this.config,...t})}};var zt=class{constructor(t){this.config=t}async transaction(t){return U({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return U({aptosConfig:this.config,...t})}};var Ot=class{constructor(t){this.config=t}transaction(t){return An({...t})}transactionAsFeePayer(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})}};var ke=class{constructor(t){this.config=t}async transaction(t){return tr({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return tr({aptosConfig:this.config,...t})}};G([mi],ke.prototype,"transaction",1),G([mi],ke.prototype,"multiAgentTransaction",1);function mi(n,t,e){let r=e.value;return e.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var Ne=class{constructor(t){this.config=t}async transaction(t){return hn({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return hn({aptosConfig:this.config,...t})}};G([yi],Ne.prototype,"transaction",1),G([yi],Ne.prototype,"multiAgentTransaction",1);function yi(n,t,e){let r=e.value;return e.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}var R=class{constructor(t){this.config=new on(t),this.account=new mt(this.config),this.ans=new It(this.config),this.coin=new St(this.config),this.digitalAsset=new xt(this.config),this.event=new vt(this.config),this.faucet=new Ct(this.config),this.fungibleAsset=new Pt(this.config),this.general=new Ut(this.config),this.staking=new Rt(this.config),this.transaction=new kt(this.config),this.transactionSubmission=new Nt(this.config),this.build=new zt(this.config),this.sign=new Ot(this.config),this.simulate=new ke(this.config),this.submit=new Ne(this.config)}};function O(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...i){return this[e][r](...i)},Object.defineProperty(n.prototype,r,o))})}O(R,mt,"account");O(R,It,"ans");O(R,St,"coin");O(R,xt,"digitalAsset");O(R,vt,"event");O(R,Ct,"faucet");O(R,Pt,"fungibleAsset");O(R,Ut,"general");O(R,Rt,"staking");O(R,kt,"transaction");O(R,Nt,"transactionSubmission");O(R,zt,"build");O(R,Ot,"sign");O(R,ke,"simulate");O(R,Ne,"submit");exports.APTOS_BIP44_REGEX = Ni; exports.APTOS_COIN = Ft; exports.APTOS_HARDENED_REGEX = ki; exports.Account = _e; exports.AccountAddress = u; exports.AccountAuthenticator = M; exports.AccountAuthenticatorEd25519 = ae; exports.AccountAuthenticatorMultiEd25519 = an; exports.AccountAuthenticatorMultiKey = $e; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = gr; exports.AccountSequenceNumber = _n; exports.AddressInvalidReason = Ei; exports.AnyPublicKey = S; exports.AnyPublicKeyVariant = mr; exports.AnySignature = se; exports.AnySignatureVariant = yr; exports.Aptos = R; exports.AptosApiError = re; exports.AptosApiType = Mt; exports.AptosConfig = on; exports.AuthenticationKey = J; exports.Bool = v; exports.CKDPriv = Nr; exports.ChainId = We; exports.DEFAULT_MAX_GAS_AMOUNT = wr; exports.DEFAULT_NETWORK = br; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = _r; exports.DEFAULT_TXN_TIMEOUT_SEC = Dt; exports.DeriveScheme = _i; exports.Deserializer = Ur; exports.Ed25519PrivateKey = Ae; exports.Ed25519PublicKey = b; exports.Ed25519Signature = C; exports.EntryFunction = it; exports.EntryFunctionBytes = Lt; exports.FeePayerRawTransaction = pe; exports.FixedBytes = Ee; exports.HARDENED_OFFSET = Ir; exports.Hex = m; exports.HexInvalidReason = Ci; exports.Identifier = x; exports.KeyType = zi; exports.MimeType = xn; exports.ModuleId = yt; exports.MoveAbility = bi; exports.MoveFunctionVisibility = Ti; exports.MoveOption = me; exports.MoveString = E; exports.MoveVector = h; exports.MultiAgentRawTransaction = de; exports.MultiEd25519PublicKey = Y; exports.MultiEd25519Signature = Me; exports.MultiKey = De; exports.MultiSig = bt; exports.MultisigTransactionPayload = wt; exports.Network = Bt; exports.NetworkToChainId = Pn; exports.NetworkToFaucetAPI = Tr; exports.NetworkToIndexerAPI = Cn; exports.NetworkToNetworkName = Os; exports.NetworkToNodeAPI = hr; exports.ParsingError = B; exports.PrivateKey = Be; exports.ProcessorType = ze; exports.PublicKey = F; exports.RAW_TRANSACTION_SALT = Sr; exports.RAW_TRANSACTION_WITH_DATA_SALT = Un; exports.RawTransaction = W; exports.RawTransactionWithData = un; exports.RoleType = wi; exports.RotationProofChallenge = sn; exports.Script = Tt; exports.ScriptTransactionArgumentVariants = pt; exports.Secp256k1PrivateKey = be; exports.Secp256k1PublicKey = Q; exports.Secp256k1Signature = we; exports.Serializable = p; exports.Serializer = j; exports.Signature = X; exports.SignedTransaction = ne; exports.SigningScheme = lt; exports.SigningSchemeInput = fr; exports.StructTag = ue; exports.TransactionAuthenticator = ce; exports.TransactionAuthenticatorEd25519 = Le; exports.TransactionAuthenticatorFeePayer = Ve; exports.TransactionAuthenticatorMultiAgent = He; exports.TransactionAuthenticatorMultiEd25519 = qn; exports.TransactionAuthenticatorSingleSender = Qe; exports.TransactionAuthenticatorVariant = lr; exports.TransactionPayload = Re; exports.TransactionPayloadEntryFunction = At; exports.TransactionPayloadMultisig = ht; exports.TransactionPayloadScript = ft; exports.TransactionPayloadVariants = dr; exports.TransactionResponseType = vn; exports.TransactionVariants = pr; exports.TransactionWorker = Sn; exports.TypeTag = P; exports.TypeTagAddress = nt; exports.TypeTagBool = je; exports.TypeTagGeneric = rt; exports.TypeTagParserError = w; exports.TypeTagParserErrorType = Hi; exports.TypeTagReference = cn; exports.TypeTagSigner = Ie; exports.TypeTagStruct = ve; exports.TypeTagU128 = et; exports.TypeTagU16 = Ye; exports.TypeTagU256 = tt; exports.TypeTagU32 = Ze; exports.TypeTagU64 = Je; exports.TypeTagU8 = Xe; exports.TypeTagVariants = ur; exports.TypeTagVector = ot; exports.U128 = H; exports.U16 = $; exports.U256 = V; exports.U32 = L; exports.U64 = I; exports.U8 = N; exports.aptosCoinStructTag = np; exports.aptosRequest = Gt; exports.buildTransaction = Jn; exports.checkOrConvertArgument = mn; exports.convertArgument = Po; exports.deriveKey = Rn; exports.deriveTransactionType = ko; exports.deserializeFromScriptArgument = Ki; exports.ensureBoolean = In; exports.fetchEntryFunctionAbi = Co; exports.findFirstNonSignerArg = xo; exports.generateMultiSignersSignedTransaction = Zi; exports.generateRawTransaction = Yi; exports.generateSignedTransaction = Ro; exports.generateSignedTransactionForSimulation = Eo; exports.generateSigningMessage = er; exports.generateTransactionPayload = fn; exports.generateTransactionPayloadWithABI = Xi; exports.get = xr; exports.getAptosFullNode = D; exports.getAuthenticatorForSimulation = yn; exports.getFunctionParts = Zn; exports.isBcsAddress = gn; exports.isBcsBool = $n; exports.isBcsFixedBytes = Vi; exports.isBcsString = Ln; exports.isBcsU128 = jn; exports.isBcsU16 = Vn; exports.isBcsU256 = Xn; exports.isBcsU32 = Qn; exports.isBcsU64 = Wn; exports.isBcsU8 = Hn; exports.isBlockMetadataTransactionResponse = fs; exports.isBool = wo; exports.isEd25519Signature = hs; exports.isEncodedEntryFunctionArgument = So; exports.isFeePayerSignature = ws; exports.isGenesisTransactionResponse = ys; exports.isLargeNumber = ln; exports.isMultiAgentSignature = bs; exports.isMultiEd25519Signature = _s; exports.isNull = _o; exports.isNumber = pn; exports.isPendingTransactionResponse = gs; exports.isScriptDataInput = Yn; exports.isSecp256k1Signature = Ts; exports.isStateCheckpointTransactionResponse = As; exports.isString = st; exports.isUserTransactionResponse = ms; exports.isValidBIP44Path = Rr; exports.isValidHardenedPath = kr; exports.mnemonicToSeed = Ht; exports.objectStructTag = ip; exports.optionStructTag = op; exports.outOfRangeErrorMessage = Pi; exports.paginateWithCursor = Oe; exports.parseTypeTag = Kn; exports.post = En; exports.postAptosFaucet = Cr; exports.postAptosFullNode = Ge; exports.postAptosIndexer = vr; exports.request = Si; exports.sign = Io; exports.splitPath = zr; exports.standardizeTypeTags = vo; exports.stringStructTag = rp; exports.throwTypeMismatch = _; exports.validateNumberInRange = ge;
426
+ `;async function jt(n){let{aptosConfig:t}=n,{data:e}=await D({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function eo(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 to(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 Ge({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _26 => _26.ledgerVersion])},body:r})).data}async function Se(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Ge({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 no(n){let{aptosConfig:t,limit:e}=n;return(await l({aptosConfig:t,query:{query:Hr,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function l(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await Cr({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Ki(n){let{aptosConfig:t}=n;return(await l({aptosConfig:t,query:{query:Nn},originMethod:"getProcessorStatuses"})).processor_status}async function Yt(n){return(await Ki({aptosConfig:n.aptosConfig}))[0].last_success_version}async function Zt(n){let{aptosConfig:t,processorType:e}=n,r={processor:{_eq:e.valueOf()}};return(await l({aptosConfig:t,query:{query:Nn,variables:{where_condition:r}},originMethod:"getProcessorStatus"})).processor_status[0]}var On=new Map;function qe(n,t,e){return async(...r)=>{if(On.has(t)){let{value:i,timestamp:s}=On.get(t);if(e===void 0||Date.now()-s<=e)return i}let o=await n(...r);return On.set(t,{value:o,timestamp:Date.now()}),o}}var se=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 P)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof we)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(P.load(e));case 1:return new n(we.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 Oe({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?ro(n):qe(async()=>ro(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function ro(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:i}=await D({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _33 => _33.ledgerVersion])}});return i}async function so(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Oe({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 ao(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Oe({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:i}=await D({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _39 => _39.ledgerVersion])}});return i.data}async function Bn(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:i}}=o,s=u.from(e);try{let a=await Xt({aptosConfig:t,handle:i,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof re&&a.data.error_code==="table_item_not_found")return s;throw a}}async function co(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await l({aptosConfig:t,query:{query:$r,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function uo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _40 => _40.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _41 => _41.tokenStandard])});let s={query:qr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _42 => _42.offset]),limit:_optionalChain([r, 'optionalAccess', _43 => _43.limit]),order_by:_optionalChain([r, 'optionalAccess', _44 => _44.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function po(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,i=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _45 => _45.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _46 => _46.tokenStandard])});let c={query:Kr,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 l({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function lo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _50 => _50.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _51 => _51.tokenStandard])}});let s={query:Dr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _52 => _52.offset]),limit:_optionalChain([r, 'optionalAccess', _53 => _53.limit]),order_by:_optionalChain([r, 'optionalAccess', _54 => _54.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function go(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),i=await l({aptosConfig:t,query:{query:Lr,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return i.account_transactions_aggregate.aggregate?i.account_transactions_aggregate.aggregate.count:0}async function Mn(n){let{aptosConfig:t,accountAddress:e,coinType:r}=n,o=u.from(e).toStringLong(),i=await Dn({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:r}}}});return i[0]?i[0].amount:0}async function Dn(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o=u.from(e).toStringLong(),i={..._optionalChain([r, 'optionalAccess', _55 => _55.where]),owner_address:{_eq:o}},s={query:Mr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([r, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([r, 'optionalAccess', _58 => _58.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function mo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),i=await l({aptosConfig:t,query:{query:Br,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function yo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()}},s={query:Fr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.limit]),order_by:_optionalChain([r, 'optionalAccess', _61 => _61.orderBy])}};return(await l({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function fo(n){let{aptosConfig:t,privateKey:e}=n,r=new S(e.publicKey());if(e instanceof be){let i=J.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return _e.fromPrivateKeyAndAddress({privateKey:e,address:i})}if(e instanceof Ae){let o=J.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await oo({authKey:o,aptosConfig:t})){let c=o.derivedAddress();return _e.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!1})}let s=J.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await oo({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return _e.fromPrivateKeyAndAddress({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function oo(n){let{aptosConfig:t,authKey:e}=n,r=await Bn({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 xe(n){return new Promise(t=>{setTimeout(t,n)})}async function Ao(n){let{aptosConfig:t,options:e}=n;return Oe({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 qe(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 ho(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 To(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 Ke(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.timeoutSecs]), () => (Dt)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _66 => _66.checkSuccess]), () => (!0)),s=!0,a=0,c,d,f=200,k=1.5;for(;s&&!(a>=o);){try{if(c=await nn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(A){if(!(A instanceof re)||(d=A,A.status!==404&&A.status>=400&&A.status<500))throw A}await xe(f),a+=f/1e3,f*=k}if(c===void 0)throw d||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(!i)return c;if(!c.success)throw new Fn(`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,i=new Date().getTime(),s=-1;for(;s<r;){if(new Date().getTime()-i>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?s=await Yt({aptosConfig:t}):s=(await Zt({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await xe(200)}}var en=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Fn=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function y(n){if(n.minimumLedgerVersion!==void 0){let t=[];for(let e of n.processorTypes)t.push(rn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:e}));await Promise.all(t)}}var mt=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 so({aptosConfig:this.config,...t})}async getAccountResources(t){return ao({aptosConfig:this.config,...t})}async getAccountResource(t){return Gn({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Bn({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),co({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),uo({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),po({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),lo({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),go({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Dn({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),mo({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Mn({aptosConfig:this.config,coinType:Ft,...t})}async getAccountCoinAmount(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Mn({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),yo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return fo({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]), () => (wr)),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 Tr[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 br[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 p{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new E("account");this.structName=new E("RotationProofChallenge");this.sequenceNumber=new I(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=h.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 M=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ae.load(t);case 1:return an.load(t);case 2:return te.load(t);case 3:return $e.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof ae}isMultiEd25519(){return this instanceof an}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof $e}},ae= exports.AccountAuthenticatorEd25519 =class n extends M{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=b.deserialize(e),o=P.deserialize(e);return new n(r,o)}},an= exports.AccountAuthenticatorMultiEd25519 =class n extends M{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=Me.deserialize(e);return new n(r,o)}},te= exports.AccountAuthenticatorSingleKey =class n extends M{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=S.deserialize(e),o=se.deserialize(e);return new n(r,o)}},$e= exports.AccountAuthenticatorMultiKey =class n extends M{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=De.deserialize(e),o=e.deserializeVector(se),i=e.deserializeBytes();return new n(r,o,i)}};var ce=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Le.load(t);case 1:return qn.load(t);case 2:return He.load(t);case 3:return Ve.load(t);case 4:return Qe.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},Le= exports.TransactionAuthenticatorEd25519 =class n extends ce{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=b.deserialize(e),o=P.deserialize(e);return new n(r,o)}},qn= exports.TransactionAuthenticatorMultiEd25519 =class n extends ce{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=Y.deserialize(e),o=Me.deserialize(e);return new n(r,o)}},He= exports.TransactionAuthenticatorMultiAgent =class n extends ce{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=M.deserialize(e),o=e.deserializeVector(u),i=e.deserializeVector(M);return new n(r,o,i)}},Ve= exports.TransactionAuthenticatorFeePayer =class n extends ce{constructor(e,r,o,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=i}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=M.deserialize(e),o=e.deserializeVector(u),i=e.deserializeVector(M),s=u.deserialize(e),a=M.deserialize(e),c={address:s,authenticator:a};return new n(r,o,i,c)}},Qe= exports.TransactionAuthenticatorSingleSender =class n extends ce{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=M.deserialize(e);return new n(r)}};var We=class n extends p{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var x=class n extends p{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var yt=class n extends p{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 x(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),o=x.deserialize(e);return new n(r,o)}};var U=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return je.load(t);case 1:return Xe.load(t);case 2:return Je.load(t);case 3:return et.load(t);case 4:return nt.load(t);case 5:return Ie.load(t);case 6:return ot.load(t);case 7:return ve.load(t);case 8:return Ye.load(t);case 9:return Ze.load(t);case 10:return tt.load(t);case 255:return rt.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof je}isAddress(){return this instanceof nt}isGeneric(){return this instanceof rt}isSigner(){return this instanceof Ie}isVector(){return this instanceof ot}isStruct(){return this instanceof ve}isU8(){return this instanceof Xe}isU16(){return this instanceof Ye}isU32(){return this instanceof Ze}isU64(){return this instanceof Je}isU128(){return this instanceof et}isU256(){return this instanceof tt}},je= exports.TypeTagBool =class n extends U{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Xe= exports.TypeTagU8 =class n extends U{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Ye= exports.TypeTagU16 =class n extends U{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Ze= exports.TypeTagU32 =class n extends U{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Je= exports.TypeTagU64 =class n extends U{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},et= exports.TypeTagU128 =class n extends U{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},tt= exports.TypeTagU256 =class n extends U{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},nt= exports.TypeTagAddress =class n extends U{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},Ie= exports.TypeTagSigner =class n extends U{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},cn= exports.TypeTagReference =class n extends U{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=U.deserialize(e);return new n(r)}},rt= exports.TypeTagGeneric =class n extends U{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)}},ot= exports.TypeTagVector =class n extends U{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=U.deserialize(e);return new n(r)}},ve= exports.TypeTagStruct =class n extends U{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=ue.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")}},ue= exports.StructTag =class n extends p{constructor(e,r,o,i){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=i}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=x.deserialize(e),i=x.deserialize(e),s=e.deserializeVector(U);return new n(r,o,i,s)}};function rp(){return new ue(u.ONE,new x("aptos_coin"),new x("AptosCoin"),[])}function op(){return new ue(u.ONE,new x("string"),new x("String"),[])}function ip(n){return new ue(u.ONE,new x("option"),new x("Option"),[n])}function sp(n){return new ue(u.ONE,new x("object"),new x("Object"),[n])}function Li(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return N.deserialize(n);case 1:return I.deserialize(n);case 2:return H.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,N);case 5:return C.deserialize(n);case 6:return $.deserialize(n);case 7:return L.deserialize(n);case 8:return V.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Re=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ft.load(t);case 2:return At.load(t);case 3:return ht.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},ft= exports.TransactionPayloadScript =class n extends Re{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=Tt.deserialize(e);return new n(r)}},At= exports.TransactionPayloadEntryFunction =class n extends Re{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)}},ht= exports.TransactionPayloadMultisig =class n extends Re{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=bt.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(yt.fromStr(t),new x(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=yt.deserialize(t),r=x.deserialize(t),o=t.deserializeVector(U),i=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let c=t.deserializeUleb128AsU32(),d=Lt.deserialize(t,c);s.push(d)}return new n(e,r,o,s)}},Tt= 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(U),o=t.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=Li(t);i.push(a)}return new n(e,r,i)}},bt= 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=wt.deserialize(t)),new n(e,o)}},wt= 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 p{constructor(e,r,o,i,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=u.deserialize(e),o=e.deserializeU64(),i=Re.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),d=We.deserialize(e);return new n(r,o,i,s,a,c,d)}},un= exports.RawTransactionWithData =class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return de.load(t);case 1:return pe.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)}},pe= 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),i=u.deserialize(e);return new n(r,o,i)}};var ne=class n extends p{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=ce.deserialize(e);return new n(r,o)}};function bo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function wo(n){return!!n.match(/\s/)}function Hi(n){return!!n.match(/^T[0-9]+$/)}function Vi(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!wo(r))break}return e}var Qi=(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))(Qi||{}),w= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Kn(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _73 => _73.allowGenerics]), () => (!1)),r=[],o=[],i=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:i}),a="",i=[],c=1;else if(d===">"){if(a!==""){let dt=dn(a,o,e);i.push(dt)}let f=r.pop();if(f===void 0)throw new w(n,"unexpected '>'");if(c!==i.length)throw new w(n,"type argument count doesn't match expected amount");let{savedStr:k,savedTypes:A,savedExpectedTypes:g}=f;o=i,i=A,a=k,c=g}else if(d===","){if(a.length!==0){let f=dn(a,o,e);o=[],i.push(f),a="",c+=1}}else if(wo(d)){let f=!1;if(a.length!==0){let A=dn(a,o,e);o=[],i.push(A),a="",f=!0}s=Vi(n,s);let k=n[s];if(s<n.length&&f&&k!==","&&k!==">")throw new w(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new w(n,"no matching '>' for '<'");switch(i.length){case 0:return dn(a,o,e);case 1:if(a==="")return i[0];throw new w(n,"unexpected ','");default:throw new w(n,"unexpected whitespace character")}}function dn(n,t,e){switch(n){case"&signer":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new cn(new Ie);case"signer":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Ie;case"bool":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new je;case"address":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new nt;case"u8":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Xe;case"u16":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Ye;case"u32":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Ze;case"u64":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new Je;case"u128":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new et;case"u256":if(t.length>0)throw new w(n,"primitive types not expected to have type arguments");return new tt;case"vector":if(t.length!==1)throw new w(n,"vector type expected to have exactly one type argument");return new ot(t[0]);default:if(Hi(n)){if(e)return new rt(Number(n.split("T")[1]));throw new w(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new w(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new w(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!bo(r[1]))throw new w(n,"module name must only contain alphanumeric or '_' characters");if(!bo(r[2]))throw new w(n,"struct name must only contain alphanumeric or '_' characters");return new ve(new ue(u.fromString(r[0]),new x(r[1]),new x(r[2]),t))}}function _o(n){return typeof n=="boolean"}function st(n){return typeof n=="string"}function pn(n){return typeof n=="number"}function ln(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function So(n){return n==null}function xo(n){return $n(n)||Hn(n)||Vn(n)||Qn(n)||Wn(n)||jn(n)||Xn(n)||gn(n)||Ln(n)||Wi(n)||n instanceof h||n instanceof me}function $n(n){return n instanceof C}function gn(n){return n instanceof u}function Ln(n){return n instanceof E}function Wi(n){return n instanceof Ee}function Hn(n){return n instanceof N}function Vn(n){return n instanceof $}function Qn(n){return n instanceof L}function Wn(n){return n instanceof I}function jn(n){return n instanceof H}function Xn(n){return n instanceof V}function Yn(n){return"bytecode"in n}function _(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function vo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Zn(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}}function Co(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _74 => _74.map, 'call', _75 => _75(t=>st(t)?Kn(t):t)]), () => ([]))}async function Po(n,t,e,r){let i=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(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let s=vo(i),a=[];for(let c=s;c<i.params.length;c+=1)a.push(Kn(i.params[c],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:a}}function Uo(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let i=t.parameters[r];return mn(e,i,r,o)}function mn(n,t,e,r){return xo(n)?(Jn(t,n,e),n):ji(n,t,e,r)}function ji(n,t,e,r){if(t.isBool()){if(_o(n))return new C(n);_("boolean",e)}if(t.isAddress()){if(st(n))return u.fromString(n);_("string | AccountAddress",e)}if(t.isU8()){if(pn(n))return new N(n);_("number",e)}if(t.isU16()){if(pn(n))return new $(n);_("number",e)}if(t.isU32()){if(pn(n))return new L(n);_("number",e)}if(t.isU64()){if(ln(n))return new I(BigInt(n));_("bigint | number | string",e)}if(t.isU128()){if(ln(n))return new H(BigInt(n));_("bigint | number | string",e)}if(t.isU256()){if(ln(n))return new V(BigInt(n));_("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 mn(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()){if(st(n))try{return h.U8(m.fromHexInput(n).toUint8Array())}catch (e2){throw new Error(`vector<u8> must be passed in as a hex string or a Uint8array, type '${t.toString()}'`)}if(n instanceof Uint8Array)return h.U8(n)}if(Array.isArray(n))return new h(n.map(o=>mn(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(st(n))return new E(n);_("string",e)}if(t.isObject()){if(st(n))return u.fromString(n);_("string | AccountAddress",e)}if(t.isOption())return So(n)?new me(null):new me(mn(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 Jn(n,t,e){if(n.isBool()){if($n(t))return;_("Bool",e)}if(n.isAddress()){if(gn(t))return;_("AccountAddress",e)}if(n.isU8()){if(Hn(t))return;_("U8",e)}if(n.isU16()){if(Vn(t))return;_("U16",e)}if(n.isU32()){if(Qn(t))return;_("U32",e)}if(n.isU64()){if(Wn(t))return;_("U64",e)}if(n.isU128()){if(jn(t))return;_("U128",e)}if(n.isU256()){if(Xn(t))return;_("U256",e)}if(n.isVector()){if(t instanceof h){t.values.length>0&&Jn(n.value,t.values[0],e);return}_("MoveVector",e)}if(n instanceof ve){if(n.isString()){if(Ln(t))return;_("MoveString",e)}if(n.isObject()){if(gn(t))return;_("AccountAddress",e)}if(n.isOption()){if(t instanceof me){t.value!==void 0&&Jn(n.value.typeArgs[0],t.value,e);return}_("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function fn(n){if(Yn(n))return Eo(n);let{moduleAddress:t,moduleName:e,functionName:r}=Zn(n.function),o=await qe(async()=>Po(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Yi(n,o)}function Yi(n,t){if(Yn(n))return Eo(n);let{moduleAddress:e,moduleName:r,functionName:o}=Zn(n.function),i=Co(n.typeArguments);if(i.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${i.length}`);let s=n.functionArguments.map((c,d)=>Uo(n.function,t,c,d,i));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${s.length}`);let a=it.build(`${e}::${r}`,o,i,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new ht(new bt(c,new wt(a)))}return new At(a)}function Eo(n){return new ft(new Tt(m.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Zi(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _80 => _80.accountSequenceNumber])!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):ee({aptosConfig:t,accountAddress:e}),s=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:d},{gas_estimate:f}]=await Promise.all([i,s,a]),{maxGasAmount:k,gasUnitPrice:A,expireTimestamp:g}={maxGasAmount:_optionalChain([o, 'optionalAccess', _82 => _82.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(_r),gasUnitPrice:BigInt(f),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Sr),...o};return new W(u.from(e),BigInt(c),r,BigInt(k),BigInt(A),BigInt(g),new We(d))}async function er(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=await Zi({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let s=_nullishCoalesce(_optionalChain([n, 'access', _83 => _83.secondarySignerAddresses, 'optionalAccess', _84 => _84.map, 'call', _85 => _85(a=>u.from(a))]), () => ([]));return{rawTransaction:i,secondarySignerAddresses:s,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}return{rawTransaction:i,feePayerAddress:n.feePayerAddress?u.from(n.feePayerAddress):void 0}}function Io(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=yn(t);if(e.feePayerAddress){let a=new pe(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(k=>yn(k)));let d=yn(o),f=new Ve(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:d});return new ne(a.raw_txn,f).bcsToBytes()}if(e.secondarySignerAddresses){let a=new de(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(f=>yn(f));let d=new He(i,e.secondarySignerAddresses,c);return new ne(a.raw_txn,d).bcsToBytes()}let s;if(i instanceof ae)s=new Le(i.public_key,i.signature);else if(i instanceof te)s=new Qe(i);else throw new Error("Invalid public key");return new ne(e.rawTransaction,s).bcsToBytes()}function yn(n){if(n instanceof S){if(n.publicKey instanceof b)return new te(n,new se(new P(new Uint8Array(64))));if(n.publicKey instanceof Q)return new te(n,new se(new we(new Uint8Array(64))))}return new ae(new b(n.toUint8Array()),new P(new Uint8Array(64)))}function Ro(n){let{signer:t,transaction:e}=n,r=tr(e),o=t.sign(r);switch(t.signingScheme){case 0:return new ae(new b(t.publicKey.toUint8Array()),new P(o.toUint8Array()));case 2:if(!S.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new te(t.publicKey,new se(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function ko(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,i=No(t);if((r||o)&&(i instanceof de||i instanceof pe))return Ji(i,e,r,o);if(e instanceof ae&&i instanceof W){let s=new Le(e.public_key,e.signature);return new ne(i,s).bcsToBytes()}if((e instanceof te||e instanceof $e)&&i instanceof W){let s=new Qe(e);return new ne(i,s).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function No(n){return n.feePayerAddress?new pe(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new de(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Ji(n,t,e,r){if(n instanceof pe){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new Ve(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 tr(n){let t=No(n),e=_sha3.sha3_256.create();if(t instanceof W)e.update(xr);else if(t instanceof de)e.update(Un);else if(t instanceof pe)e.update(Un);else throw new Error(`Unknown transaction type to sign on: ${t}`);let r=e.digest(),o=t.bcsToBytes(),i=new Uint8Array(r.length+o.length);return i.set(r),i.set(o,r.length),i}async function v(n){let t=await es(n);return ts(n,t)}async function es(n){let{aptosConfig:t,data:e}=n,r,o;return"bytecode"in e?(r=e,o=await fn(r)):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await fn(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await fn(r)),o}async function ts(n,t){let{aptosConfig:e,sender:r,options:o}=n,i;if(ns(n)&&(i=u.ZERO.toString()),rs(n)){let{secondarySignerAddresses:s}=n;return er({aptosConfig:e,sender:r,payload:t,options:o,secondarySignerAddresses:s,feePayerAddress:i})}return er({aptosConfig:e,sender:r,payload:t,options:o,feePayerAddress:i})}function ns(n){return n.withFeePayer===!0}function rs(n){return"secondarySignerAddresses"in n}function zo(n){let{transaction:t}=n;return tr(t)}function An(n){return Ro({...n})}async function nr(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=Io({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:c}=await Ge({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 hn(n){let{aptosConfig:t}=n,e=ko({...n}),{data:r}=await Ge({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function _t(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=An({signer:e,transaction:r});return hn({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function Oo(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(c=>h.U8(c));return await v({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)]},options:i})}async function Go(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await ee({aptosConfig:t,accountAddress:e.accountAddress}),i=_e.fromPrivateKey({privateKey:r,legacy:!0}),a=new sn({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),c=e.sign(a),d=i.sign(a),f=await v({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new N(e.signingScheme.valueOf()),h.U8(e.publicKey.toUint8Array()),new N(i.signingScheme.valueOf()),h.U8(i.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(d.toUint8Array())]}});return await _t({aptosConfig:t,signer:e,transaction:f})}async function Bo(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:i,options:s}=n,a=_nullishCoalesce(i, () => (Ft));return await v({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[a],functionArguments:[r,o]},options:s})}var St=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Bo({aptosConfig:this.config,...t})}};async function Mo(n){let{aptosConfig:t,options:e,creator:r}=n;return await v({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new E(n.collection),new E(n.description),new E(n.name),new E(n.uri),h.MoveString([]),h.MoveString([]),new h([])]},options:e})}async function Do(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await l({aptosConfig:t,query:{query:Jr,variables:{where_condition:r}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Fo(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await l({aptosConfig:t,query:{query:zn,variables:{where_condition:r}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function qo(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},i={query:zn,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 l({aptosConfig:t,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function Ko(n){let{aptosConfig:t,tokenAddress:e,options:r}=n,o={token_data_id:{_eq:u.from(e).toStringLong()}},i={query:Zr,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 l({aptosConfig:t,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function $o(n){let{aptosConfig:t,options:e,creator:r}=n;return await v({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new E(n.description),new I(_nullishCoalesce(n.maxSupply, () => (Pe))),new E(n.name),new E(n.uri),new C(_nullishCoalesce(n.mutableDescription, () => (!0))),new C(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new C(_nullishCoalesce(n.mutableURI, () => (!0))),new C(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new C(_nullishCoalesce(n.mutableTokenName, () => (!0))),new C(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new C(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new C(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new C(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new I(_nullishCoalesce(n.royaltyNumerator, () => (0))),new I(_nullishCoalesce(n.royaltyDenominator, () => (1)))]},options:e})}async function rr(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,i=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:i.toStringLong()}};return _optionalChain([o, 'optionalAccess', _98 => _98.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _99 => _99.tokenStandard]), () => ("v2"))}),(await l({aptosConfig:t,query:{query:Vr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Lo(n){return(await rr(n)).collection_id}async function Ho(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:o,digitalAssetType:i,options:s}=n;return await v({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(i, () => ("0x4::token::Token"))],functionArguments:[r,o]},options:s})}var xt=class{constructor(t){this.config=t}async createCollectionTransaction(t){return $o({aptosConfig:this.config,...t})}async getCollectionData(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(_optionalChain([t, 'access', _100 => _100.options, 'optionalAccess', _101 => _101.tokenStandard]))}),rr({aptosConfig:this.config,...t})}async getCollectionId(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(_optionalChain([t, 'access', _102 => _102.options, 'optionalAccess', _103 => _103.tokenStandard]))}),Lo({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return Mo({aptosConfig:this.config,...t})}async getTokenData(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),Do({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),Fo({aptosConfig:this.config,...t})}async getOwnedTokens(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),qo({aptosConfig:this.config,...t})}async getTokenActivity(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:at(void 0)}),Ko({aptosConfig:this.config,...t})}async transferDigitalAsset(t){return Ho({aptosConfig:this.config,...t})}};function at(n){switch(n){case"v1":return["token_processor"];case"v2":return["token_v2_processor"];default:return["token_processor","token_v2_processor"]}}async function Vo(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,i={account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}};return Tn({aptosConfig:e,options:{where:i}})}async function Qo(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', _104 => _104.orderBy])};return Tn({aptosConfig:e,options:a})}async function Tn(n){let{aptosConfig:t,options:e}=n,r={query:jr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _105 => _105.where]),offset:_optionalChain([e, 'optionalAccess', _106 => _106.offset]),limit:_optionalChain([e, 'optionalAccess', _107 => _107.limit]),order_by:_optionalChain([e, 'optionalAccess', _108 => _108.orderBy])}};return(await l({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var vt=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["events_processor"]}),Vo({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await y({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["events_processor"]}),Qo({aptosConfig:this.config,...t})}async getEvents(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _109 => _109.minimumLedgerVersion]),processorTypes:["events_processor"]}),Tn({aptosConfig:this.config,...t})}};async function Wo(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _110 => _110.timeoutSecs])||Dt,{data:s}=await Pr({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Ke({aptosConfig:t,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _111 => _111.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Ct=class{constructor(t){this.config=t}async fundAccount(t){let e=await Wo({aptosConfig:this.config,...t});return _optionalChain([t, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.waitForIndexer])!==!1&&await rn({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function or(n){let{aptosConfig:t,options:e}=n,r={query:Yr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _114 => _114.where]),limit:_optionalChain([e, 'optionalAccess', _115 => _115.limit]),offset:_optionalChain([e, 'optionalAccess', _116 => _116.offset])}};return(await l({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function jo(n){let{aptosConfig:t,options:e}=n,r={query:Xr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _117 => _117.where]),limit:_optionalChain([e, 'optionalAccess', _118 => _118.limit]),offset:_optionalChain([e, 'optionalAccess', _119 => _119.offset])}};return(await l({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Xo(n){let{aptosConfig:t,options:e}=n,r={query:Qr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _120 => _120.where]),limit:_optionalChain([e, 'optionalAccess', _121 => _121.limit]),offset:_optionalChain([e, 'optionalAccess', _122 => _122.offset])}};return(await l({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function Yo(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:o,amount:i,options:s}=n;return await v({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,o,i]},options:s})}var Pt=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _123 => _123.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),or({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _124 => _124.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),(await or({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _125 => _125.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),jo({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _126 => _126.minimumLedgerVersion]),processorTypes:["fungible_asset_processor"]}),Xo({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Yo({aptosConfig:this.config,...t})}};var Ut=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 eo({aptosConfig:this.config,...t})}async getBlockByHeight(t){return to({aptosConfig:this.config,...t})}async getTableItem(t){return Xt({aptosConfig:this.config,...t})}async view(t){return Se({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return no({aptosConfig:this.config,...t})}async queryIndexer(t){return l({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Yt({aptosConfig:this.config})}async getProcessorStatus(t){return Zt({aptosConfig:this.config,processorType:t})}};var Zo=["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 Jo(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Ce(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(!Jo(t))throw new Error(`${t} is not valid. ${Zo}`);if(e&&!Jo(e))throw new Error(`${e} is not valid. ${Zo}`);return{domainName:e||t,subdomainName:e?t:void 0}}var os="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",is={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:os,custom:null,devnet:null};function le(n){let t=is[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var ss=n=>({vec:[n]}),as=()=>({vec:[]}),ir=n=>n!=null?ss(n):as(),bn=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function ei(n){let{aptosConfig:t,name:e}=n,r=le(t),{domainName:o,subdomainName:i}=Ce(e),s=await Se({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,ir(i)]}}),a=bn(s[0]);return a?u.from(a).toString():void 0}async function ti(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:c}=n,d=le(t),{domainName:f,subdomainName:k}=Ce(r),A=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(k&&!A)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(A&&!k)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let cr=_nullishCoalesce(e.years, () => (1));if(cr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let hi=cr*31536e3;return await v({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[f,hi,i,s]},options:a})}if(!k)throw new Error(`${e.policy} requires a subdomain to be provided.`);let g=await sr({aptosConfig:t,name:f});if(!g)throw new Error("The domain does not exist");let dt=e.policy==="subdomain:independent"?e.expirationDate:g;if(dt>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await v({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[f,k,Math.round(dt/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,i,s]},options:a})}async function sr(n){let{aptosConfig:t,name:e}=n,r=le(t),{domainName:o,subdomainName:i}=Ce(e);try{let s=await Se({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,ir(i)]}});return Number(s[0])*1e3}catch (e3){return}}async function ni(n){let{aptosConfig:t,address:e}=n,r=le(t),o=await Se({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),i=bn(o[1]),s=bn(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function ri(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,i=le(t);if(!r)return await v({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:s,subdomainName:a}=Ce(r);return await v({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function oi(n){let{aptosConfig:t,name:e}=n,r=le(t),{domainName:o,subdomainName:i}=Ce(e),s=await Se({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,ir(i)]}}),a=bn(s[0]);return a?u.from(a).toString():void 0}async function ii(n){let{aptosConfig:t,sender:e,name:r,address:o,options:i}=n,s=le(t),{domainName:a,subdomainName:c}=Ce(r);return await v({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,o]},options:i})}async function si(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=Ce(e),a=(await l({aptosConfig:t,query:{query:Fe,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Et(a)),a}async function ai(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ar({aptosConfig:t});return(await l({aptosConfig:t,originMethod:"getAccountNames",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _127 => _127.limit]),offset:_optionalChain([e, 'optionalAccess', _128 => _128.offset]),order_by:_optionalChain([e, 'optionalAccess', _129 => _129.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _130 => _130.options, 'optionalAccess', _131 => _131.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Et)}async function ci(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ar({aptosConfig:t});return(await l({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _132 => _132.limit]),offset:_optionalChain([e, 'optionalAccess', _133 => _133.offset]),order_by:_optionalChain([e, 'optionalAccess', _134 => _134.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Et)}async function ui(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await ar({aptosConfig:t});return(await l({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _137 => _137.limit]),offset:_optionalChain([e, 'optionalAccess', _138 => _138.offset]),order_by:_optionalChain([e, 'optionalAccess', _139 => _139.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _140 => _140.options, 'optionalAccess', _141 => _141.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Et)}async function di(n){let{aptosConfig:t,options:e,domain:r}=n;return(await l({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Fe,variables:{limit:_optionalChain([e, 'optionalAccess', _142 => _142.limit]),offset:_optionalChain([e, 'optionalAccess', _143 => _143.offset]),order_by:_optionalChain([e, 'optionalAccess', _144 => _144.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _145 => _145.options, 'optionalAccess', _146 => _146.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Et)}async function ar(n){let{aptosConfig:t}=n,e=le(t),[r]=await Se({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=r/60/60/24,i=()=>new Date;return new Date(i().setDate(i().getDate()-o)).toISOString()}async function pi(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:i}=n,s=le(t),a=o*31536e3,{domainName:c,subdomainName:d}=Ce(r);if(d)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await v({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:i})}function Et(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).valueOf()}}var It=class{constructor(t){this.config=t}async getOwnerAddress(t){return ei({aptosConfig:this.config,...t})}async getExpiration(t){return sr({aptosConfig:this.config,...t})}async getTargetAddress(t){return oi({aptosConfig:this.config,...t})}async setTargetAddress(t){return ii({aptosConfig:this.config,...t})}async getPrimaryName(t){return ni({aptosConfig:this.config,...t})}async setPrimaryName(t){return ri({aptosConfig:this.config,...t})}async registerName(t){return ti({aptosConfig:this.config,...t})}async renewDomain(t){return pi({aptosConfig:this.config,...t})}async getName(t){return si({aptosConfig:this.config,...t})}async getAccountNames(t){return ai({aptosConfig:this.config,...t})}async getAccountDomains(t){return ci({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return ui({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return di({aptosConfig:this.config,...t})}};async function li(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),i=await l({aptosConfig:t,query:{query:kn,variables:{where_condition:{pool_address:{_eq:r}}}}});return i.num_active_delegator_per_pool[0]?i.num_active_delegator_per_pool[0].num_active_delegator:0}async function gi(n){let{aptosConfig:t,options:e}=n,r={query:kn,variables:{order_by:_optionalChain([e, 'optionalAccess', _147 => _147.orderBy])}};return(await l({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function mi(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Wr,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await l({aptosConfig:t,query:o})).delegated_staking_activities}var Rt=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _148 => _148.minimumLedgerVersion]),processorTypes:["stake_processor"]}),li({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _149 => _149.minimumLedgerVersion]),processorTypes:["stake_processor"]}),gi({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await y({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _150 => _150.minimumLedgerVersion]),processorTypes:["stake_processor"]}),mi({aptosConfig:this.config,...t})}};var kt=class{constructor(t){this.config=t}async getTransactions(t){return Ao({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return ho({aptosConfig:this.config,...t})}async getTransactionByHash(t){return nn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return To({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ke({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return tn({aptosConfig:this.config})}getSigningMessage(t){return zo(t)}};var wn=()=>Math.floor(Date.now()/1e3),_n= exports.AccountSequenceNumber =class{constructor(t,e,r,o,i){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=o,this.sleepTime=i}async nextSequenceNumber(){for(;this.lock;)await xe(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=wn();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await xe(this.sleepTime),wn()-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 xe(this.sleepTime);this.lock=!0;try{await this.update();let t=wn();for(;this.lastUncommintedNumber!==this.currentNumber;)wn()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await xe(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 ct=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _151 => _151.pendingDequeue, 'access', _152 => _152.shift, 'call', _153 => _153(), 'optionalAccess', _154 => _154.resolve, 'call', _155 => _155(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 ut("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},ut=class extends Error{};var yi="fulfilled",Sn= exports.TransactionWorker =class{constructor(t,e,r=30,o=100,i=10){this.taskQueue=new ct;this.transactionsQueue=new ct;this.outstandingTransactions=new ct;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new _n(t,e,r,o,i)}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=_t({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([r,t])}}catch(t){if(t instanceof ut)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 i=await Promise.allSettled(t);for(let s=0;s<i.length&&s<e.length;s+=1){let a=i[s];o=e[s],a.status===yi?(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 ut)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let r=[];r.push(Ke({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(r);for(let i=0;i<o.length;i+=1){let s=o[i];s.status===yi?this.executedTransactions.push([s.value.hash,e,null]):this.executedTransactions.push([s.status,e,s.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 v({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 Nt=class{constructor(t){this.config=t}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:o}=t,i=new Sn(this.config,e);i.start();for(let s of r)await i.push(s,o)}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return _t({aptosConfig:this.config,signer:e,transaction:r})}async publishPackageTransaction(t){return Oo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Go({aptosConfig:this.config,...t})}};var zt=class{constructor(t){this.config=t}async transaction(t){return v({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return v({aptosConfig:this.config,...t})}};var Ot=class{constructor(t){this.config=t}transaction(t){return An({...t})}transactionAsFeePayer(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})}};var ke=class{constructor(t){this.config=t}async transaction(t){return nr({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return nr({aptosConfig:this.config,...t})}};G([fi],ke.prototype,"transaction",1),G([fi],ke.prototype,"multiAgentTransaction",1);function fi(n,t,e){let r=e.value;return e.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var Ne=class{constructor(t){this.config=t}async transaction(t){return hn({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return hn({aptosConfig:this.config,...t})}};G([Ai],Ne.prototype,"transaction",1),G([Ai],Ne.prototype,"multiAgentTransaction",1);function Ai(n,t,e){let r=e.value;return e.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}var R=class{constructor(t){this.config=new on(t),this.account=new mt(this.config),this.ans=new It(this.config),this.coin=new St(this.config),this.digitalAsset=new xt(this.config),this.event=new vt(this.config),this.faucet=new Ct(this.config),this.fungibleAsset=new Pt(this.config),this.general=new Ut(this.config),this.staking=new Rt(this.config),this.transaction=new kt(this.config),this.transactionSubmission=new Nt(this.config),this.build=new zt(this.config),this.sign=new Ot(this.config),this.simulate=new ke(this.config),this.submit=new Ne(this.config)}};function O(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...i){return this[e][r](...i)},Object.defineProperty(n.prototype,r,o))})}O(R,mt,"account");O(R,It,"ans");O(R,St,"coin");O(R,xt,"digitalAsset");O(R,vt,"event");O(R,Ct,"faucet");O(R,Pt,"fungibleAsset");O(R,Ut,"general");O(R,Rt,"staking");O(R,kt,"transaction");O(R,Nt,"transactionSubmission");O(R,zt,"build");O(R,Ot,"sign");O(R,ke,"simulate");O(R,Ne,"submit");exports.APTOS_BIP44_REGEX = Oi; exports.APTOS_COIN = Ft; exports.APTOS_HARDENED_REGEX = zi; exports.Account = _e; exports.AccountAddress = u; exports.AccountAuthenticator = M; exports.AccountAuthenticatorEd25519 = ae; exports.AccountAuthenticatorMultiEd25519 = an; exports.AccountAuthenticatorMultiKey = $e; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = mr; exports.AccountSequenceNumber = _n; exports.AddressInvalidReason = Ri; exports.AnyPublicKey = S; exports.AnyPublicKeyVariant = yr; exports.AnySignature = se; exports.AnySignatureVariant = fr; exports.Aptos = R; exports.AptosApiError = re; exports.AptosApiType = Mt; exports.AptosConfig = on; exports.AuthenticationKey = J; exports.Bool = C; exports.CKDPriv = zr; exports.ChainId = We; exports.DEFAULT_MAX_GAS_AMOUNT = _r; exports.DEFAULT_NETWORK = wr; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Sr; exports.DEFAULT_TXN_TIMEOUT_SEC = Dt; exports.DeriveScheme = xi; exports.Deserializer = Er; exports.Ed25519PrivateKey = Ae; exports.Ed25519PublicKey = b; exports.Ed25519Signature = P; exports.EntryFunction = it; exports.EntryFunctionBytes = Lt; exports.FeePayerRawTransaction = pe; exports.FixedBytes = Ee; exports.HARDENED_OFFSET = Rr; exports.Hex = m; exports.HexInvalidReason = Ui; exports.Identifier = x; exports.KeyType = Gi; exports.MimeType = xn; exports.ModuleId = yt; exports.MoveAbility = _i; exports.MoveFunctionVisibility = wi; exports.MoveOption = me; exports.MoveString = E; exports.MoveVector = h; exports.MultiAgentRawTransaction = de; exports.MultiEd25519PublicKey = Y; exports.MultiEd25519Signature = Me; exports.MultiKey = De; exports.MultiSig = bt; exports.MultisigTransactionPayload = wt; exports.Network = Bt; exports.NetworkToChainId = Pn; exports.NetworkToFaucetAPI = br; exports.NetworkToIndexerAPI = Cn; exports.NetworkToNetworkName = Gs; exports.NetworkToNodeAPI = Tr; exports.ParsingError = B; exports.PrivateKey = Be; exports.ProcessorType = ze; exports.PublicKey = F; exports.RAW_TRANSACTION_SALT = xr; exports.RAW_TRANSACTION_WITH_DATA_SALT = Un; exports.RawTransaction = W; exports.RawTransactionWithData = un; exports.RoleType = Si; exports.RotationProofChallenge = sn; exports.Script = Tt; exports.ScriptTransactionArgumentVariants = pt; exports.Secp256k1PrivateKey = be; exports.Secp256k1PublicKey = Q; exports.Secp256k1Signature = we; exports.Serializable = p; exports.Serializer = j; exports.Signature = X; exports.SignedTransaction = ne; exports.SigningScheme = lt; exports.SigningSchemeInput = Ar; exports.StructTag = ue; exports.TransactionAuthenticator = ce; exports.TransactionAuthenticatorEd25519 = Le; exports.TransactionAuthenticatorFeePayer = Ve; exports.TransactionAuthenticatorMultiAgent = He; exports.TransactionAuthenticatorMultiEd25519 = qn; exports.TransactionAuthenticatorSingleSender = Qe; exports.TransactionAuthenticatorVariant = gr; exports.TransactionPayload = Re; exports.TransactionPayloadEntryFunction = At; exports.TransactionPayloadMultisig = ht; exports.TransactionPayloadScript = ft; exports.TransactionPayloadVariants = pr; exports.TransactionResponseType = vn; exports.TransactionVariants = lr; exports.TransactionWorker = Sn; exports.TypeTag = U; exports.TypeTagAddress = nt; exports.TypeTagBool = je; exports.TypeTagGeneric = rt; exports.TypeTagParserError = w; exports.TypeTagParserErrorType = Qi; exports.TypeTagReference = cn; exports.TypeTagSigner = Ie; exports.TypeTagStruct = ve; exports.TypeTagU128 = et; exports.TypeTagU16 = Ye; exports.TypeTagU256 = tt; exports.TypeTagU32 = Ze; exports.TypeTagU64 = Je; exports.TypeTagU8 = Xe; exports.TypeTagVariants = dr; exports.TypeTagVector = ot; exports.U128 = H; exports.U16 = $; exports.U256 = V; exports.U32 = L; exports.U64 = I; exports.U8 = N; exports.aptosCoinStructTag = rp; exports.aptosRequest = Gt; exports.buildTransaction = er; exports.checkOrConvertArgument = mn; exports.convertArgument = Uo; exports.deriveKey = Rn; exports.deriveTransactionType = No; exports.deserializeFromScriptArgument = Li; exports.ensureBoolean = In; exports.fetchEntryFunctionAbi = Po; exports.findFirstNonSignerArg = vo; exports.generateMultiSignersSignedTransaction = Ji; exports.generateRawTransaction = Zi; exports.generateSignedTransaction = ko; exports.generateSignedTransactionForSimulation = Io; exports.generateSigningMessage = tr; exports.generateTransactionPayload = fn; exports.generateTransactionPayloadWithABI = Yi; exports.get = vr; exports.getAptosFullNode = D; exports.getAuthenticatorForSimulation = yn; exports.getFunctionParts = Zn; exports.isBcsAddress = gn; exports.isBcsBool = $n; exports.isBcsFixedBytes = Wi; exports.isBcsString = Ln; exports.isBcsU128 = jn; exports.isBcsU16 = Vn; exports.isBcsU256 = Xn; exports.isBcsU32 = Qn; exports.isBcsU64 = Wn; exports.isBcsU8 = Hn; exports.isBlockMetadataTransactionResponse = As; exports.isBool = _o; exports.isEd25519Signature = Ts; exports.isEncodedEntryFunctionArgument = xo; exports.isFeePayerSignature = _s; exports.isGenesisTransactionResponse = fs; exports.isLargeNumber = ln; exports.isMultiAgentSignature = ws; exports.isMultiEd25519Signature = Ss; exports.isNull = So; exports.isNumber = pn; exports.isPendingTransactionResponse = ms; exports.isScriptDataInput = Yn; exports.isSecp256k1Signature = bs; exports.isStateCheckpointTransactionResponse = hs; exports.isString = st; exports.isUserTransactionResponse = ys; exports.isValidBIP44Path = kr; exports.isValidHardenedPath = Nr; exports.mnemonicToSeed = Ht; exports.objectStructTag = sp; exports.optionStructTag = ip; exports.outOfRangeErrorMessage = Ei; exports.paginateWithCursor = Oe; exports.parseTypeTag = Kn; exports.post = En; exports.postAptosFaucet = Pr; exports.postAptosFullNode = Ge; exports.postAptosIndexer = Cr; exports.request = vi; exports.sign = Ro; exports.splitPath = Or; exports.standardizeTypeTags = Co; exports.stringStructTag = op; exports.throwTypeMismatch = _; exports.validateNumberInRange = ge;
427
427
  //# sourceMappingURL=index.js.map