@aptos-labs/ts-sdk 5.0.0 → 5.1.1-side-effect-free.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 (547) hide show
  1. package/dist/common/{account-BDwBREvt.d.ts → account-Dr4y1uZG.d.ts} +8 -2
  2. package/dist/common/chunk-AWFAHZSB.js +4 -0
  3. package/dist/common/{chunk-6MMUUJHX.js.map → chunk-AWFAHZSB.js.map} +1 -1
  4. package/dist/common/cli/index.d.ts +1 -1
  5. package/dist/common/cli/index.js +1 -1
  6. package/dist/common/cli/index.js.map +1 -1
  7. package/dist/common/index.d.ts +339 -10
  8. package/dist/common/index.js +33 -33
  9. package/dist/common/index.js.map +1 -1
  10. package/dist/esm/{Ed25519Account-8ETkcAk_.d.mts → Ed25519Account-CPwej6wB.d.mts} +1 -1
  11. package/dist/esm/account/AbstractKeylessAccount.d.mts +3 -3
  12. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  13. package/dist/esm/account/AbstractKeylessAccount.mjs.map +1 -1
  14. package/dist/esm/account/AbstractedAccount.d.mts +2 -2
  15. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  16. package/dist/esm/account/AbstractedAccount.mjs.map +1 -1
  17. package/dist/esm/account/Account.d.mts +2 -2
  18. package/dist/esm/account/Account.mjs +1 -1
  19. package/dist/esm/account/Account.mjs.map +1 -1
  20. package/dist/esm/account/AccountUtils.d.mts +3 -3
  21. package/dist/esm/account/AccountUtils.mjs +1 -1
  22. package/dist/esm/account/AccountUtils.mjs.map +1 -1
  23. package/dist/esm/account/DerivableAbstractedAccount.d.mts +2 -2
  24. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  25. package/dist/esm/account/DerivableAbstractedAccount.mjs.map +1 -1
  26. package/dist/esm/account/Ed25519Account.d.mts +2 -2
  27. package/dist/esm/account/Ed25519Account.mjs +1 -1
  28. package/dist/esm/account/Ed25519Account.mjs.map +1 -1
  29. package/dist/esm/account/EphemeralKeyPair.d.mts +1 -1
  30. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  31. package/dist/esm/account/EphemeralKeyPair.mjs.map +1 -1
  32. package/dist/esm/account/FederatedKeylessAccount.d.mts +3 -3
  33. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  34. package/dist/esm/account/FederatedKeylessAccount.mjs.map +1 -1
  35. package/dist/esm/account/KeylessAccount.d.mts +3 -3
  36. package/dist/esm/account/KeylessAccount.mjs +1 -1
  37. package/dist/esm/account/KeylessAccount.mjs.map +1 -1
  38. package/dist/esm/account/MultiEd25519Account.d.mts +2 -2
  39. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  40. package/dist/esm/account/MultiEd25519Account.mjs.map +1 -1
  41. package/dist/esm/account/MultiKeyAccount.d.mts +3 -3
  42. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  43. package/dist/esm/account/MultiKeyAccount.mjs.map +1 -1
  44. package/dist/esm/account/SingleKeyAccount.d.mts +2 -2
  45. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  46. package/dist/esm/account/SingleKeyAccount.mjs.map +1 -1
  47. package/dist/esm/account/index.d.mts +3 -3
  48. package/dist/esm/account/index.mjs +1 -1
  49. package/dist/esm/account/index.mjs.map +1 -1
  50. package/dist/esm/account/utils.d.mts +1 -1
  51. package/dist/esm/account/utils.mjs +1 -1
  52. package/dist/esm/account/utils.mjs.map +1 -1
  53. package/dist/esm/{account-ClxOwjdh.d.mts → account-BortO8g2.d.mts} +6 -1
  54. package/dist/esm/api/account/abstraction.d.mts +1 -1
  55. package/dist/esm/api/account/abstraction.mjs +1 -1
  56. package/dist/esm/api/account/abstraction.mjs.map +1 -1
  57. package/dist/esm/api/account.d.mts +30 -9
  58. package/dist/esm/api/account.mjs +1 -1
  59. package/dist/esm/api/account.mjs.map +1 -1
  60. package/dist/esm/api/ans.d.mts +2 -2
  61. package/dist/esm/api/ans.mjs +1 -1
  62. package/dist/esm/api/ans.mjs.map +1 -1
  63. package/dist/esm/api/aptos.d.mts +3 -3
  64. package/dist/esm/api/aptos.mjs +1 -1
  65. package/dist/esm/api/aptos.mjs.map +1 -1
  66. package/dist/esm/api/aptosConfig.d.mts +1 -1
  67. package/dist/esm/api/aptosConfig.mjs +1 -1
  68. package/dist/esm/api/aptosConfig.mjs.map +1 -1
  69. package/dist/esm/api/coin.d.mts +1 -1
  70. package/dist/esm/api/coin.mjs +1 -1
  71. package/dist/esm/api/coin.mjs.map +1 -1
  72. package/dist/esm/api/digitalAsset.d.mts +2 -2
  73. package/dist/esm/api/digitalAsset.mjs +1 -1
  74. package/dist/esm/api/digitalAsset.mjs.map +1 -1
  75. package/dist/esm/api/faucet.d.mts +1 -1
  76. package/dist/esm/api/faucet.mjs +1 -1
  77. package/dist/esm/api/faucet.mjs.map +1 -1
  78. package/dist/esm/api/fungibleAsset.d.mts +2 -2
  79. package/dist/esm/api/fungibleAsset.mjs +1 -1
  80. package/dist/esm/api/fungibleAsset.mjs.map +1 -1
  81. package/dist/esm/api/general.d.mts +1 -1
  82. package/dist/esm/api/general.mjs +1 -1
  83. package/dist/esm/api/general.mjs.map +1 -1
  84. package/dist/esm/api/index.d.mts +3 -3
  85. package/dist/esm/api/index.mjs +1 -1
  86. package/dist/esm/api/index.mjs.map +1 -1
  87. package/dist/esm/api/keyless.d.mts +3 -3
  88. package/dist/esm/api/keyless.mjs +1 -1
  89. package/dist/esm/api/keyless.mjs.map +1 -1
  90. package/dist/esm/api/object.d.mts +1 -1
  91. package/dist/esm/api/object.mjs +1 -1
  92. package/dist/esm/api/object.mjs.map +1 -1
  93. package/dist/esm/api/staking.d.mts +1 -1
  94. package/dist/esm/api/staking.mjs +1 -1
  95. package/dist/esm/api/staking.mjs.map +1 -1
  96. package/dist/esm/api/table.d.mts +1 -1
  97. package/dist/esm/api/table.mjs +1 -1
  98. package/dist/esm/api/table.mjs.map +1 -1
  99. package/dist/esm/api/transaction.d.mts +2 -2
  100. package/dist/esm/api/transaction.mjs +1 -1
  101. package/dist/esm/api/transaction.mjs.map +1 -1
  102. package/dist/esm/api/transactionSubmission/build.d.mts +1 -1
  103. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  104. package/dist/esm/api/transactionSubmission/build.mjs.map +1 -1
  105. package/dist/esm/api/transactionSubmission/helpers.d.mts +1 -1
  106. package/dist/esm/api/transactionSubmission/helpers.mjs +1 -1
  107. package/dist/esm/api/transactionSubmission/helpers.mjs.map +1 -1
  108. package/dist/esm/api/transactionSubmission/management.d.mts +2 -2
  109. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  110. package/dist/esm/api/transactionSubmission/management.mjs.map +1 -1
  111. package/dist/esm/api/transactionSubmission/sign.d.mts +2 -2
  112. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  113. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -1
  114. package/dist/esm/api/transactionSubmission/simulate.d.mts +1 -1
  115. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  116. package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -1
  117. package/dist/esm/api/transactionSubmission/submit.d.mts +1 -1
  118. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  119. package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -1
  120. package/dist/esm/api/utils.d.mts +1 -1
  121. package/dist/esm/api/utils.mjs +1 -1
  122. package/dist/esm/api/utils.mjs.map +1 -1
  123. package/dist/esm/bcs/consts.d.mts +1 -1
  124. package/dist/esm/bcs/consts.mjs +1 -1
  125. package/dist/esm/bcs/consts.mjs.map +1 -1
  126. package/dist/esm/bcs/deserializer.d.mts +1 -1
  127. package/dist/esm/bcs/deserializer.mjs +1 -1
  128. package/dist/esm/bcs/deserializer.mjs.map +1 -1
  129. package/dist/esm/bcs/index.d.mts +1 -1
  130. package/dist/esm/bcs/index.mjs +1 -1
  131. package/dist/esm/bcs/index.mjs.map +1 -1
  132. package/dist/esm/bcs/serializable/entryFunctionBytes.d.mts +1 -1
  133. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  134. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs.map +1 -1
  135. package/dist/esm/bcs/serializable/fixedBytes.d.mts +1 -1
  136. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  137. package/dist/esm/bcs/serializable/fixedBytes.mjs.map +1 -1
  138. package/dist/esm/bcs/serializable/movePrimitives.d.mts +1 -1
  139. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  140. package/dist/esm/bcs/serializable/movePrimitives.mjs.map +1 -1
  141. package/dist/esm/bcs/serializable/moveStructs.d.mts +1 -1
  142. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  143. package/dist/esm/bcs/serializable/moveStructs.mjs.map +1 -1
  144. package/dist/esm/bcs/serializer.d.mts +1 -1
  145. package/dist/esm/bcs/serializer.mjs +1 -1
  146. package/dist/esm/bcs/serializer.mjs.map +1 -1
  147. package/dist/esm/cli/index.d.mts +1 -1
  148. package/dist/esm/cli/index.mjs +1 -1
  149. package/dist/esm/cli/index.mjs.map +1 -1
  150. package/dist/esm/cli/localNode.mjs +1 -1
  151. package/dist/esm/cli/localNode.mjs.map +1 -1
  152. package/dist/esm/cli/move.d.mts +1 -1
  153. package/dist/esm/cli/move.mjs +1 -1
  154. package/dist/esm/cli/move.mjs.map +1 -1
  155. package/dist/esm/client/core.d.mts +1 -1
  156. package/dist/esm/client/core.mjs +1 -1
  157. package/dist/esm/client/core.mjs.map +1 -1
  158. package/dist/esm/client/get.d.mts +1 -1
  159. package/dist/esm/client/get.mjs +1 -1
  160. package/dist/esm/client/get.mjs.map +1 -1
  161. package/dist/esm/client/index.d.mts +1 -1
  162. package/dist/esm/client/index.mjs +1 -1
  163. package/dist/esm/client/index.mjs.map +1 -1
  164. package/dist/esm/client/post.d.mts +1 -1
  165. package/dist/esm/client/post.mjs +1 -1
  166. package/dist/esm/client/post.mjs.map +1 -1
  167. package/dist/esm/core/account/index.d.mts +2 -2
  168. package/dist/esm/core/account/index.mjs +1 -1
  169. package/dist/esm/core/account/index.mjs.map +1 -1
  170. package/dist/esm/core/account/utils/address.d.mts +13 -2
  171. package/dist/esm/core/account/utils/address.mjs +1 -1
  172. package/dist/esm/core/account/utils/address.mjs.map +1 -1
  173. package/dist/esm/core/account/utils/index.d.mts +2 -2
  174. package/dist/esm/core/account/utils/index.mjs +1 -1
  175. package/dist/esm/core/account/utils/index.mjs.map +1 -1
  176. package/dist/esm/core/accountAddress.d.mts +1 -1
  177. package/dist/esm/core/accountAddress.mjs +3 -1
  178. package/dist/esm/core/accountAddress.mjs.map +1 -1
  179. package/dist/esm/core/authenticationKey.d.mts +1 -1
  180. package/dist/esm/core/authenticationKey.mjs +1 -1
  181. package/dist/esm/core/authenticationKey.mjs.map +1 -1
  182. package/dist/esm/core/common.mjs +1 -1
  183. package/dist/esm/core/common.mjs.map +1 -1
  184. package/dist/esm/core/crypto/abstraction.d.mts +1 -1
  185. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  186. package/dist/esm/core/crypto/abstraction.mjs.map +1 -1
  187. package/dist/esm/core/crypto/deserializationUtils.d.mts +1 -1
  188. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  189. package/dist/esm/core/crypto/deserializationUtils.mjs.map +1 -1
  190. package/dist/esm/core/crypto/ed25519.d.mts +1 -1
  191. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  192. package/dist/esm/core/crypto/ed25519.mjs.map +1 -1
  193. package/dist/esm/core/crypto/ephemeral.d.mts +1 -1
  194. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  195. package/dist/esm/core/crypto/ephemeral.mjs.map +1 -1
  196. package/dist/esm/core/crypto/federatedKeyless.d.mts +2 -2
  197. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  198. package/dist/esm/core/crypto/federatedKeyless.mjs.map +1 -1
  199. package/dist/esm/core/crypto/hdKey.mjs +1 -1
  200. package/dist/esm/core/crypto/hdKey.mjs.map +1 -1
  201. package/dist/esm/core/crypto/index.d.mts +3 -2
  202. package/dist/esm/core/crypto/index.mjs +1 -1
  203. package/dist/esm/core/crypto/index.mjs.map +1 -1
  204. package/dist/esm/core/crypto/keyless.d.mts +2 -2
  205. package/dist/esm/core/crypto/keyless.mjs +1 -1
  206. package/dist/esm/core/crypto/keyless.mjs.map +1 -1
  207. package/dist/esm/core/crypto/multiEd25519.d.mts +1 -1
  208. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  209. package/dist/esm/core/crypto/multiEd25519.mjs.map +1 -1
  210. package/dist/esm/core/crypto/multiKey.d.mts +1 -1
  211. package/dist/esm/core/crypto/multiKey.mjs +3 -1
  212. package/dist/esm/core/crypto/multiKey.mjs.map +1 -1
  213. package/dist/esm/core/crypto/poseidon.mjs +1 -1
  214. package/dist/esm/core/crypto/poseidon.mjs.map +1 -1
  215. package/dist/esm/core/crypto/privateKey.d.mts +1 -1
  216. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  217. package/dist/esm/core/crypto/privateKey.mjs.map +1 -1
  218. package/dist/esm/core/crypto/proof.d.mts +1 -1
  219. package/dist/esm/core/crypto/proof.mjs +1 -1
  220. package/dist/esm/core/crypto/proof.mjs.map +1 -1
  221. package/dist/esm/core/crypto/publicKey.d.mts +1 -1
  222. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  223. package/dist/esm/core/crypto/publicKey.mjs.map +1 -1
  224. package/dist/esm/core/crypto/secp256k1.d.mts +1 -1
  225. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  226. package/dist/esm/core/crypto/secp256k1.mjs.map +1 -1
  227. package/dist/esm/core/crypto/secp256r1.d.mts +306 -0
  228. package/dist/esm/core/crypto/secp256r1.mjs +2 -0
  229. package/dist/esm/core/crypto/secp256r1.mjs.map +1 -0
  230. package/dist/esm/core/crypto/signature.d.mts +1 -1
  231. package/dist/esm/core/crypto/signature.mjs +1 -1
  232. package/dist/esm/core/crypto/signature.mjs.map +1 -1
  233. package/dist/esm/core/crypto/singleKey.d.mts +1 -1
  234. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  235. package/dist/esm/core/crypto/singleKey.mjs.map +1 -1
  236. package/dist/esm/core/crypto/types.d.mts +1 -1
  237. package/dist/esm/core/crypto/types.mjs +0 -1
  238. package/dist/esm/core/crypto/utils.d.mts +1 -1
  239. package/dist/esm/core/crypto/utils.mjs +1 -1
  240. package/dist/esm/core/crypto/utils.mjs.map +1 -1
  241. package/dist/esm/core/hex.d.mts +1 -1
  242. package/dist/esm/core/hex.mjs +1 -1
  243. package/dist/esm/core/hex.mjs.map +1 -1
  244. package/dist/esm/core/index.d.mts +4 -3
  245. package/dist/esm/core/index.mjs +1 -1
  246. package/dist/esm/core/index.mjs.map +1 -1
  247. package/dist/esm/errors/index.d.mts +1 -1
  248. package/dist/esm/errors/index.mjs +6 -1
  249. package/dist/esm/errors/index.mjs.map +1 -1
  250. package/dist/esm/{federatedKeyless-CUPEnP-W.d.mts → federatedKeyless-CTzDAQTu.d.mts} +1 -1
  251. package/dist/esm/index.d.mts +5 -4
  252. package/dist/esm/index.mjs +1 -1
  253. package/dist/esm/index.mjs.map +1 -1
  254. package/dist/esm/internal/abstraction.d.mts +1 -1
  255. package/dist/esm/internal/abstraction.mjs +1 -1
  256. package/dist/esm/internal/abstraction.mjs.map +1 -1
  257. package/dist/esm/internal/account.d.mts +21 -3
  258. package/dist/esm/internal/account.mjs +1 -1
  259. package/dist/esm/internal/account.mjs.map +1 -1
  260. package/dist/esm/internal/ans.d.mts +2 -2
  261. package/dist/esm/internal/ans.mjs +1 -1
  262. package/dist/esm/internal/ans.mjs.map +1 -1
  263. package/dist/esm/internal/coin.d.mts +1 -1
  264. package/dist/esm/internal/coin.mjs +1 -1
  265. package/dist/esm/internal/coin.mjs.map +1 -1
  266. package/dist/esm/internal/digitalAsset.d.mts +2 -2
  267. package/dist/esm/internal/digitalAsset.mjs +1 -1
  268. package/dist/esm/internal/digitalAsset.mjs.map +1 -1
  269. package/dist/esm/internal/faucet.d.mts +1 -1
  270. package/dist/esm/internal/faucet.mjs +1 -1
  271. package/dist/esm/internal/faucet.mjs.map +1 -1
  272. package/dist/esm/internal/fungibleAsset.d.mts +2 -2
  273. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  274. package/dist/esm/internal/fungibleAsset.mjs.map +1 -1
  275. package/dist/esm/internal/general.d.mts +1 -1
  276. package/dist/esm/internal/general.mjs +1 -1
  277. package/dist/esm/internal/general.mjs.map +1 -1
  278. package/dist/esm/internal/keyless.d.mts +3 -3
  279. package/dist/esm/internal/keyless.mjs +1 -1
  280. package/dist/esm/internal/keyless.mjs.map +1 -1
  281. package/dist/esm/internal/object.d.mts +1 -1
  282. package/dist/esm/internal/object.mjs +1 -1
  283. package/dist/esm/internal/object.mjs.map +1 -1
  284. package/dist/esm/internal/staking.d.mts +1 -1
  285. package/dist/esm/internal/staking.mjs +1 -1
  286. package/dist/esm/internal/staking.mjs.map +1 -1
  287. package/dist/esm/internal/table.d.mts +1 -1
  288. package/dist/esm/internal/table.mjs +1 -1
  289. package/dist/esm/internal/table.mjs.map +1 -1
  290. package/dist/esm/internal/transaction.d.mts +1 -1
  291. package/dist/esm/internal/transaction.mjs +1 -1
  292. package/dist/esm/internal/transaction.mjs.map +1 -1
  293. package/dist/esm/internal/transactionSubmission.d.mts +2 -2
  294. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  295. package/dist/esm/internal/transactionSubmission.mjs.map +1 -1
  296. package/dist/esm/internal/utils/index.d.mts +1 -1
  297. package/dist/esm/internal/utils/index.mjs +1 -1
  298. package/dist/esm/internal/utils/index.mjs.map +1 -1
  299. package/dist/esm/internal/utils/utils.d.mts +1 -1
  300. package/dist/esm/internal/utils/utils.mjs +1 -1
  301. package/dist/esm/internal/utils/utils.mjs.map +1 -1
  302. package/dist/esm/internal/view.d.mts +1 -1
  303. package/dist/esm/internal/view.mjs +1 -1
  304. package/dist/esm/internal/view.mjs.map +1 -1
  305. package/dist/esm/transactions/authenticator/account.d.mts +1 -1
  306. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  307. package/dist/esm/transactions/authenticator/account.mjs.map +1 -1
  308. package/dist/esm/transactions/authenticator/index.d.mts +1 -1
  309. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  310. package/dist/esm/transactions/authenticator/index.mjs.map +1 -1
  311. package/dist/esm/transactions/authenticator/transaction.d.mts +1 -1
  312. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  313. package/dist/esm/transactions/authenticator/transaction.mjs.map +1 -1
  314. package/dist/esm/transactions/index.d.mts +1 -1
  315. package/dist/esm/transactions/index.mjs +1 -1
  316. package/dist/esm/transactions/index.mjs.map +1 -1
  317. package/dist/esm/transactions/instances/chainId.d.mts +1 -1
  318. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  319. package/dist/esm/transactions/instances/chainId.mjs.map +1 -1
  320. package/dist/esm/transactions/instances/identifier.d.mts +1 -1
  321. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  322. package/dist/esm/transactions/instances/identifier.mjs.map +1 -1
  323. package/dist/esm/transactions/instances/index.d.mts +1 -1
  324. package/dist/esm/transactions/instances/index.mjs +1 -1
  325. package/dist/esm/transactions/instances/index.mjs.map +1 -1
  326. package/dist/esm/transactions/instances/moduleId.d.mts +1 -1
  327. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  328. package/dist/esm/transactions/instances/moduleId.mjs.map +1 -1
  329. package/dist/esm/transactions/instances/multiAgentTransaction.d.mts +1 -1
  330. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  331. package/dist/esm/transactions/instances/multiAgentTransaction.mjs.map +1 -1
  332. package/dist/esm/transactions/instances/rawTransaction.d.mts +1 -1
  333. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  334. package/dist/esm/transactions/instances/rawTransaction.mjs.map +1 -1
  335. package/dist/esm/transactions/instances/rotationProofChallenge.d.mts +1 -1
  336. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  337. package/dist/esm/transactions/instances/rotationProofChallenge.mjs.map +1 -1
  338. package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -1
  339. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  340. package/dist/esm/transactions/instances/signedTransaction.mjs.map +1 -1
  341. package/dist/esm/transactions/instances/simpleTransaction.d.mts +1 -1
  342. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  343. package/dist/esm/transactions/instances/simpleTransaction.mjs.map +1 -1
  344. package/dist/esm/transactions/instances/transactionArgument.d.mts +1 -1
  345. package/dist/esm/transactions/instances/transactionArgument.mjs +0 -1
  346. package/dist/esm/transactions/instances/transactionPayload.d.mts +1 -1
  347. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  348. package/dist/esm/transactions/instances/transactionPayload.mjs.map +1 -1
  349. package/dist/esm/transactions/management/accountSequenceNumber.d.mts +2 -2
  350. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  351. package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -1
  352. package/dist/esm/transactions/management/asyncQueue.mjs +1 -1
  353. package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -1
  354. package/dist/esm/transactions/management/index.d.mts +2 -2
  355. package/dist/esm/transactions/management/index.mjs +1 -1
  356. package/dist/esm/transactions/management/index.mjs.map +1 -1
  357. package/dist/esm/transactions/management/transactionWorker.d.mts +2 -2
  358. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  359. package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -1
  360. package/dist/esm/transactions/transactionBuilder/helpers.d.mts +1 -1
  361. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  362. package/dist/esm/transactions/transactionBuilder/helpers.mjs.map +1 -1
  363. package/dist/esm/transactions/transactionBuilder/index.d.mts +1 -1
  364. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  365. package/dist/esm/transactions/transactionBuilder/index.mjs.map +1 -1
  366. package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +1 -1
  367. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  368. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs.map +1 -1
  369. package/dist/esm/transactions/transactionBuilder/signingMessage.d.mts +1 -1
  370. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  371. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs.map +1 -1
  372. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +1 -1
  373. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  374. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs.map +1 -1
  375. package/dist/esm/transactions/typeTag/index.d.mts +1 -1
  376. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  377. package/dist/esm/transactions/typeTag/index.mjs.map +1 -1
  378. package/dist/esm/transactions/typeTag/parser.d.mts +1 -1
  379. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  380. package/dist/esm/transactions/typeTag/parser.mjs.map +1 -1
  381. package/dist/esm/transactions/types.d.mts +1 -1
  382. package/dist/esm/transactions/types.mjs +0 -1
  383. package/dist/esm/types/abstraction.mjs +1 -1
  384. package/dist/esm/types/abstraction.mjs.map +1 -1
  385. package/dist/esm/types/generated/queries.mjs +493 -1
  386. package/dist/esm/types/generated/queries.mjs.map +1 -1
  387. package/dist/esm/types/generated/types.mjs +1 -1
  388. package/dist/esm/types/generated/types.mjs.map +1 -1
  389. package/dist/esm/types/index.d.mts +1 -1
  390. package/dist/esm/types/index.mjs +1 -1
  391. package/dist/esm/types/index.mjs.map +1 -1
  392. package/dist/esm/types/indexer.mjs +0 -1
  393. package/dist/esm/types/types.d.mts +1 -1
  394. package/dist/esm/types/types.mjs +1 -1
  395. package/dist/esm/types/types.mjs.map +1 -1
  396. package/dist/esm/utils/apiEndpoints.d.mts +1 -0
  397. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  398. package/dist/esm/utils/apiEndpoints.mjs.map +1 -1
  399. package/dist/esm/utils/const.mjs +1 -1
  400. package/dist/esm/utils/const.mjs.map +1 -1
  401. package/dist/esm/utils/helpers.d.mts +1 -1
  402. package/dist/esm/utils/helpers.mjs +1 -1
  403. package/dist/esm/utils/helpers.mjs.map +1 -1
  404. package/dist/esm/utils/index.d.mts +1 -1
  405. package/dist/esm/utils/index.mjs +1 -1
  406. package/dist/esm/utils/index.mjs.map +1 -1
  407. package/dist/esm/utils/memoize.mjs +1 -1
  408. package/dist/esm/utils/memoize.mjs.map +1 -1
  409. package/dist/esm/utils/normalizeBundle.d.mts +1 -1
  410. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  411. package/dist/esm/utils/normalizeBundle.mjs.map +1 -1
  412. package/dist/esm/version.d.mts +1 -1
  413. package/dist/esm/version.mjs +1 -1
  414. package/dist/esm/version.mjs.map +1 -1
  415. package/package.json +40 -22
  416. package/src/api/account.ts +32 -7
  417. package/src/api/aptos.ts +25 -14
  418. package/src/core/account/utils/address.ts +22 -0
  419. package/src/core/crypto/index.ts +1 -0
  420. package/src/core/crypto/privateKey.ts +1 -0
  421. package/src/core/crypto/secp256k1.ts +9 -1
  422. package/src/core/crypto/secp256r1.ts +495 -0
  423. package/src/core/crypto/singleKey.ts +11 -0
  424. package/src/internal/account.ts +33 -0
  425. package/src/internal/ans.ts +1 -0
  426. package/src/types/types.ts +5 -0
  427. package/src/utils/apiEndpoints.ts +7 -0
  428. package/src/version.ts +1 -1
  429. package/dist/common/chunk-6MMUUJHX.js +0 -4
  430. package/dist/esm/chunk-35DKMW7Q.mjs +0 -2
  431. package/dist/esm/chunk-35DKMW7Q.mjs.map +0 -1
  432. package/dist/esm/chunk-4QMXOWHP.mjs +0 -1
  433. package/dist/esm/chunk-4QMXOWHP.mjs.map +0 -1
  434. package/dist/esm/chunk-4RXKALLC.mjs +0 -2
  435. package/dist/esm/chunk-4RXKALLC.mjs.map +0 -1
  436. package/dist/esm/chunk-4WPQQPUF.mjs +0 -1
  437. package/dist/esm/chunk-4WPQQPUF.mjs.map +0 -1
  438. package/dist/esm/chunk-56CNRT2K.mjs +0 -2
  439. package/dist/esm/chunk-56CNRT2K.mjs.map +0 -1
  440. package/dist/esm/chunk-5FI4545P.mjs +0 -2
  441. package/dist/esm/chunk-5FI4545P.mjs.map +0 -1
  442. package/dist/esm/chunk-5HXLZHDW.mjs +0 -1
  443. package/dist/esm/chunk-5HXLZHDW.mjs.map +0 -1
  444. package/dist/esm/chunk-6WDVDEQZ.mjs +0 -7
  445. package/dist/esm/chunk-6WDVDEQZ.mjs.map +0 -1
  446. package/dist/esm/chunk-7DQDJ2SA.mjs +0 -2
  447. package/dist/esm/chunk-7DQDJ2SA.mjs.map +0 -1
  448. package/dist/esm/chunk-7ECCT6PK.mjs +0 -1
  449. package/dist/esm/chunk-7ECCT6PK.mjs.map +0 -1
  450. package/dist/esm/chunk-A5L76YP7.mjs +0 -2
  451. package/dist/esm/chunk-A5L76YP7.mjs.map +0 -1
  452. package/dist/esm/chunk-B563XRSZ.mjs +0 -2
  453. package/dist/esm/chunk-B563XRSZ.mjs.map +0 -1
  454. package/dist/esm/chunk-C3Q23D22.mjs +0 -2
  455. package/dist/esm/chunk-C3Q23D22.mjs.map +0 -1
  456. package/dist/esm/chunk-CW35YAMN.mjs +0 -2
  457. package/dist/esm/chunk-CW35YAMN.mjs.map +0 -1
  458. package/dist/esm/chunk-DIGP2ALY.mjs +0 -4
  459. package/dist/esm/chunk-DIGP2ALY.mjs.map +0 -1
  460. package/dist/esm/chunk-DNRUDMMV.mjs +0 -2
  461. package/dist/esm/chunk-DNRUDMMV.mjs.map +0 -1
  462. package/dist/esm/chunk-EBMEXURY.mjs +0 -2
  463. package/dist/esm/chunk-EBMEXURY.mjs.map +0 -1
  464. package/dist/esm/chunk-EM52Z7T7.mjs +0 -2
  465. package/dist/esm/chunk-EM52Z7T7.mjs.map +0 -1
  466. package/dist/esm/chunk-ES2KP6BS.mjs +0 -2
  467. package/dist/esm/chunk-ES2KP6BS.mjs.map +0 -1
  468. package/dist/esm/chunk-FD6FGKYY.mjs +0 -1
  469. package/dist/esm/chunk-FD6FGKYY.mjs.map +0 -1
  470. package/dist/esm/chunk-FGFLPH5K.mjs +0 -2
  471. package/dist/esm/chunk-FGFLPH5K.mjs.map +0 -1
  472. package/dist/esm/chunk-FLZPUYXQ.mjs +0 -2
  473. package/dist/esm/chunk-FLZPUYXQ.mjs.map +0 -1
  474. package/dist/esm/chunk-FZY4PMEE.mjs +0 -1
  475. package/dist/esm/chunk-FZY4PMEE.mjs.map +0 -1
  476. package/dist/esm/chunk-G3MHXDYA.mjs +0 -1
  477. package/dist/esm/chunk-G3MHXDYA.mjs.map +0 -1
  478. package/dist/esm/chunk-GFFKEZ56.mjs +0 -2
  479. package/dist/esm/chunk-GFFKEZ56.mjs.map +0 -1
  480. package/dist/esm/chunk-GMQCQDW4.mjs +0 -2
  481. package/dist/esm/chunk-GMQCQDW4.mjs.map +0 -1
  482. package/dist/esm/chunk-GOXRBEIJ.mjs +0 -2
  483. package/dist/esm/chunk-GOXRBEIJ.mjs.map +0 -1
  484. package/dist/esm/chunk-HGLO5LDS.mjs +0 -1
  485. package/dist/esm/chunk-HGLO5LDS.mjs.map +0 -1
  486. package/dist/esm/chunk-HNBKTJPN.mjs +0 -2
  487. package/dist/esm/chunk-HNBKTJPN.mjs.map +0 -1
  488. package/dist/esm/chunk-HNBVYE3N.mjs +0 -2
  489. package/dist/esm/chunk-HNBVYE3N.mjs.map +0 -1
  490. package/dist/esm/chunk-IF4UU2MT.mjs +0 -2
  491. package/dist/esm/chunk-IF4UU2MT.mjs.map +0 -1
  492. package/dist/esm/chunk-IJE2LVZG.mjs +0 -2
  493. package/dist/esm/chunk-IJE2LVZG.mjs.map +0 -1
  494. package/dist/esm/chunk-KDMSOCZY.mjs +0 -2
  495. package/dist/esm/chunk-KDMSOCZY.mjs.map +0 -1
  496. package/dist/esm/chunk-LWL57YFU.mjs +0 -2
  497. package/dist/esm/chunk-LWL57YFU.mjs.map +0 -1
  498. package/dist/esm/chunk-MT2RJ7H3.mjs +0 -2
  499. package/dist/esm/chunk-MT2RJ7H3.mjs.map +0 -1
  500. package/dist/esm/chunk-N3O3ULF7.mjs +0 -2
  501. package/dist/esm/chunk-N3O3ULF7.mjs.map +0 -1
  502. package/dist/esm/chunk-N6YTF76Q.mjs +0 -2
  503. package/dist/esm/chunk-N6YTF76Q.mjs.map +0 -1
  504. package/dist/esm/chunk-NECL5FCQ.mjs +0 -1
  505. package/dist/esm/chunk-NECL5FCQ.mjs.map +0 -1
  506. package/dist/esm/chunk-OLILO7VD.mjs +0 -2
  507. package/dist/esm/chunk-OLILO7VD.mjs.map +0 -1
  508. package/dist/esm/chunk-ORMOQWWH.mjs +0 -2
  509. package/dist/esm/chunk-ORMOQWWH.mjs.map +0 -1
  510. package/dist/esm/chunk-Q4W3WJ2U.mjs +0 -2
  511. package/dist/esm/chunk-Q4W3WJ2U.mjs.map +0 -1
  512. package/dist/esm/chunk-QREVMGQZ.mjs +0 -2
  513. package/dist/esm/chunk-QREVMGQZ.mjs.map +0 -1
  514. package/dist/esm/chunk-RCSJFTST.mjs +0 -2
  515. package/dist/esm/chunk-RCSJFTST.mjs.map +0 -1
  516. package/dist/esm/chunk-RGKRCZ36.mjs +0 -4
  517. package/dist/esm/chunk-RGKRCZ36.mjs.map +0 -1
  518. package/dist/esm/chunk-ROT6S6BM.mjs +0 -2
  519. package/dist/esm/chunk-ROT6S6BM.mjs.map +0 -1
  520. package/dist/esm/chunk-RQX6JOEN.mjs +0 -2
  521. package/dist/esm/chunk-RQX6JOEN.mjs.map +0 -1
  522. package/dist/esm/chunk-STY74NUA.mjs +0 -2
  523. package/dist/esm/chunk-STY74NUA.mjs.map +0 -1
  524. package/dist/esm/chunk-TGRLDWXV.mjs +0 -2
  525. package/dist/esm/chunk-TGRLDWXV.mjs.map +0 -1
  526. package/dist/esm/chunk-TOBQ5UE6.mjs +0 -2
  527. package/dist/esm/chunk-TOBQ5UE6.mjs.map +0 -1
  528. package/dist/esm/chunk-UL777LTI.mjs +0 -494
  529. package/dist/esm/chunk-UL777LTI.mjs.map +0 -1
  530. package/dist/esm/chunk-UYVPNUH3.mjs +0 -1
  531. package/dist/esm/chunk-UYVPNUH3.mjs.map +0 -1
  532. package/dist/esm/chunk-V3MBJJTL.mjs +0 -1
  533. package/dist/esm/chunk-V3MBJJTL.mjs.map +0 -1
  534. package/dist/esm/chunk-V74WPKSY.mjs +0 -2
  535. package/dist/esm/chunk-V74WPKSY.mjs.map +0 -1
  536. package/dist/esm/chunk-WCMW2L3P.mjs +0 -2
  537. package/dist/esm/chunk-WCMW2L3P.mjs.map +0 -1
  538. package/dist/esm/chunk-WSR5EBJM.mjs +0 -2
  539. package/dist/esm/chunk-WSR5EBJM.mjs.map +0 -1
  540. package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
  541. package/dist/esm/chunk-XJJVJOX5.mjs.map +0 -1
  542. package/dist/esm/chunk-XKUIMGKU.mjs +0 -2
  543. package/dist/esm/chunk-XKUIMGKU.mjs.map +0 -1
  544. package/dist/esm/chunk-YOZBVVKL.mjs +0 -2
  545. package/dist/esm/chunk-YOZBVVKL.mjs.map +0 -1
  546. package/dist/esm/chunk-ZP4DWSQA.mjs +0 -2
  547. package/dist/esm/chunk-ZP4DWSQA.mjs.map +0 -1
@@ -1,11 +1,11 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunk6MMUUJHXjs = require('./chunk-6MMUUJHX.js');var v=class n{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let t=_chunk6MMUUJHXjs.j.hexInputToUint8Array(e);return new n(t)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}assertFinished(){if(this.remaining()!==0)throw new Error("Buffer has remaining bytes")}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,t){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(t===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(t)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<_chunk6MMUUJHXjs.d;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),(r&128)===0)break;t+=7}if(e>_chunk6MMUUJHXjs.d)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var Ce=class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.value=_chunk6MMUUJHXjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var er=class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.value=new Ce(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=Ce.deserialize(e,t);return new n(r.value)}};var F=class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.n.call(void 0, e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new we(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},X= exports.U8 =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.p.call(void 0, e,0,_chunk6MMUUJHXjs.b),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},ve= exports.U16 =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.p.call(void 0, e,0,_chunk6MMUUJHXjs.c),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},Ke= exports.U32 =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.p.call(void 0, e,0,_chunk6MMUUJHXjs.d),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},L= exports.U64 =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.p.call(void 0, e,BigInt(0),_chunk6MMUUJHXjs.e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Re= exports.U128 =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.p.call(void 0, e,BigInt(0),_chunk6MMUUJHXjs.f),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},we= exports.U256 =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),_chunk6MMUUJHXjs.p.call(void 0, e,BigInt(0),_chunk6MMUUJHXjs.g),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var S=class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof X)){new Tn(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=_chunk6MMUUJHXjs.j.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new X(r)))}static U16(e){return new n(e.map(t=>new ve(t)))}static U32(e){return new n(e.map(t=>new Ke(t)))}static U64(e){return new n(e.map(t=>new L(t)))}static U128(e){return new n(e.map(t=>new Re(t)))}static U256(e){return new n(e.map(t=>new we(t)))}static Bool(e){return new n(e.map(t=>new F(t)))}static MoveString(e){return new n(e.map(t=>new C(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},Tn= exports.Serialized =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.value=_chunk6MMUUJHXjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new v(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new S(r)}},C= exports.MoveString =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let r=new TextEncoder().encode(this.value);S.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},te= exports.MoveOption =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new S([e]):this.vec=new S([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new X(e):void 0)}static U16(e){return new n(e!=null?new ve(e):void 0)}static U32(e){return new n(e!=null?new Ke(e):void 0)}static U64(e){return new n(e!=null?new L(e):void 0)}static U128(e){return new n(e!=null?new Re(e):void 0)}static U256(e){return new n(e!=null?new we(e):void 0)}static Bool(e){return new n(e!=null?new F(e):void 0)}static MoveString(e){return new n(e!=null?new C(e):void 0)}static deserialize(e,t){let r=S.deserialize(e,t);return new n(r.values[0])}};var _sha3 = require('@noble/hashes/sha3');var mt=class mt extends _chunk6MMUUJHXjs.l{constructor(e){super();let{data:t}=e,r=_chunk6MMUUJHXjs.j.fromHexInput(t);if(r.toUint8Array().length!==mt.LENGTH)throw new Error(`Authentication Key length should be ${mt.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(mt.LENGTH);return new mt({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=_chunk6MMUUJHXjs.j.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new mt({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new (0, _chunk6MMUUJHXjs.ba)(this.data.toUint8Array())}};mt.LENGTH=32;var Q=mt;var It=class extends _chunk6MMUUJHXjs.l{async verifySignatureAsync(e){return this.verifySignature(e)}toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunk6MMUUJHXjs.j.fromHexInput(e).toString()}},ae= exports.AccountPublicKey =class extends It{};var M=class extends _chunk6MMUUJHXjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunk6MMUUJHXjs.j.fromHexInput(e).toString()}};var wn=class n extends M{constructor(e){super(),this.value=_chunk6MMUUJHXjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}static deserialize(e){return new n(e.deserializeBytes())}},tr= exports.AbstractPublicKey =class extends ae{constructor(e){super(),this.accountAddress=e}authKey(){return new Q({data:this.accountAddress.toUint8Array()})}verifySignature(e){throw new Error("This function is not implemented for AbstractPublicKey.")}async verifySignatureAsync(e){throw new Error("This function is not implemented for AbstractPublicKey.")}serialize(e){throw new Error("This function is not implemented for AbstractPublicKey.")}};var _ed25519 = require('@noble/curves/ed25519');var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Eo = _interopRequireWildcard(_bip39);var Ic=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Cc= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,vc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(vc||{}),xo= exports.HARDENED_OFFSET =2147483648;function Io(n){return Cc.test(n)}function Co(n){return Ic.test(n)}var ai=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},vo= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return ai(e,s)},Kc=n=>n.replace(/'/g,""),Ko= exports.splitPath =n=>n.split("/").slice(1).map(Kc),nr= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return Eo.mnemonicToSeedSync(e)};var Sn=class Sn{static formatPrivateKey(e,t){let r=Sn.AIP80_PREFIXES[t],i=e;return typeof i=="string"&&i.startsWith(r)&&(i=i.split("-")[2]),`${r}${_chunk6MMUUJHXjs.j.fromHexInput(i).toString()}`}static parseHexInput(e,t,r){let i,o=Sn.AIP80_PREFIXES[t];if(typeof e=="string")if(!r&&!e.startsWith(o))i=_chunk6MMUUJHXjs.j.fromHexInput(e),r!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(o))i=_chunk6MMUUJHXjs.j.fromHexString(e.split("-")[2]);else throw r?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else i=_chunk6MMUUJHXjs.j.fromHexInput(e);return i}};Sn.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var ft=Sn;var _jwtdecode = require('jwt-decode');var At=class n extends It{constructor(e){super();let t=e.constructor.name;switch(t){case _.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}async verifySignatureAsync(e){return this.verifySignature(e)}serialize(e){if(this.publicKey instanceof _)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(_.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},Me= exports.EphemeralSignature =class n extends M{constructor(e){super();let t=e.constructor.name;switch(t){case R.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=_chunk6MMUUJHXjs.j.fromHexInput(e),r=new v(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof R)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(R.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var ci=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],Uo=31,Wc=16,Ro=(Wc-1)*Uo;function Ve(n,e){let r=new TextEncoder().encode(n);return Qc(r,e)}function Qc(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Pn(n,e);return vt(t)}function jc(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=Yc(n,e);return Jc(t)}function Pn(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return jc(n,e).concat([BigInt(n.length)])}function Jc(n){if(n.length>Ro)throw new Error(`Can't pack more than ${Ro}. Was given ${n.length} bytes`);return Xc(n,Uo).map(e=>Ct(e))}function Xc(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Ct(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function ui(n,e){let t=BigInt(n),r=new Uint8Array(e);for(let i=0;i<e;i+=1)r[i]=Number(t&BigInt(255)),t>>=BigInt(8);return r}function Yc(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function vt(n){if(n.length>ci.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${ci.length}`);return ci[n.length-1](n)}var rr=class extends _chunk6MMUUJHXjs.l{};var ko="5.0.0";var zo={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},No= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Fo= exports.NetworkToFaucetAPI ={devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},di= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},pi= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},li= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(li||{}),gi= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Cl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var qt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(qt||{}),Do= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Oo= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,ir= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Kt= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Go= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",Bo= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",yi= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Mo= exports.ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT ="APTOS::AASigningData",ht= exports.ProcessorType =(d=>(d.ACCOUNT_RESTORATION_PROCESSOR="account_restoration_processor",d.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",d.DEFAULT="default_processor",d.EVENTS_PROCESSOR="events_processor",d.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",d.STAKE_PROCESSOR="stake_processor",d.TOKEN_V2_PROCESSOR="token_v2_processor",d.USER_TRANSACTION_PROCESSOR="user_transaction_processor",d.OBJECT_PROCESSOR="objects_processor",d))(ht||{}),Vo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function Ho(n,e){let t=e.bcsToBytes(),r=new v(t);return n.deserialize(r)}var Zc=(s=>(s[s.API_ERROR=0]="API_ERROR",s[s.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",s[s.SESSION_EXPIRED=2]="SESSION_EXPIRED",s[s.INVALID_STATE=3]="INVALID_STATE",s[s.INVALID_SIGNATURE=4]="INVALID_SIGNATURE",s[s.UNKNOWN=5]="UNKNOWN",s))(Zc||{}),eu= exports.KeylessErrorResolutionTip =(d=>(d.REAUTHENTICATE="Re-authentiate to continue using your keyless account",d.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",d.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",d.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",d.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",d.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",d.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",d))(eu||{}),or= exports.KeylessErrorType =(m=>(m[m.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",m[m.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",m[m.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",m[m.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",m[m.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",m[m.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",m[m.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",m[m.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",m[m.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",m[m.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",m[m.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",m[m.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",m[m.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",m[m.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",m[m.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",m[m.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",m[m.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",m[m.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",m[m.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",m[m.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",m[m.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",m[m.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",m[m.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",m[m.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",m[m.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",m[m.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",m[m.SIGNATURE_TYPE_INVALID=26]="SIGNATURE_TYPE_INVALID",m[m.SIGNATURE_EXPIRED=27]="SIGNATURE_EXPIRED",m[m.MAX_EXPIRY_HORIZON_EXCEEDED=28]="MAX_EXPIRY_HORIZON_EXCEEDED",m[m.EPHEMERAL_SIGNATURE_VERIFICATION_FAILED=29]="EPHEMERAL_SIGNATURE_VERIFICATION_FAILED",m[m.TRAINING_WHEELS_SIGNATURE_MISSING=30]="TRAINING_WHEELS_SIGNATURE_MISSING",m[m.TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED=31]="TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED",m[m.PROOF_VERIFICATION_FAILED=32]="PROOF_VERIFICATION_FAILED",m[m.UNKNOWN=33]="UNKNOWN",m))(or||{}),Lo={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["The signature is not a valid Keyless signature.",4,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],27:["The ephemeral key pair used to sign the message has expired.",4,"Re-authentiate to continue using your keyless account"],28:["The expiry horizon on the signature exceeds the maximum allowed value.",4,"Re-authentiate to continue using your keyless account"],29:["Failed to verify the ephemeral signature with the ephemeral public key.",4,"Re-authentiate to continue using your keyless account"],30:["The training wheels signature is missing but is required by the Keyless configuration.",4,"Re-authentiate to continue using your keyless account"],31:["Failed to verify the training wheels signature with the training wheels public key.",4,"Re-authentiate to continue using your keyless account"],32:["The proof verification failed.",4,"Re-authentiate to continue using your keyless account"],33:["An unknown error has occurred.",5,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},E= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=Lo[o][0],details:a}=e;super(s),this.name="KeylessError",this.innerError=t,this.category=r,this.resolutionTip=i,this.type=o,this.details=a,this.message=n.constructMessage(s,i,t,a)}static constructMessage(e,t,r,i){let o=`
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunkAWFAHZSBjs = require('./chunk-AWFAHZSB.js');var v=class n{constructor(e){this.buffer=new ArrayBuffer(e.length),new Uint8Array(this.buffer).set(e,0),this.offset=0}static fromHex(e){let t=_chunkAWFAHZSBjs.j.hexInputToUint8Array(e);return new n(t)}read(e){if(this.offset+e>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let t=this.buffer.slice(this.offset,this.offset+e);return this.offset+=e,t}remaining(){return this.buffer.byteLength-this.offset}assertFinished(){if(this.remaining()!==0)throw new Error("Buffer has remaining bytes")}deserializeStr(){let e=this.deserializeBytes();return new TextDecoder().decode(e)}deserializeOptionStr(){return this.deserializeOption("string")}deserializeOption(e,t){if(this.deserializeBool()){if(e==="string")return this.deserializeStr();if(e==="bytes")return this.deserializeBytes();if(e==="fixedBytes"){if(t===void 0)throw new Error("Fixed bytes length not provided");return this.deserializeFixedBytes(t)}return this.deserialize(e)}}deserializeBytes(){let e=this.deserializeUleb128AsU32();return new Uint8Array(this.read(e))}deserializeFixedBytes(e){return new Uint8Array(this.read(e))}deserializeBool(){let e=new Uint8Array(this.read(1))[0];if(e!==1&&e!==0)throw new Error("Invalid boolean value");return e===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let e=this.deserializeU32(),t=this.deserializeU32();return BigInt(BigInt(t)<<BigInt(32)|BigInt(e))}deserializeU128(){let e=this.deserializeU64(),t=this.deserializeU64();return BigInt(t<<BigInt(64)|e)}deserializeU256(){let e=this.deserializeU128(),t=this.deserializeU128();return BigInt(t<<BigInt(128)|e)}deserializeUleb128AsU32(){let e=BigInt(0),t=0;for(;e<_chunkAWFAHZSBjs.d;){let r=this.deserializeU8();if(e|=BigInt(r&127)<<BigInt(t),(r&128)===0)break;t+=7}if(e>_chunkAWFAHZSBjs.d)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(e)}deserialize(e){return e.deserialize(this)}deserializeVector(e){let t=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<t;i+=1)r.push(this.deserialize(e));return r}};var ve=class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.value=_chunkAWFAHZSBjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,t){let r=e.deserializeFixedBytes(t);return new n(r)}};var nr=class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.value=new ve(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,t){let r=ve.deserialize(e,t);return new n(r.value)}};var lc=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(lc||{}),gc= exports.TypeTagVariants =(d=>(d[d.Bool=0]="Bool",d[d.U8=1]="U8",d[d.U64=2]="U64",d[d.U128=3]="U128",d[d.Address=4]="Address",d[d.Signer=5]="Signer",d[d.Vector=6]="Vector",d[d.Struct=7]="Struct",d[d.U16=8]="U16",d[d.U32=9]="U32",d[d.U256=10]="U256",d[d.Reference=254]="Reference",d[d.Generic=255]="Generic",d))(gc||{}),yc= exports.ScriptTransactionArgumentVariants =(g=>(g[g.U8=0]="U8",g[g.U64=1]="U64",g[g.U128=2]="U128",g[g.Address=3]="Address",g[g.U8Vector=4]="U8Vector",g[g.Bool=5]="Bool",g[g.U16=6]="U16",g[g.U32=7]="U32",g[g.U256=8]="U256",g[g.Serialized=9]="Serialized",g))(yc||{}),mc= exports.TransactionPayloadVariants =(i=>(i[i.Script=0]="Script",i[i.EntryFunction=2]="EntryFunction",i[i.Multisig=3]="Multisig",i[i.Payload=4]="Payload",i))(mc||{}),fc= exports.TransactionInnerPayloadVariants =(e=>(e[e.V1=0]="V1",e))(fc||{}),Ac= exports.TransactionExecutableVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=1]="EntryFunction",r[r.Empty=2]="Empty",r))(Ac||{}),hc= exports.TransactionExtraConfigVariants =(e=>(e[e.V1=0]="V1",e))(hc||{}),bc= exports.TransactionVariants =(t=>(t[t.MultiAgentTransaction=0]="MultiAgentTransaction",t[t.FeePayerTransaction=1]="FeePayerTransaction",t))(bc||{}),Tc= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(Tc||{}),wc= exports.AccountAuthenticatorVariant =(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.SingleKey=2]="SingleKey",s[s.MultiKey=3]="MultiKey",s[s.NoAccountAuthenticator=4]="NoAccountAuthenticator",s[s.Abstraction=5]="Abstraction",s))(wc||{}),Sc= exports.PrivateKeyVariants =(r=>(r.Ed25519="ed25519",r.Secp256k1="secp256k1",r.Secp256r1="secp256r1",r))(Sc||{}),_c= exports.AnyPublicKeyVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.Secp256k1=1]="Secp256k1",o[o.Secp256r1=2]="Secp256r1",o[o.Keyless=3]="Keyless",o[o.FederatedKeyless=4]="FederatedKeyless",o))(_c||{});function ho(n){switch(n){case 0:return"ed25519";case 1:return"secp256k1";case 2:return"secp256r1";case 3:return"keyless";case 4:return"federated_keyless";default:throw new Error("Unknown public key variant")}}var Pc=(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.WebAuthn=2]="WebAuthn",i[i.Keyless=3]="Keyless",i))(Pc||{}),Ec= exports.EphemeralPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(Ec||{}),xc= exports.EphemeralSignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e))(xc||{}),Ic= exports.EphemeralCertificateVariant =(e=>(e[e.ZkProof=0]="ZkProof",e))(Ic||{}),Cc= exports.ZkpVariant =(e=>(e[e.Groth16=0]="Groth16",e))(Cc||{}),vc= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(vc||{});function fd(n){return n.type==="pending_transaction"}function Ad(n){return n.type==="user_transaction"}function hd(n){return n.type==="genesis_transaction"}function bd(n){return n.type==="block_metadata_transaction"}function Td(n){return n.type==="state_checkpoint_transaction"}function wd(n){return n.type==="validator_transaction"}function Sd(n){return n.type==="block_epilogue_transaction"}function _d(n){return"signature"in n&&n.type==="ed25519_signature"}function Pd(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Ed(n){return n.type==="multi_agent_signature"}function xd(n){return n.type==="fee_payer_signature"}function Id(n){return n.type==="multi_ed25519_signature"}function Cd(n){return n.type==="single_sender"}var Kc=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(Kc||{}),Rc= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(Rc||{}),Uc= exports.RoleType =(t=>(t.VALIDATOR="validator",t.FULL_NODE="full_node",t))(Uc||{}),oi= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(oi||{}),kc= exports.SigningSchemeInput =(t=>(t[t.Ed25519=0]="Ed25519",t[t.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",t))(kc||{}),Nc= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Nc||{});var D=class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.n.call(void 0, e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}deserialize(e){return new Te(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},Y= exports.U8 =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.p.call(void 0, e,0,_chunkAWFAHZSBjs.b),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},Ke= exports.U16 =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.p.call(void 0, e,0,_chunkAWFAHZSBjs.c),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},Re= exports.U32 =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.p.call(void 0, e,0,_chunkAWFAHZSBjs.d),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},$= exports.U64 =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.p.call(void 0, e,BigInt(0),_chunkAWFAHZSBjs.e),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},Ue= exports.U128 =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.p.call(void 0, e,BigInt(0),_chunkAWFAHZSBjs.f),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},Te= exports.U256 =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),_chunkAWFAHZSBjs.p.call(void 0, e,BigInt(0),_chunkAWFAHZSBjs.g),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var S=class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.values=e}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof Y)){new wn(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let t;if(Array.isArray(e)&&e.length===0)t=[];else if(Array.isArray(e)&&typeof e[0]=="number")t=e;else if(typeof e=="string"){let r=_chunkAWFAHZSBjs.j.fromHexInput(e);t=Array.from(r.toUint8Array())}else if(e instanceof Uint8Array)t=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(t.map(r=>new Y(r)))}static U16(e){return new n(e.map(t=>new Ke(t)))}static U32(e){return new n(e.map(t=>new Re(t)))}static U64(e){return new n(e.map(t=>new $(t)))}static U128(e){return new n(e.map(t=>new Ue(t)))}static U256(e){return new n(e.map(t=>new Te(t)))}static Bool(e){return new n(e.map(t=>new D(t)))}static MoveString(e){return new n(e.map(t=>new C(t)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,t){let r=e.deserializeUleb128AsU32(),i=new Array;for(let o=0;o<r;o+=1)i.push(t.deserialize(e));return new n(i)}},wn= exports.Serialized =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.value=_chunkAWFAHZSBjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}serializeForEntryFunction(e){this.serialize(e)}serializeForScriptFunction(e){e.serializeU32AsUleb128(9),this.serialize(e)}static deserialize(e){return new n(e.deserializeBytes())}toMoveVector(e){let t=new v(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new S(r)}},C= exports.MoveString =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}serializeForScriptFunction(e){let r=new TextEncoder().encode(this.value);S.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},te= exports.MoveOption =class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new S([e]):this.vec=new S([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let t=this.bcsToBytes();e.serializeBytes(t)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new Y(e):void 0)}static U16(e){return new n(e!=null?new Ke(e):void 0)}static U32(e){return new n(e!=null?new Re(e):void 0)}static U64(e){return new n(e!=null?new $(e):void 0)}static U128(e){return new n(e!=null?new Ue(e):void 0)}static U256(e){return new n(e!=null?new Te(e):void 0)}static Bool(e){return new n(e!=null?new D(e):void 0)}static MoveString(e){return new n(e!=null?new C(e):void 0)}static deserialize(e,t){let r=S.deserialize(e,t);return new n(r.values[0])}};var _sha3 = require('@noble/hashes/sha3');var At=class At extends _chunkAWFAHZSBjs.l{constructor(e){super();let{data:t}=e,r=_chunkAWFAHZSBjs.j.fromHexInput(t);if(r.toUint8Array().length!==At.LENGTH)throw new Error(`Authentication Key length should be ${At.LENGTH}`);this.data=r}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeFixedBytes(At.LENGTH);return new At({data:t})}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:t,input:r}=e,i=_chunkAWFAHZSBjs.j.fromHexInput(r).toUint8Array(),o=new Uint8Array([...i,t]),s=_sha3.sha3_256.create();s.update(o);let a=s.digest();return new At({data:a})}static fromPublicKeyAndScheme(e){let{publicKey:t}=e;return t.authKey()}static fromPublicKey(e){let{publicKey:t}=e;return t.authKey()}derivedAddress(){return new (0, _chunkAWFAHZSBjs.r)(this.data.toUint8Array())}};At.LENGTH=32;var H=At;var Ye=class extends _chunkAWFAHZSBjs.l{async verifySignatureAsync(e){return this.verifySignature(e)}toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkAWFAHZSBjs.j.fromHexInput(e).toString()}},se= exports.AccountPublicKey =class extends Ye{};var F=class extends _chunkAWFAHZSBjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunkAWFAHZSBjs.j.fromHexInput(e).toString()}};var Sn=class n extends F{constructor(e){super(),this.value=_chunkAWFAHZSBjs.j.fromHexInput(e).toUint8Array()}serialize(e){e.serializeBytes(this.value)}static deserialize(e){return new n(e.deserializeBytes())}},rr= exports.AbstractPublicKey =class extends se{constructor(e){super(),this.accountAddress=e}authKey(){return new H({data:this.accountAddress.toUint8Array()})}verifySignature(e){throw new Error("This function is not implemented for AbstractPublicKey.")}async verifySignatureAsync(e){throw new Error("This function is not implemented for AbstractPublicKey.")}serialize(e){throw new Error("This function is not implemented for AbstractPublicKey.")}};var _ed25519 = require('@noble/curves/ed25519');var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var bo = _interopRequireWildcard(_bip39);var Oc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Gc= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Mc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(Mc||{}),To= exports.HARDENED_OFFSET =2147483648;function wo(n){return Gc.test(n)}function So(n){return Oc.test(n)}var si=(n,e)=>{let t=_hmac.hmac.create(_sha512.sha512,n).update(e).digest();return{key:t.slice(0,32),chainCode:t.slice(32)}},_o= exports.CKDPriv =({key:n,chainCode:e},t)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,t);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return si(e,s)},Bc=n=>n.replace(/'/g,""),Po= exports.splitPath =n=>n.split("/").slice(1).map(Bc),ir= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return bo.mnemonicToSeedSync(e)};var _n=class _n{static formatPrivateKey(e,t){let r=_n.AIP80_PREFIXES[t],i=e;return typeof i=="string"&&i.startsWith(r)&&(i=i.split("-")[2]),`${r}${_chunkAWFAHZSBjs.j.fromHexInput(i).toString()}`}static parseHexInput(e,t,r){let i,o=_n.AIP80_PREFIXES[t];if(typeof e=="string")if(!r&&!e.startsWith(o))i=_chunkAWFAHZSBjs.j.fromHexInput(e),r!==!1&&console.warn("[Aptos SDK] It is recommended that private keys are AIP-80 compliant (https://github.com/aptos-foundation/AIPs/blob/main/aips/aip-80.md). You can fix the private key by formatting it with `PrivateKey.formatPrivateKey(privateKey: string, type: 'ed25519' | 'secp256k1'): string`.");else if(e.startsWith(o))i=_chunkAWFAHZSBjs.j.fromHexString(e.split("-")[2]);else throw r?new Error("Invalid HexString input while parsing private key. Must AIP-80 compliant string."):new Error("Invalid HexString input while parsing private key.");else i=_chunkAWFAHZSBjs.j.fromHexInput(e);return i}};_n.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-",secp256r1:"secp256r1-priv-"};var we=_n;var _jwtdecode = require('jwt-decode');var ht=class n extends Ye{constructor(e){super();let t=e.constructor.name;switch(t){case P.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${t}`)}}verifySignature(e){let{message:t,signature:r}=e;return this.publicKey.verifySignature({message:t,signature:r.signature})}async verifySignatureAsync(e){return this.verifySignature(e)}serialize(e){if(this.publicKey instanceof P)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}}static isPublicKey(e){return e instanceof n}},He= exports.EphemeralSignature =class n extends F{constructor(e){super();let t=e.constructor.name;switch(t){case R.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${t}`)}}static fromHex(e){let t=_chunkAWFAHZSBjs.j.fromHexInput(e),r=new v(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof R)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(R.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _poseidonlite = require('poseidon-lite');var ai=[_poseidonlite.poseidon1,_poseidonlite.poseidon2,_poseidonlite.poseidon3,_poseidonlite.poseidon4,_poseidonlite.poseidon5,_poseidonlite.poseidon6,_poseidonlite.poseidon7,_poseidonlite.poseidon8,_poseidonlite.poseidon9,_poseidonlite.poseidon10,_poseidonlite.poseidon11,_poseidonlite.poseidon12,_poseidonlite.poseidon13,_poseidonlite.poseidon14,_poseidonlite.poseidon15,_poseidonlite.poseidon16],xo=31,iu=16,Eo=(iu-1)*xo;function Ve(n,e){let r=new TextEncoder().encode(n);return ou(r,e)}function ou(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=Pn(n,e);return Ct(t)}function su(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=uu(n,e);return au(t)}function Pn(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return su(n,e).concat([BigInt(n.length)])}function au(n){if(n.length>Eo)throw new Error(`Can't pack more than ${Eo}. Was given ${n.length} bytes`);return cu(n,xo).map(e=>It(e))}function cu(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function It(n){let e=BigInt(0);for(let t=n.length-1;t>=0;t-=1)e=e<<BigInt(8)|BigInt(n[t]);return e}function ci(n,e){let t=BigInt(n),r=new Uint8Array(e);for(let i=0;i<e;i+=1)r[i]=Number(t&BigInt(255)),t>>=BigInt(8);return r}function uu(n,e){if(e<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let t=new Uint8Array(e);t.set(n);for(let r=n.length;r<e;r+=1)t[r]=0;return t}function Ct(n){if(n.length>ai.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${ai.length}`);return ai[n.length-1](n)}var or=class extends _chunkAWFAHZSBjs.l{};var Io="5.1.1";var Co={mainnet:"https://api.mainnet.aptoslabs.com/v1/graphql",testnet:"https://api.testnet.aptoslabs.com/v1/graphql",devnet:"https://api.devnet.aptoslabs.com/v1/graphql",shelbynet:"https://api.shelbynet.shelby.xyz/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},vo= exports.NetworkToNodeAPI ={mainnet:"https://api.mainnet.aptoslabs.com/v1",testnet:"https://api.testnet.aptoslabs.com/v1",devnet:"https://api.devnet.aptoslabs.com/v1",shelbynet:"https://api.shelbynet.shelby.xyz/v1",local:"http://127.0.0.1:8080/v1"},Ko= exports.NetworkToFaucetAPI ={devnet:"https://faucet.devnet.aptoslabs.com",shelbynet:"https://faucet.shelbynet.shelby.xyz",local:"http://127.0.0.1:8081"},ui= exports.NetworkToPepperAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/pepper/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/pepper/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",shelbynet:"https://api.devnet.aptoslabs.com/keyless/pepper/v0",local:"https://api.devnet.aptoslabs.com/keyless/pepper/v0"},pi= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://api.testnet.aptoslabs.com/keyless/prover/v0",devnet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",shelbynet:"https://api.devnet.aptoslabs.com/keyless/prover/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Ro= exports.Network =(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.SHELBYNET="shelbynet",s.LOCAL="local",s.CUSTOM="custom",s))(Ro||{}),di= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},_l= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",shelbynet:"shelbynet",local:"local",custom:"custom"};var pu=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(pu||{}),du= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,lu= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Uo= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Lt= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",ko= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",No= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",li= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",zo= exports.ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT ="APTOS::AASigningData",Do= exports.ProcessorType =(p=>(p.ACCOUNT_RESTORATION_PROCESSOR="account_restoration_processor",p.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",p.DEFAULT="default_processor",p.EVENTS_PROCESSOR="events_processor",p.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",p.STAKE_PROCESSOR="stake_processor",p.TOKEN_V2_PROCESSOR="token_v2_processor",p.USER_TRANSACTION_PROCESSOR="user_transaction_processor",p.OBJECT_PROCESSOR="objects_processor",p))(Do||{}),Fo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function Oo(n,e){let t=e.bcsToBytes(),r=new v(t);return n.deserialize(r)}var gu=(s=>(s[s.API_ERROR=0]="API_ERROR",s[s.EXTERNAL_API_ERROR=1]="EXTERNAL_API_ERROR",s[s.SESSION_EXPIRED=2]="SESSION_EXPIRED",s[s.INVALID_STATE=3]="INVALID_STATE",s[s.INVALID_SIGNATURE=4]="INVALID_SIGNATURE",s[s.UNKNOWN=5]="UNKNOWN",s))(gu||{}),yu= exports.KeylessErrorResolutionTip =(p=>(p.REAUTHENTICATE="Re-authentiate to continue using your keyless account",p.REAUTHENTICATE_UNSURE="Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support",p.UPDATE_REQUEST_PARAMS="Update the invalid request parameters and reauthenticate.",p.RATE_LIMIT_EXCEEDED="Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest.",p.SERVER_ERROR="Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",p.CALL_PRECHECK="Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing.",p.REINSTANTIATE="Try instantiating the account again. Avoid manipulating the account object directly",p.JOIN_SUPPORT_GROUP="For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",p.UNKNOWN="Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx",p))(yu||{}),sr= exports.KeylessErrorType =(m=>(m[m.EPHEMERAL_KEY_PAIR_EXPIRED=0]="EPHEMERAL_KEY_PAIR_EXPIRED",m[m.PROOF_NOT_FOUND=1]="PROOF_NOT_FOUND",m[m.ASYNC_PROOF_FETCH_FAILED=2]="ASYNC_PROOF_FETCH_FAILED",m[m.INVALID_PROOF_VERIFICATION_FAILED=3]="INVALID_PROOF_VERIFICATION_FAILED",m[m.INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND=4]="INVALID_PROOF_VERIFICATION_KEY_NOT_FOUND",m[m.INVALID_JWT_SIG=5]="INVALID_JWT_SIG",m[m.INVALID_JWT_JWK_NOT_FOUND=6]="INVALID_JWT_JWK_NOT_FOUND",m[m.INVALID_JWT_ISS_NOT_RECOGNIZED=7]="INVALID_JWT_ISS_NOT_RECOGNIZED",m[m.INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED=8]="INVALID_JWT_FEDERATED_ISS_NOT_SUPPORTED",m[m.INVALID_TW_SIG_VERIFICATION_FAILED=9]="INVALID_TW_SIG_VERIFICATION_FAILED",m[m.INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND=10]="INVALID_TW_SIG_PUBLIC_KEY_NOT_FOUND",m[m.INVALID_EXPIRY_HORIZON=11]="INVALID_EXPIRY_HORIZON",m[m.JWT_PARSING_ERROR=12]="JWT_PARSING_ERROR",m[m.JWK_FETCH_FAILED=13]="JWK_FETCH_FAILED",m[m.JWK_FETCH_FAILED_FEDERATED=14]="JWK_FETCH_FAILED_FEDERATED",m[m.RATE_LIMIT_EXCEEDED=15]="RATE_LIMIT_EXCEEDED",m[m.PEPPER_SERVICE_INTERNAL_ERROR=16]="PEPPER_SERVICE_INTERNAL_ERROR",m[m.PEPPER_SERVICE_BAD_REQUEST=17]="PEPPER_SERVICE_BAD_REQUEST",m[m.PEPPER_SERVICE_OTHER=18]="PEPPER_SERVICE_OTHER",m[m.PROVER_SERVICE_INTERNAL_ERROR=19]="PROVER_SERVICE_INTERNAL_ERROR",m[m.PROVER_SERVICE_BAD_REQUEST=20]="PROVER_SERVICE_BAD_REQUEST",m[m.PROVER_SERVICE_OTHER=21]="PROVER_SERVICE_OTHER",m[m.FULL_NODE_CONFIG_LOOKUP_ERROR=22]="FULL_NODE_CONFIG_LOOKUP_ERROR",m[m.FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR=23]="FULL_NODE_VERIFICATION_KEY_LOOKUP_ERROR",m[m.FULL_NODE_JWKS_LOOKUP_ERROR=24]="FULL_NODE_JWKS_LOOKUP_ERROR",m[m.FULL_NODE_OTHER=25]="FULL_NODE_OTHER",m[m.SIGNATURE_TYPE_INVALID=26]="SIGNATURE_TYPE_INVALID",m[m.SIGNATURE_EXPIRED=27]="SIGNATURE_EXPIRED",m[m.MAX_EXPIRY_HORIZON_EXCEEDED=28]="MAX_EXPIRY_HORIZON_EXCEEDED",m[m.EPHEMERAL_SIGNATURE_VERIFICATION_FAILED=29]="EPHEMERAL_SIGNATURE_VERIFICATION_FAILED",m[m.TRAINING_WHEELS_SIGNATURE_MISSING=30]="TRAINING_WHEELS_SIGNATURE_MISSING",m[m.TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED=31]="TRAINING_WHEELS_SIGNATURE_VERIFICATION_FAILED",m[m.PROOF_VERIFICATION_FAILED=32]="PROOF_VERIFICATION_FAILED",m[m.UNKNOWN=33]="UNKNOWN",m))(sr||{}),Go={0:["The ephemeral keypair has expired.",2,"Re-authentiate to continue using your keyless account"],1:["The required proof could not be found.",3,"Call `await account.checkKeylessAccountValidity()` to wait for asyncronous changes and check for account validity before signing or serializing."],2:["The required proof failed to fetch.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],3:["The provided proof is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],4:["The verification key used to authenticate was updated.",2,"Re-authentiate to continue using your keyless account"],5:["The JWK was found, but JWT failed verification",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],6:["The JWK required to verify the JWT could not be found. The JWK may have been rotated out.",2,"Re-authentiate to continue using your keyless account"],7:["The JWT issuer is not recognized.",3,"Update the invalid request parameters and reauthenticate."],8:["The JWT issuer is not supported by the Federated Keyless ",0,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],9:["The training wheels signature is invalid.",3,"Try re-authentiating. If the error persists join the telegram group at https://t.me/+h5CN-W35yUFiYzkx for further support"],10:["The public key used to verify the training wheels signature was not found.",2,"Re-authentiate to continue using your keyless account"],11:["The expiry horizon is invalid.",2,"Re-authentiate to continue using your keyless account"],13:["Failed to fetch JWKS.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],14:["Failed to fetch JWKS for Federated Keyless provider.",1,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],15:["Rate limit exceeded. Too many requests in a short period.",0,"Cache the keyless account and reuse it to avoid making too many requests. Keyless accounts are valid until either the EphemeralKeyPair expires, when the JWK is rotated, or when the proof verifying key is changed, whichever comes soonest."],16:["Internal error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],17:["Bad request sent to Pepper service.",0,"Update the invalid request parameters and reauthenticate."],18:["Unknown error from Pepper service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],19:["Internal error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],20:["Bad request sent to Prover service.",0,"Update the invalid request parameters and reauthenticate."],21:["Unknown error from Prover service.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],12:["Error when parsing JWT. This should never happen. Join https://t.me/+h5CN-W35yUFiYzkx for support",3,"Try instantiating the account again. Avoid manipulating the account object directly"],22:["Error when looking up on-chain keyless configuration.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],23:["Error when looking up on-chain verification key.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],24:["Error when looking up on-chain JWKS.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],25:["Unknown error from full node.",0,"Try again later. See aptosApiError error for more context. For additional support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],26:["The signature is not a valid Keyless signature.",4,"For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"],27:["The ephemeral key pair used to sign the message has expired.",4,"Re-authentiate to continue using your keyless account"],28:["The expiry horizon on the signature exceeds the maximum allowed value.",4,"Re-authentiate to continue using your keyless account"],29:["Failed to verify the ephemeral signature with the ephemeral public key.",4,"Re-authentiate to continue using your keyless account"],30:["The training wheels signature is missing but is required by the Keyless configuration.",4,"Re-authentiate to continue using your keyless account"],31:["Failed to verify the training wheels signature with the training wheels public key.",4,"Re-authentiate to continue using your keyless account"],32:["The proof verification failed.",4,"Re-authentiate to continue using your keyless account"],33:["An unknown error has occurred.",5,"Error unknown. For support join the telegram group at https://t.me/+h5CN-W35yUFiYzkx"]},E= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=Go[o][0],details:a}=e;super(s),this.name="KeylessError",this.innerError=t,this.category=r,this.resolutionTip=i,this.type=o,this.details=a,this.message=n.constructMessage(s,i,t,a)}static constructMessage(e,t,r,i){let o=`
2
2
  Message: ${e}`;return i&&(o+=`
3
3
  Details: ${i}`),r instanceof Se?o+=`
4
4
  AptosApiError: ${r.message}`:r!==void 0&&(o+=`
5
- Error: ${_chunk6MMUUJHXjs.ga.call(void 0, r)}`),o+=`
6
- KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,details:i}=e,[o,s,a]=Lo[r];return new n({message:o,details:i,innerError:t,category:s,resolutionTip:a,type:r})}},Se= exports.AptosApiError =class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(tu({apiType:e,aptosRequest:t,aptosResponse:r})),this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=t}};function tu({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _2 => _2.headers, 'optionalAccess', _3 => _3.traceparent, 'optionalAccess', _4 => _4.split, 'call', _5 => _5("-"), 'access', _6 => _6[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _7 => _7.data, 'optionalAccess', _8 => _8.errors, 'optionalAccess', _9 => _9[0], 'optionalAccess', _10 => _10.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _11 => _11.data, 'optionalAccess', _12 => _12.message])!=null&&_optionalChain([t, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${nu(t.data)}`}var mi=400;function nu(n){let e=JSON.stringify(n);return e.length<=mi?e:`truncated(original_size:${e.length}): ${e.slice(0,mi/2)}...${e.slice(-mi/2)}`}async function ru(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,d={..._optionalChain([a, 'optionalAccess', _15 => _15.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${ko}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _16 => _16.AUTH_TOKEN])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _17 => _17.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _18 => _18.API_KEY])&&(d.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _19 => _19.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:d,overrides:a})}async function sr(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await ru({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Se({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Se({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Se({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Se({apiType:t,aptosRequest:n,aptosResponse:a})}async function ar(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,d=e.getRequestUrl(c);return sr({url:d,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function q(n){let{aptosConfig:e}=n;return ar({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _20 => _20.clientConfig, 'optionalAccess', _21 => _21.HEADERS]),..._optionalChain([e, 'access', _22 => _22.fullnodeConfig, 'optionalAccess', _23 => _23.HEADERS])}}})}async function tg(n){return ar({...n,type:"Pepper"})}async function cr(n){let e=new Array(0),t,r=n.params;do{let i=await ar({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function fi(n){let e=new Array(0),t,r=n.params,i=r.limit;do{let{response:o,cursor:s}=await ur({...n});if(t=s,e.push(...o.data),_optionalChain([n, 'optionalAccess', _24 => _24.params])&&(n.params.start=t),i!==void 0){let a=i-e.length;if(a<=0)break;r.limit=a}}while(t!=null);return e}async function ur(n){let e,t={};typeof _optionalChain([n, 'access', _25 => _25.params, 'optionalAccess', _26 => _26.cursor])=="string"&&(t.start=n.params.cursor),typeof _optionalChain([n, 'access', _27 => _27.params, 'optionalAccess', _28 => _28.limit])=="number"&&(t.limit=n.params.limit);let r=await ar({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:t,overrides:n.overrides});return e=r.headers["x-aptos-cursor"],{response:r,cursor:e}}async function _n(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:d}=n,g=c.getRequestUrl(e);return sr({url:g,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:d},c,n.type)}async function bt(n){let{aptosConfig:e}=n;return _n({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _29 => _29.clientConfig, 'optionalAccess', _30 => _30.HEADERS]),..._optionalChain([e, 'access', _31 => _31.fullnodeConfig, 'optionalAccess', _32 => _32.HEADERS])}}})}async function qo(n){let{aptosConfig:e}=n;return _n({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _33 => _33.clientConfig, 'optionalAccess', _34 => _34.HEADERS]),..._optionalChain([e, 'access', _35 => _35.indexerConfig, 'optionalAccess', _36 => _36.HEADERS])}}})}async function $o(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _37 => _37.clientConfig, 'optionalAccess', _38 => delete _38.API_KEY]),_n({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _39 => _39.clientConfig, 'optionalAccess', _40 => _40.HEADERS]),..._optionalChain([t, 'access', _41 => _41.faucetConfig, 'optionalAccess', _42 => _42.HEADERS])}}})}async function Wo(n){return _n({...n,type:"Pepper"})}async function Qo(n){return _n({...n,type:"Prover"})}var Ai=new Map;function He(n,e,t){return async(...r)=>{if(Ai.has(e)){let{value:o,timestamp:s}=Ai.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return Ai.set(e,{value:i,timestamp:Date.now()}),i}}var _bn254 = require('@noble/curves/bn254');var _utils = require('@noble/curves/abstract/utils');var _jsbase64 = require('js-base64');var au=1e7,hi= exports.MAX_AUD_VAL_BYTES =120,cu= exports.MAX_UID_KEY_BYTES =30,uu= exports.MAX_UID_VAL_BYTES =330,du= exports.MAX_ISS_VAL_BYTES =120,pu= exports.MAX_EXTRA_FIELD_BYTES =350,lu= exports.MAX_JWT_HEADER_B64_BYTES =300,gu= exports.MAX_COMMITED_EPK_BYTES =93,Le=class Le extends ae{constructor(e,t){super();let r=_chunk6MMUUJHXjs.j.fromHexInput(t).toUint8Array();if(r.length!==Le.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Le.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new _chunk6MMUUJHXjs.m;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),Q.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){try{return dr({...e,publicKey:this}),!0}catch(t){if(t instanceof E)return!1;throw t}}async verifySignatureAsync(e){return _i({...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 Le(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new Le(t,r)}static isPublicKey(e){return e instanceof Le}static create(e){return jo(e),new Le(e.iss,jo(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, 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 Le.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}};Le.ID_COMMITMENT_LENGTH=32;var K=Le;async function _i(n){let{aptosConfig:e,publicKey:t,message:r,signature:i,jwk:o,keylessConfig:s=await Qt({aptosConfig:e}),options:a}=n;try{if(!(i instanceof ce))throw E.fromErrorType({type:26,details:"Not a keyless signature"});return dr({message:r,publicKey:t,signature:i,jwk:o||await Ei({aptosConfig:e,publicKey:t,kid:i.getJwkKid()}),keylessConfig:s}),!0}catch(c){if(_optionalChain([a, 'optionalAccess', _43 => _43.throwErrorWithReason]))throw c;return!1}}function dr(n){let{publicKey:e,message:t,signature:r,keylessConfig:i,jwk:o}=n,{verificationKey:s,maxExpHorizonSecs:a,trainingWheelsPubkey:c}=i;if(!(r instanceof ce))throw E.fromErrorType({type:26,details:"Not a keyless signature"});if(!(r.ephemeralCertificate.signature instanceof me))throw E.fromErrorType({type:26,details:"Unsupported ephemeral certificate variant"});let d=r.ephemeralCertificate.signature;if(!(d.proof.proof instanceof Tt))throw E.fromErrorType({type:26,details:"Unsupported proof variant for ZeroKnowledgeSig"});let g=d.proof.proof;if(r.expiryDateSecs<_chunk6MMUUJHXjs.ha.call(void 0, ))throw E.fromErrorType({type:27,details:"The expiryDateSecs is in the past"});if(d.expHorizonSecs>a)throw E.fromErrorType({type:28});if(!r.ephemeralPublicKey.verifySignature({message:t,signature:r.ephemeralSignature}))throw E.fromErrorType({type:29});let A=yu({publicKey:e,signature:r,jwk:o,keylessConfig:i});if(!s.verifyProof({publicInputsHash:A,groth16Proof:g}))throw E.fromErrorType({type:32});if(c){if(!d.trainingWheelsSignature)throw E.fromErrorType({type:30});let p=new Ti(g,A);if(!c.verifySignature({message:p.hash(),signature:d.trainingWheelsSignature}))throw E.fromErrorType({type:31})}}function yu(n){let{publicKey:e,signature:t,jwk:r,keylessConfig:i}=n,o=e instanceof K?e:e.keylessPublicKey;if(!(t.ephemeralCertificate.signature instanceof me))throw new Error("Signature is not a ZeroKnowledgeSig");let s=t.ephemeralCertificate.signature,a=[];return a.push(...Pn(t.ephemeralPublicKey.toUint8Array(),i.maxCommitedEpkBytes)),a.push(Ct(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(_jsbase64.encode.call(void 0, t.jwtHeader,!0)+".",i.maxJwtHeaderB64Bytes)),a.push(r.toScalar()),s.overrideAudVal?(a.push(Ve(s.overrideAudVal,hi)),a.push(1n)):(a.push(Ve("",hi)),a.push(0n)),vt(a)}async function Ei(n){let{aptosConfig:e,publicKey:t,kid:r}=n,i=t instanceof K?t:t.keylessPublicKey,{iss:o}=i,s,a=t instanceof V?t.jwkAddress:void 0;try{s=await Au({aptosConfig:e,jwkAddr:a})}catch(g){throw E.fromErrorType({type:24,error:g,details:`Failed to fetch ${a?"Federated":"Patched"}JWKs ${a?`for address ${a}`:"0x1"}`})}let c=s.get(o);if(c===void 0)throw E.fromErrorType({type:7,details:`JWKs for issuer ${o} not found.`});let d=c.find(g=>g.kid===r);if(d===void 0)throw E.fromErrorType({type:6,details:`JWK with kid '${r}' for issuer '${o}' not found.`});return d}function jo(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[Ct(_chunk6MMUUJHXjs.j.fromHexInput(i).toUint8Array()),Ve(r,hi),Ve(t,uu),Ve(e,cu)];return ui(vt(o),K.ID_COMMITMENT_LENGTH)}var ce=class n extends M{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 bu(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=$t.deserialize(e),r=e.deserializeStr(),i=e.deserializeU64(),o=At.deserialize(e),s=Me.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new $t(new me({proof:new Wt(new Tt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new At(new _(new Uint8Array(32))),ephemeralSignature:new Me(new R(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},$t= exports.EphemeralCertificate =class n extends M{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(me.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},En=class En extends _chunk6MMUUJHXjs.l{constructor(e){if(super(),this.data=_chunk6MMUUJHXjs.j.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 En(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}=_bn254.bn254.fields,i=r.create(bi(e)),o=r.sqrt(r.add(r.pow(i,3n),En.B)),s=r.neg(o),a=o>s==(t===1)?o:s;return _bn254.bn254.G1.ProjectivePoint.fromAffine({x:i,y:a})}};En.B=_bn254.bn254.fields.Fp.create(3n);var Xe=En;function bi(n){if(n.length!==32)throw new Error("Input should be 32 bytes");let e=new Uint8Array(n);return e[0]=e[0]&63,_utils.bytesToNumberBE.call(void 0, e)}var xn=class xn extends _chunk6MMUUJHXjs.l{constructor(e){if(super(),this.data=_chunk6MMUUJHXjs.j.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}=_bn254.bn254.fields,s=o.fromBigTuple([bi(t),bi(r)]),a=o.sqrt(o.add(o.pow(s,3n),xn.B)),c=o.neg(a),g=(a.c1>c.c1||a.c1===c.c1&&a.c0>c.c0)===(i===1)?a:c;return _bn254.bn254.G2.ProjectivePoint.fromAffine({x:s,y:g})}};xn.B=_bn254.bn254.fields.Fp2.fromBigTuple([19485874751759354771024239261021720505790618469301721065564631296452457478373n,266929791119991161246907387137283842545076965332900288569378510910307636690n]);var Rt=xn,Tt= exports.Groth16Zkp =class n extends rr{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Xe(t),this.b=new Rt(r),this.c=new Xe(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Xe.deserialize(e).bcsToBytes(),r=Rt.deserialize(e).bcsToBytes(),i=Xe.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()}}},Ti= exports.Groth16ProofAndStatement =class n extends _chunk6MMUUJHXjs.l{constructor(t,r){super();this.domainSeparator="APTOS::Groth16ProofAndStatement";if(this.proof=t,this.publicInputsHash=typeof r=="bigint"?ui(r,32):_chunk6MMUUJHXjs.j.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(Tt.deserialize(t),t.deserializeFixedBytes(32))}hash(){return qe(this.bcsToBytes(),this.domainSeparator)}},Wt= exports.ZkProof =class n extends _chunk6MMUUJHXjs.l{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(Tt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},me= exports.ZeroKnowledgeSig =class n extends M{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 v(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=Wt.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(Me);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},wi= exports.KeylessConfiguration =class n{constructor(e){let{verificationKey:t,trainingWheelsPubkey:r,maxExpHorizonSecs:i=au,maxExtraFieldBytes:o=pu,maxJwtHeaderB64Bytes:s=lu,maxIssValBytes:a=du,maxCommitedEpkBytes:c=gu}=e;this.verificationKey=t,this.maxExpHorizonSecs=i,r&&(this.trainingWheelsPubkey=new At(new _(r))),this.maxExtraFieldBytes=o,this.maxJwtHeaderB64Bytes=s,this.maxIssValBytes=a,this.maxCommitedEpkBytes=c}static create(e,t){return new n({verificationKey:new Si({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})}},Si= exports.Groth16VerificationKey =class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Xe(t),this.betaG2=new Rt(r),this.deltaG2=new Rt(i),this.gammaAbcG1=[new Xe(o[0]),new Xe(o[1])],this.gammaG2=new Rt(s)}hash(){let e=new _chunk6MMUUJHXjs.m;return this.serialize(e),_sha3.sha3_256.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(),g=this.deltaG2.toProjectivePoint(),A=this.gammaAbcG1.map(gt=>gt.toProjectivePoint()),{Fp12:p}=_bn254.bn254.fields,l=A[0].add(A[1].multiply(t)),b=_bn254.bn254.pairing(l,d),N=_bn254.bn254.pairing(i,o),H=_bn254.bn254.pairing(a,c),oe=_bn254.bn254.pairing(s,g),je=p.mul(H,p.mul(b,oe));return p.eql(N,je)}catch(i){throw E.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 Qt(n){let{aptosConfig:e}=n;try{return await He(async()=>{let[t,r]=await Promise.all([mu(n),fu(n)]);return wi.create(r,t)},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof E?t:E.fromErrorType({type:25,error:t})}}function Ye(n){let{jwt:e,uidKey:t="sub"}=n,r;try{r=_jwtdecode.jwtDecode.call(void 0, e)}catch(o){throw E.fromErrorType({type:12,details:`Failed to parse JWT - ${_chunk6MMUUJHXjs.ga.call(void 0, o)}`})}if(typeof r.iss!="string")throw E.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof r.aud!="string")throw E.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 mu(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration";try{let{data:i}=await q({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${_chunk6MMUUJHXjs.ba.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _44 => _44.ledgerVersion])}});return i.data}catch(i){throw E.fromErrorType({type:22,error:i})}}async function fu(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await q({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${_chunk6MMUUJHXjs.ba.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _45 => _45.ledgerVersion])}});return i.data}catch(i){throw E.fromErrorType({type:23,error:i})}}async function Au(n){let{aptosConfig:e,jwkAddr:t,options:r}=n,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await q({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _46 => _46.ledgerVersion])}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await q({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _47 => _47.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,g=new v(_chunk6MMUUJHXjs.j.fromHexInput(d).toUint8Array()),A=Pi.deserialize(g);a.push(A)}o.set(_chunk6MMUUJHXjs.k.call(void 0, s.issuer),a)}return o}var Pi=class n extends _chunk6MMUUJHXjs.l{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 v(_chunk6MMUUJHXjs.j.fromHexInput(t).toUint8Array());return n.deserialize(r)}toScalar(){if(this.alg!=="RS256")throw E.fromErrorType({type:32,details:"Failed to convert JWK to scalar when calculating the public inputs hash. Only RSA 256 is supported currently"});let e=_chunk6MMUUJHXjs.ka.call(void 0, this.n),r=hu(e.reverse()).map(i=>Ct(i));return r.push(256n),vt(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 hu(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 bu(n){try{let e=JSON.parse(n);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch (e2){throw new Error("Failed to parse JWT header.")}}var V=class n extends ae{constructor(e,t){super(),this.jwkAddress=_chunk6MMUUJHXjs.ba.from(e),this.keylessPublicKey=t}authKey(){let e=new _chunk6MMUUJHXjs.m;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),Q.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){try{return dr({...e,publicKey:this}),!0}catch (e3){return!1}}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=_chunk6MMUUJHXjs.ba.deserialize(e),r=K.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}async verifySignatureAsync(e){return _i({...e,publicKey:this})}static create(e){return new n(e.jwkAddress,K.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,K.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof _chunk6MMUUJHXjs.ba&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof K}};var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var ke=class ke extends It{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e),{length:r}=t.toUint8Array();if(r===ke.LENGTH)this.key=t;else if(r===ke.COMPRESSED_LENGTH){let i=_secp256k1.secp256k1.ProjectivePoint.fromHex(t.toUint8Array());this.key=_chunk6MMUUJHXjs.j.fromHexInput(i.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${ke.LENGTH} or ${ke.COMPRESSED_LENGTH}, received ${r}`)}verifySignature(e){let{message:t,signature:r}=e,i=Jt(t),o=_chunk6MMUUJHXjs.j.fromHexInput(i).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=r.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.key.toUint8Array(),{lowS:!0})}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 et(t)}static deserialize(e){let t=e.deserializeBytes();return new ke(t)}static isPublicKey(e){return e instanceof ke}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _48 => _48.key, 'optionalAccess', _49 => _49.data, 'optionalAccess', _50 => _50.length])===ke.LENGTH}};ke.LENGTH=65,ke.COMPRESSED_LENGTH=33;var ze=ke,$e=class $e extends _chunk6MMUUJHXjs.l{constructor(e,t){super();let r=ft.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==$e.LENGTH)throw new Error(`PrivateKey length should be ${$e.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new $e(e,!1)}static fromDerivationPath(e,t){if(!Io(e))throw new Error(`Invalid derivation path ${e}`);return $e.fromDerivationPathInner(e,nr(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new $e(r,!1)}sign(e){let t=Jt(e),r=_chunk6MMUUJHXjs.j.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new et(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new ze(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.key.toString()}toAIP80String(){return ft.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new $e(t,!1)}static isPrivateKey(e){return e instanceof $e}};$e.LENGTH=32;var Ze=$e,jt=class jt extends M{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==jt.LENGTH)throw new Error(`Signature length should be ${jt.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 jt(t)}};jt.LENGTH=64;var et=jt;var x=class n extends ae{constructor(e){if(super(),this.publicKey=e,e instanceof _)this.variant=0;else if(e instanceof ze)this.variant=1;else if(e instanceof K)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 K)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 D)){if(_optionalChain([e, 'access', _51 => _51.options, 'optionalAccess', _52 => _52.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 Q.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=_.deserialize(e);break;case 1:r=ze.deserialize(e);break;case 3:r=K.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 _}isSecp256k1PublicKey(){return this.publicKey instanceof ze}static isInstance(e){return"publicKey"in e&&"variant"in e}},D= exports.AnySignature =class n extends M{constructor(e){if(super(),this.signature=e,e instanceof R)this.variant=0;else if(e instanceof et)this.variant=1;else if(e instanceof ce)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=R.deserialize(e);break;case 1:r=et.deserialize(e);break;case 3:r=ce.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 wu(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var pr=3,Ne= exports.AbstractMultiKey =class extends ae{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}`)}},$= exports.MultiKey =class n extends Ne{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 x?i:new x(i)),r>pr&&this.publicKeys.filter(o=>o.variant===3||o.variant===4).length>pr)throw new Error(`Construction of MultiKey with more than ${pr} keyless public keys is not allowed when signaturesRequired
7
- is greater than ${pr}. This is because a maximum of 3 keyless signatures are supported for a
8
- 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 Pe))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(_optionalChain([e, 'access', _53 => _53.options, 'optionalAccess', _54 => _54.throwErrorWithReason]))throw r;return!1}}authKey(){return Q.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(x),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}getIndex(e){let t=e instanceof x?e:new x(e);return super.getIndex(t)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},fe=class fe extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>fe.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${fe.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof D?o:new D(o)),!(r instanceof Uint8Array))this.bitmap=fe.createBitmap({bits:r});else{if(r.length!==fe.BITMAP_LEN)throw new Error(`"bitmap" length should be ${fe.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+wu(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>=fe.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${fe.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(D),r=e.deserializeBytes();return new fe({signatures:t,bitmap:r})}};fe.BITMAP_LEN=4,fe.MAX_SIGNATURES_SUPPORTED=fe.BITMAP_LEN*8;var Pe=fe;var Ae=class Ae extends Ne{constructor(e){let{publicKeys:t,threshold:r}=e;if(super({publicKeys:t}),t.length>Ae.MAX_KEYS||t.length<Ae.MIN_KEYS)throw new Error(`Must have between ${Ae.MIN_KEYS} and ${Ae.MAX_KEYS} public keys, inclusive`);if(r<Ae.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${Ae.MIN_THRESHOLD} and ${t.length}, inclusive`);this.publicKeys=t,this.threshold=r}getSignaturesRequired(){return this.threshold}verifySignature(e){let{message:t,signature:r}=e;if(!(r instanceof Fe))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 Q.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*_.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*_.LENGTH)}),e[this.publicKeys.length*_.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes(),r=t[t.length-1],i=[];for(let o=0;o<t.length-1;o+=_.LENGTH){let s=o;i.push(new _(t.subarray(s,s+_.LENGTH)))}return new Ae({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+=_.LENGTH){let a=s;o.push(new _(r.subarray(a,a+_.LENGTH)))}return new Ae({publicKeys:o,threshold:i})}getIndex(e){return super.getIndex(e)}};Ae.MAX_KEYS=32,Ae.MIN_KEYS=2,Ae.MIN_THRESHOLD=1;var re=Ae,he=class he extends M{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>he.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${he.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t,!(r instanceof Uint8Array))this.bitmap=he.createBitmap({bits:r});else{if(r.length!==he.BITMAP_LEN)throw new Error(`"bitmap" length should be ${he.BITMAP_LEN}`);this.bitmap=r}}toUint8Array(){let e=new Uint8Array(this.signatures.length*R.LENGTH+he.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*R.LENGTH)}),e.set(this.bitmap,this.signatures.length*R.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+=R.LENGTH){let s=o;i.push(new R(t.subarray(s,s+R.LENGTH)))}return new he({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>=he.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${he.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}};he.MAX_SIGNATURES_SUPPORTED=32,he.BITMAP_LEN=4;var Fe=he;var Jt=n=>typeof n=="string"?_chunk6MMUUJHXjs.j.isValid(n).valid?n:new TextEncoder().encode(n):n,xi=n=>{if(n instanceof _||n instanceof x||n instanceof re||n instanceof $)return n;if(n instanceof K||n instanceof V)return new x(n);throw new Error(`Unknown account public key: ${n}`)},Yo=n=>{let e=xi(n);if(e instanceof _)return 0;if(e instanceof x)return 2;if(e instanceof re)return 1;if(e instanceof $)return 3;throw new Error(`Unknown signing scheme: ${e}`)};var Ii=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function Su(n){let e=n.toUint8Array().slice(32);for(let t=Ii.length-1;t>=0;t-=1){if(e[t]<Ii[t])return!0;if(e[t]>Ii[t])return!1}return!1}var wt=class wt extends ae{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==wt.LENGTH)throw new Error(`PublicKey length should be ${wt.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!Su(r))return!1;let i=Jt(t),o=_chunk6MMUUJHXjs.j.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}async verifySignatureAsync(e){return this.verifySignature(e)}authKey(){return Q.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new wt(t)}static isPublicKey(e){return e instanceof wt}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _55 => _55.key, 'optionalAccess', _56 => _56.data, 'optionalAccess', _57 => _57.length])===wt.LENGTH}};wt.LENGTH=32;var _=wt,_e=class _e extends _chunk6MMUUJHXjs.l{constructor(e,t){super();let r=ft.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==_e.LENGTH)throw new Error(`PrivateKey length should be ${_e.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new _e(e,!1)}static fromDerivationPath(e,t){if(!Co(e))throw new Error(`Invalid derivation path ${e}`);return _e.fromDerivationPathInner(e,nr(t))}static fromDerivationPathInner(e,t,r=xo){let{key:i,chainCode:o}=ai(_e.SLIP_0010_SEED,t),s=Ko(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,d)=>vo(c,d+r),{key:i,chainCode:o});return new _e(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=Jt(e),r=_chunk6MMUUJHXjs.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new R(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.signingKey.toString()}toAIP80String(){return ft.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new _e(t,!1)}static isPrivateKey(e){return e instanceof _e}};_e.LENGTH=32,_e.SLIP_0010_SEED="ed25519 seed";var j=_e,Xt=class Xt extends M{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==Xt.LENGTH)throw new Error(`Signature length should be ${Xt.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 Xt(t)}};Xt.LENGTH=64;var R=Xt;var gr="Multiple possible deserializations found";function Rm(n){let e=[_,x,re,$,K,V,ze],t;for(let r of e)try{let i=v.fromHex(n),o=r.deserialize(i);if(i.assertFinished(),t)throw new Error(`${gr}: ${n}`);t=o}catch(i){if(i instanceof Error&&i.message.includes(gr))throw i}if(!t)throw new Error(`Failed to deserialize public key: ${n}`);return t}function Um(n){let e=[R,D,Fe,Pe,ce,et],t;for(let r of e)try{let i=v.fromHex(n),o=r.deserialize(i);if(i.assertFinished(),t)throw new Error(`${gr}: ${n}`);t=o}catch(i){if(i instanceof Error&&i.message.includes(gr))throw i}if(!t)throw new Error(`Failed to deserialize signature: ${n}`);return t}var Y=class extends _chunk6MMUUJHXjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return De.load(e);case 1:return tt.load(e);case 2:return ue.load(e);case 3:return We.load(e);case 4:return Yt.load(e);case 5:return Ut.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof De}isMultiEd25519(){return this instanceof tt}isSingleKey(){return this instanceof ue}isMultiKey(){return this instanceof We}},De= exports.AccountAuthenticatorEd25519 =class n extends Y{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=R.deserialize(e);return new n(t,r)}},tt= exports.AccountAuthenticatorMultiEd25519 =class n extends Y{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=re.deserialize(e),r=Fe.deserialize(e);return new n(t,r)}},ue= exports.AccountAuthenticatorSingleKey =class n extends Y{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=x.deserialize(e),r=D.deserialize(e);return new n(t,r)}},We= exports.AccountAuthenticatorMultiKey =class n extends Y{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=$.deserialize(e),r=Pe.deserialize(e);return new n(t,r)}},Yt= exports.AccountAuthenticatorNoAccountAuthenticator =class n extends Y{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},Ut= exports.AccountAuthenticatorAbstraction =class n extends Y{constructor(e,t,r,i){if(super(),!_chunk6MMUUJHXjs.qa.call(void 0, e))throw new Error(`Invalid function info ${e} passed into AccountAuthenticatorAbstraction`);this.functionInfo=e,this.abstractionSignature=r,this.signingMessageDigest=_chunk6MMUUJHXjs.j.fromHexInput(_chunk6MMUUJHXjs.j.fromHexInput(t).toUint8Array()),this.accountIdentity=i}serialize(e){e.serializeU32AsUleb128(5);let{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.call(void 0, this.functionInfo);_chunk6MMUUJHXjs.ba.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.abstractionSignature):e.serializeFixedBytes(this.abstractionSignature),this.accountIdentity&&e.serializeBytes(this.accountIdentity)}static load(e){let t=_chunk6MMUUJHXjs.ba.deserialize(e),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeUleb128AsU32(),s=e.deserializeBytes();if(o===0){let a=e.deserializeFixedBytes(e.remaining());return new n(`${t}::${r}::${i}`,s,a)}if(o===1){let a=e.deserializeBytes(),c=e.deserializeBytes();return new n(`${t}::${r}::${i}`,s,a,c)}throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${o}`)}},yr= exports.AccountAbstractionMessage =class n extends _chunk6MMUUJHXjs.l{constructor(e,t){super(),this.originalSigningMessage=_chunk6MMUUJHXjs.j.fromHexInput(_chunk6MMUUJHXjs.j.fromHexInput(e).toUint8Array()),this.functionInfo=t}serialize(e){e.serializeU32AsUleb128(0),e.serializeBytes(this.originalSigningMessage.toUint8Array());let{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.call(void 0, this.functionInfo);_chunk6MMUUJHXjs.ba.fromString(t).serialize(e),e.serializeStr(r),e.serializeStr(i)}static deserialize(e){let t=e.deserializeUleb128AsU32();if(t!==0)throw new Error(`Unknown variant index for AccountAbstractionMessage: ${t}`);let r=e.deserializeBytes(),i=_chunk6MMUUJHXjs.ba.deserialize(e),o=e.deserializeStr(),s=e.deserializeStr(),a=`${i}::${o}::${s}`;return new n(r,a)}};var Zt=class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var k=class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var Cn=class n extends _chunk6MMUUJHXjs.l{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(_chunk6MMUUJHXjs.ba.fromString(t[0]),new k(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=_chunk6MMUUJHXjs.ba.deserialize(e),r=k.deserialize(e);return new n(t,r)}};var G=class n extends _chunk6MMUUJHXjs.l{deserialize(e){let t=_chunk6MMUUJHXjs.ba.deserialize(e),r=k.deserialize(e),i=k.deserialize(e),o=e.deserializeVector(n);return new Qe(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return W.load(e);case 1:return de.load(e);case 2:return Z.load(e);case 3:return it.load(e);case 4:return O.load(e);case 5:return kt.load(e);case 6:return U.load(e);case 7:return h.load(e);case 8:return nt.load(e);case 9:return rt.load(e);case 10:return ot.load(e);case 255:return B.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof W}isAddress(){return this instanceof O}isGeneric(){return this instanceof B}isSigner(){return this instanceof kt}isVector(){return this instanceof U}isStruct(){return this instanceof h}isU8(){return this instanceof de}isU16(){return this instanceof nt}isU32(){return this instanceof rt}isU64(){return this instanceof Z}isU128(){return this instanceof it}isU256(){return this instanceof ot}isPrimitive(){return this instanceof kt||this instanceof O||this instanceof W||this instanceof de||this instanceof nt||this instanceof rt||this instanceof Z||this instanceof it||this instanceof ot}},W= exports.TypeTagBool =class n extends G{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},de= exports.TypeTagU8 =class n extends G{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},nt= exports.TypeTagU16 =class n extends G{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},rt= exports.TypeTagU32 =class n extends G{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},Z= exports.TypeTagU64 =class n extends G{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},it= exports.TypeTagU128 =class n extends G{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},ot= exports.TypeTagU256 =class n extends G{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},O= exports.TypeTagAddress =class n extends G{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},kt= exports.TypeTagSigner =class n extends G{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},mr= exports.TypeTagReference =class n extends G{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=G.deserialize(t);return new n(r)}},B= exports.TypeTagGeneric =class n extends G{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)}},U= exports.TypeTagVector =class n extends G{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new de)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=G.deserialize(t);return new n(r)}},h= exports.TypeTagStruct =class n extends G{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=Qe.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(_chunk6MMUUJHXjs.ba.ONE,"string","String")}isOption(){return this.isTypeTag(_chunk6MMUUJHXjs.ba.ONE,"option","Option")}isObject(){return this.isTypeTag(_chunk6MMUUJHXjs.ba.ONE,"object","Object")}isDelegationKey(){return this.isTypeTag(_chunk6MMUUJHXjs.ba.ONE,"permissioned_delegation","DelegationKey")}isRateLimiter(){return this.isTypeTag(_chunk6MMUUJHXjs.ba.ONE,"rate_limiter","RateLimiter")}},Qe= exports.StructTag =class n extends _chunk6MMUUJHXjs.l{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=_chunk6MMUUJHXjs.ba.deserialize(e),r=k.deserialize(e),i=k.deserialize(e),o=e.deserializeVector(G);return new n(t,r,i,o)}};function Rf(){return new Qe(_chunk6MMUUJHXjs.ba.ONE,new k("aptos_coin"),new k("AptosCoin"),[])}function I(){return new Qe(_chunk6MMUUJHXjs.ba.ONE,new k("string"),new k("String"),[])}function Uf(n){return new Qe(_chunk6MMUUJHXjs.ba.ONE,new k("option"),new k("Option"),[n])}function be(n){return new Qe(_chunk6MMUUJHXjs.ba.ONE,new k("object"),new k("Object"),[n])}function Pu(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return X.deserialize(n);case 1:return L.deserialize(n);case 2:return Re.deserialize(n);case 3:return _chunk6MMUUJHXjs.ba.deserialize(n);case 4:return S.deserialize(n,X);case 5:return F.deserialize(n);case 6:return ve.deserialize(n);case 7:return Ke.deserialize(n);case 8:return we.deserialize(n);case 9:return Tn.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var St=class extends _chunk6MMUUJHXjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return en.load(e);case 2:return tn.load(e);case 3:return nn.load(e);case 4:return fr.deserialize(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},en= exports.TransactionPayloadScript =class n extends St{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=rn.deserialize(e);return new n(t)}},tn= exports.TransactionPayloadEntryFunction =class n extends St{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=st.deserialize(e);return new n(t)}},nn= exports.TransactionPayloadMultiSig =class n extends St{constructor(e){super(),this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let t=vn.deserialize(e);return new n(t)}},st= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(Cn.fromStr(e),new k(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=Cn.deserialize(e),r=k.deserialize(e),i=e.deserializeVector(G),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),d=er.deserialize(e,c);s.push(d)}return new n(t,r,i,s)}},rn= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(G),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Pu(e);o.push(a)}return new n(t,r,o)}},vn= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=_chunk6MMUUJHXjs.ba.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Kn.deserialize(e)),new n(t,i)}},Kn= exports.MultiSigTransactionPayload =class n extends _chunk6MMUUJHXjs.l{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(st.deserialize(e))}},fr= exports.TransactionInnerPayload =class extends St{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return zt.load(e);default:throw new Error(`Unknown variant index for TransactionInnerPayload: ${t}`)}}},zt= exports.TransactionInnerPayloadV1 =class n extends fr{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=on.deserialize(e),r=Ar.deserialize(e);return new n(t,r)}},on= exports.TransactionExecutable =class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Rn.load(e);case 1:return sn.load(e);case 2:return Un.load(e);default:throw new Error(`Unknown variant index for TransactionExecutable: ${t}`)}}},Rn= exports.TransactionExecutableScript =class n extends on{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=rn.deserialize(e);return new n(t)}},sn= exports.TransactionExecutableEntryFunction =class n extends on{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(1),this.entryFunction.serialize(e)}static load(e){let t=st.deserialize(e);return new n(t)}},Un= exports.TransactionExecutableEmpty =class n extends on{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},Ar= exports.TransactionExtraConfig =class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Nt.load(e);default:throw new Error(`Unknown variant index for TransactionExtraConfig: ${t}`)}}},Nt= exports.TransactionExtraConfigV1 =class n extends Ar{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 L(this.replayProtectionNonce):void 0)}static load(e){let t=e.deserializeOption(_chunk6MMUUJHXjs.ba),r=e.deserializeOption(L);return new n(t,_optionalChain([r, 'optionalAccess', _58 => _58.value]))}};var Ee=class n extends _chunk6MMUUJHXjs.l{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=_chunk6MMUUJHXjs.ba.deserialize(e),r=e.deserializeU64(),i=St.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=Zt.deserialize(e);return new n(t,r,i,o,s,a,c)}},hr= exports.RawTransactionWithData =class extends _chunk6MMUUJHXjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ft.load(e);case 1:return Dt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},Ft= exports.MultiAgentRawTransaction =class n extends hr{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=Ee.deserialize(e),r=e.deserializeVector(_chunk6MMUUJHXjs.ba);return new n(t,r)}},Dt= exports.FeePayerRawTransaction =class n extends hr{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=Ee.deserialize(e),r=e.deserializeVector(_chunk6MMUUJHXjs.ba),i=_chunk6MMUUJHXjs.ba.deserialize(e);return new n(t,r,i)}};var br=class extends _chunk6MMUUJHXjs.l{constructor(t){super();this.accountAddress=_chunk6MMUUJHXjs.ba.ONE;this.moduleName=new C("account");this.structName=new C("RotationProofChallenge");this.sequenceNumber=new L(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=S.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var at=class extends _chunk6MMUUJHXjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ot.load(e);case 1:return an.load(e);case 2:return Gt.load(e);case 3:return Bt.load(e);case 4:return Pt.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof Ot}isMultiEd25519(){return this instanceof an}isMultiAgent(){return this instanceof Gt}isFeePayer(){return this instanceof Bt}isSingleSender(){return this instanceof Pt}},Ot= exports.TransactionAuthenticatorEd25519 =class n extends at{constructor(e,t){super(),this.public_key=e,this.signature=t}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let t=_.deserialize(e),r=R.deserialize(e);return new n(t,r)}},an= exports.TransactionAuthenticatorMultiEd25519 =class n extends at{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=re.deserialize(e),r=Fe.deserialize(e);return new n(t,r)}},Gt= exports.TransactionAuthenticatorMultiAgent =class n extends at{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=Y.deserialize(e),r=e.deserializeVector(_chunk6MMUUJHXjs.ba),i=e.deserializeVector(Y);return new n(t,r,i)}},Bt= exports.TransactionAuthenticatorFeePayer =class n extends at{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=Y.deserialize(e),r=e.deserializeVector(_chunk6MMUUJHXjs.ba),i=e.deserializeVector(Y),o=_chunk6MMUUJHXjs.ba.deserialize(e),s=Y.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},Pt= exports.TransactionAuthenticatorSingleSender =class n extends at{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Y.deserialize(e);return new n(t)}};var ct=class n extends _chunk6MMUUJHXjs.l{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=Ee.deserialize(e),r=at.deserialize(e);return new n(t,r)}};var Tr=class n extends _chunk6MMUUJHXjs.l{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=Ee.deserialize(e),r=e.deserializeBool(),i;return r&&(i=_chunk6MMUUJHXjs.ba.deserialize(e)),new n(t,i)}};var wr=class n extends _chunk6MMUUJHXjs.l{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=Ee.deserialize(e),r=e.deserializeVector(_chunk6MMUUJHXjs.ba),i=e.deserializeBool(),o;return i&&(o=_chunk6MMUUJHXjs.ba.deserialize(e)),new n(t,r,o)}};function Sr(n){return n.feePayerAddress?new Dt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new Ft(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function qe(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function qA(n){return qe(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Oe(n){let e=Sr(n);return n.feePayerAddress?qe(e.bcsToBytes(),yi):n.secondarySignerAddresses?qe(e.bcsToBytes(),yi):qe(e.bcsToBytes(),Bo)}var ie=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?_chunk6MMUUJHXjs.ba.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=j.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=j.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 De(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new De(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Oe(e))}};function Ci(n){return typeof n=="object"&&n!==null&&"getAnyPublicKey"in n&&typeof n.getAnyPublicKey=="function"}var pe=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new x(t.publicKey()),this.accountAddress=r?_chunk6MMUUJHXjs.ba.from(r):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=j.generate();break;case 2:r=Ze.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=j.fromDerivationPath(r,i);break;case 2:o=Ze.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 ue(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ue(this.publicKey,this.signTransaction(e))}sign(e){return new D(this.privateKey.sign(e))}signTransaction(e){return this.sign(Oe(e))}static fromEd25519Account(e){return new n({privateKey:e.privateKey,address:e.accountAddress})}};var ut=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?ie.generate():pe.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof j&&i?new ie({privateKey:t,address:r}):new pe({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?ie.fromDerivationPath({mnemonic:r,path:i}):pe.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)}};var _utils3 = require('@noble/hashes/utils');var xu=1209600,cn=class cn extends _chunk6MMUUJHXjs.l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new At(t.publicKey()),this.expiryDateSecs=r||_chunk6MMUUJHXjs.ia.call(void 0, _chunk6MMUUJHXjs.ha.call(void 0, )+xu),this.blinder=i!==void 0?_chunk6MMUUJHXjs.j.fromHexInput(i).toUint8Array():Iu();let o=Pn(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(Ct(this.blinder));let s=vt(o);this.nonce=s.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let t=e.deserializeUleb128AsU32(),r;switch(t){case 0:r=j.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new cn({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return cn.deserialize(new v(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _59 => _59.scheme])){case 0:default:t=j.generate()}return new cn({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _60 => _60.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new Me(this.privateKey.sign(e))}};cn.BLINDER_LENGTH=31;var Mt=cn;function Iu(){return _utils3.randomBytes.call(void 0, Mt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function _r(n){return n!=null&&typeof n.checkKeylessAccountValidity=="function"}var un=class un extends _chunk6MMUUJHXjs.l{constructor(t){super();this.signingScheme=2;let{address:r,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:d,proof:g,proofFetchCallback:A,jwt:p,verificationKeyHash:l}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=r?_chunk6MMUUJHXjs.ba.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=p,this.emitter=new _eventemitter32.default,this.proofOrPromise=g,g instanceof me)this.proof=g;else{if(A===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async N=>{await A(N),this.emitter.removeAllListeners()}),this.init(g)}let b=_chunk6MMUUJHXjs.j.fromHexInput(d).toUint8Array();if(b.length!==un.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${un.PEPPER_LENGTH}`);if(this.pepper=b,l!==void 0){if(_chunk6MMUUJHXjs.j.hexInputToUint8Array(l).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=_chunk6MMUUJHXjs.j.hexInputToUint8Array(l)}}getAnyPublicKey(){return new x(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=_chunk6MMUUJHXjs.ba.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=Mt.deserialize(t),c=me.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 D(this.sign(t)),i=new x(this.publicKey);return new ue(i,r)}signTransactionWithAuthenticator(t){let r=new D(this.signTransaction(t)),i=new x(this.publicKey);return new ue(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw E.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw E.fromErrorType({type:2});let r=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0});if(r.kid===void 0)throw E.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 Qt({aptosConfig:t});if(_chunk6MMUUJHXjs.j.hexInputToString(i.hash())!==_chunk6MMUUJHXjs.j.hexInputToString(this.verificationKeyHash))throw E.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 un.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:r.kid})}sign(t){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw E.fromErrorType({type:0});if(this.proof===void 0)throw E.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 ce({jwtHeader:_chunk6MMUUJHXjs.ja.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new $t(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw E.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=Sr(t),o=new Pr(r,this.proof.proof).hash();return this.sign(o)}getSigningMessage(t){if(this.proof===void 0)throw E.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=Sr(t);return new Pr(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 Ei(t)}};un.PEPPER_LENGTH=31;var Te=un,Pr= exports.TransactionAndProof =class extends _chunk6MMUUJHXjs.l{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 qe(this.bcsToBytes(),this.domainSeparator)}};var xe=class n extends Te{constructor(e){let t=K.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}=Te.partialDeserialize(e),{iss:d,aud:g,uidVal:A}=Ye({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:d,uidKey:s,uidVal:A,aud:g,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return n.deserialize(new v(_chunk6MMUUJHXjs.j.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:d,verificationKeyHash:g}=e;if(g&&d)throw new Error("Cannot provide both verificationKey and verificationKeyHash");let{iss:A,aud:p,uidVal:l}=Ye({jwt:i,uidKey:a});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:A,uidKey:a,uidVal:l,aud:p,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:_nullishCoalesce(g, () => ((d?d.hash():void 0)))})}};var Ge=class n extends Te{constructor(e){let t=V.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=_nullishCoalesce(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}=Te.partialDeserialize(e),d=_chunk6MMUUJHXjs.ba.deserialize(e),{iss:g,aud:A,uidVal:p}=Ye({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:g,uidKey:s,uidVal:p,aud:A,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:d})}static fromBytes(e){return n.deserialize(v.fromHex(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:d,verificationKey:g,verificationKeyHash:A}=e;if(A&&g)throw new Error("Cannot provide both verificationKey and verificationKeyHash");let{iss:p,aud:l,uidVal:b}=Ye({jwt:i,uidKey:c});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:p,uidKey:c,uidVal:b,aud:l,pepper:s,jwkAddress:_chunk6MMUUJHXjs.ba.from(a),jwt:i,proofFetchCallback:d,verificationKeyHash:_nullishCoalesce(A, () => ((g?g.hash():void 0)))})}};var dt=class n{constructor(e){this.signingScheme=3;let{multiKey:t,address:r}=e,i=e.signers.map(a=>a instanceof ie?pe.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?_chunk6MMUUJHXjs.ba.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 $({publicKeys:r,signaturesRequired:i});return new n({multiKey:s,signers:o,address:t})}static isMultiKeySigner(e){return e instanceof n}signWithAuthenticator(e){return new We(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new We(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof Te).map(async r=>r.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let r=this.signers.filter(i=>i instanceof Te).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 Pe({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new Pe({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return await this.publicKey.verifySignatureAsync(e)}};var kn=class{constructor(e){this.signingScheme=1;let{signers:t,publicKey:r,address:i}=e;if(this.publicKey=r,this.accountAddress=i?_chunk6MMUUJHXjs.ba.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 tt(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new tt(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Fe({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){return this.sign(Oe(e))}};function Zo(n){let e=n.deserializeUleb128AsU32();if(!Object.values(_chunk6MMUUJHXjs.Z).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:_chunk6MMUUJHXjs.ba.deserialize(n),signingScheme:e}}function es(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 ts(n){let e=n.deserializeStr(),t=n.deserializeStr(),r=n.deserializeFixedBytes(31),i=Mt.deserialize(n),o=me.deserialize(n),s=n.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:r,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var ns;(A=>{function n(p){let l=new _chunk6MMUUJHXjs.m;switch(l.serializeU32AsUleb128(p.signingScheme),p.accountAddress.serialize(l),p.signingScheme){case 0:return p.privateKey.serialize(l),l.toUint8Array();case 2:{if(!Ci(p))throw new Error("Account is not a SingleKeySigner");let b=p.getAnyPublicKey();switch(l.serializeU32AsUleb128(b.variant),b.variant){case 3:return es(p,l),l.toUint8Array();case 4:{let N=p;return es(N,l),N.publicKey.jwkAddress.serialize(l),l.serializeBool(N.audless),l.toUint8Array()}case 1:case 0:return p.privateKey.serialize(l),l.toUint8Array();default:throw new Error(`Invalid public key variant: ${b.variant}`)}}case 3:{let b=p;return b.publicKey.serialize(l),l.serializeU32AsUleb128(b.signers.length),b.signers.forEach(N=>{l.serializeFixedBytes(n(N))}),l.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${p.signingScheme}`)}}A.toBytes=n;function e(p){return _chunk6MMUUJHXjs.j.hexInputToStringWithoutPrefix(n(p))}A.toHexStringWithoutPrefix=e;function t(p){return _chunk6MMUUJHXjs.j.hexInputToString(n(p))}A.toHexString=t;function r(p){let{address:l,signingScheme:b}=Zo(p);switch(b){case 0:{let N=j.deserialize(p);return new ie({privateKey:N,address:l})}case 2:{let N=p.deserializeUleb128AsU32();switch(N){case 0:{let H=j.deserialize(p);return new pe({privateKey:H,address:l})}case 1:{let H=Ze.deserialize(p);return new pe({privateKey:H,address:l})}case 3:{let H=ts(p),oe=Ye(H);return new xe({...H,...oe})}case 4:{let H=ts(p),oe=_chunk6MMUUJHXjs.ba.deserialize(p),je=p.deserializeBool(),gt=Ye(H);return new Ge({...H,...gt,jwkAddress:oe,audless:je})}default:throw new Error(`Unsupported public key variant ${N}`)}}case 3:{let N=$.deserialize(p),H=p.deserializeUleb128AsU32(),oe=new Array;for(let je=0;je<H;je+=1){let gt=r(p);if(!Ci(gt)&&!(gt instanceof ie))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");oe.push(gt)}return new dt({multiKey:N,signers:oe,address:l})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${b}`)}}A.deserialize=r;function i(p){let l=d(p);if(!(l instanceof xe))throw new Error("Deserialization of KeylessAccount failed");return l}A.keylessAccountFromHex=i;function o(p){let l=d(p);if(!(l instanceof Ge))throw new Error("Deserialization of FederatedKeylessAccount failed");return l}A.federatedKeylessAccountFromHex=o;function s(p){let l=d(p);if(!(l instanceof dt))throw new Error("Deserialization of MultiKeyAccount failed");return l}A.multiKeyAccountFromHex=s;function a(p){let l=d(p);if(!(l instanceof pe))throw new Error("Deserialization of SingleKeyAccount failed");return l}A.singleKeyAccountFromHex=a;function c(p){let l=d(p);if(!(l instanceof ie))throw new Error("Deserialization of Ed25519Account failed");return l}A.ed25519AccountFromHex=c;function d(p){return r(v.fromHex(p))}A.fromHex=d;function g(p){return d(p)}A.fromBytes=g})(ns||(ns= exports.AccountUtils ={}));var Er=class n extends ut{constructor({signer:t,accountAddress:r,authenticationFunction:i}){super();this.signingScheme=2;if(!_chunk6MMUUJHXjs.qa.call(void 0, i))throw new Error(`Invalid authentication function ${i} passed into AbstractedAccount`);this.authenticationFunction=i,this.accountAddress=r,this.publicKey=new tr(this.accountAddress),this.sign=o=>new wn(t(o))}static fromPermissionedSigner({signer:t,accountAddress:r}){return new n({signer:i=>{let o=new _chunk6MMUUJHXjs.m;return t.publicKey.serialize(o),t.sign(i).serialize(o),o.toUint8Array()},accountAddress:_nullishCoalesce(r, () => (t.accountAddress)),authenticationFunction:"0x1::permissioned_delegation::authenticate"})}static generateAccountAbstractionMessage(t,r){let i=new yr(t,r);return qe(i.bcsToBytes(),Mo)}signWithAuthenticator(t){return new Ut(this.authenticationFunction,_sha3.sha3_256.call(void 0, t),this.sign(_sha3.sha3_256.call(void 0, t)).toUint8Array())}signTransactionWithAuthenticator(t){let r=n.generateAccountAbstractionMessage(Oe(t),this.authenticationFunction);return this.signWithAuthenticator(r)}signTransaction(t){return this.sign(Oe(t))}setSigner(t){this.sign=r=>new wn(t(r))}};var zn=class zn extends Er{constructor({signer:e,authenticationFunction:t,abstractPublicKey:r}){let i=new (0, _chunk6MMUUJHXjs.ba)(zn.computeAccountAddress(t,r));super({accountAddress:i,signer:e,authenticationFunction:t}),this.abstractPublicKey=r}static computeAccountAddress(e,t){if(!_chunk6MMUUJHXjs.qa.call(void 0, e))throw new Error(`Invalid authentication function ${e} passed into DerivableAbstractedAccount`);let[r,i,o]=e.split("::"),s=_sha3.sha3_256.create(),a=new _chunk6MMUUJHXjs.m;_chunk6MMUUJHXjs.ba.fromString(r).serialize(a),a.serializeStr(i),a.serializeStr(o),s.update(a.toUint8Array());let c=new _chunk6MMUUJHXjs.m;return c.serializeBytes(t),s.update(c.toUint8Array()),s.update(new Uint8Array([zn.ADDRESS_DOMAIN_SEPERATOR])),s.digest()}signWithAuthenticator(e){return new Ut(this.authenticationFunction,_sha3.sha3_256.call(void 0, e),this.sign(_sha3.sha3_256.call(void 0, e)).value,this.abstractPublicKey)}};zn.ADDRESS_DOMAIN_SEPERATOR=5;var is=zn;var Ku=`
5
+ Error: ${_chunkAWFAHZSBjs.x.call(void 0, r)}`),o+=`
6
+ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,details:i}=e,[o,s,a]=Go[r];return new n({message:o,details:i,innerError:t,category:s,resolutionTip:a,type:r})}},Se= exports.AptosApiError =class extends Error{constructor({apiType:e,aptosRequest:t,aptosResponse:r}){super(mu({apiType:e,aptosRequest:t,aptosResponse:r})),this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=t}};function mu({apiType:n,aptosRequest:e,aptosResponse:t}){let r=_optionalChain([t, 'access', _2 => _2.headers, 'optionalAccess', _3 => _3.traceparent, 'optionalAccess', _4 => _4.split, 'call', _5 => _5("-"), 'access', _6 => _6[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${e.method} ${_nullishCoalesce(t.url, () => (e.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([t, 'access', _7 => _7.data, 'optionalAccess', _8 => _8.errors, 'optionalAccess', _9 => _9[0], 'optionalAccess', _10 => _10.message])!=null?`${o}: ${t.data.errors[0].message}`:_optionalChain([t, 'access', _11 => _11.data, 'optionalAccess', _12 => _12.message])!=null&&_optionalChain([t, 'access', _13 => _13.data, 'optionalAccess', _14 => _14.error_code])!=null?`${o}: ${JSON.stringify(t.data)}`:`${o} status: ${t.statusText}(code:${t.status}) and response body: ${fu(t.data)}`}var gi=400;function fu(n){let e=JSON.stringify(n);return e.length<=gi?e:`truncated(original_size:${e.length}): ${e.slice(0,gi/2)}...${e.slice(-gi/2)}`}async function Au(n,e){let{url:t,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _15 => _15.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Io}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _16 => _16.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _17 => _17.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _18 => _18.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _19 => _19.API_KEY])}`),e.provider({url:t,method:r,body:i,params:s,headers:p,overrides:a})}async function ar(n,e,t){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Au({...n,url:o},e.client),a={status:s.status,statusText:_nullishCoalesce(s.statusText, () => ("No status text provided")),data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Se({apiType:t,aptosRequest:n,aptosResponse:a});if(t==="Indexer"){let c=a.data;if(c.errors)throw new Se({apiType:t,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((t==="Pepper"||t==="Prover")&&a.status>=400)throw new Se({apiType:t,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Se({apiType:t,aptosRequest:n,aptosResponse:a})}async function cr(n){let{aptosConfig:e,overrides:t,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=e.getRequestUrl(c);return ar({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...e.clientConfig,...t}},e,n.type)}async function V(n){let{aptosConfig:e}=n;return cr({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _20 => _20.clientConfig, 'optionalAccess', _21 => _21.HEADERS]),..._optionalChain([e, 'access', _22 => _22.fullnodeConfig, 'optionalAccess', _23 => _23.HEADERS])}}})}async function zl(n){return cr({...n,type:"Pepper"})}async function ur(n){let e=new Array(0),t,r=n.params;do{let i=await cr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});t=i.headers["x-aptos-cursor"],delete i.headers,e.push(...i.data),r.start=t}while(t!=null);return e}async function yi(n){let e=new Array(0),t,r=n.params,i=r.limit;do{let{response:o,cursor:s}=await pr({...n});if(t=s,e.push(...o.data),_optionalChain([n, 'optionalAccess', _24 => _24.params])&&(n.params.start=t),i!==void 0){let a=i-e.length;if(a<=0)break;r.limit=a}}while(t!=null);return e}async function pr(n){let e,t={};typeof _optionalChain([n, 'access', _25 => _25.params, 'optionalAccess', _26 => _26.cursor])=="string"&&(t.start=n.params.cursor),typeof _optionalChain([n, 'access', _27 => _27.params, 'optionalAccess', _28 => _28.limit])=="number"&&(t.limit=n.params.limit);let r=await cr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:t,overrides:n.overrides});return e=r.headers["x-aptos-cursor"],{response:r,cursor:e}}async function En(n){let{type:e,originMethod:t,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,g=c.getRequestUrl(e);return ar({url:g,method:"POST",originMethod:t,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function bt(n){let{aptosConfig:e}=n;return En({...n,type:"Fullnode",overrides:{...e.clientConfig,...e.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _29 => _29.clientConfig, 'optionalAccess', _30 => _30.HEADERS]),..._optionalChain([e, 'access', _31 => _31.fullnodeConfig, 'optionalAccess', _32 => _32.HEADERS])}}})}async function Mo(n){let{aptosConfig:e}=n;return En({...n,type:"Indexer",overrides:{...e.clientConfig,...e.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _33 => _33.clientConfig, 'optionalAccess', _34 => _34.HEADERS]),..._optionalChain([e, 'access', _35 => _35.indexerConfig, 'optionalAccess', _36 => _36.HEADERS])}}})}async function Bo(n){let{aptosConfig:e}=n,t={...e,clientConfig:{...e.clientConfig}};return _optionalChainDelete([t, 'optionalAccess', _37 => _37.clientConfig, 'optionalAccess', _38 => delete _38.API_KEY]),En({...n,type:"Faucet",overrides:{...t.clientConfig,...t.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _39 => _39.clientConfig, 'optionalAccess', _40 => _40.HEADERS]),..._optionalChain([t, 'access', _41 => _41.faucetConfig, 'optionalAccess', _42 => _42.HEADERS])}}})}async function Ho(n){return En({...n,type:"Pepper"})}async function Vo(n){return En({...n,type:"Prover"})}var mi=new Map;function Le(n,e,t){return async(...r)=>{if(mi.has(e)){let{value:o,timestamp:s}=mi.get(e);if(t===void 0||Date.now()-s<=t)return o}let i=await n(...r);return mi.set(e,{value:i,timestamp:Date.now()}),i}}var _bn254 = require('@noble/curves/bn254');var _utils = require('@noble/curves/abstract/utils');var _jsbase64 = require('js-base64');var wu=1e7,fi= exports.MAX_AUD_VAL_BYTES =120,Su= exports.MAX_UID_KEY_BYTES =30,_u= exports.MAX_UID_VAL_BYTES =330,Pu= exports.MAX_ISS_VAL_BYTES =120,Eu= exports.MAX_EXTRA_FIELD_BYTES =350,xu= exports.MAX_JWT_HEADER_B64_BYTES =300,Iu= exports.MAX_COMMITED_EPK_BYTES =93,qe=class qe extends se{constructor(e,t){super();let r=_chunkAWFAHZSBjs.j.fromHexInput(t).toUint8Array();if(r.length!==qe.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${qe.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=r}authKey(){let e=new _chunkAWFAHZSBjs.m;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),H.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){try{return dr({...e,publicKey:this}),!0}catch(t){if(t instanceof E)return!1;throw t}}async verifySignatureAsync(e){return Si({...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 qe(t,r)}static load(e){let t=e.deserializeStr(),r=e.deserializeBytes();return new qe(t,r)}static isPublicKey(e){return e instanceof qe}static create(e){return Lo(e),new qe(e.iss,Lo(e))}static fromJwtAndPepper(e){let{jwt:t,pepper:r,uidKey:i="sub"}=e,o=_jwtdecode.jwtDecode.call(void 0, 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 qe.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}};qe.ID_COMMITMENT_LENGTH=32;var K=qe;async function Si(n){let{aptosConfig:e,publicKey:t,message:r,signature:i,jwk:o,keylessConfig:s=await Wt({aptosConfig:e}),options:a}=n;try{if(!(i instanceof ae))throw E.fromErrorType({type:26,details:"Not a keyless signature"});return dr({message:r,publicKey:t,signature:i,jwk:o||await _i({aptosConfig:e,publicKey:t,kid:i.getJwkKid()}),keylessConfig:s}),!0}catch(c){if(_optionalChain([a, 'optionalAccess', _43 => _43.throwErrorWithReason]))throw c;return!1}}function dr(n){let{publicKey:e,message:t,signature:r,keylessConfig:i,jwk:o}=n,{verificationKey:s,maxExpHorizonSecs:a,trainingWheelsPubkey:c}=i;if(!(r instanceof ae))throw E.fromErrorType({type:26,details:"Not a keyless signature"});if(!(r.ephemeralCertificate.signature instanceof ye))throw E.fromErrorType({type:26,details:"Unsupported ephemeral certificate variant"});let p=r.ephemeralCertificate.signature;if(!(p.proof.proof instanceof Tt))throw E.fromErrorType({type:26,details:"Unsupported proof variant for ZeroKnowledgeSig"});let g=p.proof.proof;if(r.expiryDateSecs<_chunkAWFAHZSBjs.y.call(void 0, ))throw E.fromErrorType({type:27,details:"The expiryDateSecs is in the past"});if(p.expHorizonSecs>a)throw E.fromErrorType({type:28});if(!r.ephemeralPublicKey.verifySignature({message:t,signature:r.ephemeralSignature}))throw E.fromErrorType({type:29});let A=Cu({publicKey:e,signature:r,jwk:o,keylessConfig:i});if(!s.verifyProof({publicInputsHash:A,groth16Proof:g}))throw E.fromErrorType({type:32});if(c){if(!p.trainingWheelsSignature)throw E.fromErrorType({type:30});let l=new hi(g,A);if(!c.verifySignature({message:l.hash(),signature:p.trainingWheelsSignature}))throw E.fromErrorType({type:31})}}function Cu(n){let{publicKey:e,signature:t,jwk:r,keylessConfig:i}=n,o=e instanceof K?e:e.keylessPublicKey;if(!(t.ephemeralCertificate.signature instanceof ye))throw new Error("Signature is not a ZeroKnowledgeSig");let s=t.ephemeralCertificate.signature,a=[];return a.push(...Pn(t.ephemeralPublicKey.toUint8Array(),i.maxCommitedEpkBytes)),a.push(It(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(_jsbase64.encode.call(void 0, t.jwtHeader,!0)+".",i.maxJwtHeaderB64Bytes)),a.push(r.toScalar()),s.overrideAudVal?(a.push(Ve(s.overrideAudVal,fi)),a.push(1n)):(a.push(Ve("",fi)),a.push(0n)),Ct(a)}async function _i(n){let{aptosConfig:e,publicKey:t,kid:r}=n,i=t instanceof K?t:t.keylessPublicKey,{iss:o}=i,s,a=t instanceof L?t.jwkAddress:void 0;try{s=await Ru({aptosConfig:e,jwkAddr:a})}catch(g){throw E.fromErrorType({type:24,error:g,details:`Failed to fetch ${a?"Federated":"Patched"}JWKs ${a?`for address ${a}`:"0x1"}`})}let c=s.get(o);if(c===void 0)throw E.fromErrorType({type:7,details:`JWKs for issuer ${o} not found.`});let p=c.find(g=>g.kid===r);if(p===void 0)throw E.fromErrorType({type:6,details:`JWK with kid '${r}' for issuer '${o}' not found.`});return p}function Lo(n){let{uidKey:e,uidVal:t,aud:r,pepper:i}=n,o=[It(_chunkAWFAHZSBjs.j.fromHexInput(i).toUint8Array()),Ve(r,fi),Ve(t,_u),Ve(e,Su)];return ci(Ct(o),K.ID_COMMITMENT_LENGTH)}var ae=class n extends F{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 ku(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=ht.deserialize(e),s=He.deserialize(e);return new n({jwtHeader:r,expiryDateSecs:Number(i),ephemeralCertificate:t,ephemeralPublicKey:o,ephemeralSignature:s})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new qt(new ye({proof:new $t(new Tt({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new ht(new P(new Uint8Array(32))),ephemeralSignature:new He(new R(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},qt= exports.EphemeralCertificate =class n extends F{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(ye.deserialize(e),t);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${t}`)}}},xn=class xn extends _chunkAWFAHZSBjs.l{constructor(e){if(super(),this.data=_chunkAWFAHZSBjs.j.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 xn(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}=_bn254.bn254.fields,i=r.create(Ai(e)),o=r.sqrt(r.add(r.pow(i,3n),xn.B)),s=r.neg(o),a=o>s==(t===1)?o:s;return _bn254.bn254.G1.ProjectivePoint.fromAffine({x:i,y:a})}};xn.B=_bn254.bn254.fields.Fp.create(3n);var Ze=xn;function Ai(n){if(n.length!==32)throw new Error("Input should be 32 bytes");let e=new Uint8Array(n);return e[0]=e[0]&63,_utils.bytesToNumberBE.call(void 0, e)}var In=class In extends _chunkAWFAHZSBjs.l{constructor(e){if(super(),this.data=_chunkAWFAHZSBjs.j.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 In(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}=_bn254.bn254.fields,s=o.fromBigTuple([Ai(t),Ai(r)]),a=o.sqrt(o.add(o.pow(s,3n),In.B)),c=o.neg(a),g=(a.c1>c.c1||a.c1===c.c1&&a.c0>c.c0)===(i===1)?a:c;return _bn254.bn254.G2.ProjectivePoint.fromAffine({x:s,y:g})}};In.B=_bn254.bn254.fields.Fp2.fromBigTuple([19485874751759354771024239261021720505790618469301721065564631296452457478373n,266929791119991161246907387137283842545076965332900288569378510910307636690n]);var vt=In,Tt= exports.Groth16Zkp =class n extends or{constructor(e){super();let{a:t,b:r,c:i}=e;this.a=new Ze(t),this.b=new vt(r),this.c=new Ze(i)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let t=Ze.deserialize(e).bcsToBytes(),r=vt.deserialize(e).bcsToBytes(),i=Ze.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()}}},hi= exports.Groth16ProofAndStatement =class n extends _chunkAWFAHZSBjs.l{constructor(t,r){super();this.domainSeparator="APTOS::Groth16ProofAndStatement";if(this.proof=t,this.publicInputsHash=typeof r=="bigint"?ci(r,32):_chunkAWFAHZSBjs.j.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(Tt.deserialize(t),t.deserializeFixedBytes(32))}hash(){return $e(this.bcsToBytes(),this.domainSeparator)}},$t= exports.ZkProof =class n extends _chunkAWFAHZSBjs.l{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(Tt.deserialize(e),t);default:throw new Error(`Unknown variant index for ZkProof: ${t}`)}}},ye= exports.ZeroKnowledgeSig =class n extends F{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 v(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=$t.deserialize(e),r=Number(e.deserializeU64()),i=e.deserializeOption("string"),o=e.deserializeOption("string"),s=e.deserializeOption(He);return new n({proof:t,expHorizonSecs:r,trainingWheelsSignature:s,extraField:i,overrideAudVal:o})}},bi= exports.KeylessConfiguration =class n{constructor(e){let{verificationKey:t,trainingWheelsPubkey:r,maxExpHorizonSecs:i=wu,maxExtraFieldBytes:o=Eu,maxJwtHeaderB64Bytes:s=xu,maxIssValBytes:a=Pu,maxCommitedEpkBytes:c=Iu}=e;this.verificationKey=t,this.maxExpHorizonSecs=i,r&&(this.trainingWheelsPubkey=new ht(new P(r))),this.maxExtraFieldBytes=o,this.maxJwtHeaderB64Bytes=s,this.maxIssValBytes=a,this.maxCommitedEpkBytes=c}static create(e,t){return new n({verificationKey:new Ti({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})}},Ti= exports.Groth16VerificationKey =class n{constructor(e){let{alphaG1:t,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=e;this.alphaG1=new Ze(t),this.betaG2=new vt(r),this.deltaG2=new vt(i),this.gammaAbcG1=[new Ze(o[0]),new Ze(o[1])],this.gammaG2=new vt(s)}hash(){let e=new _chunkAWFAHZSBjs.m;return this.serialize(e),_sha3.sha3_256.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(),p=this.gammaG2.toProjectivePoint(),g=this.deltaG2.toProjectivePoint(),A=this.gammaAbcG1.map(mt=>mt.toProjectivePoint()),{Fp12:l}=_bn254.bn254.fields,d=A[0].add(A[1].multiply(t)),b=_bn254.bn254.pairing(d,p),z=_bn254.bn254.pairing(i,o),q=_bn254.bn254.pairing(a,c),oe=_bn254.bn254.pairing(s,g),Je=l.mul(q,l.mul(b,oe));return l.eql(z,Je)}catch(i){throw E.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 Wt(n){let{aptosConfig:e}=n;try{return await Le(async()=>{let[t,r]=await Promise.all([vu(n),Ku(n)]);return bi.create(r,t)},`keyless-configuration-${e.network}`,1e3*60*5)()}catch(t){throw t instanceof E?t:E.fromErrorType({type:25,error:t})}}function et(n){let{jwt:e,uidKey:t="sub"}=n,r;try{r=_jwtdecode.jwtDecode.call(void 0, e)}catch(o){throw E.fromErrorType({type:12,details:`Failed to parse JWT - ${_chunkAWFAHZSBjs.x.call(void 0, o)}`})}if(typeof r.iss!="string")throw E.fromErrorType({type:12,details:"JWT is missing 'iss' in the payload. This should never happen."});if(typeof r.aud!="string")throw E.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 vu(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Configuration";try{let{data:i}=await V({aptosConfig:e,originMethod:"getKeylessConfigurationResource",path:`accounts/${_chunkAWFAHZSBjs.r.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _44 => _44.ledgerVersion])}});return i.data}catch(i){throw E.fromErrorType({type:22,error:i})}}async function Ku(n){let{aptosConfig:e,options:t}=n,r="0x1::keyless_account::Groth16VerificationKey";try{let{data:i}=await V({aptosConfig:e,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${_chunkAWFAHZSBjs.r.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([t, 'optionalAccess', _45 => _45.ledgerVersion])}});return i.data}catch(i){throw E.fromErrorType({type:23,error:i})}}async function Ru(n){let{aptosConfig:e,jwkAddr:t,options:r}=n,i;if(t){let s="0x1::jwks::FederatedJWKs",{data:a}=await V({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _46 => _46.ledgerVersion])}});i=a}else{let s="0x1::jwks::PatchedJWKs",{data:a}=await V({aptosConfig:e,originMethod:"getKeylessJWKs",path:`accounts/0x1/resource/${s}`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _47 => _47.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:p}=c.variant,g=new v(_chunkAWFAHZSBjs.j.fromHexInput(p).toUint8Array()),A=wi.deserialize(g);a.push(A)}o.set(_chunkAWFAHZSBjs.k.call(void 0, s.issuer),a)}return o}var wi=class n extends _chunkAWFAHZSBjs.l{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 v(_chunkAWFAHZSBjs.j.fromHexInput(t).toUint8Array());return n.deserialize(r)}toScalar(){if(this.alg!=="RS256")throw E.fromErrorType({type:32,details:"Failed to convert JWK to scalar when calculating the public inputs hash. Only RSA 256 is supported currently"});let e=_chunkAWFAHZSBjs.B.call(void 0, this.n),r=Uu(e.reverse()).map(i=>It(i));return r.push(256n),Ct(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 Uu(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 ku(n){try{let e=JSON.parse(n);if(e.kid===void 0)throw new Error("JWT header missing kid");return e}catch (e2){throw new Error("Failed to parse JWT header.")}}var L=class n extends se{constructor(e,t){super(),this.jwkAddress=_chunkAWFAHZSBjs.r.from(e),this.keylessPublicKey=t}authKey(){let e=new _chunkAWFAHZSBjs.m;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),H.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}verifySignature(e){try{return dr({...e,publicKey:this}),!0}catch (e3){return!1}}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let t=_chunkAWFAHZSBjs.r.deserialize(e),r=K.deserialize(e);return new n(t,r)}static isPublicKey(e){return e instanceof n}async verifySignatureAsync(e){return Si({...e,publicKey:this})}static create(e){return new n(e.jwkAddress,K.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,K.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof _chunkAWFAHZSBjs.r&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof K}};var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Ne=class Ne extends Ye{constructor(t){super();this.keyType="secp256k1";let r=_chunkAWFAHZSBjs.j.fromHexInput(t),{length:i}=r.toUint8Array();if(i===Ne.LENGTH)this.key=r;else if(i===Ne.COMPRESSED_LENGTH){let o=_secp256k1.secp256k1.ProjectivePoint.fromHex(r.toUint8Array());this.key=_chunkAWFAHZSBjs.j.fromHexInput(o.toRawBytes(!1))}else throw new Error(`PublicKey length should be ${Ne.LENGTH} or ${Ne.COMPRESSED_LENGTH}, received ${i}`)}verifySignature(t){let{message:r,signature:i}=t,o=Qt(r),s=_chunkAWFAHZSBjs.j.fromHexInput(o).toUint8Array(),a=_sha3.sha3_256.call(void 0, s),c=i.toUint8Array();return _secp256k1.secp256k1.verify(c,a,this.key.toUint8Array(),{lowS:!0})}async verifySignatureAsync(t){return this.verifySignature(t)}toUint8Array(){return this.key.toUint8Array()}serialize(t){t.serializeBytes(this.key.toUint8Array())}deserialize(t){let r=t.deserializeBytes();return new nt(r)}static deserialize(t){let r=t.deserializeBytes();return new Ne(r)}static isPublicKey(t){return t instanceof Ne}static isInstance(t){return"key"in t&&_optionalChain([t, 'access', _48 => _48.key, 'optionalAccess', _49 => _49.data, 'optionalAccess', _50 => _50.length])===Ne.LENGTH&&"keyType"in t&&t.keyType==="secp256k1"}};Ne.LENGTH=65,Ne.COMPRESSED_LENGTH=33;var ze=Ne,We=class We extends _chunkAWFAHZSBjs.l{constructor(e,t){super();let r=we.parseHexInput(e,"secp256k1",t);if(r.toUint8Array().length!==We.LENGTH)throw new Error(`PrivateKey length should be ${We.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new We(e,!1)}static fromDerivationPath(e,t){if(!wo(e))throw new Error(`Invalid derivation path ${e}`);return We.fromDerivationPathInner(e,ir(t))}static fromDerivationPathInner(e,t){let{privateKey:r}=_bip32.HDKey.fromMasterSeed(t).derive(e);if(r===null)throw new Error("Invalid key");return new We(r,!1)}sign(e){let t=Qt(e),r=_chunkAWFAHZSBjs.j.fromHexInput(t),i=_sha3.sha3_256.call(void 0, r.toUint8Array()),o=_secp256k1.secp256k1.sign(i,this.key.toUint8Array(),{lowS:!0});return new nt(o.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new ze(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.key.toString()}toAIP80String(){return we.formatPrivateKey(this.key.toString(),"secp256k1")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new We(t,!1)}static isPrivateKey(e){return e instanceof We}};We.LENGTH=32;var tt=We,jt=class jt extends F{constructor(e){super();let t=_chunkAWFAHZSBjs.j.fromHexInput(e);if(t.toUint8Array().length!==jt.LENGTH)throw new Error(`Signature length should be ${jt.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 jt(t)}};jt.LENGTH=64;var nt=jt;var _nistjs = require('@noble/curves/nist.js');var _e=class _e extends Ye{constructor(t){super();this.keyType="secp256r1";let r=_chunkAWFAHZSBjs.j.fromHexInput(t),i=r.toUint8Array().length;if(i!==_e.LENGTH&&i!==_e.COMPRESSED_LENGTH)throw new Error(`PublicKey length should be ${_e.LENGTH} or ${_e.COMPRESSED_LENGTH}, received ${i}`);if(i===_e.COMPRESSED_LENGTH){let o=_nistjs.p256.ProjectivePoint.fromHex(r.toUint8Array());this.key=_chunkAWFAHZSBjs.j.fromHexInput(o.toRawBytes(!1))}else this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}bcsToBytes(){let t=new _chunkAWFAHZSBjs.m;return this.serialize(t),t.toUint8Array()}verifySignature(t){let{message:r,signature:i}=t,o=_chunkAWFAHZSBjs.j.fromHexInput(r).toUint8Array(),s=_sha3.sha3_256.call(void 0, o),a=i.toUint8Array();return _nistjs.p256.verify(a,s,this.toUint8Array())}async verifySignatureAsync(t){return this.verifySignature({message:t.message,signature:t.signature})}serialize(t){t.serializeBytes(this.key.toUint8Array())}static deserialize(t){let r=t.deserializeBytes();return new _e(r)}static load(t){let r=t.deserializeBytes();return new _e(r)}static isInstance(t){return"key"in t&&_optionalChain([t, 'access', _51 => _51.key, 'optionalAccess', _52 => _52.data, 'optionalAccess', _53 => _53.length])===_e.LENGTH&&"keyType"in t&&t.keyType==="secp256r1"}authKey(){let t=new _chunkAWFAHZSBjs.m;return t.serializeU32AsUleb128(2),t.serializeFixedBytes(this.bcsToBytes()),H.fromSchemeAndBytes({scheme:2,input:t.toUint8Array()})}};_e.LENGTH=65,_e.COMPRESSED_LENGTH=33;var Yt=_e,Kt=class Kt extends we{constructor(e,t){super();let r=we.parseHexInput(e,"secp256r1",t),i=r.toUint8Array().length;if(i!==Kt.LENGTH)throw new Error(`PrivateKey length should be ${Kt.LENGTH}, received ${i}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return we.formatPrivateKey(this.key.toString(),"secp256r1")}toHexString(){return this.key.toString()}sign(e){let t=_chunkAWFAHZSBjs.j.fromHexInput(e),r=_sha3.sha3_256.call(void 0, t.toUint8Array()),i=_nistjs.p256.sign(r,this.key.toUint8Array());return new Pi(i.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Kt(t)}static generate(){let e=_nistjs.p256.utils.randomPrivateKey();return new Kt(e)}publicKey(){let e=_nistjs.p256.getPublicKey(this.key.toUint8Array(),!1);return new Yt(e)}};Kt.LENGTH=32;var Wo=Kt,vn= exports.WebAuthnSignature =class n extends F{constructor(e,t,r){super(),this.signature=_chunkAWFAHZSBjs.j.fromHexInput(e),this.authenticatorData=_chunkAWFAHZSBjs.j.fromHexInput(t),this.clientDataJSON=_chunkAWFAHZSBjs.j.fromHexInput(r)}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(0),e.serializeBytes(this.signature.toUint8Array()),e.serializeBytes(this.authenticatorData.toUint8Array()),e.serializeBytes(this.clientDataJSON.toUint8Array())}bcsToBytes(){let e=new _chunkAWFAHZSBjs.m;return this.serialize(e),e.toUint8Array()}bcsToHex(){return _chunkAWFAHZSBjs.j.fromHexInput(this.bcsToBytes())}toStringWithoutPrefix(){return _chunkAWFAHZSBjs.j.fromHexInput(this.bcsToBytes()).toString()}static deserialize(e){let t=e.deserializeUleb128AsU32();if(t!==0)throw new Error(`Invalid id for WebAuthnSignature: ${t}`);let r=e.deserializeBytes(),i=e.deserializeBytes(),o=e.deserializeBytes();return new n(r,i,o)}},Jt=class Jt extends F{constructor(e){super();let t=_chunkAWFAHZSBjs.j.fromHexInput(e),r=t.toUint8Array().length;if(r!==Jt.LENGTH)throw new Error(`Signature length should be ${Jt.LENGTH}, received ${r}`);let i=_nistjs.p256.Signature.fromCompact(t.toUint8Array()).normalizeS().toCompactRawBytes();this.data=_chunkAWFAHZSBjs.j.fromHexInput(i)}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Jt(t)}};Jt.LENGTH=64;var Pi=Jt;var x=class n extends se{constructor(e){if(super(),this.publicKey=e,e instanceof P)this.variant=0;else if(e instanceof ze)this.variant=1;else if(e instanceof Yt)this.variant=2;else if(e instanceof K)this.variant=3;else if(e instanceof L)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:t,signature:r}=e;if(this.publicKey instanceof K)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 O)){if(_optionalChain([e, 'access', _54 => _54.options, 'optionalAccess', _55 => _55.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 H.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=P.deserialize(e);break;case 1:r=ze.deserialize(e);break;case 2:r=Yt.deserialize(e);break;case 3:r=K.deserialize(e);break;case 4:r=L.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 P}isSecp256k1PublicKey(){return this.publicKey instanceof ze}static isInstance(e){return"publicKey"in e&&"variant"in e}},O= exports.AnySignature =class n extends F{constructor(e){if(super(),this.signature=e,e instanceof R)this.variant=0;else if(e instanceof nt)this.variant=1;else if(e instanceof vn)this.variant=2;else if(e instanceof ae)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=R.deserialize(e);break;case 1:r=nt.deserialize(e);break;case 2:r=vn.deserialize(e);break;case 3:r=ae.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 zu(n){let e=n;return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}var lr=3,De= exports.AbstractMultiKey =class extends se{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),p=i[c];p|=r>>s%8,i[c]=p}),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= exports.MultiKey =class n extends De{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 x?i:new x(i)),r>lr&&this.publicKeys.filter(o=>o.variant===3||o.variant===4).length>lr)throw new Error(`Construction of MultiKey with more than ${lr} keyless public keys is not allowed when signaturesRequired
7
+ is greater than ${lr}. This is because a maximum of 3 keyless signatures are supported for a
8
+ 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 Pe))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(_optionalChain([e, 'access', _56 => _56.options, 'optionalAccess', _57 => _57.throwErrorWithReason]))throw r;return!1}}authKey(){return H.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let t=e.deserializeVector(x),r=e.deserializeU8();return new n({publicKeys:t,signaturesRequired:r})}getIndex(e){let t=e instanceof x?e:new x(e);return super.getIndex(t)}static isInstance(e){return"publicKeys"in e&&"signaturesRequired"in e}},me=class me extends F{constructor(e){super();let{signatures:t,bitmap:r}=e;if(t.length>me.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${me.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=t.map(o=>o instanceof O?o:new O(o)),!(r instanceof Uint8Array))this.bitmap=me.createBitmap({bits:r});else{if(r.length!==me.BITMAP_LEN)throw new Error(`"bitmap" length should be ${me.BITMAP_LEN}`);this.bitmap=r}let i=this.bitmap.reduce((o,s)=>o+zu(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>=me.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${me.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(O),r=e.deserializeBytes();return new me({signatures:t,bitmap:r})}};me.BITMAP_LEN=4,me.MAX_SIGNATURES_SUPPORTED=me.BITMAP_LEN*8;var Pe=me;var fe=class fe extends De{constructor(e){let{publicKeys:t,threshold:r}=e;if(super({publicKeys:t}),t.length>fe.MAX_KEYS||t.length<fe.MIN_KEYS)throw new Error(`Must have between ${fe.MIN_KEYS} and ${fe.MAX_KEYS} public keys, inclusive`);if(r<fe.MIN_THRESHOLD||r>t.length)throw new Error(`Threshold must be between ${fe.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 Fe))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 H.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*P.LENGTH+1);return this.publicKeys.forEach((t,r)=>{e.set(t.toUint8Array(),r*P.LENGTH)}),e[this.publicKeys.length*P.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+=P.LENGTH){let s=o;i.push(new P(t.subarray(s,s+P.LENGTH)))}return new fe({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+=P.LENGTH){let a=s;o.push(new P(r.subarray(a,a+P.LENGTH)))}return new fe({publicKeys:o,threshold:i})}getIndex(e){return super.getIndex(e)}};fe.MAX_KEYS=32,fe.MIN_KEYS=2,fe.MIN_THRESHOLD=1;var re=fe,Ae=class Ae extends F{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*R.LENGTH+Ae.BITMAP_LEN);return this.signatures.forEach((t,r)=>{e.set(t.toUint8Array(),r*R.LENGTH)}),e.set(this.bitmap,this.signatures.length*R.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+=R.LENGTH){let s=o;i.push(new R(t.subarray(s,s+R.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),p=i[c];p|=r>>s%8,i[c]=p}),i}};Ae.MAX_SIGNATURES_SUPPORTED=32,Ae.BITMAP_LEN=4;var Fe=Ae;var Qt=n=>typeof n=="string"?_chunkAWFAHZSBjs.j.isValid(n).valid?n:new TextEncoder().encode(n):n,Ei=n=>{if(n instanceof P||n instanceof x||n instanceof re||n instanceof W)return n;if(n instanceof K||n instanceof L)return new x(n);throw new Error(`Unknown account public key: ${n}`)},Qo=n=>{let e=Ei(n);if(e instanceof P)return 0;if(e instanceof x)return 2;if(e instanceof re)return 1;if(e instanceof W)return 3;throw new Error(`Unknown signing scheme: ${e}`)};var xi=[237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16];function Du(n){let e=n.toUint8Array().slice(32);for(let t=xi.length-1;t>=0;t-=1){if(e[t]<xi[t])return!0;if(e[t]>xi[t])return!1}return!1}var wt=class wt extends se{constructor(e){super();let t=_chunkAWFAHZSBjs.j.fromHexInput(e);if(t.toUint8Array().length!==wt.LENGTH)throw new Error(`PublicKey length should be ${wt.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!Du(r))return!1;let i=Qt(t),o=_chunkAWFAHZSBjs.j.fromHexInput(i).toUint8Array(),s=r.toUint8Array(),a=this.key.toUint8Array();return _ed25519.ed25519.verify(s,o,a)}async verifySignatureAsync(e){return this.verifySignature(e)}authKey(){return H.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new wt(t)}static isPublicKey(e){return e instanceof wt}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _58 => _58.key, 'optionalAccess', _59 => _59.data, 'optionalAccess', _60 => _60.length])===wt.LENGTH}};wt.LENGTH=32;var P=wt,Ee=class Ee extends _chunkAWFAHZSBjs.l{constructor(e,t){super();let r=we.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==Ee.LENGTH)throw new Error(`PrivateKey length should be ${Ee.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new Ee(e,!1)}static fromDerivationPath(e,t){if(!So(e))throw new Error(`Invalid derivation path ${e}`);return Ee.fromDerivationPathInner(e,ir(t))}static fromDerivationPathInner(e,t,r=To){let{key:i,chainCode:o}=si(Ee.SLIP_0010_SEED,t),s=Po(e).map(c=>parseInt(c,10)),{key:a}=s.reduce((c,p)=>_o(c,p+r),{key:i,chainCode:o});return new Ee(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new P(e)}sign(e){let t=Qt(e),r=_chunkAWFAHZSBjs.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new R(i)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.toAIP80String()}toHexString(){return this.signingKey.toString()}toAIP80String(){return we.formatPrivateKey(this.signingKey.toString(),"ed25519")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let t=e.deserializeBytes();return new Ee(t,!1)}static isPrivateKey(e){return e instanceof Ee}};Ee.LENGTH=32,Ee.SLIP_0010_SEED="ed25519 seed";var J=Ee,Zt=class Zt extends F{constructor(e){super();let t=_chunkAWFAHZSBjs.j.fromHexInput(e);if(t.toUint8Array().length!==Zt.LENGTH)throw new Error(`Signature length should be ${Zt.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 Zt(t)}};Zt.LENGTH=64;var R=Zt;var yr="Multiple possible deserializations found";function Vy(n){let e=[P,x,re,W,K,L,ze],t;for(let r of e)try{let i=v.fromHex(n),o=r.deserialize(i);if(i.assertFinished(),t)throw new Error(`${yr}: ${n}`);t=o}catch(i){if(i instanceof Error&&i.message.includes(yr))throw i}if(!t)throw new Error(`Failed to deserialize public key: ${n}`);return t}function Ly(n){let e=[R,O,Fe,Pe,ae,nt],t;for(let r of e)try{let i=v.fromHex(n),o=r.deserialize(i);if(i.assertFinished(),t)throw new Error(`${yr}: ${n}`);t=o}catch(i){if(i instanceof Error&&i.message.includes(yr))throw i}if(!t)throw new Error(`Failed to deserialize signature: ${n}`);return t}var Z=class extends _chunkAWFAHZSBjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Oe.load(e);case 1:return rt.load(e);case 2:return ce.load(e);case 3:return je.load(e);case 4:return en.load(e);case 5:return Rt.load(e);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${t}`)}}isEd25519(){return this instanceof Oe}isMultiEd25519(){return this instanceof rt}isSingleKey(){return this instanceof ce}isMultiKey(){return this instanceof je}},Oe= exports.AccountAuthenticatorEd25519 =class n extends Z{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=P.deserialize(e),r=R.deserialize(e);return new n(t,r)}},rt= exports.AccountAuthenticatorMultiEd25519 =class n extends Z{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=re.deserialize(e),r=Fe.deserialize(e);return new n(t,r)}},ce= exports.AccountAuthenticatorSingleKey =class n extends Z{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=x.deserialize(e),r=O.deserialize(e);return new n(t,r)}},je= exports.AccountAuthenticatorMultiKey =class n extends Z{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=Pe.deserialize(e);return new n(t,r)}},en= exports.AccountAuthenticatorNoAccountAuthenticator =class n extends Z{serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},Rt= exports.AccountAuthenticatorAbstraction =class n extends Z{constructor(e,t,r,i){if(super(),!_chunkAWFAHZSBjs.H.call(void 0, e))throw new Error(`Invalid function info ${e} passed into AccountAuthenticatorAbstraction`);this.functionInfo=e,this.abstractionSignature=r,this.signingMessageDigest=_chunkAWFAHZSBjs.j.fromHexInput(_chunkAWFAHZSBjs.j.fromHexInput(t).toUint8Array()),this.accountIdentity=i}serialize(e){e.serializeU32AsUleb128(5);let{moduleAddress:t,moduleName:r,functionName:i}=_chunkAWFAHZSBjs.G.call(void 0, this.functionInfo);_chunkAWFAHZSBjs.r.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.abstractionSignature):e.serializeFixedBytes(this.abstractionSignature),this.accountIdentity&&e.serializeBytes(this.accountIdentity)}static load(e){let t=_chunkAWFAHZSBjs.r.deserialize(e),r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeUleb128AsU32(),s=e.deserializeBytes();if(o===0){let a=e.deserializeFixedBytes(e.remaining());return new n(`${t}::${r}::${i}`,s,a)}if(o===1){let a=e.deserializeBytes(),c=e.deserializeBytes();return new n(`${t}::${r}::${i}`,s,a,c)}throw new Error(`Unknown variant index for AccountAuthenticatorAbstraction: ${o}`)}},mr= exports.AccountAbstractionMessage =class n extends _chunkAWFAHZSBjs.l{constructor(e,t){super(),this.originalSigningMessage=_chunkAWFAHZSBjs.j.fromHexInput(_chunkAWFAHZSBjs.j.fromHexInput(e).toUint8Array()),this.functionInfo=t}serialize(e){e.serializeU32AsUleb128(0),e.serializeBytes(this.originalSigningMessage.toUint8Array());let{moduleAddress:t,moduleName:r,functionName:i}=_chunkAWFAHZSBjs.G.call(void 0, this.functionInfo);_chunkAWFAHZSBjs.r.fromString(t).serialize(e),e.serializeStr(r),e.serializeStr(i)}static deserialize(e){let t=e.deserializeUleb128AsU32();if(t!==0)throw new Error(`Unknown variant index for AccountAbstractionMessage: ${t}`);let r=e.deserializeBytes(),i=_chunkAWFAHZSBjs.r.deserialize(e),o=e.deserializeStr(),s=e.deserializeStr(),a=`${i}::${o}::${s}`;return new n(r,a)}};var tn=class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let t=e.deserializeU8();return new n(t)}};var k=class n extends _chunkAWFAHZSBjs.l{constructor(e){super(),this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let t=e.deserializeStr();return new n(t)}};var Kn=class n extends _chunkAWFAHZSBjs.l{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(_chunkAWFAHZSBjs.r.fromString(t[0]),new k(t[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let t=_chunkAWFAHZSBjs.r.deserialize(e),r=k.deserialize(e);return new n(t,r)}};var M=class n extends _chunkAWFAHZSBjs.l{deserialize(e){let t=_chunkAWFAHZSBjs.r.deserialize(e),r=k.deserialize(e),i=k.deserialize(e),o=e.deserializeVector(n);return new Qe(t,r,i,o)}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return j.load(e);case 1:return ue.load(e);case 2:return ee.load(e);case 3:return st.load(e);case 4:return G.load(e);case 5:return Ut.load(e);case 6:return U.load(e);case 7:return h.load(e);case 8:return it.load(e);case 9:return ot.load(e);case 10:return at.load(e);case 255:return B.load(e);default:throw new Error(`Unknown variant index for TypeTag: ${t}`)}}isBool(){return this instanceof j}isAddress(){return this instanceof G}isGeneric(){return this instanceof B}isSigner(){return this instanceof Ut}isVector(){return this instanceof U}isStruct(){return this instanceof h}isU8(){return this instanceof ue}isU16(){return this instanceof it}isU32(){return this instanceof ot}isU64(){return this instanceof ee}isU128(){return this instanceof st}isU256(){return this instanceof at}isPrimitive(){return this instanceof Ut||this instanceof G||this instanceof j||this instanceof ue||this instanceof it||this instanceof ot||this instanceof ee||this instanceof st||this instanceof at}},j= exports.TypeTagBool =class n extends M{toString(){return"bool"}serialize(e){e.serializeU32AsUleb128(0)}static load(e){return new n}},ue= exports.TypeTagU8 =class n extends M{toString(){return"u8"}serialize(e){e.serializeU32AsUleb128(1)}static load(e){return new n}},it= exports.TypeTagU16 =class n extends M{toString(){return"u16"}serialize(e){e.serializeU32AsUleb128(8)}static load(e){return new n}},ot= exports.TypeTagU32 =class n extends M{toString(){return"u32"}serialize(e){e.serializeU32AsUleb128(9)}static load(e){return new n}},ee= exports.TypeTagU64 =class n extends M{toString(){return"u64"}serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},st= exports.TypeTagU128 =class n extends M{toString(){return"u128"}serialize(e){e.serializeU32AsUleb128(3)}static load(e){return new n}},at= exports.TypeTagU256 =class n extends M{toString(){return"u256"}serialize(e){e.serializeU32AsUleb128(10)}static load(e){return new n}},G= exports.TypeTagAddress =class n extends M{toString(){return"address"}serialize(e){e.serializeU32AsUleb128(4)}static load(e){return new n}},Ut= exports.TypeTagSigner =class n extends M{toString(){return"signer"}serialize(e){e.serializeU32AsUleb128(5)}static load(e){return new n}},fr= exports.TypeTagReference =class n extends M{constructor(t){super();this.value=t}toString(){return`&${this.value.toString()}`}serialize(t){t.serializeU32AsUleb128(254)}static load(t){let r=M.deserialize(t);return new n(r)}},B= exports.TypeTagGeneric =class n extends M{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)}},U= exports.TypeTagVector =class n extends M{constructor(t){super();this.value=t}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ue)}serialize(t){t.serializeU32AsUleb128(6),this.value.serialize(t)}static load(t){let r=M.deserialize(t);return new n(r)}},h= exports.TypeTagStruct =class n extends M{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=Qe.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(_chunkAWFAHZSBjs.r.ONE,"string","String")}isOption(){return this.isTypeTag(_chunkAWFAHZSBjs.r.ONE,"option","Option")}isObject(){return this.isTypeTag(_chunkAWFAHZSBjs.r.ONE,"object","Object")}isDelegationKey(){return this.isTypeTag(_chunkAWFAHZSBjs.r.ONE,"permissioned_delegation","DelegationKey")}isRateLimiter(){return this.isTypeTag(_chunkAWFAHZSBjs.r.ONE,"rate_limiter","RateLimiter")}},Qe= exports.StructTag =class n extends _chunkAWFAHZSBjs.l{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=_chunkAWFAHZSBjs.r.deserialize(e),r=k.deserialize(e),i=k.deserialize(e),o=e.deserializeVector(M);return new n(t,r,i,o)}};function Am(){return new Qe(_chunkAWFAHZSBjs.r.ONE,new k("aptos_coin"),new k("AptosCoin"),[])}function I(){return new Qe(_chunkAWFAHZSBjs.r.ONE,new k("string"),new k("String"),[])}function hm(n){return new Qe(_chunkAWFAHZSBjs.r.ONE,new k("option"),new k("Option"),[n])}function he(n){return new Qe(_chunkAWFAHZSBjs.r.ONE,new k("object"),new k("Object"),[n])}function Fu(n){let e=n.deserializeUleb128AsU32();switch(e){case 0:return Y.deserialize(n);case 1:return $.deserialize(n);case 2:return Ue.deserialize(n);case 3:return _chunkAWFAHZSBjs.r.deserialize(n);case 4:return S.deserialize(n,Y);case 5:return D.deserialize(n);case 6:return Ke.deserialize(n);case 7:return Re.deserialize(n);case 8:return Te.deserialize(n);case 9:return wn.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${e}`)}}var St=class extends _chunkAWFAHZSBjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return nn.load(e);case 2:return rn.load(e);case 3:return on.load(e);case 4:return Ar.deserialize(e);default:throw new Error(`Unknown variant index for TransactionPayload: ${t}`)}}},nn= exports.TransactionPayloadScript =class n extends St{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=sn.deserialize(e);return new n(t)}},rn= exports.TransactionPayloadEntryFunction =class n extends St{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let t=ct.deserialize(e);return new n(t)}},on= exports.TransactionPayloadMultiSig =class n extends St{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)}},ct= exports.EntryFunction =class n{constructor(e,t,r,i){this.module_name=e,this.function_name=t,this.type_args=r,this.args=i}static build(e,t,r,i){return new n(Kn.fromStr(e),new k(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=Kn.deserialize(e),r=k.deserialize(e),i=e.deserializeVector(M),o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=e.deserializeUleb128AsU32(),p=nr.deserialize(e,c);s.push(p)}return new n(t,r,i,s)}},sn= exports.Script =class n{constructor(e,t,r){this.bytecode=e,this.type_args=t,this.args=r}serialize(e){e.serializeBytes(this.bytecode),e.serializeVector(this.type_args),e.serializeU32AsUleb128(this.args.length),this.args.forEach(t=>{t.serializeForScriptFunction(e)})}static deserialize(e){let t=e.deserializeBytes(),r=e.deserializeVector(M),i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=Fu(e);o.push(a)}return new n(t,r,o)}},Rn= exports.MultiSig =class n{constructor(e,t){this.multisig_address=e,this.transaction_payload=t}serialize(e){this.multisig_address.serialize(e),this.transaction_payload===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.transaction_payload.serialize(e))}static deserialize(e){let t=_chunkAWFAHZSBjs.r.deserialize(e),r=e.deserializeBool(),i;return r&&(i=Un.deserialize(e)),new n(t,i)}},Un= exports.MultiSigTransactionPayload =class n extends _chunkAWFAHZSBjs.l{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(ct.deserialize(e))}},Ar= exports.TransactionInnerPayload =class extends St{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return kt.load(e);default:throw new Error(`Unknown variant index for TransactionInnerPayload: ${t}`)}}},kt= exports.TransactionInnerPayloadV1 =class n extends Ar{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=an.deserialize(e),r=hr.deserialize(e);return new n(t,r)}},an= exports.TransactionExecutable =class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return kn.load(e);case 1:return cn.load(e);case 2:return Nn.load(e);default:throw new Error(`Unknown variant index for TransactionExecutable: ${t}`)}}},kn= exports.TransactionExecutableScript =class n extends an{constructor(e){super(),this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let t=sn.deserialize(e);return new n(t)}},cn= exports.TransactionExecutableEntryFunction =class n extends an{constructor(e){super(),this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(1),this.entryFunction.serialize(e)}static load(e){let t=ct.deserialize(e);return new n(t)}},Nn= exports.TransactionExecutableEmpty =class n extends an{serialize(e){e.serializeU32AsUleb128(2)}static load(e){return new n}},hr= exports.TransactionExtraConfig =class{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Nt.load(e);default:throw new Error(`Unknown variant index for TransactionExtraConfig: ${t}`)}}},Nt= exports.TransactionExtraConfigV1 =class n extends hr{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 $(this.replayProtectionNonce):void 0)}static load(e){let t=e.deserializeOption(_chunkAWFAHZSBjs.r),r=e.deserializeOption($);return new n(t,_optionalChain([r, 'optionalAccess', _61 => _61.value]))}};var xe=class n extends _chunkAWFAHZSBjs.l{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=_chunkAWFAHZSBjs.r.deserialize(e),r=e.deserializeU64(),i=St.deserialize(e),o=e.deserializeU64(),s=e.deserializeU64(),a=e.deserializeU64(),c=tn.deserialize(e);return new n(t,r,i,o,s,a,c)}},br= exports.RawTransactionWithData =class extends _chunkAWFAHZSBjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return zt.load(e);case 1:return Dt.load(e);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${t}`)}}},zt= exports.MultiAgentRawTransaction =class n extends br{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=xe.deserialize(e),r=e.deserializeVector(_chunkAWFAHZSBjs.r);return new n(t,r)}},Dt= exports.FeePayerRawTransaction =class n extends br{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=xe.deserialize(e),r=e.deserializeVector(_chunkAWFAHZSBjs.r),i=_chunkAWFAHZSBjs.r.deserialize(e);return new n(t,r,i)}};var Tr=class extends _chunkAWFAHZSBjs.l{constructor(t){super();this.accountAddress=_chunkAWFAHZSBjs.r.ONE;this.moduleName=new C("account");this.structName=new C("RotationProofChallenge");this.sequenceNumber=new $(t.sequenceNumber),this.originator=t.originator,this.currentAuthKey=t.currentAuthKey,this.newPublicKey=S.U8(t.newPublicKey.toUint8Array())}serialize(t){t.serialize(this.accountAddress),t.serialize(this.moduleName),t.serialize(this.structName),t.serialize(this.sequenceNumber),t.serialize(this.originator),t.serialize(this.currentAuthKey),t.serialize(this.newPublicKey)}};var ut=class extends _chunkAWFAHZSBjs.l{static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return Ft.load(e);case 1:return un.load(e);case 2:return Ot.load(e);case 3:return Gt.load(e);case 4:return _t.load(e);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${t}`)}}isEd25519(){return this instanceof Ft}isMultiEd25519(){return this instanceof un}isMultiAgent(){return this instanceof Ot}isFeePayer(){return this instanceof Gt}isSingleSender(){return this instanceof _t}},Ft= exports.TransactionAuthenticatorEd25519 =class n extends ut{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=P.deserialize(e),r=R.deserialize(e);return new n(t,r)}},un= exports.TransactionAuthenticatorMultiEd25519 =class n extends ut{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=re.deserialize(e),r=Fe.deserialize(e);return new n(t,r)}},Ot= exports.TransactionAuthenticatorMultiAgent =class n extends ut{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=Z.deserialize(e),r=e.deserializeVector(_chunkAWFAHZSBjs.r),i=e.deserializeVector(Z);return new n(t,r,i)}},Gt= exports.TransactionAuthenticatorFeePayer =class n extends ut{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=Z.deserialize(e),r=e.deserializeVector(_chunkAWFAHZSBjs.r),i=e.deserializeVector(Z),o=_chunkAWFAHZSBjs.r.deserialize(e),s=Z.deserialize(e),a={address:o,authenticator:s};return new n(t,r,i,a)}},_t= exports.TransactionAuthenticatorSingleSender =class n extends ut{constructor(e){super(),this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let t=Z.deserialize(e);return new n(t)}};var pt=class n extends _chunkAWFAHZSBjs.l{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=xe.deserialize(e),r=ut.deserialize(e);return new n(t,r)}};var wr=class n extends _chunkAWFAHZSBjs.l{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=xe.deserialize(e),r=e.deserializeBool(),i;return r&&(i=_chunkAWFAHZSBjs.r.deserialize(e)),new n(t,i)}};var Sr=class n extends _chunkAWFAHZSBjs.l{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=xe.deserialize(e),r=e.deserializeVector(_chunkAWFAHZSBjs.r),i=e.deserializeBool(),o;return i&&(o=_chunkAWFAHZSBjs.r.deserialize(e)),new n(t,r,o)}};function _r(n){return n.feePayerAddress?new Dt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new zt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function $e(n,e){let t=_sha3.sha3_256.create();if(!e.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${e}`);t.update(e);let r=t.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function ff(n){return $e(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function Ge(n){let e=_r(n);return n.feePayerAddress?$e(e.bcsToBytes(),li):n.secondarySignerAddresses?$e(e.bcsToBytes(),li):$e(e.bcsToBytes(),No)}var ie=class n{constructor(e){this.signingScheme=0;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=t.publicKey(),this.accountAddress=r?_chunkAWFAHZSBjs.r.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let e=J.generate();return new n({privateKey:e})}static fromDerivationPath(e){let{path:t,mnemonic:r}=e,i=J.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 Oe(this.publicKey,this.privateKey.sign(e))}signTransactionWithAuthenticator(e){return new Oe(this.publicKey,this.signTransaction(e))}sign(e){return this.privateKey.sign(e)}signTransaction(e){return this.sign(Ge(e))}};function Ii(n){return typeof n=="object"&&n!==null&&"getAnyPublicKey"in n&&typeof n.getAnyPublicKey=="function"}var pe=class n{constructor(e){this.signingScheme=2;let{privateKey:t,address:r}=e;this.privateKey=t,this.publicKey=new x(t.publicKey()),this.accountAddress=r?_chunkAWFAHZSBjs.r.from(r):this.publicKey.authKey().derivedAddress()}getAnyPublicKey(){return this.publicKey}static generate(e={}){let{scheme:t=0}=e,r;switch(t){case 0:r=J.generate();break;case 2:r=tt.generate();break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:r})}static fromDerivationPath(e){let{scheme:t=0,path:r,mnemonic:i}=e,o;switch(t){case 0:o=J.fromDerivationPath(r,i);break;case 2:o=tt.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${t}`)}return new n({privateKey:o})}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return this.publicKey.verifySignatureAsync({...e,signature:e.signature})}signWithAuthenticator(e){return new ce(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new ce(this.publicKey,this.signTransaction(e))}sign(e){return new O(this.privateKey.sign(e))}signTransaction(e){return this.sign(Ge(e))}static fromEd25519Account(e){return new n({privateKey:e.privateKey,address:e.accountAddress})}};var dt=class{static generate(e={}){let{scheme:t=0,legacy:r=!0}=e;return t===0&&r?ie.generate():pe.generate({scheme:t})}static fromPrivateKey(e){let{privateKey:t,address:r,legacy:i=!0}=e;return t instanceof J&&i?new ie({privateKey:t,address:r}):new pe({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?ie.fromDerivationPath({mnemonic:r,path:i}):pe.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)}};var _utils3 = require('@noble/hashes/utils');var Mu=1209600,pn=class pn extends _chunkAWFAHZSBjs.l{constructor(e){super();let{privateKey:t,expiryDateSecs:r,blinder:i}=e;this.privateKey=t,this.publicKey=new ht(t.publicKey()),this.expiryDateSecs=r||_chunkAWFAHZSBjs.z.call(void 0, _chunkAWFAHZSBjs.y.call(void 0, )+Mu),this.blinder=i!==void 0?_chunkAWFAHZSBjs.j.fromHexInput(i).toUint8Array():Bu();let o=Pn(this.publicKey.bcsToBytes(),93);o.push(BigInt(this.expiryDateSecs)),o.push(It(this.blinder));let s=Ct(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=J.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${t}`)}let i=e.deserializeU64(),o=e.deserializeFixedBytes(31);return new pn({privateKey:r,expiryDateSecs:Number(i),blinder:o})}static fromBytes(e){return pn.deserialize(new v(e))}static generate(e){let t;switch(_optionalChain([e, 'optionalAccess', _62 => _62.scheme])){case 0:default:t=J.generate()}return new pn({privateKey:t,expiryDateSecs:_optionalChain([e, 'optionalAccess', _63 => _63.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new He(this.privateKey.sign(e))}};pn.BLINDER_LENGTH=31;var Mt=pn;function Bu(){return _utils3.randomBytes.call(void 0, Mt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);function Er(n){return n!=null&&typeof n.checkKeylessAccountValidity=="function"}var dn=class dn extends _chunkAWFAHZSBjs.l{constructor(t){super();this.signingScheme=2;let{address:r,ephemeralKeyPair:i,publicKey:o,uidKey:s,uidVal:a,aud:c,pepper:p,proof:g,proofFetchCallback:A,jwt:l,verificationKeyHash:d}=t;if(this.ephemeralKeyPair=i,this.publicKey=o,this.accountAddress=r?_chunkAWFAHZSBjs.r.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=s,this.uidVal=a,this.aud=c,this.jwt=l,this.emitter=new _eventemitter32.default,this.proofOrPromise=g,g instanceof ye)this.proof=g;else{if(A===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async z=>{await A(z),this.emitter.removeAllListeners()}),this.init(g)}let b=_chunkAWFAHZSBjs.j.fromHexInput(p).toUint8Array();if(b.length!==dn.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${dn.PEPPER_LENGTH}`);if(this.pepper=b,d!==void 0){if(_chunkAWFAHZSBjs.j.hexInputToUint8Array(d).length!==32)throw new Error("verificationKeyHash must be 32 bytes");this.verificationKeyHash=_chunkAWFAHZSBjs.j.hexInputToUint8Array(d)}}getAnyPublicKey(){return new x(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=_chunkAWFAHZSBjs.r.deserialize(t),i=t.deserializeStr(),o=t.deserializeStr(),s=t.deserializeFixedBytes(31),a=Mt.deserialize(t),c=ye.deserialize(t),p=t.deserializeOption("fixedBytes",32);return{address:r,jwt:i,uidKey:o,pepper:s,ephemeralKeyPair:a,proof:c,verificationKeyHash:p}}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(t){let r=new O(this.sign(t)),i=new x(this.publicKey);return new ce(i,r)}signTransactionWithAuthenticator(t){let r=new O(this.signTransaction(t)),i=new x(this.publicKey);return new ce(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}async checkKeylessAccountValidity(t){if(this.isExpired())throw E.fromErrorType({type:0});if(await this.waitForProofFetch(),this.proof===void 0)throw E.fromErrorType({type:2});let r=_jwtdecode.jwtDecode.call(void 0, this.jwt,{header:!0});if(r.kid===void 0)throw E.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 Wt({aptosConfig:t});if(_chunkAWFAHZSBjs.j.hexInputToString(i.hash())!==_chunkAWFAHZSBjs.j.hexInputToString(this.verificationKeyHash))throw E.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 dn.fetchJWK({aptosConfig:t,publicKey:this.publicKey,kid:r.kid})}sign(t){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw E.fromErrorType({type:0});if(this.proof===void 0)throw E.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 ae({jwtHeader:_chunkAWFAHZSBjs.A.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new qt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(t){if(this.proof===void 0)throw E.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=_r(t),o=new Pr(r,this.proof.proof).hash();return this.sign(o)}getSigningMessage(t){if(this.proof===void 0)throw E.fromErrorType({type:1,details:"Proof not found - make sure to call `await account.checkKeylessAccountValidity()` before signing."});let r=_r(t);return new Pr(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 _i(t)}};dn.PEPPER_LENGTH=31;var be=dn,Pr= exports.TransactionAndProof =class extends _chunkAWFAHZSBjs.l{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 $e(this.bcsToBytes(),this.domainSeparator)}};var Ie=class n extends be{constructor(e){let t=K.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}=be.partialDeserialize(e),{iss:p,aud:g,uidVal:A}=et({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:p,uidKey:s,uidVal:A,aud:g,pepper:a,jwt:o,verificationKeyHash:c})}static fromBytes(e){return n.deserialize(new v(_chunkAWFAHZSBjs.j.hexInputToUint8Array(e)))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c,verificationKey:p,verificationKeyHash:g}=e;if(g&&p)throw new Error("Cannot provide both verificationKey and verificationKeyHash");let{iss:A,aud:l,uidVal:d}=et({jwt:i,uidKey:a});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:A,uidKey:a,uidVal:d,aud:l,pepper:s,jwt:i,proofFetchCallback:c,verificationKeyHash:_nullishCoalesce(g, () => ((p?p.hash():void 0)))})}};var Me=class n extends be{constructor(e){let t=L.create(e);super({publicKey:t,...e}),this.publicKey=t,this.audless=_nullishCoalesce(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}=be.partialDeserialize(e),p=_chunkAWFAHZSBjs.r.deserialize(e),{iss:g,aud:A,uidVal:l}=et({jwt:o,uidKey:s});return new n({address:t,proof:r,ephemeralKeyPair:i,iss:g,uidKey:s,uidVal:l,aud:A,pepper:a,jwt:o,verificationKeyHash:c,jwkAddress:p})}static fromBytes(e){return n.deserialize(v.fromHex(e))}static create(e){let{address:t,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,jwkAddress:a,uidKey:c="sub",proofFetchCallback:p,verificationKey:g,verificationKeyHash:A}=e;if(A&&g)throw new Error("Cannot provide both verificationKey and verificationKeyHash");let{iss:l,aud:d,uidVal:b}=et({jwt:i,uidKey:c});return new n({address:t,proof:r,ephemeralKeyPair:o,iss:l,uidKey:c,uidVal:b,aud:d,pepper:s,jwkAddress:_chunkAWFAHZSBjs.r.from(a),jwt:i,proofFetchCallback:p,verificationKeyHash:_nullishCoalesce(A, () => ((g?g.hash():void 0)))})}};var lt=class n{constructor(e){this.signingScheme=3;let{multiKey:t,address:r}=e,i=e.signers.map(a=>a instanceof ie?pe.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?_chunkAWFAHZSBjs.r.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 je(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new je(this.publicKey,this.signTransaction(e))}async waitForProofFetch(){let t=this.signers.filter(r=>r instanceof be).map(async r=>r.waitForProofFetch());await Promise.all(t)}async checkKeylessAccountValidity(e){let r=this.signers.filter(i=>i instanceof be).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 Pe({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){let t=[];for(let r of this.signers)t.push(r.signTransaction(e));return new Pe({signatures:t,bitmap:this.signaturesBitmap})}verifySignature(e){return this.publicKey.verifySignature(e)}async verifySignatureAsync(e){return await this.publicKey.verifySignatureAsync(e)}};var zn=class{constructor(e){this.signingScheme=1;let{signers:t,publicKey:r,address:i}=e;if(this.publicKey=r,this.accountAddress=i?_chunkAWFAHZSBjs.r.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 rt(this.publicKey,this.sign(e))}signTransactionWithAuthenticator(e){return new rt(this.publicKey,this.signTransaction(e))}sign(e){let t=[];for(let r of this.signers)t.push(r.sign(e));return new Fe({signatures:t,bitmap:this.signaturesBitmap})}signTransaction(e){return this.sign(Ge(e))}};function Jo(n){let e=n.deserializeUleb128AsU32();if(!Object.values(oi).includes(e))throw new Error(`Deserialization of Account failed: SigningScheme variant ${e} is invalid`);return{address:_chunkAWFAHZSBjs.r.deserialize(n),signingScheme:e}}function Xo(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 Yo(n){let e=n.deserializeStr(),t=n.deserializeStr(),r=n.deserializeFixedBytes(31),i=Mt.deserialize(n),o=ye.deserialize(n),s=n.deserializeOption("fixedBytes",32);return{jwt:e,uidKey:t,pepper:r,ephemeralKeyPair:i,proof:o,verificationKeyHash:s}}var Zo;(A=>{function n(l){let d=new _chunkAWFAHZSBjs.m;switch(d.serializeU32AsUleb128(l.signingScheme),l.accountAddress.serialize(d),l.signingScheme){case 0:return l.privateKey.serialize(d),d.toUint8Array();case 2:{if(!Ii(l))throw new Error("Account is not a SingleKeySigner");let b=l.getAnyPublicKey();switch(d.serializeU32AsUleb128(b.variant),b.variant){case 3:return Xo(l,d),d.toUint8Array();case 4:{let z=l;return Xo(z,d),z.publicKey.jwkAddress.serialize(d),d.serializeBool(z.audless),d.toUint8Array()}case 1:case 0:return l.privateKey.serialize(d),d.toUint8Array();default:throw new Error(`Invalid public key variant: ${b.variant}`)}}case 3:{let b=l;return b.publicKey.serialize(d),d.serializeU32AsUleb128(b.signers.length),b.signers.forEach(z=>{d.serializeFixedBytes(n(z))}),d.toUint8Array()}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${l.signingScheme}`)}}A.toBytes=n;function e(l){return _chunkAWFAHZSBjs.j.hexInputToStringWithoutPrefix(n(l))}A.toHexStringWithoutPrefix=e;function t(l){return _chunkAWFAHZSBjs.j.hexInputToString(n(l))}A.toHexString=t;function r(l){let{address:d,signingScheme:b}=Jo(l);switch(b){case 0:{let z=J.deserialize(l);return new ie({privateKey:z,address:d})}case 2:{let z=l.deserializeUleb128AsU32();switch(z){case 0:{let q=J.deserialize(l);return new pe({privateKey:q,address:d})}case 1:{let q=tt.deserialize(l);return new pe({privateKey:q,address:d})}case 3:{let q=Yo(l),oe=et(q);return new Ie({...q,...oe})}case 4:{let q=Yo(l),oe=_chunkAWFAHZSBjs.r.deserialize(l),Je=l.deserializeBool(),mt=et(q);return new Me({...q,...mt,jwkAddress:oe,audless:Je})}default:throw new Error(`Unsupported public key variant ${z}`)}}case 3:{let z=W.deserialize(l),q=l.deserializeUleb128AsU32(),oe=new Array;for(let Je=0;Je<q;Je+=1){let mt=r(l);if(!Ii(mt)&&!(mt instanceof ie))throw new Error("Deserialization of MultiKeyAccount failed. Signer is not a SingleKeySigner or Ed25519Account");oe.push(mt)}return new lt({multiKey:z,signers:oe,address:d})}default:throw new Error(`Deserialization of Account failed: invalid signingScheme value ${b}`)}}A.deserialize=r;function i(l){let d=p(l);if(!(d instanceof Ie))throw new Error("Deserialization of KeylessAccount failed");return d}A.keylessAccountFromHex=i;function o(l){let d=p(l);if(!(d instanceof Me))throw new Error("Deserialization of FederatedKeylessAccount failed");return d}A.federatedKeylessAccountFromHex=o;function s(l){let d=p(l);if(!(d instanceof lt))throw new Error("Deserialization of MultiKeyAccount failed");return d}A.multiKeyAccountFromHex=s;function a(l){let d=p(l);if(!(d instanceof pe))throw new Error("Deserialization of SingleKeyAccount failed");return d}A.singleKeyAccountFromHex=a;function c(l){let d=p(l);if(!(d instanceof ie))throw new Error("Deserialization of Ed25519Account failed");return d}A.ed25519AccountFromHex=c;function p(l){return r(v.fromHex(l))}A.fromHex=p;function g(l){return p(l)}A.fromBytes=g})(Zo||(Zo= exports.AccountUtils ={}));var xr=class n extends dt{constructor({signer:t,accountAddress:r,authenticationFunction:i}){super();this.signingScheme=2;if(!_chunkAWFAHZSBjs.H.call(void 0, i))throw new Error(`Invalid authentication function ${i} passed into AbstractedAccount`);this.authenticationFunction=i,this.accountAddress=r,this.publicKey=new rr(this.accountAddress),this.sign=o=>new Sn(t(o))}static fromPermissionedSigner({signer:t,accountAddress:r}){return new n({signer:i=>{let o=new _chunkAWFAHZSBjs.m;return t.publicKey.serialize(o),t.sign(i).serialize(o),o.toUint8Array()},accountAddress:_nullishCoalesce(r, () => (t.accountAddress)),authenticationFunction:"0x1::permissioned_delegation::authenticate"})}static generateAccountAbstractionMessage(t,r){let i=new mr(t,r);return $e(i.bcsToBytes(),zo)}signWithAuthenticator(t){return new Rt(this.authenticationFunction,_sha3.sha3_256.call(void 0, t),this.sign(_sha3.sha3_256.call(void 0, t)).toUint8Array())}signTransactionWithAuthenticator(t){let r=n.generateAccountAbstractionMessage(Ge(t),this.authenticationFunction);return this.signWithAuthenticator(r)}signTransaction(t){return this.sign(Ge(t))}setSigner(t){this.sign=r=>new Sn(t(r))}};var Dn=class Dn extends xr{constructor({signer:e,authenticationFunction:t,abstractPublicKey:r}){let i=new (0, _chunkAWFAHZSBjs.r)(Dn.computeAccountAddress(t,r));super({accountAddress:i,signer:e,authenticationFunction:t}),this.abstractPublicKey=r}static computeAccountAddress(e,t){if(!_chunkAWFAHZSBjs.H.call(void 0, e))throw new Error(`Invalid authentication function ${e} passed into DerivableAbstractedAccount`);let[r,i,o]=e.split("::"),s=_sha3.sha3_256.create(),a=new _chunkAWFAHZSBjs.m;_chunkAWFAHZSBjs.r.fromString(r).serialize(a),a.serializeStr(i),a.serializeStr(o),s.update(a.toUint8Array());let c=new _chunkAWFAHZSBjs.m;return c.serializeBytes(t),s.update(c.toUint8Array()),s.update(new Uint8Array([Dn.ADDRESS_DOMAIN_SEPERATOR])),s.digest()}signWithAuthenticator(e){return new Rt(this.authenticationFunction,_sha3.sha3_256.call(void 0, e),this.sign(_sha3.sha3_256.call(void 0, e)).value,this.abstractPublicKey)}};Dn.ADDRESS_DOMAIN_SEPERATOR=5;var ts=Dn;var Lu=`
9
9
  fragment TokenActivitiesFields on token_activities_v2 {
10
10
  after_value
11
11
  before_value
@@ -23,7 +23,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
23
23
  transaction_version
24
24
  type
25
25
  }
26
- `,Ru=`
26
+ `,qu=`
27
27
  fragment AnsTokenFragment on current_aptos_names {
28
28
  domain
29
29
  expiration_timestamp
@@ -35,7 +35,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
35
35
  subdomain_expiration_policy
36
36
  domain_expiration_timestamp
37
37
  }
38
- `,xr=`
38
+ `,Ir=`
39
39
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
40
40
  token_standard
41
41
  token_properties_mutated_v1
@@ -82,7 +82,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
82
82
  }
83
83
  }
84
84
  }
85
- `,os=`
85
+ `,ns=`
86
86
  query getAccountAddressesForAuthKey($where_condition: auth_key_account_addresses_bool_exp, $order_by: [auth_key_account_addresses_order_by!]) {
87
87
  auth_key_account_addresses(where: $where_condition, order_by: $order_by) {
88
88
  auth_key
@@ -91,7 +91,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
91
91
  is_auth_key_used
92
92
  }
93
93
  }
94
- `,ss=`
94
+ `,rs=`
95
95
  query getAccountCoinsCount($address: String) {
96
96
  current_fungible_asset_balances_aggregate(
97
97
  where: {owner_address: {_eq: $address}}
@@ -101,7 +101,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
101
101
  }
102
102
  }
103
103
  }
104
- `,as=`
104
+ `,is=`
105
105
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
106
106
  current_fungible_asset_balances(
107
107
  where: $where_condition
@@ -134,7 +134,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
134
134
  }
135
135
  }
136
136
  }
137
- `,cs=`
137
+ `,os=`
138
138
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
139
139
  current_collection_ownership_v2_view(
140
140
  where: $where_condition
@@ -168,7 +168,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
168
168
  single_token_uri
169
169
  }
170
170
  }
171
- `,us=`
171
+ `,ss=`
172
172
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
173
173
  current_token_ownerships_v2(
174
174
  where: $where_condition
@@ -179,7 +179,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
179
179
  ...CurrentTokenOwnershipFields
180
180
  }
181
181
  }
182
- ${xr}`,OT=`
182
+ ${Ir}`,Uh=`
183
183
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
184
184
  current_token_ownerships_v2(
185
185
  where: $where_condition
@@ -190,7 +190,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
190
190
  ...CurrentTokenOwnershipFields
191
191
  }
192
192
  }
193
- ${xr}`,ds=`
193
+ ${Ir}`,as=`
194
194
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
195
195
  current_token_ownerships_v2(
196
196
  where: $where_condition
@@ -201,7 +201,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
201
201
  ...CurrentTokenOwnershipFields
202
202
  }
203
203
  }
204
- ${xr}`,ps=`
204
+ ${Ir}`,cs=`
205
205
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
206
206
  current_token_ownerships_v2_aggregate(
207
207
  where: $where_condition
@@ -213,7 +213,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
213
213
  }
214
214
  }
215
215
  }
216
- `,ls=`
216
+ `,us=`
217
217
  query getAccountTransactionsCount($address: String) {
218
218
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
219
219
  aggregate {
@@ -221,7 +221,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
221
221
  }
222
222
  }
223
223
  }
224
- `,gs=`
224
+ `,ps=`
225
225
  query getAuthKeysForPublicKey($where_condition: public_key_auth_keys_bool_exp, $order_by: [public_key_auth_keys_order_by!]) {
226
226
  public_key_auth_keys(where: $where_condition, order_by: $order_by) {
227
227
  public_key
@@ -233,13 +233,13 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
233
233
  signature_type
234
234
  }
235
235
  }
236
- `,ys=`
236
+ `,ds=`
237
237
  query getChainTopUserTransactions($limit: Int) {
238
238
  user_transactions(limit: $limit, order_by: {version: desc}) {
239
239
  version
240
240
  }
241
241
  }
242
- `,ms=`
242
+ `,ls=`
243
243
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
244
244
  current_collections_v2(where: $where_condition) {
245
245
  uri
@@ -269,7 +269,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
269
269
  }
270
270
  }
271
271
  }
272
- `,fs=`
272
+ `,gs=`
273
273
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
274
274
  current_fungible_asset_balances(
275
275
  where: $where_condition
@@ -287,7 +287,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
287
287
  token_standard
288
288
  }
289
289
  }
290
- `,As=`
290
+ `,ys=`
291
291
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
292
292
  delegated_staking_activities(
293
293
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -300,7 +300,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
300
300
  transaction_version
301
301
  }
302
302
  }
303
- `;var hs=`
303
+ `;var ms=`
304
304
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
305
305
  fungible_asset_activities(
306
306
  where: $where_condition
@@ -325,7 +325,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
325
325
  type
326
326
  }
327
327
  }
328
- `,bs=`
328
+ `,fs=`
329
329
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
330
330
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
331
331
  icon_uri
@@ -344,7 +344,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
344
344
  maximum_v2
345
345
  }
346
346
  }
347
- `,dn=`
347
+ `,ln=`
348
348
  query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
349
349
  current_aptos_names(
350
350
  limit: $limit
@@ -355,14 +355,14 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
355
355
  ...AnsTokenFragment
356
356
  }
357
357
  }
358
- ${Ru}`,Ki=`
358
+ ${qu}`,vi=`
359
359
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
360
360
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
361
361
  num_active_delegator
362
362
  pool_address
363
363
  }
364
364
  }
365
- `,Ir=`
365
+ `,Cr=`
366
366
  query getObjectData($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
367
367
  current_objects(
368
368
  where: $where_condition
@@ -379,7 +379,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
379
379
  is_deleted
380
380
  }
381
381
  }
382
- `,Ri=`
382
+ `,Ki=`
383
383
  query getProcessorStatus($where_condition: processor_status_bool_exp) {
384
384
  processor_status(where: $where_condition) {
385
385
  last_success_version
@@ -387,7 +387,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
387
387
  last_updated
388
388
  }
389
389
  }
390
- `,Ts=`
390
+ `,As=`
391
391
  query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
392
392
  table_items(
393
393
  where: $where_condition
@@ -403,7 +403,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
403
403
  write_set_change_index
404
404
  }
405
405
  }
406
- `,ws=`
406
+ `,hs=`
407
407
  query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
408
408
  table_metadatas(
409
409
  where: $where_condition
@@ -416,7 +416,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
416
416
  value_type
417
417
  }
418
418
  }
419
- `,Ss=`
419
+ `,bs=`
420
420
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
421
421
  token_activities_v2(
422
422
  where: $where_condition
@@ -427,7 +427,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
427
427
  ...TokenActivitiesFields
428
428
  }
429
429
  }
430
- ${Ku}`,Ui=`
430
+ ${Lu}`,Ri=`
431
431
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
432
432
  current_token_ownerships_v2(
433
433
  where: $where_condition
@@ -438,7 +438,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
438
438
  ...CurrentTokenOwnershipFields
439
439
  }
440
440
  }
441
- ${xr}`,Ps=`
441
+ ${Ir}`,Ts=`
442
442
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
443
443
  current_token_datas_v2(
444
444
  where: $where_condition
@@ -478,5 +478,5 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
478
478
  }
479
479
  }
480
480
  }
481
- `;async function Cr(n){let{aptosConfig:e}=n,{data:t}=await q({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function _s(n){let{aptosConfig:e,limit:t}=n;return(await w({aptosConfig:e,query:{query:ys,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function w(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await qo({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Uu(n){let{aptosConfig:e}=n;return(await w({aptosConfig:e,query:{query:Ri},originMethod:"getProcessorStatuses"})).processor_status}async function vr(n){let e=await Uu({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Kr(n){let{aptosConfig:e,processorType:t}=n;return(await w({aptosConfig:e,query:{query:Ri,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Rr(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await q({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}`});return r}async function xs(n){return _optionalChain([n, 'access', _61 => _61.options, 'optionalAccess', _62 => _62.ledgerVersion])!==void 0?Es(n):He(async()=>Es(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Es(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await q({aptosConfig:e,originMethod:"getModule",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _63 => _63.ledgerVersion])}});return o}async function Ur(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await bt({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _64 => _64.ledgerVersion])},body:r})).data}async function Is(n){let{aptosConfig:e,options:t}=n,r={query:Ts,variables:{where_condition:_optionalChain([t, 'optionalAccess', _65 => _65.where]),offset:_optionalChain([t, 'optionalAccess', _66 => _66.offset]),limit:_optionalChain([t, 'optionalAccess', _67 => _67.limit]),order_by:_optionalChain([t, 'optionalAccess', _68 => _68.orderBy])}};return(await w({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function Cs(n){let{aptosConfig:e,options:t}=n,r={query:ws,variables:{where_condition:_optionalChain([t, 'optionalAccess', _69 => _69.where]),offset:_optionalChain([t, 'optionalAccess', _70 => _70.offset]),limit:_optionalChain([t, 'optionalAccess', _71 => _71.limit]),order_by:_optionalChain([t, 'optionalAccess', _72 => _72.orderBy])}};return(await w({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function zi(n){let{aptosConfig:e,options:t}=n;return cr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _73 => _73.offset]),limit:_optionalChain([t, 'optionalAccess', _74 => _74.limit])}})}async function zr(n){let{aptosConfig:e}=n;return He(async()=>{let{data:t}=await q({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function vs(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await q({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Nn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await q({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Ks(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Nn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _75 => _75.status])===404)return!0;throw r}}async function ku(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await q({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function pn(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _76 => _76.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _77 => _77.checkSuccess]), () => (!0)),s=!0,a=0,c,d,g=200,A=1.5;function p(l){if(!(l instanceof Se)||(d=l,l.status!==404&&l.status>=400&&l.status<500))throw l}try{c=await Nn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(l){p(l)}if(s){let l=Date.now();try{c=await ku({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){p(b)}a=(Date.now()-l)/1e3}for(;s&&!(a>=i);){try{if(c=await Nn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(l){p(l)}await _chunk6MMUUJHXjs.fa.call(void 0, g),a+=g/1e3,g*=A}if(c===void 0)throw d||new kr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new kr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new ki(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function Nr(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await vr({aptosConfig:e}):s=(await Kr({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunk6MMUUJHXjs.fa.call(void 0, 200)}}var kr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},ki=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Rs(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await q({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _78 => _78.withTransactions])}});return ks({block:i,...n})}async function Us(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await q({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _79 => _79.withTransactions])}});return ks({block:i,...n})}async function ks(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _80 => _80.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _81 => _81.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let d=[],g=100n;for(let p=c+1n;p<s;p+=BigInt(100))d.push(zi({aptosConfig:e,options:{offset:p,limit:Math.min(Number(g),Number(s-p+1n))}}));let A=await Promise.all(d);for(let p of A)t.transactions.push(...p)}return t}function zs(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Ns(n){return!!n.match(/\s/)}function zu(n){return!!n.match(/^T[0-9]+$/)}function Nu(n){return!!n.match(/^&.+$/)}function Fu(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 Du(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Ns(r))break}return t}var Ou=(b=>(b.InvalidTypeTag="unknown type",b.UnexpectedGenericType="unexpected generic type",b.UnexpectedTypeArgumentClose="unexpected '>'",b.UnexpectedWhitespaceCharacter="unexpected whitespace character",b.UnexpectedComma="unexpected ','",b.TypeArgumentCountMismatch="type argument count doesn't match expected amount",b.MissingTypeArgumentClose="no matching '>' for '<'",b.MissingTypeArgument="no type argument before ','",b.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",b.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",b.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",b.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",b.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",b.InvalidAddress="struct address must be valid",b))(Ou||{}),J= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Be(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _82 => _82.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 b=Fn(a,i,t);o.push(b)}let g=r.pop();if(g===void 0)throw new J(n,"unexpected '>'");if(c!==o.length)throw new J(n,"type argument count doesn't match expected amount");let{savedStr:A,savedTypes:p,savedExpectedTypes:l}=g;i=o,o=p,a=A,c=l}else if(d===","){if(r.length===0)throw new J(n,"unexpected ','");if(a.length===0)throw new J(n,"no type argument before ','");let g=Fn(a,i,t);i=[],o.push(g),a="",c+=1}else if(Ns(d)){let g=!1;if(a.length!==0){let p=Fn(a,i,t);i=[],o.push(p),a="",g=!0}s=Du(n,s);let A=n[s];if(s<n.length&&g&&A!==","&&A!==">")throw new J(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new J(n,"no matching '>' for '<'");switch(o.length){case 0:return Fn(a,i,t);case 1:if(a==="")return o[0];throw new J(n,"unexpected ','");default:throw new J(n,"unexpected whitespace character")}}function Fn(n,e,t){let r=n.trim(),i=r.toLowerCase();if(Fu(i)&&e.length>0)throw new J(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new kt;case"bool":return new W;case"address":return new O;case"u8":return new de;case"u16":return new nt;case"u32":return new rt;case"u64":return new Z;case"u128":return new it;case"u256":return new ot;case"vector":if(e.length!==1)throw new J(n,"vector type expected to have exactly one type argument");return new U(e[0]);default:if(Nu(r)){let a=r.substring(1);return new mr(Fn(a,e,t))}if(zu(r)){if(t)return new B(Number(r.split("T")[1]));throw new J(n,"unexpected generic type")}if(!r.match(/:/))throw new J(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new J(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=_chunk6MMUUJHXjs.ba.fromString(o[0])}catch (e4){throw new J(n,"struct address must be valid")}if(!zs(o[1]))throw new J(n,"module name must only contain alphanumeric or '_' characters");if(!zs(o[2]))throw new J(n,"struct name must only contain alphanumeric or '_' characters");return new h(new Qe(s,new k(o[1]),new k(o[2]),e))}}function Fs(n){return typeof n=="boolean"}function pt(n){return typeof n=="string"}function Gu(n){return typeof n=="number"}function Fr(n){if(Gu(n))return n;if(pt(n)&&n!=="")return Number.parseInt(n,10)}function Dr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Ds(n){return n==null}function Os(n){return Ni(n)||Di(n)||Oi(n)||Gi(n)||Bi(n)||Mi(n)||Vi(n)||Or(n)||Fi(n)||Bu(n)||n instanceof S||n instanceof te}function Ni(n){return n instanceof F}function Or(n){return n instanceof _chunk6MMUUJHXjs.ba}function Fi(n){return n instanceof C}function Bu(n){return n instanceof Ce}function Di(n){return n instanceof X}function Oi(n){return n instanceof ve}function Gi(n){return n instanceof Ke}function Bi(n){return n instanceof L}function Mi(n){return n instanceof Re}function Vi(n){return n instanceof we}function Gs(n){return"bytecode"in n}function z(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Bs(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}var Mu=new TextEncoder;function Gr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _83 => _83.map, 'call', _84 => _84(e=>pt(e)?Be(e):e)]), () => ([]))}async function Vu(n,e,t){return(await Br({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function Li(n,e,t,r){let i=await Vu(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 Iw(n,e,t,r){let i=await Li(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(Be(i.params[s],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o}}async function Ms(n,e,t,r){let i=await Li(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=Bs(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Be(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Vs(n,e,t,r){let i=await Li(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(Be(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Be(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function qi(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=Be(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 Vt(t,s,r,i,"exposed_functions"in e?e:void 0,o)}function Vt(n,e,t,r,i,o){return Os(n)?(Hi(e,n,t),n):Hu(n,e,t,r,i,o)}function Hu(n,e,t,r,i,o){if(e.isBool()){if(Fs(n))return new F(n);if(pt(n)){if(n==="true")return new F(!0);if(n==="false")return new F(!1)}z("boolean",t)}if(e.isAddress()){if(pt(n))return _chunk6MMUUJHXjs.ba.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new (0, _chunk6MMUUJHXjs.ba)(n.data);z("string | AccountAddress",t)}if(e.isU8()){let s=Fr(n);if(s!==void 0)return new X(s);z("number | string",t)}if(e.isU16()){let s=Fr(n);if(s!==void 0)return new ve(s);z("number | string",t)}if(e.isU32()){let s=Fr(n);if(s!==void 0)return new Ke(s);z("number | string",t)}if(e.isU64()){if(Dr(n))return new L(BigInt(n));z("bigint | number | string",t)}if(e.isU128()){if(Dr(n))return new Re(BigInt(n));z("bigint | number | string",t)}if(e.isU256()){if(Dr(n))return new we(BigInt(n));z("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 Vt(n,r[s],t,r,i)}if(e.isVector()){if(e.value.isU8()){if(pt(n))return S.U8(Mu.encode(n));if(n instanceof Uint8Array)return S.U8(n);if(n instanceof ArrayBuffer)return S.U8(new Uint8Array(n))}if(pt(n)&&n.startsWith("["))return Vt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new S(n.map(s=>Vt(s,e.value,t,r,i)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(pt(n))return new C(n);z("string",t)}if(e.isObject()){if(pt(n))return _chunk6MMUUJHXjs.ba.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new (0, _chunk6MMUUJHXjs.ba)(n.data);z("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new Ce(n);z("Uint8Array",t)}if(e.isOption()){if(Ds(n)){let a=e.value.typeArgs[0];return a instanceof W?new te(null):a instanceof O?new te(null):a instanceof de?new te(null):a instanceof nt?new te(null):a instanceof rt?new te(null):a instanceof Z?new te(null):a instanceof it?new te(null):a instanceof ot?new te(null):new te(null)}return new te(Vt(n,e.value.typeArgs[0],t,r,i))}if(_optionalChain([i, 'optionalAccess', _85 => _85.structs, 'access', _86 => _86.find, 'call', _87 => _87(a=>a.name===e.value.name.identifier), 'optionalAccess', _88 => _88.fields, 'access', _89 => _89.length])===0&&n instanceof Uint8Array)return new Ce(n);if(n instanceof Uint8Array&&_optionalChain([o, 'optionalAccess', _90 => _90.allowUnknownStructs]))return console.warn(`Unsupported struct input type for argument ${t}. Continuing since 'allowUnknownStructs' is enabled.`),new Ce(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 Hi(n,e,t){if(n.isBool()){if(Ni(e))return;z("Bool",t)}if(n.isAddress()){if(Or(e))return;z("AccountAddress",t)}if(n.isU8()){if(Di(e))return;z("U8",t)}if(n.isU16()){if(Oi(e))return;z("U16",t)}if(n.isU32()){if(Gi(e))return;z("U32",t)}if(n.isU64()){if(Bi(e))return;z("U64",t)}if(n.isU128()){if(Mi(e))return;z("U128",t)}if(n.isU256()){if(Vi(e))return;z("U256",t)}if(n.isVector()){if(e instanceof S){e.values.length>0&&Hi(n.value,e.values[0],t);return}z("MoveVector",t)}if(n instanceof h){if(n.isString()){if(Fi(e))return;z("MoveString",t)}if(n.isObject()){if(Or(e))return;z("AccountAddress",t)}if(n.isOption()){if(e instanceof te){e.value!==void 0&&Hi(n.value.typeArgs[0],e.value,t);return}z("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function Mr(n){if(Gs(n))return Wu(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),i=await $s({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Ms});return qu({...n,abi:i})}function qu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),o=Gr(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)=>qi(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=st.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=_chunk6MMUUJHXjs.ba.from(n.multisigAddress);return new nn(new vn(c,new Kn(a)))}return new tn(a)}async function Hs(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),i=await $s({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Vs});return $u({abi:i,...n})}function $u(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),o=Gr(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _91 => _91.functionArguments, 'optionalAccess', _92 => _92.map, 'call', _93 => _93((a,c)=>qi(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 st.build(`${t}::${r}`,i,o,s)}function Wu(n){return new en(new rn(_chunk6MMUUJHXjs.j.fromHexInput(n.bytecode).toUint8Array(),Gr(n.typeArguments),n.functionArguments))}async function Qu(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n;if(_optionalChain([i, 'optionalAccess', _94 => _94.replayProtectionNonce])!==void 0&&_optionalChain([i, 'optionalAccess', _95 => _95.accountSequenceNumber])!==void 0)throw new Error("Cannot specify both replayProtectionNonce and accountSequenceNumber in options.");let s=async()=>gi[e.network]?{chainId:gi[e.network]}:{chainId:(await Cr({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _96 => _96.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await zr({aptosConfig:e})).gas_estimate},c=async()=>{let oe=async()=>_optionalChain([i, 'optionalAccess', _97 => _97.accountSequenceNumber])!==void 0?i.accountSequenceNumber:_optionalChain([i, 'optionalAccess', _98 => _98.replayProtectionNonce])!==void 0?0xdeadbeefn:(await Rr({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunk6MMUUJHXjs.ba.from(o).equals(_chunk6MMUUJHXjs.ba.ZERO))try{return await oe()}catch (e5){return 0}else return oe()},[{chainId:d},{gasEstimate:g},A]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:l,expireTimestamp:b,replayProtectionNonce:N}={maxGasAmount:_optionalChain([i, 'optionalAccess', _99 => _99.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(e.getDefaultMaxGasAmount()),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _100 => _100.gasUnitPrice]), () => (BigInt(g))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _101 => _101.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+e.getDefaultTxnExpirySecFromNow()))),replayProtectionNonce:_optionalChain([i, 'optionalAccess', _102 => _102.replayProtectionNonce])?BigInt(i.replayProtectionNonce):void 0},H=r;return N!==void 0&&(H=ju(r,N)),new Ee(_chunk6MMUUJHXjs.ba.from(t),BigInt(A),H,BigInt(p),BigInt(l),BigInt(b),new Zt(d))}function ju(n,e){if(n instanceof en)return new zt(new Rn(n.script),new Nt(void 0,e));if(n instanceof tn)return new zt(new sn(n.entryFunction),new Nt(void 0,e));if(n instanceof nn){let t=n.multiSig.transaction_payload,r;if(t===void 0||_optionalChain([t, 'optionalAccess', _103 => _103.transaction_payload])===void 0)r=new Un;else if(t.transaction_payload instanceof st)r=new sn(t.transaction_payload);else throw new Error("Scripts are not supported in multi-sig transactions.");return new zt(r,new Nt(n.multiSig.multisig_address,e))}else throw new Error(`Unsupported payload type: ${n}`)}async function $i(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await Qu({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _104 => _104.secondarySignerAddresses, 'optionalAccess', _105 => _105.map, 'call', _106 => _106(c=>_chunk6MMUUJHXjs.ba.from(c))]), () => ([]));return new wr(s,a,n.feePayerAddress?_chunk6MMUUJHXjs.ba.from(n.feePayerAddress):void 0)}return new Tr(s,n.feePayerAddress?_chunk6MMUUJHXjs.ba.from(n.feePayerAddress):void 0)}function Ls(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=ln(e);if(t.feePayerAddress){let a=new Dt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(A=>ln(A)):c=Array.from({length:t.secondarySignerAddresses.length},()=>ln(void 0)));let d=ln(i),g=new Bt(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new ct(a.raw_txn,g).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Ft(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(g=>ln(g)):c=Array.from({length:t.secondarySignerAddresses.length},()=>ln(void 0));let d=new Gt(o,t.secondarySignerAddresses,c);return new ct(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof De)s=new Ot(o.public_key,o.signature);else if(o instanceof ue||o instanceof We)s=new Pt(o);else if(o instanceof Yt)s=new Pt(o);else throw new Error("Invalid public key");return new ct(t.rawTransaction,s).bcsToBytes()}function ln(n){if(!n)return new Yt;let t=K.isInstance(n)||V.isInstance(n)||ze.isInstance(n)?new x(n):n,r=new R(new Uint8Array(64));if(_.isInstance(t))return new De(t,r);if(x.isInstance(t))return K.isInstance(t.publicKey)?new ue(t,new D(ce.getSimulationSignature())):new ue(t,new D(r));if($.isInstance(t))return new We(t,new Pe({signatures:t.publicKeys.map(i=>K.isInstance(i.publicKey)||V.isInstance(i.publicKey)?new D(ce.getSimulationSignature()):new D(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function Wi(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Ho(Y,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 Bt(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Gt(i,e.secondarySignerAddresses,r)}else i instanceof De?o=new Ot(i.public_key,i.signature):i instanceof tt?o=new an(i.public_key,i.signature):o=new Pt(i);return new ct(e.rawTransaction,o).bcsToBytes()}function qs(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Ju=qs(["APTOS::Transaction"]);function eS(n){let e=Wi(n);return new (0, _chunk6MMUUJHXjs.j)(qs([Ju,new Uint8Array([0]),e])).toString()}async function $s({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:He(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function T(n){let e=await Xu(n);return Yu(n,e)}async function Xu(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await Mr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Mr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Mr(r)),i}async function Yu(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(Zu(n)&&(o=_chunk6MMUUJHXjs.ba.ZERO.toString()),ed(n)){let{secondarySignerAddresses:s}=n;return $i({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return $i({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function Zu(n){return n.withFeePayer===!0}function ed(n){return"secondarySignerAddresses"in n}function Ws(n){let{transaction:e}=n;return Oe(e)}function Vr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function Hr(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,Vr({signer:e,transaction:t})}async function Qi(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Ls({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await bt({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _107 => _107.options, 'optionalAccess', _108 => _108.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _109 => _109.options, 'optionalAccess', _110 => _110.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _111 => _111.options, 'optionalAccess', _112 => _112.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=Wi({...n});try{let{data:o}=await bt({aptosConfig:e,body:i,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return o}catch(o){let s=ct.deserialize(new v(i));throw s.authenticator.isSingleSender()&&s.authenticator.sender.isSingleKey()&&(s.authenticator.sender.public_key.publicKey instanceof K||s.authenticator.sender.public_key.publicKey instanceof V)&&await Te.fetchJWK({aptosConfig:e,publicKey:s.authenticator.sender.public_key.publicKey,kid:s.authenticator.sender.signature.signature.getJwkKid()}),o}}async function Lr(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i,...o}=n;_r(t)&&await t.checkKeylessAccountValidity(e),_r(r)&&await r.checkKeylessAccountValidity(e);let s=n.feePayerAuthenticator||r&&Hr({signer:r,transaction:i}),a=Vr({signer:t,transaction:i});return Dn({aptosConfig:e,transaction:i,senderAuthenticator:a,feePayerAuthenticator:s,...o})}async function Qs(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i,...o}=n;_r(r)&&await r.checkKeylessAccountValidity(e);let s=Hr({signer:r,transaction:i});return Dn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:s,...o})}var td={typeParameters:[],parameters:[U.u8(),new U(U.u8())]};async function js(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>S.U8(a));return T({aptosConfig:e,sender:_chunk6MMUUJHXjs.ba.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[S.U8(r),new S(s)],abi:td},options:o})}async function gn(n){return Rr(n)}async function Js(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return fi({aptosConfig:e,originMethod:"getModules",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _113 => _113.ledgerVersion]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _114 => _114.limit]), () => (1e3))}})}async function Xs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await ur({aptosConfig:e,originMethod:"getModulesPage",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _115 => _115.ledgerVersion]),cursor:_optionalChain([r, 'optionalAccess', _116 => _116.cursor]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _117 => _117.limit]), () => (100))}});return{modules:i.data,cursor:o}}async function Br(n){return xs(n)}async function Ji(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return cr({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _118 => _118.offset]),limit:_optionalChain([r, 'optionalAccess', _119 => _119.limit])}})}async function Xi(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return fi({aptosConfig:e,originMethod:"getResources",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _121 => _121.limit]), () => (999))}})}async function Ys(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await ur({aptosConfig:e,originMethod:"getResourcesPage",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _122 => _122.ledgerVersion]),cursor:_optionalChain([r, 'optionalAccess', _123 => _123.cursor]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _124 => _124.limit]), () => (100))}});return{resources:i.data,cursor:o}}async function Yi(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await q({aptosConfig:e,originMethod:"getResource",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _125 => _125.ledgerVersion])}});return o.data}async function On(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await Yi({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=_chunk6MMUUJHXjs.ba.from(t);try{let a=await Ur({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return _chunk6MMUUJHXjs.ba.from(a)}catch(a){if(a instanceof Se&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Zs(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}},s=await w({aptosConfig:e,query:{query:ps,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 ea(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _126 => _126.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _127 => _127.tokenStandard])});let s={query:us,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _128 => _128.offset]),limit:_optionalChain([r, 'optionalAccess', _129 => _129.limit]),order_by:_optionalChain([r, 'optionalAccess', _130 => _130.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function ta(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),s=_chunk6MMUUJHXjs.ba.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _131 => _131.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _132 => _132.tokenStandard])});let c={query:ds,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _133 => _133.offset]),limit:_optionalChain([i, 'optionalAccess', _134 => _134.limit]),order_by:_optionalChain([i, 'optionalAccess', _135 => _135.orderBy])}};return(await w({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function na(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _136 => _136.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _137 => _137.tokenStandard])}});let s={query:cs,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _138 => _138.offset]),limit:_optionalChain([r, 'optionalAccess', _139 => _139.limit]),order_by:_optionalChain([r, 'optionalAccess', _140 => _140.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ra(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await w({aptosConfig:e,query:{query:ls,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ia(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _141 => _141.where]),owner_address:{_eq:i}},s={query:as,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _142 => _142.offset]),limit:_optionalChain([r, 'optionalAccess', _143 => _143.limit]),order_by:_optionalChain([r, 'optionalAccess', _144 => _144.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function oa(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await w({aptosConfig:e,query:{query:ss,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 Zi(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}},s={query:Ir,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _145 => _145.offset]),limit:_optionalChain([r, 'optionalAccess', _146 => _146.limit]),order_by:_optionalChain([r, 'optionalAccess', _147 => _147.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function sa(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _148 => _148.throwIfNoAccountFound]), () => (!1)),o=await qr({aptosConfig:e,privateKey:t});if(o.length===0){if(i)throw new Error("No existing account found for private key.");return ut.fromPrivateKey({privateKey:t})}return o[0]}async function nd(n){let{aptosConfig:e,accountAddress:t,options:r}=n;try{let[i,o]=await Promise.all([Xi({aptosConfig:e,accountAddress:t}),Zi({aptosConfig:e,accountAddress:t,options:{limit:1}})]),s=i.find(c=>c.type==="0x1::account::Account");if(!s&&o.length===0)return!1;if(!_optionalChain([r, 'optionalAccess', _149 => _149.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 rd={typeParameters:[],parameters:[new de,U.u8(),new de,U.u8(),U.u8(),U.u8()]};async function aa(n){let{aptosConfig:e,fromAccount:t,options:r}=n;if("toNewPrivateKey"in n)return ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toNewPrivateKey,options:r});if("toAccount"in n)return n.toAccount instanceof ie?ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toAccount.privateKey,options:r}):ji({aptosConfig:e,fromAccount:t,toAccount:n.toAccount,options:r});throw new Error("Invalid arguments")}async function ji(n){let{aptosConfig:e,fromAccount:t,options:r}=n,i=await gn({aptosConfig:e,accountAddress:t.accountAddress}),o;"toNewPrivateKey"in n?o=ut.fromPrivateKey({privateKey:n.toNewPrivateKey,legacy:!0}):o=n.toAccount;let a=new br({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:_chunk6MMUUJHXjs.ba.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),d=o.sign(a);return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new X(t.signingScheme),S.U8(t.publicKey.toUint8Array()),new X(o.signingScheme),S.U8(o.publicKey.toUint8Array()),S.U8(c.toUint8Array()),S.U8(d.toUint8Array())],abi:rd},options:r})}var id={typeParameters:[],parameters:[new de,U.u8()]};async function ca(n){let{aptosConfig:e,fromAccount:t,toNewPublicKey:r,options:i}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key_from_public_key",functionArguments:[new X(Yo(r)),S.U8(xi(r).toUint8Array())],abi:id},options:i})}async function $r(n){let{aptosConfig:e,publicKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _150 => _150.noMultiKey]), () => (!1));if(i&&t instanceof Ne)throw new Error("Multi-key accounts are not supported when noMultiKey is true.");let o=[t];t instanceof x&&t.publicKey instanceof _?o.push(t.publicKey):t instanceof _&&o.push(new x(t));let[s,a]=await Promise.all([Promise.all(o.map(async A=>{let p=await ud({aptosConfig:e,publicKey:A});if(p)return{...p,publicKey:A}})),!(t instanceof Ne)&&!i?sd({aptosConfig:e,publicKey:t,options:r}):Promise.resolve([])]),c=[];for(let A of s)A&&c.push(A);o.push(...a);let d=new Map(o.map(A=>[A.authKey().toString(),A])),g=await ad({aptosConfig:e,authKeys:o.map(A=>A.authKey()),options:r});for(let A of g){if(c.find(l=>l.accountAddress===A.accountAddress))continue;let p=d.get(A.authKey.toString());if(!p)throw new Error(`No publicKey found for authentication key ${A.authKey}. This should never happen.`);c.push({accountAddress:A.accountAddress,publicKey:p,lastTransactionVersion:A.lastTransactionVersion})}return c.sort((A,p)=>p.lastTransactionVersion-A.lastTransactionVersion)}async function eo(n){let{aptosConfig:e,signer:t,options:r}=n;if(t instanceof j||t instanceof Ze)return qr({aptosConfig:e,privateKey:t,options:r});if(t instanceof ie||t instanceof pe)return qr({aptosConfig:e,privateKey:t.privateKey,options:r});if(t instanceof xe||t instanceof Ge)return od({aptosConfig:e,keylessAccount:t,options:r});if(t instanceof dt&&t.signers.length===1)return eo({aptosConfig:e,signer:t.signers[0],options:r});if(t instanceof kn&&t.signers.length===1)return qr({aptosConfig:e,privateKey:t.signers[0],options:r});throw new Error("Unknown signer type")}async function od(n){let{aptosConfig:e,keylessAccount:t,options:r}=n,i=await $r({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 Ne){if(c.getSignaturesRequired()>1)continue;if(c instanceof re)throw new Error("Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.");c instanceof $&&s.push(new dt({multiKey:c,signers:[t],address:a}))}else t instanceof Ge?s.push(Ge.create({...o,address:a,jwkAddress:t.publicKey.jwkAddress})):s.push(xe.create({...o,address:a}));return s}async function qr(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=ut.fromPrivateKey({privateKey:t,legacy:!1}),o=await $r({aptosConfig:e,publicKey:new x(t.publicKey()),options:r}),s=[];for(let{accountAddress:a,publicKey:c}of o)if(c instanceof Ne){if(c.getSignaturesRequired()>1)continue;c instanceof re?s.push(new kn({publicKey:c,signers:[t],address:a})):c instanceof $&&s.push(new dt({multiKey:c,signers:[i],address:a}))}else{let d=c instanceof _;s.push(ut.fromPrivateKey({privateKey:t,address:a,legacy:d}))}return s}async function sd(n){let{aptosConfig:e,publicKey:t,options:r}=n;if(t instanceof Ne)throw new Error("Public key is a multi-key.");let i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _151 => _151.includeUnverified]), () => (!1)),o=t instanceof x?t:new x(t),s=o.publicKey,a=_chunk6MMUUJHXjs.C.call(void 0, o.variant),c={public_key:{_eq:s.toString()},public_key_type:{_eq:a},...i?{}:{is_public_key_used:{_eq:!0}}},d={query:gs,variables:{where_condition:c}},{public_key_auth_keys:g}=await w({aptosConfig:e,query:d,originMethod:"getMultiKeysForPublicKey"});return g.map(p=>{switch(p.signature_type){case"multi_ed25519_signature":return re.deserializeWithoutLength(v.fromHex(p.account_public_key));case"multi_key_signature":return $.deserialize(v.fromHex(p.account_public_key));default:throw new Error(`Unknown multi-signature type: ${p.signature_type}`)}})}async function ad(n){let{aptosConfig:e,authKeys:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _152 => _152.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:os,variables:{where_condition:o,order_by:[{last_transaction_version:"desc"}]}},{auth_key_account_addresses:a}=await w({aptosConfig:e,query:s,originMethod:"getAccountAddressesForAuthKeys"});return a.map(c=>({authKey:new Q({data:c.auth_key}),accountAddress:new (0, _chunk6MMUUJHXjs.ba)(_chunk6MMUUJHXjs.j.hexInputToUint8Array(c.account_address)),lastTransactionVersion:Number(c.last_transaction_version)}))}async function cd(n){let{aptosConfig:e,accountAddress:t}=n,r=await Ji({aptosConfig:e,accountAddress:t,options:{limit:1}});return r.length===0?0:Number(r[0].version)}async function ud(n){let{aptosConfig:e,publicKey:t}=n,r=t.authKey().derivedAddress(),[i,o]=await Promise.all([cd({aptosConfig:e,accountAddress:r}),nd({aptosConfig:e,accountAddress:r,options:{withAuthKey:t.authKey()}})]);if(o)return{accountAddress:r,lastTransactionVersion:i}}async function P(n){n.minimumLedgerVersion!==void 0&&await Nr({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}async function le(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Hs({...t,aptosConfig:e}),o=new _chunk6MMUUJHXjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await bt({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _153 => _153.ledgerVersion])},body:s});return a}async function ua(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await bt({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _154 => _154.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}async function da(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunk6MMUUJHXjs.pa.call(void 0, r);return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new O,new h(I()),new h(I())]}},options:i})}async function pa(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunk6MMUUJHXjs.pa.call(void 0, r);return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new O,new h(I()),new h(I())]}},options:i})}async function la(n){let{aptosConfig:e,sender:t,options:r}=n;return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var Ht=class{constructor(e){this.config=e;this.isAccountAbstractionEnabled=async e=>{let t=await this.getAuthenticationFunction(e),{moduleAddress:r,moduleName:i,functionName:o}=_chunk6MMUUJHXjs.pa.call(void 0, e.authenticationFunction);return _nullishCoalesce(_optionalChain([t, 'optionalAccess', _155 => _155.some, 'call', _156 => _156(s=>_chunk6MMUUJHXjs.ba.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 da({aptosConfig:this.config,authenticationFunction:r,sender:t,options:i})}async removeAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return pa({aptosConfig:this.config,sender:t,authenticationFunction:r,options:i})}async removeDispatchableAuthenticatorTransaction(e){let{accountAddress:t,options:r}=e;return la({aptosConfig:this.config,sender:t,options:r})}async getAuthenticationFunction(e){let{accountAddress:t}=e,[{vec:r}]=await le({aptosConfig:this.config,payload:{function:"0x1::account_abstraction::dispatchable_authenticator",functionArguments:[_chunk6MMUUJHXjs.ba.from(t)],abi:{typeParameters:[],parameters:[new O],returnTypes:[]}}});if(r.length!==0)return r[0].map(i=>({moduleAddress:_chunk6MMUUJHXjs.ba.fromString(i.module_address),moduleName:i.module_name,functionName:i.function_name}))}};var Gn=class{constructor(e){this.config=e;this.abstraction=new Ht(e)}async getAccountInfo(e){return gn({aptosConfig:this.config,...e})}async getAccountModules(e){return Js({aptosConfig:this.config,...e})}async getAccountModulesPage(e){return Xs({aptosConfig:this.config,...e})}async getAccountModule(e){return Br({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Ji({aptosConfig:this.config,...e})}async getAccountResources(e){return Xi({aptosConfig:this.config,...e})}async getAccountResourcesPage(e){return Ys({aptosConfig:this.config,...e})}async getAccountResource(e){return Yi({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return On({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Zs({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ea({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ta({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),na({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ra({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ia({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),oa({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Kt,faMetadataAddress:Go,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i}=e,o=r;r===void 0&&i!==void 0&&(o=await He(async()=>{try{let c=(await le({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}}))[0];if(c.vec.length>0&&_chunk6MMUUJHXjs.oa.call(void 0, c.vec[0]))return _chunk6MMUUJHXjs.na.call(void 0, c.vec[0])}catch (e6){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let s;if(r!==void 0&&i!==void 0)s=_chunk6MMUUJHXjs.ba.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===Kt?s=_chunk6MMUUJHXjs.ba.A.toStringLong():s=_chunk6MMUUJHXjs.ca.call(void 0, _chunk6MMUUJHXjs.ba.A,r).toStringLong();else if(r===void 0&&i!==void 0){let c=_chunk6MMUUJHXjs.ba.from(i);s=c.toStringLong(),c===_chunk6MMUUJHXjs.ba.A&&(o=Kt)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(o!==void 0){let[c]=await le({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[o],functionArguments:[t]}});return parseInt(c,10)}let[a]=await le({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,s]}});return parseInt(a,10)}async getAccountOwnedObjects(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Zi({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),sa({aptosConfig:this.config,...e})}async deriveOwnedAccountsFromSigner(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),eo({aptosConfig:this.config,...e})}async getAccountsForPublicKey(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),$r({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Wr=class{constructor(e){if(_optionalChain([e, 'optionalAccess', _157 => _157.fullnode])||_optionalChain([e, 'optionalAccess', _158 => _158.indexer])||_optionalChain([e, 'optionalAccess', _159 => _159.faucet])||_optionalChain([e, 'optionalAccess', _160 => _160.pepper])||_optionalChain([e, 'optionalAccess', _161 => _161.prover])){if(_optionalChain([e, 'optionalAccess', _162 => _162.network])==="custom")console.info("Note: using CUSTOM network will require queries to lookup ChainId");else if(!_optionalChain([e, 'optionalAccess', _163 => _163.network]))throw new Error("Custom endpoints require a network to be specified")}this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _164 => _164.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _165 => _165.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _166 => _166.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _167 => _167.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _168 => _168.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _169 => _169.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _170 => _170.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _171 => _171.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _172 => _172.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _173 => _173.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _174 => _174.faucetConfig]), () => ({})),this.transactionGenerationConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _175 => _175.transactionGenerationConfig]), () => ({})),this.pluginConfig=_optionalChain([e, 'optionalAccess', _176 => _176.pluginSettings])?{...e.pluginSettings,IGNORE_TRANSACTION_SUBMITTER:!1}:void 0}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return No[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="testnet")throw new Error("There is no way to programmatically mint testnet APT, you must use the minting site at https://aptos.dev/network/faucet");if(this.network==="mainnet")throw new Error("There is no mainnet faucet");if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Fo[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return zo[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return di[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return pi[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return di[this.network]===e}isProverServiceRequest(e){return pi[this.network]===e}getDefaultMaxGasAmount(){return _nullishCoalesce(_optionalChain([this, 'access', _177 => _177.transactionGenerationConfig, 'optionalAccess', _178 => _178.defaultMaxGasAmount]), () => (2e5))}getDefaultTxnExpirySecFromNow(){return _nullishCoalesce(_optionalChain([this, 'access', _179 => _179.transactionGenerationConfig, 'optionalAccess', _180 => _180.defaultTxnExpirySecFromNow]), () => (20))}setIgnoreTransactionSubmitter(e){this.pluginConfig&&(this.pluginConfig.IGNORE_TRANSACTION_SUBMITTER=e)}getTransactionSubmitter(){if(this.pluginConfig!==void 0&&this.pluginConfig.IGNORE_TRANSACTION_SUBMITTER!==!0)return this.pluginConfig.TRANSACTION_SUBMITTER}};var pd={typeParameters:[{constraints:[]}],parameters:[new O,new Z]};async function ga(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return T({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Kt))],functionArguments:[r,i],abi:pd},options:s})}var Bn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return ga({aptosConfig:this.config,...e})}};var _t={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},Ie="0x4::token::Token";async function ya(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};return(await w({aptosConfig:e,query:{query:Ps,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ma(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}};return(await w({aptosConfig:e,query:{query:Ui,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function fa(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}},o={query:Ui,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _181 => _181.offset]),limit:_optionalChain([r, 'optionalAccess', _182 => _182.limit]),order_by:_optionalChain([r, 'optionalAccess', _183 => _183.orderBy])}};return(await w({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function Aa(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}},o={query:Ss,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _184 => _184.offset]),limit:_optionalChain([r, 'optionalAccess', _185 => _185.limit]),order_by:_optionalChain([r, 'optionalAccess', _186 => _186.orderBy])}};return(await w({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var ld={typeParameters:[],parameters:[new h(I()),new Z,new h(I()),new h(I()),new W,new W,new W,new W,new W,new W,new W,new W,new W,new Z,new Z]};async function ha(n){let{aptosConfig:e,options:t,creator:r}=n;return T({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new C(n.description),new L(_nullishCoalesce(n.maxSupply, () => (_chunk6MMUUJHXjs.e))),new C(n.name),new C(n.uri),new F(_nullishCoalesce(n.mutableDescription, () => (!0))),new F(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new F(_nullishCoalesce(n.mutableURI, () => (!0))),new F(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new F(_nullishCoalesce(n.mutableTokenName, () => (!0))),new F(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new F(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new F(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new F(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new L(_nullishCoalesce(n.royaltyNumerator, () => (0))),new L(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:ld},options:t})}async function yn(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _187 => _187.where]);_optionalChain([t, 'optionalAccess', _188 => _188.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _189 => _189.tokenStandard]), () => ("v2"))});let i={query:ms,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _190 => _190.offset]),limit:_optionalChain([t, 'optionalAccess', _191 => _191.limit])}};return(await w({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ba(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=_chunk6MMUUJHXjs.ba.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _192 => _192.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _193 => _193.tokenStandard]), () => ("v2"))}),yn({aptosConfig:e,options:{...i,where:s}})}async function Ta(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _194 => _194.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _195 => _195.tokenStandard]), () => ("v2"))}),yn({aptosConfig:e,options:{...r,where:o}})}async function wa(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _196 => _196.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _197 => _197.tokenStandard]), () => ("v2"))}),yn({aptosConfig:e,options:{...r,where:o}})}async function Sa(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=_chunk6MMUUJHXjs.ba.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _198 => _198.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _199 => _199.tokenStandard]), () => ("v2"))}),(await yn({aptosConfig:i,options:{where:s}})).collection_id}var gd={typeParameters:[],parameters:[new h(I()),new h(I()),new h(I()),new h(I()),new U(new h(I())),new U(new h(I())),new U(U.u8())]};async function Pa(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:g}=n,A=_optionalChain([d, 'optionalAccess', _200 => _200.map, 'call', _201 => _201(p=>_t[p])]);return T({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new C(i),new C(o),new C(s),new C(a),S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(A, () => ([]))),Da(_nullishCoalesce(g, () => ([])),_nullishCoalesce(A, () => ([])))],abi:gd},options:t})}var yd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new O]};async function _a(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(r),_chunk6MMUUJHXjs.ba.from(i)],abi:yd},options:s})}var md={typeParameters:[],parameters:[new h(I()),new h(I()),new h(I()),new h(I()),new U(new h(I())),new U(new h(I())),new U(U.u8()),new O]};async function Ea(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:g,options:A}=n;if(_optionalChain([c, 'optionalAccess', _202 => _202.length])!==_optionalChain([g, 'optionalAccess', _203 => _203.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([d, 'optionalAccess', _204 => _204.length])!==_optionalChain([g, 'optionalAccess', _205 => _205.length]))throw new Error("Property types and property values counts do not match");let p=_optionalChain([d, 'optionalAccess', _206 => _206.map, 'call', _207 => _207(l=>_t[l])]);return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(p, () => ([]))),Da(_nullishCoalesce(g, () => ([])),_nullishCoalesce(p, () => ([]))),a],abi:md},options:A})}var fd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0)))]};async function xa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(r)],abi:fd},options:o})}var Ad={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0)))]};async function Ia(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Ie))],functionArguments:[r],abi:Ad},options:o})}var hd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0)))]};async function Ca(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Ie))],functionArguments:[r],abi:hd},options:o})}var bd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new h(I())]};async function va(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new C(r)],abi:bd},options:s})}var Td={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new h(I())]};async function Ka(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new C(r)],abi:Td},options:s})}var wd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new h(I())]};async function Ra(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new C(r)],abi:wd},options:s})}var Sd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new h(I()),new h(I()),U.u8()]};async function Ua(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new C(r),new C(_t[i]),S.U8(to(o,_t[i]))],abi:Sd},options:c})}var Pd={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new h(I())]};async function ka(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new C(r)],abi:Pd},options:s})}var _d={typeParameters:[{constraints:["key"]}],parameters:[new h(be(new B(0))),new h(I()),new h(I()),U.u8()]};async function za(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new C(r),new C(_t[i]),to(o,_t[i])],abi:_d},options:c})}var Ed={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new h(be(new B(0))),new h(I()),new B(1)]};async function Na(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (Ie)),_t[i]],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new C(r),o],abi:Ed},options:c})}var xd={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new h(be(new B(0))),new h(I()),new B(1)]};async function Fa(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (Ie)),_t[i]],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new C(r),o],abi:xd},options:c})}function Da(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(to(n[i],r))}),t}function to(n,e){let t=Be(e);return Vt(n,t,0,[]).bcsToBytes()}var Mn=class{constructor(e){this.config=e}async getCollectionData(e){await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=_chunk6MMUUJHXjs.ba.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _208 => _208.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _209 => _209.tokenStandard]), () => ("v2"))}),yn({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ba({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ta({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),wa({aptosConfig:this.config,...e})}async getCollectionId(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Sa({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ya({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ma({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),fa({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Aa({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return ha({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return Pa({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return _a({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return Ea({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return xa({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return Ia({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return Ca({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return va({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return Ka({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return Ra({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Ua({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return ka({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return za({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return Na({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return Fa({aptosConfig:this.config,...e})}};async function Oa(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _210 => _210.timeoutSecs])||20,{data:s}=await $o({aptosConfig:e,path:"fund",body:{address:_chunk6MMUUJHXjs.ba.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await pn({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _211 => _211.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Vn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Oa({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _212 => _212.options, 'optionalAccess', _213 => _213.waitForIndexer])===void 0||_optionalChain([e, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.waitForIndexer]))&&await Nr({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function Qr(n){let{aptosConfig:e,options:t}=n,r={query:bs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _216 => _216.where]),limit:_optionalChain([t, 'optionalAccess', _217 => _217.limit]),offset:_optionalChain([t, 'optionalAccess', _218 => _218.offset])}};return(await w({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ga(n){let{aptosConfig:e,options:t}=n,r={query:hs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _219 => _219.where]),limit:_optionalChain([t, 'optionalAccess', _220 => _220.limit]),offset:_optionalChain([t, 'optionalAccess', _221 => _221.offset])}};return(await w({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ba(n){let{aptosConfig:e,options:t}=n,r={query:fs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _222 => _222.where]),limit:_optionalChain([t, 'optionalAccess', _223 => _223.limit]),offset:_optionalChain([t, 'optionalAccess', _224 => _224.offset])}};return(await w({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Ma={typeParameters:[{constraints:[]}],parameters:[Be("0x1::object::Object"),new O,new Z]};async function Va(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Ma},options:s})}async function Ha(n){let{aptosConfig:e,sender:t,fromStore:r,toStore:i,amount:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::dispatchable_fungible_asset::transfer",typeArguments:["0x1::fungible_asset::FungibleStore"],functionArguments:[r,i,o],abi:Ma},options:s})}var Hn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _225 => _225.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Qr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _226 => _226.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Qr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _227 => _227.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await Qr({aptosConfig:this.config,options:{where:{creator_address:{_eq:_chunk6MMUUJHXjs.ba.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _228 => _228.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ga({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _229 => _229.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ba({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Va({aptosConfig:this.config,...e})}async transferFungibleAssetBetweenStores(e){return Ha({aptosConfig:this.config,...e})}};var Ln=class{constructor(e){this.config=e}async getLedgerInfo(){return Cr({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Rs({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Us({aptosConfig:this.config,...e})}async view(e){return le({aptosConfig:this.config,...e})}async viewJson(e){return ua({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return _s({aptosConfig:this.config,...e})}async queryIndexer(e){return w({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return vr({aptosConfig:this.config})}async getProcessorStatus(e){return Kr({aptosConfig:this.config,processorType:e})}};var La=["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 qa(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Et(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(!qa(e))throw new Error(`${e} is not valid. ${La}`);if(t&&!qa(t))throw new Error(`${t} is not valid. ${La}`);return{domainName:t||e,subdomainName:t?e:void 0}}function $a(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 Id="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Cd={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Id,custom:null,devnet:null};function lt(n){let e=Cd[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var jr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Wa(n){let{aptosConfig:e,name:t}=n,r=lt(e),{domainName:i,subdomainName:o}=Et(t),s=await le({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=jr(s[0]);return a?_chunk6MMUUJHXjs.ba.from(a):void 0}async function Qa(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=lt(e),{domainName:g,subdomainName:A}=Et(r),p=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(A&&!p)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(p&&!A)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let H=_nullishCoalesce(t.years, () => (1));if(H!==1)throw new Error("For now, names can only be registered for 1 year at a time");let je=H*31536e3;return await T({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[g,je,o,s]},options:a})}if(!A)throw new Error(`${t.policy} requires a subdomain to be provided.`);let l=await no({aptosConfig:e,name:g});if(!l)throw new Error("The domain does not exist");let b=t.policy==="subdomain:independent"?t.expirationDate:l;if(b>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await T({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[g,A,Math.round(b/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function no(n){let{aptosConfig:e,name:t}=n,r=lt(e),{domainName:i,subdomainName:o}=Et(t);try{let s=await le({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e7){return}}async function ja(n){let{aptosConfig:e,address:t}=n,r=lt(e),i=await le({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[_chunk6MMUUJHXjs.ba.from(t).toString()]}}),o=jr(i[1]),s=jr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Ja(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=lt(e);if(!r)return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Et(r);return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Xa(n){let{aptosConfig:e,name:t}=n,r=lt(e),{domainName:i,subdomainName:o}=Et(t),s=await le({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=jr(s[0]);return a?_chunk6MMUUJHXjs.ba.from(a):void 0}async function Ya(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=lt(e),{domainName:a,subdomainName:c}=Et(r);return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Za(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=Et(t),a=(await w({aptosConfig:e,query:{query:dn,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=qn(a)),$a(a)?a:void 0}async function ec(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await ro({aptosConfig:e});return(await w({aptosConfig:e,originMethod:"getAccountNames",query:{query:dn,variables:{limit:_optionalChain([t, 'optionalAccess', _230 => _230.limit]),offset:_optionalChain([t, 'optionalAccess', _231 => _231.offset]),order_by:_optionalChain([t, 'optionalAccess', _232 => _232.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _233 => _233.options, 'optionalAccess', _234 => _234.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(qn)}async function tc(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await ro({aptosConfig:e});return(await w({aptosConfig:e,originMethod:"getAccountDomains",query:{query:dn,variables:{limit:_optionalChain([t, 'optionalAccess', _235 => _235.limit]),offset:_optionalChain([t, 'optionalAccess', _236 => _236.offset]),order_by:_optionalChain([t, 'optionalAccess', _237 => _237.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _238 => _238.options, 'optionalAccess', _239 => _239.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(qn)}async function nc(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await ro({aptosConfig:e});return(await w({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:dn,variables:{limit:_optionalChain([t, 'optionalAccess', _240 => _240.limit]),offset:_optionalChain([t, 'optionalAccess', _241 => _241.offset]),order_by:_optionalChain([t, 'optionalAccess', _242 => _242.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _243 => _243.options, 'optionalAccess', _244 => _244.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(qn)}async function rc(n){let{aptosConfig:e,options:t,domain:r}=n;return(await w({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:dn,variables:{limit:_optionalChain([t, 'optionalAccess', _245 => _245.limit]),offset:_optionalChain([t, 'optionalAccess', _246 => _246.offset]),order_by:_optionalChain([t, 'optionalAccess', _247 => _247.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _248 => _248.options, 'optionalAccess', _249 => _249.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(qn).filter($a)}async function ro(n){let{aptosConfig:e}=n,t=lt(e),[r]=await le({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 ic(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=lt(e),a=i*31536e3,{domainName:c,subdomainName:d}=Et(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 T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function qn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var $n=class{constructor(e){this.config=e}async getOwnerAddress(e){return Wa({aptosConfig:this.config,...e})}async getExpiration(e){return no({aptosConfig:this.config,...e})}async getTargetAddress(e){return Xa({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ya({aptosConfig:this.config,...e})}async getPrimaryName(e){return ja({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ja({aptosConfig:this.config,...e})}async registerName(e){return Qa({aptosConfig:this.config,...e})}async renewDomain(e){return ic({aptosConfig:this.config,...e})}async getName(e){return Za({aptosConfig:this.config,...e})}async getAccountNames(e){return ec({aptosConfig:this.config,...e})}async getAccountDomains(e){return tc({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return nc({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return rc({aptosConfig:this.config,...e})}};async function oc(n){let{aptosConfig:e,poolAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await w({aptosConfig:e,query:{query:Ki,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 sc(n){let{aptosConfig:e,options:t}=n,r={query:Ki,variables:{order_by:_optionalChain([t, 'optionalAccess', _250 => _250.orderBy])}};return(await w({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function ac(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:As,variables:{delegatorAddress:_chunk6MMUUJHXjs.ba.from(t).toStringLong(),poolAddress:_chunk6MMUUJHXjs.ba.from(r).toStringLong()}};return(await w({aptosConfig:e,query:i})).delegated_staking_activities}var Wn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _251 => _251.minimumLedgerVersion]),processorType:"stake_processor"}),oc({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _252 => _252.minimumLedgerVersion]),processorType:"stake_processor"}),sc({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await P({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _253 => _253.minimumLedgerVersion]),processorType:"stake_processor"}),ac({aptosConfig:this.config,...e})}};var Jr=class{constructor(e){this.config=e}async simple(e){return T({aptosConfig:this.config,...e})}async multiAgent(e){return T({aptosConfig:this.config,...e})}};function io(n,e){if(!(n.getTransactionSubmitter()!==void 0||e.transactionSubmitter!==void 0)&&e.transaction.feePayerAddress&&!e.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator")}function oo(n,e,t){let r=t.value;return t.value=async function(...i){return r.apply(this,i)},t}var mn=class{constructor(e){this.config=e}async simple(e){return Qi({aptosConfig:this.config,...e})}async multiAgent(e){return Qi({aptosConfig:this.config,...e})}};_chunk6MMUUJHXjs.a.call(void 0, [oo],mn.prototype,"simple",1),_chunk6MMUUJHXjs.a.call(void 0, [oo],mn.prototype,"multiAgent",1);var Xr=class{constructor(e){this.config=e}async simple(e){return io(this.config,e),Dn({aptosConfig:this.config,...e})}async multiAgent(e){return io(this.config,e),Dn({aptosConfig:this.config,...e})}};var Yr=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 _chunk6MMUUJHXjs.fa.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunk6MMUUJHXjs.ha.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunk6MMUUJHXjs.fa.call(void 0, this.sleepTime),_chunk6MMUUJHXjs.ha.call(void 0, )-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 gn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await gn({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 _chunk6MMUUJHXjs.fa.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunk6MMUUJHXjs.ha.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunk6MMUUJHXjs.ha.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunk6MMUUJHXjs.fa.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var fn=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _254 => _254.pendingDequeue, 'access', _255 => _255.shift, 'call', _256 => _256(), 'optionalAccess', _257 => _257.resolve, 'call', _258 => _258(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new An("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},An=class extends Error{};var cc="fulfilled",uc= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(uc||{}),Zr= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new fn;this.transactionsQueue=new fn;this.outstandingTransactions=new fn;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Yr(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=Lr({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof An)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===cc?(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 An)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(pn({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===cc?(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 T({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 ei=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new Zr(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 Qn=class{constructor(e){this.config=e,this.build=new Jr(this.config),this.simulate=new mn(this.config),this.submit=new Xr(this.config),this.batch=new ei(this.config)}async getTransactions(e){return zi({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return vs({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Nn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Ks({aptosConfig:this.config,...e})}async waitForTransaction(e){return pn({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return zr({aptosConfig:this.config})}getSigningMessage(e){return Ws(e)}async publishPackageTransaction(e){return js({aptosConfig:this.config,...e})}async rotateAuthKey(e){return aa({aptosConfig:this.config,...e})}async rotateAuthKeyUnverified(e){return ca({aptosConfig:this.config,...e})}sign(e){return Vr({...e})}signAsFeePayer(e){return Hr({...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 Lr({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Qs({aptosConfig:this.config,...e})}};var jn=class{constructor(e){this.config=e}async getTableItem(e){return Ur({aptosConfig:this.config,...e})}async getTableItemsData(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Is({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Cs({aptosConfig:this.config,...e})}};async function ti(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:_chunk6MMUUJHXjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Wo({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return _chunk6MMUUJHXjs.j.fromHexInput(a.pepper).toUint8Array()}async function so(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await ti(n),uidKey:o="sub",maxExpHorizonSecs:s=(await Qt({aptosConfig:e})).maxExpHorizonSecs}=n;if(_chunk6MMUUJHXjs.j.fromHexInput(i).toUint8Array().length!==xe.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${xe.PEPPER_LENGTH} bytes`);let a=_jwtdecode.jwtDecode.call(void 0, 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:_chunk6MMUUJHXjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:_chunk6MMUUJHXjs.j.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:d}=await Qo({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),g=d.proof,A=new Tt({a:g.a,b:g.b,c:g.c});return new me({proof:new Wt(A,0),trainingWheelsSignature:Me.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function dc(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await ti(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await Qt({aptosConfig:e}),d=so({...n,pepper:s,maxExpHorizonSecs:c}),g=o?d:await d;if(r!==void 0){let l=V.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),b=await On({aptosConfig:e,authenticationKey:l.authKey().derivedAddress()});return Ge.create({...n,address:b,proof:g,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let A=K.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await On({aptosConfig:e,authenticationKey:A.authKey().derivedAddress()});return xe.create({...n,address:p,proof:g,pepper:s,proofFetchCallback:o,verificationKey:a})}async function pc(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(Vo.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}`,E.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${d}`})}let a=await s.json();return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,S.MoveString(a.keys.map(c=>c.kid)),S.MoveString(a.keys.map(c=>c.alg)),S.MoveString(a.keys.map(c=>c.e)),S.MoveString(a.keys.map(c=>c.n))]},options:i})}var Jn=class{constructor(e){this.config=e}async getPepper(e){return ti({aptosConfig:this.config,...e})}async getProof(e){return so({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return dc({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return pc({aptosConfig:this.config,...e})}};async function Ud(n){let{aptosConfig:e,options:t}=n,r={query:Ir,variables:{where_condition:_optionalChain([t, 'optionalAccess', _259 => _259.where]),offset:_optionalChain([t, 'optionalAccess', _260 => _260.offset]),limit:_optionalChain([t, 'optionalAccess', _261 => _261.limit]),order_by:_optionalChain([t, 'optionalAccess', _262 => _262.orderBy])}};return(await w({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function lc(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};return(await Ud({aptosConfig:e,options:{...r,where:o}}))[0]}var Xn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await P({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),lc({aptosConfig:this.config,...e})}};var ne=class{constructor(e){this.config=_nullishCoalesce(e, () => (new Wr)),this.account=new Gn(this.config),this.abstraction=new Ht(this.config),this.ans=new $n(this.config),this.coin=new Bn(this.config),this.digitalAsset=new Mn(this.config),this.faucet=new Vn(this.config),this.fungibleAsset=new Hn(this.config),this.general=new Ln(this.config),this.staking=new Wn(this.config),this.transaction=new Qn(this.config),this.table=new jn(this.config),this.keyless=new Jn(this.config),this.object=new Xn(this.config)}setIgnoreTransactionSubmitter(e){this.config.setIgnoreTransactionSubmitter(e)}};function ge(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})})}ge(ne,Gn,"account");ge(ne,Ht,"abstraction");ge(ne,$n,"ans");ge(ne,Bn,"coin");ge(ne,Mn,"digitalAsset");ge(ne,Event,"event");ge(ne,Vn,"faucet");ge(ne,Hn,"fungibleAsset");ge(ne,Ln,"general");ge(ne,Wn,"staking");ge(ne,Qn,"transaction");ge(ne,jn,"table");ge(ne,Jn,"keyless");ge(ne,Xn,"object");exports.ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT = Mo; exports.APTOS_BIP44_REGEX = Cc; exports.APTOS_COIN = Kt; exports.APTOS_FA = Go; exports.APTOS_HARDENED_REGEX = Ic; exports.AbstractKeylessAccount = Te; exports.AbstractMultiKey = Ne; exports.AbstractPublicKey = tr; exports.AbstractSignature = wn; exports.AbstractedAccount = Er; exports.Account = ut; exports.AccountAbstractionMessage = yr; exports.AccountAddress = _chunk6MMUUJHXjs.ba; exports.AccountAuthenticator = Y; exports.AccountAuthenticatorAbstraction = Ut; exports.AccountAuthenticatorEd25519 = De; exports.AccountAuthenticatorMultiEd25519 = tt; exports.AccountAuthenticatorMultiKey = We; exports.AccountAuthenticatorNoAccountAuthenticator = Yt; exports.AccountAuthenticatorSingleKey = ue; exports.AccountAuthenticatorVariant = _chunk6MMUUJHXjs.z; exports.AccountPublicKey = ae; exports.AccountSequenceNumber = Yr; exports.AccountUtils = ns; exports.AddressInvalidReason = _chunk6MMUUJHXjs.aa; exports.AnyPublicKey = x; exports.AnyPublicKeyVariant = _chunk6MMUUJHXjs.B; exports.AnySignature = D; exports.AnySignatureVariant = _chunk6MMUUJHXjs.D; exports.Aptos = ne; exports.AptosApiError = Se; exports.AptosApiType = qt; exports.AptosConfig = Wr; exports.AuthenticationKey = Q; exports.Bool = F; exports.CKDPriv = vo; exports.ChainId = Zt; exports.DEFAULT_MAX_GAS_AMOUNT = Do; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Oo; exports.DEFAULT_TXN_TIMEOUT_SEC = ir; exports.DerivableAbstractedAccount = is; exports.DeriveScheme = _chunk6MMUUJHXjs.$; exports.Deserializer = v; exports.EPK_HORIZON_SECS = au; exports.Ed25519Account = ie; exports.Ed25519PrivateKey = j; exports.Ed25519PublicKey = _; exports.Ed25519Signature = R; exports.EntryFunction = st; exports.EntryFunctionBytes = er; exports.EphemeralCertificate = $t; exports.EphemeralCertificateVariant = _chunk6MMUUJHXjs.G; exports.EphemeralKeyPair = Mt; exports.EphemeralPublicKey = At; exports.EphemeralPublicKeyVariant = _chunk6MMUUJHXjs.E; exports.EphemeralSignature = Me; exports.EphemeralSignatureVariant = _chunk6MMUUJHXjs.F; exports.FIREBASE_AUTH_ISS_PATTERN = Vo; exports.FederatedKeylessAccount = Ge; exports.FederatedKeylessPublicKey = V; exports.FeePayerRawTransaction = Dt; exports.FixedBytes = Ce; exports.Groth16ProofAndStatement = Ti; exports.Groth16VerificationKey = Si; exports.Groth16Zkp = Tt; exports.HARDENED_OFFSET = xo; exports.Hex = _chunk6MMUUJHXjs.j; exports.HexInvalidReason = _chunk6MMUUJHXjs.i; exports.Identifier = k; exports.KeyType = vc; exports.KeylessAccount = xe; exports.KeylessConfiguration = wi; exports.KeylessError = E; exports.KeylessErrorCategory = Zc; exports.KeylessErrorResolutionTip = eu; exports.KeylessErrorType = or; exports.KeylessPublicKey = K; exports.KeylessSignature = ce; exports.MAX_AUD_VAL_BYTES = hi; exports.MAX_COMMITED_EPK_BYTES = gu; exports.MAX_EXTRA_FIELD_BYTES = pu; exports.MAX_ISS_VAL_BYTES = du; exports.MAX_JWT_HEADER_B64_BYTES = lu; exports.MAX_UID_KEY_BYTES = cu; exports.MAX_UID_VAL_BYTES = uu; exports.MimeType = _chunk6MMUUJHXjs.q; exports.ModuleId = Cn; exports.MoveAbility = _chunk6MMUUJHXjs.X; exports.MoveFunctionVisibility = _chunk6MMUUJHXjs.W; exports.MoveJWK = Pi; exports.MoveOption = te; exports.MoveString = C; exports.MoveVector = S; exports.MultiAgentRawTransaction = Ft; exports.MultiAgentTransaction = wr; exports.MultiEd25519Account = kn; exports.MultiEd25519PublicKey = re; exports.MultiEd25519Signature = Fe; exports.MultiKey = $; exports.MultiKeyAccount = dt; exports.MultiKeySignature = Pe; exports.MultiSig = vn; exports.MultiSigTransactionPayload = Kn; exports.Network = li; exports.NetworkToChainId = gi; exports.NetworkToFaucetAPI = Fo; exports.NetworkToIndexerAPI = zo; exports.NetworkToNetworkName = Cl; exports.NetworkToNodeAPI = No; exports.NetworkToPepperAPI = di; exports.NetworkToProverAPI = pi; exports.ParsingError = _chunk6MMUUJHXjs.h; exports.PrivateKey = ft; exports.PrivateKeyVariants = _chunk6MMUUJHXjs.A; exports.ProcessorType = ht; exports.PublicKey = It; exports.RAW_TRANSACTION_SALT = Bo; exports.RAW_TRANSACTION_WITH_DATA_SALT = yi; exports.RawTransaction = Ee; exports.RawTransactionWithData = hr; exports.RoleType = _chunk6MMUUJHXjs.Y; exports.RotationProofChallenge = br; exports.Script = rn; exports.ScriptTransactionArgumentVariants = _chunk6MMUUJHXjs.s; exports.Secp256k1PrivateKey = Ze; exports.Secp256k1PublicKey = ze; exports.Secp256k1Signature = et; exports.Serializable = _chunk6MMUUJHXjs.l; exports.Serialized = Tn; exports.Serializer = _chunk6MMUUJHXjs.m; exports.Signature = M; exports.SignedTransaction = ct; exports.SigningScheme = _chunk6MMUUJHXjs.Z; exports.SigningSchemeInput = _chunk6MMUUJHXjs._; exports.SimpleTransaction = Tr; exports.SingleKeyAccount = pe; exports.StructTag = Qe; exports.TransactionAndProof = Pr; exports.TransactionAuthenticator = at; exports.TransactionAuthenticatorEd25519 = Ot; exports.TransactionAuthenticatorFeePayer = Bt; exports.TransactionAuthenticatorMultiAgent = Gt; exports.TransactionAuthenticatorMultiEd25519 = an; exports.TransactionAuthenticatorSingleSender = Pt; exports.TransactionAuthenticatorVariant = _chunk6MMUUJHXjs.y; exports.TransactionExecutable = on; exports.TransactionExecutableEmpty = Un; exports.TransactionExecutableEntryFunction = sn; exports.TransactionExecutableScript = Rn; exports.TransactionExecutableVariants = _chunk6MMUUJHXjs.v; exports.TransactionExtraConfig = Ar; exports.TransactionExtraConfigV1 = Nt; exports.TransactionExtraConfigVariants = _chunk6MMUUJHXjs.w; exports.TransactionInnerPayload = fr; exports.TransactionInnerPayloadV1 = zt; exports.TransactionInnerPayloadVariants = _chunk6MMUUJHXjs.u; exports.TransactionPayload = St; exports.TransactionPayloadEntryFunction = tn; exports.TransactionPayloadMultiSig = nn; exports.TransactionPayloadScript = en; exports.TransactionPayloadVariants = _chunk6MMUUJHXjs.t; exports.TransactionResponseType = _chunk6MMUUJHXjs.I; exports.TransactionVariants = _chunk6MMUUJHXjs.x; exports.TransactionWorker = Zr; exports.TransactionWorkerEventsEnum = uc; exports.TypeTag = G; exports.TypeTagAddress = O; exports.TypeTagBool = W; exports.TypeTagGeneric = B; exports.TypeTagParserError = J; exports.TypeTagParserErrorType = Ou; exports.TypeTagReference = mr; exports.TypeTagSigner = kt; exports.TypeTagStruct = h; exports.TypeTagU128 = it; exports.TypeTagU16 = nt; exports.TypeTagU256 = ot; exports.TypeTagU32 = rt; exports.TypeTagU64 = Z; exports.TypeTagU8 = de; exports.TypeTagVariants = _chunk6MMUUJHXjs.r; exports.TypeTagVector = U; exports.U128 = Re; exports.U16 = ve; exports.U256 = we; exports.U32 = Ke; exports.U64 = L; exports.U8 = X; exports.ZeroKnowledgeSig = me; exports.ZkProof = Wt; exports.ZkpVariant = _chunk6MMUUJHXjs.H; exports.anyPublicKeyVariantToString = _chunk6MMUUJHXjs.C; exports.aptosCoinStructTag = Rf; exports.aptosRequest = sr; exports.base64UrlDecode = _chunk6MMUUJHXjs.ja; exports.base64UrlToBytes = _chunk6MMUUJHXjs.ka; exports.bigIntToBytesLE = ui; exports.buildTransaction = $i; exports.bytesToBigIntLE = Ct; exports.checkOrConvertArgument = Vt; exports.convertAmountFromHumanReadableToOnChain = _chunk6MMUUJHXjs.la; exports.convertAmountFromOnChainToHumanReadable = _chunk6MMUUJHXjs.ma; exports.convertArgument = qi; exports.convertNumber = Fr; exports.convertPayloadToInnerPayload = ju; exports.createObjectAddress = _chunk6MMUUJHXjs.ca; exports.createResourceAddress = _chunk6MMUUJHXjs.da; exports.createTokenAddress = _chunk6MMUUJHXjs.ea; exports.deriveKey = ai; exports.deriveTransactionType = Sr; exports.deserializeFromScriptArgument = Pu; exports.deserializePublicKey = Rm; exports.deserializeSignature = Um; exports.ensureBoolean = _chunk6MMUUJHXjs.n; exports.fetchEntryFunctionAbi = Ms; exports.fetchFunctionAbi = Li; exports.fetchJWK = Ei; exports.fetchModuleAbi = Vu; exports.fetchMoveFunctionAbi = Iw; exports.fetchViewFunctionAbi = Vs; exports.findFirstNonSignerArg = Bs; exports.floorToWholeHour = _chunk6MMUUJHXjs.ia; exports.generateRawTransaction = Qu; exports.generateSignedTransaction = Wi; exports.generateSignedTransactionForSimulation = Ls; exports.generateSigningMessage = qe; exports.generateSigningMessageForSerializable = qA; exports.generateSigningMessageForTransaction = Oe; exports.generateTransactionPayload = Mr; exports.generateTransactionPayloadWithABI = qu; exports.generateUserTransactionHash = eS; exports.generateViewFunctionPayload = Hs; exports.generateViewFunctionPayloadWithABI = $u; exports.get = ar; exports.getAptosFullNode = q; exports.getAptosPepperService = tg; exports.getAuthenticatorForSimulation = ln; exports.getErrorMessage = _chunk6MMUUJHXjs.ga; exports.getFunctionParts = _chunk6MMUUJHXjs.pa; exports.getIssAudAndUidVal = Ye; exports.getKeylessConfig = Qt; exports.getKeylessJWKs = Au; exports.getPageWithObfuscatedCursor = ur; exports.hashStrToField = Ve; exports.hashValues = qs; exports.hexToAsciiString = _chunk6MMUUJHXjs.k; exports.isBcsAddress = Or; exports.isBcsBool = Ni; exports.isBcsFixedBytes = Bu; exports.isBcsString = Fi; exports.isBcsU128 = Mi; exports.isBcsU16 = Oi; exports.isBcsU256 = Vi; exports.isBcsU32 = Gi; exports.isBcsU64 = Bi; exports.isBcsU8 = Di; exports.isBlockEpilogueTransactionResponse = _chunk6MMUUJHXjs.P; exports.isBlockMetadataTransactionResponse = _chunk6MMUUJHXjs.M; exports.isBool = Fs; exports.isCanonicalEd25519Signature = Su; exports.isEd25519Signature = _chunk6MMUUJHXjs.Q; exports.isEmptyOption = Ds; exports.isEncodedEntryFunctionArgument = Os; exports.isEncodedStruct = _chunk6MMUUJHXjs.oa; exports.isFeePayerSignature = _chunk6MMUUJHXjs.T; exports.isGenesisTransactionResponse = _chunk6MMUUJHXjs.L; exports.isKeylessSigner = _r; exports.isLargeNumber = Dr; exports.isMultiAgentSignature = _chunk6MMUUJHXjs.S; exports.isMultiEd25519Signature = _chunk6MMUUJHXjs.U; exports.isNumber = Gu; exports.isPendingTransactionResponse = _chunk6MMUUJHXjs.J; exports.isScriptDataInput = Gs; exports.isSecp256k1Signature = _chunk6MMUUJHXjs.R; exports.isSingleKeySigner = Ci; exports.isSingleSenderSignature = _chunk6MMUUJHXjs.V; exports.isStateCheckpointTransactionResponse = _chunk6MMUUJHXjs.N; exports.isString = pt; exports.isUserTransactionResponse = _chunk6MMUUJHXjs.K; exports.isValidBIP44Path = Io; exports.isValidFunctionInfo = _chunk6MMUUJHXjs.qa; exports.isValidHardenedPath = Co; exports.isValidatorTransactionResponse = _chunk6MMUUJHXjs.O; exports.mnemonicToSeed = nr; exports.normalizeBundle = Ho; exports.nowInSeconds = _chunk6MMUUJHXjs.ha; exports.objectStructTag = be; exports.optionStructTag = Uf; exports.outOfRangeErrorMessage = _chunk6MMUUJHXjs.o; exports.padAndPackBytesWithLen = Pn; exports.paginateWithCursor = cr; exports.paginateWithObfuscatedCursor = fi; exports.pairedFaMetadataAddress = _chunk6MMUUJHXjs.sa; exports.parseEncodedStruct = _chunk6MMUUJHXjs.na; exports.parseJwtHeader = bu; exports.parseTypeTag = Be; exports.poseidonHash = vt; exports.post = _n; exports.postAptosFaucet = $o; exports.postAptosFullNode = bt; exports.postAptosIndexer = qo; exports.postAptosPepperService = Wo; exports.postAptosProvingService = Qo; exports.promiseFulfilledStatus = cc; exports.request = ru; exports.sleep = _chunk6MMUUJHXjs.fa; exports.splitPath = Ko; exports.standardizeTypeTags = Gr; exports.stringStructTag = I; exports.throwTypeMismatch = z; exports.truncateAddress = _chunk6MMUUJHXjs.ra; exports.validateNumberInRange = _chunk6MMUUJHXjs.p; exports.verifyKeylessSignature = _i; exports.verifyKeylessSignatureWithJwkAndConfig = dr;
481
+ `;async function vr(n){let{aptosConfig:e}=n,{data:t}=await V({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function ws(n){let{aptosConfig:e,limit:t}=n;return(await w({aptosConfig:e,query:{query:ds,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function w(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Mo({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function $u(n){let{aptosConfig:e}=n;return(await w({aptosConfig:e,query:{query:Ki},originMethod:"getProcessorStatuses"})).processor_status}async function Kr(n){let e=await $u({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Rr(n){let{aptosConfig:e,processorType:t}=n;return(await w({aptosConfig:e,query:{query:Ki,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Ur(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}`});return r}async function _s(n){return _optionalChain([n, 'access', _64 => _64.options, 'optionalAccess', _65 => _65.ledgerVersion])!==void 0?Ss(n):Le(async()=>Ss(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Ss(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await V({aptosConfig:e,originMethod:"getModule",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _66 => _66.ledgerVersion])}});return o}async function kr(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await bt({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _67 => _67.ledgerVersion])},body:r})).data}async function Ps(n){let{aptosConfig:e,options:t}=n,r={query:As,variables:{where_condition:_optionalChain([t, 'optionalAccess', _68 => _68.where]),offset:_optionalChain([t, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([t, 'optionalAccess', _70 => _70.limit]),order_by:_optionalChain([t, 'optionalAccess', _71 => _71.orderBy])}};return(await w({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function Es(n){let{aptosConfig:e,options:t}=n,r={query:hs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _72 => _72.where]),offset:_optionalChain([t, 'optionalAccess', _73 => _73.offset]),limit:_optionalChain([t, 'optionalAccess', _74 => _74.limit]),order_by:_optionalChain([t, 'optionalAccess', _75 => _75.orderBy])}};return(await w({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function ki(n){let{aptosConfig:e,options:t}=n;return ur({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _76 => _76.offset]),limit:_optionalChain([t, 'optionalAccess', _77 => _77.limit])}})}async function zr(n){let{aptosConfig:e}=n;return Le(async()=>{let{data:t}=await V({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function xs(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await V({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Fn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function Is(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Fn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _78 => _78.status])===404)return!0;throw r}}async function Wu(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await V({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function gn(n){let{aptosConfig:e,transactionHash:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _79 => _79.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _80 => _80.checkSuccess]), () => (!0)),s=!0,a=0,c,p,g=200,A=1.5;function l(d){if(!(d instanceof Se)||(p=d,d.status!==404&&d.status>=400&&d.status<500))throw d}try{c=await Fn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(d){l(d)}if(s){let d=Date.now();try{c=await Wu({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){l(b)}a=(Date.now()-d)/1e3}for(;s&&!(a>=i);){try{if(c=await Fn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(d){l(d)}await _chunkAWFAHZSBjs.w.call(void 0, g),a+=g/1e3,g*=A}if(c===void 0)throw p||new Nr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new Nr(`Transaction ${t} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Ui(`Transaction ${t} failed with an error: ${c.vm_status}`,c);return c}async function Dr(n){let{aptosConfig:e,processorType:t}=n,r=BigInt(n.minimumLedgerVersion),i=3e3,o=new Date().getTime(),s=BigInt(-1);for(;s<r;){if(new Date().getTime()-o>i)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(t===void 0?s=await Kr({aptosConfig:e}):s=(await Rr({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunkAWFAHZSBjs.w.call(void 0, 200)}}var Nr=class extends Error{constructor(e,t){super(e),this.lastSubmittedTransaction=t}},Ui=class extends Error{constructor(e,t){super(e),this.transaction=t}};async function Cs(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await V({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _81 => _81.withTransactions])}});return Ks({block:i,...n})}async function vs(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await V({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _82 => _82.withTransactions])}});return Ks({block:i,...n})}async function Ks(n){let{aptosConfig:e,block:t,options:r}=n;if(_optionalChain([r, 'optionalAccess', _83 => _83.withTransactions])){t.transactions=_nullishCoalesce(t.transactions, () => ([]));let i=t.transactions[t.transactions.length-1],o=BigInt(t.first_version),s=BigInt(t.last_version),a=_optionalChain([i, 'optionalAccess', _84 => _84.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return t;let p=[],g=100n;for(let l=c+1n;l<s;l+=BigInt(100))p.push(ki({aptosConfig:e,options:{offset:l,limit:Math.min(Number(g),Number(s-l+1n))}}));let A=await Promise.all(p);for(let l of A)t.transactions.push(...l)}return t}function Rs(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Us(n){return!!n.match(/\s/)}function ju(n){return!!n.match(/^T[0-9]+$/)}function Qu(n){return!!n.match(/^&.+$/)}function Ju(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 Xu(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Us(r))break}return t}var Yu=(b=>(b.InvalidTypeTag="unknown type",b.UnexpectedGenericType="unexpected generic type",b.UnexpectedTypeArgumentClose="unexpected '>'",b.UnexpectedWhitespaceCharacter="unexpected whitespace character",b.UnexpectedComma="unexpected ','",b.TypeArgumentCountMismatch="type argument count doesn't match expected amount",b.MissingTypeArgumentClose="no matching '>' for '<'",b.MissingTypeArgument="no type argument before ','",b.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",b.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",b.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",b.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",b.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",b.InvalidAddress="struct address must be valid",b))(Yu||{}),X= exports.TypeTagParserError =class extends Error{constructor(e,t){super(`Failed to parse typeTag '${e}', ${t}`)}};function Be(n,e){let t=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _85 => _85.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let b=On(a,i,t);o.push(b)}let g=r.pop();if(g===void 0)throw new X(n,"unexpected '>'");if(c!==o.length)throw new X(n,"type argument count doesn't match expected amount");let{savedStr:A,savedTypes:l,savedExpectedTypes:d}=g;i=o,o=l,a=A,c=d}else if(p===","){if(r.length===0)throw new X(n,"unexpected ','");if(a.length===0)throw new X(n,"no type argument before ','");let g=On(a,i,t);i=[],o.push(g),a="",c+=1}else if(Us(p)){let g=!1;if(a.length!==0){let l=On(a,i,t);i=[],o.push(l),a="",g=!0}s=Xu(n,s);let A=n[s];if(s<n.length&&g&&A!==","&&A!==">")throw new X(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new X(n,"no matching '>' for '<'");switch(o.length){case 0:return On(a,i,t);case 1:if(a==="")return o[0];throw new X(n,"unexpected ','");default:throw new X(n,"unexpected whitespace character")}}function On(n,e,t){let r=n.trim(),i=r.toLowerCase();if(Ju(i)&&e.length>0)throw new X(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new Ut;case"bool":return new j;case"address":return new G;case"u8":return new ue;case"u16":return new it;case"u32":return new ot;case"u64":return new ee;case"u128":return new st;case"u256":return new at;case"vector":if(e.length!==1)throw new X(n,"vector type expected to have exactly one type argument");return new U(e[0]);default:if(Qu(r)){let a=r.substring(1);return new fr(On(a,e,t))}if(ju(r)){if(t)return new B(Number(r.split("T")[1]));throw new X(n,"unexpected generic type")}if(!r.match(/:/))throw new X(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new X(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=_chunkAWFAHZSBjs.r.fromString(o[0])}catch (e4){throw new X(n,"struct address must be valid")}if(!Rs(o[1]))throw new X(n,"module name must only contain alphanumeric or '_' characters");if(!Rs(o[2]))throw new X(n,"struct name must only contain alphanumeric or '_' characters");return new h(new Qe(s,new k(o[1]),new k(o[2]),e))}}function ks(n){return typeof n=="boolean"}function gt(n){return typeof n=="string"}function Zu(n){return typeof n=="number"}function Fr(n){if(Zu(n))return n;if(gt(n)&&n!=="")return Number.parseInt(n,10)}function Or(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Ns(n){return n==null}function zs(n){return Ni(n)||Di(n)||Fi(n)||Oi(n)||Gi(n)||Mi(n)||Bi(n)||Gr(n)||zi(n)||ep(n)||n instanceof S||n instanceof te}function Ni(n){return n instanceof D}function Gr(n){return n instanceof _chunkAWFAHZSBjs.r}function zi(n){return n instanceof C}function ep(n){return n instanceof ve}function Di(n){return n instanceof Y}function Fi(n){return n instanceof Ke}function Oi(n){return n instanceof Re}function Gi(n){return n instanceof $}function Mi(n){return n instanceof Ue}function Bi(n){return n instanceof Te}function Ds(n){return"bytecode"in n}function N(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Fs(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}var tp=new TextEncoder;function Mr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _86 => _86.map, 'call', _87 => _87(e=>gt(e)?Be(e):e)]), () => ([]))}async function np(n,e,t){return(await Br({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function Vi(n,e,t,r){let i=await np(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 gb(n,e,t,r){let i=await Vi(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(Be(i.params[s],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o}}async function Os(n,e,t,r){let i=await Vi(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=Fs(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Be(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Gs(n,e,t,r){let i=await Vi(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(Be(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Be(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function Li(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=Be(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 Bt(t,s,r,i,"exposed_functions"in e?e:void 0,o)}function Bt(n,e,t,r,i,o){return zs(n)?(Hi(e,n,t),n):rp(n,e,t,r,i,o)}function rp(n,e,t,r,i,o){if(e.isBool()){if(ks(n))return new D(n);if(gt(n)){if(n==="true")return new D(!0);if(n==="false")return new D(!1)}N("boolean",t)}if(e.isAddress()){if(gt(n))return _chunkAWFAHZSBjs.r.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new (0, _chunkAWFAHZSBjs.r)(n.data);N("string | AccountAddress",t)}if(e.isU8()){let s=Fr(n);if(s!==void 0)return new Y(s);N("number | string",t)}if(e.isU16()){let s=Fr(n);if(s!==void 0)return new Ke(s);N("number | string",t)}if(e.isU32()){let s=Fr(n);if(s!==void 0)return new Re(s);N("number | string",t)}if(e.isU64()){if(Or(n))return new $(BigInt(n));N("bigint | number | string",t)}if(e.isU128()){if(Or(n))return new Ue(BigInt(n));N("bigint | number | string",t)}if(e.isU256()){if(Or(n))return new Te(BigInt(n));N("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 Bt(n,r[s],t,r,i)}if(e.isVector()){if(e.value.isU8()){if(gt(n))return S.U8(tp.encode(n));if(n instanceof Uint8Array)return S.U8(n);if(n instanceof ArrayBuffer)return S.U8(new Uint8Array(n))}if(gt(n)&&n.startsWith("["))return Bt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new S(n.map(s=>Bt(s,e.value,t,r,i)));throw new Error(`Type mismatch for argument ${t}, type '${e.toString()}'`)}if(e.isStruct()){if(e.isString()){if(gt(n))return new C(n);N("string",t)}if(e.isObject()){if(gt(n))return _chunkAWFAHZSBjs.r.fromString(n);if(n&&typeof n=="object"&&"data"in n&&n.data instanceof Uint8Array)return new (0, _chunkAWFAHZSBjs.r)(n.data);N("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new ve(n);N("Uint8Array",t)}if(e.isOption()){if(Ns(n)){let a=e.value.typeArgs[0];return a instanceof j?new te(null):a instanceof G?new te(null):a instanceof ue?new te(null):a instanceof it?new te(null):a instanceof ot?new te(null):a instanceof ee?new te(null):a instanceof st?new te(null):a instanceof at?new te(null):new te(null)}return new te(Bt(n,e.value.typeArgs[0],t,r,i))}if(_optionalChain([i, 'optionalAccess', _88 => _88.structs, 'access', _89 => _89.find, 'call', _90 => _90(a=>a.name===e.value.name.identifier), 'optionalAccess', _91 => _91.fields, 'access', _92 => _92.length])===0&&n instanceof Uint8Array)return new ve(n);if(n instanceof Uint8Array&&_optionalChain([o, 'optionalAccess', _93 => _93.allowUnknownStructs]))return console.warn(`Unsupported struct input type for argument ${t}. Continuing since 'allowUnknownStructs' is enabled.`),new ve(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 Hi(n,e,t){if(n.isBool()){if(Ni(e))return;N("Bool",t)}if(n.isAddress()){if(Gr(e))return;N("AccountAddress",t)}if(n.isU8()){if(Di(e))return;N("U8",t)}if(n.isU16()){if(Fi(e))return;N("U16",t)}if(n.isU32()){if(Oi(e))return;N("U32",t)}if(n.isU64()){if(Gi(e))return;N("U64",t)}if(n.isU128()){if(Mi(e))return;N("U128",t)}if(n.isU256()){if(Bi(e))return;N("U256",t)}if(n.isVector()){if(e instanceof S){e.values.length>0&&Hi(n.value,e.values[0],t);return}N("MoveVector",t)}if(n instanceof h){if(n.isString()){if(zi(e))return;N("MoveString",t)}if(n.isObject()){if(Gr(e))return;N("AccountAddress",t)}if(n.isOption()){if(e instanceof te){e.value!==void 0&&Hi(n.value.typeArgs[0],e.value,t);return}N("MoveOption",t)}}throw new Error(`Type mismatch for argument ${t}, expected '${n.toString()}'`)}async function Hr(n){if(Ds(n))return ap(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunkAWFAHZSBjs.G.call(void 0, n.function),i=await Vs({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Os});return op({...n,abi:i})}function op(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkAWFAHZSBjs.G.call(void 0, n.function),o=Mr(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>Li(n.function,e,c,p,o));if(s.length!==e.parameters.length)throw new Error(`Too few arguments for '${t}::${r}::${i}', expected ${e.parameters.length} but got ${s.length}`);let a=ct.build(`${t}::${r}`,i,o,s);if("multisigAddress"in n){let c=_chunkAWFAHZSBjs.r.from(n.multisigAddress);return new on(new Rn(c,new Un(a)))}return new rn(a)}async function Ms(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunkAWFAHZSBjs.G.call(void 0, n.function),i=await Vs({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Gs});return sp({abi:i,...n})}function sp(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunkAWFAHZSBjs.G.call(void 0, n.function),o=Mr(n.typeArguments);if(o.length!==e.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${e.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _94 => _94.functionArguments, 'optionalAccess', _95 => _95.map, 'call', _96 => _96((a,c)=>Li(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 ct.build(`${t}::${r}`,i,o,s)}function ap(n){return new nn(new sn(_chunkAWFAHZSBjs.j.fromHexInput(n.bytecode).toUint8Array(),Mr(n.typeArguments),n.functionArguments))}async function cp(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n;if(_optionalChain([i, 'optionalAccess', _97 => _97.replayProtectionNonce])!==void 0&&_optionalChain([i, 'optionalAccess', _98 => _98.accountSequenceNumber])!==void 0)throw new Error("Cannot specify both replayProtectionNonce and accountSequenceNumber in options.");let s=async()=>di[e.network]?{chainId:di[e.network]}:{chainId:(await vr({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _99 => _99.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await zr({aptosConfig:e})).gas_estimate},c=async()=>{let oe=async()=>_optionalChain([i, 'optionalAccess', _100 => _100.accountSequenceNumber])!==void 0?i.accountSequenceNumber:_optionalChain([i, 'optionalAccess', _101 => _101.replayProtectionNonce])!==void 0?0xdeadbeefn:(await Ur({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunkAWFAHZSBjs.r.from(o).equals(_chunkAWFAHZSBjs.r.ZERO))try{return await oe()}catch (e5){return 0}else return oe()},[{chainId:p},{gasEstimate:g},A]=await Promise.all([s(),a(),c()]),{maxGasAmount:l,gasUnitPrice:d,expireTimestamp:b,replayProtectionNonce:z}={maxGasAmount:_optionalChain([i, 'optionalAccess', _102 => _102.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(e.getDefaultMaxGasAmount()),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _103 => _103.gasUnitPrice]), () => (BigInt(g))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _104 => _104.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+e.getDefaultTxnExpirySecFromNow()))),replayProtectionNonce:_optionalChain([i, 'optionalAccess', _105 => _105.replayProtectionNonce])?BigInt(i.replayProtectionNonce):void 0},q=r;return z!==void 0&&(q=up(r,z)),new xe(_chunkAWFAHZSBjs.r.from(t),BigInt(A),q,BigInt(l),BigInt(d),BigInt(b),new tn(p))}function up(n,e){if(n instanceof nn)return new kt(new kn(n.script),new Nt(void 0,e));if(n instanceof rn)return new kt(new cn(n.entryFunction),new Nt(void 0,e));if(n instanceof on){let t=n.multiSig.transaction_payload,r;if(t===void 0||_optionalChain([t, 'optionalAccess', _106 => _106.transaction_payload])===void 0)r=new Nn;else if(t.transaction_payload instanceof ct)r=new cn(t.transaction_payload);else throw new Error("Scripts are not supported in multi-sig transactions.");return new kt(r,new Nt(n.multiSig.multisig_address,e))}else throw new Error(`Unsupported payload type: ${n}`)}async function qi(n){let{aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o}=n,s=await cp({aptosConfig:e,sender:t,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _107 => _107.secondarySignerAddresses, 'optionalAccess', _108 => _108.map, 'call', _109 => _109(c=>_chunkAWFAHZSBjs.r.from(c))]), () => ([]));return new Sr(s,a,n.feePayerAddress?_chunkAWFAHZSBjs.r.from(n.feePayerAddress):void 0)}return new wr(s,n.feePayerAddress?_chunkAWFAHZSBjs.r.from(n.feePayerAddress):void 0)}function Bs(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=yn(e);if(t.feePayerAddress){let a=new Dt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(A=>yn(A)):c=Array.from({length:t.secondarySignerAddresses.length},()=>yn(void 0)));let p=yn(i),g=new Gt(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:p});return new pt(a.raw_txn,g).bcsToBytes()}if(t.secondarySignerAddresses){let a=new zt(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(g=>yn(g)):c=Array.from({length:t.secondarySignerAddresses.length},()=>yn(void 0));let p=new Ot(o,t.secondarySignerAddresses,c);return new pt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof Oe)s=new Ft(o.public_key,o.signature);else if(o instanceof ce||o instanceof je)s=new _t(o);else if(o instanceof en)s=new _t(o);else throw new Error("Invalid public key");return new pt(t.rawTransaction,s).bcsToBytes()}function yn(n){if(!n)return new en;let t=K.isInstance(n)||L.isInstance(n)||ze.isInstance(n)?new x(n):n,r=new R(new Uint8Array(64));if(P.isInstance(t))return new Oe(t,r);if(x.isInstance(t))return K.isInstance(t.publicKey)?new ce(t,new O(ae.getSimulationSignature())):new ce(t,new O(r));if(W.isInstance(t))return new je(t,new Pe({signatures:t.publicKeys.map(i=>K.isInstance(i.publicKey)||L.isInstance(i.publicKey)?new O(ae.getSimulationSignature()):new O(r)),bitmap:t.createBitmap({bits:Array(t.publicKeys.length).fill(0).map((i,o)=>o)})}));throw new Error("Unsupported PublicKey used for simulations")}function $i(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Oo(Z,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 Gt(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:e.feePayerAddress,authenticator:t})}else if(e.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Ot(i,e.secondarySignerAddresses,r)}else i instanceof Oe?o=new Ft(i.public_key,i.signature):i instanceof rt?o=new un(i.public_key,i.signature):o=new _t(i);return new pt(e.rawTransaction,o).bcsToBytes()}function Hs(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var pp=Hs(["APTOS::Transaction"]);function Mb(n){let e=$i(n);return new (0, _chunkAWFAHZSBjs.j)(Hs([pp,new Uint8Array([0]),e])).toString()}async function Vs({key:n,moduleAddress:e,moduleName:t,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Le(async()=>s(e,t,r,i),`${n}-${i.network}-${e}-${t}-${r}`,1e3*60*5)()}async function T(n){let e=await dp(n);return lp(n,e)}async function dp(n){let{aptosConfig:e,data:t}=n,r,i;return"bytecode"in t?i=await Hr(t):"multisigAddress"in t?(r={aptosConfig:e,multisigAddress:t.multisigAddress,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Hr(r)):(r={aptosConfig:e,function:t.function,functionArguments:t.functionArguments,typeArguments:t.typeArguments,abi:t.abi},i=await Hr(r)),i}async function lp(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(gp(n)&&(o=_chunkAWFAHZSBjs.r.ZERO.toString()),yp(n)){let{secondarySignerAddresses:s}=n;return qi({aptosConfig:t,sender:r,payload:e,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return qi({aptosConfig:t,sender:r,payload:e,options:i,feePayerAddress:o})}function gp(n){return n.withFeePayer===!0}function yp(n){return"secondarySignerAddresses"in n}function Ls(n){let{transaction:e}=n;return Ge(e)}function Vr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function Lr(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,Vr({signer:e,transaction:t})}async function Wi(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Bs({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await bt({aptosConfig:e,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _110 => _110.options, 'optionalAccess', _111 => _111.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _112 => _112.options, 'optionalAccess', _113 => _113.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _114 => _114.options, 'optionalAccess', _115 => _115.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function Gn(n){let{aptosConfig:e,transactionSubmitter:t}=n,r=t===void 0?e.getTransactionSubmitter():t;if(r)return r.submitTransaction(n);let i=$i({...n});try{let{data:o}=await bt({aptosConfig:e,body:i,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return o}catch(o){let s=pt.deserialize(new v(i));throw s.authenticator.isSingleSender()&&s.authenticator.sender.isSingleKey()&&(s.authenticator.sender.public_key.publicKey instanceof K||s.authenticator.sender.public_key.publicKey instanceof L)&&await be.fetchJWK({aptosConfig:e,publicKey:s.authenticator.sender.public_key.publicKey,kid:s.authenticator.sender.signature.signature.getJwkKid()}),o}}async function qr(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i,...o}=n;Er(t)&&await t.checkKeylessAccountValidity(e),Er(r)&&await r.checkKeylessAccountValidity(e);let s=n.feePayerAuthenticator||r&&Lr({signer:r,transaction:i}),a=Vr({signer:t,transaction:i});return Gn({aptosConfig:e,transaction:i,senderAuthenticator:a,feePayerAuthenticator:s,...o})}async function qs(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i,...o}=n;Er(r)&&await r.checkKeylessAccountValidity(e);let s=Lr({signer:r,transaction:i});return Gn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:s,...o})}var mp={typeParameters:[],parameters:[U.u8(),new U(U.u8())]};async function $s(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>S.U8(a));return T({aptosConfig:e,sender:_chunkAWFAHZSBjs.r.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[S.U8(r),new S(s)],abi:mp},options:o})}async function mn(n){return Ur(n)}async function Ws(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return yi({aptosConfig:e,originMethod:"getModules",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _116 => _116.ledgerVersion]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _117 => _117.limit]), () => (1e3))}})}async function js(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await pr({aptosConfig:e,originMethod:"getModulesPage",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _118 => _118.ledgerVersion]),cursor:_optionalChain([r, 'optionalAccess', _119 => _119.cursor]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _120 => _120.limit]), () => (100))}});return{modules:i.data,cursor:o}}async function Br(n){return _s(n)}async function Qi(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return ur({aptosConfig:e,originMethod:"getTransactions",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _121 => _121.offset]),limit:_optionalChain([r, 'optionalAccess', _122 => _122.limit])}})}async function Ji(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return yi({aptosConfig:e,originMethod:"getResources",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _123 => _123.ledgerVersion]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _124 => _124.limit]), () => (999))}})}async function Qs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await pr({aptosConfig:e,originMethod:"getResourcesPage",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _125 => _125.ledgerVersion]),cursor:_optionalChain([r, 'optionalAccess', _126 => _126.cursor]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _127 => _127.limit]), () => (100))}});return{resources:i.data,cursor:o}}async function Xi(n){let{aptosConfig:e,accountAddress:t,resourceType:r,options:i}=n,{data:o}=await V({aptosConfig:e,originMethod:"getResource",path:`accounts/${_chunkAWFAHZSBjs.r.from(t).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _128 => _128.ledgerVersion])}});return o.data}async function Mn(n){let{aptosConfig:e,authenticationKey:t,options:r}=n,i=await Xi({aptosConfig:e,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=_chunkAWFAHZSBjs.r.from(t);try{let a=await kr({aptosConfig:e,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return _chunkAWFAHZSBjs.r.from(a)}catch(a){if(a instanceof Se&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Js(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()},amount:{_gt:0}},s=await w({aptosConfig:e,query:{query:cs,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 Xs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _129 => _129.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _130 => _130.tokenStandard])});let s={query:ss,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _131 => _131.offset]),limit:_optionalChain([r, 'optionalAccess', _132 => _132.limit]),order_by:_optionalChain([r, 'optionalAccess', _133 => _133.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ys(n){let{aptosConfig:e,accountAddress:t,collectionAddress:r,options:i}=n,o=_chunkAWFAHZSBjs.r.from(t).toStringLong(),s=_chunkAWFAHZSBjs.r.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _134 => _134.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _135 => _135.tokenStandard])});let c={query:as,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _136 => _136.offset]),limit:_optionalChain([i, 'optionalAccess', _137 => _137.limit]),order_by:_optionalChain([i, 'optionalAccess', _138 => _138.orderBy])}};return(await w({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Zs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}};_optionalChain([r, 'optionalAccess', _139 => _139.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _140 => _140.tokenStandard])}});let s={query:os,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _141 => _141.offset]),limit:_optionalChain([r, 'optionalAccess', _142 => _142.limit]),order_by:_optionalChain([r, 'optionalAccess', _143 => _143.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ea(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkAWFAHZSBjs.r.from(t).toStringLong(),o=await w({aptosConfig:e,query:{query:us,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ta(n){let{aptosConfig:e,accountAddress:t,options:r}=n,i=_chunkAWFAHZSBjs.r.from(t).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _144 => _144.where]),owner_address:{_eq:i}},s={query:is,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _145 => _145.offset]),limit:_optionalChain([r, 'optionalAccess', _146 => _146.limit]),order_by:_optionalChain([r, 'optionalAccess', _147 => _147.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function na(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunkAWFAHZSBjs.r.from(t).toStringLong(),o=await w({aptosConfig:e,query:{query:rs,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 ra(n){let{aptosConfig:e,accountAddress:t,asset:r}=n,i=await V({aptosConfig:e,originMethod:"getBalance",path:`accounts/${t}/balance/${r}`,params:{accountAddress:t.toString(),asset:r instanceof Uint8Array?_chunkAWFAHZSBjs.r.from(r).toString():r.toString()}});return parseInt(i.data.toString(),10)}async function Yi(n){let{aptosConfig:e,accountAddress:t,options:r}=n,o={owner_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}},s={query:Cr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _148 => _148.offset]),limit:_optionalChain([r, 'optionalAccess', _149 => _149.limit]),order_by:_optionalChain([r, 'optionalAccess', _150 => _150.orderBy])}};return(await w({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function ia(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _151 => _151.throwIfNoAccountFound]), () => (!1)),o=await $r({aptosConfig:e,privateKey:t});if(o.length===0){if(i)throw new Error("No existing account found for private key.");return dt.fromPrivateKey({privateKey:t})}return o[0]}async function fp(n){let{aptosConfig:e,accountAddress:t,options:r}=n;try{let[i,o]=await Promise.all([Ji({aptosConfig:e,accountAddress:t}),Yi({aptosConfig:e,accountAddress:t,options:{limit:1}})]),s=i.find(c=>c.type==="0x1::account::Account");if(!s&&o.length===0)return!1;if(!_optionalChain([r, 'optionalAccess', _152 => _152.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 Ap={typeParameters:[],parameters:[new ue,U.u8(),new ue,U.u8(),U.u8(),U.u8()]};async function oa(n){let{aptosConfig:e,fromAccount:t,options:r}=n;if("toNewPrivateKey"in n)return ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toNewPrivateKey,options:r});if("toAccount"in n)return n.toAccount instanceof ie?ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toAccount.privateKey,options:r}):ji({aptosConfig:e,fromAccount:t,toAccount:n.toAccount,options:r});throw new Error("Invalid arguments")}async function ji(n){let{aptosConfig:e,fromAccount:t,options:r}=n,i=await mn({aptosConfig:e,accountAddress:t.accountAddress}),o;"toNewPrivateKey"in n?o=dt.fromPrivateKey({privateKey:n.toNewPrivateKey,legacy:!0}):o=n.toAccount;let a=new Tr({sequenceNumber:BigInt(i.sequence_number),originator:t.accountAddress,currentAuthKey:_chunkAWFAHZSBjs.r.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=t.sign(a),p=o.sign(a);return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new Y(t.signingScheme),S.U8(t.publicKey.toUint8Array()),new Y(o.signingScheme),S.U8(o.publicKey.toUint8Array()),S.U8(c.toUint8Array()),S.U8(p.toUint8Array())],abi:Ap},options:r})}var hp={typeParameters:[],parameters:[new ue,U.u8()]};async function sa(n){let{aptosConfig:e,fromAccount:t,toNewPublicKey:r,options:i}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key_from_public_key",functionArguments:[new Y(Qo(r)),S.U8(Ei(r).toUint8Array())],abi:hp},options:i})}async function Wr(n){let{aptosConfig:e,publicKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.noMultiKey]), () => (!1));if(i&&t instanceof De)throw new Error("Multi-key accounts are not supported when noMultiKey is true.");let o=[t];t instanceof x&&t.publicKey instanceof P?o.push(t.publicKey):t instanceof P&&o.push(new x(t));let[s,a]=await Promise.all([Promise.all(o.map(async A=>{let l=await _p({aptosConfig:e,publicKey:A});if(l)return{...l,publicKey:A}})),!(t instanceof De)&&!i?Tp({aptosConfig:e,publicKey:t,options:r}):Promise.resolve([])]),c=[];for(let A of s)A&&c.push(A);o.push(...a);let p=new Map(o.map(A=>[A.authKey().toString(),A])),g=await wp({aptosConfig:e,authKeys:o.map(A=>A.authKey()),options:r});for(let A of g){if(c.find(d=>d.accountAddress===A.accountAddress))continue;let l=p.get(A.authKey.toString());if(!l)throw new Error(`No publicKey found for authentication key ${A.authKey}. This should never happen.`);c.push({accountAddress:A.accountAddress,publicKey:l,lastTransactionVersion:A.lastTransactionVersion})}return c.sort((A,l)=>l.lastTransactionVersion-A.lastTransactionVersion)}async function Zi(n){let{aptosConfig:e,signer:t,options:r}=n;if(t instanceof J||t instanceof tt)return $r({aptosConfig:e,privateKey:t,options:r});if(t instanceof ie||t instanceof pe)return $r({aptosConfig:e,privateKey:t.privateKey,options:r});if(t instanceof Ie||t instanceof Me)return bp({aptosConfig:e,keylessAccount:t,options:r});if(t instanceof lt&&t.signers.length===1)return Zi({aptosConfig:e,signer:t.signers[0],options:r});if(t instanceof zn&&t.signers.length===1)return $r({aptosConfig:e,privateKey:t.signers[0],options:r});throw new Error("Unknown signer type")}async function bp(n){let{aptosConfig:e,keylessAccount:t,options:r}=n,i=await Wr({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 De){if(c.getSignaturesRequired()>1)continue;if(c instanceof re)throw new Error("Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.");c instanceof W&&s.push(new lt({multiKey:c,signers:[t],address:a}))}else t instanceof Me?s.push(Me.create({...o,address:a,jwkAddress:t.publicKey.jwkAddress})):s.push(Ie.create({...o,address:a}));return s}async function $r(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=dt.fromPrivateKey({privateKey:t,legacy:!1}),o=await Wr({aptosConfig:e,publicKey:new x(t.publicKey()),options:r}),s=[];for(let{accountAddress:a,publicKey:c}of o)if(c instanceof De){if(c.getSignaturesRequired()>1)continue;c instanceof re?s.push(new zn({publicKey:c,signers:[t],address:a})):c instanceof W&&s.push(new lt({multiKey:c,signers:[i],address:a}))}else{let p=c instanceof P;s.push(dt.fromPrivateKey({privateKey:t,address:a,legacy:p}))}return s}async function Tp(n){let{aptosConfig:e,publicKey:t,options:r}=n;if(t instanceof De)throw new Error("Public key is a multi-key.");let i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _154 => _154.includeUnverified]), () => (!1)),o=t instanceof x?t:new x(t),s=o.publicKey,a=ho(o.variant),c={public_key:{_eq:s.toString()},public_key_type:{_eq:a},...i?{}:{is_public_key_used:{_eq:!0}}},p={query:ps,variables:{where_condition:c}},{public_key_auth_keys:g}=await w({aptosConfig:e,query:p,originMethod:"getMultiKeysForPublicKey"});return g.map(l=>{switch(l.signature_type){case"multi_ed25519_signature":return re.deserializeWithoutLength(v.fromHex(l.account_public_key));case"multi_key_signature":return W.deserialize(v.fromHex(l.account_public_key));default:throw new Error(`Unknown multi-signature type: ${l.signature_type}`)}})}async function wp(n){let{aptosConfig:e,authKeys:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.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:ns,variables:{where_condition:o,order_by:[{last_transaction_version:"desc"}]}},{auth_key_account_addresses:a}=await w({aptosConfig:e,query:s,originMethod:"getAccountAddressesForAuthKeys"});return a.map(c=>({authKey:new H({data:c.auth_key}),accountAddress:new (0, _chunkAWFAHZSBjs.r)(_chunkAWFAHZSBjs.j.hexInputToUint8Array(c.account_address)),lastTransactionVersion:Number(c.last_transaction_version)}))}async function Sp(n){let{aptosConfig:e,accountAddress:t}=n,r=await Qi({aptosConfig:e,accountAddress:t,options:{limit:1}});return r.length===0?0:Number(r[0].version)}async function _p(n){let{aptosConfig:e,publicKey:t}=n,r=t.authKey().derivedAddress(),[i,o]=await Promise.all([Sp({aptosConfig:e,accountAddress:r}),fp({aptosConfig:e,accountAddress:r,options:{withAuthKey:t.authKey()}})]);if(o)return{accountAddress:r,lastTransactionVersion:i}}async function _(n){n.minimumLedgerVersion!==void 0&&await Dr({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}async function de(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Ms({...t,aptosConfig:e}),o=new _chunkAWFAHZSBjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await bt({aptosConfig:e,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _156 => _156.ledgerVersion])},body:s});return a}async function aa(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await bt({aptosConfig:e,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _157 => _157.ledgerVersion])},body:{function:t.function,type_arguments:_nullishCoalesce(t.typeArguments, () => ([])),arguments:_nullishCoalesce(t.functionArguments, () => ([]))}});return i}async function ca(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkAWFAHZSBjs.G.call(void 0, r);return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new G,new h(I()),new h(I())]}},options:i})}async function ua(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunkAWFAHZSBjs.G.call(void 0, r);return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new G,new h(I()),new h(I())]}},options:i})}async function pa(n){let{aptosConfig:e,sender:t,options:r}=n;return T({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var Ht=class{constructor(e){this.config=e;this.isAccountAbstractionEnabled=async e=>{let t=await this.getAuthenticationFunction(e),{moduleAddress:r,moduleName:i,functionName:o}=_chunkAWFAHZSBjs.G.call(void 0, e.authenticationFunction);return _nullishCoalesce(_optionalChain([t, 'optionalAccess', _158 => _158.some, 'call', _159 => _159(s=>_chunkAWFAHZSBjs.r.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 ca({aptosConfig:this.config,authenticationFunction:r,sender:t,options:i})}async removeAuthenticationFunctionTransaction(e){let{accountAddress:t,authenticationFunction:r,options:i}=e;return ua({aptosConfig:this.config,sender:t,authenticationFunction:r,options:i})}async removeDispatchableAuthenticatorTransaction(e){let{accountAddress:t,options:r}=e;return pa({aptosConfig:this.config,sender:t,options:r})}async getAuthenticationFunction(e){let{accountAddress:t}=e,[{vec:r}]=await de({aptosConfig:this.config,payload:{function:"0x1::account_abstraction::dispatchable_authenticator",functionArguments:[_chunkAWFAHZSBjs.r.from(t)],abi:{typeParameters:[],parameters:[new G],returnTypes:[]}}});if(r.length!==0)return r[0].map(i=>({moduleAddress:_chunkAWFAHZSBjs.r.fromString(i.module_address),moduleName:i.module_name,functionName:i.function_name}))}};var Bn=class{constructor(e){this.config=e;this.abstraction=new Ht(e)}async getAccountInfo(e){return mn({aptosConfig:this.config,...e})}async getAccountModules(e){return Ws({aptosConfig:this.config,...e})}async getAccountModulesPage(e){return js({aptosConfig:this.config,...e})}async getAccountModule(e){return Br({aptosConfig:this.config,...e})}async getAccountTransactions(e){return Qi({aptosConfig:this.config,...e})}async getAccountResources(e){return Ji({aptosConfig:this.config,...e})}async getAccountResourcesPage(e){return Qs({aptosConfig:this.config,...e})}async getAccountResource(e){return Xi({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Mn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Js({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Xs({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ys({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zs({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),ea({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ta({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),na({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Lt,faMetadataAddress:ko,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i}=e,o=r;r===void 0&&i!==void 0&&(o=await Le(async()=>{try{let c=(await de({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}}))[0];if(c.vec.length>0&&_chunkAWFAHZSBjs.F.call(void 0, c.vec[0]))return _chunkAWFAHZSBjs.E.call(void 0, c.vec[0])}catch (e6){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let s;if(r!==void 0&&i!==void 0)s=_chunkAWFAHZSBjs.r.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===Lt?s=_chunkAWFAHZSBjs.r.A.toStringLong():s=_chunkAWFAHZSBjs.s.call(void 0, _chunkAWFAHZSBjs.r.A,r).toStringLong();else if(r===void 0&&i!==void 0){let c=_chunkAWFAHZSBjs.r.from(i);s=c.toStringLong(),c===_chunkAWFAHZSBjs.r.A&&(o=Lt)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(o!==void 0){let[c]=await de({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[o],functionArguments:[t]}});return parseInt(c,10)}let[a]=await de({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,s]}});return parseInt(a,10)}async getBalance(e){return ra({aptosConfig:this.config,...e})}async getAccountOwnedObjects(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Yi({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),ia({aptosConfig:this.config,...e})}async deriveOwnedAccountsFromSigner(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),Zi({aptosConfig:this.config,...e})}async getAccountsForPublicKey(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),Wr({aptosConfig:this.config,...e})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var jr=class{constructor(e){if(_optionalChain([e, 'optionalAccess', _160 => _160.fullnode])||_optionalChain([e, 'optionalAccess', _161 => _161.indexer])||_optionalChain([e, 'optionalAccess', _162 => _162.faucet])||_optionalChain([e, 'optionalAccess', _163 => _163.pepper])||_optionalChain([e, 'optionalAccess', _164 => _164.prover])){if(_optionalChain([e, 'optionalAccess', _165 => _165.network])==="custom")console.info("Note: using CUSTOM network will require queries to lookup ChainId");else if(!_optionalChain([e, 'optionalAccess', _166 => _166.network]))throw new Error("Custom endpoints require a network to be specified")}this.network=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _167 => _167.network]), () => ("devnet")),this.fullnode=_optionalChain([e, 'optionalAccess', _168 => _168.fullnode]),this.faucet=_optionalChain([e, 'optionalAccess', _169 => _169.faucet]),this.pepper=_optionalChain([e, 'optionalAccess', _170 => _170.pepper]),this.prover=_optionalChain([e, 'optionalAccess', _171 => _171.prover]),this.indexer=_optionalChain([e, 'optionalAccess', _172 => _172.indexer]),this.client=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _173 => _173.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _174 => _174.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _175 => _175.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _176 => _176.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _177 => _177.faucetConfig]), () => ({})),this.transactionGenerationConfig=_nullishCoalesce(_optionalChain([e, 'optionalAccess', _178 => _178.transactionGenerationConfig]), () => ({})),this.pluginConfig=_optionalChain([e, 'optionalAccess', _179 => _179.pluginSettings])?{...e.pluginSettings,IGNORE_TRANSACTION_SUBMITTER:!1}:void 0}getRequestUrl(e){switch(e){case"Fullnode":if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return vo[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="testnet")throw new Error("There is no way to programmatically mint testnet APT, you must use the minting site at https://aptos.dev/network/faucet");if(this.network==="mainnet")throw new Error("There is no mainnet faucet");if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ko[this.network];case"Indexer":if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Co[this.network];case"Pepper":if(this.pepper!==void 0)return this.pepper;if(this.network==="custom")throw new Error("Please provide a custom pepper service url");return ui[this.network];case"Prover":if(this.prover!==void 0)return this.prover;if(this.network==="custom")throw new Error("Please provide a custom prover service url");return pi[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return ui[this.network]===e}isProverServiceRequest(e){return pi[this.network]===e}getDefaultMaxGasAmount(){return _nullishCoalesce(_optionalChain([this, 'access', _180 => _180.transactionGenerationConfig, 'optionalAccess', _181 => _181.defaultMaxGasAmount]), () => (2e5))}getDefaultTxnExpirySecFromNow(){return _nullishCoalesce(_optionalChain([this, 'access', _182 => _182.transactionGenerationConfig, 'optionalAccess', _183 => _183.defaultTxnExpirySecFromNow]), () => (20))}setIgnoreTransactionSubmitter(e){this.pluginConfig&&(this.pluginConfig.IGNORE_TRANSACTION_SUBMITTER=e)}getTransactionSubmitter(){if(this.pluginConfig!==void 0&&this.pluginConfig.IGNORE_TRANSACTION_SUBMITTER!==!0)return this.pluginConfig.TRANSACTION_SUBMITTER}};var Ep={typeParameters:[{constraints:[]}],parameters:[new G,new ee]};async function da(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return T({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Lt))],functionArguments:[r,i],abi:Ep},options:s})}var Hn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return da({aptosConfig:this.config,...e})}};var Pt={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},Ce="0x4::token::Token";async function la(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}};return(await w({aptosConfig:e,query:{query:Ts,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ga(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()},amount:{_gt:0}};return(await w({aptosConfig:e,query:{query:Ri,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ya(n){let{aptosConfig:e,ownerAddress:t,options:r}=n,i={owner_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()},amount:{_gt:0}},o={query:Ri,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _184 => _184.offset]),limit:_optionalChain([r, 'optionalAccess', _185 => _185.limit]),order_by:_optionalChain([r, 'optionalAccess', _186 => _186.orderBy])}};return(await w({aptosConfig:e,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function ma(n){let{aptosConfig:e,digitalAssetAddress:t,options:r}=n,i={token_data_id:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}},o={query:bs,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _187 => _187.offset]),limit:_optionalChain([r, 'optionalAccess', _188 => _188.limit]),order_by:_optionalChain([r, 'optionalAccess', _189 => _189.orderBy])}};return(await w({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var xp={typeParameters:[],parameters:[new h(I()),new ee,new h(I()),new h(I()),new j,new j,new j,new j,new j,new j,new j,new j,new j,new ee,new ee]};async function fa(n){let{aptosConfig:e,options:t,creator:r}=n;return T({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new C(n.description),new $(_nullishCoalesce(n.maxSupply, () => (_chunkAWFAHZSBjs.e))),new C(n.name),new C(n.uri),new D(_nullishCoalesce(n.mutableDescription, () => (!0))),new D(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new D(_nullishCoalesce(n.mutableURI, () => (!0))),new D(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new D(_nullishCoalesce(n.mutableTokenName, () => (!0))),new D(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new D(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new D(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new D(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new $(_nullishCoalesce(n.royaltyNumerator, () => (0))),new $(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:xp},options:t})}async function fn(n){let{aptosConfig:e,options:t}=n,r=_optionalChain([t, 'optionalAccess', _190 => _190.where]);_optionalChain([t, 'optionalAccess', _191 => _191.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([t, 'optionalAccess', _192 => _192.tokenStandard]), () => ("v2"))});let i={query:ls,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _193 => _193.offset]),limit:_optionalChain([t, 'optionalAccess', _194 => _194.limit])}};return(await w({aptosConfig:e,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function Aa(n){let{aptosConfig:e,creatorAddress:t,collectionName:r,options:i}=n,o=_chunkAWFAHZSBjs.r.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _195 => _195.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _196 => _196.tokenStandard]), () => ("v2"))}),fn({aptosConfig:e,options:{...i,where:s}})}async function ha(n){let{aptosConfig:e,creatorAddress:t,options:r}=n,o={creator_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _197 => _197.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _198 => _198.tokenStandard]), () => ("v2"))}),fn({aptosConfig:e,options:{...r,where:o}})}async function ba(n){let{aptosConfig:e,collectionId:t,options:r}=n,o={collection_id:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}};return _optionalChain([r, 'optionalAccess', _199 => _199.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _200 => _200.tokenStandard]), () => ("v2"))}),fn({aptosConfig:e,options:{...r,where:o}})}async function Ta(n){let{creatorAddress:e,collectionName:t,options:r,aptosConfig:i}=n,o=_chunkAWFAHZSBjs.r.from(e),s={collection_name:{_eq:t},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _201 => _201.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _202 => _202.tokenStandard]), () => ("v2"))}),(await fn({aptosConfig:i,options:{where:s}})).collection_id}var Ip={typeParameters:[],parameters:[new h(I()),new h(I()),new h(I()),new h(I()),new U(new h(I())),new U(new h(I())),new U(U.u8())]};async function wa(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:g}=n,A=_optionalChain([p, 'optionalAccess', _203 => _203.map, 'call', _204 => _204(l=>Pt[l])]);return T({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new C(i),new C(o),new C(s),new C(a),S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(A, () => ([]))),za(_nullishCoalesce(g, () => ([])),_nullishCoalesce(A, () => ([])))],abi:Ip},options:t})}var Cp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new G]};async function Sa(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(r),_chunkAWFAHZSBjs.r.from(i)],abi:Cp},options:s})}var vp={typeParameters:[],parameters:[new h(I()),new h(I()),new h(I()),new h(I()),new U(new h(I())),new U(new h(I())),new U(U.u8()),new G]};async function _a(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:g,options:A}=n;if(_optionalChain([c, 'optionalAccess', _205 => _205.length])!==_optionalChain([g, 'optionalAccess', _206 => _206.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _207 => _207.length])!==_optionalChain([g, 'optionalAccess', _208 => _208.length]))throw new Error("Property types and property values counts do not match");let l=_optionalChain([p, 'optionalAccess', _209 => _209.map, 'call', _210 => _210(d=>Pt[d])]);return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,S.MoveString(_nullishCoalesce(c, () => ([]))),S.MoveString(_nullishCoalesce(l, () => ([]))),za(_nullishCoalesce(g, () => ([])),_nullishCoalesce(l, () => ([]))),a],abi:vp},options:A})}var Kp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0)))]};async function Pa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(r)],abi:Kp},options:o})}var Rp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0)))]};async function Ea(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Ce))],functionArguments:[r],abi:Rp},options:o})}var Up={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0)))]};async function xa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Ce))],functionArguments:[r],abi:Up},options:o})}var kp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new h(I())]};async function Ia(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(i),new C(r)],abi:kp},options:s})}var Np={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new h(I())]};async function Ca(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(i),new C(r)],abi:Np},options:s})}var zp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new h(I())]};async function va(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(i),new C(r)],abi:zp},options:s})}var Dp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new h(I()),new h(I()),U.u8()]};async function Ka(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(s),new C(r),new C(Pt[i]),S.U8(eo(o,Pt[i]))],abi:Dp},options:c})}var Fp={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new h(I())]};async function Ra(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(i),new C(r)],abi:Fp},options:s})}var Op={typeParameters:[{constraints:["key"]}],parameters:[new h(he(new B(0))),new h(I()),new h(I()),U.u8()]};async function Ua(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (Ce))],functionArguments:[_chunkAWFAHZSBjs.r.from(s),new C(r),new C(Pt[i]),eo(o,Pt[i])],abi:Op},options:c})}var Gp={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new h(he(new B(0))),new h(I()),new B(1)]};async function ka(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (Ce)),Pt[i]],functionArguments:[_chunkAWFAHZSBjs.r.from(s),new C(r),o],abi:Gp},options:c})}var Mp={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new h(he(new B(0))),new h(I()),new B(1)]};async function Na(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (Ce)),Pt[i]],functionArguments:[_chunkAWFAHZSBjs.r.from(s),new C(r),o],abi:Mp},options:c})}function za(n,e){let t=new Array;return e.forEach((r,i)=>{t.push(eo(n[i],r))}),t}function eo(n,e){let t=Be(e);return Bt(n,t,0,[]).bcsToBytes()}var Vn=class{constructor(e){this.config=e}async getCollectionData(e){await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:t,collectionName:r,options:i}=e,o=_chunkAWFAHZSBjs.r.from(t),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _211 => _211.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _212 => _212.tokenStandard]), () => ("v2"))}),fn({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Aa({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ha({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ba({aptosConfig:this.config,...e})}async getCollectionId(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ta({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),la({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ga({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ya({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ma({aptosConfig:this.config,...e})}async createCollectionTransaction(e){return fa({aptosConfig:this.config,...e})}async mintDigitalAssetTransaction(e){return wa({aptosConfig:this.config,...e})}async transferDigitalAssetTransaction(e){return Sa({aptosConfig:this.config,...e})}async mintSoulBoundTransaction(e){return _a({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return Pa({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return Ea({aptosConfig:this.config,...e})}async unfreezeDigitalAssetTransaferTransaction(e){return xa({aptosConfig:this.config,...e})}async setDigitalAssetDescriptionTransaction(e){return Ia({aptosConfig:this.config,...e})}async setDigitalAssetNameTransaction(e){return Ca({aptosConfig:this.config,...e})}async setDigitalAssetURITransaction(e){return va({aptosConfig:this.config,...e})}async addDigitalAssetPropertyTransaction(e){return Ka({aptosConfig:this.config,...e})}async removeDigitalAssetPropertyTransaction(e){return Ra({aptosConfig:this.config,...e})}async updateDigitalAssetPropertyTransaction(e){return Ua({aptosConfig:this.config,...e})}async addDigitalAssetTypedPropertyTransaction(e){return ka({aptosConfig:this.config,...e})}async updateDigitalAssetTypedPropertyTransaction(e){return Na({aptosConfig:this.config,...e})}};async function Da(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _213 => _213.timeoutSecs])||20,{data:s}=await Bo({aptosConfig:e,path:"fund",body:{address:_chunkAWFAHZSBjs.r.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await gn({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _214 => _214.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var Ln=class{constructor(e){this.config=e}async fundAccount(e){let t=await Da({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _215 => _215.options, 'optionalAccess', _216 => _216.waitForIndexer])===void 0||_optionalChain([e, 'access', _217 => _217.options, 'optionalAccess', _218 => _218.waitForIndexer]))&&await Dr({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function Qr(n){let{aptosConfig:e,options:t}=n,r={query:fs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _219 => _219.where]),limit:_optionalChain([t, 'optionalAccess', _220 => _220.limit]),offset:_optionalChain([t, 'optionalAccess', _221 => _221.offset])}};return(await w({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Fa(n){let{aptosConfig:e,options:t}=n,r={query:ms,variables:{where_condition:_optionalChain([t, 'optionalAccess', _222 => _222.where]),limit:_optionalChain([t, 'optionalAccess', _223 => _223.limit]),offset:_optionalChain([t, 'optionalAccess', _224 => _224.offset])}};return(await w({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Oa(n){let{aptosConfig:e,options:t}=n,r={query:gs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _225 => _225.where]),limit:_optionalChain([t, 'optionalAccess', _226 => _226.limit]),offset:_optionalChain([t, 'optionalAccess', _227 => _227.offset])}};return(await w({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Ga={typeParameters:[{constraints:[]}],parameters:[Be("0x1::object::Object"),new G,new ee]};async function Ma(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Ga},options:s})}async function Ba(n){let{aptosConfig:e,sender:t,fromStore:r,toStore:i,amount:o,options:s}=n;return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::dispatchable_fungible_asset::transfer",typeArguments:["0x1::fungible_asset::FungibleStore"],functionArguments:[r,i,o],abi:Ga},options:s})}var qn=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _228 => _228.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Qr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _229 => _229.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await Qr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _230 => _230.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await Qr({aptosConfig:this.config,options:{where:{creator_address:{_eq:_chunkAWFAHZSBjs.r.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _231 => _231.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Fa({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _232 => _232.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Oa({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return Ma({aptosConfig:this.config,...e})}async transferFungibleAssetBetweenStores(e){return Ba({aptosConfig:this.config,...e})}};var $n=class{constructor(e){this.config=e}async getLedgerInfo(){return vr({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Cs({aptosConfig:this.config,...e})}async getBlockByHeight(e){return vs({aptosConfig:this.config,...e})}async view(e){return de({aptosConfig:this.config,...e})}async viewJson(e){return aa({aptosConfig:this.config,...e})}async getChainTopUserTransactions(e){return ws({aptosConfig:this.config,...e})}async queryIndexer(e){return w({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Kr({aptosConfig:this.config})}async getProcessorStatus(e){return Rr({aptosConfig:this.config,processorType:e})}};var Ha=["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 Va(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Et(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(!Va(e))throw new Error(`${e} is not valid. ${Ha}`);if(t&&!Va(t))throw new Error(`${t} is not valid. ${Ha}`);return{domainName:t||e,subdomainName:t?e:void 0}}function La(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 Bp="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Hp={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Bp,custom:null,devnet:null,shelbynet:null};function yt(n){let e=Hp[n.network];if(!e)throw new Error(`The ANS contract is not deployed to ${n.network}`);return e}var Jr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function qa(n){let{aptosConfig:e,name:t}=n,r=yt(e),{domainName:i,subdomainName:o}=Et(t),s=await de({aptosConfig:e,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=Jr(s[0]);return a?_chunkAWFAHZSBjs.r.from(a):void 0}async function $a(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=yt(e),{domainName:g,subdomainName:A}=Et(r),l=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(A&&!l)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(l&&!A)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let q=_nullishCoalesce(t.years, () => (1));if(q!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Je=q*31536e3;return await T({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[g,Je,o,s]},options:a})}if(!A)throw new Error(`${t.policy} requires a subdomain to be provided.`);let d=await to({aptosConfig:e,name:g});if(!d)throw new Error("The domain does not exist");let b=t.policy==="subdomain:independent"?t.expirationDate:d;if(b>d)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await T({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[g,A,Math.round(b/1e3),t.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function to(n){let{aptosConfig:e,name:t}=n,r=yt(e),{domainName:i,subdomainName:o}=Et(t);try{let s=await de({aptosConfig:e,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e7){return}}async function Wa(n){let{aptosConfig:e,address:t}=n,r=yt(e),i=await de({aptosConfig:e,payload:{function:`${r}::router::get_primary_name`,functionArguments:[_chunkAWFAHZSBjs.r.from(t).toString()]}}),o=Jr(i[1]),s=Jr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function ja(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=yt(e);if(!r)return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Et(r);return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Qa(n){let{aptosConfig:e,name:t}=n,r=yt(e),{domainName:i,subdomainName:o}=Et(t),s=await de({aptosConfig:e,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=Jr(s[0]);return a?_chunkAWFAHZSBjs.r.from(a):void 0}async function Ja(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=yt(e),{domainName:a,subdomainName:c}=Et(r);return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Xa(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=Et(t),a=(await w({aptosConfig:e,query:{query:ln,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Wn(a)),La(a)?a:void 0}async function Ya(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await no({aptosConfig:e});return(await w({aptosConfig:e,originMethod:"getAccountNames",query:{query:ln,variables:{limit:_optionalChain([t, 'optionalAccess', _233 => _233.limit]),offset:_optionalChain([t, 'optionalAccess', _234 => _234.offset]),order_by:_optionalChain([t, 'optionalAccess', _235 => _235.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _236 => _236.options, 'optionalAccess', _237 => _237.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Wn)}async function Za(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await no({aptosConfig:e});return(await w({aptosConfig:e,originMethod:"getAccountDomains",query:{query:ln,variables:{limit:_optionalChain([t, 'optionalAccess', _238 => _238.limit]),offset:_optionalChain([t, 'optionalAccess', _239 => _239.offset]),order_by:_optionalChain([t, 'optionalAccess', _240 => _240.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _241 => _241.options, 'optionalAccess', _242 => _242.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Wn)}async function ec(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await no({aptosConfig:e});return(await w({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:ln,variables:{limit:_optionalChain([t, 'optionalAccess', _243 => _243.limit]),offset:_optionalChain([t, 'optionalAccess', _244 => _244.offset]),order_by:_optionalChain([t, 'optionalAccess', _245 => _245.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _246 => _246.options, 'optionalAccess', _247 => _247.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Wn)}async function tc(n){let{aptosConfig:e,options:t,domain:r}=n;return(await w({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:ln,variables:{limit:_optionalChain([t, 'optionalAccess', _248 => _248.limit]),offset:_optionalChain([t, 'optionalAccess', _249 => _249.offset]),order_by:_optionalChain([t, 'optionalAccess', _250 => _250.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _251 => _251.options, 'optionalAccess', _252 => _252.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Wn).filter(La)}async function no(n){let{aptosConfig:e}=n,t=yt(e),[r]=await de({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 nc(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=yt(e),a=i*31536e3,{domainName:c,subdomainName:p}=Et(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await T({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Wn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var jn=class{constructor(e){this.config=e}async getOwnerAddress(e){return qa({aptosConfig:this.config,...e})}async getExpiration(e){return to({aptosConfig:this.config,...e})}async getTargetAddress(e){return Qa({aptosConfig:this.config,...e})}async setTargetAddress(e){return Ja({aptosConfig:this.config,...e})}async getPrimaryName(e){return Wa({aptosConfig:this.config,...e})}async setPrimaryName(e){return ja({aptosConfig:this.config,...e})}async registerName(e){return $a({aptosConfig:this.config,...e})}async renewDomain(e){return nc({aptosConfig:this.config,...e})}async getName(e){return Xa({aptosConfig:this.config,...e})}async getAccountNames(e){return Ya({aptosConfig:this.config,...e})}async getAccountDomains(e){return Za({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return ec({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return tc({aptosConfig:this.config,...e})}};async function rc(n){let{aptosConfig:e,poolAddress:t}=n,r=_chunkAWFAHZSBjs.r.from(t).toStringLong(),o=await w({aptosConfig:e,query:{query:vi,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 ic(n){let{aptosConfig:e,options:t}=n,r={query:vi,variables:{order_by:_optionalChain([t, 'optionalAccess', _253 => _253.orderBy])}};return(await w({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function oc(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:ys,variables:{delegatorAddress:_chunkAWFAHZSBjs.r.from(t).toStringLong(),poolAddress:_chunkAWFAHZSBjs.r.from(r).toStringLong()}};return(await w({aptosConfig:e,query:i})).delegated_staking_activities}var Qn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _254 => _254.minimumLedgerVersion]),processorType:"stake_processor"}),rc({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _255 => _255.minimumLedgerVersion]),processorType:"stake_processor"}),ic({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await _({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _256 => _256.minimumLedgerVersion]),processorType:"stake_processor"}),oc({aptosConfig:this.config,...e})}};var Xr=class{constructor(e){this.config=e}async simple(e){return T({aptosConfig:this.config,...e})}async multiAgent(e){return T({aptosConfig:this.config,...e})}};function ro(n,e){if(!(n.getTransactionSubmitter()!==void 0||e.transactionSubmitter!==void 0)&&e.transaction.feePayerAddress&&!e.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator")}function io(n,e,t){let r=t.value;return t.value=async function(...i){return r.apply(this,i)},t}var An=class{constructor(e){this.config=e}async simple(e){return Wi({aptosConfig:this.config,...e})}async multiAgent(e){return Wi({aptosConfig:this.config,...e})}};_chunkAWFAHZSBjs.a.call(void 0, [io],An.prototype,"simple",1),_chunkAWFAHZSBjs.a.call(void 0, [io],An.prototype,"multiAgent",1);var Yr=class{constructor(e){this.config=e}async simple(e){return ro(this.config,e),Gn({aptosConfig:this.config,...e})}async multiAgent(e){return ro(this.config,e),Gn({aptosConfig:this.config,...e})}};var Zr=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 _chunkAWFAHZSBjs.w.call(void 0, this.sleepTime);this.lock=!0;let e=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let t=_chunkAWFAHZSBjs.y.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkAWFAHZSBjs.w.call(void 0, this.sleepTime),_chunkAWFAHZSBjs.y.call(void 0, )-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 mn({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(e),this.lastUncommintedNumber=BigInt(e)}async update(){let{sequence_number:e}=await mn({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 _chunkAWFAHZSBjs.w.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let e=_chunkAWFAHZSBjs.y.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkAWFAHZSBjs.y.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, re-syncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkAWFAHZSBjs.w.call(void 0, this.sleepTime),await this.update())}catch(e){console.error("error in synchronizing this account sequence number with the one on chain",e)}finally{this.lock=!1}}}};var hn=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _257 => _257.pendingDequeue, 'access', _258 => _258.shift, 'call', _259 => _259(), 'optionalAccess', _260 => _260.resolve, 'call', _261 => _261(e)]);return}this.queue.push(e)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((e,t)=>{this.pendingDequeue.push({resolve:e,reject:t})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:e})=>{e(new bn("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},bn=class extends Error{};var sc="fulfilled",ac= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(ac||{}),ei= exports.TransactionWorker =class extends _eventemitter32.default{constructor(t,r,i=30,o=100,s=10){super();this.taskQueue=new hn;this.transactionsQueue=new hn;this.outstandingTransactions=new hn;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=r,this.started=!1,this.accountSequnceNumber=new Zr(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=qr({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof bn)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===sc?(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 bn)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(gn({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===sc?(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 T({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 ti=class extends _eventemitter32.default{constructor(e){super(),this.config=e}start(e){let{sender:t}=e;this.account=t,this.transactionWorker=new ei(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 Jn=class{constructor(e){this.config=e,this.build=new Xr(this.config),this.simulate=new An(this.config),this.submit=new Yr(this.config),this.batch=new ti(this.config)}async getTransactions(e){return ki({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return xs({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Fn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return Is({aptosConfig:this.config,...e})}async waitForTransaction(e){return gn({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return zr({aptosConfig:this.config})}getSigningMessage(e){return Ls(e)}async publishPackageTransaction(e){return $s({aptosConfig:this.config,...e})}async rotateAuthKey(e){return oa({aptosConfig:this.config,...e})}async rotateAuthKeyUnverified(e){return sa({aptosConfig:this.config,...e})}sign(e){return Vr({...e})}signAsFeePayer(e){return Lr({...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 qr({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return qs({aptosConfig:this.config,...e})}};var Xn=class{constructor(e){this.config=e}async getTableItem(e){return kr({aptosConfig:this.config,...e})}async getTableItemsData(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Ps({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Es({aptosConfig:this.config,...e})}};async function ni(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:_chunkAWFAHZSBjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Ho({aptosConfig:e,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return _chunkAWFAHZSBjs.j.fromHexInput(a.pepper).toUint8Array()}async function oo(n){let{aptosConfig:e,jwt:t,ephemeralKeyPair:r,pepper:i=await ni(n),uidKey:o="sub",maxExpHorizonSecs:s=(await Wt({aptosConfig:e})).maxExpHorizonSecs}=n;if(_chunkAWFAHZSBjs.j.fromHexInput(i).toUint8Array().length!==Ie.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Ie.PEPPER_LENGTH} bytes`);let a=_jwtdecode.jwtDecode.call(void 0, 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:_chunkAWFAHZSBjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:_chunkAWFAHZSBjs.j.fromHexInput(i).toStringWithoutPrefix(),uid_key:o},{data:p}=await Vo({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),g=p.proof,A=new Tt({a:g.a,b:g.b,c:g.c});return new ye({proof:new $t(A,0),trainingWheelsSignature:He.fromHex(p.training_wheels_signature),expHorizonSecs:s})}async function cc(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await ni(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await Wt({aptosConfig:e}),p=oo({...n,pepper:s,maxExpHorizonSecs:c}),g=o?p:await p;if(r!==void 0){let d=L.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),b=await Mn({aptosConfig:e,authenticationKey:d.authKey().derivedAddress()});return Me.create({...n,address:b,proof:g,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let A=K.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),l=await Mn({aptosConfig:e,authenticationKey:A.authKey().derivedAddress()});return Ie.create({...n,address:l,proof:g,pepper:s,proofFetchCallback:o,verificationKey:a})}async function uc(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(Fo.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 p;throw c instanceof Error?p=`${c.message}`:p=`error unknown - ${c}`,E.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${p}`})}let a=await s.json();return T({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,S.MoveString(a.keys.map(c=>c.kid)),S.MoveString(a.keys.map(c=>c.alg)),S.MoveString(a.keys.map(c=>c.e)),S.MoveString(a.keys.map(c=>c.n))]},options:i})}var Yn=class{constructor(e){this.config=e}async getPepper(e){return ni({aptosConfig:this.config,...e})}async getProof(e){return oo({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return cc({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return uc({aptosConfig:this.config,...e})}};async function $p(n){let{aptosConfig:e,options:t}=n,r={query:Cr,variables:{where_condition:_optionalChain([t, 'optionalAccess', _262 => _262.where]),offset:_optionalChain([t, 'optionalAccess', _263 => _263.offset]),limit:_optionalChain([t, 'optionalAccess', _264 => _264.limit]),order_by:_optionalChain([t, 'optionalAccess', _265 => _265.orderBy])}};return(await w({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function pc(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:_chunkAWFAHZSBjs.r.from(t).toStringLong()}};return(await $p({aptosConfig:e,options:{...r,where:o}}))[0]}var Zn=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await _({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),pc({aptosConfig:this.config,...e})}};var ne=class{constructor(e){Wp(),this.config=_nullishCoalesce(e, () => (new jr)),this.account=new Bn(this.config),this.abstraction=new Ht(this.config),this.ans=new jn(this.config),this.coin=new Hn(this.config),this.digitalAsset=new Vn(this.config),this.faucet=new Ln(this.config),this.fungibleAsset=new qn(this.config),this.general=new $n(this.config),this.staking=new Qn(this.config),this.transaction=new Jn(this.config),this.table=new Xn(this.config),this.keyless=new Yn(this.config),this.object=new Zn(this.config)}setIgnoreTransactionSubmitter(e){this.config.setIgnoreTransactionSubmitter(e)}};function le(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})})}var dc=!1;function Wp(){dc||(le(ne,Bn,"account"),le(ne,Ht,"abstraction"),le(ne,jn,"ans"),le(ne,Hn,"coin"),le(ne,Vn,"digitalAsset"),le(ne,Event,"event"),le(ne,Ln,"faucet"),le(ne,qn,"fungibleAsset"),le(ne,$n,"general"),le(ne,Qn,"staking"),le(ne,Jn,"transaction"),le(ne,Xn,"table"),le(ne,Yn,"keyless"),le(ne,Zn,"object"),dc=!0)}exports.ACCOUNT_ABSTRACTION_SIGNING_DATA_SALT = zo; exports.APTOS_BIP44_REGEX = Gc; exports.APTOS_COIN = Lt; exports.APTOS_FA = ko; exports.APTOS_HARDENED_REGEX = Oc; exports.AbstractKeylessAccount = be; exports.AbstractMultiKey = De; exports.AbstractPublicKey = rr; exports.AbstractSignature = Sn; exports.AbstractedAccount = xr; exports.Account = dt; exports.AccountAbstractionMessage = mr; exports.AccountAddress = _chunkAWFAHZSBjs.r; exports.AccountAuthenticator = Z; exports.AccountAuthenticatorAbstraction = Rt; exports.AccountAuthenticatorEd25519 = Oe; exports.AccountAuthenticatorMultiEd25519 = rt; exports.AccountAuthenticatorMultiKey = je; exports.AccountAuthenticatorNoAccountAuthenticator = en; exports.AccountAuthenticatorSingleKey = ce; exports.AccountAuthenticatorVariant = wc; exports.AccountPublicKey = se; exports.AccountSequenceNumber = Zr; exports.AccountUtils = Zo; exports.AddressInvalidReason = _chunkAWFAHZSBjs.q; exports.AnyPublicKey = x; exports.AnyPublicKeyVariant = _c; exports.AnySignature = O; exports.AnySignatureVariant = Pc; exports.Aptos = ne; exports.AptosApiError = Se; exports.AptosApiType = pu; exports.AptosConfig = jr; exports.AuthenticationKey = H; exports.Bool = D; exports.CKDPriv = _o; exports.ChainId = tn; exports.DEFAULT_MAX_GAS_AMOUNT = du; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = lu; exports.DEFAULT_TXN_TIMEOUT_SEC = Uo; exports.DerivableAbstractedAccount = ts; exports.DeriveScheme = Nc; exports.Deserializer = v; exports.EPK_HORIZON_SECS = wu; exports.Ed25519Account = ie; exports.Ed25519PrivateKey = J; exports.Ed25519PublicKey = P; exports.Ed25519Signature = R; exports.EntryFunction = ct; exports.EntryFunctionBytes = nr; exports.EphemeralCertificate = qt; exports.EphemeralCertificateVariant = Ic; exports.EphemeralKeyPair = Mt; exports.EphemeralPublicKey = ht; exports.EphemeralPublicKeyVariant = Ec; exports.EphemeralSignature = He; exports.EphemeralSignatureVariant = xc; exports.FIREBASE_AUTH_ISS_PATTERN = Fo; exports.FederatedKeylessAccount = Me; exports.FederatedKeylessPublicKey = L; exports.FeePayerRawTransaction = Dt; exports.FixedBytes = ve; exports.Groth16ProofAndStatement = hi; exports.Groth16VerificationKey = Ti; exports.Groth16Zkp = Tt; exports.HARDENED_OFFSET = To; exports.Hex = _chunkAWFAHZSBjs.j; exports.HexInvalidReason = _chunkAWFAHZSBjs.i; exports.Identifier = k; exports.KeyType = Mc; exports.KeylessAccount = Ie; exports.KeylessConfiguration = bi; exports.KeylessError = E; exports.KeylessErrorCategory = gu; exports.KeylessErrorResolutionTip = yu; exports.KeylessErrorType = sr; exports.KeylessPublicKey = K; exports.KeylessSignature = ae; exports.MAX_AUD_VAL_BYTES = fi; exports.MAX_COMMITED_EPK_BYTES = Iu; exports.MAX_EXTRA_FIELD_BYTES = Eu; exports.MAX_ISS_VAL_BYTES = Pu; exports.MAX_JWT_HEADER_B64_BYTES = xu; exports.MAX_UID_KEY_BYTES = Su; exports.MAX_UID_VAL_BYTES = _u; exports.MimeType = lc; exports.ModuleId = Kn; exports.MoveAbility = Rc; exports.MoveFunctionVisibility = Kc; exports.MoveJWK = wi; exports.MoveOption = te; exports.MoveString = C; exports.MoveVector = S; exports.MultiAgentRawTransaction = zt; exports.MultiAgentTransaction = Sr; exports.MultiEd25519Account = zn; exports.MultiEd25519PublicKey = re; exports.MultiEd25519Signature = Fe; exports.MultiKey = W; exports.MultiKeyAccount = lt; exports.MultiKeySignature = Pe; exports.MultiSig = Rn; exports.MultiSigTransactionPayload = Un; exports.Network = Ro; exports.NetworkToChainId = di; exports.NetworkToFaucetAPI = Ko; exports.NetworkToIndexerAPI = Co; exports.NetworkToNetworkName = _l; exports.NetworkToNodeAPI = vo; exports.NetworkToPepperAPI = ui; exports.NetworkToProverAPI = pi; exports.ParsingError = _chunkAWFAHZSBjs.h; exports.PrivateKey = we; exports.PrivateKeyVariants = Sc; exports.ProcessorType = Do; exports.PublicKey = Ye; exports.RAW_TRANSACTION_SALT = No; exports.RAW_TRANSACTION_WITH_DATA_SALT = li; exports.RawTransaction = xe; exports.RawTransactionWithData = br; exports.RoleType = Uc; exports.RotationProofChallenge = Tr; exports.Script = sn; exports.ScriptTransactionArgumentVariants = yc; exports.Secp256k1PrivateKey = tt; exports.Secp256k1PublicKey = ze; exports.Secp256k1Signature = nt; exports.Secp256r1PrivateKey = Wo; exports.Secp256r1PublicKey = Yt; exports.Secp256r1Signature = Pi; exports.Serializable = _chunkAWFAHZSBjs.l; exports.Serialized = wn; exports.Serializer = _chunkAWFAHZSBjs.m; exports.Signature = F; exports.SignedTransaction = pt; exports.SigningScheme = oi; exports.SigningSchemeInput = kc; exports.SimpleTransaction = wr; exports.SingleKeyAccount = pe; exports.StructTag = Qe; exports.TransactionAndProof = Pr; exports.TransactionAuthenticator = ut; exports.TransactionAuthenticatorEd25519 = Ft; exports.TransactionAuthenticatorFeePayer = Gt; exports.TransactionAuthenticatorMultiAgent = Ot; exports.TransactionAuthenticatorMultiEd25519 = un; exports.TransactionAuthenticatorSingleSender = _t; exports.TransactionAuthenticatorVariant = Tc; exports.TransactionExecutable = an; exports.TransactionExecutableEmpty = Nn; exports.TransactionExecutableEntryFunction = cn; exports.TransactionExecutableScript = kn; exports.TransactionExecutableVariants = Ac; exports.TransactionExtraConfig = hr; exports.TransactionExtraConfigV1 = Nt; exports.TransactionExtraConfigVariants = hc; exports.TransactionInnerPayload = Ar; exports.TransactionInnerPayloadV1 = kt; exports.TransactionInnerPayloadVariants = fc; exports.TransactionPayload = St; exports.TransactionPayloadEntryFunction = rn; exports.TransactionPayloadMultiSig = on; exports.TransactionPayloadScript = nn; exports.TransactionPayloadVariants = mc; exports.TransactionResponseType = vc; exports.TransactionVariants = bc; exports.TransactionWorker = ei; exports.TransactionWorkerEventsEnum = ac; exports.TypeTag = M; exports.TypeTagAddress = G; exports.TypeTagBool = j; exports.TypeTagGeneric = B; exports.TypeTagParserError = X; exports.TypeTagParserErrorType = Yu; exports.TypeTagReference = fr; exports.TypeTagSigner = Ut; exports.TypeTagStruct = h; exports.TypeTagU128 = st; exports.TypeTagU16 = it; exports.TypeTagU256 = at; exports.TypeTagU32 = ot; exports.TypeTagU64 = ee; exports.TypeTagU8 = ue; exports.TypeTagVariants = gc; exports.TypeTagVector = U; exports.U128 = Ue; exports.U16 = Ke; exports.U256 = Te; exports.U32 = Re; exports.U64 = $; exports.U8 = Y; exports.WebAuthnSignature = vn; exports.ZeroKnowledgeSig = ye; exports.ZkProof = $t; exports.ZkpVariant = Cc; exports.anyPublicKeyVariantToString = ho; exports.aptosCoinStructTag = Am; exports.aptosRequest = ar; exports.base64UrlDecode = _chunkAWFAHZSBjs.A; exports.base64UrlToBytes = _chunkAWFAHZSBjs.B; exports.bigIntToBytesLE = ci; exports.buildTransaction = qi; exports.bytesToBigIntLE = It; exports.checkOrConvertArgument = Bt; exports.convertAmountFromHumanReadableToOnChain = _chunkAWFAHZSBjs.C; exports.convertAmountFromOnChainToHumanReadable = _chunkAWFAHZSBjs.D; exports.convertArgument = Li; exports.convertNumber = Fr; exports.convertPayloadToInnerPayload = up; exports.createObjectAddress = _chunkAWFAHZSBjs.s; exports.createResourceAddress = _chunkAWFAHZSBjs.t; exports.createTokenAddress = _chunkAWFAHZSBjs.v; exports.createUserDerivedObjectAddress = _chunkAWFAHZSBjs.u; exports.deriveKey = si; exports.deriveTransactionType = _r; exports.deserializeFromScriptArgument = Fu; exports.deserializePublicKey = Vy; exports.deserializeSignature = Ly; exports.ensureBoolean = _chunkAWFAHZSBjs.n; exports.fetchEntryFunctionAbi = Os; exports.fetchFunctionAbi = Vi; exports.fetchJWK = _i; exports.fetchModuleAbi = np; exports.fetchMoveFunctionAbi = gb; exports.fetchViewFunctionAbi = Gs; exports.findFirstNonSignerArg = Fs; exports.floorToWholeHour = _chunkAWFAHZSBjs.z; exports.generateRawTransaction = cp; exports.generateSignedTransaction = $i; exports.generateSignedTransactionForSimulation = Bs; exports.generateSigningMessage = $e; exports.generateSigningMessageForSerializable = ff; exports.generateSigningMessageForTransaction = Ge; exports.generateTransactionPayload = Hr; exports.generateTransactionPayloadWithABI = op; exports.generateUserTransactionHash = Mb; exports.generateViewFunctionPayload = Ms; exports.generateViewFunctionPayloadWithABI = sp; exports.get = cr; exports.getAptosFullNode = V; exports.getAptosPepperService = zl; exports.getAuthenticatorForSimulation = yn; exports.getErrorMessage = _chunkAWFAHZSBjs.x; exports.getFunctionParts = _chunkAWFAHZSBjs.G; exports.getIssAudAndUidVal = et; exports.getKeylessConfig = Wt; exports.getKeylessJWKs = Ru; exports.getPageWithObfuscatedCursor = pr; exports.hashStrToField = Ve; exports.hashValues = Hs; exports.hexToAsciiString = _chunkAWFAHZSBjs.k; exports.isBcsAddress = Gr; exports.isBcsBool = Ni; exports.isBcsFixedBytes = ep; exports.isBcsString = zi; exports.isBcsU128 = Mi; exports.isBcsU16 = Fi; exports.isBcsU256 = Bi; exports.isBcsU32 = Oi; exports.isBcsU64 = Gi; exports.isBcsU8 = Di; exports.isBlockEpilogueTransactionResponse = Sd; exports.isBlockMetadataTransactionResponse = bd; exports.isBool = ks; exports.isCanonicalEd25519Signature = Du; exports.isEd25519Signature = _d; exports.isEmptyOption = Ns; exports.isEncodedEntryFunctionArgument = zs; exports.isEncodedStruct = _chunkAWFAHZSBjs.F; exports.isFeePayerSignature = xd; exports.isGenesisTransactionResponse = hd; exports.isKeylessSigner = Er; exports.isLargeNumber = Or; exports.isMultiAgentSignature = Ed; exports.isMultiEd25519Signature = Id; exports.isNumber = Zu; exports.isPendingTransactionResponse = fd; exports.isScriptDataInput = Ds; exports.isSecp256k1Signature = Pd; exports.isSingleKeySigner = Ii; exports.isSingleSenderSignature = Cd; exports.isStateCheckpointTransactionResponse = Td; exports.isString = gt; exports.isUserTransactionResponse = Ad; exports.isValidBIP44Path = wo; exports.isValidFunctionInfo = _chunkAWFAHZSBjs.H; exports.isValidHardenedPath = So; exports.isValidatorTransactionResponse = wd; exports.mnemonicToSeed = ir; exports.normalizeBundle = Oo; exports.nowInSeconds = _chunkAWFAHZSBjs.y; exports.objectStructTag = he; exports.optionStructTag = hm; exports.outOfRangeErrorMessage = _chunkAWFAHZSBjs.o; exports.padAndPackBytesWithLen = Pn; exports.paginateWithCursor = ur; exports.paginateWithObfuscatedCursor = yi; exports.pairedFaMetadataAddress = _chunkAWFAHZSBjs.J; exports.parseEncodedStruct = _chunkAWFAHZSBjs.E; exports.parseJwtHeader = ku; exports.parseTypeTag = Be; exports.poseidonHash = Ct; exports.post = En; exports.postAptosFaucet = Bo; exports.postAptosFullNode = bt; exports.postAptosIndexer = Mo; exports.postAptosPepperService = Ho; exports.postAptosProvingService = Vo; exports.promiseFulfilledStatus = sc; exports.request = Au; exports.sleep = _chunkAWFAHZSBjs.w; exports.splitPath = Po; exports.standardizeTypeTags = Mr; exports.stringStructTag = I; exports.throwTypeMismatch = N; exports.truncateAddress = _chunkAWFAHZSBjs.I; exports.validateNumberInRange = _chunkAWFAHZSBjs.p; exports.verifyKeylessSignature = Si; exports.verifyKeylessSignatureWithJwkAndConfig = dr;
482
482
  //# sourceMappingURL=index.js.map