@aptos-labs/ts-sdk 3.1.1 → 3.1.2

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 (199) hide show
  1. package/dist/common/chunk-6MMUUJHX.js.map +1 -1
  2. package/dist/common/cli/index.js.map +1 -1
  3. package/dist/common/index.js +2 -2
  4. package/dist/common/index.js.map +1 -1
  5. package/dist/esm/account/AbstractKeylessAccount.mjs +1 -1
  6. package/dist/esm/account/AbstractedAccount.mjs +1 -1
  7. package/dist/esm/account/Account.mjs +1 -1
  8. package/dist/esm/account/AccountUtils.mjs +1 -1
  9. package/dist/esm/account/DerivableAbstractedAccount.mjs +1 -1
  10. package/dist/esm/account/Ed25519Account.mjs +1 -1
  11. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  12. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  13. package/dist/esm/account/KeylessAccount.mjs +1 -1
  14. package/dist/esm/account/MultiEd25519Account.mjs +1 -1
  15. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  16. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  17. package/dist/esm/account/index.mjs +1 -1
  18. package/dist/esm/account/utils.mjs +1 -1
  19. package/dist/esm/api/account/abstraction.mjs +1 -1
  20. package/dist/esm/api/account.mjs +1 -1
  21. package/dist/esm/api/ans.mjs +1 -1
  22. package/dist/esm/api/aptos.mjs +1 -1
  23. package/dist/esm/api/coin.mjs +1 -1
  24. package/dist/esm/api/digitalAsset.mjs +1 -1
  25. package/dist/esm/api/event.mjs +1 -1
  26. package/dist/esm/api/faucet.mjs +1 -1
  27. package/dist/esm/api/fungibleAsset.mjs +1 -1
  28. package/dist/esm/api/general.mjs +1 -1
  29. package/dist/esm/api/index.mjs +1 -1
  30. package/dist/esm/api/keyless.mjs +1 -1
  31. package/dist/esm/api/object.mjs +1 -1
  32. package/dist/esm/api/staking.mjs +1 -1
  33. package/dist/esm/api/table.mjs +1 -1
  34. package/dist/esm/api/transaction.mjs +1 -1
  35. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  36. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  37. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  38. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  39. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  40. package/dist/esm/api/utils.mjs +1 -1
  41. package/dist/esm/bcs/deserializer.mjs +1 -1
  42. package/dist/esm/bcs/index.mjs +1 -1
  43. package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
  44. package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
  45. package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
  46. package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
  47. package/dist/esm/bcs/serializer.mjs +1 -1
  48. package/dist/esm/chunk-4R4AI5RT.mjs +2 -0
  49. package/dist/esm/{chunk-75NVN2CG.mjs.map → chunk-4R4AI5RT.mjs.map} +1 -1
  50. package/dist/esm/{chunk-Q4W3WJ2U.mjs → chunk-6MWXV62C.mjs} +2 -2
  51. package/dist/esm/{chunk-FGFLPH5K.mjs → chunk-6PKBXYG3.mjs} +2 -2
  52. package/dist/esm/{chunk-6WDVDEQZ.mjs → chunk-6Y6ZO7TS.mjs} +2 -2
  53. package/dist/esm/{chunk-JL6RR7ML.mjs → chunk-AQQEQB35.mjs} +2 -2
  54. package/dist/esm/{chunk-HNBVYE3N.mjs → chunk-BUUV6B4P.mjs} +2 -2
  55. package/dist/esm/{chunk-WSR5EBJM.mjs → chunk-BYINW7I2.mjs} +2 -2
  56. package/dist/esm/{chunk-ORMOQWWH.mjs → chunk-C6JRJNK3.mjs} +2 -2
  57. package/dist/esm/{chunk-S335GK43.mjs → chunk-DW6WLD2B.mjs} +2 -2
  58. package/dist/esm/{chunk-LIS2GDBI.mjs → chunk-E6IUB35J.mjs} +2 -2
  59. package/dist/esm/{chunk-CO67Y6YE.mjs → chunk-EPMBZCYJ.mjs} +2 -2
  60. package/dist/esm/{chunk-RQX6JOEN.mjs → chunk-FBCXUC7J.mjs} +2 -2
  61. package/dist/esm/{chunk-CFQFFP6N.mjs → chunk-FWGLACJS.mjs} +2 -2
  62. package/dist/esm/{chunk-LJEERFEH.mjs → chunk-GRB6YSIT.mjs} +2 -2
  63. package/dist/esm/{chunk-RGKRCZ36.mjs → chunk-GYVSI3TS.mjs} +2 -2
  64. package/dist/esm/chunk-HPQMAP7O.mjs +2 -0
  65. package/dist/esm/{chunk-L3GEIX2R.mjs → chunk-I4NMWLUZ.mjs} +3 -3
  66. package/dist/esm/chunk-I4NMWLUZ.mjs.map +1 -0
  67. package/dist/esm/{chunk-TOBQ5UE6.mjs → chunk-IXYGZ57N.mjs} +2 -2
  68. package/dist/esm/{chunk-2PF7UFKU.mjs → chunk-NII5Q32W.mjs} +2 -2
  69. package/dist/esm/{chunk-EBMEXURY.mjs → chunk-NJN3EAOM.mjs} +2 -2
  70. package/dist/esm/{chunk-XKUIMGKU.mjs → chunk-OYH2T6V5.mjs} +2 -2
  71. package/dist/esm/chunk-OYUW6ZN2.mjs +2 -0
  72. package/dist/esm/{chunk-VW26RFJ7.mjs → chunk-PQS3II2E.mjs} +2 -2
  73. package/dist/esm/{chunk-N6YTF76Q.mjs → chunk-PRUQZNAP.mjs} +2 -2
  74. package/dist/esm/{chunk-UQWF24SS.mjs → chunk-QGFWOGAV.mjs} +2 -2
  75. package/dist/esm/{chunk-PXQPKCDD.mjs → chunk-QQEK2GJC.mjs} +2 -2
  76. package/dist/esm/{chunk-SZE4RT4B.mjs → chunk-RFQFTIOA.mjs} +2 -2
  77. package/dist/esm/{chunk-O7WBNU4J.mjs → chunk-THUSLDD6.mjs} +2 -2
  78. package/dist/esm/{chunk-FLZPUYXQ.mjs → chunk-UCBUUH5M.mjs} +2 -2
  79. package/dist/esm/{chunk-MT2RJ7H3.mjs → chunk-WLUXOUZH.mjs} +2 -2
  80. package/dist/esm/{chunk-V74WPKSY.mjs → chunk-XIQFX5FV.mjs} +2 -2
  81. package/dist/esm/{chunk-7DQDJ2SA.mjs → chunk-YFFDF22R.mjs} +2 -2
  82. package/dist/esm/{chunk-WCMW2L3P.mjs → chunk-Z6KQX6VX.mjs} +2 -2
  83. package/dist/esm/{chunk-B563XRSZ.mjs → chunk-ZMT2M6YT.mjs} +2 -2
  84. package/dist/esm/cli/index.mjs +1 -1
  85. package/dist/esm/cli/localNode.mjs +1 -1
  86. package/dist/esm/client/core.mjs +1 -1
  87. package/dist/esm/client/get.mjs +1 -1
  88. package/dist/esm/client/index.mjs +1 -1
  89. package/dist/esm/client/post.mjs +1 -1
  90. package/dist/esm/core/account/index.mjs +1 -1
  91. package/dist/esm/core/account/utils/address.mjs +1 -1
  92. package/dist/esm/core/account/utils/index.mjs +1 -1
  93. package/dist/esm/core/accountAddress.mjs +1 -1
  94. package/dist/esm/core/authenticationKey.mjs +1 -1
  95. package/dist/esm/core/crypto/abstraction.mjs +1 -1
  96. package/dist/esm/core/crypto/deserializationUtils.mjs +1 -1
  97. package/dist/esm/core/crypto/ed25519.mjs +1 -1
  98. package/dist/esm/core/crypto/ephemeral.mjs +1 -1
  99. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  100. package/dist/esm/core/crypto/index.mjs +1 -1
  101. package/dist/esm/core/crypto/keyless.mjs +1 -1
  102. package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
  103. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  104. package/dist/esm/core/crypto/privateKey.mjs +1 -1
  105. package/dist/esm/core/crypto/proof.mjs +1 -1
  106. package/dist/esm/core/crypto/publicKey.mjs +1 -1
  107. package/dist/esm/core/crypto/secp256k1.mjs +1 -1
  108. package/dist/esm/core/crypto/signature.mjs +1 -1
  109. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  110. package/dist/esm/core/index.mjs +1 -1
  111. package/dist/esm/errors/index.mjs +1 -1
  112. package/dist/esm/index.mjs +1 -1
  113. package/dist/esm/internal/abstraction.mjs +1 -1
  114. package/dist/esm/internal/account.mjs +1 -1
  115. package/dist/esm/internal/ans.mjs +1 -1
  116. package/dist/esm/internal/coin.mjs +1 -1
  117. package/dist/esm/internal/digitalAsset.mjs +1 -1
  118. package/dist/esm/internal/event.mjs +1 -1
  119. package/dist/esm/internal/faucet.mjs +1 -1
  120. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  121. package/dist/esm/internal/general.mjs +1 -1
  122. package/dist/esm/internal/keyless.mjs +1 -1
  123. package/dist/esm/internal/object.mjs +1 -1
  124. package/dist/esm/internal/staking.mjs +1 -1
  125. package/dist/esm/internal/table.mjs +1 -1
  126. package/dist/esm/internal/transaction.mjs +1 -1
  127. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  128. package/dist/esm/internal/utils/index.mjs +1 -1
  129. package/dist/esm/internal/utils/utils.mjs +1 -1
  130. package/dist/esm/internal/view.mjs +1 -1
  131. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  132. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  133. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  134. package/dist/esm/transactions/index.mjs +1 -1
  135. package/dist/esm/transactions/instances/chainId.mjs +1 -1
  136. package/dist/esm/transactions/instances/identifier.mjs +1 -1
  137. package/dist/esm/transactions/instances/index.mjs +1 -1
  138. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  139. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  140. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  141. package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
  142. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  143. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  144. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  145. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  146. package/dist/esm/transactions/management/index.mjs +1 -1
  147. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  148. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  149. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  150. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  151. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  152. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  153. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  154. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  155. package/dist/esm/types/index.mjs +1 -1
  156. package/dist/esm/utils/helpers.mjs +1 -1
  157. package/dist/esm/utils/index.mjs +1 -1
  158. package/dist/esm/utils/normalizeBundle.mjs +1 -1
  159. package/dist/esm/version.d.mts +1 -1
  160. package/dist/esm/version.mjs +1 -1
  161. package/package.json +19 -18
  162. package/src/transactions/transactionBuilder/remoteAbi.ts +10 -1
  163. package/src/version.ts +1 -1
  164. package/dist/esm/chunk-75NVN2CG.mjs +0 -2
  165. package/dist/esm/chunk-CW35YAMN.mjs +0 -2
  166. package/dist/esm/chunk-L3GEIX2R.mjs.map +0 -1
  167. package/dist/esm/chunk-XJJVJOX5.mjs +0 -2
  168. /package/dist/esm/{chunk-Q4W3WJ2U.mjs.map → chunk-6MWXV62C.mjs.map} +0 -0
  169. /package/dist/esm/{chunk-FGFLPH5K.mjs.map → chunk-6PKBXYG3.mjs.map} +0 -0
  170. /package/dist/esm/{chunk-6WDVDEQZ.mjs.map → chunk-6Y6ZO7TS.mjs.map} +0 -0
  171. /package/dist/esm/{chunk-JL6RR7ML.mjs.map → chunk-AQQEQB35.mjs.map} +0 -0
  172. /package/dist/esm/{chunk-HNBVYE3N.mjs.map → chunk-BUUV6B4P.mjs.map} +0 -0
  173. /package/dist/esm/{chunk-WSR5EBJM.mjs.map → chunk-BYINW7I2.mjs.map} +0 -0
  174. /package/dist/esm/{chunk-ORMOQWWH.mjs.map → chunk-C6JRJNK3.mjs.map} +0 -0
  175. /package/dist/esm/{chunk-S335GK43.mjs.map → chunk-DW6WLD2B.mjs.map} +0 -0
  176. /package/dist/esm/{chunk-LIS2GDBI.mjs.map → chunk-E6IUB35J.mjs.map} +0 -0
  177. /package/dist/esm/{chunk-CO67Y6YE.mjs.map → chunk-EPMBZCYJ.mjs.map} +0 -0
  178. /package/dist/esm/{chunk-RQX6JOEN.mjs.map → chunk-FBCXUC7J.mjs.map} +0 -0
  179. /package/dist/esm/{chunk-CFQFFP6N.mjs.map → chunk-FWGLACJS.mjs.map} +0 -0
  180. /package/dist/esm/{chunk-LJEERFEH.mjs.map → chunk-GRB6YSIT.mjs.map} +0 -0
  181. /package/dist/esm/{chunk-RGKRCZ36.mjs.map → chunk-GYVSI3TS.mjs.map} +0 -0
  182. /package/dist/esm/{chunk-CW35YAMN.mjs.map → chunk-HPQMAP7O.mjs.map} +0 -0
  183. /package/dist/esm/{chunk-TOBQ5UE6.mjs.map → chunk-IXYGZ57N.mjs.map} +0 -0
  184. /package/dist/esm/{chunk-2PF7UFKU.mjs.map → chunk-NII5Q32W.mjs.map} +0 -0
  185. /package/dist/esm/{chunk-EBMEXURY.mjs.map → chunk-NJN3EAOM.mjs.map} +0 -0
  186. /package/dist/esm/{chunk-XKUIMGKU.mjs.map → chunk-OYH2T6V5.mjs.map} +0 -0
  187. /package/dist/esm/{chunk-XJJVJOX5.mjs.map → chunk-OYUW6ZN2.mjs.map} +0 -0
  188. /package/dist/esm/{chunk-VW26RFJ7.mjs.map → chunk-PQS3II2E.mjs.map} +0 -0
  189. /package/dist/esm/{chunk-N6YTF76Q.mjs.map → chunk-PRUQZNAP.mjs.map} +0 -0
  190. /package/dist/esm/{chunk-UQWF24SS.mjs.map → chunk-QGFWOGAV.mjs.map} +0 -0
  191. /package/dist/esm/{chunk-PXQPKCDD.mjs.map → chunk-QQEK2GJC.mjs.map} +0 -0
  192. /package/dist/esm/{chunk-SZE4RT4B.mjs.map → chunk-RFQFTIOA.mjs.map} +0 -0
  193. /package/dist/esm/{chunk-O7WBNU4J.mjs.map → chunk-THUSLDD6.mjs.map} +0 -0
  194. /package/dist/esm/{chunk-FLZPUYXQ.mjs.map → chunk-UCBUUH5M.mjs.map} +0 -0
  195. /package/dist/esm/{chunk-MT2RJ7H3.mjs.map → chunk-WLUXOUZH.mjs.map} +0 -0
  196. /package/dist/esm/{chunk-V74WPKSY.mjs.map → chunk-XIQFX5FV.mjs.map} +0 -0
  197. /package/dist/esm/{chunk-7DQDJ2SA.mjs.map → chunk-YFFDF22R.mjs.map} +0 -0
  198. /package/dist/esm/{chunk-WCMW2L3P.mjs.map → chunk-Z6KQX6VX.mjs.map} +0 -0
  199. /package/dist/esm/{chunk-B563XRSZ.mjs.map → chunk-ZMT2M6YT.mjs.map} +0 -0
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } function _optionalChainDelete(ops) { const result = _optionalChain(ops); return result == null ? true : result; }var _chunk6MMUUJHXjs = require('./chunk-6MMUUJHX.js');var C=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 rr=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 be(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},Y= 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())}},H= 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())}},be= 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 E=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 Y)){new Sn(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 Y(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 H(t)))}static U128(e){return new n(e.map(t=>new Re(t)))}static U256(e){return new n(e.map(t=>new be(t)))}static Bool(e){return new n(e.map(t=>new F(t)))}static MoveString(e){return new n(e.map(t=>new I(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)}},Sn= 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 C(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new E(r)}},I= 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);E.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Z= exports.MoveOption =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new E([e]):this.vec=new E([]),[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 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 H(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 be(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 I(e):void 0)}static deserialize(e,t){let r=E.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 $=mt;var vt=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()}},se= exports.AccountPublicKey =class extends vt{};var M=class extends _chunk6MMUUJHXjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunk6MMUUJHXjs.j.fromHexInput(e).toString()}};var En=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())}},ir= exports.AbstractPublicKey =class extends se{constructor(e){super(),this.accountAddress=e}authKey(){return new $({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 _o = _interopRequireWildcard(_bip39);var vc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Kc= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Rc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(Rc||{}),xo= exports.HARDENED_OFFSET =2147483648;function Io(n){return Kc.test(n)}function Co(n){return vc.test(n)}var ci=(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 ci(e,s)},Uc=n=>n.replace(/'/g,""),Ko= exports.splitPath =n=>n.split("/").slice(1).map(Uc),or= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return _o.mnemonicToSeedSync(e)};var Pn=class Pn{static formatPrivateKey(e,t){let r=Pn.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=Pn.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}};Pn.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var ft=Pn;var Wt=n=>typeof n=="string"?_chunk6MMUUJHXjs.j.isValid(n).valid?n:new TextEncoder().encode(n):n;var ui=[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 kc(n){let e=n.toUint8Array().slice(32);for(let t=ui.length-1;t>=0;t-=1){if(e[t]<ui[t])return!0;if(e[t]>ui[t])return!1}return!1}var At=class At extends se{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==At.LENGTH)throw new Error(`PublicKey length should be ${At.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!kc(r))return!1;let i=Wt(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 $.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 At(t)}static isPublicKey(e){return e instanceof At}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _2 => _2.key, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.length])===At.LENGTH}};At.LENGTH=32;var _=At,we=class we extends _chunk6MMUUJHXjs.l{constructor(e,t){super();let r=ft.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==we.LENGTH)throw new Error(`PrivateKey length should be ${we.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new we(e,!1)}static fromDerivationPath(e,t){if(!Co(e))throw new Error(`Invalid derivation path ${e}`);return we.fromDerivationPathInner(e,or(t))}static fromDerivationPathInner(e,t,r=xo){let{key:i,chainCode:o}=ci(we.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 we(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=Wt(e),r=_chunk6MMUUJHXjs.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(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 we(t,!1)}static isPrivateKey(e){return e instanceof we}};we.LENGTH=32,we.SLIP_0010_SEED="ed25519 seed";var W=we,Qt=class Qt extends M{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==Qt.LENGTH)throw new Error(`Signature length should be ${Qt.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 Qt(t)}};Qt.LENGTH=64;var v=Qt;var ht=class n extends vt{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 v.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 C(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _jwtdecode = require('jwt-decode');var _poseidonlite = require('poseidon-lite');var di=[_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,Jc=16,Ro=(Jc-1)*Uo;function Ve(n,e){let r=new TextEncoder().encode(n);return Xc(r,e)}function Xc(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=_n(n,e);return Rt(t)}function Yc(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=tu(n,e);return Zc(t)}function _n(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Yc(n,e).concat([BigInt(n.length)])}function Zc(n){if(n.length>Ro)throw new Error(`Can't pack more than ${Ro}. Was given ${n.length} bytes`);return eu(n,Uo).map(e=>Kt(e))}function eu(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Kt(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 pi(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 tu(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 Rt(n){if(n.length>di.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${di.length}`);return di[n.length-1](n)}var ar=class extends _chunk6MMUUJHXjs.l{};var ko="3.1.1";var No={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"},zo= 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"},li= 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"},gi= 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"},yi= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(yi||{}),mi= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Jl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var jt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(jt||{}),Oo= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Do= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,cr= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ut= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Go= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",Bo= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",fi= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Je= 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))(Je||{}),Mo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function Vo(n,e){let t=e.bcsToBytes(),r=new C(t);return n.deserialize(r)}var nu=(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))(nu||{}),ru= 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))(ru||{}),ur= 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))(ur||{}),Ho={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"]},P= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=Ho[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 _chunk6MMUUJHXjs = require('./chunk-6MMUUJHX.js');var C=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 rr=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 be(e.deserializeU256())}static deserialize(e){return new n(e.deserializeBool())}},Y= 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())}},H= 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())}},be= 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 E=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 Y)){new Sn(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 Y(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 H(t)))}static U128(e){return new n(e.map(t=>new Re(t)))}static U256(e){return new n(e.map(t=>new be(t)))}static Bool(e){return new n(e.map(t=>new F(t)))}static MoveString(e){return new n(e.map(t=>new I(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)}},Sn= 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 C(this.bcsToBytes());t.deserializeUleb128AsU32();let r=t.deserializeVector(e);return new E(r)}},I= 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);E.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Z= exports.MoveOption =class n extends _chunk6MMUUJHXjs.l{constructor(e){super(),typeof e<"u"&&e!==null?this.vec=new E([e]):this.vec=new E([]),[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 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 H(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 be(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 I(e):void 0)}static deserialize(e,t){let r=E.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 $=mt;var vt=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()}},se= exports.AccountPublicKey =class extends vt{};var M=class extends _chunk6MMUUJHXjs.l{toUint8Array(){return this.bcsToBytes()}toString(){let e=this.toUint8Array();return _chunk6MMUUJHXjs.j.fromHexInput(e).toString()}};var En=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())}},ir= exports.AbstractPublicKey =class extends se{constructor(e){super(),this.accountAddress=e}authKey(){return new $({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 _o = _interopRequireWildcard(_bip39);var vc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Kc= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,Rc= exports.KeyType =(e=>(e.ED25519="ed25519 seed",e))(Rc||{}),xo= exports.HARDENED_OFFSET =2147483648;function Io(n){return Kc.test(n)}function Co(n){return vc.test(n)}var ci=(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 ci(e,s)},Uc=n=>n.replace(/'/g,""),Ko= exports.splitPath =n=>n.split("/").slice(1).map(Uc),or= exports.mnemonicToSeed =n=>{let e=n.trim().split(/\s+/).map(t=>t.toLowerCase()).join(" ");return _o.mnemonicToSeedSync(e)};var Pn=class Pn{static formatPrivateKey(e,t){let r=Pn.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=Pn.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}};Pn.AIP80_PREFIXES={ed25519:"ed25519-priv-",secp256k1:"secp256k1-priv-"};var ft=Pn;var Wt=n=>typeof n=="string"?_chunk6MMUUJHXjs.j.isValid(n).valid?n:new TextEncoder().encode(n):n;var ui=[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 kc(n){let e=n.toUint8Array().slice(32);for(let t=ui.length-1;t>=0;t-=1){if(e[t]<ui[t])return!0;if(e[t]>ui[t])return!1}return!1}var At=class At extends se{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==At.LENGTH)throw new Error(`PublicKey length should be ${At.LENGTH}`);this.key=t}verifySignature(e){let{message:t,signature:r}=e;if(!kc(r))return!1;let i=Wt(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 $.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 At(t)}static isPublicKey(e){return e instanceof At}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _2 => _2.key, 'optionalAccess', _3 => _3.data, 'optionalAccess', _4 => _4.length])===At.LENGTH}};At.LENGTH=32;var _=At,we=class we extends _chunk6MMUUJHXjs.l{constructor(e,t){super();let r=ft.parseHexInput(e,"ed25519",t);if(r.toUint8Array().length!==we.LENGTH)throw new Error(`PrivateKey length should be ${we.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new we(e,!1)}static fromDerivationPath(e,t){if(!Co(e))throw new Error(`Invalid derivation path ${e}`);return we.fromDerivationPathInner(e,or(t))}static fromDerivationPathInner(e,t,r=xo){let{key:i,chainCode:o}=ci(we.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 we(a,!1)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new _(e)}sign(e){let t=Wt(e),r=_chunk6MMUUJHXjs.j.fromHexInput(t).toUint8Array(),i=_ed25519.ed25519.sign(r,this.signingKey.toUint8Array());return new v(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 we(t,!1)}static isPrivateKey(e){return e instanceof we}};we.LENGTH=32,we.SLIP_0010_SEED="ed25519 seed";var W=we,Qt=class Qt extends M{constructor(e){super();let t=_chunk6MMUUJHXjs.j.fromHexInput(e);if(t.toUint8Array().length!==Qt.LENGTH)throw new Error(`Signature length should be ${Qt.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 Qt(t)}};Qt.LENGTH=64;var v=Qt;var ht=class n extends vt{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 v.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 C(t.toUint8Array());return n.deserialize(r)}serialize(e){if(this.signature instanceof v)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let t=e.deserializeUleb128AsU32();switch(t){case 0:return new n(v.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${t}`)}}};var _jwtdecode = require('jwt-decode');var _poseidonlite = require('poseidon-lite');var di=[_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,Jc=16,Ro=(Jc-1)*Uo;function Ve(n,e){let r=new TextEncoder().encode(n);return Xc(r,e)}function Xc(n,e){if(n.length>e)throw new Error(`Inputted bytes of length ${n} is longer than ${e}`);let t=_n(n,e);return Rt(t)}function Yc(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);let t=tu(n,e);return Zc(t)}function _n(n,e){if(n.length>e)throw new Error(`Input bytes of length ${n} is longer than ${e}`);return Yc(n,e).concat([BigInt(n.length)])}function Zc(n){if(n.length>Ro)throw new Error(`Can't pack more than ${Ro}. Was given ${n.length} bytes`);return eu(n,Uo).map(e=>Kt(e))}function eu(n,e){let t=[];for(let r=0;r<n.length;r+=e)t.push(n.subarray(r,r+e));return t}function Kt(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 pi(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 tu(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 Rt(n){if(n.length>di.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${di.length}`);return di[n.length-1](n)}var ar=class extends _chunk6MMUUJHXjs.l{};var ko="3.1.2";var No={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"},zo= 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"},li= 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"},gi= 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"},yi= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(yi||{}),mi= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Jl= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var jt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(jt||{}),Oo= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Do= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,cr= exports.DEFAULT_TXN_TIMEOUT_SEC =20,Ut= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Go= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",Bo= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",fi= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Je= 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))(Je||{}),Mo= exports.FIREBASE_AUTH_ISS_PATTERN =/^https:\/\/securetoken\.google\.com\/[a-zA-Z0-9-_]+$/;function Vo(n,e){let t=e.bcsToBytes(),r=new C(t);return n.deserialize(r)}var nu=(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))(nu||{}),ru= 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))(ru||{}),ur= 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))(ur||{}),Ho={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"]},P= exports.KeylessError =class n extends Error{constructor(e){let{innerError:t,category:r,resolutionTip:i,type:o,message:s=Ho[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+=`
@@ -497,7 +497,7 @@ KeylessErrorResolutionTip: ${t}`,o}static fromErrorType(e){let{error:t,type:r,de
497
497
  }
498
498
  }
499
499
  }
500
- `;async function Kr(n){let{aptosConfig:e}=n,{data:t}=await L({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function Es(n){let{aptosConfig:e,limit:t}=n;return(await S({aptosConfig:e,query:{query:ls,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function S(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Lo({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Nu(n){let{aptosConfig:e}=n;return(await S({aptosConfig:e,query:{query:Ri},originMethod:"getProcessorStatuses"})).processor_status}async function Rr(n){let e=await Nu({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Ur(n){let{aptosConfig:e,processorType:t}=n;return(await S({aptosConfig:e,query:{query:Ri,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function kr(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}`});return r}async function _s(n){return _optionalChain([n, 'access', _61 => _61.options, 'optionalAccess', _62 => _62.ledgerVersion])!==void 0?Ps(n):He(async()=>Ps(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Ps(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await L({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 Nr(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await Tt({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _64 => _64.ledgerVersion])},body:r})).data}async function xs(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 S({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function Is(n){let{aptosConfig:e,options:t}=n,r={query:bs,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 S({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Ni(n){let{aptosConfig:e,options:t}=n;return lr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _73 => _73.offset]),limit:_optionalChain([t, 'optionalAccess', _74 => _74.limit])}})}async function Fr(n){let{aptosConfig:e}=n;return He(async()=>{let{data:t}=await L({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Cs(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Fn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function vs(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Fn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _75 => _75.status])===404)return!0;throw r}}async function zu(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Pt(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,l=200,f=1.5;function p(g){if(!(g instanceof Se)||(d=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await Fn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){p(g)}if(s){let g=Date.now();try{c=await zu({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){p(b)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await Fn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){p(g)}await _chunk6MMUUJHXjs.fa.call(void 0, l),a+=l/1e3,l*=f}if(c===void 0)throw d||new zr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new zr(`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 Or(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 Rr({aptosConfig:e}):s=(await Ur({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunk6MMUUJHXjs.fa.call(void 0, 200)}}var zr=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 Ks(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _78 => _78.withTransactions])}});return Us({block:i,...n})}async function Rs(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _79 => _79.withTransactions])}});return Us({block:i,...n})}async function Us(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=[],l=100n;for(let p=c+1n;p<s;p+=BigInt(100))d.push(Ni({aptosConfig:e,options:{offset:p,limit:Math.min(Number(l),Number(s-p+1n))}}));let f=await Promise.all(d);for(let p of f)t.transactions.push(...p)}return t}function ks(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Ns(n){return!!n.match(/\s/)}function Fu(n){return!!n.match(/^T[0-9]+$/)}function Ou(n){return!!n.match(/^&.+$/)}function Du(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 Gu(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Ns(r))break}return t}var Bu=(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))(Bu||{}),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=On(a,i,t);o.push(b)}let l=r.pop();if(l===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:f,savedTypes:p,savedExpectedTypes:g}=l;i=o,o=p,a=f,c=g}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 l=On(a,i,t);i=[],o.push(l),a="",c+=1}else if(Ns(d)){let l=!1;if(a.length!==0){let p=On(a,i,t);i=[],o.push(p),a="",l=!0}s=Gu(n,s);let f=n[s];if(s<n.length&&l&&f!==","&&f!==">")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 On(a,i,t);case 1:if(a==="")return o[0];throw new j(n,"unexpected ','");default:throw new j(n,"unexpected whitespace character")}}function On(n,e,t){let r=n.trim(),i=r.toLowerCase();if(Du(i)&&e.length>0)throw new j(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new zt;case"bool":return new q;case"address":return new D;case"u8":return new fe;case"u16":return new nt;case"u32":return new rt;case"u64":return new X;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 R(e[0]);default:if(Ou(r)){let a=r.substring(1);return new Ar(On(a,e,t))}if(Fu(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(!ks(o[1]))throw new j(n,"module name must only contain alphanumeric or '_' characters");if(!ks(o[2]))throw new j(n,"struct name must only contain alphanumeric or '_' characters");return new h(new We(s,new k(o[1]),new k(o[2]),e))}}function zs(n){return typeof n=="boolean"}function pt(n){return typeof n=="string"}function Mu(n){return typeof n=="number"}function Dr(n){if(Mu(n))return n;if(pt(n)&&n!=="")return Number.parseInt(n,10)}function Gr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Fs(n){return n==null}function Os(n){return zi(n)||Oi(n)||Di(n)||Gi(n)||Bi(n)||Mi(n)||Vi(n)||Br(n)||Fi(n)||Vu(n)||n instanceof E||n instanceof Z}function zi(n){return n instanceof F}function Br(n){return n instanceof _chunk6MMUUJHXjs.ba}function Fi(n){return n instanceof I}function Vu(n){return n instanceof Ce}function Oi(n){return n instanceof Y}function Di(n){return n instanceof ve}function Gi(n){return n instanceof Ke}function Bi(n){return n instanceof H}function Mi(n){return n instanceof Re}function Vi(n){return n instanceof be}function Ds(n){return"bytecode"in n}function N(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Gs(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}var Hu=new TextEncoder;function Mr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _83 => _83.map, 'call', _84 => _84(e=>pt(e)?Be(e):e)]), () => ([]))}async function Lu(n,e,t){return(await Vr({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function Li(n,e,t,r){let i=await Lu(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 bw(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 Bs(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=Gs(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 Ms(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 Lt(t,s,r,i,"exposed_functions"in e?e:void 0,o)}function Lt(n,e,t,r,i,o){return Os(n)?(Hi(e,n,t),n):qu(n,e,t,r,i,o)}function qu(n,e,t,r,i,o){if(e.isBool()){if(zs(n))return new F(n);if(pt(n)){if(n==="true")return new F(!0);if(n==="false")return new F(!1)}N("boolean",t)}if(e.isAddress()){if(pt(n))return _chunk6MMUUJHXjs.ba.fromString(n);N("string | AccountAddress",t)}if(e.isU8()){let s=Dr(n);if(s!==void 0)return new Y(s);N("number | string",t)}if(e.isU16()){let s=Dr(n);if(s!==void 0)return new ve(s);N("number | string",t)}if(e.isU32()){let s=Dr(n);if(s!==void 0)return new Ke(s);N("number | string",t)}if(e.isU64()){if(Gr(n))return new H(BigInt(n));N("bigint | number | string",t)}if(e.isU128()){if(Gr(n))return new Re(BigInt(n));N("bigint | number | string",t)}if(e.isU256()){if(Gr(n))return new be(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 Lt(n,r[s],t,r,i)}if(e.isVector()){if(e.value.isU8()){if(pt(n))return E.U8(Hu.encode(n));if(n instanceof Uint8Array)return E.U8(n);if(n instanceof ArrayBuffer)return E.U8(new Uint8Array(n))}if(pt(n)&&n.startsWith("["))return Lt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new E(n.map(s=>Lt(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 I(n);N("string",t)}if(e.isObject()){if(pt(n))return _chunk6MMUUJHXjs.ba.fromString(n);N("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new Ce(n);N("Uint8Array",t)}if(e.isOption()){if(Fs(n)){let a=e.value.typeArgs[0];return a instanceof q?new Z(null):a instanceof D?new Z(null):a instanceof fe?new Z(null):a instanceof nt?new Z(null):a instanceof rt?new Z(null):a instanceof X?new Z(null):a instanceof it?new Z(null):a instanceof ot?new Z(null):new Z(null)}return new Z(Lt(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(zi(e))return;N("Bool",t)}if(n.isAddress()){if(Br(e))return;N("AccountAddress",t)}if(n.isU8()){if(Oi(e))return;N("U8",t)}if(n.isU16()){if(Di(e))return;N("U16",t)}if(n.isU32()){if(Gi(e))return;N("U32",t)}if(n.isU64()){if(Bi(e))return;N("U64",t)}if(n.isU128()){if(Mi(e))return;N("U128",t)}if(n.isU256()){if(Vi(e))return;N("U256",t)}if(n.isVector()){if(e instanceof E){e.values.length>0&&Hi(n.value,e.values[0],t);return}N("MoveVector",t)}if(n instanceof h){if(n.isString()){if(Fi(e))return;N("MoveString",t)}if(n.isObject()){if(Br(e))return;N("AccountAddress",t)}if(n.isOption()){if(e instanceof Z){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 ju(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),i=await qs({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Bs});return Wu({...n,abi:i})}function Wu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.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,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 on(new Rn(c,new Un(a)))}return new rn(a)}async function Vs(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),i=await qs({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Ms});return Qu({abi:i,...n})}function Qu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.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', _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 ju(n){return new nn(new sn(_chunk6MMUUJHXjs.j.fromHexInput(n.bytecode).toUint8Array(),Mr(n.typeArguments),n.functionArguments))}async function Ju(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()=>mi[e.network]?{chainId:mi[e.network]}:{chainId:(await Kr({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _96 => _96.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Fr({aptosConfig:e})).gas_estimate},c=async()=>{let ie=async()=>_optionalChain([i, 'optionalAccess', _97 => _97.accountSequenceNumber])!==void 0?i.accountSequenceNumber:_optionalChain([i, 'optionalAccess', _98 => _98.replayProtectionNonce])!==void 0?0xdeadbeefn:(await kr({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunk6MMUUJHXjs.ba.from(o).equals(_chunk6MMUUJHXjs.ba.ZERO))try{return await ie()}catch (e5){return 0}else return ie()},[{chainId:d},{gasEstimate:l},f]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:g,expireTimestamp:b,replayProtectionNonce:z}={maxGasAmount:_optionalChain([i, 'optionalAccess', _99 => _99.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(e.getDefaultMaxGasAmount()),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _100 => _100.gasUnitPrice]), () => (BigInt(l))),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},V=r;return z!==void 0&&(V=Xu(r,z)),new _e(_chunk6MMUUJHXjs.ba.from(t),BigInt(f),V,BigInt(p),BigInt(g),BigInt(b),new tn(d))}function Xu(n,e){if(n instanceof nn)return new Ft(new kn(n.script),new Ot(void 0,e));if(n instanceof rn)return new Ft(new cn(n.entryFunction),new Ot(void 0,e));if(n instanceof on){let t=n.multiSig.transaction_payload,r;if(t===void 0||_optionalChain([t, 'optionalAccess', _103 => _103.transaction_payload])===void 0)r=new Nn;else if(t.transaction_payload instanceof st)r=new cn(t.transaction_payload);else throw new Error("Scripts are not supported in multi-sig transactions.");return new Ft(r,new Ot(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 Ju({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 Er(s,a,n.feePayerAddress?_chunk6MMUUJHXjs.ba.from(n.feePayerAddress):void 0)}return new Sr(s,n.feePayerAddress?_chunk6MMUUJHXjs.ba.from(n.feePayerAddress):void 0)}function Hs(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=yn(e);if(t.feePayerAddress){let a=new Gt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(f=>yn(f)):c=Array.from({length:t.secondarySignerAddresses.length},()=>yn(void 0)));let d=yn(i),l=new Vt(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new ct(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Dt(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(l=>yn(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>yn(void 0));let d=new Mt(o,t.secondarySignerAddresses,c);return new ct(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof Oe)s=new Bt(o.public_key,o.signature);else if(o instanceof ce||o instanceof $e)s=new Et(o);else if(o instanceof en)s=new Et(o);else throw new Error("Invalid public key");return new ct(t.rawTransaction,s).bcsToBytes()}function yn(n){if(!n)return new en;let t=U.isInstance(n)||Q.isInstance(n)||Ne.isInstance(n)?new K(n):n,r=new v(new Uint8Array(64));if(_.isInstance(t))return new Oe(t,r);if(K.isInstance(t))return U.isInstance(t.publicKey)?new ce(t,new O(ae.getSimulationSignature())):new ce(t,new O(r));if(ee.isInstance(t))return new $e(t,new Ee({signatures:t.publicKeys.map(i=>U.isInstance(i.publicKey)||Q.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 Wi(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Vo(J,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 Vt(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 Mt(i,e.secondarySignerAddresses,r)}else i instanceof Oe?o=new Bt(i.public_key,i.signature):i instanceof tt?o=new un(i.public_key,i.signature):o=new Et(i);return new ct(e.rawTransaction,o).bcsToBytes()}function Ls(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Yu=Ls(["APTOS::Transaction"]);function Ww(n){let e=Wi(n);return new (0, _chunk6MMUUJHXjs.j)(Ls([Yu,new Uint8Array([0]),e])).toString()}async function qs({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 w(n){let e=await Zu(n);return ed(n,e)}async function Zu(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 ed(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(td(n)&&(o=_chunk6MMUUJHXjs.ba.ZERO.toString()),nd(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 td(n){return n.withFeePayer===!0}function nd(n){return"secondarySignerAddresses"in n}function $s(n){let{transaction:e}=n;return De(e)}function Lr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function qr(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,Lr({signer:e,transaction:t})}async function Qi(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Hs({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Tt({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 Tt({aptosConfig:e,body:i,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return o}catch(o){let s=ct.deserialize(new C(i));throw s.authenticator.isSingleSender()&&s.authenticator.sender.isSingleKey()&&(s.authenticator.sender.public_key.publicKey instanceof U||s.authenticator.sender.public_key.publicKey instanceof Q)&&await he.fetchJWK({aptosConfig:e,publicKey:s.authenticator.sender.public_key.publicKey,kid:s.authenticator.sender.signature.signature.getJwkKid()}),o}}async function _t(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i,...o}=n;xr(t)&&await t.checkKeylessAccountValidity(e),xr(r)&&await r.checkKeylessAccountValidity(e);let s=n.feePayerAuthenticator||r&&qr({signer:r,transaction:i}),a=Lr({signer:t,transaction:i});return Dn({aptosConfig:e,transaction:i,senderAuthenticator:a,feePayerAuthenticator:s,...o})}async function Ws(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i,...o}=n;xr(r)&&await r.checkKeylessAccountValidity(e);let s=qr({signer:r,transaction:i});return Dn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:s,...o})}var rd={typeParameters:[],parameters:[R.u8(),new R(R.u8())]};async function Qs(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>E.U8(a));return w({aptosConfig:e,sender:_chunk6MMUUJHXjs.ba.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[E.U8(r),new E(s)],abi:rd},options:o})}async function mn(n){return kr(n)}async function js(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return hi({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 Js(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await gr({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 Vr(n){return _s(n)}async function Ji(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return lr({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 hi({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 Xs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await gr({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 L({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 Gn(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 Nr({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 Ys(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}},s=await S({aptosConfig:e,query:{query:us,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 Zs(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:as,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 S({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function ea(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:cs,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 S({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function ta(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:ss,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 S({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function na(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await S({aptosConfig:e,query:{query:ds,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ra(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:os,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 S({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ia(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await S({aptosConfig:e,query:{query:is,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:vr,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 S({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function oa(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _148 => _148.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 ut.fromPrivateKey({privateKey:t})}return o[0]}async function id(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 od={typeParameters:[],parameters:[new fe,R.u8(),new fe,R.u8(),R.u8(),R.u8()]};async function sa(n){let{aptosConfig:e,fromAccount:t,dangerouslySkipVerification:r,options:i}=n;if("toNewPrivateKey"in n)return ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toNewPrivateKey,options:i});let o;if("toAccount"in n){if(n.toAccount instanceof re)return ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toAccount.privateKey,options:i});if(n.toAccount instanceof ln)return ji({aptosConfig:e,fromAccount:t,toAccount:n.toAccount,options:i});o=n.toAccount.publicKey.authKey()}else if("toAuthKey"in n)o=n.toAuthKey;else throw new Error("Invalid arguments");let s=await ad({aptosConfig:e,fromAccount:t,toAuthKey:o,options:i});if(r===!0)return s;let a=await Pt({aptosConfig:e,transactionHash:s.hash});if(!a.success)throw new Error(`Failed to rotate authentication key - ${a}`);let c=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::set_originating_address",functionArguments:[]}});return _t({aptosConfig:e,signer:n.toAccount,transaction:c})}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=ut.fromPrivateKey({privateKey:n.toNewPrivateKey,legacy:!0}):o=n.toAccount;let a=new wr({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),l=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new Y(t.signingScheme),E.U8(t.publicKey.toUint8Array()),new Y(o.signingScheme),E.U8(o.publicKey.toUint8Array()),E.U8(c.toUint8Array()),E.U8(d.toUint8Array())],abi:od},options:r});return _t({aptosConfig:e,signer:t,transaction:l})}var sd={typeParameters:[],parameters:[R.u8()]};async function ad(n){let{aptosConfig:e,fromAccount:t,toAuthKey:r,options:i}=n,o=r,s=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key_call",functionArguments:[E.U8(o.toUint8Array())],abi:sd},options:i});return _t({aptosConfig:e,signer:t,transaction:s})}async function Wr(n){let{aptosConfig:e,publicKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _150 => _150.noMultiKey]), () => (!1));if(i&&t instanceof ze)throw new Error("Multi-key accounts are not supported when noMultiKey is true.");let o=[t];t instanceof K&&t.publicKey instanceof _?o.push(t.publicKey):t instanceof _&&o.push(new K(t));let[s,a]=await Promise.all([Promise.all(o.map(async f=>{let p=await ld({aptosConfig:e,publicKey:f});if(p)return{...p,publicKey:f}})),!(t instanceof ze)&&!i?ud({aptosConfig:e,publicKey:t,options:r}):Promise.resolve([])]),c=[];for(let f of s)f&&c.push(f);o.push(...a);let d=new Map(o.map(f=>[f.authKey().toString(),f])),l=await dd({aptosConfig:e,authKeys:o.map(f=>f.authKey()),options:r});for(let f of l){if(c.find(g=>g.accountAddress===f.accountAddress))continue;let p=d.get(f.authKey.toString());if(!p)throw new Error(`No publicKey found for authentication key ${f.authKey}. This should never happen.`);c.push({accountAddress:f.accountAddress,publicKey:p,lastTransactionVersion:f.lastTransactionVersion})}return c.sort((f,p)=>p.lastTransactionVersion-f.lastTransactionVersion)}async function eo(n){let{aptosConfig:e,signer:t,options:r}=n;if(t instanceof W||t instanceof Ze)return $r({aptosConfig:e,privateKey:t,options:r});if(t instanceof re||t instanceof ue)return $r({aptosConfig:e,privateKey:t.privateKey,options:r});if(t instanceof xe||t instanceof Ge)return cd({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 ln&&t.signers.length===1)return $r({aptosConfig:e,privateKey:t.signers[0],options:r});throw new Error("Unknown signer type")}async function cd(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 ze){if(c.getSignaturesRequired()>1)continue;if(c instanceof Pe)throw new Error("Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.");c instanceof ee&&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 $r(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=ut.fromPrivateKey({privateKey:t,legacy:!1}),o=await Wr({aptosConfig:e,publicKey:new K(t.publicKey()),options:r}),s=[];for(let{accountAddress:a,publicKey:c}of o)if(c instanceof ze){if(c.getSignaturesRequired()>1)continue;c instanceof Pe?s.push(new ln({publicKey:c,signers:[t],address:a})):c instanceof ee&&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 ud(n){let{aptosConfig:e,publicKey:t,options:r}=n;if(t instanceof ze)throw new Error("Public key is a multi-key.");let i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _151 => _151.includeUnverified]), () => (!1)),o=t instanceof K?t:new K(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:ps,variables:{where_condition:c}},{public_key_auth_keys:l}=await S({aptosConfig:e,query:d,originMethod:"getMultiKeysForPublicKey"});return l.map(p=>{switch(p.signature_type){case"multi_ed25519_signature":return Pe.deserializeWithoutLength(C.fromHex(p.account_public_key));case"multi_key_signature":return ee.deserialize(C.fromHex(p.account_public_key));default:throw new Error(`Unknown multi-signature type: ${p.signature_type}`)}})}async function dd(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:rs,variables:{where_condition:o,order_by:[{last_transaction_version:"desc"}]}},{auth_key_account_addresses:a}=await S({aptosConfig:e,query:s,originMethod:"getAccountAddressesForAuthKeys"});return a.map(c=>({authKey:new $({data:c.auth_key}),accountAddress:new (0, _chunk6MMUUJHXjs.ba)(_chunk6MMUUJHXjs.j.hexInputToUint8Array(c.account_address)),lastTransactionVersion:Number(c.last_transaction_version)}))}async function pd(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 ld(n){let{aptosConfig:e,publicKey:t}=n,r=t.authKey().derivedAddress(),[i,o]=await Promise.all([pd({aptosConfig:e,accountAddress:r}),id({aptosConfig:e,accountAddress:r,options:{withAuthKey:t.authKey()}})]);if(o)return{accountAddress:r,lastTransactionVersion:i}}async function T(n){n.minimumLedgerVersion!==void 0&&await Or({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}async function de(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Vs({...t,aptosConfig:e}),o=new _chunk6MMUUJHXjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Tt({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 aa(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await Tt({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 ca(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunk6MMUUJHXjs.pa.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new D,new h(x()),new h(x())]}},options:i})}async function ua(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunk6MMUUJHXjs.pa.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new D,new h(x()),new h(x())]}},options:i})}async function da(n){let{aptosConfig:e,sender:t,options:r}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var qt=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 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 da({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:[_chunk6MMUUJHXjs.ba.from(t)],abi:{typeParameters:[],parameters:[new D],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 Bn=class{constructor(e){this.config=e;this.abstraction=new qt(e)}async getAccountInfo(e){return mn({aptosConfig:this.config,...e})}async getAccountModules(e){return js({aptosConfig:this.config,...e})}async getAccountModulesPage(e){return Js({aptosConfig:this.config,...e})}async getAccountModule(e){return Vr({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 Xs({aptosConfig:this.config,...e})}async getAccountResource(e){return Yi({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Gn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Ys({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zs({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ea({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ta({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),na({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ra({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ia({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Ut,faMetadataAddress:Go,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
500
+ `;async function Kr(n){let{aptosConfig:e}=n,{data:t}=await L({aptosConfig:e,originMethod:"getLedgerInfo",path:""});return t}async function Es(n){let{aptosConfig:e,limit:t}=n;return(await S({aptosConfig:e,query:{query:ls,variables:{limit:t}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function S(n){let{aptosConfig:e,query:t,originMethod:r}=n,{data:i}=await Lo({aptosConfig:e,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:t,overrides:{WITH_CREDENTIALS:!1}});return i}async function Nu(n){let{aptosConfig:e}=n;return(await S({aptosConfig:e,query:{query:Ri},originMethod:"getProcessorStatuses"})).processor_status}async function Rr(n){let e=await Nu({aptosConfig:n.aptosConfig});return BigInt(e[0].last_success_version)}async function Ur(n){let{aptosConfig:e,processorType:t}=n;return(await S({aptosConfig:e,query:{query:Ri,variables:{where_condition:{processor:{_eq:t}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function kr(n){let{aptosConfig:e,accountAddress:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getInfo",path:`accounts/${_chunk6MMUUJHXjs.ba.from(t).toString()}`});return r}async function _s(n){return _optionalChain([n, 'access', _61 => _61.options, 'optionalAccess', _62 => _62.ledgerVersion])!==void 0?Ps(n):He(async()=>Ps(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Ps(n){let{aptosConfig:e,accountAddress:t,moduleName:r,options:i}=n,{data:o}=await L({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 Nr(n){let{aptosConfig:e,handle:t,data:r,options:i}=n;return(await Tt({aptosConfig:e,originMethod:"getTableItem",path:`tables/${t}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _64 => _64.ledgerVersion])},body:r})).data}async function xs(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 S({aptosConfig:e,query:r,originMethod:"getTableItemsData"})).table_items}async function Is(n){let{aptosConfig:e,options:t}=n,r={query:bs,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 S({aptosConfig:e,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function Ni(n){let{aptosConfig:e,options:t}=n;return lr({aptosConfig:e,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([t, 'optionalAccess', _73 => _73.offset]),limit:_optionalChain([t, 'optionalAccess', _74 => _74.limit])}})}async function Fr(n){let{aptosConfig:e}=n;return He(async()=>{let{data:t}=await L({aptosConfig:e,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return t},`gas-price-${e.network}`,1e3*60*5)()}async function Cs(n){let{aptosConfig:e,ledgerVersion:t}=n,{data:r}=await L({aptosConfig:e,originMethod:"getTransactionByVersion",path:`transactions/by_version/${t}`});return r}async function Fn(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/by_hash/${t}`,originMethod:"getTransactionByHash"});return r}async function vs(n){let{aptosConfig:e,transactionHash:t}=n;try{return(await Fn({aptosConfig:e,transactionHash:t})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _75 => _75.status])===404)return!0;throw r}}async function zu(n){let{aptosConfig:e,transactionHash:t}=n,{data:r}=await L({aptosConfig:e,path:`transactions/wait_by_hash/${t}`,originMethod:"longWaitForTransaction"});return r}async function Pt(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,l=200,f=1.5;function p(g){if(!(g instanceof Se)||(d=g,g.status!==404&&g.status>=400&&g.status<500))throw g}try{c=await Fn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(g){p(g)}if(s){let g=Date.now();try{c=await zu({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction"}catch(b){p(b)}a=(Date.now()-g)/1e3}for(;s&&!(a>=i);){try{if(c=await Fn({aptosConfig:e,transactionHash:t}),s=c.type==="pending_transaction",!s)break}catch(g){p(g)}await _chunk6MMUUJHXjs.fa.call(void 0, l),a+=l/1e3,l*=f}if(c===void 0)throw d||new zr(`Fetching transaction ${t} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new zr(`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 Or(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 Rr({aptosConfig:e}):s=(await Ur({aptosConfig:e,processorType:t})).last_success_version,s>=r)break;await _chunk6MMUUJHXjs.fa.call(void 0, 200)}}var zr=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 Ks(n){let{aptosConfig:e,ledgerVersion:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByVersion",path:`blocks/by_version/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _78 => _78.withTransactions])}});return Us({block:i,...n})}async function Rs(n){let{aptosConfig:e,blockHeight:t,options:r}=n,{data:i}=await L({aptosConfig:e,originMethod:"getBlockByHeight",path:`blocks/by_height/${t}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _79 => _79.withTransactions])}});return Us({block:i,...n})}async function Us(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=[],l=100n;for(let p=c+1n;p<s;p+=BigInt(100))d.push(Ni({aptosConfig:e,options:{offset:p,limit:Math.min(Number(l),Number(s-p+1n))}}));let f=await Promise.all(d);for(let p of f)t.transactions.push(...p)}return t}function ks(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Ns(n){return!!n.match(/\s/)}function Fu(n){return!!n.match(/^T[0-9]+$/)}function Ou(n){return!!n.match(/^&.+$/)}function Du(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 Gu(n,e){let t=e;for(;t<n.length;t+=1){let r=n[t];if(!Ns(r))break}return t}var Bu=(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))(Bu||{}),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=On(a,i,t);o.push(b)}let l=r.pop();if(l===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:f,savedTypes:p,savedExpectedTypes:g}=l;i=o,o=p,a=f,c=g}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 l=On(a,i,t);i=[],o.push(l),a="",c+=1}else if(Ns(d)){let l=!1;if(a.length!==0){let p=On(a,i,t);i=[],o.push(p),a="",l=!0}s=Gu(n,s);let f=n[s];if(s<n.length&&l&&f!==","&&f!==">")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 On(a,i,t);case 1:if(a==="")return o[0];throw new j(n,"unexpected ','");default:throw new j(n,"unexpected whitespace character")}}function On(n,e,t){let r=n.trim(),i=r.toLowerCase();if(Du(i)&&e.length>0)throw new j(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new zt;case"bool":return new q;case"address":return new D;case"u8":return new fe;case"u16":return new nt;case"u32":return new rt;case"u64":return new X;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 R(e[0]);default:if(Ou(r)){let a=r.substring(1);return new Ar(On(a,e,t))}if(Fu(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(!ks(o[1]))throw new j(n,"module name must only contain alphanumeric or '_' characters");if(!ks(o[2]))throw new j(n,"struct name must only contain alphanumeric or '_' characters");return new h(new We(s,new k(o[1]),new k(o[2]),e))}}function zs(n){return typeof n=="boolean"}function pt(n){return typeof n=="string"}function Mu(n){return typeof n=="number"}function Dr(n){if(Mu(n))return n;if(pt(n)&&n!=="")return Number.parseInt(n,10)}function Gr(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Fs(n){return n==null}function Os(n){return zi(n)||Oi(n)||Di(n)||Gi(n)||Bi(n)||Mi(n)||Vi(n)||Br(n)||Fi(n)||Vu(n)||n instanceof E||n instanceof Z}function zi(n){return n instanceof F}function Br(n){return n instanceof _chunk6MMUUJHXjs.ba}function Fi(n){return n instanceof I}function Vu(n){return n instanceof Ce}function Oi(n){return n instanceof Y}function Di(n){return n instanceof ve}function Gi(n){return n instanceof Ke}function Bi(n){return n instanceof H}function Mi(n){return n instanceof Re}function Vi(n){return n instanceof be}function Ds(n){return"bytecode"in n}function N(n,e){throw new Error(`Type mismatch for argument ${e}, expected '${n}'`)}function Gs(n){let e=n.params.findIndex(t=>t!=="signer"&&t!=="&signer");return e<0?n.params.length:e}var Hu=new TextEncoder;function Mr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _83 => _83.map, 'call', _84 => _84(e=>pt(e)?Be(e):e)]), () => ([]))}async function Lu(n,e,t){return(await Vr({aptosConfig:t,accountAddress:n,moduleName:e})).abi}async function Li(n,e,t,r){let i=await Lu(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 bw(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 Bs(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=Gs(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 Ms(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 Lt(t,s,r,i,"exposed_functions"in e?e:void 0,o)}function Lt(n,e,t,r,i,o){return Os(n)?(Hi(e,n,t),n):qu(n,e,t,r,i,o)}function qu(n,e,t,r,i,o){if(e.isBool()){if(zs(n))return new F(n);if(pt(n)){if(n==="true")return new F(!0);if(n==="false")return new F(!1)}N("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);N("string | AccountAddress",t)}if(e.isU8()){let s=Dr(n);if(s!==void 0)return new Y(s);N("number | string",t)}if(e.isU16()){let s=Dr(n);if(s!==void 0)return new ve(s);N("number | string",t)}if(e.isU32()){let s=Dr(n);if(s!==void 0)return new Ke(s);N("number | string",t)}if(e.isU64()){if(Gr(n))return new H(BigInt(n));N("bigint | number | string",t)}if(e.isU128()){if(Gr(n))return new Re(BigInt(n));N("bigint | number | string",t)}if(e.isU256()){if(Gr(n))return new be(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 Lt(n,r[s],t,r,i)}if(e.isVector()){if(e.value.isU8()){if(pt(n))return E.U8(Hu.encode(n));if(n instanceof Uint8Array)return E.U8(n);if(n instanceof ArrayBuffer)return E.U8(new Uint8Array(n))}if(pt(n)&&n.startsWith("["))return Lt(JSON.parse(n),e,t,r);if(Array.isArray(n))return new E(n.map(s=>Lt(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 I(n);N("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);N("string | AccountAddress",t)}if(e.isDelegationKey()||e.isRateLimiter()){if(n instanceof Uint8Array)return new Ce(n);N("Uint8Array",t)}if(e.isOption()){if(Fs(n)){let a=e.value.typeArgs[0];return a instanceof q?new Z(null):a instanceof D?new Z(null):a instanceof fe?new Z(null):a instanceof nt?new Z(null):a instanceof rt?new Z(null):a instanceof X?new Z(null):a instanceof it?new Z(null):a instanceof ot?new Z(null):new Z(null)}return new Z(Lt(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(zi(e))return;N("Bool",t)}if(n.isAddress()){if(Br(e))return;N("AccountAddress",t)}if(n.isU8()){if(Oi(e))return;N("U8",t)}if(n.isU16()){if(Di(e))return;N("U16",t)}if(n.isU32()){if(Gi(e))return;N("U32",t)}if(n.isU64()){if(Bi(e))return;N("U64",t)}if(n.isU128()){if(Mi(e))return;N("U128",t)}if(n.isU256()){if(Vi(e))return;N("U256",t)}if(n.isVector()){if(e instanceof E){e.values.length>0&&Hi(n.value,e.values[0],t);return}N("MoveVector",t)}if(n instanceof h){if(n.isString()){if(Fi(e))return;N("MoveString",t)}if(n.isObject()){if(Br(e))return;N("AccountAddress",t)}if(n.isOption()){if(e instanceof Z){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 ju(n);let{moduleAddress:e,moduleName:t,functionName:r}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),i=await qs({key:"entry-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Bs});return Wu({...n,abi:i})}function Wu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.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,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 on(new Rn(c,new Un(a)))}return new rn(a)}async function Vs(n){let{moduleAddress:e,moduleName:t,functionName:r}=_chunk6MMUUJHXjs.pa.call(void 0, n.function),i=await qs({key:"view-function",moduleAddress:e,moduleName:t,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Ms});return Qu({abi:i,...n})}function Qu(n){let e=n.abi,{moduleAddress:t,moduleName:r,functionName:i}=_chunk6MMUUJHXjs.pa.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', _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 ju(n){return new nn(new sn(_chunk6MMUUJHXjs.j.fromHexInput(n.bytecode).toUint8Array(),Mr(n.typeArguments),n.functionArguments))}async function Ju(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()=>mi[e.network]?{chainId:mi[e.network]}:{chainId:(await Kr({aptosConfig:e})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _96 => _96.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await Fr({aptosConfig:e})).gas_estimate},c=async()=>{let ie=async()=>_optionalChain([i, 'optionalAccess', _97 => _97.accountSequenceNumber])!==void 0?i.accountSequenceNumber:_optionalChain([i, 'optionalAccess', _98 => _98.replayProtectionNonce])!==void 0?0xdeadbeefn:(await kr({aptosConfig:e,accountAddress:t})).sequence_number;if(o&&_chunk6MMUUJHXjs.ba.from(o).equals(_chunk6MMUUJHXjs.ba.ZERO))try{return await ie()}catch (e5){return 0}else return ie()},[{chainId:d},{gasEstimate:l},f]=await Promise.all([s(),a(),c()]),{maxGasAmount:p,gasUnitPrice:g,expireTimestamp:b,replayProtectionNonce:z}={maxGasAmount:_optionalChain([i, 'optionalAccess', _99 => _99.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(e.getDefaultMaxGasAmount()),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _100 => _100.gasUnitPrice]), () => (BigInt(l))),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},V=r;return z!==void 0&&(V=Xu(r,z)),new _e(_chunk6MMUUJHXjs.ba.from(t),BigInt(f),V,BigInt(p),BigInt(g),BigInt(b),new tn(d))}function Xu(n,e){if(n instanceof nn)return new Ft(new kn(n.script),new Ot(void 0,e));if(n instanceof rn)return new Ft(new cn(n.entryFunction),new Ot(void 0,e));if(n instanceof on){let t=n.multiSig.transaction_payload,r;if(t===void 0||_optionalChain([t, 'optionalAccess', _103 => _103.transaction_payload])===void 0)r=new Nn;else if(t.transaction_payload instanceof st)r=new cn(t.transaction_payload);else throw new Error("Scripts are not supported in multi-sig transactions.");return new Ft(r,new Ot(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 Ju({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 Er(s,a,n.feePayerAddress?_chunk6MMUUJHXjs.ba.from(n.feePayerAddress):void 0)}return new Sr(s,n.feePayerAddress?_chunk6MMUUJHXjs.ba.from(n.feePayerAddress):void 0)}function Hs(n){let{signerPublicKey:e,transaction:t,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=yn(e);if(t.feePayerAddress){let a=new Gt(t.rawTransaction,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),t.feePayerAddress),c=[];t.secondarySignerAddresses&&(r?c=r.map(f=>yn(f)):c=Array.from({length:t.secondarySignerAddresses.length},()=>yn(void 0)));let d=yn(i),l=new Vt(o,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),c,{address:t.feePayerAddress,authenticator:d});return new ct(a.raw_txn,l).bcsToBytes()}if(t.secondarySignerAddresses){let a=new Dt(t.rawTransaction,t.secondarySignerAddresses),c=[];r?c=r.map(l=>yn(l)):c=Array.from({length:t.secondarySignerAddresses.length},()=>yn(void 0));let d=new Mt(o,t.secondarySignerAddresses,c);return new ct(a.raw_txn,d).bcsToBytes()}let s;if(o instanceof Oe)s=new Bt(o.public_key,o.signature);else if(o instanceof ce||o instanceof $e)s=new Et(o);else if(o instanceof en)s=new Et(o);else throw new Error("Invalid public key");return new ct(t.rawTransaction,s).bcsToBytes()}function yn(n){if(!n)return new en;let t=U.isInstance(n)||Q.isInstance(n)||Ne.isInstance(n)?new K(n):n,r=new v(new Uint8Array(64));if(_.isInstance(t))return new Oe(t,r);if(K.isInstance(t))return U.isInstance(t.publicKey)?new ce(t,new O(ae.getSimulationSignature())):new ce(t,new O(r));if(ee.isInstance(t))return new $e(t,new Ee({signatures:t.publicKeys.map(i=>U.isInstance(i.publicKey)||Q.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 Wi(n){let{transaction:e,feePayerAuthenticator:t,additionalSignersAuthenticators:r}=n,i=Vo(J,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 Vt(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 Mt(i,e.secondarySignerAddresses,r)}else i instanceof Oe?o=new Bt(i.public_key,i.signature):i instanceof tt?o=new un(i.public_key,i.signature):o=new Et(i);return new ct(e.rawTransaction,o).bcsToBytes()}function Ls(n){let e=_sha3.sha3_256.create();for(let t of n)e.update(t);return e.digest()}var Yu=Ls(["APTOS::Transaction"]);function Ww(n){let e=Wi(n);return new (0, _chunk6MMUUJHXjs.j)(Ls([Yu,new Uint8Array([0]),e])).toString()}async function qs({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 w(n){let e=await Zu(n);return ed(n,e)}async function Zu(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 ed(n,e){let{aptosConfig:t,sender:r,options:i}=n,o;if(td(n)&&(o=_chunk6MMUUJHXjs.ba.ZERO.toString()),nd(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 td(n){return n.withFeePayer===!0}function nd(n){return"secondarySignerAddresses"in n}function $s(n){let{transaction:e}=n;return De(e)}function Lr(n){let{signer:e,transaction:t}=n;return e.signTransactionWithAuthenticator(t)}function qr(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,Lr({signer:e,transaction:t})}async function Qi(n){let{aptosConfig:e,transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=Hs({transaction:t,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Tt({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 Tt({aptosConfig:e,body:i,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return o}catch(o){let s=ct.deserialize(new C(i));throw s.authenticator.isSingleSender()&&s.authenticator.sender.isSingleKey()&&(s.authenticator.sender.public_key.publicKey instanceof U||s.authenticator.sender.public_key.publicKey instanceof Q)&&await he.fetchJWK({aptosConfig:e,publicKey:s.authenticator.sender.public_key.publicKey,kid:s.authenticator.sender.signature.signature.getJwkKid()}),o}}async function _t(n){let{aptosConfig:e,signer:t,feePayer:r,transaction:i,...o}=n;xr(t)&&await t.checkKeylessAccountValidity(e),xr(r)&&await r.checkKeylessAccountValidity(e);let s=n.feePayerAuthenticator||r&&qr({signer:r,transaction:i}),a=Lr({signer:t,transaction:i});return Dn({aptosConfig:e,transaction:i,senderAuthenticator:a,feePayerAuthenticator:s,...o})}async function Ws(n){let{aptosConfig:e,senderAuthenticator:t,feePayer:r,transaction:i,...o}=n;xr(r)&&await r.checkKeylessAccountValidity(e);let s=qr({signer:r,transaction:i});return Dn({aptosConfig:e,transaction:i,senderAuthenticator:t,feePayerAuthenticator:s,...o})}var rd={typeParameters:[],parameters:[R.u8(),new R(R.u8())]};async function Qs(n){let{aptosConfig:e,account:t,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>E.U8(a));return w({aptosConfig:e,sender:_chunk6MMUUJHXjs.ba.from(t),data:{function:"0x1::code::publish_package_txn",functionArguments:[E.U8(r),new E(s)],abi:rd},options:o})}async function mn(n){return kr(n)}async function js(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return hi({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 Js(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await gr({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 Vr(n){return _s(n)}async function Ji(n){let{aptosConfig:e,accountAddress:t,options:r}=n;return lr({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 hi({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 Xs(n){let{aptosConfig:e,accountAddress:t,options:r}=n,{response:i,cursor:o}=await gr({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 L({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 Gn(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 Nr({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 Ys(n){let{aptosConfig:e,accountAddress:t}=n,i={owner_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}},s=await S({aptosConfig:e,query:{query:us,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 Zs(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:as,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 S({aptosConfig:e,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function ea(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:cs,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 S({aptosConfig:e,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function ta(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:ss,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 S({aptosConfig:e,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function na(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await S({aptosConfig:e,query:{query:ds,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ra(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:os,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 S({aptosConfig:e,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function ia(n){let{aptosConfig:e,accountAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await S({aptosConfig:e,query:{query:is,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:vr,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 S({aptosConfig:e,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function oa(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _148 => _148.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 ut.fromPrivateKey({privateKey:t})}return o[0]}async function id(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 od={typeParameters:[],parameters:[new fe,R.u8(),new fe,R.u8(),R.u8(),R.u8()]};async function sa(n){let{aptosConfig:e,fromAccount:t,dangerouslySkipVerification:r,options:i}=n;if("toNewPrivateKey"in n)return ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toNewPrivateKey,options:i});let o;if("toAccount"in n){if(n.toAccount instanceof re)return ji({aptosConfig:e,fromAccount:t,toNewPrivateKey:n.toAccount.privateKey,options:i});if(n.toAccount instanceof ln)return ji({aptosConfig:e,fromAccount:t,toAccount:n.toAccount,options:i});o=n.toAccount.publicKey.authKey()}else if("toAuthKey"in n)o=n.toAuthKey;else throw new Error("Invalid arguments");let s=await ad({aptosConfig:e,fromAccount:t,toAuthKey:o,options:i});if(r===!0)return s;let a=await Pt({aptosConfig:e,transactionHash:s.hash});if(!a.success)throw new Error(`Failed to rotate authentication key - ${a}`);let c=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::set_originating_address",functionArguments:[]}});return _t({aptosConfig:e,signer:n.toAccount,transaction:c})}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=ut.fromPrivateKey({privateKey:n.toNewPrivateKey,legacy:!0}):o=n.toAccount;let a=new wr({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),l=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new Y(t.signingScheme),E.U8(t.publicKey.toUint8Array()),new Y(o.signingScheme),E.U8(o.publicKey.toUint8Array()),E.U8(c.toUint8Array()),E.U8(d.toUint8Array())],abi:od},options:r});return _t({aptosConfig:e,signer:t,transaction:l})}var sd={typeParameters:[],parameters:[R.u8()]};async function ad(n){let{aptosConfig:e,fromAccount:t,toAuthKey:r,options:i}=n,o=r,s=await w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::account::rotate_authentication_key_call",functionArguments:[E.U8(o.toUint8Array())],abi:sd},options:i});return _t({aptosConfig:e,signer:t,transaction:s})}async function Wr(n){let{aptosConfig:e,publicKey:t,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _150 => _150.noMultiKey]), () => (!1));if(i&&t instanceof ze)throw new Error("Multi-key accounts are not supported when noMultiKey is true.");let o=[t];t instanceof K&&t.publicKey instanceof _?o.push(t.publicKey):t instanceof _&&o.push(new K(t));let[s,a]=await Promise.all([Promise.all(o.map(async f=>{let p=await ld({aptosConfig:e,publicKey:f});if(p)return{...p,publicKey:f}})),!(t instanceof ze)&&!i?ud({aptosConfig:e,publicKey:t,options:r}):Promise.resolve([])]),c=[];for(let f of s)f&&c.push(f);o.push(...a);let d=new Map(o.map(f=>[f.authKey().toString(),f])),l=await dd({aptosConfig:e,authKeys:o.map(f=>f.authKey()),options:r});for(let f of l){if(c.find(g=>g.accountAddress===f.accountAddress))continue;let p=d.get(f.authKey.toString());if(!p)throw new Error(`No publicKey found for authentication key ${f.authKey}. This should never happen.`);c.push({accountAddress:f.accountAddress,publicKey:p,lastTransactionVersion:f.lastTransactionVersion})}return c.sort((f,p)=>p.lastTransactionVersion-f.lastTransactionVersion)}async function eo(n){let{aptosConfig:e,signer:t,options:r}=n;if(t instanceof W||t instanceof Ze)return $r({aptosConfig:e,privateKey:t,options:r});if(t instanceof re||t instanceof ue)return $r({aptosConfig:e,privateKey:t.privateKey,options:r});if(t instanceof xe||t instanceof Ge)return cd({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 ln&&t.signers.length===1)return $r({aptosConfig:e,privateKey:t.signers[0],options:r});throw new Error("Unknown signer type")}async function cd(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 ze){if(c.getSignaturesRequired()>1)continue;if(c instanceof Pe)throw new Error("Keyless authentication cannot be used for multi-ed25519 accounts. This should never happen.");c instanceof ee&&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 $r(n){let{aptosConfig:e,privateKey:t,options:r}=n,i=ut.fromPrivateKey({privateKey:t,legacy:!1}),o=await Wr({aptosConfig:e,publicKey:new K(t.publicKey()),options:r}),s=[];for(let{accountAddress:a,publicKey:c}of o)if(c instanceof ze){if(c.getSignaturesRequired()>1)continue;c instanceof Pe?s.push(new ln({publicKey:c,signers:[t],address:a})):c instanceof ee&&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 ud(n){let{aptosConfig:e,publicKey:t,options:r}=n;if(t instanceof ze)throw new Error("Public key is a multi-key.");let i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _151 => _151.includeUnverified]), () => (!1)),o=t instanceof K?t:new K(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:ps,variables:{where_condition:c}},{public_key_auth_keys:l}=await S({aptosConfig:e,query:d,originMethod:"getMultiKeysForPublicKey"});return l.map(p=>{switch(p.signature_type){case"multi_ed25519_signature":return Pe.deserializeWithoutLength(C.fromHex(p.account_public_key));case"multi_key_signature":return ee.deserialize(C.fromHex(p.account_public_key));default:throw new Error(`Unknown multi-signature type: ${p.signature_type}`)}})}async function dd(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:rs,variables:{where_condition:o,order_by:[{last_transaction_version:"desc"}]}},{auth_key_account_addresses:a}=await S({aptosConfig:e,query:s,originMethod:"getAccountAddressesForAuthKeys"});return a.map(c=>({authKey:new $({data:c.auth_key}),accountAddress:new (0, _chunk6MMUUJHXjs.ba)(_chunk6MMUUJHXjs.j.hexInputToUint8Array(c.account_address)),lastTransactionVersion:Number(c.last_transaction_version)}))}async function pd(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 ld(n){let{aptosConfig:e,publicKey:t}=n,r=t.authKey().derivedAddress(),[i,o]=await Promise.all([pd({aptosConfig:e,accountAddress:r}),id({aptosConfig:e,accountAddress:r,options:{withAuthKey:t.authKey()}})]);if(o)return{accountAddress:r,lastTransactionVersion:i}}async function T(n){n.minimumLedgerVersion!==void 0&&await Or({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}async function de(n){let{aptosConfig:e,payload:t,options:r}=n,i=await Vs({...t,aptosConfig:e}),o=new _chunk6MMUUJHXjs.m;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Tt({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 aa(n){let{aptosConfig:e,payload:t,options:r}=n,{data:i}=await Tt({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 ca(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunk6MMUUJHXjs.pa.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::add_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new D,new h(x()),new h(x())]}},options:i})}async function ua(n){let{aptosConfig:e,sender:t,authenticationFunction:r,options:i}=n,{moduleAddress:o,moduleName:s,functionName:a}=_chunk6MMUUJHXjs.pa.call(void 0, r);return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authentication_function",typeArguments:[],functionArguments:[o,s,a],abi:{typeParameters:[],parameters:[new D,new h(x()),new h(x())]}},options:i})}async function da(n){let{aptosConfig:e,sender:t,options:r}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::account_abstraction::remove_authenticator",typeArguments:[],functionArguments:[],abi:{typeParameters:[],parameters:[]}},options:r})}var qt=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 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 da({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:[_chunk6MMUUJHXjs.ba.from(t)],abi:{typeParameters:[],parameters:[new D],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 Bn=class{constructor(e){this.config=e;this.abstraction=new qt(e)}async getAccountInfo(e){return mn({aptosConfig:this.config,...e})}async getAccountModules(e){return js({aptosConfig:this.config,...e})}async getAccountModulesPage(e){return Js({aptosConfig:this.config,...e})}async getAccountModule(e){return Vr({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 Xs({aptosConfig:this.config,...e})}async getAccountResource(e){return Yi({aptosConfig:this.config,...e})}async lookupOriginalAccountAddress(e){return Gn({aptosConfig:this.config,...e})}async getAccountTokensCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),Ys({aptosConfig:this.config,...e})}async getAccountOwnedTokens(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Zs({aptosConfig:this.config,...e})}async getAccountOwnedTokensFromCollectionAddress(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ea({aptosConfig:this.config,...e})}async getAccountCollectionsWithOwnedTokens(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ta({aptosConfig:this.config,...e})}async getAccountTransactionsCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_transactions_processor"}),na({aptosConfig:this.config,...e})}async getAccountCoinsData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ra({aptosConfig:this.config,...e})}async getAccountCoinsCount(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"fungible_asset_processor"}),ia({aptosConfig:this.config,...e})}async getAccountAPTAmount(e){return this.getAccountCoinAmount({coinType:Ut,faMetadataAddress:Go,...e})}async getAccountCoinAmount(e){let{accountAddress:t,coinType:r,faMetadataAddress:i,minimumLedgerVersion:o}=e;o&&console.warn(`minimumLedgerVersion is not used anymore, here for backward
501
501
  compatibility see https://github.com/aptos-labs/aptos-ts-sdk/pull/519,
502
502
  will be removed in the near future`);let s=r;r===void 0&&i!==void 0&&(s=await He(async()=>{try{let d=(await de({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[i]}})).at(0);if(d.vec.length>0&&_chunk6MMUUJHXjs.oa.call(void 0, d.vec[0]))return _chunk6MMUUJHXjs.na.call(void 0, d.vec[0])}catch (e6){}},`coin-mapping-${i.toString()}`,1e3*60*5)());let a;if(r!==void 0&&i!==void 0)a=_chunk6MMUUJHXjs.ba.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===Ut?a=_chunk6MMUUJHXjs.ba.A.toStringLong():a=_chunk6MMUUJHXjs.ca.call(void 0, _chunk6MMUUJHXjs.ba.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=_chunk6MMUUJHXjs.ba.from(i);a=d.toStringLong(),d===_chunk6MMUUJHXjs.ba.A&&(s=Ut)}else throw new Error("Either coinType, faMetadataAddress, or both must be provided");if(s!==void 0){let[d]=await de({aptosConfig:this.config,payload:{function:"0x1::coin::balance",typeArguments:[s],functionArguments:[t]}});return parseInt(d,10)}let[c]=await de({aptosConfig:this.config,payload:{function:"0x1::primary_fungible_store::balance",typeArguments:["0x1::object::ObjectCore"],functionArguments:[t,a]}});return parseInt(c,10)}async getAccountOwnedObjects(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Zi({aptosConfig:this.config,...e})}async deriveAccountFromPrivateKey(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),oa({aptosConfig:this.config,...e})}async deriveOwnedAccountsFromSigner(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),eo({aptosConfig:this.config,...e})}async getAccountsForPublicKey(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"account_restoration_processor"}),await T({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 Qr=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 zo[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 No[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 li[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 gi[this.network];default:throw Error(`apiType ${e} is not supported`)}}isPepperServiceRequest(e){return li[this.network]===e}isProverServiceRequest(e){return gi[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 yd={typeParameters:[{constraints:[]}],parameters:[new D,new X]};async function pa(n){let{aptosConfig:e,sender:t,recipient:r,amount:i,coinType:o,options:s}=n;return w({aptosConfig:e,sender:t,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (Ut))],functionArguments:[r,i],abi:yd},options:s})}var Mn=class{constructor(e){this.config=e}async transferCoinTransaction(e){return pa({aptosConfig:this.config,...e})}};var xt={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 la(n){let{aptosConfig:e,digitalAssetAddress:t}=n,r={token_data_id:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};return(await S({aptosConfig:e,query:{query:Ss,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:_chunk6MMUUJHXjs.ba.from(t).toStringLong()},amount:{_gt:0}};return(await S({aptosConfig:e,query:{query:Ui,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:_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 S({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:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}},o={query:ws,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 S({aptosConfig:e,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var md={typeParameters:[],parameters:[new h(x()),new X,new h(x()),new h(x()),new q,new q,new q,new q,new q,new q,new q,new q,new q,new X,new X]};async function fa(n){let{aptosConfig:e,options:t,creator:r}=n;return w({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new I(n.description),new H(_nullishCoalesce(n.maxSupply, () => (_chunk6MMUUJHXjs.e))),new I(n.name),new I(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 H(_nullishCoalesce(n.royaltyNumerator, () => (0))),new H(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:md},options:t})}async function fn(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:gs,variables:{where_condition:r,offset:_optionalChain([t, 'optionalAccess', _190 => _190.offset]),limit:_optionalChain([t, 'optionalAccess', _191 => _191.limit])}};return(await S({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=_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"))}),fn({aptosConfig:e,options:{...i,where:s}})}async function ha(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"))}),fn({aptosConfig:e,options:{...r,where:o}})}async function Ta(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"))}),fn({aptosConfig:e,options:{...r,where:o}})}async function ba(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 fn({aptosConfig:i,options:{where:s}})).collection_id}var fd={typeParameters:[],parameters:[new h(x()),new h(x()),new h(x()),new h(x()),new R(new h(x())),new R(new h(x())),new R(R.u8())]};async function wa(n){let{aptosConfig:e,options:t,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:d,propertyValues:l}=n,f=_optionalChain([d, 'optionalAccess', _200 => _200.map, 'call', _201 => _201(p=>xt[p])]);return w({aptosConfig:e,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new I(i),new I(o),new I(s),new I(a),E.MoveString(_nullishCoalesce(c, () => ([]))),E.MoveString(_nullishCoalesce(f, () => ([]))),za(_nullishCoalesce(l, () => ([])),_nullishCoalesce(f, () => ([])))],abi:fd},options:t})}var Ad={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new D]};async function Sa(n){let{aptosConfig:e,sender:t,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(r),_chunk6MMUUJHXjs.ba.from(i)],abi:Ad},options:s})}var hd={typeParameters:[],parameters:[new h(x()),new h(x()),new h(x()),new h(x()),new R(new h(x())),new R(new h(x())),new R(R.u8()),new D]};async function Ea(n){let{aptosConfig:e,account:t,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:d,propertyValues:l,options:f}=n;if(_optionalChain([c, 'optionalAccess', _202 => _202.length])!==_optionalChain([l, 'optionalAccess', _203 => _203.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([d, 'optionalAccess', _204 => _204.length])!==_optionalChain([l, '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(g=>xt[g])]);return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,E.MoveString(_nullishCoalesce(c, () => ([]))),E.MoveString(_nullishCoalesce(p, () => ([]))),za(_nullishCoalesce(l, () => ([])),_nullishCoalesce(p, () => ([]))),a],abi:hd},options:f})}var Td={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0)))]};async function Pa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(r)],abi:Td},options:o})}var bd={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0)))]};async function _a(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Ie))],functionArguments:[r],abi:bd},options:o})}var wd={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0)))]};async function xa(n){let{aptosConfig:e,creator:t,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (Ie))],functionArguments:[r],abi:wd},options:o})}var Sd={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new h(x())]};async function Ia(n){let{aptosConfig:e,creator:t,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new I(r)],abi:Sd},options:s})}var Ed={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new h(x())]};async function Ca(n){let{aptosConfig:e,creator:t,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new I(r)],abi:Ed},options:s})}var Pd={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new h(x())]};async function va(n){let{aptosConfig:e,creator:t,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new I(r)],abi:Pd},options:s})}var _d={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new h(x()),new h(x()),R.u8()]};async function Ka(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new I(r),new I(xt[i]),E.U8(to(o,xt[i]))],abi:_d},options:c})}var xd={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new h(x())]};async function Ra(n){let{aptosConfig:e,creator:t,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(i),new I(r)],abi:xd},options:s})}var Id={typeParameters:[{constraints:["key"]}],parameters:[new h(Ae(new B(0))),new h(x()),new h(x()),R.u8()]};async function Ua(n){let{aptosConfig:e,creator:t,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (Ie))],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new I(r),new I(xt[i]),to(o,xt[i])],abi:Id},options:c})}var Cd={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new h(Ae(new B(0))),new h(x()),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 w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (Ie)),xt[i]],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new I(r),o],abi:Cd},options:c})}var vd={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new h(Ae(new B(0))),new h(x()),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 w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (Ie)),xt[i]],functionArguments:[_chunk6MMUUJHXjs.ba.from(s),new I(r),o],abi:vd},options:c})}function za(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 Lt(n,t,0,[]).bcsToBytes()}var Vn=class{constructor(e){this.config=e}async getCollectionData(e){await T({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"))}),fn({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Aa({aptosConfig:this.config,...e})}async getCollectionDataByCreatorAddress(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ha({aptosConfig:this.config,...e})}async getCollectionDataByCollectionId(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),Ta({aptosConfig:this.config,...e})}async getCollectionId(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ba({aptosConfig:this.config,...e})}async getDigitalAssetData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),la({aptosConfig:this.config,...e})}async getCurrentDigitalAssetOwnership(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ga({aptosConfig:this.config,...e})}async getOwnedDigitalAssets(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"token_v2_processor"}),ya({aptosConfig:this.config,...e})}async getDigitalAssetActivity(e){return await T({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 Ea({aptosConfig:this.config,...e})}async burnDigitalAssetTransaction(e){return Pa({aptosConfig:this.config,...e})}async freezeDigitalAssetTransaferTransaction(e){return _a({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})}};var Fa=300,Kd=n=>{if(n&&n.length>Fa)throw new Error(`Event type length exceeds the maximum length of ${Fa}`)};async function Oa(n){let{aptosConfig:e,eventType:t,options:r}=n,i={_or:[{account_address:{_eq:t.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:t}};return Hn({aptosConfig:e,options:{...r,where:i}})}async function Da(n){let{accountAddress:e,aptosConfig:t,creationNumber:r,options:i}=n,s={account_address:{_eq:_chunk6MMUUJHXjs.ba.from(e).toStringLong()},creation_number:{_eq:r}};return Hn({aptosConfig:t,options:{...i,where:s}})}async function Ga(n){let{accountAddress:e,aptosConfig:t,eventType:r,options:i}=n,s={account_address:{_eq:_chunk6MMUUJHXjs.ba.from(e).toStringLong()},indexed_type:{_eq:r}};return Hn({aptosConfig:t,options:{...i,where:s}})}async function Hn(n){let{aptosConfig:e,options:t}=n;Kd(_optionalChain([t, 'optionalAccess', _210 => _210.where, 'optionalAccess', _211 => _211.indexed_type, 'optionalAccess', _212 => _212._eq]));let r={query:fs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _213 => _213.where]),offset:_optionalChain([t, 'optionalAccess', _214 => _214.offset]),limit:_optionalChain([t, 'optionalAccess', _215 => _215.limit]),order_by:_optionalChain([t, 'optionalAccess', _216 => _216.orderBy])}};return(await S({aptosConfig:e,query:r,originMethod:"getEvents"})).events}var Ln=class{constructor(e){this.config=e}async getModuleEventsByEventType(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Oa({aptosConfig:this.config,...e})}async getAccountEventsByCreationNumber(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Da({aptosConfig:this.config,...e})}async getAccountEventsByEventType(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"events_processor"}),Ga({aptosConfig:this.config,...e})}async getEvents(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"events_processor"}),Hn({aptosConfig:this.config,...e})}};async function Ba(n){let{aptosConfig:e,accountAddress:t,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _218 => _218.timeoutSecs])||20,{data:s}=await qo({aptosConfig:e,path:"fund",body:{address:_chunk6MMUUJHXjs.ba.from(t).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Pt({aptosConfig:e,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _219 => _219.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var qn=class{constructor(e){this.config=e}async fundAccount(e){let t=await Ba({aptosConfig:this.config,...e});return(_optionalChain([e, 'access', _220 => _220.options, 'optionalAccess', _221 => _221.waitForIndexer])===void 0||_optionalChain([e, 'access', _222 => _222.options, 'optionalAccess', _223 => _223.waitForIndexer]))&&await Or({aptosConfig:this.config,minimumLedgerVersion:BigInt(t.version),processorType:"fungible_asset_processor"}),t}};async function jr(n){let{aptosConfig:e,options:t}=n,r={query:hs,variables:{where_condition:_optionalChain([t, 'optionalAccess', _224 => _224.where]),limit:_optionalChain([t, 'optionalAccess', _225 => _225.limit]),offset:_optionalChain([t, 'optionalAccess', _226 => _226.offset])}};return(await S({aptosConfig:e,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ma(n){let{aptosConfig:e,options:t}=n,r={query:As,variables:{where_condition:_optionalChain([t, 'optionalAccess', _227 => _227.where]),limit:_optionalChain([t, 'optionalAccess', _228 => _228.limit]),offset:_optionalChain([t, 'optionalAccess', _229 => _229.offset])}};return(await S({aptosConfig:e,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Va(n){let{aptosConfig:e,options:t}=n,r={query:ys,variables:{where_condition:_optionalChain([t, 'optionalAccess', _230 => _230.where]),limit:_optionalChain([t, 'optionalAccess', _231 => _231.limit]),offset:_optionalChain([t, 'optionalAccess', _232 => _232.offset])}};return(await S({aptosConfig:e,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Ha={typeParameters:[{constraints:[]}],parameters:[Be("0x1::object::Object"),new D,new X]};async function La(n){let{aptosConfig:e,sender:t,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:Ha},options:s})}async function qa(n){let{aptosConfig:e,sender:t,fromStore:r,toStore:i,amount:o,options:s}=n;return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::dispatchable_fungible_asset::transfer",typeArguments:["0x1::fungible_asset::FungibleStore"],functionArguments:[r,i,o],abi:Ha},options:s})}var $n=class{constructor(e){this.config=e}async getFungibleAssetMetadata(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _233 => _233.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),jr({aptosConfig:this.config,...e})}async getFungibleAssetMetadataByAssetType(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _234 => _234.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await jr({aptosConfig:this.config,options:{where:{asset_type:{_eq:e.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _235 => _235.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await jr({aptosConfig:this.config,options:{where:{creator_address:{_eq:_chunk6MMUUJHXjs.ba.from(e.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _236 => _236.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ma({aptosConfig:this.config,...e})}async getCurrentFungibleAssetBalances(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _237 => _237.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Va({aptosConfig:this.config,...e})}async transferFungibleAsset(e){return La({aptosConfig:this.config,...e})}async transferFungibleAssetBetweenStores(e){return qa({aptosConfig:this.config,...e})}};var Wn=class{constructor(e){this.config=e}async getLedgerInfo(){return Kr({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(e){return Ks({aptosConfig:this.config,...e})}async getBlockByHeight(e){return Rs({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 Es({aptosConfig:this.config,...e})}async queryIndexer(e){return S({aptosConfig:this.config,...e})}async getIndexerLastSuccessVersion(){return Rr({aptosConfig:this.config})}async getProcessorStatus(e){return Ur({aptosConfig:this.config,processorType:e})}};var $a=["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 Wa(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function It(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(!Wa(e))throw new Error(`${e} is not valid. ${$a}`);if(t&&!Wa(t))throw new Error(`${t} is not valid. ${$a}`);return{domainName:t||e,subdomainName:t?e:void 0}}function Qa(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 Rd="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",Ud={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Rd,custom:null,devnet:null};function lt(n){let e=Ud[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 ja(n){let{aptosConfig:e,name:t}=n,r=lt(e),{domainName:i,subdomainName:o}=It(t),s=await de({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 Ja(n){let{aptosConfig:e,expiration:t,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,d=lt(e),{domainName:l,subdomainName:f}=It(r),p=t.policy==="subdomain:independent"||t.policy==="subdomain:follow-domain";if(f&&!p)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(p&&!f)throw new Error(`Policy is set to ${t.policy} but no subdomain was provided`);if(t.policy==="domain"){let V=_nullishCoalesce(t.years, () => (1));if(V!==1)throw new Error("For now, names can only be registered for 1 year at a time");let Qe=V*31536e3;return await w({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[l,Qe,o,s]},options:a})}if(!f)throw new Error(`${t.policy} requires a subdomain to be provided.`);let g=await no({aptosConfig:e,name:l});if(!g)throw new Error("The domain does not exist");let b=t.policy==="subdomain:independent"?t.expirationDate:g;if(b>g)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await w({aptosConfig:e,sender:i.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[l,f,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}=It(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 Xa(n){let{aptosConfig:e,address:t}=n,r=lt(e),i=await de({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 Ya(n){let{aptosConfig:e,sender:t,name:r,options:i}=n,o=lt(e);if(!r)return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=It(r);return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Za(n){let{aptosConfig:e,name:t}=n,r=lt(e),{domainName:i,subdomainName:o}=It(t),s=await de({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 ec(n){let{aptosConfig:e,sender:t,name:r,address:i,options:o}=n,s=lt(e),{domainName:a,subdomainName:c}=It(r);return await w({aptosConfig:e,sender:t.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function tc(n){let{aptosConfig:e,name:t}=n,{domainName:r,subdomainName:i=""}=It(t),a=(await S({aptosConfig:e,query:{query:gn,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Qn(a)),Qa(a)?a:void 0}async function nc(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await ro({aptosConfig:e});return(await S({aptosConfig:e,originMethod:"getAccountNames",query:{query:gn,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}}}}})).current_aptos_names.map(Qn)}async function rc(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await ro({aptosConfig:e});return(await S({aptosConfig:e,originMethod:"getAccountDomains",query:{query:gn,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:{_eq:""}}}}})).current_aptos_names.map(Qn)}async function ic(n){let{aptosConfig:e,options:t,accountAddress:r}=n,i=await ro({aptosConfig:e});return(await S({aptosConfig:e,originMethod:"getAccountSubdomains",query:{query:gn,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]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Qn)}async function oc(n){let{aptosConfig:e,options:t,domain:r}=n;return(await S({aptosConfig:e,originMethod:"getDomainSubdomains",query:{query:gn,variables:{limit:_optionalChain([t, 'optionalAccess', _253 => _253.limit]),offset:_optionalChain([t, 'optionalAccess', _254 => _254.offset]),order_by:_optionalChain([t, 'optionalAccess', _255 => _255.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _256 => _256.options, 'optionalAccess', _257 => _257.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Qn).filter(Qa)}async function ro(n){let{aptosConfig:e}=n,t=lt(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 sc(n){let{aptosConfig:e,sender:t,name:r,years:i=1,options:o}=n,s=lt(e),a=i*31536e3,{domainName:c,subdomainName:d}=It(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 w({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 jn=class{constructor(e){this.config=e}async getOwnerAddress(e){return ja({aptosConfig:this.config,...e})}async getExpiration(e){return no({aptosConfig:this.config,...e})}async getTargetAddress(e){return Za({aptosConfig:this.config,...e})}async setTargetAddress(e){return ec({aptosConfig:this.config,...e})}async getPrimaryName(e){return Xa({aptosConfig:this.config,...e})}async setPrimaryName(e){return Ya({aptosConfig:this.config,...e})}async registerName(e){return Ja({aptosConfig:this.config,...e})}async renewDomain(e){return sc({aptosConfig:this.config,...e})}async getName(e){return tc({aptosConfig:this.config,...e})}async getAccountNames(e){return nc({aptosConfig:this.config,...e})}async getAccountDomains(e){return rc({aptosConfig:this.config,...e})}async getAccountSubdomains(e){return ic({aptosConfig:this.config,...e})}async getDomainSubdomains(e){return oc({aptosConfig:this.config,...e})}};async function ac(n){let{aptosConfig:e,poolAddress:t}=n,r=_chunk6MMUUJHXjs.ba.from(t).toStringLong(),o=await S({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 cc(n){let{aptosConfig:e,options:t}=n,r={query:Ki,variables:{order_by:_optionalChain([t, 'optionalAccess', _258 => _258.orderBy])}};return(await S({aptosConfig:e,query:r})).num_active_delegator_per_pool}async function uc(n){let{aptosConfig:e,delegatorAddress:t,poolAddress:r}=n,i={query:ms,variables:{delegatorAddress:_chunk6MMUUJHXjs.ba.from(t).toStringLong(),poolAddress:_chunk6MMUUJHXjs.ba.from(r).toStringLong()}};return(await S({aptosConfig:e,query:i})).delegated_staking_activities}var Jn=class{constructor(e){this.config=e}async getNumberOfDelegators(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _259 => _259.minimumLedgerVersion]),processorType:"stake_processor"}),ac({aptosConfig:this.config,...e})}async getNumberOfDelegatorsForAllPools(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _260 => _260.minimumLedgerVersion]),processorType:"stake_processor"}),cc({aptosConfig:this.config,...e})}async getDelegatedStakingActivities(e){return await T({config:this.config,minimumLedgerVersion:_optionalChain([e, 'optionalAccess', _261 => _261.minimumLedgerVersion]),processorType:"stake_processor"}),uc({aptosConfig:this.config,...e})}};var Xr=class{constructor(e){this.config=e}async simple(e){return w({aptosConfig:this.config,...e})}async multiAgent(e){return w({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 An=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],An.prototype,"simple",1),_chunk6MMUUJHXjs.a.call(void 0, [oo],An.prototype,"multiAgent",1);var Yr=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 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 _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 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 _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 hn=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(e){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _262 => _262.pendingDequeue, 'access', _263 => _263.shift, 'call', _264 => _264(), 'optionalAccess', _265 => _265.resolve, 'call', _266 => _266(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 Tn("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Tn=class extends Error{};var dc="fulfilled",pc= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(pc||{}),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=_t({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,t])}}catch(t){if(t instanceof Tn)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===dc?(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 Tn)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,r){try{let i=[];i.push(Pt({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===dc?(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 w({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 Xn=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 Ni({aptosConfig:this.config,...e})}async getTransactionByVersion(e){return Cs({aptosConfig:this.config,...e})}async getTransactionByHash(e){return Fn({aptosConfig:this.config,...e})}async isPendingTransaction(e){return vs({aptosConfig:this.config,...e})}async waitForTransaction(e){return Pt({aptosConfig:this.config,...e})}async getGasPriceEstimation(){return Fr({aptosConfig:this.config})}getSigningMessage(e){return $s(e)}async publishPackageTransaction(e){return Qs({aptosConfig:this.config,...e})}async rotateAuthKey(e){return sa({aptosConfig:this.config,...e})}sign(e){return Lr({...e})}signAsFeePayer(e){return qr({...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 _t({aptosConfig:this.config,...e})}async signAndSubmitAsFeePayer(e){return Ws({aptosConfig:this.config,...e})}};var Yn=class{constructor(e){this.config=e}async getTableItem(e){return Nr({aptosConfig:this.config,...e})}async getTableItemsData(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),xs({aptosConfig:this.config,...e})}async getTableItemsMetadata(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"default_processor"}),Is({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:_chunk6MMUUJHXjs.j.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await $o({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 ni(n),uidKey:o="sub",maxExpHorizonSecs:s=(await Yt({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 Wo({aptosConfig:e,path:"prove",body:c,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}}),l=d.proof,f=new bt({a:l.a,b:l.b,c:l.c});return new le({proof:new Xt(f,0),trainingWheelsSignature:Me.fromHex(d.training_wheels_signature),expHorizonSecs:s})}async function lc(n){let{aptosConfig:e,jwt:t,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await ni(n)}=n,{verificationKey:a,maxExpHorizonSecs:c}=await Yt({aptosConfig:e}),d=so({...n,pepper:s,maxExpHorizonSecs:c}),l=o?d:await d;if(r!==void 0){let g=Q.fromJwtAndPepper({jwt:t,pepper:s,jwkAddress:r,uidKey:i}),b=await Gn({aptosConfig:e,authenticationKey:g.authKey().derivedAddress()});return Ge.create({...n,address:b,proof:l,pepper:s,proofFetchCallback:o,jwkAddress:r,verificationKey:a})}let f=U.fromJwtAndPepper({jwt:t,pepper:s,uidKey:i}),p=await Gn({aptosConfig:e,authenticationKey:f.authKey().derivedAddress()});return xe.create({...n,address:p,proof:l,pepper:s,proofFetchCallback:o,verificationKey:a})}async function gc(n){let{aptosConfig:e,sender:t,iss:r,options:i}=n,{jwksUrl:o}=n;o===void 0&&(Mo.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}`,P.fromErrorType({type:14,details:`Failed to fetch JWKS at ${o}: ${d}`})}let a=await s.json();return w({aptosConfig:e,sender:t.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,E.MoveString(a.keys.map(c=>c.kid)),E.MoveString(a.keys.map(c=>c.alg)),E.MoveString(a.keys.map(c=>c.e)),E.MoveString(a.keys.map(c=>c.n))]},options:i})}var Zn=class{constructor(e){this.config=e}async getPepper(e){return ni({aptosConfig:this.config,...e})}async getProof(e){return so({aptosConfig:this.config,...e})}async deriveKeylessAccount(e){return lc({aptosConfig:this.config,...e})}async updateFederatedKeylessJwkSetTransaction(e){return gc({aptosConfig:this.config,...e})}};async function Fd(n){let{aptosConfig:e,options:t}=n,r={query:vr,variables:{where_condition:_optionalChain([t, 'optionalAccess', _267 => _267.where]),offset:_optionalChain([t, 'optionalAccess', _268 => _268.offset]),limit:_optionalChain([t, 'optionalAccess', _269 => _269.limit]),order_by:_optionalChain([t, 'optionalAccess', _270 => _270.orderBy])}};return(await S({aptosConfig:e,query:r,originMethod:"getObjectData"})).current_objects}async function yc(n){let{aptosConfig:e,objectAddress:t,options:r}=n,o={object_address:{_eq:_chunk6MMUUJHXjs.ba.from(t).toStringLong()}};return(await Fd({aptosConfig:e,options:{...r,where:o}}))[0]}var er=class{constructor(e){this.config=e}async getObjectDataByObjectAddress(e){return await T({config:this.config,minimumLedgerVersion:e.minimumLedgerVersion,processorType:"objects_processor"}),yc({aptosConfig:this.config,...e})}};var te=class{constructor(e){this.config=_nullishCoalesce(e, () => (new Qr)),this.account=new Bn(this.config),this.abstraction=new qt(this.config),this.ans=new jn(this.config),this.coin=new Mn(this.config),this.digitalAsset=new Vn(this.config),this.event=new Ln(this.config),this.faucet=new qn(this.config),this.fungibleAsset=new $n(this.config),this.general=new Wn(this.config),this.staking=new Jn(this.config),this.transaction=new Xn(this.config),this.table=new Yn(this.config),this.keyless=new Zn(this.config),this.object=new er(this.config)}setIgnoreTransactionSubmitter(e){this.config.setIgnoreTransactionSubmitter(e)}};function pe(n,e,t){Object.getOwnPropertyNames(e.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(e.prototype,r);i&&(i.value=function(...o){return this[t][r](...o)},Object.defineProperty(n.prototype,r,i))})}pe(te,Bn,"account");pe(te,qt,"abstraction");pe(te,jn,"ans");pe(te,Mn,"coin");pe(te,Vn,"digitalAsset");pe(te,Ln,"event");pe(te,qn,"faucet");pe(te,$n,"fungibleAsset");pe(te,Wn,"general");pe(te,Jn,"staking");pe(te,Xn,"transaction");pe(te,Yn,"table");pe(te,Zn,"keyless");pe(te,er,"object");exports.APTOS_BIP44_REGEX = Kc; exports.APTOS_COIN = Ut; exports.APTOS_FA = Go; exports.APTOS_HARDENED_REGEX = vc; exports.AbstractKeylessAccount = he; exports.AbstractMultiKey = ze; exports.AbstractPublicKey = ir; exports.AbstractSignature = En; exports.AbstractedAccount = Ir; exports.Account = ut; exports.AccountAddress = _chunk6MMUUJHXjs.ba; exports.AccountAuthenticator = J; exports.AccountAuthenticatorAbstraction = Nt; exports.AccountAuthenticatorEd25519 = Oe; exports.AccountAuthenticatorMultiEd25519 = tt; exports.AccountAuthenticatorMultiKey = $e; exports.AccountAuthenticatorNoAccountAuthenticator = en; exports.AccountAuthenticatorSingleKey = ce; exports.AccountAuthenticatorVariant = _chunk6MMUUJHXjs.z; exports.AccountPublicKey = se; exports.AccountSequenceNumber = Zr; exports.AccountUtils = es; exports.AddressInvalidReason = _chunk6MMUUJHXjs.aa; exports.AnyPublicKey = K; exports.AnyPublicKeyVariant = _chunk6MMUUJHXjs.B; exports.AnySignature = O; exports.AnySignatureVariant = _chunk6MMUUJHXjs.D; exports.Aptos = te; exports.AptosApiError = Se; exports.AptosApiType = jt; exports.AptosConfig = Qr; exports.AuthenticationKey = $; exports.Bool = F; exports.CKDPriv = vo; exports.ChainId = tn; exports.DEFAULT_MAX_GAS_AMOUNT = Oo; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Do; exports.DEFAULT_TXN_TIMEOUT_SEC = cr; exports.DerivableAbstractedAccount = ns; exports.DeriveScheme = _chunk6MMUUJHXjs.$; exports.Deserializer = C; exports.EPK_HORIZON_SECS = du; exports.Ed25519Account = re; exports.Ed25519PrivateKey = W; exports.Ed25519PublicKey = _; exports.Ed25519Signature = v; exports.EntryFunction = st; exports.EntryFunctionBytes = rr; exports.EphemeralCertificate = Jt; exports.EphemeralCertificateVariant = _chunk6MMUUJHXjs.G; exports.EphemeralKeyPair = Ht; exports.EphemeralPublicKey = ht; exports.EphemeralPublicKeyVariant = _chunk6MMUUJHXjs.E; exports.EphemeralSignature = Me; exports.EphemeralSignatureVariant = _chunk6MMUUJHXjs.F; exports.FIREBASE_AUTH_ISS_PATTERN = Mo; exports.FederatedKeylessAccount = Ge; exports.FederatedKeylessPublicKey = Q; exports.FeePayerRawTransaction = Gt; exports.FixedBytes = Ce; exports.Groth16ProofAndStatement = Si; exports.Groth16VerificationKey = Pi; exports.Groth16Zkp = bt; exports.HARDENED_OFFSET = xo; exports.Hex = _chunk6MMUUJHXjs.j; exports.HexInvalidReason = _chunk6MMUUJHXjs.i; exports.Identifier = k; exports.KeyType = Rc; exports.KeylessAccount = xe; exports.KeylessConfiguration = Ei; exports.KeylessError = P; exports.KeylessErrorCategory = nu; exports.KeylessErrorResolutionTip = ru; exports.KeylessErrorType = ur; exports.KeylessPublicKey = U; exports.KeylessSignature = ae; exports.MAX_AUD_VAL_BYTES = bi; exports.MAX_COMMITED_EPK_BYTES = fu; exports.MAX_EXTRA_FIELD_BYTES = yu; exports.MAX_ISS_VAL_BYTES = gu; exports.MAX_JWT_HEADER_B64_BYTES = mu; exports.MAX_UID_KEY_BYTES = pu; exports.MAX_UID_VAL_BYTES = lu; exports.MimeType = _chunk6MMUUJHXjs.q; exports.ModuleId = Kn; exports.MoveAbility = _chunk6MMUUJHXjs.X; exports.MoveFunctionVisibility = _chunk6MMUUJHXjs.W; exports.MoveJWK = _i; exports.MoveOption = Z; exports.MoveString = I; exports.MoveVector = E; exports.MultiAgentRawTransaction = Dt; exports.MultiAgentTransaction = Er; exports.MultiEd25519Account = ln; exports.MultiEd25519PublicKey = Pe; exports.MultiEd25519Signature = Fe; exports.MultiKey = ee; exports.MultiKeyAccount = dt; exports.MultiKeySignature = Ee; exports.MultiSig = Rn; exports.MultiSigTransactionPayload = Un; exports.Network = yi; exports.NetworkToChainId = mi; exports.NetworkToFaucetAPI = Fo; exports.NetworkToIndexerAPI = No; exports.NetworkToNetworkName = Jl; exports.NetworkToNodeAPI = zo; exports.NetworkToPepperAPI = li; exports.NetworkToProverAPI = gi; exports.ParsingError = _chunk6MMUUJHXjs.h; exports.PrivateKey = ft; exports.PrivateKeyVariants = _chunk6MMUUJHXjs.A; exports.ProcessorType = Je; exports.PublicKey = vt; exports.RAW_TRANSACTION_SALT = Bo; exports.RAW_TRANSACTION_WITH_DATA_SALT = fi; exports.RawTransaction = _e; exports.RawTransactionWithData = br; exports.RoleType = _chunk6MMUUJHXjs.Y; exports.RotationProofChallenge = wr; exports.Script = sn; exports.ScriptTransactionArgumentVariants = _chunk6MMUUJHXjs.s; exports.Secp256k1PrivateKey = Ze; exports.Secp256k1PublicKey = Ne; exports.Secp256k1Signature = et; exports.Serializable = _chunk6MMUUJHXjs.l; exports.Serialized = Sn; exports.Serializer = _chunk6MMUUJHXjs.m; exports.Signature = M; exports.SignedTransaction = ct; exports.SigningScheme = _chunk6MMUUJHXjs.Z; exports.SigningSchemeInput = _chunk6MMUUJHXjs._; exports.SimpleTransaction = Sr; exports.SingleKeyAccount = ue; exports.StructTag = We; exports.TransactionAndProof = _r; exports.TransactionAuthenticator = at; exports.TransactionAuthenticatorEd25519 = Bt; exports.TransactionAuthenticatorFeePayer = Vt; exports.TransactionAuthenticatorMultiAgent = Mt; exports.TransactionAuthenticatorMultiEd25519 = un; exports.TransactionAuthenticatorSingleSender = Et; exports.TransactionAuthenticatorVariant = _chunk6MMUUJHXjs.y; exports.TransactionExecutable = an; exports.TransactionExecutableEmpty = Nn; exports.TransactionExecutableEntryFunction = cn; exports.TransactionExecutableScript = kn; exports.TransactionExecutableVariants = _chunk6MMUUJHXjs.v; exports.TransactionExtraConfig = Tr; exports.TransactionExtraConfigV1 = Ot; exports.TransactionExtraConfigVariants = _chunk6MMUUJHXjs.w; exports.TransactionInnerPayload = hr; exports.TransactionInnerPayloadV1 = Ft; exports.TransactionInnerPayloadVariants = _chunk6MMUUJHXjs.u; exports.TransactionPayload = St; exports.TransactionPayloadEntryFunction = rn; exports.TransactionPayloadMultiSig = on; exports.TransactionPayloadScript = nn; exports.TransactionPayloadVariants = _chunk6MMUUJHXjs.t; exports.TransactionResponseType = _chunk6MMUUJHXjs.I; exports.TransactionVariants = _chunk6MMUUJHXjs.x; exports.TransactionWorker = ei; exports.TransactionWorkerEventsEnum = pc; exports.TypeTag = G; exports.TypeTagAddress = D; exports.TypeTagBool = q; exports.TypeTagGeneric = B; exports.TypeTagParserError = j; exports.TypeTagParserErrorType = Bu; exports.TypeTagReference = Ar; exports.TypeTagSigner = zt; exports.TypeTagStruct = h; exports.TypeTagU128 = it; exports.TypeTagU16 = nt; exports.TypeTagU256 = ot; exports.TypeTagU32 = rt; exports.TypeTagU64 = X; exports.TypeTagU8 = fe; exports.TypeTagVariants = _chunk6MMUUJHXjs.r; exports.TypeTagVector = R; exports.U128 = Re; exports.U16 = ve; exports.U256 = be; exports.U32 = Ke; exports.U64 = H; exports.U8 = Y; exports.ZeroKnowledgeSig = le; exports.ZkProof = Xt; exports.ZkpVariant = _chunk6MMUUJHXjs.H; exports.anyPublicKeyVariantToString = _chunk6MMUUJHXjs.C; exports.aptosCoinStructTag = xf; exports.aptosRequest = dr; exports.base64UrlDecode = _chunk6MMUUJHXjs.ja; exports.base64UrlToBytes = _chunk6MMUUJHXjs.ka; exports.bigIntToBytesLE = pi; exports.buildTransaction = $i; exports.bytesToBigIntLE = Kt; exports.checkOrConvertArgument = Lt; exports.convertAmountFromHumanReadableToOnChain = _chunk6MMUUJHXjs.la; exports.convertAmountFromOnChainToHumanReadable = _chunk6MMUUJHXjs.ma; exports.convertArgument = qi; exports.convertNumber = Dr; exports.convertPayloadToInnerPayload = Xu; exports.createObjectAddress = _chunk6MMUUJHXjs.ca; exports.createResourceAddress = _chunk6MMUUJHXjs.da; exports.createTokenAddress = _chunk6MMUUJHXjs.ea; exports.deriveKey = ci; exports.deriveTransactionType = Pr; exports.deserializeFromScriptArgument = _u; exports.deserializePublicKey = Im; exports.deserializeSignature = Cm; exports.ensureBoolean = _chunk6MMUUJHXjs.n; exports.fetchEntryFunctionAbi = Bs; exports.fetchFunctionAbi = Li; exports.fetchJWK = Ii; exports.fetchModuleAbi = Lu; exports.fetchMoveFunctionAbi = bw; exports.fetchViewFunctionAbi = Ms; exports.findFirstNonSignerArg = Gs; exports.floorToWholeHour = _chunk6MMUUJHXjs.ia; exports.generateRawTransaction = Ju; exports.generateSignedTransaction = Wi; exports.generateSignedTransactionForSimulation = Hs; exports.generateSigningMessage = wt; exports.generateSigningMessageForSerializable = BA; exports.generateSigningMessageForTransaction = De; exports.generateTransactionPayload = Hr; exports.generateTransactionPayloadWithABI = Wu; exports.generateUserTransactionHash = Ww; exports.generateViewFunctionPayload = Vs; exports.generateViewFunctionPayloadWithABI = Qu; exports.get = pr; exports.getAptosFullNode = L; exports.getAptosPepperService = Eg; exports.getAuthenticatorForSimulation = yn; exports.getErrorMessage = _chunk6MMUUJHXjs.ga; exports.getFunctionParts = _chunk6MMUUJHXjs.pa; exports.getIssAudAndUidVal = Ye; exports.getKeylessConfig = Yt; exports.getKeylessJWKs = bu; exports.getPageWithObfuscatedCursor = gr; exports.hashStrToField = Ve; exports.hashValues = Ls; exports.hexToAsciiString = _chunk6MMUUJHXjs.k; exports.isBcsAddress = Br; exports.isBcsBool = zi; exports.isBcsFixedBytes = Vu; exports.isBcsString = Fi; exports.isBcsU128 = Mi; exports.isBcsU16 = Di; exports.isBcsU256 = Vi; exports.isBcsU32 = Gi; exports.isBcsU64 = Bi; exports.isBcsU8 = Oi; exports.isBlockEpilogueTransactionResponse = _chunk6MMUUJHXjs.P; exports.isBlockMetadataTransactionResponse = _chunk6MMUUJHXjs.M; exports.isBool = zs; exports.isCanonicalEd25519Signature = kc; exports.isEd25519Signature = _chunk6MMUUJHXjs.Q; exports.isEmptyOption = Fs; exports.isEncodedEntryFunctionArgument = Os; exports.isEncodedStruct = _chunk6MMUUJHXjs.oa; exports.isFeePayerSignature = _chunk6MMUUJHXjs.T; exports.isGenesisTransactionResponse = _chunk6MMUUJHXjs.L; exports.isKeylessSigner = xr; exports.isLargeNumber = Gr; exports.isMultiAgentSignature = _chunk6MMUUJHXjs.S; exports.isMultiEd25519Signature = _chunk6MMUUJHXjs.U; exports.isNumber = Mu; exports.isPendingTransactionResponse = _chunk6MMUUJHXjs.J; exports.isScriptDataInput = Ds; 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 = or; exports.normalizeBundle = Vo; exports.nowInSeconds = _chunk6MMUUJHXjs.ha; exports.objectStructTag = Ae; exports.optionStructTag = If; exports.outOfRangeErrorMessage = _chunk6MMUUJHXjs.o; exports.padAndPackBytesWithLen = _n; exports.paginateWithCursor = lr; exports.paginateWithObfuscatedCursor = hi; exports.pairedFaMetadataAddress = _chunk6MMUUJHXjs.sa; exports.parseEncodedStruct = _chunk6MMUUJHXjs.na; exports.parseJwtHeader = Su; exports.parseTypeTag = Be; exports.poseidonHash = Rt; exports.post = xn; exports.postAptosFaucet = qo; exports.postAptosFullNode = Tt; exports.postAptosIndexer = Lo; exports.postAptosPepperService = $o; exports.postAptosProvingService = Wo; exports.promiseFulfilledStatus = dc; exports.request = su; exports.sleep = _chunk6MMUUJHXjs.fa; exports.splitPath = Ko; exports.standardizeTypeTags = Mr; exports.stringStructTag = x; exports.throwTypeMismatch = N; exports.truncateAddress = _chunk6MMUUJHXjs.ra; exports.validateNumberInRange = _chunk6MMUUJHXjs.p; exports.verifyKeylessSignature = xi; exports.verifyKeylessSignatureWithJwkAndConfig = yr;
503
503
  //# sourceMappingURL=index.js.map