@aptos-labs/ts-sdk 3.1.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/dist/common/{account-Bb5REyaT.d.ts → account-CmEgDBH6.d.ts} +1 -1
  2. package/dist/common/cli/index.d.ts +1 -1
  3. package/dist/common/index.d.ts +6 -203
  4. package/dist/common/index.js +32 -51
  5. package/dist/common/index.js.map +1 -1
  6. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  7. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  8. package/dist/esm/account/Account.mjs +1 -1
  9. package/dist/esm/account/AccountUtils.mjs +1 -1
  10. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  11. package/dist/esm/account/Ed25519Account.mjs +1 -1
  12. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  13. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  14. package/dist/esm/account/KeylessAccount.mjs +1 -1
  15. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  16. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  17. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  18. package/dist/esm/account/index.mjs +1 -1
  19. package/dist/esm/account/utils.mjs +1 -1
  20. package/dist/esm/api/account/abstraction.mjs +1 -1
  21. package/dist/esm/api/account.mjs +1 -1
  22. package/dist/esm/api/ans.mjs +1 -1
  23. package/dist/esm/api/aptos.d.mts +0 -2
  24. package/dist/esm/api/aptos.mjs +1 -1
  25. package/dist/esm/api/coin.mjs +1 -1
  26. package/dist/esm/api/digitalAsset.mjs +1 -1
  27. package/dist/esm/api/faucet.mjs +1 -1
  28. package/dist/esm/api/fungibleAsset.mjs +1 -1
  29. package/dist/esm/api/general.mjs +1 -1
  30. package/dist/esm/api/index.d.mts +0 -1
  31. package/dist/esm/api/index.mjs +1 -1
  32. package/dist/esm/api/keyless.mjs +1 -1
  33. package/dist/esm/api/object.mjs +1 -1
  34. package/dist/esm/api/staking.mjs +1 -1
  35. package/dist/esm/api/table.mjs +1 -1
  36. package/dist/esm/api/transaction.mjs +1 -1
  37. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  39. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  40. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  41. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  42. package/dist/esm/api/utils.mjs +1 -1
  43. package/dist/esm/bcs/index.mjs +1 -1
  44. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  45. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  46. package/dist/esm/{chunk-JEEUU42Q.mjs → chunk-3BMZKCLH.mjs} +2 -2
  47. package/dist/esm/{chunk-CO67Y6YE.mjs → chunk-4JT5AESZ.mjs} +2 -2
  48. package/dist/esm/chunk-55Q7BSZT.mjs +6 -0
  49. package/dist/esm/chunk-55Q7BSZT.mjs.map +1 -0
  50. package/dist/esm/{chunk-QVLV73OB.mjs → chunk-6JYQ5P36.mjs} +2 -2
  51. package/dist/esm/chunk-6SLY7UV2.mjs +2 -0
  52. package/dist/esm/{chunk-ZIB2TU7B.mjs.map → chunk-6SLY7UV2.mjs.map} +1 -1
  53. package/dist/esm/{chunk-MGMCLJQC.mjs → chunk-BPWSOC2Y.mjs} +2 -2
  54. package/dist/esm/{chunk-RQX6JOEN.mjs → chunk-EF4FA5I6.mjs} +2 -2
  55. package/dist/esm/{chunk-GMEBV7NZ.mjs → chunk-HZVN4JSO.mjs} +2 -2
  56. package/dist/esm/{chunk-UQWF24SS.mjs → chunk-K43K3YG7.mjs} +2 -2
  57. package/dist/esm/{chunk-CFQFFP6N.mjs → chunk-MSMFHPDT.mjs} +2 -2
  58. package/dist/esm/{chunk-KJW3XYRT.mjs → chunk-NF73V673.mjs} +2 -2
  59. package/dist/esm/{chunk-DAGUHPTV.mjs → chunk-PLI53ZU6.mjs} +2 -2
  60. package/dist/esm/{chunk-NIXUOEWL.mjs → chunk-UQZTHVWC.mjs} +2 -2
  61. package/dist/esm/{chunk-XZQAMU5W.mjs → chunk-V6C6NWFU.mjs} +2 -2
  62. package/dist/esm/{chunk-TZRRQMCT.mjs → chunk-XYXBAU4J.mjs} +2 -2
  63. package/dist/esm/cli/index.mjs +1 -1
  64. package/dist/esm/cli/localNode.mjs +1 -1
  65. package/dist/esm/client/core.mjs +1 -1
  66. package/dist/esm/client/get.mjs +1 -1
  67. package/dist/esm/client/index.mjs +1 -1
  68. package/dist/esm/client/post.mjs +1 -1
  69. package/dist/esm/core/account/index.mjs +1 -1
  70. package/dist/esm/core/account/utils/address.mjs +1 -1
  71. package/dist/esm/core/account/utils/index.mjs +1 -1
  72. package/dist/esm/core/accountAddress.mjs +1 -1
  73. package/dist/esm/core/authenticationKey.mjs +1 -1
  74. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  75. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  76. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  77. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  78. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  79. package/dist/esm/core/crypto/index.mjs +1 -1
  80. package/dist/esm/core/crypto/keyless.mjs +1 -1
  81. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  82. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  83. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  84. package/dist/esm/core/crypto/proof.mjs +1 -1
  85. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  86. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  87. package/dist/esm/core/crypto/signature.mjs +1 -1
  88. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  89. package/dist/esm/core/index.mjs +1 -1
  90. package/dist/esm/errors/index.mjs +1 -1
  91. package/dist/esm/index.d.mts +0 -1
  92. package/dist/esm/index.mjs +1 -1
  93. package/dist/esm/internal/abstraction.mjs +1 -1
  94. package/dist/esm/internal/account.mjs +1 -1
  95. package/dist/esm/internal/ans.d.mts +19 -8
  96. package/dist/esm/internal/ans.mjs +1 -1
  97. package/dist/esm/internal/coin.mjs +1 -1
  98. package/dist/esm/internal/digitalAsset.mjs +1 -1
  99. package/dist/esm/internal/faucet.mjs +1 -1
  100. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  101. package/dist/esm/internal/general.mjs +1 -1
  102. package/dist/esm/internal/keyless.mjs +1 -1
  103. package/dist/esm/internal/object.mjs +1 -1
  104. package/dist/esm/internal/staking.mjs +1 -1
  105. package/dist/esm/internal/table.mjs +1 -1
  106. package/dist/esm/internal/transaction.mjs +1 -1
  107. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  108. package/dist/esm/internal/utils/index.mjs +1 -1
  109. package/dist/esm/internal/utils/utils.mjs +1 -1
  110. package/dist/esm/internal/view.mjs +1 -1
  111. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  112. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  113. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  114. package/dist/esm/transactions/index.mjs +1 -1
  115. package/dist/esm/transactions/instances/index.mjs +1 -1
  116. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  117. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  118. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  119. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  120. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  121. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  122. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  123. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  124. package/dist/esm/transactions/management/index.mjs +1 -1
  125. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  126. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  127. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  128. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  129. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  130. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +2 -2
  131. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  132. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  133. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  134. package/dist/esm/types/index.mjs +1 -1
  135. package/dist/esm/types/indexer.d.mts +1 -1
  136. package/dist/esm/utils/helpers.mjs +1 -1
  137. package/dist/esm/utils/index.mjs +1 -1
  138. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  139. package/dist/esm/version.d.mts +1 -1
  140. package/dist/esm/version.mjs +1 -1
  141. package/package.json +1 -1
  142. package/src/api/aptos.ts +10 -9
  143. package/src/internal/ans.ts +19 -8
  144. package/src/version.ts +1 -1
  145. package/dist/esm/api/event.d.mts +0 -193
  146. package/dist/esm/api/event.mjs +0 -2
  147. package/dist/esm/api/event.mjs.map +0 -1
  148. package/dist/esm/chunk-GXDOOLCG.mjs +0 -6
  149. package/dist/esm/chunk-GXDOOLCG.mjs.map +0 -1
  150. package/dist/esm/chunk-ZIB2TU7B.mjs +0 -2
  151. package/dist/esm/internal/event.d.mts +0 -82
  152. package/dist/esm/internal/event.mjs +0 -2
  153. package/dist/esm/internal/event.mjs.map +0 -1
  154. package/src/api/event.ts +0 -230
  155. package/src/internal/event.ts +0 -171
  156. /package/dist/esm/{chunk-JEEUU42Q.mjs.map → chunk-3BMZKCLH.mjs.map} +0 -0
  157. /package/dist/esm/{chunk-CO67Y6YE.mjs.map → chunk-4JT5AESZ.mjs.map} +0 -0
  158. /package/dist/esm/{chunk-QVLV73OB.mjs.map → chunk-6JYQ5P36.mjs.map} +0 -0
  159. /package/dist/esm/{chunk-MGMCLJQC.mjs.map → chunk-BPWSOC2Y.mjs.map} +0 -0
  160. /package/dist/esm/{chunk-RQX6JOEN.mjs.map → chunk-EF4FA5I6.mjs.map} +0 -0
  161. /package/dist/esm/{chunk-GMEBV7NZ.mjs.map → chunk-HZVN4JSO.mjs.map} +0 -0
  162. /package/dist/esm/{chunk-UQWF24SS.mjs.map → chunk-K43K3YG7.mjs.map} +0 -0
  163. /package/dist/esm/{chunk-CFQFFP6N.mjs.map → chunk-MSMFHPDT.mjs.map} +0 -0
  164. /package/dist/esm/{chunk-KJW3XYRT.mjs.map → chunk-NF73V673.mjs.map} +0 -0
  165. /package/dist/esm/{chunk-DAGUHPTV.mjs.map → chunk-PLI53ZU6.mjs.map} +0 -0
  166. /package/dist/esm/{chunk-NIXUOEWL.mjs.map → chunk-UQZTHVWC.mjs.map} +0 -0
  167. /package/dist/esm/{chunk-XZQAMU5W.mjs.map → chunk-V6C6NWFU.mjs.map} +0 -0
  168. /package/dist/esm/{chunk-TZRRQMCT.mjs.map → chunk-XYXBAU4J.mjs.map} +0 -0
@@ -1,2 +1,2 @@
1
- import{Ud as a}from"../../chunk-GXDOOLCG.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-NIXUOEWL.mjs";import"../../chunk-CO67Y6YE.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-RQX6JOEN.mjs";import"../../chunk-CFQFFP6N.mjs";import"../../chunk-UQWF24SS.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-GMEBV7NZ.mjs";import"../../chunk-JEEUU42Q.mjs";import"../../chunk-XZQAMU5W.mjs";import"../../chunk-DAGUHPTV.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-TZRRQMCT.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-MGMCLJQC.mjs";import"../../chunk-QVLV73OB.mjs";import"../../chunk-KJW3XYRT.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-ZIB2TU7B.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Build};
1
+ import{Pd as a}from"../../chunk-55Q7BSZT.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-UQZTHVWC.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-4JT5AESZ.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-MSMFHPDT.mjs";import"../../chunk-K43K3YG7.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-HZVN4JSO.mjs";import"../../chunk-3BMZKCLH.mjs";import"../../chunk-V6C6NWFU.mjs";import"../../chunk-PLI53ZU6.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-XYXBAU4J.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-BPWSOC2Y.mjs";import"../../chunk-6JYQ5P36.mjs";import"../../chunk-NF73V673.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-6SLY7UV2.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Build};
2
2
  //# sourceMappingURL=build.mjs.map
@@ -1,2 +1,2 @@
1
- import{$d as a}from"../../chunk-GXDOOLCG.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-NIXUOEWL.mjs";import"../../chunk-CO67Y6YE.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-RQX6JOEN.mjs";import"../../chunk-CFQFFP6N.mjs";import"../../chunk-UQWF24SS.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-GMEBV7NZ.mjs";import"../../chunk-JEEUU42Q.mjs";import"../../chunk-XZQAMU5W.mjs";import"../../chunk-DAGUHPTV.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-TZRRQMCT.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-MGMCLJQC.mjs";import"../../chunk-QVLV73OB.mjs";import"../../chunk-KJW3XYRT.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-ZIB2TU7B.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as TransactionManagement};
1
+ import{Wd as a}from"../../chunk-55Q7BSZT.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-UQZTHVWC.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-4JT5AESZ.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-MSMFHPDT.mjs";import"../../chunk-K43K3YG7.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-HZVN4JSO.mjs";import"../../chunk-3BMZKCLH.mjs";import"../../chunk-V6C6NWFU.mjs";import"../../chunk-PLI53ZU6.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-XYXBAU4J.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-BPWSOC2Y.mjs";import"../../chunk-6JYQ5P36.mjs";import"../../chunk-NF73V673.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-6SLY7UV2.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as TransactionManagement};
2
2
  //# sourceMappingURL=management.mjs.map
@@ -1,2 +1,2 @@
1
- import{Zb as o}from"../../chunk-GXDOOLCG.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-NIXUOEWL.mjs";import"../../chunk-CO67Y6YE.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-RQX6JOEN.mjs";import"../../chunk-CFQFFP6N.mjs";import"../../chunk-UQWF24SS.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-GMEBV7NZ.mjs";import"../../chunk-JEEUU42Q.mjs";import"../../chunk-XZQAMU5W.mjs";import"../../chunk-DAGUHPTV.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-TZRRQMCT.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-MGMCLJQC.mjs";import"../../chunk-QVLV73OB.mjs";import"../../chunk-KJW3XYRT.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-ZIB2TU7B.mjs";import"../../chunk-KDMSOCZY.mjs";var a=class{constructor(n){this.config=n}transaction(n){return o({...n})}transactionAsFeePayer(n){let{signer:r,transaction:t}=n;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=r.accountAddress,o({signer:r,transaction:t})}};export{a as Sign};
1
+ import{Zb as o}from"../../chunk-55Q7BSZT.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-UQZTHVWC.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-4JT5AESZ.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-MSMFHPDT.mjs";import"../../chunk-K43K3YG7.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-HZVN4JSO.mjs";import"../../chunk-3BMZKCLH.mjs";import"../../chunk-V6C6NWFU.mjs";import"../../chunk-PLI53ZU6.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-XYXBAU4J.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-BPWSOC2Y.mjs";import"../../chunk-6JYQ5P36.mjs";import"../../chunk-NF73V673.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-6SLY7UV2.mjs";import"../../chunk-KDMSOCZY.mjs";var a=class{constructor(n){this.config=n}transaction(n){return o({...n})}transactionAsFeePayer(n){let{signer:r,transaction:t}=n;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=r.accountAddress,o({signer:r,transaction:t})}};export{a as Sign};
2
2
  //# sourceMappingURL=sign.mjs.map
@@ -1,2 +1,2 @@
1
- import{Vd as a}from"../../chunk-GXDOOLCG.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-NIXUOEWL.mjs";import"../../chunk-CO67Y6YE.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-RQX6JOEN.mjs";import"../../chunk-CFQFFP6N.mjs";import"../../chunk-UQWF24SS.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-GMEBV7NZ.mjs";import"../../chunk-JEEUU42Q.mjs";import"../../chunk-XZQAMU5W.mjs";import"../../chunk-DAGUHPTV.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-TZRRQMCT.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-MGMCLJQC.mjs";import"../../chunk-QVLV73OB.mjs";import"../../chunk-KJW3XYRT.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-ZIB2TU7B.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Simulate};
1
+ import{Qd as a}from"../../chunk-55Q7BSZT.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-UQZTHVWC.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-4JT5AESZ.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-MSMFHPDT.mjs";import"../../chunk-K43K3YG7.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-HZVN4JSO.mjs";import"../../chunk-3BMZKCLH.mjs";import"../../chunk-V6C6NWFU.mjs";import"../../chunk-PLI53ZU6.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-XYXBAU4J.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-BPWSOC2Y.mjs";import"../../chunk-6JYQ5P36.mjs";import"../../chunk-NF73V673.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-6SLY7UV2.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Simulate};
2
2
  //# sourceMappingURL=simulate.mjs.map
