@aptos-labs/ts-sdk 1.18.1 → 1.19.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 (240) hide show
  1. package/dist/common/cli/index.js +1 -1
  2. package/dist/common/cli/index.js.map +1 -1
  3. package/dist/common/index.d.ts +22 -3
  4. package/dist/common/index.js +8 -8
  5. package/dist/common/index.js.map +1 -1
  6. package/dist/esm/account/Account.mjs +1 -1
  7. package/dist/esm/account/Ed25519Account.mjs +1 -1
  8. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  9. package/dist/esm/account/KeylessAccount.mjs +1 -1
  10. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  11. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  12. package/dist/esm/account/index.mjs +1 -1
  13. package/dist/esm/api/account.mjs +1 -1
  14. package/dist/esm/api/ans.mjs +1 -1
  15. package/dist/esm/api/aptos.mjs +1 -1
  16. package/dist/esm/api/coin.mjs +1 -1
  17. package/dist/esm/api/digitalAsset.mjs +1 -1
  18. package/dist/esm/api/event.mjs +1 -1
  19. package/dist/esm/api/faucet.mjs +1 -1
  20. package/dist/esm/api/fungibleAsset.d.mts +18 -1
  21. package/dist/esm/api/fungibleAsset.mjs +1 -1
  22. package/dist/esm/api/general.mjs +1 -1
  23. package/dist/esm/api/index.mjs +1 -1
  24. package/dist/esm/api/keyless.mjs +1 -1
  25. package/dist/esm/api/staking.mjs +1 -1
  26. package/dist/esm/api/table.mjs +1 -1
  27. package/dist/esm/api/transaction.mjs +1 -1
  28. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  30. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  31. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  32. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  33. package/dist/esm/api/utils.mjs +1 -1
  34. package/dist/esm/bcs/index.mjs +1 -1
  35. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  36. package/dist/esm/{chunk-DPO352QL.mjs → chunk-3EDNV7KS.mjs} +2 -2
  37. package/dist/esm/{chunk-TG2LLWVU.mjs → chunk-3JEL6FIZ.mjs} +2 -2
  38. package/dist/esm/{chunk-MHZ64FIW.mjs → chunk-3KZ7HFFA.mjs} +2 -2
  39. package/dist/esm/{chunk-HHE63GFW.mjs → chunk-47M33ENP.mjs} +2 -2
  40. package/dist/esm/{chunk-6DYDZSEW.mjs → chunk-4U3MAEYH.mjs} +2 -2
  41. package/dist/esm/{chunk-FM6ALU5B.mjs → chunk-4ZM7V7HN.mjs} +2 -2
  42. package/dist/esm/{chunk-PTA3VHTQ.mjs → chunk-5Y3O7MLN.mjs} +2 -2
  43. package/dist/esm/{chunk-2QWQ6RX5.mjs → chunk-64P5SB7N.mjs} +2 -2
  44. package/dist/esm/chunk-6DDSU7HN.mjs +2 -0
  45. package/dist/esm/{chunk-LVSOUCFD.mjs.map → chunk-6DDSU7HN.mjs.map} +1 -1
  46. package/dist/esm/{chunk-NSQLZBCA.mjs → chunk-7JUBWA7V.mjs} +2 -2
  47. package/dist/esm/{chunk-S32JHML7.mjs → chunk-BCY5UOGP.mjs} +2 -2
  48. package/dist/esm/{chunk-XYLM277Z.mjs → chunk-BI5P5ASH.mjs} +2 -2
  49. package/dist/esm/{chunk-BVB3QII3.mjs → chunk-C2IJG37E.mjs} +2 -2
  50. package/dist/esm/{chunk-SLFAROVZ.mjs → chunk-CAC7G2HC.mjs} +2 -2
  51. package/dist/esm/{chunk-M3JHXCGV.mjs → chunk-CPCS5KIA.mjs} +2 -2
  52. package/dist/esm/{chunk-VCMP3MXN.mjs → chunk-DCBXXRXS.mjs} +2 -2
  53. package/dist/esm/chunk-E2JEBCSY.mjs +2 -0
  54. package/dist/esm/chunk-E2JEBCSY.mjs.map +1 -0
  55. package/dist/esm/chunk-EAXCOIOP.mjs +2 -0
  56. package/dist/esm/{chunk-Z4YHE4A5.mjs.map → chunk-EAXCOIOP.mjs.map} +1 -1
  57. package/dist/esm/{chunk-FYB7C42X.mjs → chunk-FD2VCIZG.mjs} +2 -2
  58. package/dist/esm/{chunk-JSWBLHMX.mjs → chunk-FGFQZQGX.mjs} +2 -2
  59. package/dist/esm/{chunk-BLVYB7Y3.mjs → chunk-FTA2ZMUX.mjs} +2 -2
  60. package/dist/esm/{chunk-DW2KZREM.mjs → chunk-GCPWPGCS.mjs} +2 -2
  61. package/dist/esm/{chunk-FTIW5GGG.mjs → chunk-GMHGYDZQ.mjs} +2 -2
  62. package/dist/esm/{chunk-K4CTCBLY.mjs → chunk-GPZEPKKD.mjs} +2 -2
  63. package/dist/esm/{chunk-DLDGUTFV.mjs → chunk-GRZVD45M.mjs} +2 -2
  64. package/dist/esm/{chunk-EYIJYUN7.mjs → chunk-GXLFQEPR.mjs} +2 -2
  65. package/dist/esm/{chunk-VTKPSYKA.mjs → chunk-HACVLK5I.mjs} +2 -2
  66. package/dist/esm/{chunk-XWVU4G57.mjs → chunk-HED6CPN2.mjs} +2 -2
  67. package/dist/esm/{chunk-EAW6AWYD.mjs → chunk-HJT2Q5NL.mjs} +2 -2
  68. package/dist/esm/{chunk-42SZQH5Z.mjs → chunk-ICE6OL3A.mjs} +2 -2
  69. package/dist/esm/{chunk-5X2BJDOB.mjs → chunk-ILXK4OH5.mjs} +2 -2
  70. package/dist/esm/{chunk-AVH5SYTL.mjs → chunk-IOMJ5OWV.mjs} +2 -2
  71. package/dist/esm/{chunk-QL2QFRKV.mjs → chunk-JM7CSDJ3.mjs} +2 -2
  72. package/dist/esm/{chunk-GFRNBBTY.mjs → chunk-K6NUFABY.mjs} +2 -2
  73. package/dist/esm/chunk-KMJ6TF6Y.mjs +2 -0
  74. package/dist/esm/chunk-KMJ6TF6Y.mjs.map +1 -0
  75. package/dist/esm/{chunk-NCUBVHUW.mjs → chunk-KUAN2WZF.mjs} +2 -2
  76. package/dist/esm/chunk-LAZTLEXF.mjs +2 -0
  77. package/dist/esm/chunk-LAZTLEXF.mjs.map +1 -0
  78. package/dist/esm/{chunk-UAZUO75M.mjs → chunk-LLLINNAG.mjs} +2 -2
  79. package/dist/esm/{chunk-AYKZA676.mjs → chunk-LWFSV3OA.mjs} +2 -2
  80. package/dist/esm/{chunk-U6X2FYNI.mjs → chunk-MH6HIFMG.mjs} +2 -2
  81. package/dist/esm/{chunk-2DSPX6BX.mjs → chunk-MKOIEX4B.mjs} +2 -2
  82. package/dist/esm/{chunk-L22R3OIW.mjs → chunk-MUAV4P6C.mjs} +2 -2
  83. package/dist/esm/{chunk-CZ6TC4GO.mjs → chunk-N5A4L6Z6.mjs} +2 -2
  84. package/dist/esm/{chunk-NNQYSSLH.mjs → chunk-NBGXHLM4.mjs} +2 -2
  85. package/dist/esm/{chunk-K7DBDI2I.mjs → chunk-OKLLJQM4.mjs} +2 -2
  86. package/dist/esm/{chunk-C5V4EBVP.mjs → chunk-OLVNRYGT.mjs} +2 -2
  87. package/dist/esm/{chunk-4IBJW3PB.mjs → chunk-PS7L2TLP.mjs} +2 -2
  88. package/dist/esm/{chunk-F74FF323.mjs → chunk-PVEPP4HR.mjs} +2 -2
  89. package/dist/esm/{chunk-UGVNOSD3.mjs → chunk-QTNKFKDE.mjs} +2 -2
  90. package/dist/esm/{chunk-7Y45UTRL.mjs → chunk-RUVDYKIZ.mjs} +2 -2
  91. package/dist/esm/chunk-SYV4KFI7.mjs +2 -0
  92. package/dist/esm/chunk-SYV4KFI7.mjs.map +1 -0
  93. package/dist/esm/{chunk-6JL2U7JB.mjs → chunk-TFNJPJF6.mjs} +2 -2
  94. package/dist/esm/{chunk-QVWBJJRF.mjs → chunk-V5JJHVMP.mjs} +2 -2
  95. package/dist/esm/{chunk-5YHI7WOB.mjs → chunk-VRSZLJVR.mjs} +2 -2
  96. package/dist/esm/{chunk-362JBD4O.mjs → chunk-VY2MJZWM.mjs} +2 -2
  97. package/dist/esm/{chunk-SFUTXSDK.mjs → chunk-WUWJLSGN.mjs} +2 -2
  98. package/dist/esm/{chunk-3ZCQQ3L2.mjs → chunk-XSHUCBNT.mjs} +2 -2
  99. package/dist/esm/{chunk-BS7EVBWX.mjs → chunk-Y37TV7SM.mjs} +2 -2
  100. package/dist/esm/{chunk-JPDT6E3B.mjs → chunk-YDXU6ALO.mjs} +2 -2
  101. package/dist/esm/{chunk-6UDHM6YZ.mjs → chunk-YF6UA3XW.mjs} +2 -2
  102. package/dist/esm/{chunk-WQHW4WQN.mjs → chunk-YXXEXFQH.mjs} +2 -2
  103. package/dist/esm/{chunk-QAMV4L3K.mjs → chunk-ZQUDGZIZ.mjs} +2 -2
  104. package/dist/esm/cli/index.mjs +1 -1
  105. package/dist/esm/cli/move.mjs +1 -1
  106. package/dist/esm/client/core.mjs +1 -1
  107. package/dist/esm/client/get.mjs +1 -1
  108. package/dist/esm/client/index.mjs +1 -1
  109. package/dist/esm/client/post.mjs +1 -1
  110. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  111. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  112. package/dist/esm/core/crypto/index.mjs +1 -1
  113. package/dist/esm/core/crypto/keyless.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/proof.mjs +1 -1
  117. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  118. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  119. package/dist/esm/core/crypto/signature.mjs +1 -1
  120. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  121. package/dist/esm/core/index.mjs +1 -1
  122. package/dist/esm/index.d.mts +1 -1
  123. package/dist/esm/index.mjs +1 -1
  124. package/dist/esm/internal/account.mjs +1 -1
  125. package/dist/esm/internal/ans.mjs +1 -1
  126. package/dist/esm/internal/coin.mjs +1 -1
  127. package/dist/esm/internal/digitalAsset.mjs +1 -1
  128. package/dist/esm/internal/event.mjs +1 -1
  129. package/dist/esm/internal/faucet.mjs +1 -1
  130. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  131. package/dist/esm/internal/general.mjs +1 -1
  132. package/dist/esm/internal/keyless.mjs +1 -1
  133. package/dist/esm/internal/staking.mjs +1 -1
  134. package/dist/esm/internal/table.mjs +1 -1
  135. package/dist/esm/internal/transaction.mjs +1 -1
  136. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  137. package/dist/esm/internal/view.mjs +1 -1
  138. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  139. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  140. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  141. package/dist/esm/transactions/index.d.mts +1 -1
  142. package/dist/esm/transactions/index.mjs +1 -1
  143. package/dist/esm/transactions/instances/index.mjs +1 -1
  144. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  145. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  146. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  147. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  148. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  149. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  150. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  151. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  152. package/dist/esm/transactions/management/index.mjs +1 -1
  153. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  154. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -2
  155. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  156. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  157. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  158. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -0
  159. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  160. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  161. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  162. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  163. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  164. package/dist/esm/utils/index.mjs +1 -1
  165. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  166. package/dist/esm/version.d.mts +1 -1
  167. package/dist/esm/version.mjs +1 -1
  168. package/package.json +1 -1
  169. package/src/api/fungibleAsset.ts +36 -2
  170. package/src/bcs/serializable/moveStructs.ts +5 -2
  171. package/src/cli/move.ts +2 -3
  172. package/src/transactions/transactionBuilder/helpers.ts +12 -1
  173. package/src/transactions/transactionBuilder/remoteAbi.ts +58 -24
  174. package/src/version.ts +1 -1
  175. package/dist/esm/chunk-HCN7YJGB.mjs +0 -2
  176. package/dist/esm/chunk-HCN7YJGB.mjs.map +0 -1
  177. package/dist/esm/chunk-LVSOUCFD.mjs +0 -2
  178. package/dist/esm/chunk-RJ4RKVVQ.mjs +0 -2
  179. package/dist/esm/chunk-RJ4RKVVQ.mjs.map +0 -1
  180. package/dist/esm/chunk-U4A56FN2.mjs +0 -2
  181. package/dist/esm/chunk-U4A56FN2.mjs.map +0 -1
  182. package/dist/esm/chunk-YMUCYX3B.mjs +0 -2
  183. package/dist/esm/chunk-YMUCYX3B.mjs.map +0 -1
  184. package/dist/esm/chunk-Z4YHE4A5.mjs +0 -2
  185. /package/dist/esm/{chunk-DPO352QL.mjs.map → chunk-3EDNV7KS.mjs.map} +0 -0
  186. /package/dist/esm/{chunk-TG2LLWVU.mjs.map → chunk-3JEL6FIZ.mjs.map} +0 -0
  187. /package/dist/esm/{chunk-MHZ64FIW.mjs.map → chunk-3KZ7HFFA.mjs.map} +0 -0
  188. /package/dist/esm/{chunk-HHE63GFW.mjs.map → chunk-47M33ENP.mjs.map} +0 -0
  189. /package/dist/esm/{chunk-6DYDZSEW.mjs.map → chunk-4U3MAEYH.mjs.map} +0 -0
  190. /package/dist/esm/{chunk-FM6ALU5B.mjs.map → chunk-4ZM7V7HN.mjs.map} +0 -0
  191. /package/dist/esm/{chunk-PTA3VHTQ.mjs.map → chunk-5Y3O7MLN.mjs.map} +0 -0
  192. /package/dist/esm/{chunk-2QWQ6RX5.mjs.map → chunk-64P5SB7N.mjs.map} +0 -0
  193. /package/dist/esm/{chunk-NSQLZBCA.mjs.map → chunk-7JUBWA7V.mjs.map} +0 -0
  194. /package/dist/esm/{chunk-S32JHML7.mjs.map → chunk-BCY5UOGP.mjs.map} +0 -0
  195. /package/dist/esm/{chunk-XYLM277Z.mjs.map → chunk-BI5P5ASH.mjs.map} +0 -0
  196. /package/dist/esm/{chunk-BVB3QII3.mjs.map → chunk-C2IJG37E.mjs.map} +0 -0
  197. /package/dist/esm/{chunk-SLFAROVZ.mjs.map → chunk-CAC7G2HC.mjs.map} +0 -0
  198. /package/dist/esm/{chunk-M3JHXCGV.mjs.map → chunk-CPCS5KIA.mjs.map} +0 -0
  199. /package/dist/esm/{chunk-VCMP3MXN.mjs.map → chunk-DCBXXRXS.mjs.map} +0 -0
  200. /package/dist/esm/{chunk-FYB7C42X.mjs.map → chunk-FD2VCIZG.mjs.map} +0 -0
  201. /package/dist/esm/{chunk-JSWBLHMX.mjs.map → chunk-FGFQZQGX.mjs.map} +0 -0
  202. /package/dist/esm/{chunk-BLVYB7Y3.mjs.map → chunk-FTA2ZMUX.mjs.map} +0 -0
  203. /package/dist/esm/{chunk-DW2KZREM.mjs.map → chunk-GCPWPGCS.mjs.map} +0 -0
  204. /package/dist/esm/{chunk-FTIW5GGG.mjs.map → chunk-GMHGYDZQ.mjs.map} +0 -0
  205. /package/dist/esm/{chunk-K4CTCBLY.mjs.map → chunk-GPZEPKKD.mjs.map} +0 -0
  206. /package/dist/esm/{chunk-DLDGUTFV.mjs.map → chunk-GRZVD45M.mjs.map} +0 -0
  207. /package/dist/esm/{chunk-EYIJYUN7.mjs.map → chunk-GXLFQEPR.mjs.map} +0 -0
  208. /package/dist/esm/{chunk-VTKPSYKA.mjs.map → chunk-HACVLK5I.mjs.map} +0 -0
  209. /package/dist/esm/{chunk-XWVU4G57.mjs.map → chunk-HED6CPN2.mjs.map} +0 -0
  210. /package/dist/esm/{chunk-EAW6AWYD.mjs.map → chunk-HJT2Q5NL.mjs.map} +0 -0
  211. /package/dist/esm/{chunk-42SZQH5Z.mjs.map → chunk-ICE6OL3A.mjs.map} +0 -0
  212. /package/dist/esm/{chunk-5X2BJDOB.mjs.map → chunk-ILXK4OH5.mjs.map} +0 -0
  213. /package/dist/esm/{chunk-AVH5SYTL.mjs.map → chunk-IOMJ5OWV.mjs.map} +0 -0
  214. /package/dist/esm/{chunk-QL2QFRKV.mjs.map → chunk-JM7CSDJ3.mjs.map} +0 -0
  215. /package/dist/esm/{chunk-GFRNBBTY.mjs.map → chunk-K6NUFABY.mjs.map} +0 -0
  216. /package/dist/esm/{chunk-NCUBVHUW.mjs.map → chunk-KUAN2WZF.mjs.map} +0 -0
  217. /package/dist/esm/{chunk-UAZUO75M.mjs.map → chunk-LLLINNAG.mjs.map} +0 -0
  218. /package/dist/esm/{chunk-AYKZA676.mjs.map → chunk-LWFSV3OA.mjs.map} +0 -0
  219. /package/dist/esm/{chunk-U6X2FYNI.mjs.map → chunk-MH6HIFMG.mjs.map} +0 -0
  220. /package/dist/esm/{chunk-2DSPX6BX.mjs.map → chunk-MKOIEX4B.mjs.map} +0 -0
  221. /package/dist/esm/{chunk-L22R3OIW.mjs.map → chunk-MUAV4P6C.mjs.map} +0 -0
  222. /package/dist/esm/{chunk-CZ6TC4GO.mjs.map → chunk-N5A4L6Z6.mjs.map} +0 -0
  223. /package/dist/esm/{chunk-NNQYSSLH.mjs.map → chunk-NBGXHLM4.mjs.map} +0 -0
  224. /package/dist/esm/{chunk-K7DBDI2I.mjs.map → chunk-OKLLJQM4.mjs.map} +0 -0
  225. /package/dist/esm/{chunk-C5V4EBVP.mjs.map → chunk-OLVNRYGT.mjs.map} +0 -0
  226. /package/dist/esm/{chunk-4IBJW3PB.mjs.map → chunk-PS7L2TLP.mjs.map} +0 -0
  227. /package/dist/esm/{chunk-F74FF323.mjs.map → chunk-PVEPP4HR.mjs.map} +0 -0
  228. /package/dist/esm/{chunk-UGVNOSD3.mjs.map → chunk-QTNKFKDE.mjs.map} +0 -0
  229. /package/dist/esm/{chunk-7Y45UTRL.mjs.map → chunk-RUVDYKIZ.mjs.map} +0 -0
  230. /package/dist/esm/{chunk-6JL2U7JB.mjs.map → chunk-TFNJPJF6.mjs.map} +0 -0
  231. /package/dist/esm/{chunk-QVWBJJRF.mjs.map → chunk-V5JJHVMP.mjs.map} +0 -0
  232. /package/dist/esm/{chunk-5YHI7WOB.mjs.map → chunk-VRSZLJVR.mjs.map} +0 -0
  233. /package/dist/esm/{chunk-362JBD4O.mjs.map → chunk-VY2MJZWM.mjs.map} +0 -0
  234. /package/dist/esm/{chunk-SFUTXSDK.mjs.map → chunk-WUWJLSGN.mjs.map} +0 -0
  235. /package/dist/esm/{chunk-3ZCQQ3L2.mjs.map → chunk-XSHUCBNT.mjs.map} +0 -0
  236. /package/dist/esm/{chunk-BS7EVBWX.mjs.map → chunk-Y37TV7SM.mjs.map} +0 -0
  237. /package/dist/esm/{chunk-JPDT6E3B.mjs.map → chunk-YDXU6ALO.mjs.map} +0 -0
  238. /package/dist/esm/{chunk-6UDHM6YZ.mjs.map → chunk-YF6UA3XW.mjs.map} +0 -0
  239. /package/dist/esm/{chunk-WQHW4WQN.mjs.map → chunk-YXXEXFQH.mjs.map} +0 -0
  240. /package/dist/esm/{chunk-QAMV4L3K.mjs.map → chunk-ZQUDGZIZ.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkBHKSQXUZjs = require('./chunk-BHKSQXUZ.js');var wn=255,Sn=65535,ve=4294967295,Ve=18446744073709551615n,Mt=340282366920938463463374607431768211455n,xn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var ne=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===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 e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<ve;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>ve)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var Q=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var Xs=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Xs||{}),l= exports.Hex =class n{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new Q("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new Q("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, t))}catch(r){throw new Q(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};var d=class{bcsToBytes(){let e=new W;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return l.fromHexInput(e)}},W= exports.Serializer =class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,r){this.ensureBufferWillHandleSize(t);let i=new DataView(this.buffer,this.offset);e.apply(i,[0,r,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){lr(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(ve),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&Ve,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&Mt,r=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(r)}serializeU32AsUleb128(e){let t=e,r=[];for(;t>>>7;)r.push(t&127|128),t>>>=7;r.push(t),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}serializeOption(e){let t=e!==void 0;this.serializeBool(t),t&&e.serialize(this)}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunkBHKSQXUZjs.a.call(void 0, [He(0,wn)],W.prototype,"serializeU8",1),_chunkBHKSQXUZjs.a.call(void 0, [He(0,Sn)],W.prototype,"serializeU16",1),_chunkBHKSQXUZjs.a.call(void 0, [He(0,ve)],W.prototype,"serializeU32",1),_chunkBHKSQXUZjs.a.call(void 0, [He(BigInt(0),Ve)],W.prototype,"serializeU64",1),_chunkBHKSQXUZjs.a.call(void 0, [He(BigInt(0),Mt)],W.prototype,"serializeU128",1),_chunkBHKSQXUZjs.a.call(void 0, [He(BigInt(0),xn)],W.prototype,"serializeU256",1),_chunkBHKSQXUZjs.a.call(void 0, [He(0,ve)],W.prototype,"serializeU32AsUleb128",1);function lr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Ys=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ge(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(Ys(n,e,t))}function He(n,e){return(t,r,i)=>{let o=i.value;return i.value=function(a){return Ge(a,n,e),o.apply(this,[a])},i}}var Le=class n extends d{constructor(e){super(),this.value=l.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var _n=class n extends d{constructor(e){super(),this.value=new Le(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Le.deserialize(e,t);return new n(r.value)}};var vn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(vn||{}),di= 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))(di||{}),qt= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p))(qt||{}),li= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(li||{}),gi= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(gi||{}),mi= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(mi||{}),yi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(yi||{}),gr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(gr||{}),fi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(fi||{}),mr= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(mr||{}),Ai= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Ai||{}),yr= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(yr||{}),fr= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(fr||{}),Ar= exports.TransactionResponseType =(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s.Validator="validator_transaction",s))(Ar||{});function uu(n){return n.type==="pending_transaction"}function pu(n){return n.type==="user_transaction"}function du(n){return n.type==="genesis_transaction"}function lu(n){return n.type==="block_metadata_transaction"}function gu(n){return n.type==="state_checkpoint_transaction"}function mu(n){return n.type==="validator_transaction"}function yu(n){return"signature"in n&&n.signature==="ed25519_signature"}function fu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Au(n){return n.type==="multi_agent_signature"}function hu(n){return n.type==="fee_payer_signature"}function Tu(n){return n.type==="multi_ed25519_signature"}var Zs=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Zs||{}),hi= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(hi||{}),Js= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Js||{}),ye= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(ye||{}),hr= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(hr||{}),ea= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(ea||{});var I=class n extends d{constructor(e){super(),lr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},N= exports.U8 =class n extends d{constructor(e){super(),Ge(e,0,wn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},re= exports.U16 =class n extends d{constructor(e){super(),Ge(e,0,Sn),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},ie= exports.U32 =class n extends d{constructor(e){super(),Ge(e,0,ve),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),Ve),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},de= exports.U128 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),Mt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},le= exports.U256 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),xn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var T=class n extends d{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}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 t;if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=l.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type");return new n(t.map(r=>new N(r)))}static U16(e){return new n(e.map(t=>new re(t)))}static U32(e){return new n(e.map(t=>new ie(t)))}static U64(e){return new n(e.map(t=>new O(t)))}static U128(e){return new n(e.map(t=>new de(t)))}static U256(e){return new n(e.map(t=>new le(t)))}static Bool(e){return new n(e.map(t=>new I(t)))}static MoveString(e){return new n(e.map(t=>new b(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},b= exports.MoveString =class n extends d{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let t=this.bcsToBytes().slice(1);T.U8(t).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Be= exports.MoveOption =class n extends d{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new T([e]):this.vec=new T([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}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 re(e):void 0)}static U32(e){return new n(e!=null?new ie(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new de(e):void 0)}static U256(e){return new n(e!=null?new le(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,t){let r=T.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var na=(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))(na||{}),x=class x extends d{constructor(e){if(super(),e.length!==x.LENGTH)throw new Q("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let t=e.deserializeFixedBytes(x.LENGTH);return new x(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new Q("Hex string must start with a leading 0x.","leading_zero_x_required");let t=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new Q(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new Q(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return t}static fromString(e){let t=e;if(e.startsWith("0x")&&(t=e.slice(2)),t.length===0)throw new Q("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new Q("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let r;try{r=_utils.hexToBytes.call(void 0, t.padStart(64,"0"))}catch(i){throw new Q(`Hex characters are invalid: ${_optionalChain([i, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(r)}static from(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromString(e)}static fromStrict(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromStringStrict(e)}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4");var u=x;var De=class De extends d{constructor(e){super();let{data:t}=e,r=l.fromHexInput(t);if(r.toUint8Array().length!==De.LENGTH)throw new Error(`Authentication Key length should be ${De.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(De.LENGTH);return new De({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=l.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new De({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};De.LENGTH=32;var F=De;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var bi = _interopRequireWildcard(_bip39);var sa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,aa= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,ca= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(ca||{}),wi= exports.HARDENED_OFFSET =2147483648;function Si(n){return aa.test(n)}function xi(n){return sa.test(n)}var Tr=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},_i= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return Tr(e,s)},ua=n=>n.replace("'",""),vi= exports.splitPath =n=>n.split("/").slice(1).map(ua),Pn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return bi.mnemonicToSeedSync(e)};var Qe=class extends d{toString(){let e=this.toUint8Array();return l.fromHexInput(e).toString()}},oe= exports.AccountPublicKey =class extends Qe{};var G=class extends d{toString(){let e=this.toUint8Array();return l.fromHexInput(e).toString()}};var pt=n=>typeof n=="string"?l.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Pi=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16],We=class We extends oe{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==We.LENGTH)throw new Error(`PublicKey length should be ${We.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof v))return!1;let i=pt(t),o=l.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return r.isCanonicalSignature()?_ed25519.ed25519.verify(s,o,a):!1}authKey(){return F.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new We(t)}static isPublicKey(e){return e instanceof We}};We.LENGTH=32;var _=We,se=class se extends d{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==se.LENGTH)throw new Error(`PrivateKey length should be ${se.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new se(e)}static fromDerivationPath(e,t){if(!xi(e))throw new Error(`Invalid derivation path ${e}`);return se.fromDerivationPathInner(e,Pn(t))}static fromDerivationPathInner(e,t,r=wi){let{key:i,chainCode:o}=Tr(se.SLIP_0010_SEED,t),s=vi(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>_i(c,p+r),{key:i,chainCode:o});return new se(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=pt(e),r=l.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new se(t)}static isPrivateKey(e){return e instanceof se}};se.LENGTH=32,se.SLIP_0010_SEED="ed25519 seed";var $=se,dt=class dt extends G{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==dt.LENGTH)throw new Error(`Signature length should be ${dt.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new dt(t)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let t=e.length-1;t>=0;t-=1){if(e[t]<Pi[t])return!0;if(e[t]>Pi[t])return!1}return!1}};dt.LENGTH=64;var v=dt;var ae=class ae extends oe{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>ae.MAX_KEYS||t.length<ae.MIN_KEYS)throw new Error(`Must have between ${ae.MIN_KEYS} and ${ae.MAX_KEYS} public keys, inclusive`);if(r<ae.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${ae.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof je))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((r.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:r.signatures[o]}))return!1;return!0}authKey(){return F.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*_.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*_.LENGTH)}),e[this.publicKeys.length*_.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=_.LENGTH){let s=o;i.push(new _(t.subarray(s,s+_.LENGTH)))}return new ae({publicKeys:i,threshold:r})}};ae.MAX_KEYS=32,ae.MIN_KEYS=2,ae.MIN_THRESHOLD=1;var lt=ae,Y=class Y extends G{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Y.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=Y.createBitmap({bits:r});else{if(r.length!==Y.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Y.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*v.LENGTH+Y.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*v.LENGTH)}),e.set(this.bitmap,this.signatures.length*v.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=v.LENGTH){let s=o;i.push(new v(t.subarray(s,s+v.LENGTH)))}return new Y({signatures:i,bitmap:r})}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(s>=Y.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Y.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}};Y.MAX_SIGNATURES_SUPPORTED=32,Y.BITMAP_LEN=4;var je=Y;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Xe=class Xe extends Qe{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==Xe.LENGTH)throw new Error(`PublicKey length should be ${Xe.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Pe))return!1;let i=pt(t),o=l.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Xe(t)}static isPublicKey(e){return e instanceof Xe}};Xe.LENGTH=65;var Ae=Xe,fe=class fe extends d{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==fe.LENGTH)throw new Error(`PrivateKey length should be ${fe.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new fe(e)}static fromDerivationPath(e,t){if(!Si(e))throw new Error(`Invalid derivation path ${e}`);return fe.fromDerivationPathInner(e,Pn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new fe(r)}sign(e){let t=pt(e),r=l.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new Pe(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Ae(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new fe(t)}static isPrivateKey(e){return e instanceof fe}};fe.LENGTH=32;var Ye=fe,gt=class gt extends G{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==gt.LENGTH)throw new Error(`Signature length should be ${gt.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new gt(t)}};gt.LENGTH=64;var Pe=gt;var _jwtdecode = require('jwt-decode');var Ze=class n extends Qe{constructor(e){super();let t=e.constructor.name;switch(t){case _.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r})}serialize(e){if(this.publicKey instanceof _)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(_.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},he= exports.EphemeralSignature =class n extends G{constructor(e){super();let t=e.constructor.name;switch(t){case v.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let t=l.fromHexInput(e),r=new ne(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var br=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Ii=31,Ca=16,Ei=(Ca-1)*Ii;function In(n,e){let r=new TextEncoder().encode(n);return Ea(r,e)}function Ea(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=wr(n,e);return Vt(t)}function Ia(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=za(n,e);return Ua(t)}function wr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Ia(n,e).concat([BigInt(n.length)])}function Ua(n){if(n.length>Ei)throw new Error(`Can't pack more than ${Ei}. Was given ${n.length} bytes`);return Ra(n,Ii).map(e=>$t(e))}function Ra(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function $t(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function Ui(n,e){let t=new Uint8Array(e);for(let r=0;r<e;r+=1)t[r]=Number(n&BigInt(255)),n>>=BigInt(8);return t}function za(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function Vt(n){if(n.length>br.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${br.length}`);return br[n.length-1](n)}var Un=class extends d{toString(){let e=this.bcsToBytes();return l.fromHexInput(e).toString()}};var ge=class extends Error{constructor(e,t,r){super(r),this.name="AptosApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.data=t.data,this.request=e}};var Ri="1.18.1";var zi={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},ki= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ki= 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"},Sr= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},xr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},_r= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(_r||{}),vr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},ld= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Ht=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Ht||{}),Gi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Bi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Rn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,zn= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Di= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Pr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Je= exports.ProcessorType =(a=>(a.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",a.DEFAULT="default_processor",a.EVENTS_PROCESSOR="events_processor",a.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",a.STAKE_PROCESSOR="stake_processor",a.TOKEN_V2_PROCESSOR="token_v2_processor",a.USER_TRANSACTION_PROCESSOR="user_transaction_processor",a))(Je||{});function Ni(n,e){let t=e.bcsToBytes(),r=new ne(t);return n.deserialize(r)}var Oi={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 ka(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _8 => _8.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Ri}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _9 => _9.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _10 => _10.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _11 => _11.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _12 => _12.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:p,overrides:a})}async function kn(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await ka({...n,url:o},e.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new ge(n,a,`Error: ${a.data}`);if(t==="Indexer"){let p=a.data;if(p.errors)throw new ge(n,a,_nullishCoalesce(`Indexer error: ${p.errors[0].message}`, () => (`Indexer unhandled Error ${s.status} : ${s.statusText}`)));a.data=p.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new ge(n,a,`${s.data}`);if(a.status>=200&&a.status<300)return a;let c;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?c=JSON.stringify(a.data):a.status in Oi?c=Oi[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ge(n,a,`${t} error: ${c}`)}async function Cr(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return kn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function M(n){let{aptosConfig:e}=n;return Cr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _13 => _13.clientConfig, 'optionalAccess', _14 => _14.HEADERS]),..._optionalChain([e, 'access', _15 => _15.fullnodeConfig, 'optionalAccess', _16 => _16.HEADERS])}}})}async function Gd(n){return Cr({...n,type:"Pepper"})}async function mt(n){let e=[],t,r=n.params;do{let i=await Cr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function Lt(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,y=c.getRequestUrl(e);return kn({url:y,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function et(n){let{aptosConfig:e}=n;return Lt({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _17 => _17.clientConfig, 'optionalAccess', _18 => _18.HEADERS]),..._optionalChain([e, 'access', _19 => _19.fullnodeConfig, 'optionalAccess', _20 => _20.HEADERS])}}})}async function Fi(n){let{aptosConfig:e}=n;return Lt({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _21 => _21.clientConfig, 'optionalAccess', _22 => _22.HEADERS]),..._optionalChain([e, 'access', _23 => _23.indexerConfig, 'optionalAccess', _24 => _24.HEADERS])}}})}async function Mi(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _25 => _25.clientConfig, 'optionalAccess', _26 => delete _26.API_KEY]),Lt({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _27 => _27.clientConfig, 'optionalAccess', _28 => _28.HEADERS]),..._optionalChain([t, 'access', _29 => _29.faucetConfig, 'optionalAccess', _30 => _30.HEADERS])}}})}async function qi(n){return Lt({...n,type:"Pepper"})}async function $i(n){return Lt({...n,type:"Prover"})}var Er=new Map;function Ne(n,e,t){return async(...r)=>{if(Er.has(e)){let{value:o,timestamp:s}=Er.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return Er.set(e,{value:i,timestamp:Date.now()}),i}}var dl=1e7,Ga= exports.MAX_AUD_VAL_BYTES =120,Ba= exports.MAX_UID_KEY_BYTES =30,Da= exports.MAX_UID_VAL_BYTES =330,ll= exports.MAX_ISS_VAL_BYTES =120,gl= exports.MAX_EXTRA_FIELD_BYTES =350,ml= exports.MAX_JWT_HEADER_B64_BYTES =300,yl= exports.MAX_COMMITED_EPK_BYTES =93,Te=class Te extends oe{constructor(e,t){super();let r=l.fromHexInput(t).toUint8Array();if(r.length!==Te.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Te.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new W;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),F.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Te(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Te(t,r)}static isPublicKey(e){return e instanceof Te}static create(e){return Vi(e),new Te(e.iss,Vi(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t),s=o.iss;if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let a=o.aud,c=o[i];return Te.create({iss:s,uidKey:i,uidVal:c,aud:a,pepper:r})}};Te.ID_COMMITMENT_LENGTH=32;var Z=Te;function Vi(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[$t(l.fromHexInput(i).toUint8Array()),In(r,Ga),In(t,Da),In(e,Ba)];return Ui(Vt(o),Z.ID_COMMITMENT_LENGTH)}var Ee=class n extends G{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=yt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=Ze.deserialize(e),s=he.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new yt(new Ie({proof:new At(new ft({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new Ze(new _(new Uint8Array(32))),ephemeralSignature:new he(new v(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},yt= exports.EphemeralCertificate =class n extends G{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Ie.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Ce=class n extends d{constructor(e){if(super(),this.data=l.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},tt=class n extends d{constructor(e){if(super(),this.data=l.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},ft= exports.Groth16Zkp =class n extends Un{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Ce(t),this.b=new tt(r),this.c=new Ce(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ce.deserialize(e).bcsToBytes(),r=tt.deserialize(e).bcsToBytes(),i=Ce.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},At= exports.ZkProof =class n extends d{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(ft.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},Ie= exports.ZeroKnowledgeSig =class n extends G{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new ne(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=At.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOptionStr(),o=e.deserializeOptionStr(),s=e.deserializeOption(he);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},Ir= exports.KeylessConfiguration =class n{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new Ur({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},Ur=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Ce(t),this.betaG2=new tt(r),this.deltaG2=new tt(i),this.gammaAbcG1=[new Ce(o[0]),new Ce(o[1])],this.gammaG2=new tt(s)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function Hi(n){let{aptosConfig:e}=n;return Ne(async()=>{let t=await Na(n),r=await Oa(n);return Ir.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function Na(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration",{data:i}=await M({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _31 => _31.ledgerVersion])}});return i.data}async function Oa(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await M({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _32 => _32.ledgerVersion])}});return i.data}var K=class n extends oe{constructor(e){if(super(),this.publicKey=e,e instanceof _)this.variant=0;else if(e instanceof Ae)this.variant=1;else if(e instanceof Z)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return r instanceof B?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return F.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=_.deserialize(e);break;case 1:r=Ae.deserialize(e);break;case 3:r=Z.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof _}isSecp256k1PublicKey(){return this.publicKey instanceof Ae}},B= exports.AnySignature =class n extends G{constructor(e){if(super(),this.signature=e,e instanceof v)this.variant=0;else if(e instanceof Pe)this.variant=1;else if(e instanceof Ee)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=v.deserialize(e);break;case 1:r=Pe.deserialize(e);break;case 3:r=Ee.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}};function Fa(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var ht=class n extends oe{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof K?i:new K(i)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return F.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(K),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}getIndex(e){let t=e instanceof K?e:new K(e),r=this.publicKeys.findIndex(i=>i.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}},J=class J extends G{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>J.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${J.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof B?o:new B(o)),!(r instanceof Uint8Array))this.bitmap=J.createBitmap({bits:r});else{if(r.length!==J.BITMAP_LEN)throw new Error(`"bitmap" length should be ${J.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+Fa(s),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach(s=>{if(s>=J.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${J.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(B),r=e.deserializeBytes();return new J({signatures:t,bitmap:r})}};J.BITMAP_LEN=4,J.MAX_SIGNATURES_SUPPORTED=J.BITMAP_LEN*8;var nt=J;var V=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return me.load(e);case 1:return Kn.load(e);case 2:return H.load(e);case 3:return rt.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof me}isMultiEd25519(){return this instanceof Kn}isSingleKey(){return this instanceof H}isMultiKey(){return this instanceof rt}},me= exports.AccountAuthenticatorEd25519 =class n extends V{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Kn= exports.AccountAuthenticatorMultiEd25519 =class n extends V{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=lt.deserialize(e),r=je.deserialize(e);return new n(t,r)}},H= exports.AccountAuthenticatorSingleKey =class n extends V{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=K.deserialize(e),r=B.deserialize(e);return new n(t,r)}},rt= exports.AccountAuthenticatorMultiKey =class n extends V{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=ht.deserialize(e),r=nt.deserialize(e);return new n(t,r)}};var Tt=class n extends d{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var R=class n extends d{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var Qt=class n extends d{constructor(e,t){super(),this.address=e,this.name=t}static fromStr(e){let t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(t[0]),new R(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=R.deserialize(e);return new n(t,r)}};var z=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return q.load(e);case 1:return be.load(e);case 2:return j.load(e);case 3:return St.load(e);case 4:return ee.load(e);case 5:return _t.load(e);case 6:return C.load(e);case 7:return m.load(e);case 8:return bt.load(e);case 9:return wt.load(e);case 10:return xt.load(e);case 255:return k.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof q}isAddress(){return this instanceof ee}isGeneric(){return this instanceof k}isSigner(){return this instanceof _t}isVector(){return this instanceof C}isStruct(){return this instanceof m}isU8(){return this instanceof be}isU16(){return this instanceof bt}isU32(){return this instanceof wt}isU64(){return this instanceof j}isU128(){return this instanceof St}isU256(){return this instanceof xt}},q= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},be= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},bt= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},wt= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},j= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},St= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},xt= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},ee= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},_t= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},Gn= exports.TypeTagReference =class n extends z{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=z.deserialize(t);return new n(r)}},k= exports.TypeTagGeneric =class n extends z{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},C= exports.TypeTagVector =class n extends z{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new be)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=z.deserialize(t);return new n(r)}},m= exports.TypeTagStruct =class n extends z{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=Ue.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}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 d{constructor(e,t,r,i){super(),this.address=e,this.moduleName=t,this.name=r,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 t=u.deserialize(e),r=R.deserialize(e),i=R.deserialize(e),o=e.deserializeVector(z);return new n(t,r,i,o)}};function _g(){return new Ue(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function P(){return new Ue(u.ONE,new R("string"),new R("String"),[])}function vg(n){return new Ue(u.ONE,new R("option"),new R("Option"),[n])}function te(n){return new Ue(u.ONE,new R("object"),new R("Object"),[n])}function Ma(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return N.deserialize(n);case 1:return O.deserialize(n);case 2:return de.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,N);case 5:return I.deserialize(n);case 6:return re.deserialize(n);case 7:return ie.deserialize(n);case 8:return le.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var it=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Wt.load(e);case 2:return jt.load(e);case 3:return Xt.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},Wt= exports.TransactionPayloadScript =class n extends it{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Yt.deserialize(e);return new n(t)}},jt= exports.TransactionPayloadEntryFunction =class n extends it{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=ot.deserialize(e);return new n(t)}},Xt= exports.TransactionPayloadMultiSig =class n extends it{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=Zt.deserialize(e);return new n(t)}},ot= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(Qt.fromStr(e),new R(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=Qt.deserialize(e),r=R.deserialize(e),i=e.deserializeVector(z),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),p=_n.deserialize(e,c);s.push(p)}return new n(t,r,i,s)}},Yt= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(z),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Ma(e);o.push(a)}return new n(t,r,o)}},Zt= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=u.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Jt.deserialize(e)),new n(t,i)}},Jt= exports.MultiSigTransactionPayload =class n extends d{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(ot.deserialize(e))}};var ce=class n extends d{constructor(e,t,r,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}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 t=u.deserialize(e),r=e.deserializeU64(),i=it.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Tt.deserialize(e);return new n(t,r,i,o,s,a,c)}},Bn= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return st.load(e);case 1:return at.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},st= exports.MultiAgentRawTransaction =class n extends Bn{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=ce.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},at= exports.FeePayerRawTransaction =class n extends Bn{constructor(e,t,r){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=r}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 t=ce.deserialize(e),r=e.deserializeVector(u),i=u.deserialize(e);return new n(t,r,i)}};var Dn=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new O(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=T.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var Re=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return vt.load(e);case 1:return Rr.load(e);case 2:return Pt.load(e);case 3:return Ct.load(e);case 4:return Et.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},vt= exports.TransactionAuthenticatorEd25519 =class n extends Re{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Rr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Re{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=lt.deserialize(e),r=je.deserialize(e);return new n(t,r)}},Pt= exports.TransactionAuthenticatorMultiAgent =class n extends Re{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=V.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(V);return new n(t,r,i)}},Ct= exports.TransactionAuthenticatorFeePayer =class n extends Re{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,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 t=V.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(V),o=u.deserialize(e),s=V.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},Et= exports.TransactionAuthenticatorSingleSender =class n extends Re{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=V.deserialize(e);return new n(t)}};var ct=class n extends d{constructor(e,t){super(),this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let t=ce.deserialize(e),r=Re.deserialize(e);return new n(t,r)}};var Nn=class n extends d{constructor(e,t){super(),this.rawTransaction=e,this.feePayerAddress=t}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=ce.deserialize(e),r=e.deserializeBool(),i;return r&&(i=u.deserialize(e)),new n(t,i)}};var On=class n extends d{constructor(e,t,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=t}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=ce.deserialize(e),r=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(t,r,o)}};function zr(n){return n.feePayerAddress?new at(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new st(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function It(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Bm(n){return It(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Ut(n){let e=zr(n);return n.feePayerAddress?It(e.bcsToBytes(),Pr):n.secondarySignerAddresses?It(e.bcsToBytes(),Pr):It(e.bcsToBytes(),Di)}var Rt=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=$.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=$.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new me(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new me(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Ut(e))}};var zt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new K(t.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=$.generate();break;case 2:r=Ye.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=$.fromDerivationPath(r,i);break;case 2:o=Ye.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new H(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new H(this.publicKey,this.signTransaction(e))}sign(e){return new B(this.privateKey.sign(e))}signTransaction(e){return this.sign(Ut(e))}};var Oe=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?Rt.generate():zt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof $&&i?new Rt({privateKey:t,address:r}):new zt({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?Rt.fromDerivationPath({mnemonic:r,path:i}):zt.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var Va=1209600,kt=class kt extends d{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new Ze(t.publicKey()),this.expiryDateSecs=r||_chunkBHKSQXUZjs.d.call(void 0, _chunkBHKSQXUZjs.c.call(void 0, )+Va),this.blinder=i!==void 0?l.fromHexInput(i).toUint8Array():Ha();let o=wr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push($t(this.blinder));let s=Vt(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=$.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new kt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return kt.deserialize(new ne(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _33 => _33.scheme])){case 0:default:t=$.generate()}return new kt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _34 => _34.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new he(this.privateKey.sign(e))}};kt.BLINDER_LENGTH=31;var en=kt;function Ha(){return _utils.randomBytes.call(void 0, en.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var Fe=class Fe extends d{constructor(e){super();let{address:t,ephemeralKeyPair:r,uidKey:i,uidVal:o,aud:s,pepper:a,proof:c,proofFetchCallback:p,jwt:y}=e;if(this.ephemeralKeyPair=r,this.publicKey=Z.create(e),this.accountAddress=t?u.from(t):this.publicKey.authKey().derivedAddress(),this.uidKey=i,this.uidVal=o,this.aud=s,this.jwt=y,this.emitter=new _eventemitter32.default,this.proofOrPromise=c,c instanceof Ie)this.proof=c;else{if(p===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async S=>{await p(S),this.emitter.removeAllListeners()}),this.init(c)}this.signingScheme=2;let w=l.fromHexInput(a).toUint8Array();if(w.length!==Fe.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Fe.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(t){t instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:t.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=en.deserialize(e),s=Ie.deserialize(e);return Fe.create({proof:s,pepper:i,uidKey:r,jwt:t,ephemeralKeyPair:o})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let t=new B(this.sign(e)),r=new K(this.publicKey);return new H(r,t)}signTransactionWithAuthenticator(e){let t=new B(this.signTransaction(e)),r=new K(this.publicKey);return new H(r,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:t}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let r=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new Ee({jwtHeader:_chunkBHKSQXUZjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new yt(this.proof,0),expiryDateSecs:t,ephemeralPublicKey:r,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let t=zr(e),i=new kr(t,this.proof.proof).hash();return this.sign(i)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return Fe.deserialize(new ne(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=e,p=_jwtdecode.jwtDecode.call(void 0, i),y=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let w=p.aud,S=p[a];return new Fe({address:t,proof:r,ephemeralKeyPair:o,iss:y,uidKey:a,uidVal:S,aud:w,pepper:s,jwt:i,proofFetchCallback:c})}};Fe.PEPPER_LENGTH=31;var we=Fe,kr=class extends d{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return It(this.bcsToBytes(),this.domainSeparator)}};var Fn=class n{constructor(e){let{multiKey:t,signers:r}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let i=[];for(let s of r)i.push(this.publicKey.getIndex(s.publicKey));let o=r.map((s,a)=>[s,i[a]]);o.sort((s,a)=>s[1]-a[1]),this.signers=o.map(s=>s[0]),this.signerIndicies=o.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:i})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new ht({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new rt(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new rt(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof we).map(async r=>r.waitForProofFetch());await Promise.all(t)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new nt({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new nt({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:t,signature:s}))return!1}return!0}};var Wa=`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkBHKSQXUZjs = require('./chunk-BHKSQXUZ.js');var wn=255,Sn=65535,ve=4294967295,We=18446744073709551615n,Mt=340282366920938463463374607431768211455n,xn=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var re=class{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(e){return this.deserializeBool()?this.deserialize(e):void 0}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===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 e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<ve;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),!(r&128))break;t+=7}if(e>ve)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var _utils = require('@noble/hashes/utils');var X=class extends Error{constructor(e,t){super(e),this.invalidReason=t}};var Xs=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(Xs||{}),l= exports.Hex =class n{constructor(e){this.data=e}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(e){let t=e;if(t.startsWith("0x")&&(t=t.slice(2)),t.length===0)throw new X("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(t.length%2!==0)throw new X("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, t))}catch(r){throw new X(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(e){return e instanceof Uint8Array?new n(e):n.fromHexString(e)}static isValid(e){try{return n.fromHexString(e),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _4 => _4.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};var d=class{bcsToBytes(){let e=new Y;return this.serialize(e),e.toUint8Array()}bcsToHex(){let e=this.bcsToBytes();return l.fromHexInput(e)}},Y= exports.Serializer =class{constructor(e=64){if(e<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(e),this.offset=0}ensureBufferWillHandleSize(e){for(;this.buffer.byteLength<this.offset+e;){let t=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(t).set(new Uint8Array(this.buffer)),this.buffer=t}}appendToBuffer(e){this.ensureBufferWillHandleSize(e.length),new Uint8Array(this.buffer,this.offset).set(e),this.offset+=e.length}serializeWithFunction(e,t,r){this.ensureBufferWillHandleSize(t);let i=new DataView(this.buffer,this.offset);e.apply(i,[0,r,!0]),this.offset+=t}serializeStr(e){let t=new TextEncoder;this.serializeBytes(t.encode(e))}serializeBytes(e){this.serializeU32AsUleb128(e.length),this.appendToBuffer(e)}serializeFixedBytes(e){this.appendToBuffer(e)}serializeBool(e){gr(e);let t=e?1:0;this.appendToBuffer(new Uint8Array([t]))}serializeU8(e){this.appendToBuffer(new Uint8Array([e]))}serializeU16(e){this.serializeWithFunction(DataView.prototype.setUint16,2,e)}serializeU32(e){this.serializeWithFunction(DataView.prototype.setUint32,4,e)}serializeU64(e){let t=BigInt(e)&BigInt(ve),r=BigInt(e)>>BigInt(32);this.serializeU32(Number(t)),this.serializeU32(Number(r))}serializeU128(e){let t=BigInt(e)&We,r=BigInt(e)>>BigInt(64);this.serializeU64(t),this.serializeU64(r)}serializeU256(e){let t=BigInt(e)&Mt,r=BigInt(e)>>BigInt(128);this.serializeU128(t),this.serializeU128(r)}serializeU32AsUleb128(e){let t=e,r=[];for(;t>>>7;)r.push(t&127|128),t>>>=7;r.push(t),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(e){e.serialize(this)}serializeVector(e){this.serializeU32AsUleb128(e.length),e.forEach(t=>{t.serialize(this)})}serializeOption(e){let t=e!==void 0;this.serializeBool(t),t&&e.serialize(this)}serializeOptionStr(e){e===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(e))}};_chunkBHKSQXUZjs.a.call(void 0, [je(0,wn)],Y.prototype,"serializeU8",1),_chunkBHKSQXUZjs.a.call(void 0, [je(0,Sn)],Y.prototype,"serializeU16",1),_chunkBHKSQXUZjs.a.call(void 0, [je(0,ve)],Y.prototype,"serializeU32",1),_chunkBHKSQXUZjs.a.call(void 0, [je(BigInt(0),We)],Y.prototype,"serializeU64",1),_chunkBHKSQXUZjs.a.call(void 0, [je(BigInt(0),Mt)],Y.prototype,"serializeU128",1),_chunkBHKSQXUZjs.a.call(void 0, [je(BigInt(0),xn)],Y.prototype,"serializeU256",1),_chunkBHKSQXUZjs.a.call(void 0, [je(0,ve)],Y.prototype,"serializeU32AsUleb128",1);function gr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Ys=(n,e,t)=>`${n} is out of range: [${e}, ${t}]`;function Ge(n,e,t){let r=BigInt(n);if(r>BigInt(t)||r<BigInt(e))throw new Error(Ys(n,e,t))}function je(n,e){return(t,r,i)=>{let o=i.value;return i.value=function(a){return Ge(a,n,e),o.apply(this,[a])},i}}var Xe=class n extends d{constructor(e){super(),this.value=l.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var _n=class n extends d{constructor(e){super(),this.value=new Xe(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Xe.deserialize(e,t);return new n(r.value)}};var vn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(vn||{}),di= 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))(di||{}),qt= exports.ScriptTransactionArgumentVariants =(p=>(p[p.U8=0]="U8",p[p.U64=1]="U64",p[p.U128=2]="U128",p[p.Address=3]="Address",p[p.U8Vector=4]="U8Vector",p[p.Bool=5]="Bool",p[p.U16=6]="U16",p[p.U32=7]="U32",p[p.U256=8]="U256",p))(qt||{}),li= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(li||{}),gi= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(gi||{}),mi= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(mi||{}),yi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(yi||{}),mr= exports.AnyPublicKeyVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(mr||{}),fi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(fi||{}),yr= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(yr||{}),Ai= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Ai||{}),fr= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(fr||{}),Ar= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(Ar||{}),hr= exports.TransactionResponseType =(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s.Validator="validator_transaction",s))(hr||{});function pu(n){return n.type==="pending_transaction"}function du(n){return n.type==="user_transaction"}function lu(n){return n.type==="genesis_transaction"}function gu(n){return n.type==="block_metadata_transaction"}function mu(n){return n.type==="state_checkpoint_transaction"}function yu(n){return n.type==="validator_transaction"}function fu(n){return"signature"in n&&n.signature==="ed25519_signature"}function Au(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function hu(n){return n.type==="multi_agent_signature"}function Tu(n){return n.type==="fee_payer_signature"}function bu(n){return n.type==="multi_ed25519_signature"}var Zs=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Zs||{}),hi= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(hi||{}),Js= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Js||{}),Ae= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Ae||{}),Tr= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(Tr||{}),ea= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(ea||{});var I=class n extends d{constructor(e){super(),gr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},F= exports.U8 =class n extends d{constructor(e){super(),Ge(e,0,wn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},de= exports.U16 =class n extends d{constructor(e){super(),Ge(e,0,Sn),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},le= exports.U32 =class n extends d{constructor(e){super(),Ge(e,0,ve),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),We),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},ge= exports.U128 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),Mt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},me= exports.U256 =class n extends d{constructor(e){super(),Ge(e,BigInt(0),xn),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var T=class n extends d{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(!(this.values[0]instanceof F)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=l.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new F(r)))}static U16(e){return new n(e.map(t=>new de(t)))}static U32(e){return new n(e.map(t=>new le(t)))}static U64(e){return new n(e.map(t=>new O(t)))}static U128(e){return new n(e.map(t=>new ge(t)))}static U256(e){return new n(e.map(t=>new me(t)))}static Bool(e){return new n(e.map(t=>new I(t)))}static MoveString(e){return new n(e.map(t=>new b(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},b= exports.MoveString =class n extends d{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let t=this.bcsToBytes().slice(1);T.U8(t).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},M= exports.MoveOption =class n extends d{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new T([e]):this.vec=new T([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new F(e):void 0)}static U16(e){return new n(e!=null?new de(e):void 0)}static U32(e){return new n(e!=null?new le(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new ge(e):void 0)}static U256(e){return new n(e!=null?new me(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new b(e):void 0)}static deserialize(e,t){let r=T.deserialize(e,t);return new n(r.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var na=(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))(na||{}),x=class x extends d{constructor(e){if(super(),e.length!==x.LENGTH)throw new X("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 t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let t=e.deserializeFixedBytes(x.LENGTH);return new x(t)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new X("Hex string must start with a leading 0x.","leading_zero_x_required");let t=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(t.isSpecial()){if(e.length!==3)throw new X(`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 X(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return t}static fromString(e){let t=e;if(e.startsWith("0x")&&(t=e.slice(2)),t.length===0)throw new X("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(t.length>64)throw new X("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let r;try{r=_utils.hexToBytes.call(void 0, t.padStart(64,"0"))}catch(i){throw new X(`Hex characters are invalid: ${_optionalChain([i, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(r)}static from(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromString(e)}static fromStrict(e){return e instanceof x?e:e instanceof Uint8Array?new x(e):x.fromStringStrict(e)}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.from(e.input),{valid:!0}}catch(t){return{valid:!1,invalidReason:_optionalChain([t, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([t, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((t,r)=>t===e.data[r])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4");var u=x;var Be=class Be extends d{constructor(e){super();let{data:t}=e,r=l.fromHexInput(t);if(r.toUint8Array().length!==Be.LENGTH)throw new Error(`Authentication Key length should be ${Be.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(Be.LENGTH);return new Be({data:t})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=l.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new Be({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};Be.LENGTH=32;var q=Be;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var bi = _interopRequireWildcard(_bip39);var sa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,aa= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,ca= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(ca||{}),wi= exports.HARDENED_OFFSET =2147483648;function Si(n){return aa.test(n)}function xi(n){return sa.test(n)}var br=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},_i= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return br(e,s)},ua=n=>n.replace("'",""),vi= exports.splitPath =n=>n.split("/").slice(1).map(ua),Pn= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return bi.mnemonicToSeedSync(e)};var Ye=class extends d{toString(){let e=this.toUint8Array();return l.fromHexInput(e).toString()}},ie= exports.AccountPublicKey =class extends Ye{};var G=class extends d{toString(){let e=this.toUint8Array();return l.fromHexInput(e).toString()}};var mt=n=>typeof n=="string"?l.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Pi=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16],Ze=class Ze extends ie{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==Ze.LENGTH)throw new Error(`PublicKey length should be ${Ze.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof v))return!1;let i=mt(t),o=l.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return r.isCanonicalSignature()?_ed25519.ed25519.verify(s,o,a):!1}authKey(){return q.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ze(t)}static isPublicKey(e){return e instanceof Ze}};Ze.LENGTH=32;var _=Ze,oe=class oe extends d{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==oe.LENGTH)throw new Error(`PrivateKey length should be ${oe.LENGTH}`);this.signingKey=t}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new oe(e)}static fromDerivationPath(e,t){if(!xi(e))throw new Error(`Invalid derivation path ${e}`);return oe.fromDerivationPathInner(e,Pn(t))}static fromDerivationPathInner(e,t,r=wi){let{key:i,chainCode:o}=br(oe.SLIP_0010_SEED,t),s=vi(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>_i(c,p+r),{key:i,chainCode:o});return new oe(a)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=mt(e),r=l.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new oe(t)}static isPrivateKey(e){return e instanceof oe}};oe.LENGTH=32,oe.SLIP_0010_SEED="ed25519 seed";var L=oe,yt=class yt extends G{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==yt.LENGTH)throw new Error(`Signature length should be ${yt.LENGTH}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new yt(t)}isCanonicalSignature(){let e=this.toUint8Array().slice(32);for(let t=e.length-1;t>=0;t-=1){if(e[t]<Pi[t])return!0;if(e[t]>Pi[t])return!1}return!1}};yt.LENGTH=64;var v=yt;var se=class se extends ie{constructor(e){super();let{publicKeys:t,threshold:r}=e;if(t.length>se.MAX_KEYS||t.length<se.MIN_KEYS)throw new Error(`Must have between ${se.MIN_KEYS} and ${se.MAX_KEYS} public keys, inclusive`);if(r<se.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${se.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Je))return!1;let i=[];for(let o=0;o<4;o+=1)for(let s=0;s<8;s+=1)if((r.bitmap[o]&1<<7-s)!==0){let c=o*8+s;i.push(c)}if(i.length!==r.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(i.length<this.threshold)throw new Error("Not enough signatures");for(let o=0;o<i.length;o+=1)if(!this.publicKeys[i[o]].verifySignature({message:t,signature:r.signatures[o]}))return!1;return!0}authKey(){return q.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*_.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*_.LENGTH)}),e[this.publicKeys.length*_.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=_.LENGTH){let s=o;i.push(new _(t.subarray(s,s+_.LENGTH)))}return new se({publicKeys:i,threshold:r})}};se.MAX_KEYS=32,se.MIN_KEYS=2,se.MIN_THRESHOLD=1;var ft=se,J=class J extends G{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>J.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${J.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=J.createBitmap({bits:r});else{if(r.length!==J.BITMAP_LEN)throw new Error(`"bitmap" length should be ${J.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*v.LENGTH+J.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*v.LENGTH)}),e.set(this.bitmap,this.signatures.length*v.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t.subarray(t.length-4),i=[];for(let o=0;o<t.length-r.length;o+=v.LENGTH){let s=o;i.push(new v(t.subarray(s,s+v.LENGTH)))}return new J({signatures:i,bitmap:r})}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(s>=J.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${J.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");if(a>0&&s<=t[a-1])throw new Error("The bits need to be sorted in ascending order.");o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}};J.MAX_SIGNATURES_SUPPORTED=32,J.BITMAP_LEN=4;var Je=J;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var et=class et extends Ye{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==et.LENGTH)throw new Error(`PublicKey length should be ${et.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Pe))return!1;let i=mt(t),o=l.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new et(t)}static isPublicKey(e){return e instanceof et}};et.LENGTH=65;var Te=et,he=class he extends d{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==he.LENGTH)throw new Error(`PrivateKey length should be ${he.LENGTH}`);this.key=t}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new he(e)}static fromDerivationPath(e,t){if(!Si(e))throw new Error(`Invalid derivation path ${e}`);return he.fromDerivationPathInner(e,Pn(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new he(r)}sign(e){let t=mt(e),r=l.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new Pe(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new Te(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new he(t)}static isPrivateKey(e){return e instanceof he}};he.LENGTH=32;var tt=he,At=class At extends G{constructor(e){super();let t=l.fromHexInput(e);if(t.toUint8Array().length!==At.LENGTH)throw new Error(`Signature length should be ${At.LENGTH}, received ${t.toUint8Array().length}`);this.data=t}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new At(t)}};At.LENGTH=64;var Pe=At;var _jwtdecode = require('jwt-decode');var nt=class n extends Ye{constructor(e){super();let t=e.constructor.name;switch(t){case _.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r})}serialize(e){if(this.publicKey instanceof _)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(_.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},be= exports.EphemeralSignature =class n extends G{constructor(e){super();let t=e.constructor.name;switch(t){case v.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let t=l.fromHexInput(e),r=new re(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var wr=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Ii=31,Ca=16,Ei=(Ca-1)*Ii;function In(n,e){let r=new TextEncoder().encode(n);return Ea(r,e)}function Ea(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Sr(n,e);return Vt(t)}function Ia(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=za(n,e);return Ua(t)}function Sr(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Ia(n,e).concat([BigInt(n.length)])}function Ua(n){if(n.length>Ei)throw new Error(`Can't pack more than ${Ei}. Was given ${n.length} bytes`);return Ra(n,Ii).map(e=>$t(e))}function Ra(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function $t(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function Ui(n,e){let t=new Uint8Array(e);for(let r=0;r<e;r+=1)t[r]=Number(n&BigInt(255)),n>>=BigInt(8);return t}function za(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function Vt(n){if(n.length>wr.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${wr.length}`);return wr[n.length-1](n)}var Un=class extends d{toString(){let e=this.bcsToBytes();return l.fromHexInput(e).toString()}};var ye=class extends Error{constructor(e,t,r){super(r),this.name="AptosApiError",this.url=t.url,this.status=t.status,this.statusText=t.statusText,this.data=t.data,this.request=e}};var Ri="1.19.0";var zi={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},ki= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ki= 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"},xr= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},_r= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},vr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(vr||{}),Pr= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},gd= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Lt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(Lt||{}),Gi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Bi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Rn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,zn= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Di= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Cr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",rt= exports.ProcessorType =(a=>(a.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",a.DEFAULT="default_processor",a.EVENTS_PROCESSOR="events_processor",a.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",a.STAKE_PROCESSOR="stake_processor",a.TOKEN_V2_PROCESSOR="token_v2_processor",a.USER_TRANSACTION_PROCESSOR="user_transaction_processor",a))(rt||{});function Ni(n,e){let t=e.bcsToBytes(),r=new re(t);return n.deserialize(r)}var Oi={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 ka(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _8 => _8.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Ri}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _9 => _9.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _10 => _10.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _11 => _11.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _12 => _12.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:p,overrides:a})}async function kn(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await ka({...n,url:o},e.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new ye(n,a,`Error: ${a.data}`);if(t==="Indexer"){let p=a.data;if(p.errors)throw new ye(n,a,_nullishCoalesce(`Indexer error: ${p.errors[0].message}`, () => (`Indexer unhandled Error ${s.status} : ${s.statusText}`)));a.data=p.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new ye(n,a,`${s.data}`);if(a.status>=200&&a.status<300)return a;let c;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?c=JSON.stringify(a.data):a.status in Oi?c=Oi[a.status]:c=`Unhandled Error ${a.status} : ${a.statusText}`,new ye(n,a,`${t} error: ${c}`)}async function Er(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return kn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function $(n){let{aptosConfig:e}=n;return Er({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _13 => _13.clientConfig, 'optionalAccess', _14 => _14.HEADERS]),..._optionalChain([e, 'access', _15 => _15.fullnodeConfig, 'optionalAccess', _16 => _16.HEADERS])}}})}async function Bd(n){return Er({...n,type:"Pepper"})}async function ht(n){let e=[],t,r=n.params;do{let i=await Er({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function Ht(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,y=c.getRequestUrl(e);return kn({url:y,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function it(n){let{aptosConfig:e}=n;return Ht({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _17 => _17.clientConfig, 'optionalAccess', _18 => _18.HEADERS]),..._optionalChain([e, 'access', _19 => _19.fullnodeConfig, 'optionalAccess', _20 => _20.HEADERS])}}})}async function Fi(n){let{aptosConfig:e}=n;return Ht({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _21 => _21.clientConfig, 'optionalAccess', _22 => _22.HEADERS]),..._optionalChain([e, 'access', _23 => _23.indexerConfig, 'optionalAccess', _24 => _24.HEADERS])}}})}async function Mi(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _25 => _25.clientConfig, 'optionalAccess', _26 => delete _26.API_KEY]),Ht({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _27 => _27.clientConfig, 'optionalAccess', _28 => _28.HEADERS]),..._optionalChain([t, 'access', _29 => _29.faucetConfig, 'optionalAccess', _30 => _30.HEADERS])}}})}async function qi(n){return Ht({...n,type:"Pepper"})}async function $i(n){return Ht({...n,type:"Prover"})}var Ir=new Map;function De(n,e,t){return async(...r)=>{if(Ir.has(e)){let{value:o,timestamp:s}=Ir.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return Ir.set(e,{value:i,timestamp:Date.now()}),i}}var ll=1e7,Ga= exports.MAX_AUD_VAL_BYTES =120,Ba= exports.MAX_UID_KEY_BYTES =30,Da= exports.MAX_UID_VAL_BYTES =330,gl= exports.MAX_ISS_VAL_BYTES =120,ml= exports.MAX_EXTRA_FIELD_BYTES =350,yl= exports.MAX_JWT_HEADER_B64_BYTES =300,fl= exports.MAX_COMMITED_EPK_BYTES =93,we=class we extends ie{constructor(e,t){super();let r=l.fromHexInput(t).toUint8Array();if(r.length!==we.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${we.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new Y;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),q.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return l.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new we(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new we(t,r)}static isPublicKey(e){return e instanceof we}static create(e){return Vi(e),new we(e.iss,Vi(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, t),s=o.iss;if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let a=o.aud,c=o[i];return we.create({iss:s,uidKey:i,uidVal:c,aud:a,pepper:r})}};we.ID_COMMITMENT_LENGTH=32;var ee=we;function Vi(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[$t(l.fromHexInput(i).toUint8Array()),In(r,Ga),In(t,Da),In(e,Ba)];return Ui(Vt(o),ee.ID_COMMITMENT_LENGTH)}var Ee=class n extends G{constructor(e){super();let{jwtHeader:t,ephemeralCertificate:r,expiryDateSecs:i,ephemeralPublicKey:o,ephemeralSignature:s}=e;this.jwtHeader=t,this.ephemeralCertificate=r,this.expiryDateSecs=i,this.ephemeralPublicKey=o,this.ephemeralSignature=s}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let t=Tt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=nt.deserialize(e),s=be.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new Tt(new Ie({proof:new wt(new bt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new nt(new _(new Uint8Array(32))),ephemeralSignature:new be(new v(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},Tt= exports.EphemeralCertificate =class n extends G{constructor(e,t){super(),this.signature=e,this.variant=t}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(Ie.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Ce=class n extends d{constructor(e){if(super(),this.data=l.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(32);return new n(t)}},ot=class n extends d{constructor(e){if(super(),this.data=l.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let t=e.deserializeFixedBytes(64);return new n(t)}},bt= exports.Groth16Zkp =class n extends Un{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Ce(t),this.b=new ot(r),this.c=new Ce(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ce.deserialize(e).bcsToBytes(),r=ot.deserialize(e).bcsToBytes(),i=Ce.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}},wt= exports.ZkProof =class n extends d{constructor(e,t){super(),this.proof=e,this.variant=t}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(bt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},Ie= exports.ZeroKnowledgeSig =class n extends G{constructor(e){super();let{proof:t,expHorizonSecs:r,trainingWheelsSignature:i,extraField:o,overrideAudVal:s}=e;this.proof=t,this.expHorizonSecs=r,this.trainingWheelsSignature=i,this.extraField=o,this.overrideAudVal=s}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new re(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=wt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOptionStr(),o=e.deserializeOptionStr(),s=e.deserializeOption(be);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},Ur= exports.KeylessConfiguration =class n{constructor(e,t){this.verficationKey=e,this.maxExpHorizonSecs=t}static create(e,t){return new n(new Rr({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),t)}},Rr=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Ce(t),this.betaG2=new ot(r),this.deltaG2=new ot(i),this.gammaAbcG1=[new Ce(o[0]),new Ce(o[1])],this.gammaG2=new ot(s)}static fromGroth16VerificationKeyResponse(e){return new n({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2})}};async function Li(n){let{aptosConfig:e}=n;return De(async()=>{let t=await Na(n),r=await Oa(n);return Ur.create(r,Number(t.max_exp_horizon_secs))},`keyless-configuration-${e.network}`,1e3*60*5)()}async function Na(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration",{data:i}=await $({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _31 => _31.ledgerVersion])}});return i.data}async function Oa(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await $({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _32 => _32.ledgerVersion])}});return i.data}var K=class n extends ie{constructor(e){if(super(),this.publicKey=e,e instanceof _)this.variant=0;else if(e instanceof Te)this.variant=1;else if(e instanceof ee)this.variant=3;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;return r instanceof B?this.publicKey.verifySignature({message:t,signature:r.signature}):!1}authKey(){return q.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=_.deserialize(e);break;case 1:r=Te.deserialize(e);break;case 3:r=ee.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${t}`)}return new n(r)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof _}isSecp256k1PublicKey(){return this.publicKey instanceof Te}},B= exports.AnySignature =class n extends G{constructor(e){if(super(),this.signature=e,e instanceof v)this.variant=0;else if(e instanceof Pe)this.variant=1;else if(e instanceof Ee)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=v.deserialize(e);break;case 1:r=Pe.deserialize(e);break;case 3:r=Ee.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}};function Fa(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var St=class n extends ie{constructor(e){super();let{publicKeys:t,signaturesRequired:r}=e;if(r<1)throw new Error("The number of required signatures needs to be greater than 0");if(t.length<r)throw new Error(`Provided ${t.length} public keys is smaller than the ${r} required signatures`);this.publicKeys=t.map(i=>i instanceof K?i:new K(i)),this.signaturesRequired=r}verifySignature(e){throw new Error("not implemented")}authKey(){return q.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(K),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach((s,a)=>{if(a+1>this.publicKeys.length)throw new Error(`Signature index ${a+1} is out of public keys range, ${this.publicKeys.length}.`);if(o.has(s))throw new Error(`Duplicate bit ${s} detected.`);o.add(s);let c=Math.floor(s/8),p=i[c];p|=r>>s%8,i[c]=p}),i}getIndex(e){let t=e instanceof K?e:new K(e),r=this.publicKeys.findIndex(i=>i.toString()===t.toString());if(r!==-1)return r;throw new Error("Public key not found in MultiKey")}},te=class te extends G{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>te.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${te.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof B?o:new B(o)),!(r instanceof Uint8Array))this.bitmap=te.createBitmap({bits:r});else{if(r.length!==te.BITMAP_LEN)throw new Error(`"bitmap" length should be ${te.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+Fa(s),0);if(i!==this.signatures.length)throw new Error(`Expecting ${i} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:t}=e,r=128,i=new Uint8Array([0,0,0,0]),o=new Set;return t.forEach(s=>{if(s>=te.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${te.MAX_SIGNATURES_SUPPORTED-1}.`);if(o.has(s))throw new Error("Duplicate bits detected.");o.add(s);let a=Math.floor(s/8),c=i[a];c|=r>>s%8,i[a]=c}),i}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(B),r=e.deserializeBytes();return new te({signatures:t,bitmap:r})}};te.BITMAP_LEN=4,te.MAX_SIGNATURES_SUPPORTED=te.BITMAP_LEN*8;var st=te;var H=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return fe.load(e);case 1:return Kn.load(e);case 2:return Q.load(e);case 3:return at.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof fe}isMultiEd25519(){return this instanceof Kn}isSingleKey(){return this instanceof Q}isMultiKey(){return this instanceof at}},fe= exports.AccountAuthenticatorEd25519 =class n extends H{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},Kn= exports.AccountAuthenticatorMultiEd25519 =class n extends H{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=ft.deserialize(e),r=Je.deserialize(e);return new n(t,r)}},Q= exports.AccountAuthenticatorSingleKey =class n extends H{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=K.deserialize(e),r=B.deserialize(e);return new n(t,r)}},at= exports.AccountAuthenticatorMultiKey =class n extends H{constructor(e,t){super(),this.public_keys=e,this.signatures=t}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let t=St.deserialize(e),r=st.deserialize(e);return new n(t,r)}};var xt=class n extends d{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var R=class n extends d{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var Qt=class n extends d{constructor(e,t){super(),this.address=e,this.name=t}static fromStr(e){let t=e.split("::");if(t.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(t[0]),new R(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=R.deserialize(e);return new n(t,r)}};var z=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return D.load(e);case 1:return ae.load(e);case 2:return V.load(e);case 3:return Fe.load(e);case 4:return W.load(e);case 5:return _t.load(e);case 6:return C.load(e);case 7:return m.load(e);case 8:return Ne.load(e);case 9:return Oe.load(e);case 10:return Me.load(e);case 255:return k.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof D}isAddress(){return this instanceof W}isGeneric(){return this instanceof k}isSigner(){return this instanceof _t}isVector(){return this instanceof C}isStruct(){return this instanceof m}isU8(){return this instanceof ae}isU16(){return this instanceof Ne}isU32(){return this instanceof Oe}isU64(){return this instanceof V}isU128(){return this instanceof Fe}isU256(){return this instanceof Me}},D= exports.TypeTagBool =class n extends z{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ae= exports.TypeTagU8 =class n extends z{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},Ne= exports.TypeTagU16 =class n extends z{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Oe= exports.TypeTagU32 =class n extends z{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},V= exports.TypeTagU64 =class n extends z{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Fe= exports.TypeTagU128 =class n extends z{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Me= exports.TypeTagU256 =class n extends z{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},W= exports.TypeTagAddress =class n extends z{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},_t= exports.TypeTagSigner =class n extends z{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},Gn= exports.TypeTagReference =class n extends z{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=z.deserialize(t);return new n(r)}},k= exports.TypeTagGeneric =class n extends z{constructor(t){super();this.value=t;if(t<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(t){t.serializeU32AsUleb128(255),t.serializeU32(this.value)}static load(t){let r=t.deserializeU32();return new n(r)}},C= exports.TypeTagVector =class n extends z{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ae)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=z.deserialize(t);return new n(r)}},m= exports.TypeTagStruct =class n extends z{constructor(t){super();this.value=t}toString(){let t="";return this.value.typeArgs.length>0&&(t=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${t}`}serialize(t){t.serializeU32AsUleb128(7),this.value.serialize(t)}static load(t){let r=Ue.deserialize(t);return new n(r)}isTypeTag(t,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(t)}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 d{constructor(e,t,r,i){super(),this.address=e,this.moduleName=t,this.name=r,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 t=u.deserialize(e),r=R.deserialize(e),i=R.deserialize(e),o=e.deserializeVector(z);return new n(t,r,i,o)}};function vg(){return new Ue(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function P(){return new Ue(u.ONE,new R("string"),new R("String"),[])}function Pg(n){return new Ue(u.ONE,new R("option"),new R("Option"),[n])}function ne(n){return new Ue(u.ONE,new R("object"),new R("Object"),[n])}function Ma(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return F.deserialize(n);case 1:return O.deserialize(n);case 2:return ge.deserialize(n);case 3:return u.deserialize(n);case 4:return T.deserialize(n,F);case 5:return I.deserialize(n);case 6:return de.deserialize(n);case 7:return le.deserialize(n);case 8:return me.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var ct=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Wt.load(e);case 2:return jt.load(e);case 3:return Xt.load(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},Wt= exports.TransactionPayloadScript =class n extends ct{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Yt.deserialize(e);return new n(t)}},jt= exports.TransactionPayloadEntryFunction =class n extends ct{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=ut.deserialize(e);return new n(t)}},Xt= exports.TransactionPayloadMultiSig =class n extends ct{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=Zt.deserialize(e);return new n(t)}},ut= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(Qt.fromStr(e),new R(t),r,i)}serialize(e){this.module_name.serialize(e),this.function_name.serialize(e),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForEntryFunction(e)})}static deserialize(e){let t=Qt.deserialize(e),r=R.deserialize(e),i=e.deserializeVector(z),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),p=_n.deserialize(e,c);s.push(p)}return new n(t,r,i,s)}},Yt= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(z),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Ma(e);o.push(a)}return new n(t,r,o)}},Zt= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=u.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Jt.deserialize(e)),new n(t,i)}},Jt= exports.MultiSigTransactionPayload =class n extends d{constructor(e){super(),this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(ut.deserialize(e))}};var ce=class n extends d{constructor(e,t,r,i,o,s,a){super(),this.sender=e,this.sequence_number=t,this.payload=r,this.max_gas_amount=i,this.gas_unit_price=o,this.expiration_timestamp_secs=s,this.chain_id=a}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 t=u.deserialize(e),r=e.deserializeU64(),i=ct.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=xt.deserialize(e);return new n(t,r,i,o,s,a,c)}},Bn= exports.RawTransactionWithData =class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return pt.load(e);case 1:return dt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},pt= exports.MultiAgentRawTransaction =class n extends Bn{constructor(e,t){super(),this.raw_txn=e,this.secondary_signer_addresses=t}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let t=ce.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},dt= exports.FeePayerRawTransaction =class n extends Bn{constructor(e,t,r){super(),this.raw_txn=e,this.secondary_signer_addresses=t,this.fee_payer_address=r}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 t=ce.deserialize(e),r=e.deserializeVector(u),i=u.deserialize(e);return new n(t,r,i)}};var Dn=class extends d{constructor(t){super();this.accountAddress=u.ONE;this.moduleName=new b("account");this.structName=new b("RotationProofChallenge");this.sequenceNumber=new O(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=T.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var Re=class extends d{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return vt.load(e);case 1:return zr.load(e);case 2:return Pt.load(e);case 3:return Ct.load(e);case 4:return Et.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}},vt= exports.TransactionAuthenticatorEd25519 =class n extends Re{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=v.deserialize(e);return new n(t,r)}},zr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Re{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=ft.deserialize(e),r=Je.deserialize(e);return new n(t,r)}},Pt= exports.TransactionAuthenticatorMultiAgent =class n extends Re{constructor(e,t,r){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let t=H.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(H);return new n(t,r,i)}},Ct= exports.TransactionAuthenticatorFeePayer =class n extends Re{constructor(e,t,r,i){super(),this.sender=e,this.secondary_signer_addresses=t,this.secondary_signers=r,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 t=H.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(H),o=u.deserialize(e),s=H.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},Et= exports.TransactionAuthenticatorSingleSender =class n extends Re{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=H.deserialize(e);return new n(t)}};var lt=class n extends d{constructor(e,t){super(),this.raw_txn=e,this.authenticator=t}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let t=ce.deserialize(e),r=Re.deserialize(e);return new n(t,r)}};var Nn=class n extends d{constructor(e,t){super(),this.rawTransaction=e,this.feePayerAddress=t}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=ce.deserialize(e),r=e.deserializeBool(),i;return r&&(i=u.deserialize(e)),new n(t,i)}};var On=class n extends d{constructor(e,t,r){super(),this.rawTransaction=e,this.feePayerAddress=r,this.secondarySignerAddresses=t}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let t=ce.deserialize(e),r=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(t,r,o)}};function kr(n){return n.feePayerAddress?new dt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new pt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function It(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Dm(n){return It(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Ut(n){let e=kr(n);return n.feePayerAddress?It(e.bcsToBytes(),Cr):n.secondarySignerAddresses?It(e.bcsToBytes(),Cr):It(e.bcsToBytes(),Di)}var Rt=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=L.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=L.fromDerivationPath(t,r);return new n({privateKey:i})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new fe(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new fe(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Ut(e))}};var zt=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new K(t.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=L.generate();break;case 2:r=tt.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=L.fromDerivationPath(r,i);break;case 2:o=tt.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}signWithAuthenticator(e){return new Q(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new Q(this.publicKey,this.signTransaction(e))}sign(e){return new B(this.privateKey.sign(e))}signTransaction(e){return this.sign(Ut(e))}};var qe=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?Rt.generate():zt.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof L&&i?new Rt({privateKey:t,address:r}):new zt({privateKey:t,address:r})}static fromPrivateKeyAndAddress(e){return this.fromPrivateKey(e)}static fromDerivationPath(e){let{scheme:t=0,mnemonic:r,path:i,legacy:o=!0}=e;return t===0&&o?Rt.fromDerivationPath({mnemonic:r,path:i}):zt.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}};var Va=1209600,kt=class kt extends d{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new nt(t.publicKey()),this.expiryDateSecs=r||_chunkBHKSQXUZjs.d.call(void 0, _chunkBHKSQXUZjs.c.call(void 0, )+Va),this.blinder=i!==void 0?l.fromHexInput(i).toUint8Array():La();let o=Sr(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push($t(this.blinder));let s=Vt(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=L.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new kt({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return kt.deserialize(new re(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _33 => _33.scheme])){case 0:default:t=L.generate()}return new kt({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _34 => _34.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new be(this.privateKey.sign(e))}};kt.BLINDER_LENGTH=31;var en=kt;function La(){return _utils.randomBytes.call(void 0, en.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var $e=class $e extends d{constructor(e){super();let{address:t,ephemeralKeyPair:r,uidKey:i,uidVal:o,aud:s,pepper:a,proof:c,proofFetchCallback:p,jwt:y}=e;if(this.ephemeralKeyPair=r,this.publicKey=ee.create(e),this.accountAddress=t?u.from(t):this.publicKey.authKey().derivedAddress(),this.uidKey=i,this.uidVal=o,this.aud=s,this.jwt=y,this.emitter=new _eventemitter32.default,this.proofOrPromise=c,c instanceof Ie)this.proof=c;else{if(p===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async S=>{await p(S),this.emitter.removeAllListeners()}),this.init(c)}this.signingScheme=2;let w=l.fromHexInput(a).toUint8Array();if(w.length!==$e.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${$e.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(t){t instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:t.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeFixedBytes(31),o=en.deserialize(e),s=Ie.deserialize(e);return $e.create({proof:s,pepper:i,uidKey:r,jwt:t,ephemeralKeyPair:o})}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let t=new B(this.sign(e)),r=new K(this.publicKey);return new Q(r,t)}signTransactionWithAuthenticator(e){let t=new B(this.signTransaction(e)),r=new K(this.publicKey);return new Q(r,t)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:t}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let r=this.ephemeralKeyPair.getPublicKey(),i=this.ephemeralKeyPair.sign(e);return new Ee({jwtHeader:_chunkBHKSQXUZjs.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new Tt(this.proof,0),expiryDateSecs:t,ephemeralPublicKey:r,ephemeralSignature:i})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let t=kr(e),i=new Kr(t,this.proof.proof).hash();return this.sign(i)}verifySignature(e){throw new Error("Not implemented")}static fromBytes(e){return $e.deserialize(new re(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=e,p=_jwtdecode.jwtDecode.call(void 0, i),y=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let w=p.aud,S=p[a];return new $e({address:t,proof:r,ephemeralKeyPair:o,iss:y,uidKey:a,uidVal:S,aud:w,pepper:s,jwt:i,proofFetchCallback:c})}};$e.PEPPER_LENGTH=31;var Se=$e,Kr=class extends d{constructor(t,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=t,this.proof=r}serialize(t){t.serializeFixedBytes(this.transaction.bcsToBytes()),t.serializeOption(this.proof)}hash(){return It(this.bcsToBytes(),this.domainSeparator)}};var Fn=class n{constructor(e){let{multiKey:t,signers:r}=e;this.publicKey=t,this.signingScheme=3,this.accountAddress=this.publicKey.authKey().derivedAddress();let i=[];for(let s of r)i.push(this.publicKey.getIndex(s.publicKey));let o=r.map((s,a)=>[s,i[a]]);o.sort((s,a)=>s[1]-a[1]),this.signers=o.map(s=>s[0]),this.signerIndicies=o.map(s=>s[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:i})}static fromPublicKeysAndSigners(e){let{publicKeys:t,signaturesRequired:r,signers:i}=e,o=new St({publicKeys:t,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new at(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new at(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof Se).map(async r=>r.waitForProofFetch());await Promise.all(t)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new st({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new st({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){let{message:t,signature:r}=e;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:t,signature:s}))return!1}return!0}};var Wa=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -73,7 +73,7 @@
73
73
  }
74
74
  }
75
75
  }
76
- `,Li=`
76
+ `,Hi=`
77
77
  query getAccountCoinsCount($address: String) {
78
78
  current_fungible_asset_balances_aggregate(
79
79
  where: {owner_address: {_eq: $address}}
@@ -178,7 +178,7 @@
178
178
  ...CurrentTokenOwnershipFields
179
179
  }
180
180
  }
181
- ${Mn}`,tf=`
181
+ ${Mn}`,nf=`
182
182
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
183
183
  current_token_ownerships_v2(
184
184
  where: $where_condition
@@ -226,7 +226,7 @@
226
226
  version
227
227
  }
228
228
  }
229
- `,Kr=`
229
+ `,Gr=`
230
230
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
231
231
  current_collections_v2(where: $where_condition) {
232
232
  collection_id
@@ -350,14 +350,14 @@
350
350
  ...AnsTokenFragment
351
351
  }
352
352
  }
353
- ${ja}`,Gr=`
353
+ ${ja}`,Br=`
354
354
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
355
355
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
356
356
  num_active_delegator
357
357
  pool_address
358
358
  }
359
359
  }
360
- `,Br=`
360
+ `,Dr=`
361
361
  query getProcessorStatus($where_condition: processor_status_bool_exp) {
362
362
  processor_status(where: $where_condition) {
363
363
  last_success_version
@@ -405,7 +405,7 @@
405
405
  ...TokenActivitiesFields
406
406
  }
407
407
  }
408
- ${Wa}`,Dr=`
408
+ ${Wa}`,Nr=`
409
409
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
410
410
  current_token_ownerships_v2(
411
411
  where: $where_condition
@@ -456,5 +456,5 @@
456
456
  }
457
457
  }
458
458
  }
459
- `;async function qn(n){let{aptosConfig:e}=n,{data:t}=await M({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function po(n){let{aptosConfig:e,limit:t}=n;return(await f({aptosConfig:e,query:{query:eo,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Fi({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Xa(n){let{aptosConfig:e}=n;return(await f({aptosConfig:e,query:{query:Br},originMethod:"getProcessorStatuses"})).processor_status}async function $n(n){let e=await Xa({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Vn(n){let{aptosConfig:e,processorType:t}=n;return(await f({aptosConfig:e,query:{query:Br,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Hn(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await et({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _35 => _35.ledgerVersion])},body:r})).data}async function lo(n){let{aptosConfig:e,options:t}=n,r={query:so,variables:{where_condition:_optionalChain([t, 'optionalAccess', _36 => _36.where]),offset:_optionalChain([t, 'optionalAccess', _37 => _37.offset]),limit:_optionalChain([t, 'optionalAccess', _38 => _38.limit]),order_by:_optionalChain([t, 'optionalAccess', _39 => _39.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function go(n){let{aptosConfig:e,options:t}=n,r={query:ao,variables:{where_condition:_optionalChain([t, 'optionalAccess', _40 => _40.where]),offset:_optionalChain([t, 'optionalAccess', _41 => _41.offset]),limit:_optionalChain([t, 'optionalAccess', _42 => _42.limit]),order_by:_optionalChain([t, 'optionalAccess', _43 => _43.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Se(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await M({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function fo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return mt({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _44 => _44.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _45 => _45.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _46 => _46.limit]), () => (1e3))}})}async function Ln(n){return _optionalChain([n, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.ledgerVersion])!==void 0?mo(n):Ne(async()=>mo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function mo(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await M({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _49 => _49.ledgerVersion])}});return o}async function Ao(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return mt({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _50 => _50.offset]),limit:_optionalChain([r, 'optionalAccess', _51 => _51.limit])}})}async function ho(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return mt({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _52 => _52.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _53 => _53.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _54 => _54.limit]), () => (999))}})}async function Nr(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await M({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _55 => _55.ledgerVersion])}});return o.data}async function tn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await Nr({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await Hn({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ge&&a.data.error_code==="table_item_not_found")return s;throw a}}async function To(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:e,query:{query:Zi,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function bo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])});let s={query:Xi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function wo(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=u.from(t).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _61 => _61.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _62 => _62.tokenStandard])});let c={query:Yi,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([i, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([i, 'optionalAccess', _65 => _65.orderBy])}};return(await f({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function So(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _66 => _66.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _67 => _67.tokenStandard])}});let s={query:Wi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([r, 'optionalAccess', _69 => _69.limit]),order_by:_optionalChain([r, 'optionalAccess', _70 => _70.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function xo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Ji,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function _o(n){let{aptosConfig:e,accountAddress:t,coinType:r}=n,i=u.from(t).toStringLong(),o=await Or({aptosConfig:e,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Or(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=u.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _71 => _71.where]),owner_address:{_eq:i}},s={query:Qi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_optionalChain([r, 'optionalAccess', _73 => _73.limit]),order_by:_optionalChain([r, 'optionalAccess', _74 => _74.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function vo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Li,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function Po(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:ji,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _75 => _75.offset]),limit:_optionalChain([r, 'optionalAccess', _76 => _76.limit]),order_by:_optionalChain([r, 'optionalAccess', _77 => _77.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Co(n){let{aptosConfig:e,privateKey:t}=n,r=new K(t.publicKey());if(t instanceof Ye){let o=F.fromPublicKey({publicKey:r}).derivedAddress();return Oe.fromPrivateKey({privateKey:t,address:o})}if(t instanceof $){let i=F.fromPublicKey({publicKey:r});if(await yo({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return Oe.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=F.fromPublicKey({publicKey:r.publicKey});if(await yo({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return Oe.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function yo(n){let{aptosConfig:e,authKey:t}=n,r=await tn({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await Se({aptosConfig:e,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Mr(n){let{aptosConfig:e,options:t}=n;return mt({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([t, 'optionalAccess', _79 => _79.limit])}})}async function Wn(n){let{aptosConfig:e}=n;return Ne(async()=>{let{data:t}=await M({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Eo(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await M({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function nn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await M({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Io(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await nn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _80 => _80.status])===404)return!0;throw r}}async function Ya(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await M({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Gt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.checkSuccess]), () => (!0)),s=!0,a=0,c,p,y=200,w=1.5;function S(g){if(!(g instanceof ge)||(p=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await nn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){S(g)}if(s){let g=Date.now();try{c=await Ya({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(E){S(E)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await nn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){S(g)}await _chunkBHKSQXUZjs.b.call(void 0, y),a+=y/1e3,y*=w}if(c===void 0)throw p||new Qn(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Qn(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Fr(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function jn(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await $n({aptosConfig:e}):s=(await Vn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkBHKSQXUZjs.b.call(void 0, 200)}}var Qn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Fr=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Uo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await M({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _83 => _83.withTransactions])}});return zo({block:i,...n})}async function Ro(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await M({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _84 => _84.withTransactions])}});return zo({block:i,...n})}async function zo(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _85 => _85.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _86 => _86.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let p=[],y=100n;for(let S=c+1n;S<s;S+=BigInt(100))p.push(Mr({aptosConfig:e,options:{offset:S,limit:Math.min(Number(y),Number(s-S+1n))}}));let w=await Promise.all(p);for(let S of w)t.transactions.push(...S)}return t}async function A(n){n.minimumLedgerVersion!==void 0&&await jn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var rn=class{constructor(e){this.config=e}async getAccountInfo(e){return Se({aptosConfig:this.config,...e})}async getAccountModules(e){return fo({aptosConfig:this.config,...e})}async getAccountModule(e){return Ln({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Ao({aptosConfig:this.config,...e})}async getAccountResources(e){return ho({aptosConfig:this.config,...e})}async getAccountResource(e){return Nr({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return tn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),To({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),bo({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),wo({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),So({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),xo({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Or({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),vo({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:zn,...e})}async getAccountCoinAmount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),_o({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Po({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Co({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Xn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _87 => _87.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _88 => _88.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _89 => _89.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _90 => _90.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _91 => _91.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _92 => _92.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _93 => _93.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _94 => _94.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _95 => _95.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _96 => _96.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _97 => _97.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return ki[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ki[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return zi[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return Sr[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return xr[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return Sr[this.network]===e}isProverServiceRequest(e){return xr[this.network]===e}};function ko(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Ko(n){return!!n.match(/\s/)}function Ja(n){return!!n.match(/^T[0-9]+$/)}function ec(n){return!!n.match(/^&.+$/)}function tc(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function nc(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Ko(r))break}return t}var rc=(E=>(E.InvalidTypeTag="unknown type",E.UnexpectedGenericType="unexpected generic type",E.UnexpectedTypeArgumentClose="unexpected '>'",E.UnexpectedWhitespaceCharacter="unexpected whitespace character",E.UnexpectedComma="unexpected ','",E.TypeArgumentCountMismatch="type argument count doesn't match expected amount",E.MissingTypeArgumentClose="no matching '>' for '<'",E.MissingTypeArgument="no type argument before ','",E.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",E.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",E.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",E.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",E.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",E.InvalidAddress="struct address must be valid",E))(rc||{}),D= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function ze(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _98 => _98.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let E=on(a,i,t);o.push(E)}let y=r.pop();if(y===void 0)throw new D(n,"unexpected '>'");if(c!==o.length)throw new D(n,"type argument count doesn't match expected amount");let{savedStr:w,savedTypes:S,savedExpectedTypes:g}=y;i=o,o=S,a=w,c=g}else if(p===","){if(r.length===0)throw new D(n,"unexpected ','");if(a.length===0)throw new D(n,"no type argument before ','");let y=on(a,i,t);i=[],o.push(y),a="",c+=1}else if(Ko(p)){let y=!1;if(a.length!==0){let S=on(a,i,t);i=[],o.push(S),a="",y=!0}s=nc(n,s);let w=n[s];if(s<n.length&&y&&w!==","&&w!==">")throw new D(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new D(n,"no matching '>' for '<'");switch(o.length){case 0:return on(a,i,t);case 1:if(a==="")return o[0];throw new D(n,"unexpected ','");default:throw new D(n,"unexpected whitespace character")}}function on(n,e,t){let r=n.trim(),i=r.toLowerCase();if(tc(i)&&e.length>0)throw new D(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new _t;case"bool":return new q;case"address":return new ee;case"u8":return new be;case"u16":return new bt;case"u32":return new wt;case"u64":return new j;case"u128":return new St;case"u256":return new xt;case"vector":if(e.length!==1)throw new D(n,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(ec(r)){let a=r.substring(1);return new Gn(on(a,e,t))}if(Ja(r)){if(t)return new k(Number(r.split("T")[1]));throw new D(n,"unexpected generic type")}if(!r.match(/:/))throw new D(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new D(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new D(n,"struct address must be valid")}if(!ko(o[1]))throw new D(n,"module name must only contain alphanumeric or '_' characters");if(!ko(o[2]))throw new D(n,"struct name must only contain alphanumeric or '_' characters");return new m(new Ue(s,new R(o[1]),new R(o[2]),e))}}function Go(n){return typeof n=="boolean"}function xe(n){return typeof n=="string"}function Yn(n){return typeof n=="number"}function Zn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Bo(n){return n==null}function Do(n){return qr(n)||Vr(n)||Hr(n)||Lr(n)||Qr(n)||Wr(n)||jr(n)||Jn(n)||$r(n)||ic(n)||n instanceof T||n instanceof Be}function qr(n){return n instanceof I}function Jn(n){return n instanceof u}function $r(n){return n instanceof b}function ic(n){return n instanceof Le}function Vr(n){return n instanceof N}function Hr(n){return n instanceof re}function Lr(n){return n instanceof ie}function Qr(n){return n instanceof O}function Wr(n){return n instanceof de}function jr(n){return n instanceof le}function No(n){return"bytecode"in n}function U(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Oo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function sn(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],i=e[2];return{moduleAddress:t,moduleName:r,functionName:i}}var oc=new TextEncoder;function er(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _99 => _99.map, 'call', _100 => _100(e=>xe(e)?ze(e):e)]), () => ([]))}async function Fo(n,e,t,r){let i=await Ln({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function Mo(n,e,t,r){let i=await Fo(n,e,t,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!i.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Oo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(ze(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function qo(n,e,t,r){let i=await Fo(n,e,t,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(ze(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(ze(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Yr(n,e,t,r,i){if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[r];return Bt(t,o,r,i)}function Bt(n,e,t,r){return Do(n)?(Xr(e,n,t),n):sc(n,e,t,r)}function sc(n,e,t,r){if(e.isBool()){if(Go(n))return new I(n);if(xe(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",t)}if(e.isAddress()){if(xe(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isU8()){if(Yn(n))return new N(n);if(xe(n))return new N(Number.parseInt(n,10));U("number",t)}if(e.isU16()){if(Yn(n))return new re(n);if(xe(n))return new re(Number.parseInt(n,10));U("number",t)}if(e.isU32()){if(Yn(n))return new ie(n);if(xe(n))return new ie(Number.parseInt(n,10));U("number",t)}if(e.isU64()){if(Zn(n))return new O(BigInt(n));U("bigint | number | string",t)}if(e.isU128()){if(Zn(n))return new de(BigInt(n));U("bigint | number | string",t)}if(e.isU256()){if(Zn(n))return new le(BigInt(n));U("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Bt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(xe(n))return T.U8(oc.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(i=>Bt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(xe(n))return new b(n);U("string",t)}if(e.isObject()){if(xe(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isOption())return Bo(n)?new Be(null):new Be(Bt(n,e.value.typeArgs[0],t,r));throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function Xr(n,e,t){if(n.isBool()){if(qr(e))return;U("Bool",t)}if(n.isAddress()){if(Jn(e))return;U("AccountAddress",t)}if(n.isU8()){if(Vr(e))return;U("U8",t)}if(n.isU16()){if(Hr(e))return;U("U16",t)}if(n.isU32()){if(Lr(e))return;U("U32",t)}if(n.isU64()){if(Qr(e))return;U("U64",t)}if(n.isU128()){if(Wr(e))return;U("U128",t)}if(n.isU256()){if(jr(e))return;U("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&Xr(n.value,e.values[0],t);return}U("MoveVector",t)}if(n instanceof m){if(n.isString()){if($r(e))return;U("MoveString",t)}if(n.isObject()){if(Jn(e))return;U("AccountAddress",t)}if(n.isOption()){if(e instanceof Be){e.value!==void 0&&Xr(n.value.typeArgs[0],e.value,t);return}U("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function nr(n){if(No(n))return pc(n);let{moduleAddress:e,moduleName:t,functionName:r}=sn(n.function),i=await Lo({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Mo});return cc({...n,abi:i})}function cc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=sn(n.function),o=er(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>Yr(n.function,e,c,p,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=ot.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Xt(new Zt(c,new Jt(a)))}return new jt(a)}async function $o(n){let{moduleAddress:e,moduleName:t,functionName:r}=sn(n.function),i=await Lo({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:qo});return uc({abi:i,...n})}function uc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=sn(n.function),o=er(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _101 => _101.functionArguments, 'optionalAccess', _102 => _102.map, 'call', _103 => _103((a,c)=>Yr(n.function,e,a,c,o))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);return ot.build(`${t}::${r}`,i,o,s)}function pc(n){return new Wt(new Yt(l.fromHexInput(n.bytecode).toUint8Array(),er(n.typeArguments),n.functionArguments))}async function dc(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>vr[e.network]?{chainId:vr[e.network]}:{chainId:(await qn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _104 => _104.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Wn({aptosConfig:e})).gas_estimate},c=async()=>{let ut=async()=>_optionalChain([i, 'optionalAccess', _105 => _105.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await Se({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await ut()}catch (e3){return 0}else return ut()},[{chainId:p},{gasEstimate:y},w]=await Promise.all([s(),a(),c()]),{maxGasAmount:S,gasUnitPrice:g,expireTimestamp:E}={maxGasAmount:_optionalChain([i, 'optionalAccess', _106 => _106.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _107 => _107.gasUnitPrice]), () => (BigInt(y))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _108 => _108.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ce(u.from(t),BigInt(w),r,BigInt(S),BigInt(g),BigInt(E),new Tt(p))}async function Zr(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await dc({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _109 => _109.secondarySignerAddresses, 'optionalAccess', _110 => _110.map, 'call', _111 => _111(c=>u.from(c))]), () => ([]));return new On(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Nn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Vo(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=tr(e);if(t.feePayerAddress){let a=new at(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(w=>tr(w)));let p=tr(i),y=new Ct(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new ct(a.raw_txn,y).bcsToBytes()}if(t.secondarySignerAddresses){let a=new st(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(y=>tr(y));let p=new Pt(o,t.secondarySignerAddresses,c);return new ct(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof me)s=new vt(o.public_key,o.signature);else if(o instanceof H)s=new Et(o);else throw new Error("Invalid public key");return new ct(t.rawTransaction,s).bcsToBytes()}function tr(n){if((n instanceof Z||n instanceof Ae)&&(n=new K(n)),n instanceof K){if(n.publicKey instanceof _)return new H(n,new B(new v(new Uint8Array(64))));if(n.publicKey instanceof Ae)return new H(n,new B(new Pe(new Uint8Array(64))));if(n.publicKey instanceof Z)return new H(n,new B(Ee.getSimulationSignature()))}return new me(new _(n.toUint8Array()),new v(new Uint8Array(64)))}function Jr(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Ni(V,n.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new Ct(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Pt(i,e.secondarySignerAddresses,r)}else i instanceof me?o=new vt(i.public_key,i.signature):o=new Et(i);return new ct(e.rawTransaction,o).bcsToBytes()}function Ho(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var lc=Ho(["APTOS::Transaction"]);function IA(n){let e=Jr(n);return new l(Ho([lc,new Uint8Array([0]),e])).toString()}async function Lo({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Ne(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function h(n){let e=await gc(n);return mc(n,e)}async function gc(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await nr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await nr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await nr(r)),i}async function mc(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(yc(n)&&(o=u.ZERO.toString()),fc(n)){let{secondarySignerAddresses:s}=n;return Zr({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Zr({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function yc(n){return n.withFeePayer===!0}function fc(n){return"secondarySignerAddresses"in n}function Qo(n){let{transaction:e}=n;return Ut(e)}function rr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}async function ei(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Vo({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await et({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _114 => _114.options, 'optionalAccess', _115 => _115.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _116 => _116.options, 'optionalAccess', _117 => _117.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function ir(n){let{aptosConfig:e}=n,t=Jr({...n}),{data:r}=await et({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function an(n){let{aptosConfig:e,signer:t,transaction:r}=n;(t instanceof we||t instanceof Fn)&&await t.waitForProofFetch();let i=rr({signer:t,transaction:r});return ir({aptosConfig:e,transaction:r,senderAuthenticator:i})}var Ac={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function Wo(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>T.U8(a));return h({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:Ac},options:o})}var hc={typeParameters:[],parameters:[new be,C.u8(),new be,C.u8(),C.u8(),C.u8()]};async function jo(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await Se({aptosConfig:e,accountAddress:t.accountAddress}),o=Oe.fromPrivateKey({privateKey:r,legacy:!0}),a=new Dn({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),p=o.sign(a),y=await h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new N(t.signingScheme),T.U8(t.publicKey.toUint8Array()),new N(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:hc}});return an({aptosConfig:e,signer:t,transaction:y})}var Tc={typeParameters:[{constraints:[]}],parameters:[new ee,new j]};async function Xo(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return h({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (zn))],functionArguments:[r,i],abi:Tc},options:s})}var cn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Xo({aptosConfig:this.config,...e})}};var Me={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ue="0x4::token::Token";async function Yo(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:uo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Zo(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:e,query:{query:Dr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Jo(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},o={query:Dr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _118 => _118.offset]),limit:_optionalChain([r, 'optionalAccess', _119 => _119.limit]),order_by:_optionalChain([r, 'optionalAccess', _120 => _120.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function es(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:co,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _121 => _121.offset]),limit:_optionalChain([r, 'optionalAccess', _122 => _122.limit]),order_by:_optionalChain([r, 'optionalAccess', _123 => _123.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var bc={typeParameters:[],parameters:[new m(P()),new j,new m(P()),new m(P()),new q,new q,new q,new q,new q,new q,new q,new q,new q,new j,new j]};async function ts(n){let{aptosConfig:e,options:t,creator:r}=n;return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Ve))),new b(n.name),new b(n.uri),new I(_nullishCoalesce(n.mutableDescription, () => (!0))),new I(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new I(_nullishCoalesce(n.mutableURI, () => (!0))),new I(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new I(_nullishCoalesce(n.mutableTokenName, () => (!0))),new I(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new I(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new I(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new I(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:bc},options:t})}async function ti(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _124 => _124.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _125 => _125.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:e,query:{query:Kr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ns(n){let{aptosConfig:e,collectionId:t}=n,i={collection_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:Kr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function rs(n){return(await ti(n)).collection_id}var wc={typeParameters:[],parameters:[new m(P()),new m(P()),new m(P()),new m(P()),new C(new m(P())),new C(new m(P())),new C(C.u8())]};async function is(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:y}=n,w=_optionalChain([p, 'optionalAccess', _126 => _126.map, 'call', _127 => _127(S=>Me[S])]);return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(i),new b(o),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(w, () => ([]))),hs(_nullishCoalesce(y, () => ([])),_nullishCoalesce(w, () => ([])))],abi:wc},options:t})}var Sc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new ee]};async function os(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(r),u.from(i)],abi:Sc},options:s})}var xc={typeParameters:[],parameters:[new m(P()),new m(P()),new m(P()),new m(P()),new C(new m(P())),new C(new m(P())),new C(C.u8()),new ee]};async function ss(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:y,options:w}=n;if(_optionalChain([c, 'optionalAccess', _128 => _128.length])!==_optionalChain([y, 'optionalAccess', _129 => _129.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _130 => _130.length])!==_optionalChain([y, 'optionalAccess', _131 => _131.length]))throw new Error("Property types and property values counts do not match");let S=_optionalChain([p, 'optionalAccess', _132 => _132.map, 'call', _133 => _133(g=>Me[g])]);return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(S, () => ([]))),hs(_nullishCoalesce(y, () => ([])),_nullishCoalesce(S, () => ([]))),a],abi:xc},options:w})}var _c={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0)))]};async function as(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[u.from(r)],abi:_c},options:o})}var vc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0)))]};async function cs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:vc},options:o})}var Pc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0)))]};async function us(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:Pc},options:o})}var Cc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new m(P())]};async function ps(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Cc},options:s})}var Ec={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new m(P())]};async function ds(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ec},options:s})}var Ic={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new m(P())]};async function ls(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ic},options:s})}var Uc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new m(P()),new m(P()),C.u8()]};async function gs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Me[i]),T.U8(ni(o,Me[i]))],abi:Uc},options:c})}var Rc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new m(P())]};async function ms(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Rc},options:s})}var zc={typeParameters:[{constraints:["key"]}],parameters:[new m(te(new k(0))),new m(P()),new m(P()),C.u8()]};async function ys(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Me[i]),ni(o,Me[i])],abi:zc},options:c})}var kc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(te(new k(0))),new m(P()),new k(1)]};async function fs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Me[i]],functionArguments:[u.from(s),new b(r),o],abi:kc},options:c})}var Kc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(te(new k(0))),new m(P()),new k(1)]};async function As(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Me[i]],functionArguments:[u.from(s),new b(r),o],abi:Kc},options:c})}function hs(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(ni(n[i],r))}),t}function ni(n,e){let t=ze(e);return Bt(n,t,0,[]).bcsToBytes()}var un=class{constructor(e){this.config=e}async getCollectionData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ti({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ns({aptosConfig:this.config,...e})}async getCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),rs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Yo({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Jo({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),es({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ts({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return is({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return os({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ss({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return as({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return cs({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return us({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return ps({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return ds({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return ls({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return gs({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ms({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ys({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return fs({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return As({aptosConfig:this.config,...e})}};var Ts=300,Gc=n=>{if(n&&n.length>Ts)throw new Error(`Event type length exceeds the maximum length of ${Ts}`)};async function bs(n){let{aptosConfig:e,eventType:t,options:r}=n,o={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:t}},pagination:r,orderBy:_optionalChain([r, 'optionalAccess', _134 => _134.orderBy])};return pn({aptosConfig:e,options:o})}async function ws(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,a={where:{account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _135 => _135.orderBy])};return pn({aptosConfig:t,options:a})}async function Ss(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,a={where:{account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _136 => _136.orderBy])};return pn({aptosConfig:t,options:a})}async function pn(n){let{aptosConfig:e,options:t}=n;Gc(_optionalChain([t, 'optionalAccess', _137 => _137.where, 'optionalAccess', _138 => _138.indexed_type, 'optionalAccess', _139 => _139._eq]));let r={query:ro,variables:{where_condition:_optionalChain([t, 'optionalAccess', _140 => _140.where]),offset:_optionalChain([t, 'optionalAccess', _141 => _141.offset]),limit:_optionalChain([t, 'optionalAccess', _142 => _142.limit]),order_by:_optionalChain([t, 'optionalAccess', _143 => _143.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var dn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),bs({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ws({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ss({aptosConfig:this.config,...e})}async getEvents(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _144 => _144.minimumLedgerVersion]),processorType:"events_processor"}),pn({aptosConfig:this.config,...e})}};async function xs(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _145 => _145.timeoutSecs])||20,{data:s}=await Mi({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Gt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _146 => _146.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var ln=class{constructor(e){this.config=e}async fundAccount(e){let t=await xs({aptosConfig:this.config,...e});return _optionalChain([e, 'access', _147 => _147.options, 'optionalAccess', _148 => _148.waitForIndexer])!==!1&&await jn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version)}),t}};async function ri(n){let{aptosConfig:e,options:t}=n,r={query:oo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _149 => _149.where]),limit:_optionalChain([t, 'optionalAccess', _150 => _150.limit]),offset:_optionalChain([t, 'optionalAccess', _151 => _151.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function _s(n){let{aptosConfig:e,options:t}=n,r={query:io,variables:{where_condition:_optionalChain([t, 'optionalAccess', _152 => _152.where]),limit:_optionalChain([t, 'optionalAccess', _153 => _153.limit]),offset:_optionalChain([t, 'optionalAccess', _154 => _154.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function vs(n){let{aptosConfig:e,options:t}=n,r={query:to,variables:{where_condition:_optionalChain([t, 'optionalAccess', _155 => _155.where]),limit:_optionalChain([t, 'optionalAccess', _156 => _156.limit]),offset:_optionalChain([t, 'optionalAccess', _157 => _157.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Bc={typeParameters:[{constraints:[]}],parameters:[ze("0x1::object::Object"),new ee,new j]};async function Ps(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Bc},options:s})}var gn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _158 => _158.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),ri({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _159 => _159.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await ri({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _160 => _160.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),_s({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _161 => _161.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),vs({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Ps({aptosConfig:this.config,...e})}};async function qe(n){let{aptosConfig:e,payload:t,options:r}=n,i=await $o({...t,aptosConfig:e}),o=new W;i.serialize(o);let s=o.toUint8Array(),{data:a}=await et({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _162 => _162.ledgerVersion])},body:s});return a}var mn=class{constructor(e){this.config=e}async getLedgerInfo(){return qn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Uo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Ro({aptosConfig:this.config,...e})}async view(e){return qe({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return po({aptosConfig:this.config,...e})}async queryIndexer(e){return f({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return $n({aptosConfig:this.config})}async getProcessorStatus(e){return Vn({aptosConfig:this.config,processorType:e})}};var Cs=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Es(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function $e(n){let[e,t,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Es(e))throw new Error(`${e} is not valid. ${Cs}`);if(t&&!Es(t))throw new Error(`${t} is not valid. ${Cs}`);return{domainName:t||e,subdomainName:t?e:void 0}}var Dc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Nc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Dc,custom:null,devnet:null};function ke(n){let e=Nc[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var or=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Is(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:i,subdomainName:o}=$e(t),s=await qe({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=or(s[0]);return a?u.from(a):void 0}async function Us(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=ke(e),{domainName:y,subdomainName:w}=$e(r),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(w&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!w)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let dr=_nullishCoalesce(t.years, () => (1));if(dr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Qs=dr*31536e3;return await h({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,Qs,o,s]},options:a})}if(!w)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await ii({aptosConfig:e,name:y});if(!g)throw new Error("The domain does not exist");let E=t.policy==="subdomain:independent"?t.expirationDate:g;if(E>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[y,w,Math.round(E/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function ii(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:i,subdomainName:o}=$e(t);try{let s=await qe({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e4){return}}async function Rs(n){let{aptosConfig:e,address:t}=n,r=ke(e),i=await qe({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),o=or(i[1]),s=or(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function zs(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=ke(e);if(!r)return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=$e(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function ks(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:i,subdomainName:o}=$e(t),s=await qe({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=or(s[0]);return a?u.from(a):void 0}async function Ks(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=ke(e),{domainName:a,subdomainName:c}=$e(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Gs(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=$e(t),a=(await f({aptosConfig:e,query:{query:Kt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=yn(a)),a}async function Bs(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await oi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountNames",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _163 => _163.limit]),offset:_optionalChain([t, 'optionalAccess', _164 => _164.offset]),order_by:_optionalChain([t, 'optionalAccess', _165 => _165.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _166 => _166.options, 'optionalAccess', _167 => _167.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(yn)}async function Ds(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await oi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _168 => _168.limit]),offset:_optionalChain([t, 'optionalAccess', _169 => _169.offset]),order_by:_optionalChain([t, 'optionalAccess', _170 => _170.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _171 => _171.options, 'optionalAccess', _172 => _172.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(yn)}async function Ns(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await oi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _173 => _173.limit]),offset:_optionalChain([t, 'optionalAccess', _174 => _174.offset]),order_by:_optionalChain([t, 'optionalAccess', _175 => _175.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _176 => _176.options, 'optionalAccess', _177 => _177.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(yn)}async function Os(n){let{aptosConfig:e,options:t,domain:r}=n;return(await f({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _178 => _178.limit]),offset:_optionalChain([t, 'optionalAccess', _179 => _179.offset]),order_by:_optionalChain([t, 'optionalAccess', _180 => _180.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _181 => _181.options, 'optionalAccess', _182 => _182.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(yn)}async function oi(n){let{aptosConfig:e}=n,t=ke(e),[r]=await qe({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function Fs(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=ke(e),a=i*31536e3,{domainName:c,subdomainName:p}=$e(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function yn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var fn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Is({aptosConfig:this.config,...e})}async getExpiration(e){return ii({aptosConfig:this.config,...e})}async getTargetAddress(e){return ks({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ks({aptosConfig:this.config,...e})}async getPrimaryName(e){return Rs({aptosConfig:this.config,...e})}async setPrimaryName(e){return zs({aptosConfig:this.config,...e})}async registerName(e){return Us({aptosConfig:this.config,...e})}async renewDomain(e){return Fs({aptosConfig:this.config,...e})}async getName(e){return Gs({aptosConfig:this.config,...e})}async getAccountNames(e){return Bs({aptosConfig:this.config,...e})}async getAccountDomains(e){return Ds({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Ns({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Os({aptosConfig:this.config,...e})}};async function Ms(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Gr,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function qs(n){let{aptosConfig:e,options:t}=n,r={query:Gr,variables:{order_by:_optionalChain([t, 'optionalAccess', _183 => _183.orderBy])}};return(await f({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function $s(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:no,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:e,query:i})).delegated_staking_activities}var An=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _184 => _184.minimumLedgerVersion]),processorType:"stake_processor"}),Ms({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _185 => _185.minimumLedgerVersion]),processorType:"stake_processor"}),qs({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _186 => _186.minimumLedgerVersion]),processorType:"stake_processor"}),$s({aptosConfig:this.config,...e})}};var sr=class{constructor(e){this.config=e}async simple(e){return h({aptosConfig:this.config,...e})}async multiAgent(e){return h({aptosConfig:this.config,...e})}};function si(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},t}function ai(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},t}var Dt=class{constructor(e){this.config=e}async simple(e){return ei({aptosConfig:this.config,...e})}async multiAgent(e){return ei({aptosConfig:this.config,...e})}};_chunkBHKSQXUZjs.a.call(void 0, [ai],Dt.prototype,"simple",1),_chunkBHKSQXUZjs.a.call(void 0, [ai],Dt.prototype,"multiAgent",1);var Nt=class{constructor(e){this.config=e}async simple(e){return ir({aptosConfig:this.config,...e})}async multiAgent(e){return ir({aptosConfig:this.config,...e})}};_chunkBHKSQXUZjs.a.call(void 0, [si],Nt.prototype,"simple",1),_chunkBHKSQXUZjs.a.call(void 0, [si],Nt.prototype,"multiAgent",1);var ar=class{constructor(e,t,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkBHKSQXUZjs.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime),_chunkBHKSQXUZjs.c.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await Se({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Se({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(e),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkBHKSQXUZjs.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkBHKSQXUZjs.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var Ot=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _187 => _187.pendingDequeue, 'access', _188 => _188.shift, 'call', _189 => _189(), 'optionalAccess', _190 => _190.resolve, 'call', _191 => _191(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new Ft("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Ft=class extends Error{};var Vs="fulfilled",Hs= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Hs||{}),cr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new Ot;this.transactionsQueue=new Ot;this.outstandingTransactions=new Ot;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new ar(t,r,i,o,s)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let r=await this.generateNextTransaction(this.account,t);if(!r)return;let i=an({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Ft)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(t.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),t.push(i),r.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===Vs?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(t){if(t instanceof Ft)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Gt({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Vs?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(t,r){this.transactionsQueue.enqueue([t,r])}async generateNextTransaction(t,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}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 ur=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new cr(this.config,t),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:t,options:r}=e;for(let i of t)this.transactionWorker.push(i,r)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.start({sender:t}),this.push({data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var hn=class{constructor(e){this.config=e,this.build=new sr(this.config),this.simulate=new Dt(this.config),this.submit=new Nt(this.config),this.batch=new ur(this.config)}async getTransactions(e){return Mr({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Eo({aptosConfig:this.config,...e})}async getTransactionByHash(e){return nn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Io({aptosConfig:this.config,...e})}async waitForTransaction(e){return Gt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Wn({aptosConfig:this.config})}getSigningMessage(e){return Qo(e)}async publishPackageTransaction(e){return Wo({aptosConfig:this.config,...e})}async rotateAuthKey(e){return jo({aptosConfig:this.config,...e})}sign(e){return rr({...e})}signAsFeePayer(e){let{signer:t,transaction:r}=e;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=t.accountAddress,rr({signer:t,transaction:r})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.batch.forSingleAccount({sender:t,data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){let{signer:t,transaction:r}=e;return an({aptosConfig:this.config,signer:t,transaction:r})}};var Tn=class{constructor(e){this.config=e}async getTableItem(e){return Hn({aptosConfig:this.config,...e})}async getTableItemsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),lo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),go({aptosConfig:this.config,...e})}};async function pr(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await qi({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return l.fromHexInput(a.pepper).toUint8Array()}async function ci(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await pr(n),uidKey:o="sub"}=n;if(l.fromHexInput(i).toUint8Array().length!==we.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${we.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await Hi({aptosConfig:e});if(s<r.expiryDateSecs-_chunkBHKSQXUZjs.c.call(void 0, ))throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let a={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:l.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:c}=await $i({aptosConfig:e,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),p=c.proof,y=new ft({a:p.a,b:p.b,c:p.c});return new Ie({proof:new At(y,0),trainingWheelsSignature:he.fromHex(c.training_wheels_signature),expHorizonSecs:s})}async function Ls(n){let{aptosConfig:e,jwt:t,uidKey:r,proofFetchCallback:i,pepper:o=await pr(n)}=n,s=ci({...n,pepper:o}),a=i?s:await s,c=Z.fromJwtAndPepper({jwt:t,pepper:o,uidKey:r}),p=await tn({aptosConfig:e,authenticationKey:c.authKey().derivedAddress()});return we.create({...n,address:p,proof:a,pepper:o,proofFetchCallback:i})}var bn=class{constructor(e){this.config=e}async getPepper(e){return pr({aptosConfig:this.config,...e})}async getProof(e){return ci({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return Ls({aptosConfig:this.config,...e})}};var X=class{constructor(e){this.config=new Xn(e),this.account=new rn(this.config),this.ans=new fn(this.config),this.coin=new cn(this.config),this.digitalAsset=new un(this.config),this.event=new dn(this.config),this.faucet=new ln(this.config),this.fungibleAsset=new gn(this.config),this.general=new mn(this.config),this.staking=new An(this.config),this.transaction=new hn(this.config),this.table=new Tn(this.config),this.keyless=new bn(this.config)}};function pe(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}pe(X,rn,"account");pe(X,fn,"ans");pe(X,cn,"coin");pe(X,un,"digitalAsset");pe(X,dn,"event");pe(X,ln,"faucet");pe(X,gn,"fungibleAsset");pe(X,mn,"general");pe(X,An,"staking");pe(X,hn,"transaction");pe(X,Tn,"table");pe(X,bn,"keyless");exports.APTOS_BIP44_REGEX = aa; exports.APTOS_COIN = zn; exports.APTOS_HARDENED_REGEX = sa; exports.Account = Oe; exports.AccountAddress = u; exports.AccountAuthenticator = V; exports.AccountAuthenticatorEd25519 = me; exports.AccountAuthenticatorMultiEd25519 = Kn; exports.AccountAuthenticatorMultiKey = rt; exports.AccountAuthenticatorSingleKey = H; exports.AccountAuthenticatorVariant = yi; exports.AccountPublicKey = oe; exports.AccountSequenceNumber = ar; exports.AddressInvalidReason = na; exports.AnyPublicKey = K; exports.AnyPublicKeyVariant = gr; exports.AnySignature = B; exports.AnySignatureVariant = fi; exports.Aptos = X; exports.AptosApiError = ge; exports.AptosApiType = Ht; exports.AptosConfig = Xn; exports.AuthenticationKey = F; exports.Bool = I; exports.CKDPriv = _i; exports.ChainId = Tt; exports.DEFAULT_MAX_GAS_AMOUNT = Gi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Bi; exports.DEFAULT_TXN_TIMEOUT_SEC = Rn; exports.DeriveScheme = ea; exports.Deserializer = ne; exports.EPK_HORIZON_SECS = dl; exports.Ed25519Account = Rt; exports.Ed25519PrivateKey = $; exports.Ed25519PublicKey = _; exports.Ed25519Signature = v; exports.EntryFunction = ot; exports.EntryFunctionBytes = _n; exports.EphemeralCertificate = yt; exports.EphemeralCertificateVariant = yr; exports.EphemeralKeyPair = en; exports.EphemeralPublicKey = Ze; exports.EphemeralPublicKeyVariant = mr; exports.EphemeralSignature = he; exports.EphemeralSignatureVariant = Ai; exports.FeePayerRawTransaction = at; exports.FixedBytes = Le; exports.Groth16Zkp = ft; exports.HARDENED_OFFSET = wi; exports.Hex = l; exports.HexInvalidReason = Xs; exports.Identifier = R; exports.KeyType = ca; exports.KeylessAccount = we; exports.KeylessConfiguration = Ir; exports.KeylessPublicKey = Z; exports.KeylessSignature = Ee; exports.MAX_AUD_VAL_BYTES = Ga; exports.MAX_COMMITED_EPK_BYTES = yl; exports.MAX_EXTRA_FIELD_BYTES = gl; exports.MAX_ISS_VAL_BYTES = ll; exports.MAX_JWT_HEADER_B64_BYTES = ml; exports.MAX_UID_KEY_BYTES = Ba; exports.MAX_UID_VAL_BYTES = Da; exports.MimeType = vn; exports.ModuleId = Qt; exports.MoveAbility = hi; exports.MoveFunctionVisibility = Zs; exports.MoveOption = Be; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = st; exports.MultiAgentTransaction = On; exports.MultiEd25519PublicKey = lt; exports.MultiEd25519Signature = je; exports.MultiKey = ht; exports.MultiKeyAccount = Fn; exports.MultiKeySignature = nt; exports.MultiSig = Zt; exports.MultiSigTransactionPayload = Jt; exports.Network = _r; exports.NetworkToChainId = vr; exports.NetworkToFaucetAPI = Ki; exports.NetworkToIndexerAPI = zi; exports.NetworkToNetworkName = ld; exports.NetworkToNodeAPI = ki; exports.NetworkToPepperAPI = Sr; exports.NetworkToProverAPI = xr; exports.ParsingError = Q; exports.ProcessorType = Je; exports.PublicKey = Qe; exports.RAW_TRANSACTION_SALT = Di; exports.RAW_TRANSACTION_WITH_DATA_SALT = Pr; exports.RawTransaction = ce; exports.RawTransactionWithData = Bn; exports.RoleType = Js; exports.RotationProofChallenge = Dn; exports.Script = Yt; exports.ScriptTransactionArgumentVariants = qt; exports.Secp256k1PrivateKey = Ye; exports.Secp256k1PublicKey = Ae; exports.Secp256k1Signature = Pe; exports.Serializable = d; exports.Serializer = W; exports.Signature = G; exports.SignedTransaction = ct; exports.SigningScheme = ye; exports.SigningSchemeInput = hr; exports.SimpleTransaction = Nn; exports.SingleKeyAccount = zt; exports.StructTag = Ue; exports.TransactionAuthenticator = Re; exports.TransactionAuthenticatorEd25519 = vt; exports.TransactionAuthenticatorFeePayer = Ct; exports.TransactionAuthenticatorMultiAgent = Pt; exports.TransactionAuthenticatorMultiEd25519 = Rr; exports.TransactionAuthenticatorSingleSender = Et; exports.TransactionAuthenticatorVariant = mi; exports.TransactionPayload = it; exports.TransactionPayloadEntryFunction = jt; exports.TransactionPayloadMultiSig = Xt; exports.TransactionPayloadScript = Wt; exports.TransactionPayloadVariants = li; exports.TransactionResponseType = Ar; exports.TransactionVariants = gi; exports.TransactionWorker = cr; exports.TransactionWorkerEventsEnum = Hs; exports.TypeTag = z; exports.TypeTagAddress = ee; exports.TypeTagBool = q; exports.TypeTagGeneric = k; exports.TypeTagParserError = D; exports.TypeTagParserErrorType = rc; exports.TypeTagReference = Gn; exports.TypeTagSigner = _t; exports.TypeTagStruct = m; exports.TypeTagU128 = St; exports.TypeTagU16 = bt; exports.TypeTagU256 = xt; exports.TypeTagU32 = wt; exports.TypeTagU64 = j; exports.TypeTagU8 = be; exports.TypeTagVariants = di; exports.TypeTagVector = C; exports.U128 = de; exports.U16 = re; exports.U256 = le; exports.U32 = ie; exports.U64 = O; exports.U8 = N; exports.ZeroKnowledgeSig = Ie; exports.ZkProof = At; exports.ZkpVariant = fr; exports.aptosCoinStructTag = _g; exports.aptosRequest = kn; exports.buildTransaction = Zr; exports.checkOrConvertArgument = Bt; exports.convertArgument = Yr; exports.deriveKey = Tr; exports.deriveTransactionType = zr; exports.deserializeFromScriptArgument = Ma; exports.ensureBoolean = lr; exports.fetchEntryFunctionAbi = Mo; exports.fetchFunctionAbi = Fo; exports.fetchViewFunctionAbi = qo; exports.findFirstNonSignerArg = Oo; exports.generateRawTransaction = dc; exports.generateSignedTransaction = Jr; exports.generateSignedTransactionForSimulation = Vo; exports.generateSigningMessage = It; exports.generateSigningMessageForSerializable = Bm; exports.generateSigningMessageForTransaction = Ut; exports.generateTransactionPayload = nr; exports.generateTransactionPayloadWithABI = cc; exports.generateUserTransactionHash = IA; exports.generateViewFunctionPayload = $o; exports.generateViewFunctionPayloadWithABI = uc; exports.get = Cr; exports.getAptosFullNode = M; exports.getAptosPepperService = Gd; exports.getAuthenticatorForSimulation = tr; exports.getFunctionParts = sn; exports.getKeylessConfig = Hi; exports.hashValues = Ho; exports.isBcsAddress = Jn; exports.isBcsBool = qr; exports.isBcsFixedBytes = ic; exports.isBcsString = $r; exports.isBcsU128 = Wr; exports.isBcsU16 = Hr; exports.isBcsU256 = jr; exports.isBcsU32 = Lr; exports.isBcsU64 = Qr; exports.isBcsU8 = Vr; exports.isBlockMetadataTransactionResponse = lu; exports.isBool = Go; exports.isEd25519Signature = yu; exports.isEncodedEntryFunctionArgument = Do; exports.isFeePayerSignature = hu; exports.isGenesisTransactionResponse = du; exports.isLargeNumber = Zn; exports.isMultiAgentSignature = Au; exports.isMultiEd25519Signature = Tu; exports.isNull = Bo; exports.isNumber = Yn; exports.isPendingTransactionResponse = uu; exports.isScriptDataInput = No; exports.isSecp256k1Signature = fu; exports.isStateCheckpointTransactionResponse = gu; exports.isString = xe; exports.isUserTransactionResponse = pu; exports.isValidBIP44Path = Si; exports.isValidHardenedPath = xi; exports.isValidatorTransactionResponse = mu; exports.mnemonicToSeed = Pn; exports.normalizeBundle = Ni; exports.objectStructTag = te; exports.optionStructTag = vg; exports.outOfRangeErrorMessage = Ys; exports.paginateWithCursor = mt; exports.parseTypeTag = ze; exports.post = Lt; exports.postAptosFaucet = Mi; exports.postAptosFullNode = et; exports.postAptosIndexer = Fi; exports.postAptosPepperService = qi; exports.postAptosProvingService = $i; exports.promiseFulfilledStatus = Vs; exports.request = ka; exports.splitPath = vi; exports.standardizeTypeTags = er; exports.stringStructTag = P; exports.throwTypeMismatch = U; exports.validateNumberInRange = Ge;
459
+ `;async function qn(n){let{aptosConfig:e}=n,{data:t}=await $({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function po(n){let{aptosConfig:e,limit:t}=n;return(await f({aptosConfig:e,query:{query:eo,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Fi({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Xa(n){let{aptosConfig:e}=n;return(await f({aptosConfig:e,query:{query:Dr},originMethod:"getProcessorStatuses"})).processor_status}async function $n(n){let e=await Xa({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Vn(n){let{aptosConfig:e,processorType:t}=n;return(await f({aptosConfig:e,query:{query:Dr,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Ln(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await it({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _35 => _35.ledgerVersion])},body:r})).data}async function lo(n){let{aptosConfig:e,options:t}=n,r={query:so,variables:{where_condition:_optionalChain([t, 'optionalAccess', _36 => _36.where]),offset:_optionalChain([t, 'optionalAccess', _37 => _37.offset]),limit:_optionalChain([t, 'optionalAccess', _38 => _38.limit]),order_by:_optionalChain([t, 'optionalAccess', _39 => _39.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function go(n){let{aptosConfig:e,options:t}=n,r={query:ao,variables:{where_condition:_optionalChain([t, 'optionalAccess', _40 => _40.where]),offset:_optionalChain([t, 'optionalAccess', _41 => _41.offset]),limit:_optionalChain([t, 'optionalAccess', _42 => _42.limit]),order_by:_optionalChain([t, 'optionalAccess', _43 => _43.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function xe(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await $({aptosConfig:e,originMethod:"getInfo",path:`accounts/${u.from(t).toString()}`});return r}async function fo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ht({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _44 => _44.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _45 => _45.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _46 => _46.limit]), () => (1e3))}})}async function Hn(n){return _optionalChain([n, 'access', _47 => _47.options, 'optionalAccess', _48 => _48.ledgerVersion])!==void 0?mo(n):De(async()=>mo(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function mo(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await $({aptosConfig:e,originMethod:"getModule",path:`accounts/${u.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _49 => _49.ledgerVersion])}});return o}async function Ao(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ht({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _50 => _50.offset]),limit:_optionalChain([r, 'optionalAccess', _51 => _51.limit])}})}async function ho(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ht({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _52 => _52.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _53 => _53.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _54 => _54.limit]), () => (999))}})}async function Or(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await $({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _55 => _55.ledgerVersion])}});return o.data}async function tn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await Or({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await Ln({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof ye&&a.data.error_code==="table_item_not_found")return s;throw a}}async function To(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:e,query:{query:Zi,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function bo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _56 => _56.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _57 => _57.tokenStandard])});let s={query:Xi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _58 => _58.offset]),limit:_optionalChain([r, 'optionalAccess', _59 => _59.limit]),order_by:_optionalChain([r, 'optionalAccess', _60 => _60.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function wo(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=u.from(t).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _61 => _61.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _62 => _62.tokenStandard])});let c={query:Yi,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _63 => _63.offset]),limit:_optionalChain([i, 'optionalAccess', _64 => _64.limit]),order_by:_optionalChain([i, 'optionalAccess', _65 => _65.orderBy])}};return(await f({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function So(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _66 => _66.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _67 => _67.tokenStandard])}});let s={query:Wi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _68 => _68.offset]),limit:_optionalChain([r, 'optionalAccess', _69 => _69.limit]),order_by:_optionalChain([r, 'optionalAccess', _70 => _70.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function xo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Ji,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function _o(n){let{aptosConfig:e,accountAddress:t,coinType:r}=n,i=u.from(t).toStringLong(),o=await Fr({aptosConfig:e,accountAddress:i,options:{where:{asset_type:{_eq:r}}}});return o[0]?o[0].amount:0}async function Fr(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=u.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _71 => _71.where]),owner_address:{_eq:i}},s={query:Qi,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_optionalChain([r, 'optionalAccess', _73 => _73.limit]),order_by:_optionalChain([r, 'optionalAccess', _74 => _74.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function vo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Hi,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!o.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return o.current_fungible_asset_balances_aggregate.aggregate.count}async function Po(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:ji,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _75 => _75.offset]),limit:_optionalChain([r, 'optionalAccess', _76 => _76.limit]),order_by:_optionalChain([r, 'optionalAccess', _77 => _77.orderBy])}};return(await f({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Co(n){let{aptosConfig:e,privateKey:t}=n,r=new K(t.publicKey());if(t instanceof tt){let o=q.fromPublicKey({publicKey:r}).derivedAddress();return qe.fromPrivateKey({privateKey:t,address:o})}if(t instanceof L){let i=q.fromPublicKey({publicKey:r});if(await yo({authKey:i,aptosConfig:e})){let c=i.derivedAddress();return qe.fromPrivateKey({privateKey:t,address:c,legacy:!1})}let s=q.fromPublicKey({publicKey:r.publicKey});if(await yo({authKey:s,aptosConfig:e})){let c=s.derivedAddress();return qe.fromPrivateKey({privateKey:t,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${t}`)}async function yo(n){let{aptosConfig:e,authKey:t}=n,r=await tn({aptosConfig:e,authenticationKey:t.derivedAddress()});try{return await xe({aptosConfig:e,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function qr(n){let{aptosConfig:e,options:t}=n;return ht({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _78 => _78.offset]),limit:_optionalChain([t, 'optionalAccess', _79 => _79.limit])}})}async function Wn(n){let{aptosConfig:e}=n;return De(async()=>{let{data:t}=await $({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Eo(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await $({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function nn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await $({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Io(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await nn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _80 => _80.status])===404)return!0;throw r}}async function Ya(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await $({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Gt(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _81 => _81.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _82 => _82.checkSuccess]), () => (!0)),s=!0,a=0,c,p,y=200,w=1.5;function S(g){if(!(g instanceof ye)||(p=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await nn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){S(g)}if(s){let g=Date.now();try{c=await Ya({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(E){S(E)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await nn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){S(g)}await _chunkBHKSQXUZjs.b.call(void 0, y),a+=y/1e3,y*=w}if(c===void 0)throw p||new Qn(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Qn(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Mr(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function jn(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await $n({aptosConfig:e}):s=(await Vn({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkBHKSQXUZjs.b.call(void 0, 200)}}var Qn=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Mr=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Uo(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await $({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _83 => _83.withTransactions])}});return zo({block:i,...n})}async function Ro(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await $({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _84 => _84.withTransactions])}});return zo({block:i,...n})}async function zo(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _85 => _85.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _86 => _86.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let p=[],y=100n;for(let S=c+1n;S<s;S+=BigInt(100))p.push(qr({aptosConfig:e,options:{offset:S,limit:Math.min(Number(y),Number(s-S+1n))}}));let w=await Promise.all(p);for(let S of w)t.transactions.push(...S)}return t}async function A(n){n.minimumLedgerVersion!==void 0&&await jn({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}var rn=class{constructor(e){this.config=e}async getAccountInfo(e){return xe({aptosConfig:this.config,...e})}async getAccountModules(e){return fo({aptosConfig:this.config,...e})}async getAccountModule(e){return Hn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Ao({aptosConfig:this.config,...e})}async getAccountResources(e){return ho({aptosConfig:this.config,...e})}async getAccountResource(e){return Or({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return tn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),To({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),bo({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),wo({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),So({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),xo({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Fr({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),vo({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:zn,...e})}async getAccountCoinAmount(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),_o({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Po({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return Co({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Xn=class{constructor(e){this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _87 => _87.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _88 => _88.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _89 => _89.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _90 => _90.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _91 => _91.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _92 => _92.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _93 => _93.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _94 => _94.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _95 => _95.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _96 => _96.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _97 => _97.faucetConfig]), () => ({}))}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return ki[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ki[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return zi[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return xr[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return _r[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return xr[this.network]===e}isProverServiceRequest(e){return _r[this.network]===e}};function ko(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Ko(n){return!!n.match(/\s/)}function Ja(n){return!!n.match(/^T[0-9]+$/)}function ec(n){return!!n.match(/^&.+$/)}function tc(n){switch(n){case"signer":case"address":case"bool":case"u8":case"u16":case"u32":case"u64":case"u128":case"u256":return!0;default:return!1}}function nc(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Ko(r))break}return t}var rc=(E=>(E.InvalidTypeTag="unknown type",E.UnexpectedGenericType="unexpected generic type",E.UnexpectedTypeArgumentClose="unexpected '>'",E.UnexpectedWhitespaceCharacter="unexpected whitespace character",E.UnexpectedComma="unexpected ','",E.TypeArgumentCountMismatch="type argument count doesn't match expected amount",E.MissingTypeArgumentClose="no matching '>' for '<'",E.MissingTypeArgument="no type argument before ','",E.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",E.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",E.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",E.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",E.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",E.InvalidAddress="struct address must be valid",E))(rc||{}),N= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function ze(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _98 => _98.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let E=on(a,i,t);o.push(E)}let y=r.pop();if(y===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:w,savedTypes:S,savedExpectedTypes:g}=y;i=o,o=S,a=w,c=g}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let y=on(a,i,t);i=[],o.push(y),a="",c+=1}else if(Ko(p)){let y=!1;if(a.length!==0){let S=on(a,i,t);i=[],o.push(S),a="",y=!0}s=nc(n,s);let w=n[s];if(s<n.length&&y&&w!==","&&w!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return on(a,i,t);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function on(n,e,t){let r=n.trim(),i=r.toLowerCase();if(tc(i)&&e.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new _t;case"bool":return new D;case"address":return new W;case"u8":return new ae;case"u16":return new Ne;case"u32":return new Oe;case"u64":return new V;case"u128":return new Fe;case"u256":return new Me;case"vector":if(e.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new C(e[0]);default:if(ec(r)){let a=r.substring(1);return new Gn(on(a,e,t))}if(Ja(r)){if(t)return new k(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!ko(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!ko(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new m(new Ue(s,new R(o[1]),new R(o[2]),e))}}function Go(n){return typeof n=="boolean"}function Ve(n){return typeof n=="string"}function ic(n){return typeof n=="number"}function Yn(n){if(ic(n))return n;if(Ve(n)&&n!=="")return Number.parseInt(n,10)}function Zn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Bo(n){return n==null}function Do(n){return $r(n)||Lr(n)||Hr(n)||Qr(n)||Wr(n)||jr(n)||Xr(n)||Jn(n)||Vr(n)||oc(n)||n instanceof T||n instanceof M}function $r(n){return n instanceof I}function Jn(n){return n instanceof u}function Vr(n){return n instanceof b}function oc(n){return n instanceof Xe}function Lr(n){return n instanceof F}function Hr(n){return n instanceof de}function Qr(n){return n instanceof le}function Wr(n){return n instanceof O}function jr(n){return n instanceof ge}function Xr(n){return n instanceof me}function No(n){return"bytecode"in n}function U(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Oo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}function sn(n){let e=n.split("::");if(e.length!==3)throw new Error(`Invalid function ${n}`);let t=e[0],r=e[1],i=e[2];return{moduleAddress:t,moduleName:r,functionName:i}}var sc=new TextEncoder;function er(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _99 => _99.map, 'call', _100 => _100(e=>Ve(e)?ze(e):e)]), () => ([]))}async function Fo(n,e,t,r){let i=await Hn({aptosConfig:r,accountAddress:n,moduleName:e});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===t)}async function Mo(n,e,t,r){let i=await Fo(n,e,t,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${e}::${t}'`);if(!i.is_entry)throw new Error(`'${n}::${e}::${t}' is not an entry function`);let o=Oo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(ze(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function qo(n,e,t,r){let i=await Fo(n,e,t,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${e}::${t}'`);if(!i.is_view)throw new Error(`'${n}::${e}::${t}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(ze(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(ze(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Zr(n,e,t,r,i){if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);let o=e.parameters[r];return Bt(t,o,r,i)}function Bt(n,e,t,r){return Do(n)?(Yr(e,n,t),n):ac(n,e,t,r)}function ac(n,e,t,r){if(e.isBool()){if(Go(n))return new I(n);if(Ve(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",t)}if(e.isAddress()){if(Ve(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isU8()){let i=Yn(n);if(i!==void 0)return new F(i);U("number | string",t)}if(e.isU16()){let i=Yn(n);if(i!==void 0)return new de(i);U("number | string",t)}if(e.isU32()){let i=Yn(n);if(i!==void 0)return new le(i);U("number | string",t)}if(e.isU64()){if(Zn(n))return new O(BigInt(n));U("bigint | number | string",t)}if(e.isU128()){if(Zn(n))return new ge(BigInt(n));U("bigint | number | string",t)}if(e.isU256()){if(Zn(n))return new me(BigInt(n));U("bigint | number | string",t)}if(e.isGeneric()){let i=e.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return Bt(n,r[i],t,r)}if(e.isVector()){if(e.value.isU8()){if(Ve(n))return T.U8(sc.encode(n));if(n instanceof Uint8Array)return T.U8(n);if(n instanceof ArrayBuffer)return T.U8(new Uint8Array(n))}if(Array.isArray(n))return new T(n.map(i=>Bt(i,e.value,t,r)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(Ve(n))return new b(n);U("string",t)}if(e.isObject()){if(Ve(n))return u.fromString(n);U("string | AccountAddress",t)}if(e.isOption()){if(Bo(n)){let i=e.value.typeArgs[0];return i instanceof D?new M(null):i instanceof W?new M(null):i instanceof ae?new M(null):i instanceof Ne?new M(null):i instanceof Oe?new M(null):i instanceof V?new M(null):i instanceof Fe?new M(null):i instanceof Me?new M(null):new M(null)}return new M(Bt(n,e.value.typeArgs[0],t,r))}throw new Error(`Unsupported struct input type for argument ${t}, type '${e.toString()}'`)}throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}function Yr(n,e,t){if(n.isBool()){if($r(e))return;U("Bool",t)}if(n.isAddress()){if(Jn(e))return;U("AccountAddress",t)}if(n.isU8()){if(Lr(e))return;U("U8",t)}if(n.isU16()){if(Hr(e))return;U("U16",t)}if(n.isU32()){if(Qr(e))return;U("U32",t)}if(n.isU64()){if(Wr(e))return;U("U64",t)}if(n.isU128()){if(jr(e))return;U("U128",t)}if(n.isU256()){if(Xr(e))return;U("U256",t)}if(n.isVector()){if(e instanceof T){e.values.length>0&&Yr(n.value,e.values[0],t);return}U("MoveVector",t)}if(n instanceof m){if(n.isString()){if(Vr(e))return;U("MoveString",t)}if(n.isObject()){if(Jn(e))return;U("AccountAddress",t)}if(n.isOption()){if(e instanceof M){e.value!==void 0&&Yr(n.value.typeArgs[0],e.value,t);return}U("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function nr(n){if(No(n))return dc(n);let{moduleAddress:e,moduleName:t,functionName:r}=sn(n.function),i=await Ho({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Mo});return uc({...n,abi:i})}function uc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=sn(n.function),o=er(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>Zr(n.function,e,c,p,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=ut.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Xt(new Zt(c,new Jt(a)))}return new jt(a)}async function $o(n){let{moduleAddress:e,moduleName:t,functionName:r}=sn(n.function),i=await Ho({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:qo});return pc({abi:i,...n})}function pc(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=sn(n.function),o=er(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _101 => _101.functionArguments, 'optionalAccess', _102 => _102.map, 'call', _103 => _103((a,c)=>Zr(n.function,e,a,c,o))]), () => ([]));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);return ut.build(`${t}::${r}`,i,o,s)}function dc(n){return new Wt(new Yt(l.fromHexInput(n.bytecode).toUint8Array(),er(n.typeArguments),n.functionArguments))}async function lc(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Pr[e.network]?{chainId:Pr[e.network]}:{chainId:(await qn({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _104 => _104.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Wn({aptosConfig:e})).gas_estimate},c=async()=>{let gt=async()=>_optionalChain([i, 'optionalAccess', _105 => _105.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await xe({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await gt()}catch (e3){return 0}else return gt()},[{chainId:p},{gasEstimate:y},w]=await Promise.all([s(),a(),c()]),{maxGasAmount:S,gasUnitPrice:g,expireTimestamp:E}={maxGasAmount:_optionalChain([i, 'optionalAccess', _106 => _106.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _107 => _107.gasUnitPrice]), () => (BigInt(y))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _108 => _108.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new ce(u.from(t),BigInt(w),r,BigInt(S),BigInt(g),BigInt(E),new xt(p))}async function Jr(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await lc({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _109 => _109.secondarySignerAddresses, 'optionalAccess', _110 => _110.map, 'call', _111 => _111(c=>u.from(c))]), () => ([]));return new On(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Nn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Vo(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=tr(e);if(t.feePayerAddress){let a=new dt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];r&&(c=r.map(w=>tr(w)));let p=tr(i),y=new Ct(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new lt(a.raw_txn,y).bcsToBytes()}if(t.secondarySignerAddresses){let a=new pt(t.rawTransaction,t.secondarySignerAddresses),c=[];c=r.map(y=>tr(y));let p=new Pt(o,t.secondarySignerAddresses,c);return new lt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof fe)s=new vt(o.public_key,o.signature);else if(o instanceof Q)s=new Et(o);else throw new Error("Invalid public key");return new lt(t.rawTransaction,s).bcsToBytes()}function tr(n){if((n instanceof ee||n instanceof Te)&&(n=new K(n)),n instanceof K){if(n.publicKey instanceof _)return new Q(n,new B(new v(new Uint8Array(64))));if(n.publicKey instanceof Te)return new Q(n,new B(new Pe(new Uint8Array(64))));if(n.publicKey instanceof ee)return new Q(n,new B(Ee.getSimulationSignature()))}return new fe(new _(n.toUint8Array()),new v(new Uint8Array(64)))}function ei(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Ni(H,n.senderAuthenticator),o;if(e.feePayerAddress){if(!t)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new Ct(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Pt(i,e.secondarySignerAddresses,r)}else i instanceof fe?o=new vt(i.public_key,i.signature):o=new Et(i);return new lt(e.rawTransaction,o).bcsToBytes()}function Lo(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var gc=Lo(["APTOS::Transaction"]);function UA(n){let e=ei(n);return new l(Lo([gc,new Uint8Array([0]),e])).toString()}async function Ho({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:De(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function h(n){let e=await mc(n);return yc(n,e)}async function mc(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await nr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await nr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await nr(r)),i}async function yc(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(fc(n)&&(o=u.ZERO.toString()),Ac(n)){let{secondarySignerAddresses:s}=n;return Jr({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Jr({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function fc(n){return n.withFeePayer===!0}function Ac(n){return"secondarySignerAddresses"in n}function Qo(n){let{transaction:e}=n;return Ut(e)}function rr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}async function ti(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Vo({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await it({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _114 => _114.options, 'optionalAccess', _115 => _115.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _116 => _116.options, 'optionalAccess', _117 => _117.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function ir(n){let{aptosConfig:e}=n,t=ei({...n}),{data:r}=await it({aptosConfig:e,body:t,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function an(n){let{aptosConfig:e,signer:t,transaction:r}=n;(t instanceof Se||t instanceof Fn)&&await t.waitForProofFetch();let i=rr({signer:t,transaction:r});return ir({aptosConfig:e,transaction:r,senderAuthenticator:i})}var hc={typeParameters:[],parameters:[C.u8(),new C(C.u8())]};async function Wo(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>T.U8(a));return h({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[T.U8(r),new T(s)],abi:hc},options:o})}var Tc={typeParameters:[],parameters:[new ae,C.u8(),new ae,C.u8(),C.u8(),C.u8()]};async function jo(n){let{aptosConfig:e,fromAccount:t,toNewPrivateKey:r}=n,i=await xe({aptosConfig:e,accountAddress:t.accountAddress}),o=qe.fromPrivateKey({privateKey:r,legacy:!0}),a=new Dn({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),p=o.sign(a),y=await h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new F(t.signingScheme),T.U8(t.publicKey.toUint8Array()),new F(o.signingScheme),T.U8(o.publicKey.toUint8Array()),T.U8(c.toUint8Array()),T.U8(p.toUint8Array())],abi:Tc}});return an({aptosConfig:e,signer:t,transaction:y})}var bc={typeParameters:[{constraints:[]}],parameters:[new W,new V]};async function Xo(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return h({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (zn))],functionArguments:[r,i],abi:bc},options:s})}var cn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return Xo({aptosConfig:this.config,...e})}};var Le={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},ue="0x4::token::Token";async function Yo(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:uo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Zo(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:e,query:{query:Nr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function Jo(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},o={query:Nr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _118 => _118.offset]),limit:_optionalChain([r, 'optionalAccess', _119 => _119.limit]),order_by:_optionalChain([r, 'optionalAccess', _120 => _120.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function es(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:co,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _121 => _121.offset]),limit:_optionalChain([r, 'optionalAccess', _122 => _122.limit]),order_by:_optionalChain([r, 'optionalAccess', _123 => _123.orderBy])}};return(await f({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var wc={typeParameters:[],parameters:[new m(P()),new V,new m(P()),new m(P()),new D,new D,new D,new D,new D,new D,new D,new D,new D,new V,new V]};async function ts(n){let{aptosConfig:e,options:t,creator:r}=n;return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new b(n.description),new O(_nullishCoalesce(n.maxSupply, () => (We))),new b(n.name),new b(n.uri),new I(_nullishCoalesce(n.mutableDescription, () => (!0))),new I(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new I(_nullishCoalesce(n.mutableURI, () => (!0))),new I(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new I(_nullishCoalesce(n.mutableTokenName, () => (!0))),new I(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new I(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new I(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new I(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:wc},options:t})}async function ni(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _124 => _124.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _125 => _125.tokenStandard]), () => ("v2"))}),(await f({aptosConfig:e,query:{query:Gr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function ns(n){let{aptosConfig:e,collectionId:t}=n,i={collection_id:{_eq:u.from(t).toStringLong()}};return(await f({aptosConfig:e,query:{query:Gr,variables:{where_condition:i}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function rs(n){return(await ni(n)).collection_id}var Sc={typeParameters:[],parameters:[new m(P()),new m(P()),new m(P()),new m(P()),new C(new m(P())),new C(new m(P())),new C(C.u8())]};async function is(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:y}=n,w=_optionalChain([p, 'optionalAccess', _126 => _126.map, 'call', _127 => _127(S=>Le[S])]);return h({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new b(i),new b(o),new b(s),new b(a),T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(w, () => ([]))),hs(_nullishCoalesce(y, () => ([])),_nullishCoalesce(w, () => ([])))],abi:Sc},options:t})}var xc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new W]};async function os(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(r),u.from(i)],abi:xc},options:s})}var _c={typeParameters:[],parameters:[new m(P()),new m(P()),new m(P()),new m(P()),new C(new m(P())),new C(new m(P())),new C(C.u8()),new W]};async function ss(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:y,options:w}=n;if(_optionalChain([c, 'optionalAccess', _128 => _128.length])!==_optionalChain([y, 'optionalAccess', _129 => _129.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _130 => _130.length])!==_optionalChain([y, 'optionalAccess', _131 => _131.length]))throw new Error("Property types and property values counts do not match");let S=_optionalChain([p, 'optionalAccess', _132 => _132.map, 'call', _133 => _133(g=>Le[g])]);return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,T.MoveString(_nullishCoalesce(c, () => ([]))),T.MoveString(_nullishCoalesce(S, () => ([]))),hs(_nullishCoalesce(y, () => ([])),_nullishCoalesce(S, () => ([]))),a],abi:_c},options:w})}var vc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0)))]};async function as(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[u.from(r)],abi:vc},options:o})}var Pc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0)))]};async function cs(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:Pc},options:o})}var Cc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0)))]};async function us(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (ue))],functionArguments:[r],abi:Cc},options:o})}var Ec={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function ps(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ec},options:s})}var Ic={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function ds(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Ic},options:s})}var Uc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function ls(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:Uc},options:s})}var Rc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P()),new m(P()),C.u8()]};async function gs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Le[i]),T.U8(ri(o,Le[i]))],abi:Rc},options:c})}var zc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P())]};async function ms(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (ue))],functionArguments:[u.from(i),new b(r)],abi:zc},options:s})}var kc={typeParameters:[{constraints:["key"]}],parameters:[new m(ne(new k(0))),new m(P()),new m(P()),C.u8()]};async function ys(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (ue))],functionArguments:[u.from(s),new b(r),new b(Le[i]),ri(o,Le[i])],abi:kc},options:c})}var Kc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(ne(new k(0))),new m(P()),new k(1)]};async function fs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Le[i]],functionArguments:[u.from(s),new b(r),o],abi:Kc},options:c})}var Gc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(ne(new k(0))),new m(P()),new k(1)]};async function As(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (ue)),Le[i]],functionArguments:[u.from(s),new b(r),o],abi:Gc},options:c})}function hs(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(ri(n[i],r))}),t}function ri(n,e){let t=ze(e);return Bt(n,t,0,[]).bcsToBytes()}var un=class{constructor(e){this.config=e}async getCollectionData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ni({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ns({aptosConfig:this.config,...e})}async getCollectionId(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),rs({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Yo({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Jo({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),es({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ts({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return is({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return os({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return ss({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return as({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return cs({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return us({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return ps({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return ds({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return ls({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return gs({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ms({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ys({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return fs({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return As({aptosConfig:this.config,...e})}};var Ts=300,Bc=n=>{if(n&&n.length>Ts)throw new Error(`Event type length exceeds the maximum length of ${Ts}`)};async function bs(n){let{aptosConfig:e,eventType:t,options:r}=n,o={where:{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},creation_number:{_eq:"0"},sequence_number:{_eq:"0"},indexed_type:{_eq:t}},pagination:r,orderBy:_optionalChain([r, 'optionalAccess', _134 => _134.orderBy])};return pn({aptosConfig:e,options:o})}async function ws(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,a={where:{account_address:{_eq:u.from(e).toStringLong()},creation_number:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _135 => _135.orderBy])};return pn({aptosConfig:t,options:a})}async function Ss(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,a={where:{account_address:{_eq:u.from(e).toStringLong()},indexed_type:{_eq:r}},pagination:i,orderBy:_optionalChain([i, 'optionalAccess', _136 => _136.orderBy])};return pn({aptosConfig:t,options:a})}async function pn(n){let{aptosConfig:e,options:t}=n;Bc(_optionalChain([t, 'optionalAccess', _137 => _137.where, 'optionalAccess', _138 => _138.indexed_type, 'optionalAccess', _139 => _139._eq]));let r={query:ro,variables:{where_condition:_optionalChain([t, 'optionalAccess', _140 => _140.where]),offset:_optionalChain([t, 'optionalAccess', _141 => _141.offset]),limit:_optionalChain([t, 'optionalAccess', _142 => _142.limit]),order_by:_optionalChain([t, 'optionalAccess', _143 => _143.orderBy])}};return(await f({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var dn=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),bs({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),ws({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ss({aptosConfig:this.config,...e})}async getEvents(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _144 => _144.minimumLedgerVersion]),processorType:"events_processor"}),pn({aptosConfig:this.config,...e})}};async function xs(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _145 => _145.timeoutSecs])||20,{data:s}=await Mi({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Gt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _146 => _146.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var ln=class{constructor(e){this.config=e}async fundAccount(e){let t=await xs({aptosConfig:this.config,...e});return _optionalChain([e, 'access', _147 => _147.options, 'optionalAccess', _148 => _148.waitForIndexer])!==!1&&await jn({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version)}),t}};async function or(n){let{aptosConfig:e,options:t}=n,r={query:oo,variables:{where_condition:_optionalChain([t, 'optionalAccess', _149 => _149.where]),limit:_optionalChain([t, 'optionalAccess', _150 => _150.limit]),offset:_optionalChain([t, 'optionalAccess', _151 => _151.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function _s(n){let{aptosConfig:e,options:t}=n,r={query:io,variables:{where_condition:_optionalChain([t, 'optionalAccess', _152 => _152.where]),limit:_optionalChain([t, 'optionalAccess', _153 => _153.limit]),offset:_optionalChain([t, 'optionalAccess', _154 => _154.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function vs(n){let{aptosConfig:e,options:t}=n,r={query:to,variables:{where_condition:_optionalChain([t, 'optionalAccess', _155 => _155.where]),limit:_optionalChain([t, 'optionalAccess', _156 => _156.limit]),offset:_optionalChain([t, 'optionalAccess', _157 => _157.offset])}};return(await f({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Dc={typeParameters:[{constraints:[]}],parameters:[ze("0x1::object::Object"),new W,new V]};async function Ps(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return h({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Dc},options:s})}var gn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _158 => _158.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),or({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _159 => _159.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await or({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _160 => _160.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await or({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _161 => _161.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),_s({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _162 => _162.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),vs({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Ps({aptosConfig:this.config,...e})}};async function He(n){let{aptosConfig:e,payload:t,options:r}=n,i=await $o({...t,aptosConfig:e}),o=new Y;i.serialize(o);let s=o.toUint8Array(),{data:a}=await it({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _163 => _163.ledgerVersion])},body:s});return a}var mn=class{constructor(e){this.config=e}async getLedgerInfo(){return qn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Uo({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Ro({aptosConfig:this.config,...e})}async view(e){return He({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return po({aptosConfig:this.config,...e})}async queryIndexer(e){return f({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return $n({aptosConfig:this.config})}async getProcessorStatus(e){return Vn({aptosConfig:this.config,processorType:e})}};var Cs=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Es(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Qe(n){let[e,t,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Es(e))throw new Error(`${e} is not valid. ${Cs}`);if(t&&!Es(t))throw new Error(`${t} is not valid. ${Cs}`);return{domainName:t||e,subdomainName:t?e:void 0}}var Nc="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Oc={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Nc,custom:null,devnet:null};function ke(n){let e=Oc[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var sr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Is(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:i,subdomainName:o}=Qe(t),s=await He({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=sr(s[0]);return a?u.from(a):void 0}async function Us(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=ke(e),{domainName:y,subdomainName:w}=Qe(r),S=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(w&&!S)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(S&&!w)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let lr=_nullishCoalesce(t.years, () => (1));if(lr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Qs=lr*31536e3;return await h({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[y,Qs,o,s]},options:a})}if(!w)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await ii({aptosConfig:e,name:y});if(!g)throw new Error("The domain does not exist");let E=t.policy==="subdomain:independent"?t.expirationDate:g;if(E>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await h({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[y,w,Math.round(E/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function ii(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:i,subdomainName:o}=Qe(t);try{let s=await He({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e4){return}}async function Rs(n){let{aptosConfig:e,address:t}=n,r=ke(e),i=await He({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(t).toString()]}}),o=sr(i[1]),s=sr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function zs(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=ke(e);if(!r)return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Qe(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function ks(n){let{aptosConfig:e,name:t}=n,r=ke(e),{domainName:i,subdomainName:o}=Qe(t),s=await He({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=sr(s[0]);return a?u.from(a):void 0}async function Ks(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=ke(e),{domainName:a,subdomainName:c}=Qe(r);return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Gs(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=Qe(t),a=(await f({aptosConfig:e,query:{query:Kt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i},is_active:{_eq:!0}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=yn(a)),a}async function Bs(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await oi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountNames",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _164 => _164.limit]),offset:_optionalChain([t, 'optionalAccess', _165 => _165.offset]),order_by:_optionalChain([t, 'optionalAccess', _166 => _166.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _167 => _167.options, 'optionalAccess', _168 => _168.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(yn)}async function Ds(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await oi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _169 => _169.limit]),offset:_optionalChain([t, 'optionalAccess', _170 => _170.offset]),order_by:_optionalChain([t, 'optionalAccess', _171 => _171.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _172 => _172.options, 'optionalAccess', _173 => _173.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(yn)}async function Ns(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await oi({aptosConfig:e});return(await f({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _174 => _174.limit]),offset:_optionalChain([t, 'optionalAccess', _175 => _175.offset]),order_by:_optionalChain([t, 'optionalAccess', _176 => _176.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _177 => _177.options, 'optionalAccess', _178 => _178.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(yn)}async function Os(n){let{aptosConfig:e,options:t,domain:r}=n;return(await f({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Kt,variables:{limit:_optionalChain([t, 'optionalAccess', _179 => _179.limit]),offset:_optionalChain([t, 'optionalAccess', _180 => _180.offset]),order_by:_optionalChain([t, 'optionalAccess', _181 => _181.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _182 => _182.options, 'optionalAccess', _183 => _183.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""},is_active:{_eq:!0}}}}})).current_aptos_names.map(yn)}async function oi(n){let{aptosConfig:e}=n,t=ke(e),[r]=await He({aptosConfig:e,payload:{function:`${t}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function Fs(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=ke(e),a=i*31536e3,{domainName:c,subdomainName:p}=Qe(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await h({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function yn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var fn=class{constructor(e){this.config=e}async getOwnerAddress(e){return Is({aptosConfig:this.config,...e})}async getExpiration(e){return ii({aptosConfig:this.config,...e})}async getTargetAddress(e){return ks({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ks({aptosConfig:this.config,...e})}async getPrimaryName(e){return Rs({aptosConfig:this.config,...e})}async setPrimaryName(e){return zs({aptosConfig:this.config,...e})}async registerName(e){return Us({aptosConfig:this.config,...e})}async renewDomain(e){return Fs({aptosConfig:this.config,...e})}async getName(e){return Gs({aptosConfig:this.config,...e})}async getAccountNames(e){return Bs({aptosConfig:this.config,...e})}async getAccountDomains(e){return Ds({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Ns({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Os({aptosConfig:this.config,...e})}};async function Ms(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),o=await f({aptosConfig:e,query:{query:Br,variables:{where_condition:{pool_address:{_eq:r}}}}});return o.num_active_delegator_per_pool[0]?o.num_active_delegator_per_pool[0].num_active_delegator:0}async function qs(n){let{aptosConfig:e,options:t}=n,r={query:Br,variables:{order_by:_optionalChain([t, 'optionalAccess', _184 => _184.orderBy])}};return(await f({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function $s(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:no,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:e,query:i})).delegated_staking_activities}var An=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _185 => _185.minimumLedgerVersion]),processorType:"stake_processor"}),Ms({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _186 => _186.minimumLedgerVersion]),processorType:"stake_processor"}),qs({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await A({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _187 => _187.minimumLedgerVersion]),processorType:"stake_processor"}),$s({aptosConfig:this.config,...e})}};var ar=class{constructor(e){this.config=e}async simple(e){return h({aptosConfig:this.config,...e})}async multiAgent(e){return h({aptosConfig:this.config,...e})}};function si(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},t}function ai(n,e,t){let r=t.value;return t.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},t}var Dt=class{constructor(e){this.config=e}async simple(e){return ti({aptosConfig:this.config,...e})}async multiAgent(e){return ti({aptosConfig:this.config,...e})}};_chunkBHKSQXUZjs.a.call(void 0, [ai],Dt.prototype,"simple",1),_chunkBHKSQXUZjs.a.call(void 0, [ai],Dt.prototype,"multiAgent",1);var Nt=class{constructor(e){this.config=e}async simple(e){return ir({aptosConfig:this.config,...e})}async multiAgent(e){return ir({aptosConfig:this.config,...e})}};_chunkBHKSQXUZjs.a.call(void 0, [si],Nt.prototype,"simple",1),_chunkBHKSQXUZjs.a.call(void 0, [si],Nt.prototype,"multiAgent",1);var cr=class{constructor(e,t,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=e,this.account=t,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkBHKSQXUZjs.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime),_chunkBHKSQXUZjs.c.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}e=this.currentNumber,this.currentNumber+=BigInt(1)}catch(t){console.error("error in getting next sequence number for this account",t)}finally{this.lock=!1}return e}async initialize(){let{sequence_number:e}=await xe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await xe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(e),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkBHKSQXUZjs.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkBHKSQXUZjs.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkBHKSQXUZjs.b.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var Ot=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _188 => _188.pendingDequeue, 'access', _189 => _189.shift, 'call', _190 => _190(), 'optionalAccess', _191 => _191.resolve, 'call', _192 => _192(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new Ft("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Ft=class extends Error{};var Vs="fulfilled",Ls= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Ls||{}),ur= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new Ot;this.transactionsQueue=new Ot;this.outstandingTransactions=new Ot;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new cr(t,r,i,o,s)}async submitNextTransaction(){try{for(;;){let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let r=await this.generateNextTransaction(this.account,t);if(!r)return;let i=an({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Ft)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(t.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),t.push(i),r.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===Vs?(this.sentTransactions.push([c.value.hash,o,null]),this.emit("transactionSent",{message:`transaction hash ${c.value.hash} has been committed to chain`,transactionHash:c.value.hash}),await this.checkTransaction(c,o)):(this.sentTransactions.push([c.status,o,c.reason]),this.emit("transactionSendFailed",{message:`failed to commit transaction ${this.sentTransactions.length} with error ${c.reason}`,error:c.reason}))}this.emit("executionFinish",{message:`execute ${s.length} transactions finished`})}}catch(t){if(t instanceof Ft)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Gt({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Vs?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:t.value.hash})):(this.executedTransactions.push([a.status,r,a.reason]),this.emit("transactionExecutionFailed",{message:`failed to execute transaction ${this.executedTransactions.length} with error ${a.reason}`,error:a.reason}))}}catch(i){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${i}`)}}async push(t,r){this.transactionsQueue.enqueue([t,r])}async generateNextTransaction(t,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return h({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}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 pr=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new ur(this.config,t),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:t,options:r}=e;for(let i of t)this.transactionWorker.push(i,r)}registerToEvents(){this.transactionWorker.on("transactionSent",async e=>{this.emit("transactionSent",e)}),this.transactionWorker.on("transactionSendFailed",async e=>{this.emit("transactionSendFailed",e)}),this.transactionWorker.on("transactionExecuted",async e=>{this.emit("transactionExecuted",e)}),this.transactionWorker.on("transactionExecutionFailed",async e=>{this.emit("transactionExecutionFailed",e)}),this.transactionWorker.on("executionFinish",async e=>{this.emit("executionFinish",e)})}forSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.start({sender:t}),this.push({data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}};var hn=class{constructor(e){this.config=e,this.build=new ar(this.config),this.simulate=new Dt(this.config),this.submit=new Nt(this.config),this.batch=new pr(this.config)}async getTransactions(e){return qr({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Eo({aptosConfig:this.config,...e})}async getTransactionByHash(e){return nn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Io({aptosConfig:this.config,...e})}async waitForTransaction(e){return Gt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Wn({aptosConfig:this.config})}getSigningMessage(e){return Qo(e)}async publishPackageTransaction(e){return Wo({aptosConfig:this.config,...e})}async rotateAuthKey(e){return jo({aptosConfig:this.config,...e})}sign(e){return rr({...e})}signAsFeePayer(e){let{signer:t,transaction:r}=e;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=t.accountAddress,rr({signer:t,transaction:r})}async batchTransactionsForSingleAccount(e){try{let{sender:t,data:r,options:i}=e;this.batch.forSingleAccount({sender:t,data:r,options:i})}catch(t){throw new Error(`failed to submit transactions with error: ${t}`)}}async signAndSubmitTransaction(e){let{signer:t,transaction:r}=e;return an({aptosConfig:this.config,signer:t,transaction:r})}};var Tn=class{constructor(e){this.config=e}async getTableItem(e){return Ln({aptosConfig:this.config,...e})}async getTableItemsData(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),lo({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await A({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),go({aptosConfig:this.config,...e})}};async function dr(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await qi({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return l.fromHexInput(a.pepper).toUint8Array()}async function ci(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await dr(n),uidKey:o="sub"}=n;if(l.fromHexInput(i).toUint8Array().length!==Se.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Se.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await Li({aptosConfig:e});if(s<r.expiryDateSecs-_chunkBHKSQXUZjs.c.call(void 0, ))throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let a={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:l.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:l.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:c}=await $i({aptosConfig:e,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),p=c.proof,y=new bt({a:p.a,b:p.b,c:p.c});return new Ie({proof:new wt(y,0),trainingWheelsSignature:be.fromHex(c.training_wheels_signature),expHorizonSecs:s})}async function Hs(n){let{aptosConfig:e,jwt:t,uidKey:r,proofFetchCallback:i,pepper:o=await dr(n)}=n,s=ci({...n,pepper:o}),a=i?s:await s,c=ee.fromJwtAndPepper({jwt:t,pepper:o,uidKey:r}),p=await tn({aptosConfig:e,authenticationKey:c.authKey().derivedAddress()});return Se.create({...n,address:p,proof:a,pepper:o,proofFetchCallback:i})}var bn=class{constructor(e){this.config=e}async getPepper(e){return dr({aptosConfig:this.config,...e})}async getProof(e){return ci({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return Hs({aptosConfig:this.config,...e})}};var Z=class{constructor(e){this.config=new Xn(e),this.account=new rn(this.config),this.ans=new fn(this.config),this.coin=new cn(this.config),this.digitalAsset=new un(this.config),this.event=new dn(this.config),this.faucet=new ln(this.config),this.fungibleAsset=new gn(this.config),this.general=new mn(this.config),this.staking=new An(this.config),this.transaction=new hn(this.config),this.table=new Tn(this.config),this.keyless=new bn(this.config)}};function pe(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}pe(Z,rn,"account");pe(Z,fn,"ans");pe(Z,cn,"coin");pe(Z,un,"digitalAsset");pe(Z,dn,"event");pe(Z,ln,"faucet");pe(Z,gn,"fungibleAsset");pe(Z,mn,"general");pe(Z,An,"staking");pe(Z,hn,"transaction");pe(Z,Tn,"table");pe(Z,bn,"keyless");exports.APTOS_BIP44_REGEX = aa; exports.APTOS_COIN = zn; exports.APTOS_HARDENED_REGEX = sa; exports.Account = qe; exports.AccountAddress = u; exports.AccountAuthenticator = H; exports.AccountAuthenticatorEd25519 = fe; exports.AccountAuthenticatorMultiEd25519 = Kn; exports.AccountAuthenticatorMultiKey = at; exports.AccountAuthenticatorSingleKey = Q; exports.AccountAuthenticatorVariant = yi; exports.AccountPublicKey = ie; exports.AccountSequenceNumber = cr; exports.AddressInvalidReason = na; exports.AnyPublicKey = K; exports.AnyPublicKeyVariant = mr; exports.AnySignature = B; exports.AnySignatureVariant = fi; exports.Aptos = Z; exports.AptosApiError = ye; exports.AptosApiType = Lt; exports.AptosConfig = Xn; exports.AuthenticationKey = q; exports.Bool = I; exports.CKDPriv = _i; exports.ChainId = xt; exports.DEFAULT_MAX_GAS_AMOUNT = Gi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Bi; exports.DEFAULT_TXN_TIMEOUT_SEC = Rn; exports.DeriveScheme = ea; exports.Deserializer = re; exports.EPK_HORIZON_SECS = ll; exports.Ed25519Account = Rt; exports.Ed25519PrivateKey = L; exports.Ed25519PublicKey = _; exports.Ed25519Signature = v; exports.EntryFunction = ut; exports.EntryFunctionBytes = _n; exports.EphemeralCertificate = Tt; exports.EphemeralCertificateVariant = fr; exports.EphemeralKeyPair = en; exports.EphemeralPublicKey = nt; exports.EphemeralPublicKeyVariant = yr; exports.EphemeralSignature = be; exports.EphemeralSignatureVariant = Ai; exports.FeePayerRawTransaction = dt; exports.FixedBytes = Xe; exports.Groth16Zkp = bt; exports.HARDENED_OFFSET = wi; exports.Hex = l; exports.HexInvalidReason = Xs; exports.Identifier = R; exports.KeyType = ca; exports.KeylessAccount = Se; exports.KeylessConfiguration = Ur; exports.KeylessPublicKey = ee; exports.KeylessSignature = Ee; exports.MAX_AUD_VAL_BYTES = Ga; exports.MAX_COMMITED_EPK_BYTES = fl; exports.MAX_EXTRA_FIELD_BYTES = ml; exports.MAX_ISS_VAL_BYTES = gl; exports.MAX_JWT_HEADER_B64_BYTES = yl; exports.MAX_UID_KEY_BYTES = Ba; exports.MAX_UID_VAL_BYTES = Da; exports.MimeType = vn; exports.ModuleId = Qt; exports.MoveAbility = hi; exports.MoveFunctionVisibility = Zs; exports.MoveOption = M; exports.MoveString = b; exports.MoveVector = T; exports.MultiAgentRawTransaction = pt; exports.MultiAgentTransaction = On; exports.MultiEd25519PublicKey = ft; exports.MultiEd25519Signature = Je; exports.MultiKey = St; exports.MultiKeyAccount = Fn; exports.MultiKeySignature = st; exports.MultiSig = Zt; exports.MultiSigTransactionPayload = Jt; exports.Network = vr; exports.NetworkToChainId = Pr; exports.NetworkToFaucetAPI = Ki; exports.NetworkToIndexerAPI = zi; exports.NetworkToNetworkName = gd; exports.NetworkToNodeAPI = ki; exports.NetworkToPepperAPI = xr; exports.NetworkToProverAPI = _r; exports.ParsingError = X; exports.ProcessorType = rt; exports.PublicKey = Ye; exports.RAW_TRANSACTION_SALT = Di; exports.RAW_TRANSACTION_WITH_DATA_SALT = Cr; exports.RawTransaction = ce; exports.RawTransactionWithData = Bn; exports.RoleType = Js; exports.RotationProofChallenge = Dn; exports.Script = Yt; exports.ScriptTransactionArgumentVariants = qt; exports.Secp256k1PrivateKey = tt; exports.Secp256k1PublicKey = Te; exports.Secp256k1Signature = Pe; exports.Serializable = d; exports.Serializer = Y; exports.Signature = G; exports.SignedTransaction = lt; exports.SigningScheme = Ae; exports.SigningSchemeInput = Tr; exports.SimpleTransaction = Nn; exports.SingleKeyAccount = zt; exports.StructTag = Ue; exports.TransactionAuthenticator = Re; exports.TransactionAuthenticatorEd25519 = vt; exports.TransactionAuthenticatorFeePayer = Ct; exports.TransactionAuthenticatorMultiAgent = Pt; exports.TransactionAuthenticatorMultiEd25519 = zr; exports.TransactionAuthenticatorSingleSender = Et; exports.TransactionAuthenticatorVariant = mi; exports.TransactionPayload = ct; exports.TransactionPayloadEntryFunction = jt; exports.TransactionPayloadMultiSig = Xt; exports.TransactionPayloadScript = Wt; exports.TransactionPayloadVariants = li; exports.TransactionResponseType = hr; exports.TransactionVariants = gi; exports.TransactionWorker = ur; exports.TransactionWorkerEventsEnum = Ls; exports.TypeTag = z; exports.TypeTagAddress = W; exports.TypeTagBool = D; exports.TypeTagGeneric = k; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = rc; exports.TypeTagReference = Gn; exports.TypeTagSigner = _t; exports.TypeTagStruct = m; exports.TypeTagU128 = Fe; exports.TypeTagU16 = Ne; exports.TypeTagU256 = Me; exports.TypeTagU32 = Oe; exports.TypeTagU64 = V; exports.TypeTagU8 = ae; exports.TypeTagVariants = di; exports.TypeTagVector = C; exports.U128 = ge; exports.U16 = de; exports.U256 = me; exports.U32 = le; exports.U64 = O; exports.U8 = F; exports.ZeroKnowledgeSig = Ie; exports.ZkProof = wt; exports.ZkpVariant = Ar; exports.aptosCoinStructTag = vg; exports.aptosRequest = kn; exports.buildTransaction = Jr; exports.checkOrConvertArgument = Bt; exports.convertArgument = Zr; exports.convertNumber = Yn; exports.deriveKey = br; exports.deriveTransactionType = kr; exports.deserializeFromScriptArgument = Ma; exports.ensureBoolean = gr; exports.fetchEntryFunctionAbi = Mo; exports.fetchFunctionAbi = Fo; exports.fetchViewFunctionAbi = qo; exports.findFirstNonSignerArg = Oo; exports.generateRawTransaction = lc; exports.generateSignedTransaction = ei; exports.generateSignedTransactionForSimulation = Vo; exports.generateSigningMessage = It; exports.generateSigningMessageForSerializable = Dm; exports.generateSigningMessageForTransaction = Ut; exports.generateTransactionPayload = nr; exports.generateTransactionPayloadWithABI = uc; exports.generateUserTransactionHash = UA; exports.generateViewFunctionPayload = $o; exports.generateViewFunctionPayloadWithABI = pc; exports.get = Er; exports.getAptosFullNode = $; exports.getAptosPepperService = Bd; exports.getAuthenticatorForSimulation = tr; exports.getFunctionParts = sn; exports.getKeylessConfig = Li; exports.hashValues = Lo; exports.isBcsAddress = Jn; exports.isBcsBool = $r; exports.isBcsFixedBytes = oc; exports.isBcsString = Vr; exports.isBcsU128 = jr; exports.isBcsU16 = Hr; exports.isBcsU256 = Xr; exports.isBcsU32 = Qr; exports.isBcsU64 = Wr; exports.isBcsU8 = Lr; exports.isBlockMetadataTransactionResponse = gu; exports.isBool = Go; exports.isEd25519Signature = fu; exports.isEmptyOption = Bo; exports.isEncodedEntryFunctionArgument = Do; exports.isFeePayerSignature = Tu; exports.isGenesisTransactionResponse = lu; exports.isLargeNumber = Zn; exports.isMultiAgentSignature = hu; exports.isMultiEd25519Signature = bu; exports.isNumber = ic; exports.isPendingTransactionResponse = pu; exports.isScriptDataInput = No; exports.isSecp256k1Signature = Au; exports.isStateCheckpointTransactionResponse = mu; exports.isString = Ve; exports.isUserTransactionResponse = du; exports.isValidBIP44Path = Si; exports.isValidHardenedPath = xi; exports.isValidatorTransactionResponse = yu; exports.mnemonicToSeed = Pn; exports.normalizeBundle = Ni; exports.objectStructTag = ne; exports.optionStructTag = Pg; exports.outOfRangeErrorMessage = Ys; exports.paginateWithCursor = ht; exports.parseTypeTag = ze; exports.post = Ht; exports.postAptosFaucet = Mi; exports.postAptosFullNode = it; exports.postAptosIndexer = Fi; exports.postAptosPepperService = qi; exports.postAptosProvingService = $i; exports.promiseFulfilledStatus = Vs; exports.request = ka; exports.splitPath = vi; exports.standardizeTypeTags = er; exports.stringStructTag = P; exports.throwTypeMismatch = U; exports.validateNumberInRange = Ge;
460
460
  //# sourceMappingURL=index.js.map