@@ -1,2 +1,2 @@
1
- import{Wd as a}from"../../chunk-GXDOOLCG.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-NIXUOEWL.mjs";import"../../chunk-CO67Y6YE.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-RQX6JOEN.mjs";import"../../chunk-CFQFFP6N.mjs";import"../../chunk-UQWF24SS.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-GMEBV7NZ.mjs";import"../../chunk-JEEUU42Q.mjs";import"../../chunk-XZQAMU5W.mjs";import"../../chunk-DAGUHPTV.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-TZRRQMCT.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-MGMCLJQC.mjs";import"../../chunk-QVLV73OB.mjs";import"../../chunk-KJW3XYRT.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-ZIB2TU7B.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Submit};
1
+ import{Rd as a}from"../../chunk-55Q7BSZT.mjs";import"../../chunk-UYVPNUH3.mjs";import"../../chunk-A5L76YP7.mjs";import"../../chunk-XKUIMGKU.mjs";import"../../chunk-N6YTF76Q.mjs";import"../../chunk-2XQKGWHQ.mjs";import"../../chunk-5HXLZHDW.mjs";import"../../chunk-G3MHXDYA.mjs";import"../../chunk-UQZTHVWC.mjs";import"../../chunk-GOXRBEIJ.mjs";import"../../chunk-XJJVJOX5.mjs";import"../../chunk-4JT5AESZ.mjs";import"../../chunk-NECL5FCQ.mjs";import"../../chunk-4QMXOWHP.mjs";import"../../chunk-EF4FA5I6.mjs";import"../../chunk-MSMFHPDT.mjs";import"../../chunk-K43K3YG7.mjs";import"../../chunk-DPW6ELCQ.mjs";import"../../chunk-ROT6S6BM.mjs";import"../../chunk-WCMW2L3P.mjs";import"../../chunk-WSR5EBJM.mjs";import"../../chunk-C3Q23D22.mjs";import"../../chunk-QREVMGQZ.mjs";import"../../chunk-V3MBJJTL.mjs";import"../../chunk-KJH4KKG6.mjs";import"../../chunk-FGFLPH5K.mjs";import"../../chunk-HZVN4JSO.mjs";import"../../chunk-3BMZKCLH.mjs";import"../../chunk-V6C6NWFU.mjs";import"../../chunk-PLI53ZU6.mjs";import"../../chunk-YOZBVVKL.mjs";import"../../chunk-XYXBAU4J.mjs";import"../../chunk-UL777LTI.mjs";import"../../chunk-7ECCT6PK.mjs";import"../../chunk-BPWSOC2Y.mjs";import"../../chunk-6JYQ5P36.mjs";import"../../chunk-NF73V673.mjs";import"../../chunk-HGLO5LDS.mjs";import"../../chunk-CW35YAMN.mjs";import"../../chunk-6WDVDEQZ.mjs";import"../../chunk-Y7ZQTLH4.mjs";import"../../chunk-4RXKALLC.mjs";import"../../chunk-JCFTAG5Z.mjs";import"../../chunk-7DQDJ2SA.mjs";import"../../chunk-HNBVYE3N.mjs";import"../../chunk-RGKRCZ36.mjs";import"../../chunk-FZY4PMEE.mjs";import"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-TOBQ5UE6.mjs";import"../../chunk-MT2RJ7H3.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-6SLY7UV2.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Submit};
2
2
  //# sourceMappingURL=submit.mjs.map
@@ -1,2 +1,2 @@
1
- import{a}from"../chunk-XZQAMU5W.mjs";import"../chunk-DAGUHPTV.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-TZRRQMCT.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-MGMCLJQC.mjs";import"../chunk-QVLV73OB.mjs";import"../chunk-KJW3XYRT.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-JCFTAG5Z.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-IJE2LVZG.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-ZIB2TU7B.mjs";import"../chunk-KDMSOCZY.mjs";export{a as waitForIndexerOnVersion};
1
+ import{a}from"../chunk-V6C6NWFU.mjs";import"../chunk-PLI53ZU6.mjs";import"../chunk-YOZBVVKL.mjs";import"../chunk-XYXBAU4J.mjs";import"../chunk-UL777LTI.mjs";import"../chunk-7ECCT6PK.mjs";import"../chunk-BPWSOC2Y.mjs";import"../chunk-6JYQ5P36.mjs";import"../chunk-NF73V673.mjs";import"../chunk-HGLO5LDS.mjs";import"../chunk-CW35YAMN.mjs";import"../chunk-6WDVDEQZ.mjs";import"../chunk-4RXKALLC.mjs";import"../chunk-JCFTAG5Z.mjs";import"../chunk-7DQDJ2SA.mjs";import"../chunk-HNBVYE3N.mjs";import"../chunk-RGKRCZ36.mjs";import"../chunk-FZY4PMEE.mjs";import"../chunk-Q4W3WJ2U.mjs";import"../chunk-TOBQ5UE6.mjs";import"../chunk-MT2RJ7H3.mjs";import"../chunk-ORMOQWWH.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-IJE2LVZG.mjs";import"../chunk-FLZPUYXQ.mjs";import"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-6SLY7UV2.mjs";import"../chunk-KDMSOCZY.mjs";export{a as waitForIndexerOnVersion};
2
2
  //# sourceMappingURL=utils.mjs.map
@@ -1,2 +1,2 @@
1
- import"../chunk-FZY4PMEE.mjs";import{a as p,b as q,c as r,d as s}from"../chunk-Q4W3WJ2U.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n,g as o}from"../chunk-ORMOQWWH.mjs";import{a as h}from"../chunk-TOBQ5UE6.mjs";import{a as g}from"../chunk-MT2RJ7H3.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-IJE2LVZG.mjs";import"../chunk-4WPQQPUF.mjs";import{a}from"../chunk-FLZPUYXQ.mjs";import{a as b,b as c,c as d,d as e,e as f}from"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{i as Bool,a as Deserializer,h as EntryFunctionBytes,g as FixedBytes,s as MoveOption,r as MoveString,p as MoveVector,b as Serializable,q as Serialized,c as Serializer,n as U128,k as U16,o as U256,l as U32,m as U64,j as U8,d as ensureBoolean,e as outOfRangeErrorMessage,f as validateNumberInRange};
1
+ import"../chunk-FZY4PMEE.mjs";import{a as p,b as q,c as r,d as s}from"../chunk-Q4W3WJ2U.mjs";import{a as h}from"../chunk-TOBQ5UE6.mjs";import{a as g}from"../chunk-MT2RJ7H3.mjs";import{a as i,b as j,c as k,d as l,e as m,f as n,g as o}from"../chunk-ORMOQWWH.mjs";import"../chunk-FD6FGKYY.mjs";import"../chunk-4WPQQPUF.mjs";import"../chunk-IJE2LVZG.mjs";import{a}from"../chunk-FLZPUYXQ.mjs";import{a as b,b as c,c as d,d as e,e as f}from"../chunk-EBMEXURY.mjs";import"../chunk-STY74NUA.mjs";import"../chunk-IF4UU2MT.mjs";import"../chunk-56CNRT2K.mjs";import"../chunk-KDMSOCZY.mjs";export{i as Bool,a as Deserializer,h as EntryFunctionBytes,g as FixedBytes,s as MoveOption,r as MoveString,p as MoveVector,b as Serializable,q as Serialized,c as Serializer,n as U128,k as U16,o as U256,l as U32,m as U64,j as U8,d as ensureBoolean,e as outOfRangeErrorMessage,f as validateNumberInRange};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d,e,f,g}from"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Bool,f as U128,c as U16,g as U256,d as U32,e as U64,b as U8};
1
+ import{a,b,c,d,e,f,g}from"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{a as Bool,f as U128,c as U16,g as U256,d as U32,e as U64,b as U8};
2
2
  //# sourceMappingURL=movePrimitives.mjs.map
@@ -1,2 +1,2 @@
1
- import{a,b,c,d}from"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{d as MoveOption,c as MoveString,a as MoveVector,b as Serialized};
1
+ import{a,b,c,d}from"../../chunk-Q4W3WJ2U.mjs";import"../../chunk-ORMOQWWH.mjs";import"../../chunk-FD6FGKYY.mjs";import"../../chunk-4WPQQPUF.mjs";import"../../chunk-IJE2LVZG.mjs";import"../../chunk-FLZPUYXQ.mjs";import"../../chunk-EBMEXURY.mjs";import"../../chunk-STY74NUA.mjs";import"../../chunk-IF4UU2MT.mjs";import"../../chunk-56CNRT2K.mjs";import"../../chunk-KDMSOCZY.mjs";export{d as MoveOption,c as MoveString,a as MoveVector,b as Serialized};
2
2
  //# sourceMappingURL=moveStructs.mjs.map
@@ -1,2 +1,2 @@
1
- import{c as s}from"./chunk-TZRRQMCT.mjs";import{y as i,z as m}from"./chunk-UL777LTI.mjs";import{b as n}from"./chunk-QVLV73OB.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
- //# sourceMappingURL=chunk-JEEUU42Q.mjs.map
1
+ import{c as s}from"./chunk-XYXBAU4J.mjs";import{y as i,z as m}from"./chunk-UL777LTI.mjs";import{b as n}from"./chunk-6JYQ5P36.mjs";async function b(t){let{aptosConfig:a,handle:e,data:o,options:r}=t;return(await n({aptosConfig:a,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:r?.ledgerVersion},body:o})).data}async function f(t){let{aptosConfig:a,options:e}=t,o={query:i,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsData"})).table_items}async function T(t){let{aptosConfig:a,options:e}=t,o={query:m,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await s({aptosConfig:a,query:o,originMethod:"getTableItemsMetadata"})).table_metadatas}export{b as a,f as b,T as c};
2
+ //# sourceMappingURL=chunk-3BMZKCLH.mjs.map
@@ -1,2 +1,2 @@
1
- import{a as p}from"./chunk-DPW6ELCQ.mjs";import{e as d,j as S}from"./chunk-C3Q23D22.mjs";import{a as u}from"./chunk-ROT6S6BM.mjs";import{a as f}from"./chunk-WSR5EBJM.mjs";import{a as h}from"./chunk-WCMW2L3P.mjs";import{a as g}from"./chunk-EBMEXURY.mjs";import{b as s}from"./chunk-STY74NUA.mjs";import{sha3_256 as H}from"@noble/hashes/sha3";import{secp256k1 as y}from"@noble/curves/secp256k1";import{HDKey as A}from"@scure/bip32";var i=class i extends f{constructor(e){super();let t=s.fromHexInput(e),{length:r}=t.toUint8Array();if(r===i.LENGTH)this.key=t;else if(r===i.COMPRESSED_LENGTH){let o=y.ProjectivePoint.fromHex(t.toUint8Array());this.key=s.fromHexInput(o.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${i.LENGTH} or ${i.COMPRESSED_LENGTH}, received ${r}`)}verifySignature(e){let{message:t,signature:r}=e,o=p(t),c=s.fromHexInput(o).toUint8Array(),P=H(c),x=r.toUint8Array();return y.verify(x,P,this.key.toUint8Array(),{lowS:!0})}async verifySignatureAsync(e){return this.verifySignature(e)}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new l(t)}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}static isInstance(e){return"key"in e&&e.key?.data?.length===i.LENGTH}};i.LENGTH=65,i.COMPRESSED_LENGTH=33;var m=i,n=class n extends g{constructor(e,t){super();let r=u.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==n.LENGTH)throw new Error(`PrivateKey length should be ${n.LENGTH}`);this.key=r}static generate(){let e=y.utils.randomPrivateKey();return new n(e,!1)}static fromDerivationPath(e,t){if(!d(e))throw new Error(`Invalid derivation path ${e}`);return n.fromDerivationPathInner(e,S(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=A.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new n(r,!1)}sign(e){let t=p(e),r=s.fromHexInput(t),o=H(r.toUint8Array()),c=y.sign(o,this.key.toUint8Array(),{lowS:!0});return new l(c.toCompactRawBytes())}publicKey(){let e=y.getPublicKey(this.key.toUint8Array(),!1);return new m(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.key.toString()}toAIP80String(){return u.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t,!1)}static isPrivateKey(e){return e instanceof n}};n.LENGTH=32;var v=n,a=class a extends h{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.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 a(t)}};a.LENGTH=64;var l=a;export{m as a,v as b,l as c};
2
- //# sourceMappingURL=chunk-CO67Y6YE.mjs.map
1
+ import{a as p}from"./chunk-DPW6ELCQ.mjs";import{a as u}from"./chunk-ROT6S6BM.mjs";import{a as h}from"./chunk-WCMW2L3P.mjs";import{a as f}from"./chunk-WSR5EBJM.mjs";import{e as d,j as S}from"./chunk-C3Q23D22.mjs";import{a as g}from"./chunk-EBMEXURY.mjs";import{b as s}from"./chunk-STY74NUA.mjs";import{sha3_256 as H}from"@noble/hashes/sha3";import{secp256k1 as y}from"@noble/curves/secp256k1";import{HDKey as A}from"@scure/bip32";var i=class i extends f{constructor(e){super();let t=s.fromHexInput(e),{length:r}=t.toUint8Array();if(r===i.LENGTH)this.key=t;else if(r===i.COMPRESSED_LENGTH){let o=y.ProjectivePoint.fromHex(t.toUint8Array());this.key=s.fromHexInput(o.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${i.LENGTH} or ${i.COMPRESSED_LENGTH}, received ${r}`)}verifySignature(e){let{message:t,signature:r}=e,o=p(t),c=s.fromHexInput(o).toUint8Array(),P=H(c),x=r.toUint8Array();return y.verify(x,P,this.key.toUint8Array(),{lowS:!0})}async verifySignatureAsync(e){return this.verifySignature(e)}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}deserialize(e){let t=e.deserializeBytes();return new l(t)}static deserialize(e){let t=e.deserializeBytes();return new i(t)}static isPublicKey(e){return e instanceof i}static isInstance(e){return"key"in e&&e.key?.data?.length===i.LENGTH}};i.LENGTH=65,i.COMPRESSED_LENGTH=33;var m=i,n=class n extends g{constructor(e,t){super();let r=u.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==n.LENGTH)throw new Error(`PrivateKey length should be ${n.LENGTH}`);this.key=r}static generate(){let e=y.utils.randomPrivateKey();return new n(e,!1)}static fromDerivationPath(e,t){if(!d(e))throw new Error(`Invalid derivation path ${e}`);return n.fromDerivationPathInner(e,S(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=A.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new n(r,!1)}sign(e){let t=p(e),r=s.fromHexInput(t),o=H(r.toUint8Array()),c=y.sign(o,this.key.toUint8Array(),{lowS:!0});return new l(c.toCompactRawBytes())}publicKey(){let e=y.getPublicKey(this.key.toUint8Array(),!1);return new m(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.key.toString()}toAIP80String(){return u.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new n(t,!1)}static isPrivateKey(e){return e instanceof n}};n.LENGTH=32;var v=n,a=class a extends h{constructor(e){super();let t=s.fromHexInput(e);if(t.toUint8Array().length!==a.LENGTH)throw new Error(`Signature length should be ${a.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 a(t)}};a.LENGTH=64;var l=a;export{m as a,v as b,l as c};
2
+ //# sourceMappingURL=chunk-4JT5AESZ.mjs.map
@@ -0,0 +1,6 @@
1
+ import{a as Un,b as Pr}from"./chunk-A5L76YP7.mjs";import{a as En}from"./chunk-XKUIMGKU.mjs";import{a as F}from"./chunk-N6YTF76Q.mjs";import{a as vi}from"./chunk-2XQKGWHQ.mjs";import{a as kn,b as Qi}from"./chunk-UQZTHVWC.mjs";import{a as ve,b as Cn,c as vt,d as yr,e as _t}from"./chunk-GOXRBEIJ.mjs";import{a as li}from"./chunk-XJJVJOX5.mjs";import{a as Xe,b as ut,c as tn}from"./chunk-4JT5AESZ.mjs";import{a as gr,b as pi}from"./chunk-EF4FA5I6.mjs";import{a as Et,b as Ye}from"./chunk-MSMFHPDT.mjs";import{b as x,c as $,d as N}from"./chunk-K43K3YG7.mjs";import{a as Ee}from"./chunk-WCMW2L3P.mjs";import{b as Ze}from"./chunk-WSR5EBJM.mjs";import{a as Tr,b as Sr}from"./chunk-QREVMGQZ.mjs";import{a as ge}from"./chunk-FGFLPH5K.mjs";import{a as Kr}from"./chunk-HZVN4JSO.mjs";import{a as Ji}from"./chunk-3BMZKCLH.mjs";import{a as h}from"./chunk-V6C6NWFU.mjs";import{a as Zi,b as Fn,c as Yi,d as Xi,e as eo,g as et,h as to,k as no,l as ro}from"./chunk-PLI53ZU6.mjs";import{a as Ut}from"./chunk-YOZBVVKL.mjs";import{a as _n,b as $i,c as T,e as Wi,f as ji}from"./chunk-XYXBAU4J.mjs";import{A as Li,B as wr,C as qi,d as _i,e as ki,f as Fi,g as Ui,h as Di,j as Ri,k as zi,l as Oi,m as Ni,o as Gi,p as Mi,q as Bi,s as Vi,t as Hi,u as Dt,v as br,w as vn}from"./chunk-UL777LTI.mjs";import{b as ct,d as xi,e as Ar,f as hr}from"./chunk-BPWSOC2Y.mjs";import{b as Ft,d as Ci,e as Ii,f as Ei}from"./chunk-6JYQ5P36.mjs";import{a as Ai}from"./chunk-CW35YAMN.mjs";import{d as w,e as Ki}from"./chunk-6WDVDEQZ.mjs";import{a as io}from"./chunk-Y7ZQTLH4.mjs";import{g as mr}from"./chunk-4RXKALLC.mjs";import{d as gi,e as De,f as yi,g as mi,h as fr,j as fi}from"./chunk-JCFTAG5Z.mjs";import{a as en,b as hi,c as Re,d as bi,e as wi,f as Ti,i as Si,j as Pi,k as ye,l as kt}from"./chunk-7DQDJ2SA.mjs";import{a as In}from"./chunk-HNBVYE3N.mjs";import{b as u}from"./chunk-RGKRCZ36.mjs";import{a as P,b as di,c as k,d as X}from"./chunk-Q4W3WJ2U.mjs";import{a as ci}from"./chunk-TOBQ5UE6.mjs";import{a as Pt}from"./chunk-MT2RJ7H3.mjs";import{a as B,b as Ie,c as Kt,d as xt,e as le,f as Ct,g as It}from"./chunk-ORMOQWWH.mjs";import{J as Y,m as ui}from"./chunk-IJE2LVZG.mjs";import{a as O}from"./chunk-FLZPUYXQ.mjs";import{a as S,b as Z}from"./chunk-EBMEXURY.mjs";import{b,c as ai}from"./chunk-STY74NUA.mjs";import{d as si}from"./chunk-56CNRT2K.mjs";import{a as lr}from"./chunk-KDMSOCZY.mjs";import{jwtDecode as $s}from"jwt-decode";import{sha3_256 as ic}from"@noble/hashes/sha3";import{bn254 as Ce}from"@noble/curves/bn254";import{bytesToNumberBE as oc}from"@noble/curves/abstract/utils";var V=class n extends Ze{constructor(e,t){super(),this.jwkAddress=u.from(e),this.keylessPublicKey=t}authKey(){let e=new Z;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),ge.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){try{return Rn({...e,publicKey:this}),!0}catch{return!1}}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=E.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}async verifySignatureAsync(e){return xr({...e,publicKey:this})}static create(e){return new n(e.jwkAddress,E.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,E.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof u&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof E}};import{encode as sc}from"js-base64";var C=class n extends Ze{constructor(e){if(super(),this.publicKey=e,e instanceof x)this.variant=0;else if(e instanceof Xe)this.variant=1;else if(e instanceof E)this.variant=3;else if(e instanceof V)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;if(this.publicKey instanceof E)throw new Error("Use verifySignatureAsync to verify Keyless signatures");return this.publicKey.verifySignature({message:t,signature:r.signature})}async verifySignatureAsync(e){if(!(e.signature instanceof U)){if(e.options?.throwErrorWithReason)throw new Error("Signature must be an instance of AnySignature");return!1}return await this.publicKey.verifySignatureAsync({...e,signature:e.signature.signature})}authKey(){return ge.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=x.deserialize(e);break;case 1:r=Xe.deserialize(e);break;case 3:r=E.deserialize(e);break;case 4:r=V.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 x}isSecp256k1PublicKey(){return this.publicKey instanceof Xe}static isInstance(e){return"publicKey"in e&&"variant"in e}},U=class n extends Ee{constructor(e){if(super(),this.signature=e,e instanceof N)this.variant=0;else if(e instanceof tn)this.variant=1;else if(e instanceof ee)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),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=N.deserialize(e);break;case 1:r=tn.deserialize(e);break;case 3:r=ee.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${t}`)}return new n(r)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function Ws(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var zn=3,we=class extends Ze{constructor(e){super(),this.publicKeys=e.publicKeys}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),d=i[c];d|=r>>s%8,i[c]=d}),i}getIndex(e){let t=this.publicKeys.findIndex(r=>r.toString()===e.toString());if(t!==-1)return t;throw new Error(`Public key ${e} not found in multi key set ${this.publicKeys}`)}},W=class n extends we{constructor(e){let{publicKeys:t,signaturesRequired:r}=e;if(super({publicKeys:t}),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`);if(this.publicKeys=t.map(i=>i instanceof C?i:new C(i)),r>zn&&this.publicKeys.filter(o=>o.variant===3||o.variant===4).length>zn)throw new Error(`Construction of MultiKey with more than ${zn} keyless public keys is not allowed when signaturesRequired
2
+ is greater than ${zn}. This is because a maximum of 3 keyless signatures are supported for a
3
+ K-of-N MultiKey transaction.`);this.signaturesRequired=r}getSignaturesRequired(){return this.signaturesRequired}verifySignature(e){let{message:t,signature:r}=e;if(r.signatures.length!==this.signaturesRequired)throw new Error("The number of signatures does not match the number of required signatures");let i=r.bitMapToSignerIndices();for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKeys[i[o]].verifySignature({message:t,signature:s}))return!1}return!0}async verifySignatureAsync(e){let{signature:t}=e;try{if(!(t instanceof me))throw new Error("Signature is not a MultiKeySignature");if(t.signatures.length!==this.signaturesRequired)throw new Error("The number of signatures does not match the number of required signatures");let r=t.bitMapToSignerIndices();for(let i=0;i<t.signatures.length;i+=1){let o=t.signatures[i];if(!await this.publicKeys[r[i]].verifySignatureAsync({...e,signature:o}))return!1}return!0}catch(r){if(e.options?.throwErrorWithReason)throw r;return!1}}authKey(){return ge.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(C),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}getIndex(e){let t=e instanceof C?e:new C(e);return super.getIndex(t)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},oe=class oe extends Ee{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>oe.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${oe.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof U?o:new U(o)),!(r instanceof Uint8Array))this.bitmap=oe.createBitmap({bits:r});else{if(r.length!==oe.BITMAP_LEN)throw new Error(`"bitmap" length should be ${oe.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+Ws(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>=oe.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${oe.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}bitMapToSignerIndices(){let e=[];for(let t=0;t<this.bitmap.length;t+=1){let r=this.bitmap[t];for(let i=0;i<8;i+=1)(r&128>>i)!==0&&e.push(t*8+i)}return e}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let t=e.deserializeVector(U),r=e.deserializeBytes();return new oe({signatures:t,bitmap:r})}};oe.BITMAP_LEN=4,oe.MAX_SIGNATURES_SUPPORTED=oe.BITMAP_LEN*8;var me=oe;var se=class se extends we{constructor(e){let{publicKeys:t,threshold:r}=e;if(super({publicKeys:t}),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}getSignaturesRequired(){return this.threshold}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Te))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}async verifySignatureAsync(e){return this.verifySignature(e)}authKey(){return ge.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*x.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*x.LENGTH)}),e[this.publicKeys.length*x.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+=x.LENGTH){let s=o;i.push(new x(t.subarray(s,s+x.LENGTH)))}return new se({publicKeys:i,threshold:r})}static deserializeWithoutLength(e){let t=e.remaining(),r=e.deserializeFixedBytes(t),i=r[r.length-1],o=[];for(let s=0;s<r.length-1;s+=x.LENGTH){let a=s;o.push(new x(r.subarray(a,a+x.LENGTH)))}return new se({publicKeys:o,threshold:i})}getIndex(e){return super.getIndex(e)}};se.MAX_KEYS=32,se.MIN_KEYS=2,se.MIN_THRESHOLD=1;var fe=se,ae=class ae extends Ee{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>ae.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ae.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=ae.createBitmap({bits:r});else{if(r.length!==ae.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ae.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*N.LENGTH+ae.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*N.LENGTH)}),e.set(this.bitmap,this.signatures.length*N.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+=N.LENGTH){let s=o;i.push(new N(t.subarray(s,s+N.LENGTH)))}return new ae({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>=ae.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ae.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),d=i[c];d|=r>>s%8,i[c]=d}),i}};ae.MAX_SIGNATURES_SUPPORTED=32,ae.BITMAP_LEN=4;var Te=ae;var On="Multiple possible deserializations found";function Tu(n){let e=[x,C,fe,W,E,V,Xe],t;for(let r of e)try{let i=O.fromHex(n),o=r.deserialize(i);if(i.assertFinished(),t)throw new Error(`${On}: ${n}`);t=o}catch(i){if(i instanceof Error&&i.message.includes(On))throw i}if(!t)throw new Error(`Failed to deserialize public key: ${n}`);return t}function Su(n){let e=[N,U,Te,me,ee,tn],t;for(let r of e)try{let i=O.fromHex(n),o=r.deserialize(i);if(i.assertFinished(),t)throw new Error(`${On}: ${n}`);t=o}catch(i){if(i instanceof Error&&i.message.includes(On))throw i}if(!t)throw new Error(`Failed to deserialize signature: ${n}`);return t}var L=class extends S{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Se.load(e);case 1:return ze.load(e);case 2:return te.load(e);case 3:return _e.load(e);case 4:return Rt.load(e);case 5:return dt.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof Se}isMultiEd25519(){return this instanceof ze}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof _e}},Se=class n extends L{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=x.deserialize(e),r=N.deserialize(e);return new n(t,r)}},ze=class n extends L{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=fe.deserialize(e),r=Te.deserialize(e);return new n(t,r)}},te=class n extends L{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=C.deserialize(e),r=U.deserialize(e);return new n(t,r)}},_e=class n extends L{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=W.deserialize(e),r=me.deserialize(e);return new n(t,r)}},Rt=class n extends L{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},dt=class n extends L{constructor(e,t,r,i){if(super(),!kt(e))throw new Error(`Invalid function info ${e} passed into AccountAuthenticatorAbstraction`);this.functionInfo=e,this.authenticator=r,this.signingMessageDigest=b.fromHexInput(b.fromHexInput(t).toUint8Array()),this.accountIdentity=i}serialize(e){e.serializeU32AsUleb128(5);let{moduleAddress:t,moduleName:r,functionName:i}=ye(this.functionInfo);u.fromString(t).serialize(e),e.serializeStr(r),e.serializeStr(i),this.accountIdentity?e.serializeU32AsUleb128(1):e.serializeU32AsUleb128(0),e.serializeBytes(this.signingMessageDigest.toUint8Array()),this.accountIdentity?e.serializeBytes(this.authenticator):e.serializeFixedBytes(this.authenticator),this.accountIdentity&&e.serializeBytes(this.accountIdentity)}static load(e){let t=u.deserialize(e),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeUleb128AsU32();if(o===0){let s=e.deserializeBytes(),a=e.deserializeFixedBytes(e.remaining());return new n(`${t}::${r}::${i}`,s,a)}if(o===1){let s=e.deserializeBytes(),a=e.deserializeBytes(),c=e.deserializeBytes();return new n(`${t}::${r}::${i}`,s,a,c)}throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${o}`)}};import{sha3_256 as Qs}from"@noble/hashes/sha3";var nn=class n extends S{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 F(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=u.deserialize(e),r=F.deserialize(e);return new n(t,r)}};var R=class n extends S{deserialize(e){let t=u.deserialize(e),r=F.deserialize(e),i=F.deserialize(e),o=e.deserializeVector(n);return new ke(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return M.load(e);case 1:return ce.load(e);case 2:return q.load(e);case 3:return Ge.load(e);case 4:return D.load(e);case 5:return pt.load(e);case 6:return I.load(e);case 7:return m.load(e);case 8:return Oe.load(e);case 9:return Ne.load(e);case 10:return Me.load(e);case 255:return z.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof M}isAddress(){return this instanceof D}isGeneric(){return this instanceof z}isSigner(){return this instanceof pt}isVector(){return this instanceof I}isStruct(){return this instanceof m}isU8(){return this instanceof ce}isU16(){return this instanceof Oe}isU32(){return this instanceof Ne}isU64(){return this instanceof q}isU128(){return this instanceof Ge}isU256(){return this instanceof Me}isPrimitive(){return this instanceof pt||this instanceof D||this instanceof M||this instanceof ce||this instanceof Oe||this instanceof Ne||this instanceof q||this instanceof Ge||this instanceof Me}},M=class n extends R{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ce=class n extends R{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},Oe=class n extends R{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},Ne=class n extends R{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},q=class n extends R{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Ge=class n extends R{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},Me=class n extends R{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},D=class n extends R{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},pt=class n extends R{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},Nn=class n extends R{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=R.deserialize(t);return new n(r)}},z=class n extends R{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)}},I=class n extends R{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ce)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=R.deserialize(t);return new n(r)}},m=class n extends R{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=ke.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")}isDelegationKey(){return this.isTypeTag(u.ONE,"permissioned_delegation","DelegationKey")}isRateLimiter(){return this.isTypeTag(u.ONE,"rate_limiter","RateLimiter")}},ke=class n extends S{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=F.deserialize(e),i=F.deserialize(e),o=e.deserializeVector(R);return new n(t,r,i,o)}};function yd(){return new ke(u.ONE,new F("aptos_coin"),new F("AptosCoin"),[])}function K(){return new ke(u.ONE,new F("string"),new F("String"),[])}function md(n){return new ke(u.ONE,new F("option"),new F("Option"),[n])}function ue(n){return new ke(u.ONE,new F("object"),new F("Object"),[n])}function js(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return Ie.deserialize(n);case 1:return le.deserialize(n);case 2:return Ct.deserialize(n);case 3:return u.deserialize(n);case 4:return P.deserialize(n,Ie);case 5:return B.deserialize(n);case 6:return Kt.deserialize(n);case 7:return xt.deserialize(n);case 8:return It.deserialize(n);case 9:return di.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var tt=class extends S{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return zt.load(e);case 2:return Ot.load(e);case 3:return Nt.load(e);case 4:return Gn.deserialize(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},zt=class n extends tt{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Gt.deserialize(e);return new n(t)}},Ot=class n extends tt{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=Be.deserialize(e);return new n(t)}},Nt=class n extends tt{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=rn.deserialize(e);return new n(t)}},Be=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(nn.fromStr(e),new F(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=nn.deserialize(e),r=F.deserialize(e),i=e.deserializeVector(R),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),d=ci.deserialize(e,c);s.push(d)}return new n(t,r,i,s)}},Gt=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(R),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=js(e);o.push(a)}return new n(t,r,o)}},rn=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=on.deserialize(e)),new n(t,i)}},on=class n extends S{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(Be.deserialize(e))}},Gn=class extends tt{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return lt.load(e);default:throw new Error(`Unknown variant index for TransactionInnerPayload: ${t}`)}}},lt=class n extends Gn{constructor(e,t){super(),this.executable=e,this.extra_config=t}serialize(e){e.serializeU32AsUleb128(4),e.serializeU32AsUleb128(0),this.executable.serialize(e),this.extra_config.serialize(e)}static load(e){let t=Mt.deserialize(e),r=Mn.deserialize(e);return new n(t,r)}},Mt=class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return sn.load(e);case 1:return Bt.load(e);case 2:return an.load(e);default:throw new Error(`Unknown variant index for TransactionExecutable: ${t}`)}}},sn=class n extends Mt{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=Gt.deserialize(e);return new n(t)}},Bt=class n extends Mt{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(1),this.entryFunction.serialize(e)}static load(e){let t=Be.deserialize(e);return new n(t)}},an=class n extends Mt{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Mn=class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return gt.load(e);default:throw new Error(`Unknown variant index for TransactionExtraConfig: ${t}`)}}},gt=class n extends Mn{constructor(e,t){super(),this.multisigAddress=e,this.replayProtectionNonce=t!==void 0?BigInt(t):void 0}serialize(e){e.serializeU32AsUleb128(0),e.serializeOption(this.multisigAddress),e.serializeOption(this.replayProtectionNonce!==void 0?new le(this.replayProtectionNonce):void 0)}static load(e){let t=e.deserializeOption(u),r=e.deserializeOption(le);return new n(t,r?.value)}};var Ae=class n extends S{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=tt.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=En.deserialize(e);return new n(t,r,i,o,s,a,c)}},Bn=class extends S{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return yt.load(e);case 1:return mt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},yt=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=Ae.deserialize(e),r=e.deserializeVector(u);return new n(t,r)}},mt=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=Ae.deserialize(e),r=e.deserializeVector(u),i=u.deserialize(e);return new n(t,r,i)}};var Ve=class extends S{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return ft.load(e);case 1:return Vt.load(e);case 2:return At.load(e);case 3:return ht.load(e);case 4:return nt.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof ft}isMultiEd25519(){return this instanceof Vt}isMultiAgent(){return this instanceof At}isFeePayer(){return this instanceof ht}isSingleSender(){return this instanceof nt}},ft=class n extends Ve{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=x.deserialize(e),r=N.deserialize(e);return new n(t,r)}},Vt=class n extends Ve{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=fe.deserialize(e),r=Te.deserialize(e);return new n(t,r)}},At=class n extends Ve{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=L.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(L);return new n(t,r,i)}},ht=class n extends Ve{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=L.deserialize(e),r=e.deserializeVector(u),i=e.deserializeVector(L),o=u.deserialize(e),s=L.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},nt=class n extends Ve{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=L.deserialize(e);return new n(t)}};var He=class n extends S{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=Ae.deserialize(e),r=Ve.deserialize(e);return new n(t,r)}};var Vn=class n extends S{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=Ae.deserialize(e),r=e.deserializeBool(),i;return r&&(i=u.deserialize(e)),new n(t,i)}};var Hn=class n extends S{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=Ae.deserialize(e),r=e.deserializeVector(u),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(t,r,o)}};function Ln(n){return n.feePayerAddress?new mt(n.rawTransaction,n.secondarySignerAddresses??[],n.feePayerAddress):n.secondarySignerAddresses?new yt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function rt(n,e){let t=Qs.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 vp(n){return rt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Pe(n){let e=Ln(n);return n.feePayerAddress?rt(e.bcsToBytes(),fr):n.secondarySignerAddresses?rt(e.bcsToBytes(),fr):rt(e.bcsToBytes(),mi)}var Q=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)}async verifySignatureAsync(e){return this.publicKey.verifySignatureAsync({...e,signature:e.signature})}signWithAuthenticator(e){return new Se(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new Se(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Pe(e))}};function Cr(n){return typeof n=="object"&&n!==null&&"getAnyPublicKey"in n&&typeof n.getAnyPublicKey=="function"}var ne=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new C(t.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=$.generate();break;case 2:r=ut.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=ut.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return this.publicKey.verifySignatureAsync({...e,signature:e.signature})}signWithAuthenticator(e){return new te(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new te(this.publicKey,this.signTransaction(e))}sign(e){return new U(this.privateKey.sign(e))}signTransaction(e){return this.sign(Pe(e))}static fromEd25519Account(e){return new n({privateKey:e.privateKey,address:e.accountAddress})}};var Le=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?Q.generate():ne.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof $&&i?new Q({privateKey:t,address:r}):new ne({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?Q.fromDerivationPath({mnemonic:r,path:i}):ne.fromDerivationPath({scheme:t,mnemonic:r,path:i})}static authKey(e){let{publicKey:t}=e;return t.authKey()}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return this.publicKey.verifySignatureAsync(e)}};import{randomBytes as Zs}from"@noble/hashes/utils";var Ys=1209600,Ht=class Ht extends S{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new Et(t.publicKey()),this.expiryDateSecs=r||bi(Re()+Ys),this.blinder=i!==void 0?b.fromHexInput(i).toUint8Array():Xs();let o=Cn(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(vt(this.blinder));let s=_t(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 Ht({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return Ht.deserialize(new O(e))}static generate(e){let t;switch(e?.scheme){case 0:default:t=$.generate()}return new Ht({privateKey:t,expiryDateSecs:e?.expiryDateSecs})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Ye(this.privateKey.sign(e))}};Ht.BLINDER_LENGTH=31;var bt=Ht;function Xs(){return Zs(bt.BLINDER_LENGTH)}import ta from"eventemitter3";import{jwtDecode as na}from"jwt-decode";function $n(n){return n!=null&&typeof n.checkKeylessAccountValidity=="function"}var Lt=class Lt extends S{constructor(t){super();this.signingScheme=2;let{address:r,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:d,proof:l,proofFetchCallback:g,jwt:p,verificationKeyHash:y}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=p,this.emitter=new ta,this.proofOrPromise=l,l instanceof de)this.proof=l;else{if(g===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async _=>{await g(_),this.emitter.removeAllListeners()}),this.init(l)}let A=b.fromHexInput(d).toUint8Array();if(A.length!==Lt.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${Lt.PEPPER_LENGTH}`);if(this.pepper=A,y!==void 0){if(b.hexInputToUint8Array(y).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=b.hexInputToUint8Array(y)}}getAnyPublicKey(){return new C(this.publicKey)}async init(t){try{this.proof=await t,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(t){if(this.accountAddress.serialize(t),t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Cannot serialize - proof undefined");this.proof.serialize(t),t.serializeOption(this.verificationKeyHash,32)}static partialDeserialize(t){let r=u.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=bt.deserialize(t),c=de.deserialize(t),d=t.deserializeOption("fixedBytes",32);return{address:r,jwt:i,uidKey:o,pepper:s,ephemeralKeyPair:a,proof:c,verificationKeyHash:d}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(t){let r=new U(this.sign(t)),i=new C(this.publicKey);return new te(i,r)}signTransactionWithAuthenticator(t){let r=new U(this.signTransaction(t)),i=new C(this.publicKey);return new te(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw w.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw w.fromErrorType({type:2});let r=na(this.jwt,{header:!0});if(r.kid===void 0)throw w.fromErrorType({type:12,details:"checkKeylessAccountValidity failed. JWT is missing 'kid' in header. This should never happen."});if(this.verificationKeyHash!==void 0){let{verificationKey:i}=await $t({aptosConfig:t});if(b.hexInputToString(i.hash())!==b.hexInputToString(this.verificationKeyHash))throw w.fromErrorType({type:4})}else console.warn("[Aptos SDK] The verification key hash was not set. Proof may be invalid if the verification key has rotated.");await Lt.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:r.kid})}sign(t){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw w.fromErrorType({type:0});if(this.proof===void 0)throw w.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(t);return new ee({jwtHeader:wi(this.jwt.split(".")[0]),ephemeralCertificate:new qt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw w.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=Ln(t),o=new qn(r,this.proof.proof).hash();return this.sign(o)}getSigningMessage(t){if(this.proof===void 0)throw w.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=Ln(t);return new qn(r,this.proof.proof).hash()}verifySignature(t){return this.publicKey.verifySignature(t)}async verifySignatureAsync(t){return this.publicKey.verifySignatureAsync({...t})}static async fetchJWK(t){return Ir(t)}};Lt.PEPPER_LENGTH=31;var pe=Lt,qn=class extends S{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 rt(this.bcsToBytes(),this.domainSeparator)}};var he=class n extends pe{constructor(e){let t=E.create(e);super({publicKey:t,...e}),this.publicKey=t}serialize(e){super.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=pe.partialDeserialize(e),{iss:d,aud:l,uidVal:g}=qe({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:d,uidKey:s,uidVal:g,aud:l,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return n.deserialize(new O(b.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:d,verificationKeyHash:l}=e;if(l&&d)throw new Error("Cannot provide both verificationKey and verificationKeyHash");let{iss:g,aud:p,uidVal:y}=qe({jwt:i,uidKey:a});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:g,uidKey:a,uidVal:y,aud:p,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:l??(d?d.hash():void 0)})}};var Ke=class n extends pe{constructor(e){let t=V.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=e.audless??!1}serialize(e){super.serialize(e),this.publicKey.jwkAddress.serialize(e)}static deserialize(e){let{address:t,proof:r,ephemeralKeyPair:i,jwt:o,uidKey:s,pepper:a,verificationKeyHash:c}=pe.partialDeserialize(e),d=u.deserialize(e),{iss:l,aud:g,uidVal:p}=qe({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:l,uidKey:s,uidVal:p,aud:g,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:d})}static fromBytes(e){return n.deserialize(O.fromHex(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:d,verificationKey:l,verificationKeyHash:g}=e;if(g&&l)throw new Error("Cannot provide both verificationKey and verificationKeyHash");let{iss:p,aud:y,uidVal:A}=qe({jwt:i,uidKey:c});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:p,uidKey:c,uidVal:A,aud:y,pepper:s,jwkAddress:u.from(a),jwt:i,proofFetchCallback:d,verificationKeyHash:g??(l?l.hash():void 0)})}};var $e=class n{constructor(e){this.signingScheme=3;let{multiKey:t,address:r}=e,i=e.signers.map(a=>a instanceof Q?ne.fromEd25519Account(a):a);if(t.signaturesRequired>i.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${t.signaturesRequired} signers, but only ${i.length} provided`);if(t.signaturesRequired<i.length)throw new Error(`More signers provided than required. Need ${t.signaturesRequired} signers, but ${i.length} provided`);this.publicKey=t,this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress();let o=[];for(let a of i)o.push(this.publicKey.getIndex(a.getAnyPublicKey()));let s=i.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(e){let{address:t,publicKeys:r,signaturesRequired:i,signers:o}=e,s=new W({publicKeys:r,signaturesRequired:i});return new n({multiKey:s,signers:o,address:t})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new _e(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new _e(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof pe).map(async r=>r.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let r=this.signers.filter(i=>i instanceof pe).map(i=>i.checkKeylessAccountValidity(e));await Promise.all(r)}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new me({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new me({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return await this.publicKey.verifySignatureAsync(e)}};var Wt=class{constructor(e){this.signingScheme=1;let{signers:t,publicKey:r,address:i}=e;if(this.publicKey=r,this.accountAddress=i?u.from(i):this.publicKey.authKey().derivedAddress(),r.threshold>t.length)throw new Error(`Not enough signers provided to satisfy the required signatures. Need ${r.threshold} signers, but only ${t.length} provided`);if(r.threshold<t.length)throw new Error(`More signers provided than required. Need ${r.threshold} signers, but ${t.length} provided`);let o=[];for(let a of t)o.push(this.publicKey.getIndex(a.publicKey()));let s=t.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndices=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return this.publicKey.verifySignatureAsync({...e,signature:e.signature})}signWithAuthenticator(e){return new ze(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ze(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Te({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){return this.sign(Pe(e))}};function so(n){let e=n.deserializeUleb128AsU32();if(!Object.values(Y).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:u.deserialize(n),signingScheme:e}}function ao(n,e){if(e.serializeStr(n.jwt),e.serializeStr(n.uidKey),e.serializeFixedBytes(n.pepper),n.ephemeralKeyPair.serialize(e),n.proof===void 0)throw new Error("Cannot serialize - proof undefined");n.proof.serialize(e),e.serializeOption(n.verificationKeyHash,32)}function co(n){let e=n.deserializeStr(),t=n.deserializeStr(),r=n.deserializeFixedBytes(31),i=bt.deserialize(n),o=de.deserialize(n),s=n.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:r,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var uo;(g=>{function n(p){let y=new Z;switch(y.serializeU32AsUleb128(p.signingScheme),p.accountAddress.serialize(y),p.signingScheme){case 0:return p.privateKey.serialize(y),y.toUint8Array();case 2:{if(!Cr(p))throw new Error("Account is not a SingleKeySigner");let A=p.getAnyPublicKey();switch(y.serializeU32AsUleb128(A.variant),A.variant){case 3:return ao(p,y),y.toUint8Array();case 4:{let _=p;return ao(_,y),_.publicKey.jwkAddress.serialize(y),y.serializeBool(_.audless),y.toUint8Array()}case 1:case 0:return p.privateKey.serialize(y),y.toUint8Array();default:throw new Error(`Invalid public key variant: ${A.variant}`)}}case 3:{let A=p;return A.publicKey.serialize(y),y.serializeU32AsUleb128(A.signers.length),A.signers.forEach(_=>{y.serializeFixedBytes(n(_))}),y.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${p.signingScheme}`)}}g.toBytes=n;function e(p){return b.hexInputToStringWithoutPrefix(n(p))}g.toHexStringWithoutPrefix=e;function t(p){return b.hexInputToString(n(p))}g.toHexString=t;function r(p){let{address:y,signingScheme:A}=so(p);switch(A){case 0:{let _=$.deserialize(p);return new Q({privateKey:_,address:y})}case 2:{let _=p.deserializeUleb128AsU32();switch(_){case 0:{let G=$.deserialize(p);return new ne({privateKey:G,address:y})}case 1:{let G=ut.deserialize(p);return new ne({privateKey:G,address:y})}case 3:{let G=co(p),J=qe(G);return new he({...G,...J})}case 4:{let G=co(p),J=u.deserialize(p),Ue=p.deserializeBool(),Je=qe(G);return new Ke({...G,...Je,jwkAddress:J,audless:Ue})}default:throw new Error(`Unsupported public key variant ${_}`)}}case 3:{let _=W.deserialize(p),G=p.deserializeUleb128AsU32(),J=new Array;for(let Ue=0;Ue<G;Ue+=1){let Je=r(p);if(!Cr(Je)&&!(Je instanceof Q))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");J.push(Je)}return new $e({multiKey:_,signers:J,address:y})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${A}`)}}g.deserialize=r;function i(p){let y=d(p);if(!(y instanceof he))throw new Error("Deserialization of KeylessAccount failed");return y}g.keylessAccountFromHex=i;function o(p){let y=d(p);if(!(y instanceof Ke))throw new Error("Deserialization of FederatedKeylessAccount failed");return y}g.federatedKeylessAccountFromHex=o;function s(p){let y=d(p);if(!(y instanceof $e))throw new Error("Deserialization of MultiKeyAccount failed");return y}g.multiKeyAccountFromHex=s;function a(p){let y=d(p);if(!(y instanceof ne))throw new Error("Deserialization of SingleKeyAccount failed");return y}g.singleKeyAccountFromHex=a;function c(p){let y=d(p);if(!(y instanceof Q))throw new Error("Deserialization of Ed25519Account failed");return y}g.ed25519AccountFromHex=c;function d(p){return r(O.fromHex(p))}g.fromHex=d;function l(p){return d(p)}g.fromBytes=l})(uo||(uo={}));import{sha3_256 as po}from"@noble/hashes/sha3";var Wn=class n extends Le{constructor({signer:t,accountAddress:r,authenticationFunction:i}){super();this.signingScheme=2;if(!kt(i))throw new Error(`Invalid authentication function ${i} passed into AbstractedAccount`);this.authenticationFunction=i,this.accountAddress=r,this.publicKey=new pi(this.accountAddress),this.sign=o=>new gr(t(o))}static fromPermissionedSigner({signer:t,accountAddress:r}){return new n({signer:i=>{let o=new Z;return t.publicKey.serialize(o),t.sign(i).serialize(o),o.toUint8Array()},accountAddress:r??t.accountAddress,authenticationFunction:"0x1::permissioned_delegation::authenticate"})}signWithAuthenticator(t){return new dt(this.authenticationFunction,po(t),this.sign(po(t)).toUint8Array())}signTransactionWithAuthenticator(t){return this.signWithAuthenticator(Pe(t))}signTransaction(t){return this.sign(Pe(t))}setSigner(t){this.sign=r=>new gr(t(r))}};import{sha3_256 as Er}from"@noble/hashes/sha3";var cn=class cn extends Wn{constructor({signer:e,authenticationFunction:t,abstractPublicKey:r}){let i=new u(cn.computeAccountAddress(t,r));super({accountAddress:i,signer:e,authenticationFunction:t}),this.abstractPublicKey=r}static computeAccountAddress(e,t){if(!kt(e))throw new Error(`Invalid authentication function ${e} passed into DerivableAbstractedAccount`);let[r,i,o]=e.split("::"),s=Er.create(),a=new Z;u.fromString(r).serialize(a),a.serializeStr(i),a.serializeStr(o),s.update(a.toUint8Array());let c=new Z;return c.serializeBytes(t),s.update(c.toUint8Array()),s.update(new Uint8Array([cn.ADDRESS_DOMAIN_SEPERATOR])),s.digest()}signWithAuthenticator(e){return new dt(this.authenticationFunction,Er(e),this.sign(Er(e)).value,this.abstractPublicKey)}};cn.ADDRESS_DOMAIN_SEPERATOR=5;var lo=cn;import{sha3_256 as ga}from"@noble/hashes/sha3";function go(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function yo(n){return!!n.match(/\s/)}function ra(n){return!!n.match(/^T[0-9]+$/)}function ia(n){return!!n.match(/^&.+$/)}function oa(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 sa(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!yo(r))break}return t}var aa=(A=>(A.InvalidTypeTag="unknown type",A.UnexpectedGenericType="unexpected generic type",A.UnexpectedTypeArgumentClose="unexpected '>'",A.UnexpectedWhitespaceCharacter="unexpected whitespace character",A.UnexpectedComma="unexpected ','",A.TypeArgumentCountMismatch="type argument count doesn't match expected amount",A.MissingTypeArgumentClose="no matching '>' for '<'",A.MissingTypeArgument="no type argument before ','",A.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",A.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",A.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",A.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",A.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",A.InvalidAddress="struct address must be valid",A))(aa||{}),H=class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function xe(n,e){let t=e?.allowGenerics??!1,r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(d===">"){if(a!==""){let A=un(a,i,t);o.push(A)}let l=r.pop();if(l===void 0)throw new H(n,"unexpected '>'");if(c!==o.length)throw new H(n,"type argument count doesn't match expected amount");let{savedStr:g,savedTypes:p,savedExpectedTypes:y}=l;i=o,o=p,a=g,c=y}else if(d===","){if(r.length===0)throw new H(n,"unexpected ','");if(a.length===0)throw new H(n,"no type argument before ','");let l=un(a,i,t);i=[],o.push(l),a="",c+=1}else if(yo(d)){let l=!1;if(a.length!==0){let p=un(a,i,t);i=[],o.push(p),a="",l=!0}s=sa(n,s);let g=n[s];if(s<n.length&&l&&g!==","&&g!==">")throw new H(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new H(n,"no matching '>' for '<'");switch(o.length){case 0:return un(a,i,t);case 1:if(a==="")return o[0];throw new H(n,"unexpected ','");default:throw new H(n,"unexpected whitespace character")}}function un(n,e,t){let r=n.trim(),i=r.toLowerCase();if(oa(i)&&e.length>0)throw new H(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new pt;case"bool":return new M;case"address":return new D;case"u8":return new ce;case"u16":return new Oe;case"u32":return new Ne;case"u64":return new q;case"u128":return new Ge;case"u256":return new Me;case"vector":if(e.length!==1)throw new H(n,"vector type expected to have exactly one type argument");return new I(e[0]);default:if(ia(r)){let a=r.substring(1);return new Nn(un(a,e,t))}if(ra(r)){if(t)return new z(Number(r.split("T")[1]));throw new H(n,"unexpected generic type")}if(!r.match(/:/))throw new H(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new H(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch{throw new H(n,"struct address must be valid")}if(!go(o[1]))throw new H(n,"module name must only contain alphanumeric or '_' characters");if(!go(o[2]))throw new H(n,"struct name must only contain alphanumeric or '_' characters");return new m(new ke(s,new F(o[1]),new F(o[2]),e))}}function mo(n){return typeof n=="boolean"}function We(n){return typeof n=="string"}function ca(n){return typeof n=="number"}function jn(n){if(ca(n))return n;if(We(n)&&n!=="")return Number.parseInt(n,10)}function Qn(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function fo(n){return n==null}function Ao(n){return vr(n)||kr(n)||Fr(n)||Ur(n)||Dr(n)||Rr(n)||zr(n)||Jn(n)||_r(n)||ua(n)||n instanceof P||n instanceof X}function vr(n){return n instanceof B}function Jn(n){return n instanceof u}function _r(n){return n instanceof k}function ua(n){return n instanceof Pt}function kr(n){return n instanceof Ie}function Fr(n){return n instanceof Kt}function Ur(n){return n instanceof xt}function Dr(n){return n instanceof le}function Rr(n){return n instanceof Ct}function zr(n){return n instanceof It}function ho(n){return"bytecode"in n}function v(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function bo(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}var da=new TextEncoder;function Zn(n){return n?.map(e=>We(e)?xe(e):e)??[]}async function pa(n,e,t){return(await Yn({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function Nr(n,e,t,r){let i=await pa(n,e,r);if(!i)throw new Error(`Could not find module ABI for '${n}::${e}'`);return i.exposed_functions.find(o=>o.name===t)}async function zy(n,e,t,r){let i=await Nr(n,e,t,r);if(!i)throw new Error(`Could not find function ABI for '${n}::${e}::${t}'`);let o=[];for(let s=0;s<i.params.length;s+=1)o.push(xe(i.params[s],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o}}async function wo(n,e,t,r){let i=await Nr(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=bo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(xe(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function To(n,e,t,r){let i=await Nr(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(xe(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(xe(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Gr(n,e,t,r,i,o){let s;if("exposed_functions"in e){let a=e.exposed_functions.find(c=>c.name===n);if(!a)throw new Error(`Could not find function ABI for '${e.address}::${e.name}::${n}'`);if(r>=a.params.length)throw new Error(`Too many arguments for '${n}', expected ${a.params.length}`);s=xe(a.params[r],{allowGenerics:!0})}else{if(r>=e.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${e.parameters.length}`);s=e.parameters[r]}return wt(t,s,r,i,"exposed_functions"in e?e:void 0,o)}function wt(n,e,t,r,i,o){return Ao(n)?(Or(e,n,t),n):la(n,e,t,r,i,o)}function la(n,e,t,r,i,o){if(e.isBool()){if(mo(n))return new B(n);if(We(n)){if(n==="true")return new B(!0);if(n==="false")return new B(!1)}v("boolean",t)}if(e.isAddress()){if(We(n))return u.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new u(n.data);v("string | AccountAddress",t)}if(e.isU8()){let s=jn(n);if(s!==void 0)return new Ie(s);v("number | string",t)}if(e.isU16()){let s=jn(n);if(s!==void 0)return new Kt(s);v("number | string",t)}if(e.isU32()){let s=jn(n);if(s!==void 0)return new xt(s);v("number | string",t)}if(e.isU64()){if(Qn(n))return new le(BigInt(n));v("bigint | number | string",t)}if(e.isU128()){if(Qn(n))return new Ct(BigInt(n));v("bigint | number | string",t)}if(e.isU256()){if(Qn(n))return new It(BigInt(n));v("bigint | number | string",t)}if(e.isGeneric()){let s=e.value;if(s<0||s>=r.length)throw new Error(`Generic argument ${e.toString()} is invalid for argument ${t}`);return wt(n,r[s],t,r,i)}if(e.isVector()){if(e.value.isU8()){if(We(n))return P.U8(da.encode(n));if(n instanceof Uint8Array)return P.U8(n);if(n instanceof ArrayBuffer)return P.U8(new Uint8Array(n))}if(We(n)&&n.startsWith("["))return wt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new P(n.map(s=>wt(s,e.value,t,r,i)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(We(n))return new k(n);v("string",t)}if(e.isObject()){if(We(n))return u.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new u(n.data);v("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new Pt(n);v("Uint8Array",t)}if(e.isOption()){if(fo(n)){let a=e.value.typeArgs[0];return a instanceof M?new X(null):a instanceof D?new X(null):a instanceof ce?new X(null):a instanceof Oe?new X(null):a instanceof Ne?new X(null):a instanceof q?new X(null):a instanceof Ge?new X(null):a instanceof Me?new X(null):new X(null)}return new X(wt(n,e.value.typeArgs[0],t,r,i))}if(i?.structs.find(a=>a.name===e.value.name.identifier)?.fields.length===0&&n instanceof Uint8Array)return new Pt(n);if(n instanceof Uint8Array&&o?.allowUnknownStructs)return console.warn(`Unsupported struct input type for argument ${t}. Continuing since 'allowUnknownStructs' is enabled.`),new Pt(n);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 Or(n,e,t){if(n.isBool()){if(vr(e))return;v("Bool",t)}if(n.isAddress()){if(Jn(e))return;v("AccountAddress",t)}if(n.isU8()){if(kr(e))return;v("U8",t)}if(n.isU16()){if(Fr(e))return;v("U16",t)}if(n.isU32()){if(Ur(e))return;v("U32",t)}if(n.isU64()){if(Dr(e))return;v("U64",t)}if(n.isU128()){if(Rr(e))return;v("U128",t)}if(n.isU256()){if(zr(e))return;v("U256",t)}if(n.isVector()){if(e instanceof P){e.values.length>0&&Or(n.value,e.values[0],t);return}v("MoveVector",t)}if(n instanceof m){if(n.isString()){if(_r(e))return;v("MoveString",t)}if(n.isObject()){if(Jn(e))return;v("AccountAddress",t)}if(n.isOption()){if(e instanceof X){e.value!==void 0&&Or(n.value.typeArgs[0],e.value,t);return}v("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function Xn(n){if(ho(n))return fa(n);let{moduleAddress:e,moduleName:t,functionName:r}=ye(n.function),i=await xo({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:wo});return ya({...n,abi:i})}function ya(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=ye(n.function),o=Zn(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,d)=>Gr(n.function,e,c,d,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=Be.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new Nt(new rn(c,new on(a)))}return new Ot(a)}async function So(n){let{moduleAddress:e,moduleName:t,functionName:r}=ye(n.function),i=await xo({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:To});return ma({abi:i,...n})}function ma(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=ye(n.function),o=Zn(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((a,c)=>Gr(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 Be.build(`${t}::${r}`,i,o,s)}function fa(n){return new zt(new Gt(b.fromHexInput(n.bytecode).toUint8Array(),Zn(n.typeArguments),n.functionArguments))}async function Aa(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n;if(i?.replayProtectionNonce!==void 0&&i?.accountSequenceNumber!==void 0)throw new Error("Cannot specify both replayProtectionNonce and accountSequenceNumber in options.");let s=async()=>mr[e.network]?{chainId:mr[e.network]}:{chainId:(await _n({aptosConfig:e})).chain_id},a=async()=>i?.gasUnitPrice?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Fn({aptosConfig:e})).gas_estimate},c=async()=>{let J=async()=>i?.accountSequenceNumber!==void 0?i.accountSequenceNumber:i?.replayProtectionNonce!==void 0?0xdeadbeefn:(await kn({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await J()}catch{return 0}else return J()},[{chainId:d},{gasEstimate:l},g]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:y,expireTimestamp:A,replayProtectionNonce:_}={maxGasAmount:i?.maxGasAmount?BigInt(i.maxGasAmount):BigInt(e.getDefaultMaxGasAmount()),gasUnitPrice:i?.gasUnitPrice??BigInt(l),expireTimestamp:i?.expireTimestamp??BigInt(Math.floor(Date.now()/1e3)+e.getDefaultTxnExpirySecFromNow()),replayProtectionNonce:i?.replayProtectionNonce?BigInt(i.replayProtectionNonce):void 0},G=r;return _!==void 0&&(G=ha(r,_)),new Ae(u.from(t),BigInt(g),G,BigInt(p),BigInt(y),BigInt(A),new En(d))}function ha(n,e){if(n instanceof zt)return new lt(new sn(n.script),new gt(void 0,e));if(n instanceof Ot)return new lt(new Bt(n.entryFunction),new gt(void 0,e));if(n instanceof Nt){let t=n.multiSig.transaction_payload,r;if(t===void 0||t?.transaction_payload===void 0)r=new an;else if(t.transaction_payload instanceof Be)r=new Bt(t.transaction_payload);else throw new Error("Scripts are not supported in multi-sig transactions.");return new lt(r,new gt(n.multiSig.multisig_address,e))}else throw new Error(`Unsupported payload type: ${n}`)}async function Mr(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Aa({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=n.secondarySignerAddresses?.map(c=>u.from(c))??[];return new Hn(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new Vn(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function Po(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=jt(e);if(t.feePayerAddress){let a=new mt(t.rawTransaction,t.secondarySignerAddresses??[],t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(g=>jt(g)):c=Array.from({length:t.secondarySignerAddresses.length},()=>jt(void 0)));let d=jt(i),l=new ht(o,t.secondarySignerAddresses??[],c,{address:t.feePayerAddress,authenticator:d});return new He(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new yt(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(l=>jt(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>jt(void 0));let d=new At(o,t.secondarySignerAddresses,c);return new He(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof Se)s=new ft(o.public_key,o.signature);else if(o instanceof te||o instanceof _e)s=new nt(o);else if(o instanceof Rt)s=new nt(o);else throw new Error("Invalid public key");return new He(t.rawTransaction,s).bcsToBytes()}function jt(n){if(!n)return new Rt;let t=E.isInstance(n)||V.isInstance(n)||Xe.isInstance(n)?new C(n):n,r=new N(new Uint8Array(64));if(x.isInstance(t))return new Se(t,r);if(C.isInstance(t))return E.isInstance(t.publicKey)?new te(t,new U(ee.getSimulationSignature())):new te(t,new U(r));if(W.isInstance(t))return new _e(t,new me({signatures:t.publicKeys.map(i=>E.isInstance(i.publicKey)||V.isInstance(i.publicKey)?new U(ee.getSimulationSignature()):new U(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function Br(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Ai(L,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 ht(i,e.secondarySignerAddresses??[],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 At(i,e.secondarySignerAddresses,r)}else i instanceof Se?o=new ft(i.public_key,i.signature):i instanceof ze?o=new Vt(i.public_key,i.signature):o=new nt(i);return new He(e.rawTransaction,o).bcsToBytes()}function Ko(n){let e=ga.create();for(let t of n)e.update(t);return e.digest()}var ba=Ko(["APTOS::Transaction"]);function um(n){let e=Br(n);return new b(Ko([ba,new Uint8Array([0]),e])).toString()}async function xo({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Ut(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function f(n){let e=await Ta(n);return Sa(n,e)}async function Ta(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await Xn(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Xn(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Xn(r)),i}async function Sa(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(Pa(n)&&(o=u.ZERO.toString()),Ka(n)){let{secondarySignerAddresses:s}=n;return Mr({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return Mr({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function Pa(n){return n.withFeePayer===!0}function Ka(n){return"secondarySignerAddresses"in n}function Co(n){let{transaction:e}=n;return Pe(e)}function er(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function tr(n){let{signer:e,transaction:t}=n;if(!t.feePayerAddress)throw new Error(`Transaction ${t} is not a Fee Payer transaction`);return t.feePayerAddress=e.accountAddress,er({signer:e,transaction:t})}async function Vr(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Po({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Ft({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:n.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:n.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:n.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function dn(n){let{aptosConfig:e,transactionSubmitter:t}=n,r=t===void 0?e.getTransactionSubmitter():t;if(r)return r.submitTransaction(n);let i=Br({...n});try{let{data:o}=await Ft({aptosConfig:e,body:i,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return o}catch(o){let s=He.deserialize(new O(i));throw s.authenticator.isSingleSender()&&s.authenticator.sender.isSingleKey()&&(s.authenticator.sender.public_key.publicKey instanceof E||s.authenticator.sender.public_key.publicKey instanceof V)&&await pe.fetchJWK({aptosConfig:e,publicKey:s.authenticator.sender.public_key.publicKey,kid:s.authenticator.sender.signature.signature.getJwkKid()}),o}}async function it(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i,...o}=n;$n(t)&&await t.checkKeylessAccountValidity(e),$n(r)&&await r.checkKeylessAccountValidity(e);let s=n.feePayerAuthenticator||r&&tr({signer:r,transaction:i}),a=er({signer:t,transaction:i});return dn({aptosConfig:e,transaction:i,senderAuthenticator:a,feePayerAuthenticator:s,...o})}async function Io(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i,...o}=n;$n(r)&&await r.checkKeylessAccountValidity(e);let s=tr({signer:r,transaction:i});return dn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:s,...o})}var xa={typeParameters:[],parameters:[I.u8(),new I(I.u8())]};async function Eo(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>P.U8(a));return f({aptosConfig:e,sender:u.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[P.U8(r),new P(s)],abi:xa},options:o})}async function Qt(n){return kn(n)}async function vo(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Ar({aptosConfig:e,originMethod:"getModules",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:r?.ledgerVersion,limit:r?.limit??1e3}})}async function _o(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await hr({aptosConfig:e,originMethod:"getModulesPage",path:`accounts/${u.from(t).toString()}/modules`,params:{ledger_version:r?.ledgerVersion,cursor:r?.cursor,limit:r?.limit??100}});return{modules:i.data,cursor:o}}async function Yn(n){return Qi(n)}async function Lr(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return xi({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${u.from(t).toString()}/transactions`,params:{start:r?.offset,limit:r?.limit}})}async function qr(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return Ar({aptosConfig:e,originMethod:"getResources",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:r?.ledgerVersion,limit:r?.limit??999}})}async function ko(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await hr({aptosConfig:e,originMethod:"getResourcesPage",path:`accounts/${u.from(t).toString()}/resources`,params:{ledger_version:r?.ledgerVersion,cursor:r?.cursor,limit:r?.limit??100}});return{resources:i.data,cursor:o}}async function $r(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await ct({aptosConfig:e,originMethod:"getResource",path:`accounts/${u.from(t).toString()}/resource/${r}`,params:{ledger_version:i?.ledgerVersion}});return o.data}async function Jt(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await $r({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(t);try{let a=await Ji({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 Ki&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Fo(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}},s=await T({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 Uo(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};r?.tokenStandard&&(o.token_standard={_eq:r?.tokenStandard});let s={query:Di,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Do(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}};i?.tokenStandard&&(a.token_standard={_eq:i?.tokenStandard});let c={query:Ri,variables:{where_condition:a,offset:i?.offset,limit:i?.limit,order_by:i?.orderBy}};return(await T({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Ro(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}};r?.tokenStandard&&(o.current_collection={token_standard:{_eq:r?.tokenStandard}});let s={query:Ui,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function zo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:Oi,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function _f(n){let{aptosConfig:e,accountAddress:t,coinType:r,faMetadataAddress:i}=n,o=r,s;if(r!==void 0&&i!==void 0)s=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===De?s=u.A.toStringLong():s=In(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let l=u.from(i);s=l.toStringLong(),l===u.A&&(o=De)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=u.from(t).toStringLong(),c={asset_type:{_eq:s}};o!==void 0&&(c={asset_type:{_in:[o,s]}});let d=await Wr({aptosConfig:e,accountAddress:a,options:{where:c}});return d[0]?d[0].amount:0}async function Wr(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=u.from(t).toStringLong(),o={...r?.where,owner_address:{_eq:i}},s={query:Fi,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Oo(n){let{aptosConfig:e,accountAddress:t}=n,r=u.from(t).toStringLong(),o=await T({aptosConfig:e,query:{query:ki,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 jr(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:u.from(t).toStringLong()}},s={query:vn,variables:{where_condition:o,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await T({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function No(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=r?.throwIfNoAccountFound??!1,o=await nr({aptosConfig:e,privateKey:t});if(o.length===0){if(i)throw new Error("No existing account found for private key.");return Le.fromPrivateKey({privateKey:t})}return o[0]}async function kf(n){let{aptosConfig:e,authKey:t}=n,r=await Jt({aptosConfig:e,authenticationKey:t.derivedAddress()});return Go({aptosConfig:e,accountAddress:r})}async function Go(n){let{aptosConfig:e,accountAddress:t,options:r}=n;try{let[i,o]=await Promise.all([qr({aptosConfig:e,accountAddress:t}),jr({aptosConfig:e,accountAddress:t,options:{limit:1}})]),s=i.find(c=>c.type==="0x1::account::Account");if(!s&&o.length===0)return!1;if(!r?.withAuthKey)return!0;let a;return s?a=s.data.authentication_key:a=t.toStringLong(),a===r.withAuthKey.toString()}catch(i){throw new Error(`Error while checking if account exists at ${t.toString()}: ${i}`)}}var Ca={typeParameters:[],parameters:[new ce,I.u8(),new ce,I.u8(),I.u8(),I.u8()]};async function Mo(n){let{aptosConfig:e,fromAccount:t,dangerouslySkipVerification:r,options:i}=n;if("toNewPrivateKey"in n)return Hr({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toNewPrivateKey,options:i});let o;if("toAccount"in n){if(n.toAccount instanceof Q)return Hr({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toAccount.privateKey,options:i});if(n.toAccount instanceof Wt)return Hr({aptosConfig:e,fromAccount:t,toAccount:n.toAccount,options:i});o=n.toAccount.publicKey.authKey()}else if("toAuthKey"in n)o=n.toAuthKey;else throw new Error("Invalid arguments");let s=await Ea({aptosConfig:e,fromAccount:t,toAuthKey:o,options:i});if(r===!0)return s;let a=await et({aptosConfig:e,transactionHash:s.hash});if(!a.success)throw new Error(`Failed to rotate authentication key - ${a}`);let c=await f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::set_originating_address",functionArguments:[]}});return it({aptosConfig:e,signer:n.toAccount,transaction:c})}async function Hr(n){let{aptosConfig:e,fromAccount:t,options:r}=n,i=await Qt({aptosConfig:e,accountAddress:t.accountAddress}),o;"toNewPrivateKey"in n?o=Le.fromPrivateKey({privateKey:n.toNewPrivateKey,legacy:!0}):o=n.toAccount;let a=new vi({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),d=o.sign(a),l=await f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new Ie(t.signingScheme),P.U8(t.publicKey.toUint8Array()),new Ie(o.signingScheme),P.U8(o.publicKey.toUint8Array()),P.U8(c.toUint8Array()),P.U8(d.toUint8Array())],abi:Ca},options:r});return it({aptosConfig:e,signer:t,transaction:l})}var Ia={typeParameters:[],parameters:[I.u8()]};async function Ea(n){let{aptosConfig:e,fromAccount:t,toAuthKey:r,options:i}=n,o=r,s=await f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key_call",functionArguments:[P.U8(o.toUint8Array())],abi:Ia},options:i});return it({aptosConfig:e,signer:t,transaction:s})}async function rr(n){let{aptosConfig:e,publicKey:t,options:r}=n,i=r?.noMultiKey??!1;if(i&&t instanceof we)throw new Error("Multi-key accounts are not supported when noMultiKey is true.");let o=[t];t instanceof C&&t.publicKey instanceof x?o.push(t.publicKey):t instanceof x&&o.push(new C(t));let[s,a]=await Promise.all([Promise.all(o.map(async g=>{let p=await Ua({aptosConfig:e,publicKey:g});if(p)return{...p,publicKey:g}})),!(t instanceof we)&&!i?_a({aptosConfig:e,publicKey:t,options:r}):Promise.resolve([])]),c=[];for(let g of s)g&&c.push(g);o.push(...a);let d=new Map(o.map(g=>[g.authKey().toString(),g])),l=await ka({aptosConfig:e,authKeys:o.map(g=>g.authKey()),options:r});for(let g of l){if(c.find(y=>y.accountAddress===g.accountAddress))continue;let p=d.get(g.authKey.toString());if(!p)throw new Error(`No publicKey found for authentication key ${g.authKey}. This should never happen.`);c.push({accountAddress:g.accountAddress,publicKey:p,lastTransactionVersion:g.lastTransactionVersion})}return c.sort((g,p)=>p.lastTransactionVersion-g.lastTransactionVersion)}async function Qr(n){let{aptosConfig:e,signer:t,options:r}=n;if(t instanceof $||t instanceof ut)return nr({aptosConfig:e,privateKey:t,options:r});if(t instanceof Q||t instanceof ne)return nr({aptosConfig:e,privateKey:t.privateKey,options:r});if(t instanceof he||t instanceof Ke)return va({aptosConfig:e,keylessAccount:t,options:r});if(t instanceof $e&&t.signers.length===1)return Qr({aptosConfig:e,signer:t.signers[0],options:r});if(t instanceof Wt&&t.signers.length===1)return nr({aptosConfig:e,privateKey:t.signers[0],options:r});throw new Error("Unknown signer type")}async function va(n){let{aptosConfig:e,keylessAccount:t,options:r}=n,i=await rr({aptosConfig:e,publicKey:t.getAnyPublicKey(),options:r}),o={proof:t.proofOrPromise,jwt:t.jwt,ephemeralKeyPair:t.ephemeralKeyPair,pepper:t.pepper,verificationKeyHash:t.verificationKeyHash},s=[];for(let{accountAddress:a,publicKey:c}of i)if(c instanceof we){if(c.getSignaturesRequired()>1)continue;if(c instanceof fe)throw new Error("Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.");c instanceof W&&s.push(new $e({multiKey:c,signers:[t],address:a}))}else t instanceof Ke?s.push(Ke.create({...o,address:a,jwkAddress:t.publicKey.jwkAddress})):s.push(he.create({...o,address:a}));return s}async function nr(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=Le.fromPrivateKey({privateKey:t,legacy:!1}),o=await rr({aptosConfig:e,publicKey:new C(t.publicKey()),options:r}),s=[];for(let{accountAddress:a,publicKey:c}of o)if(c instanceof we){if(c.getSignaturesRequired()>1)continue;c instanceof fe?s.push(new Wt({publicKey:c,signers:[t],address:a})):c instanceof W&&s.push(new $e({multiKey:c,signers:[i],address:a}))}else{let d=c instanceof x;s.push(Le.fromPrivateKey({privateKey:t,address:a,legacy:d}))}return s}async function _a(n){let{aptosConfig:e,publicKey:t,options:r}=n;if(t instanceof we)throw new Error("Public key is a multi-key.");let i=r?.includeUnverified??!1,o=t instanceof C?t:new C(t),s=o.publicKey,a=ui(o.variant),c={public_key:{_eq:s.toString()},public_key_type:{_eq:a},...i?{}:{is_public_key_used:{_eq:!0}}},d={query:Ni,variables:{where_condition:c}},{public_key_auth_keys:l}=await T({aptosConfig:e,query:d,originMethod:"getMultiKeysForPublicKey"});return l.map(p=>{switch(p.signature_type){case"multi_ed25519_signature":return fe.deserializeWithoutLength(O.fromHex(p.account_public_key));case"multi_key_signature":return W.deserialize(O.fromHex(p.account_public_key));default:throw new Error(`Unknown multi-signature type: ${p.signature_type}`)}})}async function ka(n){let{aptosConfig:e,authKeys:t,options:r}=n,i=r?.includeUnverified??!1;if(t.length===0)throw new Error("No authentication keys provided");let o={auth_key:{_in:t.map(c=>c.toString())},...i?{}:{is_auth_key_used:{_eq:!0}}},s={query:_i,variables:{where_condition:o,order_by:[{last_transaction_version:"desc"}]}},{auth_key_account_addresses:a}=await T({aptosConfig:e,query:s,originMethod:"getAccountAddressesForAuthKeys"});return a.map(c=>({authKey:new ge({data:c.auth_key}),accountAddress:new u(b.hexInputToUint8Array(c.account_address)),lastTransactionVersion:Number(c.last_transaction_version)}))}async function Fa(n){let{aptosConfig:e,accountAddress:t}=n,r=await Lr({aptosConfig:e,accountAddress:t,options:{limit:1}});return r.length===0?0:Number(r[0].version)}async function Ua(n){let{aptosConfig:e,publicKey:t}=n,r=t.authKey().derivedAddress(),[i,o]=await Promise.all([Fa({aptosConfig:e,accountAddress:r}),Go({aptosConfig:e,accountAddress:r,options:{withAuthKey:t.authKey()}})]);if(o)return{accountAddress:r,lastTransactionVersion:i}}async function re(n){let{aptosConfig:e,payload:t,options:r}=n,i=await So({...t,aptosConfig:e}),o=new Z;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Ft({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:r?.ledgerVersion},body:s});return a}async function Bo(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await Ft({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:r?.ledgerVersion},body:{function:t.function,type_arguments:t.typeArguments??[],arguments:t.functionArguments??[]}});return i}async function Vo(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=ye(r);return f({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new D,new m(K()),new m(K())]}},options:i})}async function Ho(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=ye(r);return f({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new D,new m(K()),new m(K())]}},options:i})}async function Lo(n){let{aptosConfig:e,sender:t,options:r}=n;return f({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var Tt=class{constructor(e){this.config=e;this.isAccountAbstractionEnabled=async e=>{let t=await this.getAuthenticationFunction(e),{moduleAddress:r,moduleName:i,functionName:o}=ye(e.authenticationFunction);return t?.some(s=>u.fromString(r).equals(s.moduleAddress)&&i===s.moduleName&&o===s.functionName)??!1};this.enableAccountAbstractionTransaction=this.addAuthenticationFunctionTransaction;this.disableAccountAbstractionTransaction=async e=>{let{accountAddress:t,authenticationFunction:r,options:i}=e;return r?this.removeAuthenticationFunctionTransaction({accountAddress:t,authenticationFunction:r,options:i}):this.removeDispatchableAuthenticatorTransaction({accountAddress:t,options:i})}}async addAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Vo({aptosConfig:this.config,authenticationFunction:r,sender:t,options:i})}async removeAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return Ho({aptosConfig:this.config,sender:t,authenticationFunction:r,options:i})}async removeDispatchableAuthenticatorTransaction(e){let{accountAddress:t,options:r}=e;return Lo({aptosConfig:this.config,sender:t,options:r})}async getAuthenticationFunction(e){let{accountAddress:t}=e,[{vec:r}]=await re({aptosConfig:this.config,payload:{function:"0x1::account_abstraction::dispatchable_authenticator",functionArguments:[u.from(t)],abi:{typeParameters:[],parameters:[new D],returnTypes:[]}}});if(r.length!==0)return r[0].map(i=>({moduleAddress:u.fromString(i.module_address),moduleName:i.module_name,functionName:i.function_name}))}};var pn=class{constructor(e){this.config=e;this.abstraction=new Tt(e)}async getAccountInfo(e){return Qt({aptosConfig:this.config,...e})}async getAccountModules(e){return vo({aptosConfig:this.config,...e})}async getAccountModulesPage(e){return _o({aptosConfig:this.config,...e})}async getAccountModule(e){return Yn({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Lr({aptosConfig:this.config,...e})}async getAccountResources(e){return qr({aptosConfig:this.config,...e})}async getAccountResourcesPage(e){return ko({aptosConfig:this.config,...e})}async getAccountResource(e){return $r({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Jt({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Fo({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Uo({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Do({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ro({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),zo({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Wr({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Oo({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:De,faMetadataAddress:yi,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
4
+ compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
5
+ will be removed in the near future`);let s=r;r===void 0&&i!==void 0&&(s=await Ut(async()=>{try{let d=(await re({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(d.vec.length>0&&Pi(d.vec[0]))return Si(d.vec[0])}catch{}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(r!==void 0&&i!==void 0)a=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===De?a=u.A.toStringLong():a=In(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=u.from(i);a=d.toStringLong(),d===u.A&&(s=De)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[d]=await re({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(d,10)}let[c]=await re({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,a]}});return parseInt(c,10)}async getAccountOwnedObjects(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),jr({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),No({aptosConfig:this.config,...e})}async deriveOwnedAccountsFromSigner(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),Qr({aptosConfig:this.config,...e})}async getAccountsForPublicKey(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),rr({aptosConfig:this.config,...e})}};var Da={typeParameters:[{constraints:[]}],parameters:[new D,new q]};async function qo(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return f({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[o??De],functionArguments:[r,i],abi:Da},options:s})}var gn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return qo({aptosConfig:this.config,...e})}};var ot={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},be="0x4::token::Token";async function $o(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()}};return(await T({aptosConfig:e,query:{query:qi,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function Wo(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:u.from(t).toStringLong()},amount:{_gt:0}};return(await T({aptosConfig:e,query:{query:wr,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:wr,variables:{where_condition:i,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await T({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Qo(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:u.from(t).toStringLong()}},o={query:Li,variables:{where_condition:i,offset:r?.offset,limit:r?.limit,order_by:r?.orderBy}};return(await T({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Ra={typeParameters:[],parameters:[new m(K()),new q,new m(K()),new m(K()),new M,new M,new M,new M,new M,new M,new M,new M,new M,new q,new q]};async function Jo(n){let{aptosConfig:e,options:t,creator:r}=n;return f({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new k(n.description),new le(n.maxSupply??si),new k(n.name),new k(n.uri),new B(n.mutableDescription??!0),new B(n.mutableRoyalty??!0),new B(n.mutableURI??!0),new B(n.mutableTokenDescription??!0),new B(n.mutableTokenName??!0),new B(n.mutableTokenProperties??!0),new B(n.mutableTokenURI??!0),new B(n.tokensBurnableByCreator??!0),new B(n.tokensFreezableByCreator??!0),new le(n.royaltyNumerator??0),new le(n.royaltyDenominator??1)],abi:Ra},options:t})}async function Zt(n){let{aptosConfig:e,options:t}=n,r=t?.where;t?.tokenStandard&&(r.token_standard={_eq:t?.tokenStandard??"v2"});let i={query:Gi,variables:{where_condition:r,offset:t?.offset,limit:t?.limit}};return(await T({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function Zo(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 i?.tokenStandard&&(s.token_standard={_eq:i?.tokenStandard??"v2"}),Zt({aptosConfig:e,options:{...i,where:s}})}async function Yo(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:u.from(t).toStringLong()}};return r?.tokenStandard&&(o.token_standard={_eq:r?.tokenStandard??"v2"}),Zt({aptosConfig:e,options:{...r,where:o}})}async function Xo(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:u.from(t).toStringLong()}};return r?.tokenStandard&&(o.token_standard={_eq:r?.tokenStandard??"v2"}),Zt({aptosConfig:e,options:{...r,where:o}})}async function es(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=u.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return r?.tokenStandard&&(s.token_standard={_eq:r?.tokenStandard??"v2"}),(await Zt({aptosConfig:i,options:{where:s}})).collection_id}var za={typeParameters:[],parameters:[new m(K()),new m(K()),new m(K()),new m(K()),new I(new m(K())),new I(new m(K())),new I(I.u8())]};async function ts(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:l}=n,g=d?.map(p=>ot[p]);return f({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new k(i),new k(o),new k(s),new k(a),P.MoveString(c??[]),P.MoveString(g??[]),ms(l??[],g??[])],abi:za},options:t})}var Oa={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new D]};async function ns(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[o??be],functionArguments:[u.from(r),u.from(i)],abi:Oa},options:s})}var Na={typeParameters:[],parameters:[new m(K()),new m(K()),new m(K()),new m(K()),new I(new m(K())),new I(new m(K())),new I(I.u8()),new D]};async function rs(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:l,options:g}=n;if(c?.length!==l?.length)throw new Error("Property keys and property values counts do not match");if(d?.length!==l?.length)throw new Error("Property types and property values counts do not match");let p=d?.map(y=>ot[y]);return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,P.MoveString(c??[]),P.MoveString(p??[]),ms(l??[],p??[]),a],abi:Na},options:g})}var Ga={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0)))]};async function is(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[i??be],functionArguments:[u.from(r)],abi:Ga},options:o})}var Ma={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0)))]};async function os(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[i??be],functionArguments:[r],abi:Ma},options:o})}var Ba={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0)))]};async function ss(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[i??be],functionArguments:[r],abi:Ba},options:o})}var Va={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new m(K())]};async function as(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[o??be],functionArguments:[u.from(i),new k(r)],abi:Va},options:s})}var Ha={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new m(K())]};async function cs(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[o??be],functionArguments:[u.from(i),new k(r)],abi:Ha},options:s})}var La={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new m(K())]};async function us(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[o??be],functionArguments:[u.from(i),new k(r)],abi:La},options:s})}var qa={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new m(K()),new m(K()),I.u8()]};async function ds(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[a??be],functionArguments:[u.from(s),new k(r),new k(ot[i]),P.U8(Jr(o,ot[i]))],abi:qa},options:c})}var $a={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new m(K())]};async function ps(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[o??be],functionArguments:[u.from(i),new k(r)],abi:$a},options:s})}var Wa={typeParameters:[{constraints:["key"]}],parameters:[new m(ue(new z(0))),new m(K()),new m(K()),I.u8()]};async function ls(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[a??be],functionArguments:[u.from(s),new k(r),new k(ot[i]),Jr(o,ot[i])],abi:Wa},options:c})}var ja={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(ue(new z(0))),new m(K()),new z(1)]};async function gs(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[a??be,ot[i]],functionArguments:[u.from(s),new k(r),o],abi:ja},options:c})}var Qa={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new m(ue(new z(0))),new m(K()),new z(1)]};async function ys(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[a??be,ot[i]],functionArguments:[u.from(s),new k(r),o],abi:Qa},options:c})}function ms(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(Jr(n[i],r))}),t}function Jr(n,e){let t=xe(e);return wt(n,t,0,[]).bcsToBytes()}var yn=class{constructor(e){this.config=e}async getCollectionData(e){await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=u.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return i?.tokenStandard&&(s.token_standard={_eq:i?.tokenStandard??"v2"}),Zt({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zo({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Yo({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Xo({aptosConfig:this.config,...e})}async getCollectionId(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),es({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),$o({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Wo({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),jo({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Qo({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return Jo({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return ts({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return ns({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return rs({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return is({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return os({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return ss({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return as({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return cs({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return us({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return ds({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ps({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return ls({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return gs({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return ys({aptosConfig:this.config,...e})}};async function fs(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=i?.timeoutSecs||20,{data:s}=await Ci({aptosConfig:e,path:"fund",body:{address:u.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await et({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:i?.checkSuccess}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var mn=class{constructor(e){this.config=e}async fundAccount(e){let t=await fs({aptosConfig:this.config,...e});return(e.options?.waitForIndexer===void 0||e.options?.waitForIndexer)&&await to({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function ir(n){let{aptosConfig:e,options:t}=n,r={query:Hi,variables:{where_condition:t?.where,limit:t?.limit,offset:t?.offset}};return(await T({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function As(n){let{aptosConfig:e,options:t}=n,r={query:Vi,variables:{where_condition:t?.where,limit:t?.limit,offset:t?.offset}};return(await T({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function hs(n){let{aptosConfig:e,options:t}=n,r={query:Mi,variables:{where_condition:t?.where,limit:t?.limit,offset:t?.offset}};return(await T({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var bs={typeParameters:[{constraints:[]}],parameters:[xe("0x1::object::Object"),new D,new q]};async function ws(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:bs},options:s})}async function Ts(n){let{aptosConfig:e,sender:t,fromStore:r,toStore:i,amount:o,options:s}=n;return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::dispatchable_fungible_asset::transfer",typeArguments:["0x1::fungible_asset::FungibleStore"],functionArguments:[r,i,o],abi:bs},options:s})}var fn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ir({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),(await ir({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),await ir({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),As({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"fungible_asset_processor"}),hs({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return ws({aptosConfig:this.config,...e})}async transferFungibleAssetBetweenStores(e){return Ts({aptosConfig:this.config,...e})}};var An=class{constructor(e){this.config=e}async getLedgerInfo(){return _n({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return no({aptosConfig:this.config,...e})}async getBlockByHeight(e){return ro({aptosConfig:this.config,...e})}async view(e){return re({aptosConfig:this.config,...e})}async viewJson(e){return Bo({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return $i({aptosConfig:this.config,...e})}async queryIndexer(e){return T({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Wi({aptosConfig:this.config})}async getProcessorStatus(e){return ji({aptosConfig:this.config,processorType:e})}};var Ss=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Ps(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function st(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(!Ps(e))throw new Error(`${e} is not valid. ${Ss}`);if(t&&!Ps(t))throw new Error(`${t} is not valid. ${Ss}`);return{domainName:t||e,subdomainName:t?e:void 0}}var Ja=(t=>(t[t.Independent=0]="Independent",t[t.FollowsDomain=1]="FollowsDomain",t))(Ja||{});function Ks(n){if(!n)return!1;let e=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),t=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&e?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!t}var Nh="0x37368b46ce665362562c6d1d4ec01a08c8644c488690df5a17e13ba163e20221",Za="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Ya={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Za,custom:null,devnet:null};function je(n){let e=Ya[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 xs(n){let{aptosConfig:e,name:t}=n,r=je(e),{domainName:i,subdomainName:o}=st(t),s=await re({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 Cs(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=je(e),{domainName:l,subdomainName:g}=st(r),p=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(g&&!p)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(p&&!g)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let G=t.years??1;if(G!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Ue=G*31536e3;return await f({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[l,Ue,o,s]},options:a})}if(!g)throw new Error(`${t.policy} requires a subdomain to be provided.`);let y=await Zr({aptosConfig:e,name:l});if(!y)throw new Error("The domain does not exist");let A=t.policy==="subdomain:independent"?t.expirationDate:y;if(A>y)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await f({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[l,g,Math.round(A/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function Zr(n){let{aptosConfig:e,name:t}=n,r=je(e),{domainName:i,subdomainName:o}=st(t);try{let s=await re({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch{return}}async function Is(n){let{aptosConfig:e,address:t}=n,r=je(e),i=await re({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 Es(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=je(e);if(!r)return await f({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=st(r);return await f({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function vs(n){let{aptosConfig:e,name:t}=n,r=je(e),{domainName:i,subdomainName:o}=st(t),s=await re({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 _s(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=je(e),{domainName:a,subdomainName:c}=st(r);return await f({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function ks(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=st(t),a=(await T({aptosConfig:e,query:{query:Dt,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=hn(a)),Ks(a)?a:void 0}async function Fs(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Yr({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountNames",query:{query:Dt,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(hn)}async function Us(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Yr({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountDomains",query:{query:Dt,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(hn)}async function Ds(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await Yr({aptosConfig:e});return(await T({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:Dt,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...n.options?.where??{},owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(hn)}async function Rs(n){let{aptosConfig:e,options:t,domain:r}=n;return(await T({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:Dt,variables:{limit:t?.limit,offset:t?.offset,order_by:t?.orderBy,where_condition:{...n.options?.where??{},domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(hn).filter(Ks)}async function Yr(n){let{aptosConfig:e}=n,t=je(e),[r]=await re({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 zs(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=je(e),a=i*31536e3,{domainName:c,subdomainName:d}=st(r);if(d)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await f({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function hn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var bn=class{constructor(e){this.config=e}async getOwnerAddress(e){return xs({aptosConfig:this.config,...e})}async getExpiration(e){return Zr({aptosConfig:this.config,...e})}async getTargetAddress(e){return vs({aptosConfig:this.config,...e})}async setTargetAddress(e){return _s({aptosConfig:this.config,...e})}async getPrimaryName(e){return Is({aptosConfig:this.config,...e})}async setPrimaryName(e){return Es({aptosConfig:this.config,...e})}async registerName(e){return Cs({aptosConfig:this.config,...e})}async renewDomain(e){return zs({aptosConfig:this.config,...e})}async getName(e){return ks({aptosConfig:this.config,...e})}async getAccountNames(e){return Fs({aptosConfig:this.config,...e})}async getAccountDomains(e){return Us({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return Ds({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return Rs({aptosConfig:this.config,...e})}};async function Os(n){let{aptosConfig:e,poolAddress:t}=n,r=u.from(t).toStringLong(),o=await T({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 Ns(n){let{aptosConfig:e,options:t}=n,r={query:br,variables:{order_by:t?.orderBy}};return(await T({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function Gs(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:Bi,variables:{delegatorAddress:u.from(t).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await T({aptosConfig:e,query:i})).delegated_staking_activities}var wn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),Os({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),Ns({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await h({config:this.config,minimumLedgerVersion:e?.minimumLedgerVersion,processorType:"stake_processor"}),Gs({aptosConfig:this.config,...e})}};var sr=class{constructor(e){this.config=e}async simple(e){return f({aptosConfig:this.config,...e})}async multiAgent(e){return f({aptosConfig:this.config,...e})}};var Yt=class{constructor(e){this.config=e}async simple(e){return Vr({aptosConfig:this.config,...e})}async multiAgent(e){return Vr({aptosConfig:this.config,...e})}};lr([Sr],Yt.prototype,"simple",1),lr([Sr],Yt.prototype,"multiAgent",1);var ar=class{constructor(e){this.config=e}async simple(e){return Tr(this.config,e),dn({aptosConfig:this.config,...e})}async multiAgent(e){return Tr(this.config,e),dn({aptosConfig:this.config,...e})}};import ec from"eventemitter3";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 en(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=Re();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await en(this.sleepTime),Re()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${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 Qt({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await Qt({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 en(this.sleepTime);this.lock=!0;try{await this.update();let e=Re();for(;this.lastUncommintedNumber!==this.currentNumber;)Re()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await en(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}}}};import Xa from"eventemitter3";var Ms="fulfilled",Bs=(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(Bs||{}),ur=class extends Xa{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new Un;this.transactionsQueue=new Un;this.outstandingTransactions=new Un;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=it({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Pr)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===Ms?(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 Pr)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(et({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===Ms?(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 f({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:i,options:{...o,accountSequenceNumber:r,replayProtectionNonce:void 0}})}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 dr=class extends ec{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 Tn=class{constructor(e){this.config=e,this.build=new sr(this.config),this.simulate=new Yt(this.config),this.submit=new ar(this.config),this.batch=new dr(this.config)}async getTransactions(e){return Zi({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Yi({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Xi({aptosConfig:this.config,...e})}async isPendingTransaction(e){return eo({aptosConfig:this.config,...e})}async waitForTransaction(e){return et({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Fn({aptosConfig:this.config})}getSigningMessage(e){return Co(e)}async publishPackageTransaction(e){return Eo({aptosConfig:this.config,...e})}async rotateAuthKey(e){return Mo({aptosConfig:this.config,...e})}sign(e){return er({...e})}signAsFeePayer(e){return tr({...e})}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){return it({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Io({aptosConfig:this.config,...e})}};import{jwtDecode as nc}from"jwt-decode";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:b.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Ii({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return b.fromHexInput(a.pepper).toUint8Array()}async function Xr(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await pr(n),uidKey:o="sub",maxExpHorizonSecs:s=(await $t({aptosConfig:e})).maxExpHorizonSecs}=n;if(b.fromHexInput(i).toUint8Array().length!==he.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${he.PEPPER_LENGTH} bytes`);let a=nc(t);if(typeof a.iat!="number")throw new Error("iat was not found");if(s<r.expiryDateSecs-a.iat)throw Error(`The EphemeralKeyPair is too long lived. It's lifespan must be less than ${s}`);let c={jwt_b64:t,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:b.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:b.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:d}=await Ei({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),l=d.proof,g=new at({a:l.a,b:l.b,c:l.c});return new de({proof:new Xt(g,0),trainingWheelsSignature:Ye.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function Vs(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await pr(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await $t({aptosConfig:e}),d=Xr({...n,pepper:s,maxExpHorizonSecs:c}),l=o?d:await d;if(r!==void 0){let y=V.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),A=await Jt({aptosConfig:e,authenticationKey:y.authKey().derivedAddress()});return Ke.create({...n,address:A,proof:l,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let g=E.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await Jt({aptosConfig:e,authenticationKey:g.authKey().derivedAddress()});return he.create({...n,address:p,proof:l,pepper:s,proofFetchCallback:o,verificationKey:a})}async function Hs(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(fi.test(r)?o="https://www.googleapis.com/service_accounts/v1/jwk/securetoken@system.gserviceaccount.com":o=r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`);let s;try{if(s=await fetch(o),!s.ok)throw new Error(`${s.status} ${s.statusText}`)}catch(c){let d;throw c instanceof Error?d=`${c.message}`:d=`error unknown - ${c}`,w.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${d}`})}let a=await s.json();return f({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,P.MoveString(a.keys.map(c=>c.kid)),P.MoveString(a.keys.map(c=>c.alg)),P.MoveString(a.keys.map(c=>c.e)),P.MoveString(a.keys.map(c=>c.n))]},options:i})}var Sn=class{constructor(e){this.config=e}async getPepper(e){return pr({aptosConfig:this.config,...e})}async getProof(e){return Xr({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return Vs({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return Hs({aptosConfig:this.config,...e})}};async function rc(n){let{aptosConfig:e,options:t}=n,r={query:vn,variables:{where_condition:t?.where,offset:t?.offset,limit:t?.limit,order_by:t?.orderBy}};return(await T({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function Ls(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:u.from(t).toStringLong()}};return(await rc({aptosConfig:e,options:{...r,where:o}}))[0]}var Pn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await h({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),Ls({aptosConfig:this.config,...e})}};var j=class{constructor(e){this.config=e??new io,this.account=new pn(this.config),this.abstraction=new Tt(this.config),this.ans=new bn(this.config),this.coin=new gn(this.config),this.digitalAsset=new yn(this.config),this.faucet=new mn(this.config),this.fungibleAsset=new fn(this.config),this.general=new An(this.config),this.staking=new wn(this.config),this.transaction=new Tn(this.config),this.table=new Kr(this.config),this.keyless=new Sn(this.config),this.object=new Pn(this.config)}setIgnoreTransactionSubmitter(e){this.config.setIgnoreTransactionSubmitter(e)}};function ie(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&Object.defineProperty(n.prototype,r,{value:function(...o){return this[t][r](...o)},writable:i.writable,configurable:i.configurable,enumerable:i.enumerable})})}ie(j,pn,"account");ie(j,Tt,"abstraction");ie(j,bn,"ans");ie(j,gn,"coin");ie(j,yn,"digitalAsset");ie(j,Event,"event");ie(j,mn,"faucet");ie(j,fn,"fungibleAsset");ie(j,An,"general");ie(j,wn,"staking");ie(j,Tn,"transaction");ie(j,Kr,"table");ie(j,Sn,"keyless");ie(j,Pn,"object");var ac=1e7,ei=120,cc=30,uc=330,dc=120,pc=350,lc=300,gc=93,Fe=class Fe extends Ze{constructor(e,t){super();let r=b.fromHexInput(t).toUint8Array();if(r.length!==Fe.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Fe.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new Z;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),ge.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){try{return Rn({...e,publicKey:this}),!0}catch(t){if(t instanceof w)return!1;throw t}}async verifySignatureAsync(e){return xr({...e,publicKey:this})}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Fe(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Fe(t,r)}static isPublicKey(e){return e instanceof Fe}static create(e){return qs(e),new Fe(e.iss,qs(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=$s(t);if(typeof o.iss!="string")throw new Error("iss was not found");if(typeof o.aud!="string")throw new Error("aud was not found or an array of values");let s=o[i];return Fe.create({iss:o.iss,uidKey:i,uidVal:s,aud:o.aud,pepper:r})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};Fe.ID_COMMITMENT_LENGTH=32;var E=Fe;async function xr(n){let{aptosConfig:e,publicKey:t,message:r,signature:i,jwk:o,keylessConfig:s=await $t({aptosConfig:e}),options:a}=n;try{if(!(i instanceof ee))throw w.fromErrorType({type:26,details:"Not a keyless signature"});return Rn({message:r,publicKey:t,signature:i,jwk:o||await Ir({aptosConfig:e,publicKey:t,kid:i.getJwkKid()}),keylessConfig:s}),!0}catch(c){if(a?.throwErrorWithReason)throw c;return!1}}function Rn(n){let{publicKey:e,message:t,signature:r,keylessConfig:i,jwk:o}=n,{verificationKey:s,maxExpHorizonSecs:a,trainingWheelsPubkey:c}=i;if(!(r instanceof ee))throw w.fromErrorType({type:26,details:"Not a keyless signature"});if(!(r.ephemeralCertificate.signature instanceof de))throw w.fromErrorType({type:26,details:"Unsupported ephemeral certificate variant"});let d=r.ephemeralCertificate.signature;if(!(d.proof.proof instanceof at))throw w.fromErrorType({type:26,details:"Unsupported proof variant for ZeroKnowledgeSig"});let l=d.proof.proof;if(r.expiryDateSecs<Re())throw w.fromErrorType({type:27,details:"The expiryDateSecs is in the past"});if(d.expHorizonSecs>a)throw w.fromErrorType({type:28});if(!r.ephemeralPublicKey.verifySignature({message:t,signature:r.ephemeralSignature}))throw w.fromErrorType({type:29});let g=yc({publicKey:e,signature:r,jwk:o,keylessConfig:i});if(!s.verifyProof({publicInputsHash:g,groth16Proof:l}))throw w.fromErrorType({type:32});if(c){if(!d.trainingWheelsSignature)throw w.fromErrorType({type:30});let p=new ni(l,g);if(!c.verifySignature({message:p.hash(),signature:d.trainingWheelsSignature}))throw w.fromErrorType({type:31})}}function yc(n){let{publicKey:e,signature:t,jwk:r,keylessConfig:i}=n,o=e instanceof E?e:e.keylessPublicKey;if(!(t.ephemeralCertificate.signature instanceof de))throw new Error("Signature is not a ZeroKnowledgeSig");let s=t.ephemeralCertificate.signature,a=[];return a.push(...Cn(t.ephemeralPublicKey.toUint8Array(),i.maxCommitedEpkBytes)),a.push(vt(o.idCommitment)),a.push(t.expiryDateSecs),a.push(s.expHorizonSecs),a.push(ve(o.iss,i.maxIssValBytes)),s.extraField?(a.push(1n),a.push(ve(s.extraField,i.maxExtraFieldBytes))):(a.push(0n),a.push(ve(" ",i.maxExtraFieldBytes))),a.push(ve(sc(t.jwtHeader,!0)+".",i.maxJwtHeaderB64Bytes)),a.push(r.toScalar()),s.overrideAudVal?(a.push(ve(s.overrideAudVal,ei)),a.push(1n)):(a.push(ve("",ei)),a.push(0n)),_t(a)}async function Ir(n){let{aptosConfig:e,publicKey:t,kid:r}=n,i=t instanceof E?t:t.keylessPublicKey,{iss:o}=i,s,a=t instanceof V?t.jwkAddress:void 0;try{s=await Ac({aptosConfig:e,jwkAddr:a})}catch(l){throw w.fromErrorType({type:24,error:l,details:`Failed to fetch ${a?"Federated":"Patched"}JWKs ${a?`for address ${a}`:"0x1"}`})}let c=s.get(o);if(c===void 0)throw w.fromErrorType({type:7,details:`JWKs for issuer ${o} not found.`});let d=c.find(l=>l.kid===r);if(d===void 0)throw w.fromErrorType({type:6,details:`JWK with kid '${r}' for issuer '${o}' not found.`});return d}function qs(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[vt(b.fromHexInput(i).toUint8Array()),ve(r,ei),ve(t,uc),ve(e,cc)];return yr(_t(o),E.ID_COMMITMENT_LENGTH)}var ee=class n extends Ee{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}getJwkKid(){return bc(this.jwtHeader).kid}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=qt.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=Et.deserialize(e),s=Ye.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new qt(new de({proof:new Xt(new at({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new Et(new x(new Uint8Array(32))),ephemeralSignature:new Ye(new N(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},qt=class n extends Ee{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(de.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},Kn=class Kn extends S{constructor(e){if(super(),this.data=b.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 Kn(t)}toArray(){let e=this.toProjectivePoint();return[e.x.toString(),e.y.toString(),e.pz.toString()]}toProjectivePoint(){let e=new Uint8Array(this.data);e.reverse();let t=(e[0]&128)>>7,{Fp:r}=Ce.fields,i=r.create(ti(e)),o=r.sqrt(r.add(r.pow(i,3n),Kn.B)),s=r.neg(o),a=o>s==(t===1)?o:s;return Ce.G1.ProjectivePoint.fromAffine({x:i,y:a})}};Kn.B=Ce.fields.Fp.create(3n);var Qe=Kn;function ti(n){if(n.length!==32)throw new Error("Input should be 32 bytes");let e=new Uint8Array(n);return e[0]=e[0]&63,oc(e)}var xn=class xn extends S{constructor(e){if(super(),this.data=b.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 xn(t)}toArray(){let e=this.toProjectivePoint();return[[e.x.c0.toString(),e.x.c1.toString()],[e.y.c0.toString(),e.y.c1.toString()],[e.pz.c0.toString(),e.pz.c1.toString()]]}toProjectivePoint(){let e=new Uint8Array(this.data),t=e.slice(0,32).reverse(),r=e.slice(32,64).reverse(),i=(r[0]&128)>>7,{Fp2:o}=Ce.fields,s=o.fromBigTuple([ti(t),ti(r)]),a=o.sqrt(o.add(o.pow(s,3n),xn.B)),c=o.neg(a),l=(a.c1>c.c1||a.c1===c.c1&&a.c0>c.c0)===(i===1)?a:c;return Ce.G2.ProjectivePoint.fromAffine({x:s,y:l})}};xn.B=Ce.fields.Fp2.fromBigTuple([19485874751759354771024239261021720505790618469301721065564631296452457478373n,266929791119991161246907387137283842545076965332900288569378510910307636690n]);var St=xn,at=class n extends li{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Qe(t),this.b=new St(r),this.c=new Qe(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Qe.deserialize(e).bcsToBytes(),r=St.deserialize(e).bcsToBytes(),i=Qe.deserialize(e).bcsToBytes();return new n({a:t,b:r,c:i})}toSnarkJsJson(){return{protocol:"groth16",curve:"bn128",pi_a:this.a.toArray(),pi_b:this.b.toArray(),pi_c:this.c.toArray()}}},ni=class n extends S{constructor(t,r){super();this.domainSeparator="APTOS::Groth16ProofAndStatement";if(this.proof=t,this.publicInputsHash=typeof r=="bigint"?yr(r,32):b.fromHexInput(r).toUint8Array(),this.publicInputsHash.length!==32)throw new Error("Invalid public inputs hash")}serialize(t){this.proof.serialize(t),t.serializeFixedBytes(this.publicInputsHash)}static deserialize(t){return new n(at.deserialize(t),t.deserializeFixedBytes(32))}hash(){return rt(this.bcsToBytes(),this.domainSeparator)}},Xt=class n extends S{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(at.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},de=class n extends Ee{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}static fromBytes(e){return n.deserialize(new O(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOption(this.extraField),e.serializeOption(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let t=Xt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(Ye);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},ri=class n{constructor(e){let{verificationKey:t,trainingWheelsPubkey:r,maxExpHorizonSecs:i=ac,maxExtraFieldBytes:o=pc,maxJwtHeaderB64Bytes:s=lc,maxIssValBytes:a=dc,maxCommitedEpkBytes:c=gc}=e;this.verificationKey=t,this.maxExpHorizonSecs=i,r&&(this.trainingWheelsPubkey=new Et(new x(r))),this.maxExtraFieldBytes=o,this.maxJwtHeaderB64Bytes=s,this.maxIssValBytes=a,this.maxCommitedEpkBytes=c}static create(e,t){return new n({verificationKey:new ii({alphaG1:e.alpha_g1,betaG2:e.beta_g2,deltaG2:e.delta_g2,gammaAbcG1:e.gamma_abc_g1,gammaG2:e.gamma_g2}),maxExpHorizonSecs:Number(t.max_exp_horizon_secs),trainingWheelsPubkey:t.training_wheels_pubkey.vec[0],maxExtraFieldBytes:t.max_extra_field_bytes,maxJwtHeaderB64Bytes:t.max_jwt_header_b64_bytes,maxIssValBytes:t.max_iss_val_bytes,maxCommitedEpkBytes:t.max_commited_epk_bytes})}},ii=class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Qe(t),this.betaG2=new St(r),this.deltaG2=new St(i),this.gammaAbcG1=[new Qe(o[0]),new Qe(o[1])],this.gammaG2=new St(s)}hash(){let e=new Z;return this.serialize(e),ic.create().update(e.toUint8Array()).digest()}serialize(e){this.alphaG1.serialize(e),this.betaG2.serialize(e),this.deltaG2.serialize(e),this.gammaAbcG1[0].serialize(e),this.gammaAbcG1[1].serialize(e),this.gammaG2.serialize(e)}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})}verifyProof(e){let{publicInputsHash:t,groth16Proof:r}=e;try{let i=r.a.toProjectivePoint(),o=r.b.toProjectivePoint(),s=r.c.toProjectivePoint(),a=this.alphaG1.toProjectivePoint(),c=this.betaG2.toProjectivePoint(),d=this.gammaG2.toProjectivePoint(),l=this.deltaG2.toProjectivePoint(),g=this.gammaAbcG1.map(Je=>Je.toProjectivePoint()),{Fp12:p}=Ce.fields,y=g[0].add(g[1].multiply(t)),A=Ce.pairing(y,d),_=Ce.pairing(i,o),G=Ce.pairing(a,c),J=Ce.pairing(s,l),Ue=p.mul(G,p.mul(A,J));return p.eql(_,Ue)}catch(i){throw w.fromErrorType({type:32,error:i,details:"Error encountered when checking zero knowledge relation"})}}toSnarkJsJson(){return{protocol:"groth16",curve:"bn128",nPublic:1,vk_alpha_1:this.alphaG1.toArray(),vk_beta_2:this.betaG2.toArray(),vk_gamma_2:this.gammaG2.toArray(),vk_delta_2:this.deltaG2.toArray(),IC:this.gammaAbcG1.map(e=>e.toArray())}}};async function $t(n){let{aptosConfig:e}=n;try{return await Ut(async()=>{let[t,r]=await Promise.all([mc(n),fc(n)]);return ri.create(r,t)},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof w?t:w.fromErrorType({type:25,error:t})}}function qe(n){let{jwt:e,uidKey:t="sub"}=n,r;try{r=$s(e)}catch(o){throw w.fromErrorType({type:12,details:`Failed to parse JWT - ${hi(o)}`})}if(typeof r.iss!="string")throw w.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof r.aud!="string")throw w.fromErrorType({type:12,details:"JWT is missing 'aud' in the payload or 'aud' is an array of values."});let i=r[t];return{iss:r.iss,aud:r.aud,uidVal:i}}async function mc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration";try{let{data:i}=await ct({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:t?.ledgerVersion}});return i.data}catch(i){throw w.fromErrorType({type:22,error:i})}}async function fc(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await ct({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:t?.ledgerVersion}});return i.data}catch(i){throw w.fromErrorType({type:23,error:i})}}async function Ac(n){let{aptosConfig:e,jwkAddr:t,options:r}=n,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await ct({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${u.from(t).toString()}/resource/${s}`,params:{ledger_version:r?.ledgerVersion}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await ct({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:r?.ledgerVersion}});i=a}let o=new Map;for(let s of i.data.jwks.entries){let a=[];for(let c of s.jwks){let{data:d}=c.variant,l=new O(b.fromHexInput(d).toUint8Array()),g=oi.deserialize(l);a.push(g)}o.set(ai(s.issuer),a)}return o}var oi=class n extends S{constructor(e){super();let{kid:t,kty:r,alg:i,e:o,n:s}=e;this.kid=t,this.kty=r,this.alg=i,this.e=o,this.n=s}serialize(e){e.serializeStr(this.kid),e.serializeStr(this.kty),e.serializeStr(this.alg),e.serializeStr(this.e),e.serializeStr(this.n)}static fromMoveStruct(e){let{data:t}=e.variant,r=new O(b.fromHexInput(t).toUint8Array());return n.deserialize(r)}toScalar(){if(this.alg!=="RS256")throw w.fromErrorType({type:32,details:"Failed to convert JWK to scalar when calculating the public inputs hash. Only RSA 256 is supported currently"});let e=Ti(this.n),r=hc(e.reverse()).map(i=>vt(i));return r.push(256n),_t(r)}static deserialize(e){let t=e.deserializeStr(),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeStr(),s=e.deserializeStr();return new n({kid:t,kty:r,alg:i,n:s,e:o})}};function hc(n){let e=[];for(let t=0;t<n.length;t+=24){let r=n.slice(t,Math.min(t+24,n.length));if(r.length<24){let i=new Uint8Array(24);i.set(r),e.push(i)}else e.push(r)}return e}function bc(n){try{let e=JSON.parse(n);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch{throw new Error("Failed to parse JWT header.")}}export{ac as a,ei as b,cc as c,uc as d,dc as e,pc as f,lc as g,gc as h,E as i,xr as j,Rn as k,Ir as l,ee as m,qt as n,at as o,ni as p,Xt as q,de as r,ri as s,ii as t,$t as u,qe as v,Ac as w,oi as x,bc as y,V as z,C as A,U as B,we as C,W as D,me as E,fe as F,Te as G,Tu as H,Su as I,L as J,Se as K,ze as L,te as M,_e as N,Rt as O,dt as P,nn as Q,R,M as S,ce as T,Oe as U,Ne as V,q as W,Ge as X,Me as Y,D as Z,pt as _,Nn as $,z as aa,I as ba,m as ca,ke as da,yd as ea,K as fa,md as ga,ue as ha,js as ia,tt as ja,zt as ka,Ot as la,Nt as ma,Be as na,Gt as oa,rn as pa,on as qa,Gn as ra,lt as sa,Mt as ta,sn as ua,Bt as va,an as wa,Mn as xa,gt as ya,Ae as za,Bn as Aa,yt as Ba,mt as Ca,Ve as Da,ft as Ea,Vt as Fa,At as Ga,ht as Ha,nt as Ia,He as Ja,Vn as Ka,Hn as La,Ln as Ma,rt as Na,vp as Oa,Pe as Pa,Q as Qa,Cr as Ra,ne as Sa,Le as Ta,bt as Ua,$n as Va,pe as Wa,qn as Xa,he as Ya,Ke as Za,$e as _a,Wt as $a,so as ab,uo as bb,Wn as cb,lo as db,aa as eb,H as fb,xe as gb,mo as hb,We as ib,ca as jb,jn as kb,Qn as lb,fo as mb,Ao as nb,vr as ob,Jn as pb,_r as qb,ua as rb,kr as sb,Fr as tb,Ur as ub,Dr as vb,Rr as wb,zr as xb,ho as yb,v as zb,bo as Ab,Zn as Bb,pa as Cb,Nr as Db,zy as Eb,wo as Fb,To as Gb,Gr as Hb,wt as Ib,Xn as Jb,ya as Kb,So as Lb,ma as Mb,Aa as Nb,ha as Ob,Mr as Pb,Po as Qb,jt as Rb,Br as Sb,Ko as Tb,um as Ub,f as Vb,Ta as Wb,Sa as Xb,Co as Yb,er as Zb,tr as _b,Vr as $b,dn as ac,it as bc,Io as cc,Eo as dc,Qt as ec,vo as fc,_o as gc,Yn as hc,Lr as ic,qr as jc,ko as kc,$r as lc,Jt as mc,Fo as nc,Uo as oc,Do as pc,Ro as qc,zo as rc,_f as sc,Wr as tc,Oo as uc,jr as vc,No as wc,kf as xc,Mo as yc,rr as zc,Qr as Ac,re as Bc,Bo as Cc,Vo as Dc,Ho as Ec,Lo as Fc,Tt as Gc,pn as Hc,qo as Ic,gn as Jc,$o as Kc,Wo as Lc,jo as Mc,Qo as Nc,Jo as Oc,Zt as Pc,Zo as Qc,Yo as Rc,Xo as Sc,es as Tc,ts as Uc,ns as Vc,rs as Wc,is as Xc,os as Yc,ss as Zc,as as _c,cs as $c,us as ad,ds as bd,ps as cd,ls as dd,gs as ed,ys as fd,yn as gd,fs as hd,mn as id,ir as jd,As as kd,hs as ld,ws as md,Ts as nd,fn as od,An as pd,Ss as qd,Ps as rd,st as sd,Ja as td,Ks as ud,Nh as vd,Za as wd,xs as xd,Cs as yd,Zr as zd,Is as Ad,Es as Bd,vs as Cd,_s as Dd,ks as Ed,Fs as Fd,Us as Gd,Ds as Hd,Rs as Id,zs as Jd,bn as Kd,Os as Ld,Ns as Md,Gs as Nd,wn as Od,sr as Pd,Yt as Qd,ar as Rd,cr as Sd,Ms as Td,Bs as Ud,ur as Vd,dr as Wd,Tn as Xd,pr as Yd,Xr as Zd,Vs as _d,Hs as $d,Sn as ae,rc as be,Ls as ce,Pn as de,j as ee};
6
+ //# sourceMappingURL=chunk-55Q7BSZT.mjs.map