@aptos-labs/ts-sdk 1.28.0-zeta.4 → 1.28.0-zeta.6

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 (163) hide show
  1. package/dist/common/index.js +23 -23
  2. package/dist/common/index.js.map +1 -1
  3. package/dist/esm/account/Account.mjs +1 -1
  4. package/dist/esm/account/Ed25519Account.mjs +1 -1
  5. package/dist/esm/account/EphemeralKeyPair.mjs +1 -1
  6. package/dist/esm/account/FederatedKeylessAccount.mjs +1 -1
  7. package/dist/esm/account/KeylessAccount.mjs +1 -1
  8. package/dist/esm/account/KeylessAccountCommon.mjs +1 -1
  9. package/dist/esm/account/MultiKeyAccount.mjs +1 -1
  10. package/dist/esm/account/SingleKeyAccount.mjs +1 -1
  11. package/dist/esm/account/index.mjs +1 -1
  12. package/dist/esm/api/account.mjs +1 -1
  13. package/dist/esm/api/ans.mjs +1 -1
  14. package/dist/esm/api/aptos.mjs +1 -1
  15. package/dist/esm/api/aptosConfig.mjs +1 -1
  16. package/dist/esm/api/coin.mjs +1 -1
  17. package/dist/esm/api/digitalAsset.mjs +1 -1
  18. package/dist/esm/api/event.mjs +1 -1
  19. package/dist/esm/api/faucet.mjs +1 -1
  20. package/dist/esm/api/fungibleAsset.mjs +1 -1
  21. package/dist/esm/api/general.mjs +1 -1
  22. package/dist/esm/api/index.mjs +1 -1
  23. package/dist/esm/api/keyless.mjs +1 -1
  24. package/dist/esm/api/object.mjs +1 -1
  25. package/dist/esm/api/staking.mjs +1 -1
  26. package/dist/esm/api/table.mjs +1 -1
  27. package/dist/esm/api/transaction.mjs +1 -1
  28. package/dist/esm/api/transactionSubmission/build.mjs +1 -1
  29. package/dist/esm/api/transactionSubmission/management.mjs +1 -1
  30. package/dist/esm/api/transactionSubmission/sign.mjs +1 -1
  31. package/dist/esm/api/transactionSubmission/simulate.mjs +1 -1
  32. package/dist/esm/api/transactionSubmission/submit.mjs +1 -1
  33. package/dist/esm/api/utils.mjs +1 -1
  34. package/dist/esm/{chunk-VBR46X5M.mjs → chunk-37FIIBIN.mjs} +2 -2
  35. package/dist/esm/{chunk-ETQA37EP.mjs → chunk-3EAKJRWQ.mjs} +2 -2
  36. package/dist/esm/{chunk-JRLMKLB3.mjs → chunk-3JVYQ4Q4.mjs} +2 -2
  37. package/dist/esm/{chunk-3QFDWOUG.mjs → chunk-5HWJ3SN4.mjs} +2 -2
  38. package/dist/esm/{chunk-VTEOS4PS.mjs → chunk-AE5KXM2X.mjs} +2 -2
  39. package/dist/esm/{chunk-5JRPODDO.mjs → chunk-C3EFD3E4.mjs} +2 -2
  40. package/dist/esm/{chunk-5VQK4F5X.mjs → chunk-C5JQQTMI.mjs} +2 -2
  41. package/dist/esm/{chunk-5VQK4F5X.mjs.map → chunk-C5JQQTMI.mjs.map} +1 -1
  42. package/dist/esm/{chunk-THSR4POE.mjs → chunk-DSNKW4Y4.mjs} +2 -2
  43. package/dist/esm/{chunk-QD7BJPKU.mjs → chunk-DUEJM5U3.mjs} +2 -2
  44. package/dist/esm/{chunk-WV7HZQ2V.mjs → chunk-EBLBUJDH.mjs} +2 -2
  45. package/dist/esm/{chunk-AGTINH7K.mjs → chunk-G6HZPSZ3.mjs} +2 -2
  46. package/dist/esm/{chunk-HQUG3XLS.mjs → chunk-GQ755AGC.mjs} +2 -2
  47. package/dist/esm/chunk-ILTQISCY.mjs +2 -0
  48. package/dist/esm/chunk-ILTQISCY.mjs.map +1 -0
  49. package/dist/esm/{chunk-LKN324IO.mjs → chunk-J3PN353M.mjs} +2 -2
  50. package/dist/esm/{chunk-OKEP5IEO.mjs → chunk-K5X5QPCY.mjs} +2 -2
  51. package/dist/esm/{chunk-FLNLQ7K5.mjs → chunk-MYRN7MDF.mjs} +2 -2
  52. package/dist/esm/{chunk-WBDJI34Y.mjs → chunk-N4YBJL4Q.mjs} +2 -2
  53. package/dist/esm/{chunk-GUVL374I.mjs → chunk-OKXCJKIJ.mjs} +2 -2
  54. package/dist/esm/{chunk-X26OHQZO.mjs → chunk-OVI2RY5L.mjs} +2 -2
  55. package/dist/esm/{chunk-MYF2VRVN.mjs → chunk-PBMXWRZG.mjs} +2 -2
  56. package/dist/esm/{chunk-IEH7ILF3.mjs → chunk-PEYLPXU6.mjs} +2 -2
  57. package/dist/esm/{chunk-YRXUBXIJ.mjs → chunk-PUFI54FB.mjs} +2 -2
  58. package/dist/esm/{chunk-ABAIELQE.mjs → chunk-QAB3YOEA.mjs} +2 -2
  59. package/dist/esm/{chunk-F7R7ICUR.mjs → chunk-QI3GT3PC.mjs} +2 -2
  60. package/dist/esm/{chunk-VZKENIJR.mjs → chunk-QUTP2ACU.mjs} +2 -2
  61. package/dist/esm/{chunk-7WCH4LAM.mjs → chunk-RJ2H6LNN.mjs} +2 -2
  62. package/dist/esm/{chunk-5MZJD6SA.mjs → chunk-RLGIYYI7.mjs} +2 -2
  63. package/dist/esm/{chunk-ASQ2YBOR.mjs → chunk-S7KCJQOA.mjs} +2 -2
  64. package/dist/esm/{chunk-KHYFJBKG.mjs → chunk-TJ5DAW2T.mjs} +2 -2
  65. package/dist/esm/{chunk-XUJXTPLV.mjs → chunk-U5TSZRK7.mjs} +2 -2
  66. package/dist/esm/{chunk-CUDIVR4U.mjs → chunk-UYYQZDVB.mjs} +2 -2
  67. package/dist/esm/{chunk-UEGCC3OP.mjs → chunk-VUS2FTNI.mjs} +2 -2
  68. package/dist/esm/{chunk-4X4ODN6K.mjs → chunk-VVWBJKEA.mjs} +2 -2
  69. package/dist/esm/{chunk-Z56T4OGM.mjs → chunk-W2KQ2TSH.mjs} +2 -2
  70. package/dist/esm/{chunk-HIJU5HEA.mjs → chunk-WP757NYZ.mjs} +2 -2
  71. package/dist/esm/{chunk-YTVABX3A.mjs → chunk-XJ2W4L5F.mjs} +2 -2
  72. package/dist/esm/{chunk-2XSLXHVJ.mjs → chunk-XLXMGNVW.mjs} +2 -2
  73. package/dist/esm/{chunk-HOQCND6F.mjs → chunk-YBZI6U43.mjs} +2 -2
  74. package/dist/esm/client/core.mjs +1 -1
  75. package/dist/esm/client/get.mjs +1 -1
  76. package/dist/esm/client/index.mjs +1 -1
  77. package/dist/esm/client/post.mjs +1 -1
  78. package/dist/esm/core/crypto/federatedKeyless.mjs +1 -1
  79. package/dist/esm/core/crypto/index.mjs +1 -1
  80. package/dist/esm/core/crypto/keyless.mjs +1 -1
  81. package/dist/esm/core/crypto/multiKey.mjs +1 -1
  82. package/dist/esm/core/crypto/singleKey.mjs +1 -1
  83. package/dist/esm/core/index.mjs +1 -1
  84. package/dist/esm/index.mjs +1 -1
  85. package/dist/esm/internal/account.mjs +1 -1
  86. package/dist/esm/internal/ans.mjs +1 -1
  87. package/dist/esm/internal/coin.mjs +1 -1
  88. package/dist/esm/internal/digitalAsset.mjs +1 -1
  89. package/dist/esm/internal/event.mjs +1 -1
  90. package/dist/esm/internal/faucet.mjs +1 -1
  91. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  92. package/dist/esm/internal/general.mjs +1 -1
  93. package/dist/esm/internal/keyless.mjs +1 -1
  94. package/dist/esm/internal/object.mjs +1 -1
  95. package/dist/esm/internal/staking.mjs +1 -1
  96. package/dist/esm/internal/table.mjs +1 -1
  97. package/dist/esm/internal/transaction.mjs +1 -1
  98. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  99. package/dist/esm/internal/view.mjs +1 -1
  100. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  101. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  102. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  103. package/dist/esm/transactions/index.mjs +1 -1
  104. package/dist/esm/transactions/instances/index.mjs +1 -1
  105. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  106. package/dist/esm/transactions/instances/multiAgentTransaction.mjs +1 -1
  107. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  108. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  109. package/dist/esm/transactions/instances/simpleTransaction.mjs +1 -1
  110. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  111. package/dist/esm/transactions/management/accountSequenceNumber.mjs +1 -1
  112. package/dist/esm/transactions/management/index.mjs +1 -1
  113. package/dist/esm/transactions/management/transactionWorker.mjs +1 -1
  114. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  115. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  116. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  117. package/dist/esm/transactions/transactionBuilder/signingMessage.mjs +1 -1
  118. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  119. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  120. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  121. package/dist/esm/utils/apiEndpoints.mjs +1 -1
  122. package/dist/esm/utils/index.mjs +1 -1
  123. package/package.json +1 -1
  124. package/src/internal/keyless.ts +3 -2
  125. package/src/utils/apiEndpoints.ts +1 -1
  126. package/dist/esm/chunk-45ILXL6K.mjs +0 -2
  127. package/dist/esm/chunk-45ILXL6K.mjs.map +0 -1
  128. /package/dist/esm/{chunk-VBR46X5M.mjs.map → chunk-37FIIBIN.mjs.map} +0 -0
  129. /package/dist/esm/{chunk-ETQA37EP.mjs.map → chunk-3EAKJRWQ.mjs.map} +0 -0
  130. /package/dist/esm/{chunk-JRLMKLB3.mjs.map → chunk-3JVYQ4Q4.mjs.map} +0 -0
  131. /package/dist/esm/{chunk-3QFDWOUG.mjs.map → chunk-5HWJ3SN4.mjs.map} +0 -0
  132. /package/dist/esm/{chunk-VTEOS4PS.mjs.map → chunk-AE5KXM2X.mjs.map} +0 -0
  133. /package/dist/esm/{chunk-5JRPODDO.mjs.map → chunk-C3EFD3E4.mjs.map} +0 -0
  134. /package/dist/esm/{chunk-THSR4POE.mjs.map → chunk-DSNKW4Y4.mjs.map} +0 -0
  135. /package/dist/esm/{chunk-QD7BJPKU.mjs.map → chunk-DUEJM5U3.mjs.map} +0 -0
  136. /package/dist/esm/{chunk-WV7HZQ2V.mjs.map → chunk-EBLBUJDH.mjs.map} +0 -0
  137. /package/dist/esm/{chunk-AGTINH7K.mjs.map → chunk-G6HZPSZ3.mjs.map} +0 -0
  138. /package/dist/esm/{chunk-HQUG3XLS.mjs.map → chunk-GQ755AGC.mjs.map} +0 -0
  139. /package/dist/esm/{chunk-LKN324IO.mjs.map → chunk-J3PN353M.mjs.map} +0 -0
  140. /package/dist/esm/{chunk-OKEP5IEO.mjs.map → chunk-K5X5QPCY.mjs.map} +0 -0
  141. /package/dist/esm/{chunk-FLNLQ7K5.mjs.map → chunk-MYRN7MDF.mjs.map} +0 -0
  142. /package/dist/esm/{chunk-WBDJI34Y.mjs.map → chunk-N4YBJL4Q.mjs.map} +0 -0
  143. /package/dist/esm/{chunk-GUVL374I.mjs.map → chunk-OKXCJKIJ.mjs.map} +0 -0
  144. /package/dist/esm/{chunk-X26OHQZO.mjs.map → chunk-OVI2RY5L.mjs.map} +0 -0
  145. /package/dist/esm/{chunk-MYF2VRVN.mjs.map → chunk-PBMXWRZG.mjs.map} +0 -0
  146. /package/dist/esm/{chunk-IEH7ILF3.mjs.map → chunk-PEYLPXU6.mjs.map} +0 -0
  147. /package/dist/esm/{chunk-YRXUBXIJ.mjs.map → chunk-PUFI54FB.mjs.map} +0 -0
  148. /package/dist/esm/{chunk-ABAIELQE.mjs.map → chunk-QAB3YOEA.mjs.map} +0 -0
  149. /package/dist/esm/{chunk-F7R7ICUR.mjs.map → chunk-QI3GT3PC.mjs.map} +0 -0
  150. /package/dist/esm/{chunk-VZKENIJR.mjs.map → chunk-QUTP2ACU.mjs.map} +0 -0
  151. /package/dist/esm/{chunk-7WCH4LAM.mjs.map → chunk-RJ2H6LNN.mjs.map} +0 -0
  152. /package/dist/esm/{chunk-5MZJD6SA.mjs.map → chunk-RLGIYYI7.mjs.map} +0 -0
  153. /package/dist/esm/{chunk-ASQ2YBOR.mjs.map → chunk-S7KCJQOA.mjs.map} +0 -0
  154. /package/dist/esm/{chunk-KHYFJBKG.mjs.map → chunk-TJ5DAW2T.mjs.map} +0 -0
  155. /package/dist/esm/{chunk-XUJXTPLV.mjs.map → chunk-U5TSZRK7.mjs.map} +0 -0
  156. /package/dist/esm/{chunk-CUDIVR4U.mjs.map → chunk-UYYQZDVB.mjs.map} +0 -0
  157. /package/dist/esm/{chunk-UEGCC3OP.mjs.map → chunk-VUS2FTNI.mjs.map} +0 -0
  158. /package/dist/esm/{chunk-4X4ODN6K.mjs.map → chunk-VVWBJKEA.mjs.map} +0 -0
  159. /package/dist/esm/{chunk-Z56T4OGM.mjs.map → chunk-W2KQ2TSH.mjs.map} +0 -0
  160. /package/dist/esm/{chunk-HIJU5HEA.mjs.map → chunk-WP757NYZ.mjs.map} +0 -0
  161. /package/dist/esm/{chunk-YTVABX3A.mjs.map → chunk-XJ2W4L5F.mjs.map} +0 -0
  162. /package/dist/esm/{chunk-2XSLXHVJ.mjs.map → chunk-XLXMGNVW.mjs.map} +0 -0
  163. /package/dist/esm/{chunk-HOQCND6F.mjs.map → chunk-YBZI6U43.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 _chunkHBPH2AD3js = require('./chunk-HBPH2AD3.js');var Cn=255,En=65535,Pe=4294967295,Ye=18446744073709551615n,Qt=340282366920938463463374607431768211455n,In=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var q=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(t){return this.deserializeBool()?this.deserialize(t):void 0}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<Pe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>Pe)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<e;i+=1)r.push(this.deserialize(t));return r}};var _utils = require('@noble/hashes/utils');var J=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var ga=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(ga||{}),g= exports.Hex =class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new J("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new J("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){throw new J(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromHexString(t)}static isValid(t){try{return n.fromHexString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _4 => _4.message])}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var l=class{bcsToBytes(){let t=new V;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},V= exports.Serializer =class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let i=new DataView(this.buffer,this.offset);t.apply(i,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){wr(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(Pe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Ye,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Qt,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}serializeOption(t){let e=t!==void 0;this.serializeBool(e),e&&t.serialize(this)}serializeOptionStr(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(t))}};_chunkHBPH2AD3js.a.call(void 0, [Je(0,Cn)],V.prototype,"serializeU8",1),_chunkHBPH2AD3js.a.call(void 0, [Je(0,En)],V.prototype,"serializeU16",1),_chunkHBPH2AD3js.a.call(void 0, [Je(0,Pe)],V.prototype,"serializeU32",1),_chunkHBPH2AD3js.a.call(void 0, [Je(BigInt(0),Ye)],V.prototype,"serializeU64",1),_chunkHBPH2AD3js.a.call(void 0, [Je(BigInt(0),Qt)],V.prototype,"serializeU128",1),_chunkHBPH2AD3js.a.call(void 0, [Je(BigInt(0),In)],V.prototype,"serializeU256",1),_chunkHBPH2AD3js.a.call(void 0, [Je(0,Pe)],V.prototype,"serializeU32AsUleb128",1);function wr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ma=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function De(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(ma(n,t,e))}function Je(n,t){return(e,r,i)=>{let o=i.value;return i.value=function(a){return De(a,n,t),o.apply(this,[a])},i}}var et=class n extends l{constructor(e){super();this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let i=e.deserializeFixedBytes(r);return new n(i)}};var Un=class n extends l{constructor(e){super();this.value=new et(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let i=et.deserialize(e,r);return new n(i.value)}};var Rn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(Rn||{}),wi= exports.TypeTagVariants =(m=>(m[m.Bool=0]="Bool",m[m.U8=1]="U8",m[m.U64=2]="U64",m[m.U128=3]="U128",m[m.Address=4]="Address",m[m.Signer=5]="Signer",m[m.Vector=6]="Vector",m[m.Struct=7]="Struct",m[m.U16=8]="U16",m[m.U32=9]="U32",m[m.U256=10]="U256",m[m.Reference=254]="Reference",m[m.Generic=255]="Generic",m))(wi||{}),Wt= exports.ScriptTransactionArgumentVariants =(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d[d.Serialized=9]="Serialized",d))(Wt||{}),Si= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Si||{}),xi= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(xi||{}),_i= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(_i||{}),Pi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Pi||{}),Kn= exports.AnyPublicKeyVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.Keyless=3]="Keyless",i[i.FederatedKeyless=4]="FederatedKeyless",i))(Kn||{}),vi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(vi||{}),Sr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(Sr||{}),Ci= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(Ci||{}),xr= exports.EphemeralCertificateVariant =(t=>(t[t.ZkProof=0]="ZkProof",t))(xr||{}),_r= exports.ZkpVariant =(t=>(t[t.Groth16=0]="Groth16",t))(_r||{}),Pr= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(Pr||{});function zu(n){return n.type==="pending_transaction"}function ku(n){return n.type==="user_transaction"}function Du(n){return n.type==="genesis_transaction"}function Bu(n){return n.type==="block_metadata_transaction"}function Gu(n){return n.type==="state_checkpoint_transaction"}function Fu(n){return n.type==="validator_transaction"}function Nu(n){return n.type==="block_epilogue_transaction"}function Ou(n){return"signature"in n&&n.signature==="ed25519_signature"}function Mu(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function qu(n){return n.type==="multi_agent_signature"}function Vu(n){return n.type==="fee_payer_signature"}function $u(n){return n.type==="multi_ed25519_signature"}var ya=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ya||{}),Ei= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(Ei||{}),fa= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(fa||{}),le= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(le||{}),vr= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(vr||{}),Ii= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Ii||{});var I=class n extends l{constructor(e){super();wr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},$= exports.U8 =class n extends l{constructor(e){super();De(e,0,Cn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},ge= exports.U16 =class n extends l{constructor(e){super();De(e,0,En),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},me= exports.U32 =class n extends l{constructor(e){super();De(e,0,Pe),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends l{constructor(e){super();De(e,BigInt(0),Ye),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},ye= exports.U128 =class n extends l{constructor(e){super();De(e,BigInt(0),Qt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},fe= exports.U256 =class n extends l{constructor(e){super();De(e,BigInt(0),In),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var h=class n extends l{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof $)){new jt(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&e.length===0)r=[];else if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=g.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(r.map(i=>new $(i)))}static U16(e){return new n(e.map(r=>new ge(r)))}static U32(e){return new n(e.map(r=>new me(r)))}static U64(e){return new n(e.map(r=>new O(r)))}static U128(e){return new n(e.map(r=>new ye(r)))}static U256(e){return new n(e.map(r=>new fe(r)))}static Bool(e){return new n(e.map(r=>new I(r)))}static MoveString(e){return new n(e.map(r=>new S(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1)o.push(r.deserialize(e));return new n(o)}},jt= exports.Serialized =class n extends l{constructor(e){super();this.value=g.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 r=new q(this.bcsToBytes());r.deserializeUleb128AsU32();let i=r.deserializeVector(e);return new h(i)}},S= exports.MoveString =class n extends l{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let i=new TextEncoder().encode(this.value);h.U8(i).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},L= exports.MoveOption =class n extends l{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new $(e):void 0)}static U16(e){return new n(e!=null?new ge(e):void 0)}static U32(e){return new n(e!=null?new me(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new ye(e):void 0)}static U256(e){return new n(e!=null?new fe(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new S(e):void 0)}static deserialize(e,r){let i=h.deserialize(e,r);return new n(i.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var ha=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(ha||{}),x=class x extends l{constructor(e){super();if(e.length!==x.LENGTH)throw new J("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(x.LENGTH);return new x(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new J("Hex string must start with a leading 0x.","leading_zero_x_required");let r=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new J(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new J(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new J("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new J("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let i;try{i=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(o){throw new J(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(i)}static from(e){return typeof e=="string"?x.fromString(e):e instanceof Uint8Array?new x(e):e}static fromStrict(e){return typeof e=="string"?x.fromStringStrict(e):e instanceof Uint8Array?new x(e):e}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,i)=>r===e.data[i])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4"),x.A=x.from("0xA");var u=x;var Be=class Be extends l{constructor(e){super();let{data:r}=e,i=g.fromHexInput(r);if(i.toUint8Array().length!==Be.LENGTH)throw new Error(`Authentication Key length should be ${Be.LENGTH}`);this.data=i}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Be.LENGTH);return new Be({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:r,input:i}=e,o=g.fromHexInput(i).toUint8Array(),s=new Uint8Array([...o,r]),a=_sha3.sha3_256.create();a.update(s);let c=a.digest();return new Be({data:c})}static fromPublicKeyAndScheme(e){let{publicKey:r}=e;return r.authKey()}static fromPublicKey(e){let{publicKey:r}=e;return r.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};Be.LENGTH=32;var D=Be;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ri = _interopRequireWildcard(_bip39);var Sa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,xa= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,_a= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(_a||{}),Ki= exports.HARDENED_OFFSET =2147483648;function zi(n){return xa.test(n)}function ki(n){return Sa.test(n)}var Cr=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Di= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return Cr(t,s)},Pa=n=>n.replace("'",""),Bi= exports.splitPath =n=>n.split("/").slice(1).map(Pa),zn= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Ri.mnemonicToSeedSync(t)};var tt=class extends l{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}},ee= exports.AccountPublicKey =class extends tt{};var B=class extends l{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}};var ft=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Er=[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 va(n){let t=n.toUint8Array().slice(32);for(let e=Er.length-1;e>=0;e-=1){if(t[e]<Er[e])return!0;if(t[e]>Er[e])return!1}return!1}var Ge=class Ge extends ee{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Ge.LENGTH)throw new Error(`PublicKey length should be ${Ge.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!va(i))return!1;let o=ft(r),s=g.fromHexInput(o).toUint8Array(),a=i.toUint8Array(),c=this.key.toUint8Array();return _ed25519.ed25519.verify(a,s,c)}authKey(){return D.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ge(r)}static isPublicKey(e){return e instanceof Ge}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===Ge.LENGTH}};Ge.LENGTH=32;var P=Ge,se=class se extends l{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==se.LENGTH)throw new Error(`PrivateKey length should be ${se.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new se(e)}static fromDerivationPath(e,r){if(!ki(e))throw new Error(`Invalid derivation path ${e}`);return se.fromDerivationPathInner(e,zn(r))}static fromDerivationPathInner(e,r,i=Ki){let{key:o,chainCode:s}=Cr(se.SLIP_0010_SEED,r),a=Bi(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,d)=>Di(p,d+i),{key:o,chainCode:s});return new se(c)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new P(e)}sign(e){let r=ft(e),i=g.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new C(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new se(r)}static isPrivateKey(e){return e instanceof se}};se.LENGTH=32,se.SLIP_0010_SEED="ed25519 seed";var W=se,At=class At extends B{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==At.LENGTH)throw new Error(`Signature length should be ${At.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new At(r)}};At.LENGTH=64;var C=At;var ae=class ae extends ee{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>ae.MAX_KEYS||r.length<ae.MIN_KEYS)throw new Error(`Must have between ${ae.MIN_KEYS} and ${ae.MAX_KEYS} public keys, inclusive`);if(i<ae.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${ae.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof nt))return!1;let o=[];for(let s=0;s<4;s+=1)for(let a=0;a<8;a+=1)if((i.bitmap[s]&1<<7-a)!==0){let p=s*8+a;o.push(p)}if(o.length!==i.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(o.length<this.threshold)throw new Error("Not enough signatures");for(let s=0;s<o.length;s+=1)if(!this.publicKeys[o[s]].verifySignature({message:r,signature:i.signatures[s]}))return!1;return!0}authKey(){return D.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*P.LENGTH+1);return this.publicKeys.forEach((r,i)=>{e.set(r.toUint8Array(),i*P.LENGTH)}),e[this.publicKeys.length*P.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r[r.length-1],o=[];for(let s=0;s<r.length-1;s+=P.LENGTH){let a=s;o.push(new P(r.subarray(a,a+P.LENGTH)))}return new ae({publicKeys:o,threshold:i})}};ae.MAX_KEYS=32,ae.MIN_KEYS=2,ae.MIN_THRESHOLD=1;var ht=ae,ne=class ne extends B{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ne.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=ne.createBitmap({bits:i});else{if(i.length!==ne.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ne.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*C.LENGTH+ne.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*C.LENGTH)}),e.set(this.bitmap,this.signatures.length*C.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r.subarray(r.length-4),o=[];for(let s=0;s<r.length-i.length;s+=C.LENGTH){let a=s;o.push(new C(r.subarray(a,a+C.LENGTH)))}return new ne({signatures:o,bitmap:i})}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(a>=ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ne.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");if(c>0&&a<=r[c-1])throw new Error("The bits need to be sorted in ascending order.");s.add(a);let p=Math.floor(a/8),d=o[p];d|=i>>a%8,o[p]=d}),o}};ne.MAX_SIGNATURES_SUPPORTED=32,ne.BITMAP_LEN=4;var nt=ne;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Fe=class Fe extends tt{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Fe.LENGTH)throw new Error(`PublicKey length should be ${Fe.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e,o=ft(r),s=g.fromHexInput(o).toUint8Array(),a=_sha3.sha3_256.call(void 0, s),c=i.toUint8Array();return _secp256k1.secp256k1.verify(c,a,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Fe(r)}static isPublicKey(e){return e instanceof Fe}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===Fe.LENGTH}};Fe.LENGTH=65;var ve=Fe,Te=class Te extends l{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Te.LENGTH)throw new Error(`PrivateKey length should be ${Te.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Te(e)}static fromDerivationPath(e,r){if(!zi(e))throw new Error(`Invalid derivation path ${e}`);return Te.fromDerivationPathInner(e,zn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new Te(i)}sign(e){let r=ft(e),i=g.fromHexInput(r),o=_sha3.sha3_256.call(void 0, i.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new Tt(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new ve(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Te(r)}static isPrivateKey(e){return e instanceof Te}};Te.LENGTH=32;var rt=Te,bt=class bt extends B{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==bt.LENGTH)throw new Error(`Signature length should be ${bt.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new bt(r)}};bt.LENGTH=64;var Tt=bt;var _jwtdecode = require('jwt-decode');var it=class n extends tt{constructor(e){super();let r=e.constructor.name;switch(r){case P.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:i}=e;return this.publicKey.verifySignature({message:r,signature:i.signature})}serialize(e){if(this.publicKey instanceof P)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}},we= exports.EphemeralSignature =class n extends B{constructor(e){super();let r=e.constructor.name;switch(r){case C.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=g.fromHexInput(e),i=new q(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof C)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(C.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var Ir=[_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],Ni=31,$a=16,Fi=($a-1)*Ni;function Bn(n,t){let r=new TextEncoder().encode(n);return La(r,t)}function La(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=Ur(n,t);return Zt(e)}function Ha(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=ja(n,t);return Qa(e)}function Ur(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return Ha(n,t).concat([BigInt(n.length)])}function Qa(n){if(n.length>Fi)throw new Error(`Can't pack more than ${Fi}. Was given ${n.length} bytes`);return Wa(n,Ni).map(t=>Xt(t))}function Wa(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Xt(n){let t=BigInt(0);for(let e=n.length-1;e>=0;e-=1)t=t<<BigInt(8)|BigInt(n[e]);return t}function Oi(n,t){let e=new Uint8Array(t);for(let r=0;r<t;r+=1)e[r]=Number(n&BigInt(255)),n>>=BigInt(8);return e}function ja(n,t){if(t<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let e=new Uint8Array(t);e.set(n);for(let r=n.length;r<t;r+=1)e[r]=0;return e}function Zt(n){if(n.length>Ir.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Ir.length}`);return Ir[n.length-1](n)}var Gn=class extends l{toString(){let t=this.bcsToBytes();return g.fromHexInput(t).toString()}};var wt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(wt||{}),Mi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,qi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Fn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ot= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Vi= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",$i= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Rr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ce= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(Ce||{});var Ae=class extends Error{constructor({apiType:e,aptosRequest:r,aptosResponse:i}){super(Xa({apiType:e,aptosRequest:r,aptosResponse:i}));this.name="AptosApiError",this.url=i.url,this.status=i.status,this.statusText=i.statusText,this.data=i.data,this.request=r}};function Xa({apiType:n,aptosRequest:t,aptosResponse:e}){let r=_optionalChain([e, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${t.method} ${_nullishCoalesce(e.url, () => (t.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([e, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${o}: ${e.data.errors[0].message}`:_optionalChain([e, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([e, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${o}: ${JSON.stringify(e.data)}`:`${o} status: ${e.statusText}(code:${e.status}) and response body: ${Za(e.data)}`}var Kr=400;function Za(n){let t=JSON.stringify(n);return t.length<=Kr?t:`truncated(original_size:${t.length}): ${t.slice(0,Kr/2)}...${t.slice(-Kr/2)}`}var Li="1.28.0";var Hi={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"},Qi= 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"},Wi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},zr= 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"},kr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://prover.keyless.testnet.aptoslabs.com/v0",devnet:"https://prover.keyless.devnet.aptoslabs.com/v0",local:"https://api.devnet.aptoslabs.com/keyless/prover/v0"},Dr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Dr||{}),Br= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},qd= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function ji(n,t){let e=t.bcsToBytes(),r=new q(e);return n.deserialize(r)}async function Ya(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Li}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function Nn(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Ya({...n,url:o},t.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a});if(e==="Indexer"){let c=a.data;if(c.errors)throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((e==="Pepper"||e==="Prover")&&a.status>=400)throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a})}async function Gr(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Nn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function H(n){let{aptosConfig:t}=n;return Gr({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([t, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function dl(n){return Gr({...n,type:"Pepper"})}async function St(n){let t=[],e,r=n.params;do{let i=await Gr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=i.headers["x-aptos-cursor"],delete i.headers,t.push(...i.data),r.start=e}while(e!=null);return t}async function Yt(n){let{type:t,originMethod:e,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,d=c.getRequestUrl(t);return Nn({url:d,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function Ne(n){let{aptosConfig:t}=n;return Yt({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([t, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function Xi(n){let{aptosConfig:t}=n;return Yt({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([t, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function Zi(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),Yt({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([e, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function Yi(n){return Yt({...n,type:"Pepper"})}async function Ji(n){return Yt({...n,type:"Prover"})}var Fr=new Map;function Oe(n,t,e){return async(...r)=>{if(Fr.has(t)){let{value:o,timestamp:s}=Fr.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return Fr.set(t,{value:i,timestamp:Date.now()}),i}}var Ml=1e7,ec= exports.MAX_AUD_VAL_BYTES =120,tc= exports.MAX_UID_KEY_BYTES =30,nc= exports.MAX_UID_VAL_BYTES =330,ql= exports.MAX_ISS_VAL_BYTES =120,Vl= exports.MAX_EXTRA_FIELD_BYTES =350,$l= exports.MAX_JWT_HEADER_B64_BYTES =300,Ll= exports.MAX_COMMITED_EPK_BYTES =93,Se=class Se extends ee{constructor(e,r){super();let i=g.fromHexInput(r).toUint8Array();if(i.length!==Se.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Se.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new V;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),D.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new Se(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new Se(r,i)}static isPublicKey(e){return e instanceof Se}static create(e){return eo(e),new Se(e.iss,eo(e))}static fromJwtAndPepper(e){let{jwt:r,pepper:i,uidKey:o="sub"}=e,s=_jwtdecode.jwtDecode.call(void 0, r),a=s.iss;if(typeof s.aud!="string")throw new Error("aud was not found or an array of values");let c=s.aud,p=s[o];return Se.create({iss:a,uidKey:o,uidVal:p,aud:c,pepper:i})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};Se.ID_COMMITMENT_LENGTH=32;var G=Se;function eo(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Xt(g.fromHexInput(i).toUint8Array()),Bn(r,ec),Bn(e,nc),Bn(t,tc)];return Oi(Zt(o),G.ID_COMMITMENT_LENGTH)}var Ie=class n extends B{constructor(e){super();let{jwtHeader:r,ephemeralCertificate:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.ephemeralCertificate=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let r=xt.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=it.deserialize(e),a=we.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:Number(o),ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new xt(new ce({proof:new Pt(new _t({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new it(new P(new Uint8Array(32))),ephemeralSignature:new we(new C(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},xt= exports.EphemeralCertificate =class n extends B{constructor(e,r){super();this.signature=e,this.variant=r}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(ce.deserialize(e),r);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},Ee=class n extends l{constructor(e){super();if(this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let r=e.deserializeFixedBytes(32);return new n(r)}},st=class n extends l{constructor(e){super();if(this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let r=e.deserializeFixedBytes(64);return new n(r)}},_t= exports.Groth16Zkp =class n extends Gn{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=new Ee(r),this.b=new st(i),this.c=new Ee(o)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let r=Ee.deserialize(e).bcsToBytes(),i=st.deserialize(e).bcsToBytes(),o=Ee.deserialize(e).bcsToBytes();return new n({a:r,b:i,c:o})}},Pt= exports.ZkProof =class n extends l{constructor(e,r){super();this.proof=e,this.variant=r}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(_t.deserialize(e),r);default:throw new Error(`Unknown variant index for ZkProof: ${r}`)}}},ce= exports.ZeroKnowledgeSig =class n extends B{constructor(e){super();let{proof:r,expHorizonSecs:i,trainingWheelsSignature:o,extraField:s,overrideAudVal:a}=e;this.proof=r,this.expHorizonSecs=i,this.trainingWheelsSignature=o,this.extraField=s,this.overrideAudVal=a}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new q(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let r=Pt.deserialize(e),i=Number(e.deserializeU64()),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(we);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}},Nr= exports.KeylessConfiguration =class n{constructor(t,e){this.verficationKey=t,this.maxExpHorizonSecs=e}static create(t,e){return new n(new Or({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2}),e)}},Or=class n{constructor(t){let{alphaG1:e,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=t;this.alphaG1=new Ee(e),this.betaG2=new st(r),this.deltaG2=new st(i),this.gammaAbcG1=[new Ee(o[0]),new Ee(o[1])],this.gammaG2=new st(s)}static fromGroth16VerificationKeyResponse(t){return new n({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2})}};async function to(n){let{aptosConfig:t}=n;return Oe(async()=>{let e=await rc(n),r=await ic(n);return Nr.create(r,Number(e.max_exp_horizon_secs))},`keyless-configuration-${t.network}`,1e3*60*5)()}async function rc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Configuration",{data:i}=await H({aptosConfig:t,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _50 => _50.ledgerVersion])}});return i.data}async function ic(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await H({aptosConfig:t,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _51 => _51.ledgerVersion])}});return i.data}var he=class n extends ee{constructor(e,r){super();this.jwkAddress=u.from(e),this.keylessPublicKey=r}authKey(){let e=new V;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),D.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=G.deserialize(e);return new n(r,i)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,G.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,G.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof u&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof G}};var k=class n extends ee{constructor(e){super();if(this.publicKey=e,e instanceof P)this.variant=0;else if(e instanceof ve)this.variant=1;else if(e instanceof G)this.variant=3;else if(e instanceof he)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return M.isInstance(i)?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return D.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=P.deserialize(e);break;case 1:i=ve.deserialize(e);break;case 3:i=G.deserialize(e);break;case 4:i=he.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new n(i)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof P}isSecp256k1PublicKey(){return this.publicKey instanceof ve}static isInstance(e){return"publicKey"in e&&"variant"in e}},M= exports.AnySignature =class n extends B{constructor(e){super();if(this.signature=e,e instanceof C)this.variant=0;else if(e instanceof Tt)this.variant=1;else if(e instanceof Ie)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=C.deserialize(e);break;case 1:i=Tt.deserialize(e);break;case 3:i=Ie.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(i)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function oc(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var vt=class n extends ee{constructor(e){super();let{publicKeys:r,signaturesRequired:i}=e;if(i<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<i)throw new Error(`Provided ${r.length} public keys is smaller than the ${i} required signatures`);this.publicKeys=r.map(o=>o instanceof k?o:new k(o)),this.signaturesRequired=i}verifySignature(e){throw new Error("not implemented")}authKey(){return D.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(k),i=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:i})}createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let p=Math.floor(a/8),d=o[p];d|=i>>a%8,o[p]=d}),o}getIndex(e){let r=e instanceof k?e:new k(e),i=this.publicKeys.findIndex(o=>o.toString()===r.toString());if(i!==-1)return i;throw new Error("Public key not found in MultiKey")}},re=class re extends B{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>re.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${re.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(s=>s instanceof M?s:new M(s)),!(i instanceof Uint8Array))this.bitmap=re.createBitmap({bits:i});else{if(i.length!==re.BITMAP_LEN)throw new Error(`"bitmap" length should be ${re.BITMAP_LEN}`);this.bitmap=i}let o=this.bitmap.reduce((s,a)=>s+oc(a),0);if(o!==this.signatures.length)throw new Error(`Expecting ${o} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=re.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${re.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),p=o[c];p|=i>>a%8,o[c]=p}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(M),i=e.deserializeBytes();return new re({signatures:r,bitmap:i})}};re.BITMAP_LEN=4,re.MAX_SIGNATURES_SUPPORTED=re.BITMAP_LEN*8;var at=re;var j=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return be.load(t);case 1:return On.load(t);case 2:return te.load(t);case 3:return ct.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof be}isMultiEd25519(){return this instanceof On}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof ct}},be= exports.AccountAuthenticatorEd25519 =class n extends j{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=P.deserialize(e),i=C.deserialize(e);return new n(r,i)}},On= exports.AccountAuthenticatorMultiEd25519 =class n extends j{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=ht.deserialize(e),i=nt.deserialize(e);return new n(r,i)}},te= exports.AccountAuthenticatorSingleKey =class n extends j{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=k.deserialize(e),i=M.deserialize(e);return new n(r,i)}},ct= exports.AccountAuthenticatorMultiKey =class n extends j{constructor(e,r){super();this.public_keys=e,this.signatures=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let r=vt.deserialize(e),i=at.deserialize(e);return new n(r,i)}};var Ct=class n extends l{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var R=class n extends l{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var Mr=(n,t)=>{let e=n.bcsToBytes(),r=typeof t=="string"?Buffer.from(t,"utf8"):t,i=new Uint8Array([...e,...r,254]);return new u(_sha3.sha3_256.call(void 0, i))},nm= exports.createResourceAddress =(n,t)=>{let e=n.bcsToBytes(),r=typeof t=="string"?Buffer.from(t,"utf8"):t,i=new Uint8Array([...e,...r,255]);return new u(_sha3.sha3_256.call(void 0, i))},rm= exports.createTokenAddress =(n,t,e)=>{let r=`${t}::${e}`;return Mr(n,r)};var Jt=class n extends l{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(r[0]),new R(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e);return new n(r,i)}};var K=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return F.load(t);case 1:return ue.load(t);case 2:return Q.load(t);case 3:return Ve.load(t);case 4:return X.load(t);case 5:return Et.load(t);case 6:return E.load(t);case 7:return y.load(t);case 8:return Me.load(t);case 9:return qe.load(t);case 10:return $e.load(t);case 255:return z.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof F}isAddress(){return this instanceof X}isGeneric(){return this instanceof z}isSigner(){return this instanceof Et}isVector(){return this instanceof E}isStruct(){return this instanceof y}isU8(){return this instanceof ue}isU16(){return this instanceof Me}isU32(){return this instanceof qe}isU64(){return this instanceof Q}isU128(){return this instanceof Ve}isU256(){return this instanceof $e}},F= exports.TypeTagBool =class n extends K{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},ue= exports.TypeTagU8 =class n extends K{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Me= exports.TypeTagU16 =class n extends K{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},qe= exports.TypeTagU32 =class n extends K{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Q= exports.TypeTagU64 =class n extends K{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},Ve= exports.TypeTagU128 =class n extends K{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},$e= exports.TypeTagU256 =class n extends K{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},X= exports.TypeTagAddress =class n extends K{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},Et= exports.TypeTagSigner =class n extends K{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},Mn= exports.TypeTagReference =class n extends K{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=K.deserialize(e);return new n(r)}},z= exports.TypeTagGeneric =class n extends K{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},E= exports.TypeTagVector =class n extends K{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ue)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=K.deserialize(e);return new n(r)}},y= exports.TypeTagStruct =class n extends K{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Ue.deserialize(e);return new n(r)}isTypeTag(e,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Ue= exports.StructTag =class n extends l{constructor(e,r,i,o){super();this.address=e,this.moduleName=r,this.name=i,this.typeArgs=o}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e),o=R.deserialize(e),s=e.deserializeVector(K);return new n(r,i,o,s)}};function vm(){return new Ue(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function v(){return new Ue(u.ONE,new R("string"),new R("String"),[])}function Cm(n){return new Ue(u.ONE,new R("option"),new R("Option"),[n])}function ie(n){return new Ue(u.ONE,new R("object"),new R("Object"),[n])}function sc(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return $.deserialize(n);case 1:return O.deserialize(n);case 2:return ye.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,$);case 5:return I.deserialize(n);case 6:return ge.deserialize(n);case 7:return me.deserialize(n);case 8:return fe.deserialize(n);case 9:return jt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var ut=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return en.load(t);case 2:return tn.load(t);case 3:return nn.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},en= exports.TransactionPayloadScript =class n extends ut{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=rn.deserialize(e);return new n(r)}},tn= exports.TransactionPayloadEntryFunction =class n extends ut{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=pt.deserialize(e);return new n(r)}},nn= exports.TransactionPayloadMultiSig =class n extends ut{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=on.deserialize(e);return new n(r)}},pt= exports.EntryFunction =class n{constructor(t,e,r,i){this.module_name=t,this.function_name=e,this.type_args=r,this.args=i}static build(t,e,r,i){return new n(Jt.fromStr(t),new R(e),r,i)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Jt.deserialize(t),r=R.deserialize(t),i=t.deserializeVector(K),o=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=t.deserializeUleb128AsU32(),p=Un.deserialize(t,c);s.push(p)}return new n(e,r,i,s)}},rn= exports.Script =class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(K),i=t.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=sc(t);o.push(a)}return new n(e,r,o)}},on= exports.MultiSig =class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=u.deserialize(t),r=t.deserializeBool(),i;return r&&(i=sn.deserialize(t)),new n(e,i)}},sn= exports.MultiSigTransactionPayload =class n extends l{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(pt.deserialize(e))}};var pe=class n extends l{constructor(e,r,i,o,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=i,this.max_gas_amount=o,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=e.deserializeU64(),o=ut.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=Ct.deserialize(e);return new n(r,i,o,s,a,c,p)}},qn= exports.RawTransactionWithData =class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return dt.load(t);case 1:return lt.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},dt= exports.MultiAgentRawTransaction =class n extends qn{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=pe.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},lt= exports.FeePayerRawTransaction =class n extends qn{constructor(e,r,i){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=i}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=pe.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Vn=class extends l{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new S("account");this.structName=new S("RotationProofChallenge");this.sequenceNumber=new O(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=h.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var Re=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return It.load(t);case 1:return qr.load(t);case 2:return Ut.load(t);case 3:return Rt.load(t);case 4:return Kt.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},It= exports.TransactionAuthenticatorEd25519 =class n extends Re{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=P.deserialize(e),i=C.deserialize(e);return new n(r,i)}},qr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Re{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=ht.deserialize(e),i=nt.deserialize(e);return new n(r,i)}},Ut= exports.TransactionAuthenticatorMultiAgent =class n extends Re{constructor(e,r,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=j.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(j);return new n(r,i,o)}},Rt= exports.TransactionAuthenticatorFeePayer =class n extends Re{constructor(e,r,i,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i,this.fee_payer=o}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=j.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(j),s=u.deserialize(e),a=j.deserialize(e),c={address:s,authenticator:a};return new n(r,i,o,c)}},Kt= exports.TransactionAuthenticatorSingleSender =class n extends Re{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=j.deserialize(e);return new n(r)}};var gt=class n extends l{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=pe.deserialize(e),i=Re.deserialize(e);return new n(r,i)}};var $n=class n extends l{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=pe.deserialize(e),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(r,o)}};var Ln=class n extends l{constructor(e,r,i){super();this.rawTransaction=e,this.feePayerAddress=i,this.secondarySignerAddresses=r}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=pe.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Vr(n){return n.feePayerAddress?new lt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new dt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function zt(n,t){let e=_sha3.sha3_256.create();if(!t.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${t}`);e.update(t);let r=e.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Fy(n){return zt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function kt(n){let t=Vr(n);return n.feePayerAddress?zt(t.bcsToBytes(),Rr):n.secondarySignerAddresses?zt(t.bcsToBytes(),Rr):zt(t.bcsToBytes(),$i)}var Dt=class n{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=W.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,i=W.fromDerivationPath(e,r);return new n({privateKey:i})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new be(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new be(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(kt(t))}};var Bt=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new k(e.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(t={}){let{scheme:e=0}=t,r;switch(e){case 0:r=W.generate();break;case 2:r=rt.generate();break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:r})}static fromDerivationPath(t){let{scheme:e=0,path:r,mnemonic:i}=t,o;switch(e){case 0:o=W.fromDerivationPath(r,i);break;case 2:o=rt.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:o})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new te(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new te(this.publicKey,this.signTransaction(t))}sign(t){return new M(this.privateKey.sign(t))}signTransaction(t){return this.sign(kt(t))}};var Le=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?Dt.generate():Bt.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:i=!0}=t;return e instanceof W&&i?new Dt({privateKey:e,address:r}):new Bt({privateKey:e,address:r})}static fromPrivateKeyAndAddress(t){return this.fromPrivateKey(t)}static fromDerivationPath(t){let{scheme:e=0,mnemonic:r,path:i,legacy:o=!0}=t;return e===0&&o?Dt.fromDerivationPath({mnemonic:r,path:i}):Bt.fromDerivationPath({scheme:e,mnemonic:r,path:i})}static authKey(t){let{publicKey:e}=t;return e.authKey()}verifySignature(t){return this.publicKey.verifySignature(t)}};var uc=1209600,Gt=class Gt extends l{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new it(r.publicKey()),this.expiryDateSecs=i||_chunkHBPH2AD3js.d.call(void 0, _chunkHBPH2AD3js.c.call(void 0, )+uc),this.blinder=o!==void 0?g.fromHexInput(o).toUint8Array():pc();let s=Ur(this.publicKey.bcsToBytes(),93);s.push(BigInt(this.expiryDateSecs)),s.push(Xt(this.blinder));let a=Zt(s);this.nonce=a.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=W.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let o=e.deserializeU64(),s=e.deserializeFixedBytes(31);return new Gt({privateKey:i,expiryDateSecs:Number(o),blinder:s})}static fromBytes(e){return Gt.deserialize(new q(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _52 => _52.scheme])){case 0:default:r=W.generate()}return new Gt({privateKey:r,expiryDateSecs:_optionalChain([e, 'optionalAccess', _53 => _53.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new we(this.privateKey.sign(e))}};Gt.BLINDER_LENGTH=31;var mt=Gt;function pc(){return _utils.randomBytes.call(void 0, mt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var an=class an extends l{constructor(e){super();let{address:r,ephemeralKeyPair:i,uidKey:o,uidVal:s,aud:a,pepper:c,proof:p,proofFetchCallback:d,jwt:T}=e;if(this.ephemeralKeyPair=i,this.publicKey=G.create(e),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=T,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof ce)this.proof=p;else{if(d===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async m=>{await d(m),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let w=g.fromHexInput(c).toUint8Array();if(w.length!==an.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${an.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let r=new M(this.sign(e)),i=new k(this.publicKey);return new te(i,r)}signTransactionWithAuthenticator(e){let r=new M(this.signTransaction(e)),i=new k(this.publicKey);return new te(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new Ie({jwtHeader:_chunkHBPH2AD3js.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new xt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=Vr(e),o=new $r(r,this.proof.proof).hash();return this.sign(o)}verifySignature(e){let{message:r,signature:i}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:r,signature:i.ephemeralSignature}))}};an.PEPPER_LENGTH=31;var He=an,$r= exports.TransactionAndProof =class extends l{constructor(e,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=e,this.proof=r}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}hash(){return zt(this.bcsToBytes(),this.domainSeparator)}};var Qe=class n extends He{constructor(t){super(t)}serialize(t){if(t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(t)}static deserialize(t){let e=t.deserializeStr(),r=t.deserializeStr(),i=t.deserializeFixedBytes(31),o=mt.deserialize(t),s=ce.deserialize(t);return n.create({proof:s,pepper:i,uidKey:r,jwt:e,ephemeralKeyPair:o})}static fromBytes(t){return n.deserialize(new q(t))}static create(t){let{address:e,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=t,p=_jwtdecode.jwtDecode.call(void 0, i),d=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let T=p.aud,w=p[a];return new n({address:e,proof:r,ephemeralKeyPair:o,iss:d,uidKey:a,uidVal:w,aud:T,pepper:s,jwt:i,proofFetchCallback:c})}};var Hn=class n extends He{constructor(e){super(e);this.publicKey=he.create(e)}serialize(e){if(this.proof===void 0)throw new Error("Connot serialize - proof undefined");e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.publicKey.jwkAddress.serialize(e),this.ephemeralKeyPair.serialize(e),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeFixedBytes(31),s=u.deserialize(e),a=mt.deserialize(e),c=ce.deserialize(e);return n.create({proof:c,pepper:o,jwkAddress:s,uidKey:i,jwt:r,ephemeralKeyPair:a})}static fromBytes(e){return n.deserialize(new q(e))}static create(e){let{address:r,proof:i,jwt:o,ephemeralKeyPair:s,pepper:a,jwkAddress:c,uidKey:p="sub",proofFetchCallback:d}=e,T=_jwtdecode.jwtDecode.call(void 0, o),w=T.iss;if(typeof T.aud!="string")throw new Error("aud was not found or an array of values");let m=T.aud,_=T[p];return new n({address:r,proof:i,ephemeralKeyPair:s,iss:w,uidKey:p,uidVal:_,aud:m,pepper:a,jwkAddress:u.from(c),jwt:o,proofFetchCallback:d})}};var Qn=class n{constructor(t){let{multiKey:e,signers:r,address:i}=t;this.publicKey=e,this.signingScheme=3,this.accountAddress=i?u.from(i):this.publicKey.authKey().derivedAddress();let o=[];for(let a of r)o.push(this.publicKey.getIndex(a.publicKey));let s=r.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(t){let{publicKeys:e,signaturesRequired:r,signers:i}=t,o=new vt({publicKeys:e,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(t){return t instanceof n}signWithAuthenticator(t){return new ct(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new ct(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let e=this.signers.filter(r=>r instanceof Qe).map(async r=>r.waitForProofFetch());await Promise.all(e)}sign(t){let e=[];for(let r of this.signers)e.push(r.sign(t));return new at({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new at({signatures:e,bitmap:this.signaturesBitmap})}verifySignature(t){let{message:e,signature:r}=t;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:e,signature:s}))return!1}return!0}};var mc=`
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 _chunkHBPH2AD3js = require('./chunk-HBPH2AD3.js');var Cn=255,En=65535,Pe=4294967295,Ye=18446744073709551615n,Qt=340282366920938463463374607431768211455n,In=115792089237316195423570985008687907853269984665640564039457584007913129639935n;var q=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}remaining(){return this.buffer.byteLength-this.offset}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeOptionStr(){return this.deserializeBool()?this.deserializeStr():void 0}deserializeOption(t){return this.deserializeBool()?this.deserialize(t):void 0}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<Pe;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>Pe)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),r=new Array;for(let i=0;i<e;i+=1)r.push(this.deserialize(t));return r}};var _utils = require('@noble/hashes/utils');var J=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var la=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(la||{}),g= exports.Hex =class n{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromHexString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new J("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new J("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){throw new J(`Hex string contains invalid hex characters: ${_optionalChain([r, 'optionalAccess', _2 => _2.message])}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromHexString(t)}static isValid(t){try{return n.fromHexString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:_optionalChain([e, 'optionalAccess', _3 => _3.invalidReason]),invalidReasonMessage:_optionalChain([e, 'optionalAccess', _4 => _4.message])}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var l=class{bcsToBytes(){let t=new V;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},V= exports.Serializer =class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,r){this.ensureBufferWillHandleSize(e);let i=new DataView(this.buffer,this.offset);t.apply(i,[0,r,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){wr(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(Pe),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Ye,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Qt,r=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(r)}serializeU32AsUleb128(t){let e=t,r=[];for(;e>>>7;)r.push(e&127|128),e>>>=7;r.push(e),this.appendToBuffer(new Uint8Array(r))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}serializeOption(t){let e=t!==void 0;this.serializeBool(e),e&&t.serialize(this)}serializeOptionStr(t){t===void 0?this.serializeU32AsUleb128(0):(this.serializeU32AsUleb128(1),this.serializeStr(t))}};_chunkHBPH2AD3js.a.call(void 0, [Je(0,Cn)],V.prototype,"serializeU8",1),_chunkHBPH2AD3js.a.call(void 0, [Je(0,En)],V.prototype,"serializeU16",1),_chunkHBPH2AD3js.a.call(void 0, [Je(0,Pe)],V.prototype,"serializeU32",1),_chunkHBPH2AD3js.a.call(void 0, [Je(BigInt(0),Ye)],V.prototype,"serializeU64",1),_chunkHBPH2AD3js.a.call(void 0, [Je(BigInt(0),Qt)],V.prototype,"serializeU128",1),_chunkHBPH2AD3js.a.call(void 0, [Je(BigInt(0),In)],V.prototype,"serializeU256",1),_chunkHBPH2AD3js.a.call(void 0, [Je(0,Pe)],V.prototype,"serializeU32AsUleb128",1);function wr(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var ga=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function De(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(ga(n,t,e))}function Je(n,t){return(e,r,i)=>{let o=i.value;return i.value=function(a){return De(a,n,t),o.apply(this,[a])},i}}var et=class n extends l{constructor(e){super();this.value=g.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,r){let i=e.deserializeFixedBytes(r);return new n(i)}};var Un=class n extends l{constructor(e){super();this.value=new et(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let i=et.deserialize(e,r);return new n(i.value)}};var Rn=(i=>(i.JSON="application/json",i.BCS="application/x-bcs",i.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",i.BCS_VIEW_FUNCTION="application/x.aptos.view_function+bcs",i))(Rn||{}),wi= exports.TypeTagVariants =(m=>(m[m.Bool=0]="Bool",m[m.U8=1]="U8",m[m.U64=2]="U64",m[m.U128=3]="U128",m[m.Address=4]="Address",m[m.Signer=5]="Signer",m[m.Vector=6]="Vector",m[m.Struct=7]="Struct",m[m.U16=8]="U16",m[m.U32=9]="U32",m[m.U256=10]="U256",m[m.Reference=254]="Reference",m[m.Generic=255]="Generic",m))(wi||{}),Wt= exports.ScriptTransactionArgumentVariants =(d=>(d[d.U8=0]="U8",d[d.U64=1]="U64",d[d.U128=2]="U128",d[d.Address=3]="Address",d[d.U8Vector=4]="U8Vector",d[d.Bool=5]="Bool",d[d.U16=6]="U16",d[d.U32=7]="U32",d[d.U256=8]="U256",d[d.Serialized=9]="Serialized",d))(Wt||{}),Si= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Si||{}),xi= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(xi||{}),_i= exports.TransactionAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.MultiAgent=2]="MultiAgent",o[o.FeePayer=3]="FeePayer",o[o.SingleSender=4]="SingleSender",o))(_i||{}),Pi= exports.AccountAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(Pi||{}),Kn= exports.AnyPublicKeyVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.Secp256k1=1]="Secp256k1",i[i.Keyless=3]="Keyless",i[i.FederatedKeyless=4]="FederatedKeyless",i))(Kn||{}),vi= exports.AnySignatureVariant =(r=>(r[r.Ed25519=0]="Ed25519",r[r.Secp256k1=1]="Secp256k1",r[r.Keyless=3]="Keyless",r))(vi||{}),Sr= exports.EphemeralPublicKeyVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(Sr||{}),Ci= exports.EphemeralSignatureVariant =(t=>(t[t.Ed25519=0]="Ed25519",t))(Ci||{}),xr= exports.EphemeralCertificateVariant =(t=>(t[t.ZkProof=0]="ZkProof",t))(xr||{}),_r= exports.ZkpVariant =(t=>(t[t.Groth16=0]="Groth16",t))(_r||{}),Pr= exports.TransactionResponseType =(a=>(a.Pending="pending_transaction",a.User="user_transaction",a.Genesis="genesis_transaction",a.BlockMetadata="block_metadata_transaction",a.StateCheckpoint="state_checkpoint_transaction",a.Validator="validator_transaction",a.BlockEpilogue="block_epilogue_transaction",a))(Pr||{});function Ku(n){return n.type==="pending_transaction"}function zu(n){return n.type==="user_transaction"}function ku(n){return n.type==="genesis_transaction"}function Du(n){return n.type==="block_metadata_transaction"}function Bu(n){return n.type==="state_checkpoint_transaction"}function Gu(n){return n.type==="validator_transaction"}function Fu(n){return n.type==="block_epilogue_transaction"}function Nu(n){return"signature"in n&&n.signature==="ed25519_signature"}function Ou(n){return"signature"in n&&n.signature==="secp256k1_ecdsa_signature"}function Mu(n){return n.type==="multi_agent_signature"}function qu(n){return n.type==="fee_payer_signature"}function Vu(n){return n.type==="multi_ed25519_signature"}var ma=(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ma||{}),Ei= exports.MoveAbility =(i=>(i.STORE="store",i.DROP="drop",i.KEY="key",i.COPY="copy",i))(Ei||{}),ya= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(ya||{}),le= exports.SigningScheme =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.SingleKey=2]="SingleKey",i[i.MultiKey=3]="MultiKey",i))(le||{}),vr= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(vr||{}),Ii= exports.DeriveScheme =(o=>(o[o.DeriveAuid=251]="DeriveAuid",o[o.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",o[o.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",o[o.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",o[o.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",o))(Ii||{});var I=class n extends l{constructor(e){super();wr(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new n(e.deserializeBool())}},$= exports.U8 =class n extends l{constructor(e){super();De(e,0,Cn),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new n(e.deserializeU8())}},ge= exports.U16 =class n extends l{constructor(e){super();De(e,0,En),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new n(e.deserializeU16())}},me= exports.U32 =class n extends l{constructor(e){super();De(e,0,Pe),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new n(e.deserializeU32())}},O= exports.U64 =class n extends l{constructor(e){super();De(e,BigInt(0),Ye),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new n(e.deserializeU64())}},ye= exports.U128 =class n extends l{constructor(e){super();De(e,BigInt(0),Qt),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new n(e.deserializeU128())}},fe= exports.U256 =class n extends l{constructor(e){super();De(e,BigInt(0),In),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new n(e.deserializeU256())}};var h=class n extends l{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(this.values[0]!==void 0&&!(this.values[0]instanceof $)){new jt(this.bcsToBytes()).serializeForScriptFunction(e);return}e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&e.length===0)r=[];else if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let i=g.fromHexInput(e);r=Array.from(i.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type, must be an number[], Uint8Array, or hex string");return new n(r.map(i=>new $(i)))}static U16(e){return new n(e.map(r=>new ge(r)))}static U32(e){return new n(e.map(r=>new me(r)))}static U64(e){return new n(e.map(r=>new O(r)))}static U128(e){return new n(e.map(r=>new ye(r)))}static U256(e){return new n(e.map(r=>new fe(r)))}static Bool(e){return new n(e.map(r=>new I(r)))}static MoveString(e){return new n(e.map(r=>new S(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let i=e.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1)o.push(r.deserialize(e));return new n(o)}},jt= exports.Serialized =class n extends l{constructor(e){super();this.value=g.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 r=new q(this.bcsToBytes());r.deserializeUleb128AsU32();let i=r.deserializeVector(e);return new h(i)}},S= exports.MoveString =class n extends l{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let i=new TextEncoder().encode(this.value);h.U8(i).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},L= exports.MoveOption =class n extends l{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new h([e]):this.vec=new h([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new n(e!=null?new $(e):void 0)}static U16(e){return new n(e!=null?new ge(e):void 0)}static U32(e){return new n(e!=null?new me(e):void 0)}static U64(e){return new n(e!=null?new O(e):void 0)}static U128(e){return new n(e!=null?new ye(e):void 0)}static U256(e){return new n(e!=null?new fe(e):void 0)}static Bool(e){return new n(e!=null?new I(e):void 0)}static MoveString(e){return new n(e!=null?new S(e):void 0)}static deserialize(e,r){let i=h.deserialize(e,r);return new n(i.values[0])}};var _ed25519 = require('@noble/curves/ed25519');var _sha3 = require('@noble/hashes/sha3');var Aa=(a=>(a.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",a.INVALID_HEX_CHARS="invalid_hex_chars",a.TOO_SHORT="too_short",a.TOO_LONG="too_long",a.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",a.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",a.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",a))(Aa||{}),x=class x extends l{constructor(e){super();if(e.length!==x.LENGTH)throw new J("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=_utils.bytesToHex.call(void 0, this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return _utils.bytesToHex.call(void 0, this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let r=e.deserializeFixedBytes(x.LENGTH);return new x(r)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new J("Hex string must start with a leading 0x.","leading_zero_x_required");let r=x.fromString(e);if(e.length!==x.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new J(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new J(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromString(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new J("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new J("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let i;try{i=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(o){throw new J(`Hex characters are invalid: ${_optionalChain([o, 'optionalAccess', _5 => _5.message])}`,"invalid_hex_chars")}return new x(i)}static from(e){return typeof e=="string"?x.fromString(e):e instanceof Uint8Array?new x(e):e}static fromStrict(e){return typeof e=="string"?x.fromStringStrict(e):e instanceof Uint8Array?new x(e):e}static isValid(e){try{return e.strict?x.fromStrict(e.input):x.from(e.input),{valid:!0}}catch(r){return{valid:!1,invalidReason:_optionalChain([r, 'optionalAccess', _6 => _6.invalidReason]),invalidReasonMessage:_optionalChain([r, 'optionalAccess', _7 => _7.message])}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,i)=>r===e.data[i])}};x.LENGTH=32,x.LONG_STRING_LENGTH=64,x.ZERO=x.from("0x0"),x.ONE=x.from("0x1"),x.TWO=x.from("0x2"),x.THREE=x.from("0x3"),x.FOUR=x.from("0x4"),x.A=x.from("0xA");var u=x;var Be=class Be extends l{constructor(e){super();let{data:r}=e,i=g.fromHexInput(r);if(i.toUint8Array().length!==Be.LENGTH)throw new Error(`Authentication Key length should be ${Be.LENGTH}`);this.data=i}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(Be.LENGTH);return new Be({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromSchemeAndBytes(e){let{scheme:r,input:i}=e,o=g.fromHexInput(i).toUint8Array(),s=new Uint8Array([...o,r]),a=_sha3.sha3_256.create();a.update(s);let c=a.digest();return new Be({data:c})}static fromPublicKeyAndScheme(e){let{publicKey:r}=e;return r.authKey()}static fromPublicKey(e){let{publicKey:r}=e;return r.authKey()}derivedAddress(){return new u(this.data.toUint8Array())}};Be.LENGTH=32;var D=Be;var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var Ri = _interopRequireWildcard(_bip39);var wa=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Sa= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,xa= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(xa||{}),Ki= exports.HARDENED_OFFSET =2147483648;function zi(n){return Sa.test(n)}function ki(n){return wa.test(n)}var Cr=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Di= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let i=new Uint8Array(r),o=new Uint8Array([0]),s=new Uint8Array([...o,...n,...i]);return Cr(t,s)},_a=n=>n.replace("'",""),Bi= exports.splitPath =n=>n.split("/").slice(1).map(_a),zn= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Ri.mnemonicToSeedSync(t)};var tt=class extends l{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}},ee= exports.AccountPublicKey =class extends tt{};var B=class extends l{toString(){let t=this.toUint8Array();return g.fromHexInput(t).toString()}};var ft=n=>typeof n=="string"?g.isValid(n).valid?n:Buffer.from(n,"utf8"):n;var Er=[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 Pa(n){let t=n.toUint8Array().slice(32);for(let e=Er.length-1;e>=0;e-=1){if(t[e]<Er[e])return!0;if(t[e]>Er[e])return!1}return!1}var Ge=class Ge extends ee{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Ge.LENGTH)throw new Error(`PublicKey length should be ${Ge.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e;if(!Pa(i))return!1;let o=ft(r),s=g.fromHexInput(o).toUint8Array(),a=i.toUint8Array(),c=this.key.toUint8Array();return _ed25519.ed25519.verify(a,s,c)}authKey(){return D.fromSchemeAndBytes({scheme:0,input:this.toUint8Array()})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ge(r)}static isPublicKey(e){return e instanceof Ge}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _8 => _8.key, 'optionalAccess', _9 => _9.data, 'optionalAccess', _10 => _10.length])===Ge.LENGTH}};Ge.LENGTH=32;var P=Ge,se=class se extends l{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==se.LENGTH)throw new Error(`PrivateKey length should be ${se.LENGTH}`);this.signingKey=r}static generate(){let e=_ed25519.ed25519.utils.randomPrivateKey();return new se(e)}static fromDerivationPath(e,r){if(!ki(e))throw new Error(`Invalid derivation path ${e}`);return se.fromDerivationPathInner(e,zn(r))}static fromDerivationPathInner(e,r,i=Ki){let{key:o,chainCode:s}=Cr(se.SLIP_0010_SEED,r),a=Bi(e).map(p=>parseInt(p,10)),{key:c}=a.reduce((p,d)=>Di(p,d+i),{key:o,chainCode:s});return new se(c)}publicKey(){let e=_ed25519.ed25519.getPublicKey(this.signingKey.toUint8Array());return new P(e)}sign(e){let r=ft(e),i=g.fromHexInput(r).toUint8Array(),o=_ed25519.ed25519.sign(i,this.signingKey.toUint8Array());return new C(o)}toUint8Array(){return this.signingKey.toUint8Array()}toString(){return this.signingKey.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new se(r)}static isPrivateKey(e){return e instanceof se}};se.LENGTH=32,se.SLIP_0010_SEED="ed25519 seed";var W=se,At=class At extends B{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==At.LENGTH)throw new Error(`Signature length should be ${At.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new At(r)}};At.LENGTH=64;var C=At;var ae=class ae extends ee{constructor(e){super();let{publicKeys:r,threshold:i}=e;if(r.length>ae.MAX_KEYS||r.length<ae.MIN_KEYS)throw new Error(`Must have between ${ae.MIN_KEYS} and ${ae.MAX_KEYS} public keys, inclusive`);if(i<ae.MIN_THRESHOLD||i>r.length)throw new Error(`Threshold must be between ${ae.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=i}verifySignature(e){let{message:r,signature:i}=e;if(!(i instanceof nt))return!1;let o=[];for(let s=0;s<4;s+=1)for(let a=0;a<8;a+=1)if((i.bitmap[s]&1<<7-a)!==0){let p=s*8+a;o.push(p)}if(o.length!==i.signatures.length)throw new Error("Bitmap and signatures length mismatch");if(o.length<this.threshold)throw new Error("Not enough signatures");for(let s=0;s<o.length;s+=1)if(!this.publicKeys[o[s]].verifySignature({message:r,signature:i.signatures[s]}))return!1;return!0}authKey(){return D.fromSchemeAndBytes({scheme:1,input:this.toUint8Array()})}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*P.LENGTH+1);return this.publicKeys.forEach((r,i)=>{e.set(r.toUint8Array(),i*P.LENGTH)}),e[this.publicKeys.length*P.LENGTH]=this.threshold,e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r[r.length-1],o=[];for(let s=0;s<r.length-1;s+=P.LENGTH){let a=s;o.push(new P(r.subarray(a,a+P.LENGTH)))}return new ae({publicKeys:o,threshold:i})}};ae.MAX_KEYS=32,ae.MIN_KEYS=2,ae.MIN_THRESHOLD=1;var ht=ae,ne=class ne extends B{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${ne.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r,!(i instanceof Uint8Array))this.bitmap=ne.createBitmap({bits:i});else{if(i.length!==ne.BITMAP_LEN)throw new Error(`"bitmap" length should be ${ne.BITMAP_LEN}`);this.bitmap=i}}toUint8Array(){let e=new Uint8Array(this.signatures.length*C.LENGTH+ne.BITMAP_LEN);return this.signatures.forEach((r,i)=>{e.set(r.toUint8Array(),i*C.LENGTH)}),e.set(this.bitmap,this.signatures.length*C.LENGTH),e}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),i=r.subarray(r.length-4),o=[];for(let s=0;s<r.length-i.length;s+=C.LENGTH){let a=s;o.push(new C(r.subarray(a,a+C.LENGTH)))}return new ne({signatures:o,bitmap:i})}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(a>=ne.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${ne.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");if(c>0&&a<=r[c-1])throw new Error("The bits need to be sorted in ascending order.");s.add(a);let p=Math.floor(a/8),d=o[p];d|=i>>a%8,o[p]=d}),o}};ne.MAX_SIGNATURES_SUPPORTED=32,ne.BITMAP_LEN=4;var nt=ne;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var Fe=class Fe extends tt{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Fe.LENGTH)throw new Error(`PublicKey length should be ${Fe.LENGTH}`);this.key=r}verifySignature(e){let{message:r,signature:i}=e,o=ft(r),s=g.fromHexInput(o).toUint8Array(),a=_sha3.sha3_256.call(void 0, s),c=i.toUint8Array();return _secp256k1.secp256k1.verify(c,a,this.key.toUint8Array(),{lowS:!0})}toUint8Array(){return this.key.toUint8Array()}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Fe(r)}static isPublicKey(e){return e instanceof Fe}static isInstance(e){return"key"in e&&_optionalChain([e, 'access', _11 => _11.key, 'optionalAccess', _12 => _12.data, 'optionalAccess', _13 => _13.length])===Fe.LENGTH}};Fe.LENGTH=65;var ve=Fe,Te=class Te extends l{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Te.LENGTH)throw new Error(`PrivateKey length should be ${Te.LENGTH}`);this.key=r}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new Te(e)}static fromDerivationPath(e,r){if(!zi(e))throw new Error(`Invalid derivation path ${e}`);return Te.fromDerivationPathInner(e,zn(r))}static fromDerivationPathInner(e,r){let{privateKey:i}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(i===null)throw new Error("Invalid key");return new Te(i)}sign(e){let r=ft(e),i=g.fromHexInput(r),o=_sha3.sha3_256.call(void 0, i.toUint8Array()),s=_secp256k1.secp256k1.sign(o,this.key.toUint8Array(),{lowS:!0});return new Tt(s.toCompactRawBytes())}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new ve(e)}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Te(r)}static isPrivateKey(e){return e instanceof Te}};Te.LENGTH=32;var rt=Te,bt=class bt extends B{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==bt.LENGTH)throw new Error(`Signature length should be ${bt.LENGTH}, received ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new bt(r)}};bt.LENGTH=64;var Tt=bt;var _jwtdecode = require('jwt-decode');var it=class n extends tt{constructor(e){super();let r=e.constructor.name;switch(r){case P.name:this.publicKey=e,this.variant=0;break;default:throw new Error(`Unsupported key for EphemeralPublicKey - ${r}`)}}toUint8Array(){return this.bcsToBytes()}verifySignature(e){let{message:r,signature:i}=e;return this.publicKey.verifySignature({message:r,signature:i.signature})}serialize(e){if(this.publicKey instanceof P)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(P.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}}static isPublicKey(e){return e instanceof n}},we= exports.EphemeralSignature =class n extends B{constructor(e){super();let r=e.constructor.name;switch(r){case C.name:this.signature=e;break;default:throw new Error(`Unsupported signature for EphemeralSignature - ${r}`)}}toUint8Array(){return this.bcsToBytes()}static fromHex(e){let r=g.fromHexInput(e),i=new q(r.toUint8Array());return n.deserialize(i)}serialize(e){if(this.signature instanceof C)e.serializeU32AsUleb128(0),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(C.deserialize(e));default:throw new Error(`Unknown variant index for EphemeralSignature: ${r}`)}}};var _poseidonlite = require('poseidon-lite');var Ir=[_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],Ni=31,Va=16,Fi=(Va-1)*Ni;function Bn(n,t){let r=new TextEncoder().encode(n);return $a(r,t)}function $a(n,t){if(n.length>t)throw new Error(`Inputted bytes of length ${n} is longer than ${t}`);let e=Ur(n,t);return Zt(e)}function La(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);let e=Wa(n,t);return Ha(e)}function Ur(n,t){if(n.length>t)throw new Error(`Input bytes of length ${n} is longer than ${t}`);return La(n,t).concat([BigInt(n.length)])}function Ha(n){if(n.length>Fi)throw new Error(`Can't pack more than ${Fi}. Was given ${n.length} bytes`);return Qa(n,Ni).map(t=>Xt(t))}function Qa(n,t){let e=[];for(let r=0;r<n.length;r+=t)e.push(n.subarray(r,r+t));return e}function Xt(n){let t=BigInt(0);for(let e=n.length-1;e>=0;e-=1)t=t<<BigInt(8)|BigInt(n[e]);return t}function Oi(n,t){let e=new Uint8Array(t);for(let r=0;r<t;r+=1)e[r]=Number(n&BigInt(255)),n>>=BigInt(8);return e}function Wa(n,t){if(t<n.length)throw new Error("Padded size must be greater than or equal to the input array size.");let e=new Uint8Array(t);e.set(n);for(let r=n.length;r<t;r+=1)e[r]=0;return e}function Zt(n){if(n.length>Ir.length)throw new Error(`Unable to hash input of length ${n.length}. Max input length is ${Ir.length}`);return Ir[n.length-1](n)}var Gn=class extends l{toString(){let t=this.bcsToBytes();return g.fromHexInput(t).toString()}};var wt=(o=>(o.FULLNODE="Fullnode",o.INDEXER="Indexer",o.FAUCET="Faucet",o.PEPPER="Pepper",o.PROVER="Prover",o))(wt||{}),Mi= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,qi= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,Fn= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ot= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Vi= exports.APTOS_FA ="0x000000000000000000000000000000000000000000000000000000000000000a",$i= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",Rr= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData",Ce= exports.ProcessorType =(c=>(c.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",c.DEFAULT="default_processor",c.EVENTS_PROCESSOR="events_processor",c.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",c.STAKE_PROCESSOR="stake_processor",c.TOKEN_V2_PROCESSOR="token_v2_processor",c.USER_TRANSACTION_PROCESSOR="user_transaction_processor",c.OBJECT_PROCESSOR="objects_processor",c))(Ce||{});var Ae=class extends Error{constructor({apiType:e,aptosRequest:r,aptosResponse:i}){super(ja({apiType:e,aptosRequest:r,aptosResponse:i}));this.name="AptosApiError",this.url=i.url,this.status=i.status,this.statusText=i.statusText,this.data=i.data,this.request=r}};function ja({apiType:n,aptosRequest:t,aptosResponse:e}){let r=_optionalChain([e, 'access', _14 => _14.headers, 'optionalAccess', _15 => _15.traceparent, 'optionalAccess', _16 => _16.split, 'call', _17 => _17("-"), 'access', _18 => _18[1]]),i=r?`(trace_id:${r}) `:"",o=`Request to [${n}]: ${t.method} ${_nullishCoalesce(e.url, () => (t.url))} ${i}failed with`;return n==="Indexer"&&_optionalChain([e, 'access', _19 => _19.data, 'optionalAccess', _20 => _20.errors, 'optionalAccess', _21 => _21[0], 'optionalAccess', _22 => _22.message])!=null?`${o}: ${e.data.errors[0].message}`:_optionalChain([e, 'access', _23 => _23.data, 'optionalAccess', _24 => _24.message])!=null&&_optionalChain([e, 'access', _25 => _25.data, 'optionalAccess', _26 => _26.error_code])!=null?`${o}: ${JSON.stringify(e.data)}`:`${o} status: ${e.statusText}(code:${e.status}) and response body: ${Xa(e.data)}`}var Kr=400;function Xa(n){let t=JSON.stringify(n);return t.length<=Kr?t:`truncated(original_size:${t.length}): ${t.slice(0,Kr/2)}...${t.slice(-Kr/2)}`}var Li="1.28.0";var Hi={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"},Qi= 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"},Wi= exports.NetworkToFaucetAPI ={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},zr= 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"},kr= exports.NetworkToProverAPI ={mainnet:"https://api.mainnet.aptoslabs.com/keyless/prover/v0",testnet:"https://prover.keyless.testnet.aptoslabs.com/v0",devnet:"https://prover.keyless.devnet.aptoslabs.com/v0",local:"http://127.0.0.1:8083/v0"},Dr= exports.Network =(o=>(o.MAINNET="mainnet",o.TESTNET="testnet",o.DEVNET="devnet",o.LOCAL="local",o.CUSTOM="custom",o))(Dr||{}),Br= exports.NetworkToChainId ={mainnet:1,testnet:2,local:4},Md= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};function ji(n,t){let e=t.bcsToBytes(),r=new q(e);return n.deserialize(r)}async function Za(n,t){let{url:e,method:r,body:i,contentType:o,params:s,overrides:a,originMethod:c}=n,p={..._optionalChain([a, 'optionalAccess', _27 => _27.HEADERS]),"x-aptos-client":`aptos-typescript-sdk/${Li}`,"content-type":_nullishCoalesce(o, () => ("application/json")),"x-aptos-typescript-sdk-origin-method":c};return _optionalChain([a, 'optionalAccess', _28 => _28.AUTH_TOKEN])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _29 => _29.AUTH_TOKEN])}`),_optionalChain([a, 'optionalAccess', _30 => _30.API_KEY])&&(p.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _31 => _31.API_KEY])}`),t.provider({url:e,method:r,body:i,params:s,headers:p,overrides:a})}async function Nn(n,t,e){let{url:r,path:i}=n,o=i?`${r}/${i}`:r,s=await Za({...n,url:o},t.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(a.status===401)throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a});if(e==="Indexer"){let c=a.data;if(c.errors)throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a});a.data=c.data}else if((e==="Pepper"||e==="Prover")&&a.status>=400)throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a});if(a.status>=200&&a.status<300)return a;throw new Ae({apiType:e,aptosRequest:n,aptosResponse:a})}async function Gr(n){let{aptosConfig:t,overrides:e,params:r,contentType:i,acceptType:o,path:s,originMethod:a,type:c}=n,p=t.getRequestUrl(c);return Nn({url:p,method:"GET",originMethod:a,path:s,contentType:i,acceptType:o,params:r,overrides:{...t.clientConfig,...e}},t,n.type)}async function H(n){let{aptosConfig:t}=n;return Gr({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _32 => _32.clientConfig, 'optionalAccess', _33 => _33.HEADERS]),..._optionalChain([t, 'access', _34 => _34.fullnodeConfig, 'optionalAccess', _35 => _35.HEADERS])}}})}async function pl(n){return Gr({...n,type:"Pepper"})}async function St(n){let t=[],e,r=n.params;do{let i=await Gr({type:"Fullnode",aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});e=i.headers["x-aptos-cursor"],delete i.headers,t.push(...i.data),r.start=e}while(e!=null);return t}async function Yt(n){let{type:t,originMethod:e,path:r,body:i,acceptType:o,contentType:s,params:a,aptosConfig:c,overrides:p}=n,d=c.getRequestUrl(t);return Nn({url:d,method:"POST",originMethod:e,path:r,body:i,contentType:s,acceptType:o,params:a,overrides:p},c,n.type)}async function Ne(n){let{aptosConfig:t}=n;return Yt({...n,type:"Fullnode",overrides:{...t.clientConfig,...t.fullnodeConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _36 => _36.clientConfig, 'optionalAccess', _37 => _37.HEADERS]),..._optionalChain([t, 'access', _38 => _38.fullnodeConfig, 'optionalAccess', _39 => _39.HEADERS])}}})}async function Xi(n){let{aptosConfig:t}=n;return Yt({...n,type:"Indexer",overrides:{...t.clientConfig,...t.indexerConfig,...n.overrides,HEADERS:{..._optionalChain([t, 'access', _40 => _40.clientConfig, 'optionalAccess', _41 => _41.HEADERS]),..._optionalChain([t, 'access', _42 => _42.indexerConfig, 'optionalAccess', _43 => _43.HEADERS])}}})}async function Zi(n){let{aptosConfig:t}=n,e={...t,clientConfig:{...t.clientConfig}};return _optionalChainDelete([e, 'optionalAccess', _44 => _44.clientConfig, 'optionalAccess', _45 => delete _45.API_KEY]),Yt({...n,type:"Faucet",overrides:{...e.clientConfig,...e.faucetConfig,...n.overrides,HEADERS:{..._optionalChain([e, 'access', _46 => _46.clientConfig, 'optionalAccess', _47 => _47.HEADERS]),..._optionalChain([e, 'access', _48 => _48.faucetConfig, 'optionalAccess', _49 => _49.HEADERS])}}})}async function Yi(n){return Yt({...n,type:"Pepper"})}async function Ji(n){return Yt({...n,type:"Prover"})}var Fr=new Map;function Oe(n,t,e){return async(...r)=>{if(Fr.has(t)){let{value:o,timestamp:s}=Fr.get(t);if(e===void 0||Date.now()-s<=e)return o}let i=await n(...r);return Fr.set(t,{value:i,timestamp:Date.now()}),i}}var Ol=1e7,Ja= exports.MAX_AUD_VAL_BYTES =120,ec= exports.MAX_UID_KEY_BYTES =30,tc= exports.MAX_UID_VAL_BYTES =330,Ml= exports.MAX_ISS_VAL_BYTES =120,ql= exports.MAX_EXTRA_FIELD_BYTES =350,Vl= exports.MAX_JWT_HEADER_B64_BYTES =300,$l= exports.MAX_COMMITED_EPK_BYTES =93,Se=class Se extends ee{constructor(e,r){super();let i=g.fromHexInput(r).toUint8Array();if(i.length!==Se.ID_COMMITMENT_LENGTH)throw new Error(`Id Commitment length in bytes should be ${Se.ID_COMMITMENT_LENGTH}`);this.iss=e,this.idCommitment=i}authKey(){let e=new V;return e.serializeU32AsUleb128(3),e.serializeFixedBytes(this.bcsToBytes()),D.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){e.serializeStr(this.iss),e.serializeBytes(this.idCommitment)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new Se(r,i)}static load(e){let r=e.deserializeStr(),i=e.deserializeBytes();return new Se(r,i)}static isPublicKey(e){return e instanceof Se}static create(e){return eo(e),new Se(e.iss,eo(e))}static fromJwtAndPepper(e){let{jwt:r,pepper:i,uidKey:o="sub"}=e,s=_jwtdecode.jwtDecode.call(void 0, r),a=s.iss;if(typeof s.aud!="string")throw new Error("aud was not found or an array of values");let c=s.aud,p=s[o];return Se.create({iss:a,uidKey:o,uidVal:p,aud:c,pepper:i})}static isInstance(e){return"iss"in e&&typeof e.iss=="string"&&"idCommitment"in e&&e.idCommitment instanceof Uint8Array}};Se.ID_COMMITMENT_LENGTH=32;var G=Se;function eo(n){let{uidKey:t,uidVal:e,aud:r,pepper:i}=n,o=[Xt(g.fromHexInput(i).toUint8Array()),Bn(r,Ja),Bn(e,tc),Bn(t,ec)];return Oi(Zt(o),G.ID_COMMITMENT_LENGTH)}var Ie=class n extends B{constructor(e){super();let{jwtHeader:r,ephemeralCertificate:i,expiryDateSecs:o,ephemeralPublicKey:s,ephemeralSignature:a}=e;this.jwtHeader=r,this.ephemeralCertificate=i,this.expiryDateSecs=o,this.ephemeralPublicKey=s,this.ephemeralSignature=a}toUint8Array(){return this.bcsToBytes()}serialize(e){this.ephemeralCertificate.serialize(e),e.serializeStr(this.jwtHeader),e.serializeU64(this.expiryDateSecs),this.ephemeralPublicKey.serialize(e),this.ephemeralSignature.serialize(e)}static deserialize(e){let r=xt.deserialize(e),i=e.deserializeStr(),o=e.deserializeU64(),s=it.deserialize(e),a=we.deserialize(e);return new n({jwtHeader:i,expiryDateSecs:Number(o),ephemeralCertificate:r,ephemeralPublicKey:s,ephemeralSignature:a})}static getSimulationSignature(){return new n({jwtHeader:"{}",ephemeralCertificate:new xt(new ce({proof:new Pt(new _t({a:new Uint8Array(32),b:new Uint8Array(64),c:new Uint8Array(32)}),0),expHorizonSecs:0}),0),expiryDateSecs:0,ephemeralPublicKey:new it(new P(new Uint8Array(32))),ephemeralSignature:new we(new C(new Uint8Array(64)))})}static isSignature(e){return e instanceof n}},xt= exports.EphemeralCertificate =class n extends B{constructor(e,r){super();this.signature=e,this.variant=r}toUint8Array(){return this.signature.toUint8Array()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(ce.deserialize(e),r);default:throw new Error(`Unknown variant index for EphemeralCertificate: ${r}`)}}},Ee=class n extends l{constructor(e){super();if(this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==32)throw new Error("Input needs to be 32 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let r=e.deserializeFixedBytes(32);return new n(r)}},st=class n extends l{constructor(e){super();if(this.data=g.fromHexInput(e).toUint8Array(),this.data.length!==64)throw new Error("Input needs to be 64 bytes")}serialize(e){e.serializeFixedBytes(this.data)}static deserialize(e){let r=e.deserializeFixedBytes(64);return new n(r)}},_t= exports.Groth16Zkp =class n extends Gn{constructor(e){super();let{a:r,b:i,c:o}=e;this.a=new Ee(r),this.b=new st(i),this.c=new Ee(o)}serialize(e){this.a.serialize(e),this.b.serialize(e),this.c.serialize(e)}static deserialize(e){let r=Ee.deserialize(e).bcsToBytes(),i=st.deserialize(e).bcsToBytes(),o=Ee.deserialize(e).bcsToBytes();return new n({a:r,b:i,c:o})}},Pt= exports.ZkProof =class n extends l{constructor(e,r){super();this.proof=e,this.variant=r}serialize(e){e.serializeU32AsUleb128(this.variant),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32();switch(r){case 0:return new n(_t.deserialize(e),r);default:throw new Error(`Unknown variant index for ZkProof: ${r}`)}}},ce= exports.ZeroKnowledgeSig =class n extends B{constructor(e){super();let{proof:r,expHorizonSecs:i,trainingWheelsSignature:o,extraField:s,overrideAudVal:a}=e;this.proof=r,this.expHorizonSecs=i,this.trainingWheelsSignature=o,this.extraField=s,this.overrideAudVal=a}toUint8Array(){return this.bcsToBytes()}static fromBytes(e){return n.deserialize(new q(e))}serialize(e){this.proof.serialize(e),e.serializeU64(this.expHorizonSecs),e.serializeOptionStr(this.extraField),e.serializeOptionStr(this.overrideAudVal),e.serializeOption(this.trainingWheelsSignature)}static deserialize(e){let r=Pt.deserialize(e),i=Number(e.deserializeU64()),o=e.deserializeOptionStr(),s=e.deserializeOptionStr(),a=e.deserializeOption(we);return new n({proof:r,expHorizonSecs:i,trainingWheelsSignature:a,extraField:o,overrideAudVal:s})}},Nr= exports.KeylessConfiguration =class n{constructor(t,e){this.verficationKey=t,this.maxExpHorizonSecs=e}static create(t,e){return new n(new Or({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2}),e)}},Or=class n{constructor(t){let{alphaG1:e,betaG2:r,deltaG2:i,gammaAbcG1:o,gammaG2:s}=t;this.alphaG1=new Ee(e),this.betaG2=new st(r),this.deltaG2=new st(i),this.gammaAbcG1=[new Ee(o[0]),new Ee(o[1])],this.gammaG2=new st(s)}static fromGroth16VerificationKeyResponse(t){return new n({alphaG1:t.alpha_g1,betaG2:t.beta_g2,deltaG2:t.delta_g2,gammaAbcG1:t.gamma_abc_g1,gammaG2:t.gamma_g2})}};async function Ll(n){let{aptosConfig:t}=n;return Oe(async()=>{let e=await nc(n),r=await rc(n);return Nr.create(r,Number(e.max_exp_horizon_secs))},`keyless-configuration-${t.network}`,1e3*60*5)()}async function nc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Configuration",{data:i}=await H({aptosConfig:t,originMethod:"getKeylessConfigurationResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _50 => _50.ledgerVersion])}});return i.data}async function rc(n){let{aptosConfig:t,options:e}=n,r="0x1::keyless_account::Groth16VerificationKey",{data:i}=await H({aptosConfig:t,originMethod:"getGroth16VerificationKeyResource",path:`accounts/${u.from("0x1").toString()}/resource/${r}`,params:{ledger_version:_optionalChain([e, 'optionalAccess', _51 => _51.ledgerVersion])}});return i.data}var he=class n extends ee{constructor(e,r){super();this.jwkAddress=u.from(e),this.keylessPublicKey=r}authKey(){let e=new V;return e.serializeU32AsUleb128(4),e.serializeFixedBytes(this.bcsToBytes()),D.fromSchemeAndBytes({scheme:2,input:e.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("Not yet implemented")}serialize(e){this.jwkAddress.serialize(e),this.keylessPublicKey.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=G.deserialize(e);return new n(r,i)}static isPublicKey(e){return e instanceof n}static create(e){return new n(e.jwkAddress,G.create(e))}static fromJwtAndPepper(e){return new n(e.jwkAddress,G.fromJwtAndPepper(e))}static isInstance(e){return"jwkAddress"in e&&e.jwkAddress instanceof u&&"keylessPublicKey"in e&&e.keylessPublicKey instanceof G}};var k=class n extends ee{constructor(e){super();if(this.publicKey=e,e instanceof P)this.variant=0;else if(e instanceof ve)this.variant=1;else if(e instanceof G)this.variant=3;else if(e instanceof he)this.variant=4;else throw new Error("Unsupported public key type")}verifySignature(e){let{message:r,signature:i}=e;return M.isInstance(i)?this.publicKey.verifySignature({message:r,signature:i.signature}):!1}authKey(){return D.fromSchemeAndBytes({scheme:2,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.publicKey.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=P.deserialize(e);break;case 1:i=ve.deserialize(e);break;case 3:i=G.deserialize(e);break;case 4:i=he.deserialize(e);break;default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}return new n(i)}static isPublicKey(e){return e instanceof n}isEd25519(){return this.publicKey instanceof P}isSecp256k1PublicKey(){return this.publicKey instanceof ve}static isInstance(e){return"publicKey"in e&&"variant"in e}},M= exports.AnySignature =class n extends B{constructor(e){super();if(this.signature=e,e instanceof C)this.variant=0;else if(e instanceof Tt)this.variant=1;else if(e instanceof Ie)this.variant=3;else throw new Error("Unsupported signature type")}toUint8Array(){return console.warn("[Aptos SDK] Calls to AnySignature.toUint8Array() will soon return the underlying signature bytes. Use AnySignature.bcsToBytes() instead."),this.bcsToBytes()}serialize(e){e.serializeU32AsUleb128(this.variant),this.signature.serialize(e)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=C.deserialize(e);break;case 1:i=Tt.deserialize(e);break;case 3:i=Ie.deserialize(e);break;default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}return new n(i)}static isInstance(e){return"signature"in e&&typeof e.signature=="object"&&e.signature!==null&&"toUint8Array"in e.signature}};function ic(n){let t=n;return t-=t>>1&1431655765,t=(t&858993459)+(t>>2&858993459),(t+(t>>4)&252645135)*16843009>>24}var vt=class n extends ee{constructor(e){super();let{publicKeys:r,signaturesRequired:i}=e;if(i<1)throw new Error("The number of required signatures needs to be greater than 0");if(r.length<i)throw new Error(`Provided ${r.length} public keys is smaller than the ${i} required signatures`);this.publicKeys=r.map(o=>o instanceof k?o:new k(o)),this.signaturesRequired=i}verifySignature(e){throw new Error("not implemented")}authKey(){return D.fromSchemeAndBytes({scheme:3,input:this.toUint8Array()})}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(k),i=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:i})}createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,c)=>{if(c+1>this.publicKeys.length)throw new Error(`Signature index ${c+1} is out of public keys range, ${this.publicKeys.length}.`);if(s.has(a))throw new Error(`Duplicate bit ${a} detected.`);s.add(a);let p=Math.floor(a/8),d=o[p];d|=i>>a%8,o[p]=d}),o}getIndex(e){let r=e instanceof k?e:new k(e),i=this.publicKeys.findIndex(o=>o.toString()===r.toString());if(i!==-1)return i;throw new Error("Public key not found in MultiKey")}},re=class re extends B{constructor(e){super();let{signatures:r,bitmap:i}=e;if(r.length>re.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${re.MAX_SIGNATURES_SUPPORTED}`);if(this.signatures=r.map(s=>s instanceof M?s:new M(s)),!(i instanceof Uint8Array))this.bitmap=re.createBitmap({bits:i});else{if(i.length!==re.BITMAP_LEN)throw new Error(`"bitmap" length should be ${re.BITMAP_LEN}`);this.bitmap=i}let o=this.bitmap.reduce((s,a)=>s+ic(a),0);if(o!==this.signatures.length)throw new Error(`Expecting ${o} signatures from the bitmap, but got ${this.signatures.length}`)}static createBitmap(e){let{bits:r}=e,i=128,o=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=re.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${re.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let c=Math.floor(a/8),p=o[c];p|=i>>a%8,o[c]=p}),o}toUint8Array(){return this.bcsToBytes()}serialize(e){e.serializeVector(this.signatures),e.serializeBytes(this.bitmap)}static deserialize(e){let r=e.deserializeVector(M),i=e.deserializeBytes();return new re({signatures:r,bitmap:i})}};re.BITMAP_LEN=4,re.MAX_SIGNATURES_SUPPORTED=re.BITMAP_LEN*8;var at=re;var j=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return be.load(t);case 1:return On.load(t);case 2:return te.load(t);case 3:return ct.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof be}isMultiEd25519(){return this instanceof On}isSingleKey(){return this instanceof te}isMultiKey(){return this instanceof ct}},be= exports.AccountAuthenticatorEd25519 =class n extends j{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=P.deserialize(e),i=C.deserialize(e);return new n(r,i)}},On= exports.AccountAuthenticatorMultiEd25519 =class n extends j{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=ht.deserialize(e),i=nt.deserialize(e);return new n(r,i)}},te= exports.AccountAuthenticatorSingleKey =class n extends j{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=k.deserialize(e),i=M.deserialize(e);return new n(r,i)}},ct= exports.AccountAuthenticatorMultiKey =class n extends j{constructor(e,r){super();this.public_keys=e,this.signatures=r}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),this.signatures.serialize(e)}static load(e){let r=vt.deserialize(e),i=at.deserialize(e);return new n(r,i)}};var Ct=class n extends l{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var R=class n extends l{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var Mr=(n,t)=>{let e=n.bcsToBytes(),r=typeof t=="string"?Buffer.from(t,"utf8"):t,i=new Uint8Array([...e,...r,254]);return new u(_sha3.sha3_256.call(void 0, i))},nm= exports.createResourceAddress =(n,t)=>{let e=n.bcsToBytes(),r=typeof t=="string"?Buffer.from(t,"utf8"):t,i=new Uint8Array([...e,...r,255]);return new u(_sha3.sha3_256.call(void 0, i))},rm= exports.createTokenAddress =(n,t,e)=>{let r=`${t}::${e}`;return Mr(n,r)};var Jt=class n extends l{constructor(e,r){super();this.address=e,this.name=r}static fromStr(e){let r=e.split("::");if(r.length!==2)throw new Error("Invalid module id.");return new n(u.fromString(r[0]),new R(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e);return new n(r,i)}};var K=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return F.load(t);case 1:return ue.load(t);case 2:return Q.load(t);case 3:return Ve.load(t);case 4:return X.load(t);case 5:return Et.load(t);case 6:return E.load(t);case 7:return y.load(t);case 8:return Me.load(t);case 9:return qe.load(t);case 10:return $e.load(t);case 255:return z.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof F}isAddress(){return this instanceof X}isGeneric(){return this instanceof z}isSigner(){return this instanceof Et}isVector(){return this instanceof E}isStruct(){return this instanceof y}isU8(){return this instanceof ue}isU16(){return this instanceof Me}isU32(){return this instanceof qe}isU64(){return this instanceof Q}isU128(){return this instanceof Ve}isU256(){return this instanceof $e}},F= exports.TypeTagBool =class n extends K{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},ue= exports.TypeTagU8 =class n extends K{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Me= exports.TypeTagU16 =class n extends K{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},qe= exports.TypeTagU32 =class n extends K{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Q= exports.TypeTagU64 =class n extends K{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},Ve= exports.TypeTagU128 =class n extends K{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},$e= exports.TypeTagU256 =class n extends K{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},X= exports.TypeTagAddress =class n extends K{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},Et= exports.TypeTagSigner =class n extends K{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},Mn= exports.TypeTagReference =class n extends K{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=K.deserialize(e);return new n(r)}},z= exports.TypeTagGeneric =class n extends K{constructor(e){super();this.value=e;if(e<0)throw new Error("Generic type parameter index cannot be negative")}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let r=e.deserializeU32();return new n(r)}},E= exports.TypeTagVector =class n extends K{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}static u8(){return new n(new ue)}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=K.deserialize(e);return new n(r)}},y= exports.TypeTagStruct =class n extends K{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(r=>r.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let r=Ue.deserialize(e);return new n(r)}isTypeTag(e,r,i){return this.value.moduleName.identifier===r&&this.value.name.identifier===i&&this.value.address.equals(e)}isString(){return this.isTypeTag(u.ONE,"string","String")}isOption(){return this.isTypeTag(u.ONE,"option","Option")}isObject(){return this.isTypeTag(u.ONE,"object","Object")}},Ue= exports.StructTag =class n extends l{constructor(e,r,i,o){super();this.address=e,this.moduleName=r,this.name=i,this.typeArgs=o}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=u.deserialize(e),i=R.deserialize(e),o=R.deserialize(e),s=e.deserializeVector(K);return new n(r,i,o,s)}};function vm(){return new Ue(u.ONE,new R("aptos_coin"),new R("AptosCoin"),[])}function v(){return new Ue(u.ONE,new R("string"),new R("String"),[])}function Cm(n){return new Ue(u.ONE,new R("option"),new R("Option"),[n])}function ie(n){return new Ue(u.ONE,new R("object"),new R("Object"),[n])}function oc(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return $.deserialize(n);case 1:return O.deserialize(n);case 2:return ye.deserialize(n);case 3:return u.deserialize(n);case 4:return h.deserialize(n,$);case 5:return I.deserialize(n);case 6:return ge.deserialize(n);case 7:return me.deserialize(n);case 8:return fe.deserialize(n);case 9:return jt.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var ut=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return en.load(t);case 2:return tn.load(t);case 3:return nn.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},en= exports.TransactionPayloadScript =class n extends ut{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=rn.deserialize(e);return new n(r)}},tn= exports.TransactionPayloadEntryFunction =class n extends ut{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=pt.deserialize(e);return new n(r)}},nn= exports.TransactionPayloadMultiSig =class n extends ut{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=on.deserialize(e);return new n(r)}},pt= exports.EntryFunction =class n{constructor(t,e,r,i){this.module_name=t,this.function_name=e,this.type_args=r,this.args=i}static build(t,e,r,i){return new n(Jt.fromStr(t),new R(e),r,i)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=Jt.deserialize(t),r=R.deserialize(t),i=t.deserializeVector(K),o=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let c=t.deserializeUleb128AsU32(),p=Un.deserialize(t,c);s.push(p)}return new n(e,r,i,s)}},rn= exports.Script =class n{constructor(t,e,r){this.bytecode=t,this.type_args=e,this.args=r}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),r=t.deserializeVector(K),i=t.deserializeUleb128AsU32(),o=new Array;for(let s=0;s<i;s+=1){let a=oc(t);o.push(a)}return new n(e,r,o)}},on= exports.MultiSig =class n{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=u.deserialize(t),r=t.deserializeBool(),i;return r&&(i=sn.deserialize(t)),new n(e,i)}},sn= exports.MultiSigTransactionPayload =class n extends l{constructor(e){super();this.transaction_payload=e}serialize(e){e.serializeU32AsUleb128(0),this.transaction_payload.serialize(e)}static deserialize(e){return e.deserializeUleb128AsU32(),new n(pt.deserialize(e))}};var pe=class n extends l{constructor(e,r,i,o,s,a,c){super();this.sender=e,this.sequence_number=r,this.payload=i,this.max_gas_amount=o,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=c}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let r=u.deserialize(e),i=e.deserializeU64(),o=ut.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),c=e.deserializeU64(),p=Ct.deserialize(e);return new n(r,i,o,s,a,c,p)}},qn= exports.RawTransactionWithData =class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return dt.load(t);case 1:return lt.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},dt= exports.MultiAgentRawTransaction =class n extends qn{constructor(e,r){super();this.raw_txn=e,this.secondary_signer_addresses=r}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let r=pe.deserialize(e),i=e.deserializeVector(u);return new n(r,i)}},lt= exports.FeePayerRawTransaction =class n extends qn{constructor(e,r,i){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=i}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let r=pe.deserialize(e),i=e.deserializeVector(u),o=u.deserialize(e);return new n(r,i,o)}};var Vn=class extends l{constructor(e){super();this.accountAddress=u.ONE;this.moduleName=new S("account");this.structName=new S("RotationProofChallenge");this.sequenceNumber=new O(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=h.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var Re=class extends l{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return It.load(t);case 1:return qr.load(t);case 2:return Ut.load(t);case 3:return Rt.load(t);case 4:return Kt.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},It= exports.TransactionAuthenticatorEd25519 =class n extends Re{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=P.deserialize(e),i=C.deserialize(e);return new n(r,i)}},qr= exports.TransactionAuthenticatorMultiEd25519 =class n extends Re{constructor(e,r){super();this.public_key=e,this.signature=r}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let r=ht.deserialize(e),i=nt.deserialize(e);return new n(r,i)}},Ut= exports.TransactionAuthenticatorMultiAgent =class n extends Re{constructor(e,r,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let r=j.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(j);return new n(r,i,o)}},Rt= exports.TransactionAuthenticatorFeePayer =class n extends Re{constructor(e,r,i,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=i,this.fee_payer=o}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=j.deserialize(e),i=e.deserializeVector(u),o=e.deserializeVector(j),s=u.deserialize(e),a=j.deserialize(e),c={address:s,authenticator:a};return new n(r,i,o,c)}},Kt= exports.TransactionAuthenticatorSingleSender =class n extends Re{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=j.deserialize(e);return new n(r)}};var gt=class n extends l{constructor(e,r){super();this.raw_txn=e,this.authenticator=r}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let r=pe.deserialize(e),i=Re.deserialize(e);return new n(r,i)}};var $n=class n extends l{constructor(e,r){super();this.rawTransaction=e,this.feePayerAddress=r}serialize(e){this.rawTransaction.serialize(e),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=pe.deserialize(e),i=e.deserializeBool(),o;return i&&(o=u.deserialize(e)),new n(r,o)}};var Ln=class n extends l{constructor(e,r,i){super();this.rawTransaction=e,this.feePayerAddress=i,this.secondarySignerAddresses=r}serialize(e){this.rawTransaction.serialize(e),e.serializeVector(this.secondarySignerAddresses),this.feePayerAddress===void 0?e.serializeBool(!1):(e.serializeBool(!0),this.feePayerAddress.serialize(e))}static deserialize(e){let r=pe.deserialize(e),i=e.deserializeVector(u),o=e.deserializeBool(),s;return o&&(s=u.deserialize(e)),new n(r,i,s)}};function Vr(n){return n.feePayerAddress?new lt(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new dt(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function zt(n,t){let e=_sha3.sha3_256.create();if(!t.startsWith("APTOS::"))throw new Error(`Domain separator needs to start with 'APTOS::'. Provided - ${t}`);e.update(t);let r=e.digest(),i=n,o=new Uint8Array(r.length+i.length);return o.set(r),o.set(i,r.length),o}function Fy(n){return zt(n.bcsToBytes(),`APTOS::${n.constructor.name}`)}function kt(n){let t=Vr(n);return n.feePayerAddress?zt(t.bcsToBytes(),Rr):n.secondarySignerAddresses?zt(t.bcsToBytes(),Rr):zt(t.bcsToBytes(),$i)}var Dt=class n{constructor(t){this.signingScheme=0;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=e.publicKey(),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(){let t=W.generate();return new n({privateKey:t})}static fromDerivationPath(t){let{path:e,mnemonic:r}=t,i=W.fromDerivationPath(e,r);return new n({privateKey:i})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new be(this.publicKey,this.privateKey.sign(t))}signTransactionWithAuthenticator(t){return new be(this.publicKey,this.signTransaction(t))}sign(t){return this.privateKey.sign(t)}signTransaction(t){return this.sign(kt(t))}};var Bt=class n{constructor(t){this.signingScheme=2;let{privateKey:e,address:r}=t;this.privateKey=e,this.publicKey=new k(e.publicKey()),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress()}static generate(t={}){let{scheme:e=0}=t,r;switch(e){case 0:r=W.generate();break;case 2:r=rt.generate();break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:r})}static fromDerivationPath(t){let{scheme:e=0,path:r,mnemonic:i}=t,o;switch(e){case 0:o=W.fromDerivationPath(r,i);break;case 2:o=rt.fromDerivationPath(r,i);break;default:throw new Error(`Unsupported signature scheme ${e}`)}return new n({privateKey:o})}verifySignature(t){return this.publicKey.verifySignature(t)}signWithAuthenticator(t){return new te(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new te(this.publicKey,this.signTransaction(t))}sign(t){return new M(this.privateKey.sign(t))}signTransaction(t){return this.sign(kt(t))}};var Le=class{static generate(t={}){let{scheme:e=0,legacy:r=!0}=t;return e===0&&r?Dt.generate():Bt.generate({scheme:e})}static fromPrivateKey(t){let{privateKey:e,address:r,legacy:i=!0}=t;return e instanceof W&&i?new Dt({privateKey:e,address:r}):new Bt({privateKey:e,address:r})}static fromPrivateKeyAndAddress(t){return this.fromPrivateKey(t)}static fromDerivationPath(t){let{scheme:e=0,mnemonic:r,path:i,legacy:o=!0}=t;return e===0&&o?Dt.fromDerivationPath({mnemonic:r,path:i}):Bt.fromDerivationPath({scheme:e,mnemonic:r,path:i})}static authKey(t){let{publicKey:e}=t;return e.authKey()}verifySignature(t){return this.publicKey.verifySignature(t)}};var cc=1209600,Gt=class Gt extends l{constructor(e){super();let{privateKey:r,expiryDateSecs:i,blinder:o}=e;this.privateKey=r,this.publicKey=new it(r.publicKey()),this.expiryDateSecs=i||_chunkHBPH2AD3js.d.call(void 0, _chunkHBPH2AD3js.c.call(void 0, )+cc),this.blinder=o!==void 0?g.fromHexInput(o).toUint8Array():uc();let s=Ur(this.publicKey.bcsToBytes(),93);s.push(BigInt(this.expiryDateSecs)),s.push(Xt(this.blinder));let a=Zt(s);this.nonce=a.toString()}getPublicKey(){return this.publicKey}isExpired(){return Math.floor(Date.now()/1e3)>this.expiryDateSecs}serialize(e){e.serializeU32AsUleb128(this.publicKey.variant),e.serializeBytes(this.privateKey.toUint8Array()),e.serializeU64(this.expiryDateSecs),e.serializeFixedBytes(this.blinder)}static deserialize(e){let r=e.deserializeUleb128AsU32(),i;switch(r){case 0:i=W.deserialize(e);break;default:throw new Error(`Unknown variant index for EphemeralPublicKey: ${r}`)}let o=e.deserializeU64(),s=e.deserializeFixedBytes(31);return new Gt({privateKey:i,expiryDateSecs:Number(o),blinder:s})}static fromBytes(e){return Gt.deserialize(new q(e))}static generate(e){let r;switch(_optionalChain([e, 'optionalAccess', _52 => _52.scheme])){case 0:default:r=W.generate()}return new Gt({privateKey:r,expiryDateSecs:_optionalChain([e, 'optionalAccess', _53 => _53.expiryDateSecs])})}sign(e){if(this.isExpired())throw new Error("EphemeralKeyPair has expired");return new we(this.privateKey.sign(e))}};Gt.BLINDER_LENGTH=31;var mt=Gt;function uc(){return _utils.randomBytes.call(void 0, mt.BLINDER_LENGTH)}var _eventemitter3 = require('eventemitter3'); var _eventemitter32 = _interopRequireDefault(_eventemitter3);var an=class an extends l{constructor(e){super();let{address:r,ephemeralKeyPair:i,uidKey:o,uidVal:s,aud:a,pepper:c,proof:p,proofFetchCallback:d,jwt:T}=e;if(this.ephemeralKeyPair=i,this.publicKey=G.create(e),this.accountAddress=r?u.from(r):this.publicKey.authKey().derivedAddress(),this.uidKey=o,this.uidVal=s,this.aud=a,this.jwt=T,this.emitter=new _eventemitter32.default,this.proofOrPromise=p,p instanceof ce)this.proof=p;else{if(d===void 0)throw new Error("Must provide callback for async proof fetch");this.emitter.on("proofFetchFinish",async m=>{await d(m),this.emitter.removeAllListeners()}),this.init(p)}this.signingScheme=2;let w=g.fromHexInput(c).toUint8Array();if(w.length!==an.PEPPER_LENGTH)throw new Error(`Pepper length in bytes should be ${an.PEPPER_LENGTH}`);this.pepper=w}async init(e){try{this.proof=await e,this.emitter.emit("proofFetchFinish",{status:"Success"})}catch(r){r instanceof Error?this.emitter.emit("proofFetchFinish",{status:"Failed",error:r.toString()}):this.emitter.emit("proofFetchFinish",{status:"Failed",error:"Unknown"})}}serialize(e){if(e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(e),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(e)}isExpired(){return this.ephemeralKeyPair.isExpired()}signWithAuthenticator(e){let r=new M(this.sign(e)),i=new k(this.publicKey);return new te(i,r)}signTransactionWithAuthenticator(e){let r=new M(this.signTransaction(e)),i=new k(this.publicKey);return new te(i,r)}async waitForProofFetch(){this.proofOrPromise instanceof Promise&&await this.proofOrPromise}sign(e){let{expiryDateSecs:r}=this.ephemeralKeyPair;if(this.isExpired())throw new Error("EphemeralKeyPair is expired");if(this.proof===void 0)throw new Error("Proof not defined");let i=this.ephemeralKeyPair.getPublicKey(),o=this.ephemeralKeyPair.sign(e);return new Ie({jwtHeader:_chunkHBPH2AD3js.e.call(void 0, this.jwt.split(".")[0]),ephemeralCertificate:new xt(this.proof,0),expiryDateSecs:r,ephemeralPublicKey:i,ephemeralSignature:o})}signTransaction(e){if(this.proof===void 0)throw new Error("Proof not found");let r=Vr(e),o=new $r(r,this.proof.proof).hash();return this.sign(o)}verifySignature(e){let{message:r,signature:i}=e;return!(this.isExpired()||!this.ephemeralKeyPair.getPublicKey().verifySignature({message:r,signature:i.ephemeralSignature}))}};an.PEPPER_LENGTH=31;var He=an,$r= exports.TransactionAndProof =class extends l{constructor(e,r){super();this.domainSeparator="APTOS::TransactionAndProof";this.transaction=e,this.proof=r}serialize(e){e.serializeFixedBytes(this.transaction.bcsToBytes()),e.serializeOption(this.proof)}hash(){return zt(this.bcsToBytes(),this.domainSeparator)}};var Qe=class n extends He{constructor(t){super(t)}serialize(t){if(t.serializeStr(this.jwt),t.serializeStr(this.uidKey),t.serializeFixedBytes(this.pepper),this.ephemeralKeyPair.serialize(t),this.proof===void 0)throw new Error("Connot serialize - proof undefined");this.proof.serialize(t)}static deserialize(t){let e=t.deserializeStr(),r=t.deserializeStr(),i=t.deserializeFixedBytes(31),o=mt.deserialize(t),s=ce.deserialize(t);return n.create({proof:s,pepper:i,uidKey:r,jwt:e,ephemeralKeyPair:o})}static fromBytes(t){return n.deserialize(new q(t))}static create(t){let{address:e,proof:r,jwt:i,ephemeralKeyPair:o,pepper:s,uidKey:a="sub",proofFetchCallback:c}=t,p=_jwtdecode.jwtDecode.call(void 0, i),d=p.iss;if(typeof p.aud!="string")throw new Error("aud was not found or an array of values");let T=p.aud,w=p[a];return new n({address:e,proof:r,ephemeralKeyPair:o,iss:d,uidKey:a,uidVal:w,aud:T,pepper:s,jwt:i,proofFetchCallback:c})}};var Hn=class n extends He{constructor(e){super(e);this.publicKey=he.create(e)}serialize(e){if(this.proof===void 0)throw new Error("Connot serialize - proof undefined");e.serializeStr(this.jwt),e.serializeStr(this.uidKey),e.serializeFixedBytes(this.pepper),this.publicKey.jwkAddress.serialize(e),this.ephemeralKeyPair.serialize(e),this.proof.serialize(e)}static deserialize(e){let r=e.deserializeStr(),i=e.deserializeStr(),o=e.deserializeFixedBytes(31),s=u.deserialize(e),a=mt.deserialize(e),c=ce.deserialize(e);return n.create({proof:c,pepper:o,jwkAddress:s,uidKey:i,jwt:r,ephemeralKeyPair:a})}static fromBytes(e){return n.deserialize(new q(e))}static create(e){let{address:r,proof:i,jwt:o,ephemeralKeyPair:s,pepper:a,jwkAddress:c,uidKey:p="sub",proofFetchCallback:d}=e,T=_jwtdecode.jwtDecode.call(void 0, o),w=T.iss;if(typeof T.aud!="string")throw new Error("aud was not found or an array of values");let m=T.aud,_=T[p];return new n({address:r,proof:i,ephemeralKeyPair:s,iss:w,uidKey:p,uidVal:_,aud:m,pepper:a,jwkAddress:u.from(c),jwt:o,proofFetchCallback:d})}};var Qn=class n{constructor(t){let{multiKey:e,signers:r,address:i}=t;this.publicKey=e,this.signingScheme=3,this.accountAddress=i?u.from(i):this.publicKey.authKey().derivedAddress();let o=[];for(let a of r)o.push(this.publicKey.getIndex(a.publicKey));let s=r.map((a,c)=>[a,o[c]]);s.sort((a,c)=>a[1]-c[1]),this.signers=s.map(a=>a[0]),this.signerIndicies=s.map(a=>a[1]),this.signaturesBitmap=this.publicKey.createBitmap({bits:o})}static fromPublicKeysAndSigners(t){let{publicKeys:e,signaturesRequired:r,signers:i}=t,o=new vt({publicKeys:e,signaturesRequired:r});return new n({multiKey:o,signers:i})}static isMultiKeySigner(t){return t instanceof n}signWithAuthenticator(t){return new ct(this.publicKey,this.sign(t))}signTransactionWithAuthenticator(t){return new ct(this.publicKey,this.signTransaction(t))}async waitForProofFetch(){let e=this.signers.filter(r=>r instanceof Qe).map(async r=>r.waitForProofFetch());await Promise.all(e)}sign(t){let e=[];for(let r of this.signers)e.push(r.sign(t));return new at({signatures:e,bitmap:this.signaturesBitmap})}signTransaction(t){let e=[];for(let r of this.signers)e.push(r.signTransaction(t));return new at({signatures:e,bitmap:this.signaturesBitmap})}verifySignature(t){let{message:e,signature:r}=t;if(!this.signerIndicies.every((o,s)=>s===0||o>=this.signerIndicies[s-1]))return!1;for(let o=0;o<r.signatures.length;o+=1){let s=r.signatures[o];if(!this.publicKey.publicKeys[this.signerIndicies[o]].verifySignature({message:e,signature:s}))return!1}return!0}};var gc=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -16,7 +16,7 @@
16
16
  transaction_version
17
17
  type
18
18
  }
19
- `,yc=`
19
+ `,mc=`
20
20
  fragment AnsTokenFragment on current_aptos_names {
21
21
  domain
22
22
  expiration_timestamp
@@ -75,7 +75,7 @@
75
75
  }
76
76
  }
77
77
  }
78
- `,ro=`
78
+ `,no=`
79
79
  query getAccountCoinsCount($address: String) {
80
80
  current_fungible_asset_balances_aggregate(
81
81
  where: {owner_address: {_eq: $address}}
@@ -85,7 +85,7 @@
85
85
  }
86
86
  }
87
87
  }
88
- `,io=`
88
+ `,ro=`
89
89
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
90
90
  current_fungible_asset_balances(
91
91
  where: $where_condition
@@ -118,7 +118,7 @@
118
118
  }
119
119
  }
120
120
  }
121
- `,oo=`
121
+ `,io=`
122
122
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
123
123
  current_collection_ownership_v2_view(
124
124
  where: $where_condition
@@ -152,7 +152,7 @@
152
152
  single_token_uri
153
153
  }
154
154
  }
155
- `,so=`
155
+ `,oo=`
156
156
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
157
157
  current_token_ownerships_v2(
158
158
  where: $where_condition
@@ -174,7 +174,7 @@
174
174
  ...CurrentTokenOwnershipFields
175
175
  }
176
176
  }
177
- ${Wn}`,ao=`
177
+ ${Wn}`,so=`
178
178
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
179
179
  current_token_ownerships_v2(
180
180
  where: $where_condition
@@ -185,7 +185,7 @@
185
185
  ...CurrentTokenOwnershipFields
186
186
  }
187
187
  }
188
- ${Wn}`,co=`
188
+ ${Wn}`,ao=`
189
189
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
190
190
  current_token_ownerships_v2_aggregate(
191
191
  where: $where_condition
@@ -197,7 +197,7 @@
197
197
  }
198
198
  }
199
199
  }
200
- `,uo=`
200
+ `,co=`
201
201
  query getAccountTransactionsCount($address: String) {
202
202
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
203
203
  aggregate {
@@ -205,13 +205,13 @@
205
205
  }
206
206
  }
207
207
  }
208
- `,po=`
208
+ `,uo=`
209
209
  query getChainTopUserTransactions($limit: Int) {
210
210
  user_transactions(limit: $limit, order_by: {version: desc}) {
211
211
  version
212
212
  }
213
213
  }
214
- `,lo=`
214
+ `,po=`
215
215
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
216
216
  current_collections_v2(where: $where_condition) {
217
217
  uri
@@ -241,7 +241,7 @@
241
241
  }
242
242
  }
243
243
  }
244
- `,go=`
244
+ `,lo=`
245
245
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
246
246
  current_fungible_asset_balances(
247
247
  where: $where_condition
@@ -259,7 +259,7 @@
259
259
  token_standard
260
260
  }
261
261
  }
262
- `,mo=`
262
+ `,go=`
263
263
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
264
264
  delegated_staking_activities(
265
265
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -272,7 +272,7 @@
272
272
  transaction_version
273
273
  }
274
274
  }
275
- `,yo=`
275
+ `,mo=`
276
276
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
277
277
  events(
278
278
  where: $where_condition
@@ -291,7 +291,7 @@
291
291
  indexed_type
292
292
  }
293
293
  }
294
- `,fo=`
294
+ `,yo=`
295
295
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
296
296
  fungible_asset_activities(
297
297
  where: $where_condition
@@ -316,7 +316,7 @@
316
316
  type
317
317
  }
318
318
  }
319
- `,Ao=`
319
+ `,fo=`
320
320
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
321
321
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
322
322
  icon_uri
@@ -346,7 +346,7 @@
346
346
  ...AnsTokenFragment
347
347
  }
348
348
  }
349
- ${yc}`,Lr=`
349
+ ${mc}`,Lr=`
350
350
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
351
351
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
352
352
  num_active_delegator
@@ -378,7 +378,7 @@
378
378
  last_updated
379
379
  }
380
380
  }
381
- `,ho=`
381
+ `,Ao=`
382
382
  query getTableItemsData($where_condition: table_items_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_items_order_by!]) {
383
383
  table_items(
384
384
  where: $where_condition
@@ -394,7 +394,7 @@
394
394
  write_set_change_index
395
395
  }
396
396
  }
397
- `,bo=`
397
+ `,ho=`
398
398
  query getTableItemsMetadata($where_condition: table_metadatas_bool_exp!, $offset: Int, $limit: Int, $order_by: [table_metadatas_order_by!]) {
399
399
  table_metadatas(
400
400
  where: $where_condition
@@ -407,7 +407,7 @@
407
407
  value_type
408
408
  }
409
409
  }
410
- `,To=`
410
+ `,bo=`
411
411
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
412
412
  token_activities_v2(
413
413
  where: $where_condition
@@ -418,7 +418,7 @@
418
418
  ...TokenActivitiesFields
419
419
  }
420
420
  }
421
- ${mc}`,Qr=`
421
+ ${gc}`,Qr=`
422
422
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
423
423
  current_token_ownerships_v2(
424
424
  where: $where_condition
@@ -429,7 +429,7 @@
429
429
  ...CurrentTokenOwnershipFields
430
430
  }
431
431
  }
432
- ${Wn}`,wo=`
432
+ ${Wn}`,To=`
433
433
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
434
434
  current_token_datas_v2(
435
435
  where: $where_condition
@@ -469,5 +469,5 @@
469
469
  }
470
470
  }
471
471
  }
472
- `;async function Xn(n){let{aptosConfig:t}=n,{data:e}=await H({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function So(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:po,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await Xi({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function fc(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:Hr},originMethod:"getProcessorStatuses"})).processor_status}async function Zn(n){let t=await fc({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Yn(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:Hr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Jn(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await Ne({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _54 => _54.ledgerVersion])},body:r})).data}async function xo(n){let{aptosConfig:t,options:e}=n,r={query:ho,variables:{where_condition:_optionalChain([e, 'optionalAccess', _55 => _55.where]),offset:_optionalChain([e, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([e, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([e, 'optionalAccess', _58 => _58.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsData"})).table_items}async function _o(n){let{aptosConfig:t,options:e}=n,r={query:bo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _59 => _59.where]),offset:_optionalChain([e, 'optionalAccess', _60 => _60.offset]),limit:_optionalChain([e, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([e, 'optionalAccess', _62 => _62.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function xe(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await H({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function Co(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return St({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function er(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?Po(n):Oe(async()=>Po(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Po(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await H({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _68 => _68.ledgerVersion])}});return o}async function Eo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return St({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([r, 'optionalAccess', _70 => _70.limit])}})}async function Io(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return St({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _71 => _71.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.limit]), () => (999))}})}async function Wr(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await H({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _74 => _74.ledgerVersion])}});return o.data}async function Nt(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await Wr({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Jn({aptosConfig:t,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof Ae&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Uo(n){let{aptosConfig:t,accountAddress:e}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:t,query:{query:co,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 Ro(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _75 => _75.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _76 => _76.tokenStandard])});let s={query:so,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _77 => _77.offset]),limit:_optionalChain([r, 'optionalAccess', _78 => _78.limit]),order_by:_optionalChain([r, 'optionalAccess', _79 => _79.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ko(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:i}=n,o=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _80 => _80.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _81 => _81.tokenStandard])});let c={query:ao,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _82 => _82.offset]),limit:_optionalChain([i, 'optionalAccess', _83 => _83.limit]),order_by:_optionalChain([i, 'optionalAccess', _84 => _84.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function zo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}};_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _86 => _86.tokenStandard])}});let s={query:oo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _87 => _87.offset]),limit:_optionalChain([r, 'optionalAccess', _88 => _88.limit]),order_by:_optionalChain([r, 'optionalAccess', _89 => _89.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function ko(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:uo,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function Do(n){let{aptosConfig:t,accountAddress:e,coinType:r,faMetadataAddress:i}=n,o=r,s;if(r!==void 0&&i!==void 0)s=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===ot?s=u.A.toStringLong():s=Mr(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=u.from(i);s=d.toStringLong(),d===u.A&&(o=ot)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=u.from(e).toStringLong(),c={asset_type:{_eq:s}};o!==void 0&&(c={asset_type:{_in:[o,s]}});let p=await jr({aptosConfig:t,accountAddress:a,options:{where:c}});return p[0]?p[0].amount:0}async function jr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _90 => _90.where]),owner_address:{_eq:i}},s={query:io,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([r, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([r, 'optionalAccess', _93 => _93.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Bo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:ro,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 Go(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:jn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _94 => _94.offset]),limit:_optionalChain([r, 'optionalAccess', _95 => _95.limit]),order_by:_optionalChain([r, 'optionalAccess', _96 => _96.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Fo(n){let{aptosConfig:t,privateKey:e}=n,r=new k(e.publicKey());if(e instanceof rt){let o=D.fromPublicKey({publicKey:r}).derivedAddress();return Le.fromPrivateKey({privateKey:e,address:o})}if(e instanceof W){let i=D.fromPublicKey({publicKey:r});if(await vo({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Le.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=D.fromPublicKey({publicKey:r.publicKey});if(await vo({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return Le.fromPrivateKey({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function vo(n){let{aptosConfig:t,authKey:e}=n,r=await Nt({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await xe({aptosConfig:t,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Zr(n){let{aptosConfig:t,options:e}=n;return St({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _97 => _97.offset]),limit:_optionalChain([e, 'optionalAccess', _98 => _98.limit])}})}async function nr(n){let{aptosConfig:t}=n;return Oe(async()=>{let{data:e}=await H({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function No(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await H({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function cn(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await H({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function Oo(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await cn({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _99 => _99.status])===404)return!0;throw r}}async function Ac(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await H({aptosConfig:t,path:`transactions/wait_by_hash/${e}`,originMethod:"longWaitForTransaction"});return r}async function Ot(n){let{aptosConfig:t,transactionHash:e,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _101 => _101.checkSuccess]), () => (!0)),s=!0,a=0,c,p,d=200,T=1.5;function w(m){if(!(m instanceof Ae)||(p=m,m.status!==404&&m.status>=400&&m.status<500))throw m}try{c=await cn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(m){w(m)}if(s){let m=Date.now();try{c=await Ac({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(_){w(_)}a=(Date.now()-m)/1e3}for(;s&&!(a>=i);){try{if(c=await cn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(m){w(m)}await _chunkHBPH2AD3js.b.call(void 0, d),a+=d/1e3,d*=T}if(c===void 0)throw p||new tr(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new tr(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Xr(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function rr(n){let{aptosConfig:t,processorType:e}=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(e===void 0?s=await Zn({aptosConfig:t}):s=(await Yn({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkHBPH2AD3js.b.call(void 0, 200)}}var tr=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Xr=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function Mo(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await H({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _102 => _102.withTransactions])}});return Vo({block:i,...n})}async function qo(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await H({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _103 => _103.withTransactions])}});return Vo({block:i,...n})}async function Vo(n){let{aptosConfig:t,block:e,options:r}=n;if(_optionalChain([r, 'optionalAccess', _104 => _104.withTransactions])){e.transactions=_nullishCoalesce(e.transactions, () => ([]));let i=e.transactions[e.transactions.length-1],o=BigInt(e.first_version),s=BigInt(e.last_version),a=_optionalChain([i, 'optionalAccess', _105 => _105.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return e;let p=[],d=100n;for(let w=c+1n;w<s;w+=BigInt(100))p.push(Zr({aptosConfig:t,options:{offset:w,limit:Math.min(Number(d),Number(s-w+1n))}}));let T=await Promise.all(p);for(let w of T)e.transactions.push(...w)}return e}async function A(n){n.minimumLedgerVersion!==void 0&&await rr({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function $o(n){return typeof n=="boolean"}function We(n){return typeof n=="string"}function hc(n){return typeof n=="number"}function ir(n){if(hc(n))return n;if(We(n)&&n!=="")return Number.parseInt(n,10)}function or(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Lo(n){return n==null}function Ho(n){return Yr(n)||ei(n)||ti(n)||ni(n)||ri(n)||ii(n)||oi(n)||sr(n)||Jr(n)||bc(n)||n instanceof h||n instanceof L}function Yr(n){return n instanceof I}function sr(n){return n instanceof u}function Jr(n){return n instanceof S}function bc(n){return n instanceof et}function ei(n){return n instanceof $}function ti(n){return n instanceof ge}function ni(n){return n instanceof me}function ri(n){return n instanceof O}function ii(n){return n instanceof ye}function oi(n){return n instanceof fe}function Qo(n){return"bytecode"in n}function U(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Wo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function un(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],i=t[2];return{moduleAddress:e,moduleName:r,functionName:i}}function jo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Xo(n){return!!n.match(/\s/)}function Tc(n){return!!n.match(/^T[0-9]+$/)}function wc(n){return!!n.match(/^&.+$/)}function Sc(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 xc(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Xo(r))break}return e}var _c=(_=>(_.InvalidTypeTag="unknown type",_.UnexpectedGenericType="unexpected generic type",_.UnexpectedTypeArgumentClose="unexpected '>'",_.UnexpectedWhitespaceCharacter="unexpected whitespace character",_.UnexpectedComma="unexpected ','",_.TypeArgumentCountMismatch="type argument count doesn't match expected amount",_.MissingTypeArgumentClose="no matching '>' for '<'",_.MissingTypeArgument="no type argument before ','",_.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",_.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",_.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",_.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",_.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",_.InvalidAddress="struct address must be valid",_))(_c||{}),N= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Ke(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _106 => _106.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let _=pn(a,i,e);o.push(_)}let d=r.pop();if(d===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:T,savedTypes:w,savedExpectedTypes:m}=d;i=o,o=w,a=T,c=m}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let d=pn(a,i,e);i=[],o.push(d),a="",c+=1}else if(Xo(p)){let d=!1;if(a.length!==0){let w=pn(a,i,e);i=[],o.push(w),a="",d=!0}s=xc(n,s);let T=n[s];if(s<n.length&&d&&T!==","&&T!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return pn(a,i,e);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function pn(n,t,e){let r=n.trim(),i=r.toLowerCase();if(Sc(i)&&t.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new Et;case"bool":return new F;case"address":return new X;case"u8":return new ue;case"u16":return new Me;case"u32":return new qe;case"u64":return new Q;case"u128":return new Ve;case"u256":return new $e;case"vector":if(t.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new E(t[0]);default:if(wc(r)){let a=r.substring(1);return new Mn(pn(a,t,e))}if(Tc(r)){if(e)return new z(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!jo(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!jo(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Ue(s,new R(o[1]),new R(o[2]),t))}}var Pc=new TextEncoder;function ar(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _107 => _107.map, 'call', _108 => _108(t=>We(t)?Ke(t):t)]), () => ([]))}async function Zo(n,t,e,r){let i=await er({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function Yo(n,t,e,r){let i=await Zo(n,t,e,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let o=Wo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ke(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Jo(n,t,e,r){let i=await Zo(n,t,e,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${t}::${e}'`);if(!i.is_view)throw new Error(`'${n}::${t}::${e}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Ke(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ke(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function ai(n,t,e,r,i){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let o=t.parameters[r];return Mt(e,o,r,i)}function Mt(n,t,e,r){return Ho(n)?(si(t,n,e),n):vc(n,t,e,r)}function vc(n,t,e,r){if(t.isBool()){if($o(n))return new I(n);if(We(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",e)}if(t.isAddress()){if(We(n))return u.fromString(n);U("string | AccountAddress",e)}if(t.isU8()){let i=ir(n);if(i!==void 0)return new $(i);U("number | string",e)}if(t.isU16()){let i=ir(n);if(i!==void 0)return new ge(i);U("number | string",e)}if(t.isU32()){let i=ir(n);if(i!==void 0)return new me(i);U("number | string",e)}if(t.isU64()){if(or(n))return new O(BigInt(n));U("bigint | number | string",e)}if(t.isU128()){if(or(n))return new ye(BigInt(n));U("bigint | number | string",e)}if(t.isU256()){if(or(n))return new fe(BigInt(n));U("bigint | number | string",e)}if(t.isGeneric()){let i=t.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return Mt(n,r[i],e,r)}if(t.isVector()){if(t.value.isU8()){if(We(n))return h.U8(Pc.encode(n));if(n instanceof Uint8Array)return h.U8(n);if(n instanceof ArrayBuffer)return h.U8(new Uint8Array(n))}if(Array.isArray(n))return new h(n.map(i=>Mt(i,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(We(n))return new S(n);U("string",e)}if(t.isObject()){if(We(n))return u.fromString(n);U("string | AccountAddress",e)}if(t.isOption()){if(Lo(n)){let i=t.value.typeArgs[0];return i instanceof F?new L(null):i instanceof X?new L(null):i instanceof ue?new L(null):i instanceof Me?new L(null):i instanceof qe?new L(null):i instanceof Q?new L(null):i instanceof Ve?new L(null):i instanceof $e?new L(null):new L(null)}return new L(Mt(n,t.value.typeArgs[0],e,r))}throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function si(n,t,e){if(n.isBool()){if(Yr(t))return;U("Bool",e)}if(n.isAddress()){if(sr(t))return;U("AccountAddress",e)}if(n.isU8()){if(ei(t))return;U("U8",e)}if(n.isU16()){if(ti(t))return;U("U16",e)}if(n.isU32()){if(ni(t))return;U("U32",e)}if(n.isU64()){if(ri(t))return;U("U64",e)}if(n.isU128()){if(ii(t))return;U("U128",e)}if(n.isU256()){if(oi(t))return;U("U256",e)}if(n.isVector()){if(t instanceof h){t.values.length>0&&si(n.value,t.values[0],e);return}U("MoveVector",e)}if(n instanceof y){if(n.isString()){if(Jr(t))return;U("MoveString",e)}if(n.isObject()){if(sr(t))return;U("AccountAddress",e)}if(n.isOption()){if(t instanceof L){t.value!==void 0&&si(n.value.typeArgs[0],t.value,e);return}U("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function ur(n){if(Qo(n))return Uc(n);let{moduleAddress:t,moduleName:e,functionName:r}=un(n.function),i=await rs({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Yo});return Ec({...n,abi:i})}function Ec(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=un(n.function),o=ar(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>ai(n.function,t,c,p,o));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);let a=pt.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new nn(new on(c,new sn(a)))}return new tn(a)}async function es(n){let{moduleAddress:t,moduleName:e,functionName:r}=un(n.function),i=await rs({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Jo});return Ic({abi:i,...n})}function Ic(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=un(n.function),o=ar(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _109 => _109.functionArguments, 'optionalAccess', _110 => _110.map, 'call', _111 => _111((a,c)=>ai(n.function,t,a,c,o))]), () => ([]));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);return pt.build(`${e}::${r}`,i,o,s)}function Uc(n){return new en(new rn(g.fromHexInput(n.bytecode).toUint8Array(),ar(n.typeArguments),n.functionArguments))}async function Rc(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Br[t.network]?{chainId:Br[t.network]}:{chainId:(await Xn({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _112 => _112.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await nr({aptosConfig:t})).gas_estimate},c=async()=>{let yt=async()=>_optionalChain([i, 'optionalAccess', _113 => _113.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await xe({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await yt()}catch (e3){return 0}else return yt()},[{chainId:p},{gasEstimate:d},T]=await Promise.all([s(),a(),c()]),{maxGasAmount:w,gasUnitPrice:m,expireTimestamp:_}={maxGasAmount:_optionalChain([i, 'optionalAccess', _114 => _114.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _115 => _115.gasUnitPrice]), () => (BigInt(d))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _116 => _116.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new pe(u.from(e),BigInt(T),r,BigInt(w),BigInt(m),BigInt(_),new Ct(p))}async function ci(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await Rc({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _117 => _117.secondarySignerAddresses, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(c=>u.from(c))]), () => ([]));return new Ln(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new $n(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function ts(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=cr(t);if(e.feePayerAddress){let a=new lt(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(T=>cr(T)));let p=cr(i),d=new Rt(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new gt(a.raw_txn,d).bcsToBytes()}if(e.secondarySignerAddresses){let a=new dt(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(d=>cr(d));let p=new Ut(o,e.secondarySignerAddresses,c);return new gt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof be)s=new It(o.public_key,o.signature);else if(o instanceof te)s=new Kt(o);else throw new Error("Invalid public key");return new gt(e.rawTransaction,s).bcsToBytes()}function cr(n){let e=G.isInstance(n)||he.isInstance(n)||ve.isInstance(n)?new k(n):n,r=new C(new Uint8Array(64));if(P.isInstance(e))return new be(e,r);if(k.isInstance(e))return G.isInstance(e.publicKey)?new te(e,new M(Ie.getSimulationSignature())):new te(e,new M(r));throw new Error("Unsupported public key")}function ui(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=ji(j,n.senderAuthenticator),o;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new Rt(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Ut(i,t.secondarySignerAddresses,r)}else i instanceof be?o=new It(i.public_key,i.signature):o=new Kt(i);return new gt(t.rawTransaction,o).bcsToBytes()}function ns(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var Kc=ns(["APTOS::Transaction"]);function Wh(n){let t=ui(n);return new g(ns([Kc,new Uint8Array([0]),t])).toString()}async function rs({key:n,moduleAddress:t,moduleName:e,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Oe(async()=>s(t,e,r,i),`${n}-${i.network}-${t}-${e}-${r}`,1e3*60*5)()}async function _e(n){let{aptosConfig:t,payload:e,options:r}=n,i=await es({...e,aptosConfig:t}),o=new V;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Ne({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion])},body:s});return a}async function is(n){let{aptosConfig:t,payload:e,options:r}=n,{data:i}=await Ne({aptosConfig:t,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _121 => _121.ledgerVersion])},body:{function:e.function,type_arguments:_nullishCoalesce(e.typeArguments, () => ([])),arguments:_nullishCoalesce(e.functionArguments, () => ([]))}});return i}var dn=class{constructor(t){this.config=t}async getAccountInfo(t){return xe({aptosConfig:this.config,...t})}async getAccountModules(t){return Co({aptosConfig:this.config,...t})}async getAccountModule(t){return er({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Eo({aptosConfig:this.config,...t})}async getAccountResources(t){return Io({aptosConfig:this.config,...t})}async getAccountResource(t){return Wr({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Nt({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Uo({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ro({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),zo({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),ko({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),jr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Bo({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:ot,faMetadataAddress:Vi,...t})}async getAccountCoinAmount(t){let{coinType:e,faMetadataAddress:r}=t;await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"});let i=e;if(e===void 0&&r!==void 0)try{let o=(await _e({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[r]}})).at(0);o.vec.length>0&&_chunkHBPH2AD3js.i.call(void 0, o.vec[0])&&(i=_chunkHBPH2AD3js.h.call(void 0, o.vec[0]))}catch (e4){}return Do({aptosConfig:this.config,...t,coinType:i})}async getAccountOwnedObjects(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),Go({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Fo({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var pr=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _122 => _122.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _123 => _123.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _124 => _124.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _125 => _125.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _126 => _126.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _127 => _127.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _128 => _128.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _129 => _129.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _130 => _130.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _131 => _131.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _132 => _132.faucetConfig]), () => ({}))}getRequestUrl(t){switch(t){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 Qi[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Wi[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 Hi[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 zr[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 kr[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return zr[this.network]===t}isProverServiceRequest(t){return kr[this.network]===t}};async function b(n){let t=await kc(n);return Dc(n,t)}async function kc(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await ur(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await ur(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await ur(r)),i}async function Dc(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(Bc(n)&&(o=u.ZERO.toString()),Gc(n)){let{secondarySignerAddresses:s}=n;return ci({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return ci({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function Bc(n){return n.withFeePayer===!0}function Gc(n){return"secondarySignerAddresses"in n}function os(n){let{transaction:t}=n;return kt(t)}function dr(n){let{signer:t,transaction:e}=n;return t.signTransactionWithAuthenticator(e)}async function pi(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=ts({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Ne({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function lr(n){let{aptosConfig:t}=n,e=ui({...n}),{data:r}=await Ne({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function ln(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof He||e instanceof Qn)&&await e.waitForProofFetch();let i=dr({signer:e,transaction:r});return lr({aptosConfig:t,transaction:r,senderAuthenticator:i})}var Fc={typeParameters:[],parameters:[E.u8(),new E(E.u8())]};async function ss(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>h.U8(a));return b({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)],abi:Fc},options:o})}var Nc={typeParameters:[],parameters:[new ue,E.u8(),new ue,E.u8(),E.u8(),E.u8()]};async function as(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await xe({aptosConfig:t,accountAddress:e.accountAddress}),o=Le.fromPrivateKey({privateKey:r,legacy:!0}),a=new Vn({sequenceNumber:BigInt(i.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=e.sign(a),p=o.sign(a),d=await b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new $(e.signingScheme),h.U8(e.publicKey.toUint8Array()),new $(o.signingScheme),h.U8(o.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(p.toUint8Array())],abi:Nc}});return ln({aptosConfig:t,signer:e,transaction:d})}var Oc={typeParameters:[{constraints:[]}],parameters:[new X,new Q]};async function cs(n){let{aptosConfig:t,sender:e,recipient:r,amount:i,coinType:o,options:s}=n;return b({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (ot))],functionArguments:[r,i],abi:Oc},options:s})}var gn=class{constructor(t){this.config=t}async transferCoinTransaction(t){return cs({aptosConfig:this.config,...t})}};var je={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},de="0x4::token::Token";async function us(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:wo,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function ps(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:t,query:{query:Qr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ds(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:Qr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _139 => _139.offset]),limit:_optionalChain([r, 'optionalAccess', _140 => _140.limit]),order_by:_optionalChain([r, 'optionalAccess', _141 => _141.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function ls(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:To,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _142 => _142.offset]),limit:_optionalChain([r, 'optionalAccess', _143 => _143.limit]),order_by:_optionalChain([r, 'optionalAccess', _144 => _144.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Mc={typeParameters:[],parameters:[new y(v()),new Q,new y(v()),new y(v()),new F,new F,new F,new F,new F,new F,new F,new F,new F,new Q,new Q]};async function gs(n){let{aptosConfig:t,options:e,creator:r}=n;return b({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new S(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Ye))),new S(n.name),new S(n.uri),new I(_nullishCoalesce(n.mutableDescription, () => (!0))),new I(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new I(_nullishCoalesce(n.mutableURI, () => (!0))),new I(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new I(_nullishCoalesce(n.mutableTokenName, () => (!0))),new I(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new I(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new I(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new I(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Mc},options:e})}async function qt(n){let{aptosConfig:t,options:e}=n,r=_optionalChain([e, 'optionalAccess', _145 => _145.where]);_optionalChain([e, 'optionalAccess', _146 => _146.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([e, 'optionalAccess', _147 => _147.tokenStandard]), () => ("v2"))});let i={query:lo,variables:{where_condition:r,offset:_optionalChain([e, 'optionalAccess', _148 => _148.offset]),limit:_optionalChain([e, 'optionalAccess', _149 => _149.limit])}};return(await f({aptosConfig:t,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function ms(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:i}=n,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _150 => _150.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _151 => _151.tokenStandard]), () => ("v2"))}),qt({aptosConfig:t,options:{...i,where:s}})}async function ys(n){let{aptosConfig:t,creatorAddress:e,options:r}=n,o={creator_address:{_eq:u.from(e).toStringLong()}};return _optionalChain([r, 'optionalAccess', _152 => _152.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),qt({aptosConfig:t,options:{...r,where:o}})}async function fs(n){let{aptosConfig:t,collectionId:e,options:r}=n,o={collection_id:{_eq:u.from(e).toStringLong()}};return _optionalChain([r, 'optionalAccess', _154 => _154.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),qt({aptosConfig:t,options:{...r,where:o}})}async function As(n){let{creatorAddress:t,collectionName:e,options:r,aptosConfig:i}=n,o=u.from(t),s={collection_name:{_eq:e},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _156 => _156.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _157 => _157.tokenStandard]), () => ("v2"))}),(await qt({aptosConfig:i,options:{where:s}})).collection_id}var qc={typeParameters:[],parameters:[new y(v()),new y(v()),new y(v()),new y(v()),new E(new y(v())),new E(new y(v())),new E(E.u8())]};async function hs(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:d}=n,T=_optionalChain([p, 'optionalAccess', _158 => _158.map, 'call', _159 => _159(w=>je[w])]);return b({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new S(i),new S(o),new S(s),new S(a),h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(T, () => ([]))),Ks(_nullishCoalesce(d, () => ([])),_nullishCoalesce(T, () => ([])))],abi:qc},options:e})}var Vc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new X]};async function bs(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(r),u.from(i)],abi:Vc},options:s})}var $c={typeParameters:[],parameters:[new y(v()),new y(v()),new y(v()),new y(v()),new E(new y(v())),new E(new y(v())),new E(E.u8()),new X]};async function Ts(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:d,options:T}=n;if(_optionalChain([c, 'optionalAccess', _160 => _160.length])!==_optionalChain([d, 'optionalAccess', _161 => _161.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _162 => _162.length])!==_optionalChain([d, 'optionalAccess', _163 => _163.length]))throw new Error("Property types and property values counts do not match");let w=_optionalChain([p, 'optionalAccess', _164 => _164.map, 'call', _165 => _165(m=>je[m])]);return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(w, () => ([]))),Ks(_nullishCoalesce(d, () => ([])),_nullishCoalesce(w, () => ([]))),a],abi:$c},options:T})}var Lc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function ws(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (de))],functionArguments:[u.from(r)],abi:Lc},options:o})}var Hc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function Ss(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (de))],functionArguments:[r],abi:Hc},options:o})}var Qc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function xs(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (de))],functionArguments:[r],abi:Qc},options:o})}var Wc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function _s(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:Wc},options:s})}var jc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function Ps(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:jc},options:s})}var Xc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function vs(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:Xc},options:s})}var Zc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v()),new y(v()),E.u8()]};async function Cs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (de))],functionArguments:[u.from(s),new S(r),new S(je[i]),h.U8(di(o,je[i]))],abi:Zc},options:c})}var Yc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function Es(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:Yc},options:s})}var Jc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v()),new y(v()),E.u8()]};async function Is(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (de))],functionArguments:[u.from(s),new S(r),new S(je[i]),di(o,je[i])],abi:Jc},options:c})}var eu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ie(new z(0))),new y(v()),new z(1)]};async function Us(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (de)),je[i]],functionArguments:[u.from(s),new S(r),o],abi:eu},options:c})}var tu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ie(new z(0))),new y(v()),new z(1)]};async function Rs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (de)),je[i]],functionArguments:[u.from(s),new S(r),o],abi:tu},options:c})}function Ks(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(di(n[i],r))}),e}function di(n,t){let e=Ke(t);return Mt(n,e,0,[]).bcsToBytes()}var mn=class{constructor(t){this.config=t}async getCollectionData(t){await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:e,collectionName:r,options:i}=t,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _166 => _166.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _167 => _167.tokenStandard]), () => ("v2"))}),qt({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ms({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ys({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),fs({aptosConfig:this.config,...t})}async getCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),As({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),us({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ps({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ds({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ls({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return gs({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return hs({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return bs({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return Ts({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return ws({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return Ss({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return xs({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return _s({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return Ps({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return vs({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return Cs({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return Es({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return Is({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return Us({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return Rs({aptosConfig:this.config,...t})}};var zs=300,nu=n=>{if(n&&n.length>zs)throw new Error(`Event type length exceeds the maximum length of ${zs}`)};async function ks(n){let{aptosConfig:t,eventType:e,options:r}=n,i={_or:[{account_address:{_eq:e.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:e}};return yn({aptosConfig:t,options:{...r,where:i}})}async function Ds(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:i}=n,s={account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}};return yn({aptosConfig:e,options:{...i,where:s}})}async function Bs(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:i}=n,s={account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}};return yn({aptosConfig:e,options:{...i,where:s}})}async function yn(n){let{aptosConfig:t,options:e}=n;nu(_optionalChain([e, 'optionalAccess', _168 => _168.where, 'optionalAccess', _169 => _169.indexed_type, 'optionalAccess', _170 => _170._eq]));let r={query:yo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _171 => _171.where]),offset:_optionalChain([e, 'optionalAccess', _172 => _172.offset]),limit:_optionalChain([e, 'optionalAccess', _173 => _173.limit]),order_by:_optionalChain([e, 'optionalAccess', _174 => _174.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var fn=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ks({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Ds({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Bs({aptosConfig:this.config,...t})}async getEvents(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _175 => _175.minimumLedgerVersion]),processorType:"events_processor"}),yn({aptosConfig:this.config,...t})}};async function Gs(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _176 => _176.timeoutSecs])||20,{data:s}=await Zi({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Ot({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _177 => _177.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var An=class{constructor(t){this.config=t}async fundAccount(t){let e=await Gs({aptosConfig:this.config,...t});return(_optionalChain([t, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.waitForIndexer])===void 0||_optionalChain([t, 'access', _180 => _180.options, 'optionalAccess', _181 => _181.waitForIndexer]))&&await rr({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version),processorType:"fungible_asset_processor"}),e}};async function gr(n){let{aptosConfig:t,options:e}=n,r={query:Ao,variables:{where_condition:_optionalChain([e, 'optionalAccess', _182 => _182.where]),limit:_optionalChain([e, 'optionalAccess', _183 => _183.limit]),offset:_optionalChain([e, 'optionalAccess', _184 => _184.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Fs(n){let{aptosConfig:t,options:e}=n,r={query:fo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _185 => _185.where]),limit:_optionalChain([e, 'optionalAccess', _186 => _186.limit]),offset:_optionalChain([e, 'optionalAccess', _187 => _187.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Ns(n){let{aptosConfig:t,options:e}=n,r={query:go,variables:{where_condition:_optionalChain([e, 'optionalAccess', _188 => _188.where]),limit:_optionalChain([e, 'optionalAccess', _189 => _189.limit]),offset:_optionalChain([e, 'optionalAccess', _190 => _190.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var ru={typeParameters:[{constraints:[]}],parameters:[Ke("0x1::object::Object"),new X,new Q]};async function Os(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:ru},options:s})}var hn=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _191 => _191.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),gr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _192 => _192.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await gr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await gr({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(t.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _194 => _194.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Fs({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _195 => _195.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Ns({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Os({aptosConfig:this.config,...t})}};var bn=class{constructor(t){this.config=t}async getLedgerInfo(){return Xn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Mo({aptosConfig:this.config,...t})}async getBlockByHeight(t){return qo({aptosConfig:this.config,...t})}async view(t){return _e({aptosConfig:this.config,...t})}async viewJson(t){return is({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return So({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Zn({aptosConfig:this.config})}async getProcessorStatus(t){return Yn({aptosConfig:this.config,processorType:t})}};var Ms=["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 qs(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Xe(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!qs(t))throw new Error(`${t} is not valid. ${Ms}`);if(e&&!qs(e))throw new Error(`${e} is not valid. ${Ms}`);return{domainName:e||t,subdomainName:e?t:void 0}}function Vs(n){if(!n)return!1;let t=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),e=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&t?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!e}var iu="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",ou={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:iu,custom:null,devnet:null};function ze(n){let t=ou[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var mr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function $s(n){let{aptosConfig:t,name:e}=n,r=ze(t),{domainName:i,subdomainName:o}=Xe(e),s=await _e({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=mr(s[0]);return a?u.from(a):void 0}async function Ls(n){let{aptosConfig:t,expiration:e,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=ze(t),{domainName:d,subdomainName:T}=Xe(r),w=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(T&&!w)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(w&&!T)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let Tr=_nullishCoalesce(e.years, () => (1));if(Tr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let pa=Tr*31536e3;return await b({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[d,pa,o,s]},options:a})}if(!T)throw new Error(`${e.policy} requires a subdomain to be provided.`);let m=await li({aptosConfig:t,name:d});if(!m)throw new Error("The domain does not exist");let _=e.policy==="subdomain:independent"?e.expirationDate:m;if(_>m)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await b({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[d,T,Math.round(_/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function li(n){let{aptosConfig:t,name:e}=n,r=ze(t),{domainName:i,subdomainName:o}=Xe(e);try{let s=await _e({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e5){return}}async function Hs(n){let{aptosConfig:t,address:e}=n,r=ze(t),i=await _e({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=mr(i[1]),s=mr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Qs(n){let{aptosConfig:t,sender:e,name:r,options:i}=n,o=ze(t);if(!r)return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Xe(r);return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Ws(n){let{aptosConfig:t,name:e}=n,r=ze(t),{domainName:i,subdomainName:o}=Xe(e),s=await _e({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=mr(s[0]);return a?u.from(a):void 0}async function js(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=ze(t),{domainName:a,subdomainName:c}=Xe(r);return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function Xs(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:i=""}=Xe(e),a=(await f({aptosConfig:t,query:{query:Ft,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Tn(a)),Vs(a)?a:void 0}async function Zs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await gi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _196 => _196.limit]),offset:_optionalChain([e, 'optionalAccess', _197 => _197.offset]),order_by:_optionalChain([e, 'optionalAccess', _198 => _198.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _199 => _199.options, 'optionalAccess', _200 => _200.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Tn)}async function Ys(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await gi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _201 => _201.limit]),offset:_optionalChain([e, 'optionalAccess', _202 => _202.offset]),order_by:_optionalChain([e, 'optionalAccess', _203 => _203.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Tn)}async function Js(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await gi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _206 => _206.limit]),offset:_optionalChain([e, 'optionalAccess', _207 => _207.offset]),order_by:_optionalChain([e, 'optionalAccess', _208 => _208.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Tn)}async function ea(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([e, 'optionalAccess', _212 => _212.offset]),order_by:_optionalChain([e, 'optionalAccess', _213 => _213.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Tn).filter(Vs)}async function gi(n){let{aptosConfig:t}=n,e=ze(t),[r]=await _e({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function ta(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=ze(t),a=i*31536e3,{domainName:c,subdomainName:p}=Xe(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Tn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var wn=class{constructor(t){this.config=t}async getOwnerAddress(t){return $s({aptosConfig:this.config,...t})}async getExpiration(t){return li({aptosConfig:this.config,...t})}async getTargetAddress(t){return Ws({aptosConfig:this.config,...t})}async setTargetAddress(t){return js({aptosConfig:this.config,...t})}async getPrimaryName(t){return Hs({aptosConfig:this.config,...t})}async setPrimaryName(t){return Qs({aptosConfig:this.config,...t})}async registerName(t){return Ls({aptosConfig:this.config,...t})}async renewDomain(t){return ta({aptosConfig:this.config,...t})}async getName(t){return Xs({aptosConfig:this.config,...t})}async getAccountNames(t){return Zs({aptosConfig:this.config,...t})}async getAccountDomains(t){return Ys({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Js({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return ea({aptosConfig:this.config,...t})}};async function na(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Lr,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 ra(n){let{aptosConfig:t,options:e}=n,r={query:Lr,variables:{order_by:_optionalChain([e, 'optionalAccess', _216 => _216.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function ia(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:mo,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var Sn=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"stake_processor"}),na({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _218 => _218.minimumLedgerVersion]),processorType:"stake_processor"}),ra({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),ia({aptosConfig:this.config,...t})}};var yr=class{constructor(t){this.config=t}async simple(t){return b({aptosConfig:this.config,...t})}async multiAgent(t){return b({aptosConfig:this.config,...t})}};function mi(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},e}function yi(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},e}var Vt=class{constructor(t){this.config=t}async simple(t){return pi({aptosConfig:this.config,...t})}async multiAgent(t){return pi({aptosConfig:this.config,...t})}};_chunkHBPH2AD3js.a.call(void 0, [yi],Vt.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [yi],Vt.prototype,"multiAgent",1);var $t=class{constructor(t){this.config=t}async simple(t){return lr({aptosConfig:this.config,...t})}async multiAgent(t){return lr({aptosConfig:this.config,...t})}};_chunkHBPH2AD3js.a.call(void 0, [mi],$t.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [mi],$t.prototype,"multiAgent",1);var fr=class{constructor(t,e,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=_chunkHBPH2AD3js.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),_chunkHBPH2AD3js.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await xe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await xe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=_chunkHBPH2AD3js.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkHBPH2AD3js.c.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Lt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _220 => _220.pendingDequeue, 'access', _221 => _221.shift, 'call', _222 => _222(), 'optionalAccess', _223 => _223.resolve, 'call', _224 => _224(t)]);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Ht("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Ht=class extends Error{};var oa="fulfilled",sa= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(sa||{}),Ar= exports.TransactionWorker =class extends _eventemitter32.default{constructor(e,r,i=30,o=100,s=10){super();this.taskQueue=new Lt;this.transactionsQueue=new Lt;this.outstandingTransactions=new Lt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new fr(e,r,i,o,s)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let i=ln({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,e])}}catch(e){if(e instanceof Ht)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(e.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),e.push(i),r.push(o);let s=await Promise.allSettled(e);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===oa?(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(e){if(e instanceof Ht)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let i=[];i.push(Ot({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===oa?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:e.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(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return b({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}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 hr=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new Ar(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:i}=e;for(let o of r)this.transactionWorker.push(o,i)}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:r,data:i,options:o}=e;this.start({sender:r}),this.push({data:i,options:o})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var xn=class{constructor(t){this.config=t,this.build=new yr(this.config),this.simulate=new Vt(this.config),this.submit=new $t(this.config),this.batch=new hr(this.config)}async getTransactions(t){return Zr({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return No({aptosConfig:this.config,...t})}async getTransactionByHash(t){return cn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return Oo({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ot({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return nr({aptosConfig:this.config})}getSigningMessage(t){return os(t)}async publishPackageTransaction(t){return ss({aptosConfig:this.config,...t})}async rotateAuthKey(t){return as({aptosConfig:this.config,...t})}sign(t){return dr({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,dr({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:i}=t;this.batch.forSingleAccount({sender:e,data:r,options:i})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return ln({aptosConfig:this.config,signer:e,transaction:r})}};var _n=class{constructor(t){this.config=t}async getTableItem(t){return Jn({aptosConfig:this.config,...t})}async getTableItemsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),xo({aptosConfig:this.config,...t})}async getTableItemsMetadata(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),_o({aptosConfig:this.config,...t})}};async function br(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Yi({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function fi(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i=await br(n),uidKey:o="sub"}=n;if(g.fromHexInput(i).toUint8Array().length!==Qe.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Qe.PEPPER_LENGTH} bytes`);let{maxExpHorizonSecs:s}=await to({aptosConfig:t}),a={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:999999999999,pepper:g.fromHexInput(i).toStringWithoutPrefix(),uid_key:o,use_insecure_test_jwk:!0};console.log(JSON.stringify(a));let{data:c}=await Ji({aptosConfig:t,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}});console.log(JSON.stringify(c));let p=c.proof,d=new _t({a:p.a,b:p.b,c:p.c});return new ce({proof:new Pt(d,0),trainingWheelsSignature:we.fromHex(c.training_wheels_signature),expHorizonSecs:s})}async function aa(n){let{aptosConfig:t,jwt:e,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await br(n)}=n,a=fi({...n,pepper:s}),c=o?a:await a;if(r!==void 0){let T=he.fromJwtAndPepper({jwt:e,pepper:s,jwkAddress:r,uidKey:i}),w=await Nt({aptosConfig:t,authenticationKey:T.authKey().derivedAddress()});return Hn.create({...n,address:w,proof:c,pepper:s,proofFetchCallback:o,jwkAddress:r})}let p=G.fromJwtAndPepper({jwt:e,pepper:s,uidKey:i}),d=await Nt({aptosConfig:t,authenticationKey:p.authKey().derivedAddress()});return Qe.create({...n,address:d,proof:c,pepper:s,proofFetchCallback:o})}async function ca(n){let{aptosConfig:t,sender:e,iss:r}=n,i=_nullishCoalesce(n.jwksUrl, () => ((r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`))),o=await fetch(i);if(!o.ok)throw new Error(`Failed to fetch JWKS: ${o.status} ${o.statusText}`);let s=await o.json();return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,h.MoveString(s.keys.map(a=>a.kid)),h.MoveString(s.keys.map(a=>a.alg)),h.MoveString(s.keys.map(a=>a.e)),h.MoveString(s.keys.map(a=>a.n))]}})}var Pn=class{constructor(t){this.config=t}async getPepper(t){return br({aptosConfig:this.config,...t})}async getProof(t){return fi({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return aa({aptosConfig:this.config,...t})}async updateFederatedKeylessJwkSetTransaction(t){return ca({aptosConfig:this.config,...t})}};async function cu(n){let{aptosConfig:t,options:e}=n,r={query:jn,variables:{where_condition:_optionalChain([e, 'optionalAccess', _225 => _225.where]),offset:_optionalChain([e, 'optionalAccess', _226 => _226.offset]),limit:_optionalChain([e, 'optionalAccess', _227 => _227.limit]),order_by:_optionalChain([e, 'optionalAccess', _228 => _228.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getObjectData"})).current_objects}async function ua(n){let{aptosConfig:t,objectAddress:e,options:r}=n,o={object_address:{_eq:u.from(e).toStringLong()}};return(await cu({aptosConfig:t,options:{...r,where:o}}))[0]}var vn=class{constructor(t){this.config=t}async getObjectDataByObjectAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"objects_processor"}),ua({aptosConfig:this.config,...t})}};var Z=class{constructor(t){this.config=new pr(t),this.account=new dn(this.config),this.ans=new wn(this.config),this.coin=new gn(this.config),this.digitalAsset=new mn(this.config),this.event=new fn(this.config),this.faucet=new An(this.config),this.fungibleAsset=new hn(this.config),this.general=new bn(this.config),this.staking=new Sn(this.config),this.transaction=new xn(this.config),this.table=new _n(this.config),this.keyless=new Pn(this.config),this.object=new vn(this.config)}};function oe(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(t.prototype,r);i&&(i.value=function(...o){return this[e][r](...o)},Object.defineProperty(n.prototype,r,i))})}oe(Z,dn,"account");oe(Z,wn,"ans");oe(Z,gn,"coin");oe(Z,mn,"digitalAsset");oe(Z,fn,"event");oe(Z,An,"faucet");oe(Z,hn,"fungibleAsset");oe(Z,bn,"general");oe(Z,Sn,"staking");oe(Z,xn,"transaction");oe(Z,_n,"table");oe(Z,Pn,"keyless");oe(Z,vn,"object");exports.APTOS_BIP44_REGEX = xa; exports.APTOS_COIN = ot; exports.APTOS_FA = Vi; exports.APTOS_HARDENED_REGEX = Sa; exports.Account = Le; exports.AccountAddress = u; exports.AccountAuthenticator = j; exports.AccountAuthenticatorEd25519 = be; exports.AccountAuthenticatorMultiEd25519 = On; exports.AccountAuthenticatorMultiKey = ct; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = Pi; exports.AccountPublicKey = ee; exports.AccountSequenceNumber = fr; exports.AddressInvalidReason = ha; exports.AnyPublicKey = k; exports.AnyPublicKeyVariant = Kn; exports.AnySignature = M; exports.AnySignatureVariant = vi; exports.Aptos = Z; exports.AptosApiError = Ae; exports.AptosApiType = wt; exports.AptosConfig = pr; exports.AuthenticationKey = D; exports.Bool = I; exports.CKDPriv = Di; exports.ChainId = Ct; exports.DEFAULT_MAX_GAS_AMOUNT = Mi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = qi; exports.DEFAULT_TXN_TIMEOUT_SEC = Fn; exports.DeriveScheme = Ii; exports.Deserializer = q; exports.EPK_HORIZON_SECS = Ml; exports.Ed25519Account = Dt; exports.Ed25519PrivateKey = W; exports.Ed25519PublicKey = P; exports.Ed25519Signature = C; exports.EntryFunction = pt; exports.EntryFunctionBytes = Un; exports.EphemeralCertificate = xt; exports.EphemeralCertificateVariant = xr; exports.EphemeralKeyPair = mt; exports.EphemeralPublicKey = it; exports.EphemeralPublicKeyVariant = Sr; exports.EphemeralSignature = we; exports.EphemeralSignatureVariant = Ci; exports.FederatedKeylessAccount = Hn; exports.FederatedKeylessPublicKey = he; exports.FeePayerRawTransaction = lt; exports.FixedBytes = et; exports.Groth16Zkp = _t; exports.HARDENED_OFFSET = Ki; exports.Hex = g; exports.HexInvalidReason = ga; exports.Identifier = R; exports.KeyType = _a; exports.KeylessAccount = Qe; exports.KeylessAccountCommon = He; exports.KeylessConfiguration = Nr; exports.KeylessPublicKey = G; exports.KeylessSignature = Ie; exports.MAX_AUD_VAL_BYTES = ec; exports.MAX_COMMITED_EPK_BYTES = Ll; exports.MAX_EXTRA_FIELD_BYTES = Vl; exports.MAX_ISS_VAL_BYTES = ql; exports.MAX_JWT_HEADER_B64_BYTES = $l; exports.MAX_UID_KEY_BYTES = tc; exports.MAX_UID_VAL_BYTES = nc; exports.MimeType = Rn; exports.ModuleId = Jt; exports.MoveAbility = Ei; exports.MoveFunctionVisibility = ya; exports.MoveOption = L; exports.MoveString = S; exports.MoveVector = h; exports.MultiAgentRawTransaction = dt; exports.MultiAgentTransaction = Ln; exports.MultiEd25519PublicKey = ht; exports.MultiEd25519Signature = nt; exports.MultiKey = vt; exports.MultiKeyAccount = Qn; exports.MultiKeySignature = at; exports.MultiSig = on; exports.MultiSigTransactionPayload = sn; exports.Network = Dr; exports.NetworkToChainId = Br; exports.NetworkToFaucetAPI = Wi; exports.NetworkToIndexerAPI = Hi; exports.NetworkToNetworkName = qd; exports.NetworkToNodeAPI = Qi; exports.NetworkToPepperAPI = zr; exports.NetworkToProverAPI = kr; exports.ParsingError = J; exports.ProcessorType = Ce; exports.PublicKey = tt; exports.RAW_TRANSACTION_SALT = $i; exports.RAW_TRANSACTION_WITH_DATA_SALT = Rr; exports.RawTransaction = pe; exports.RawTransactionWithData = qn; exports.RoleType = fa; exports.RotationProofChallenge = Vn; exports.Script = rn; exports.ScriptTransactionArgumentVariants = Wt; exports.Secp256k1PrivateKey = rt; exports.Secp256k1PublicKey = ve; exports.Secp256k1Signature = Tt; exports.Serializable = l; exports.Serialized = jt; exports.Serializer = V; exports.Signature = B; exports.SignedTransaction = gt; exports.SigningScheme = le; exports.SigningSchemeInput = vr; exports.SimpleTransaction = $n; exports.SingleKeyAccount = Bt; exports.StructTag = Ue; exports.TransactionAndProof = $r; exports.TransactionAuthenticator = Re; exports.TransactionAuthenticatorEd25519 = It; exports.TransactionAuthenticatorFeePayer = Rt; exports.TransactionAuthenticatorMultiAgent = Ut; exports.TransactionAuthenticatorMultiEd25519 = qr; exports.TransactionAuthenticatorSingleSender = Kt; exports.TransactionAuthenticatorVariant = _i; exports.TransactionPayload = ut; exports.TransactionPayloadEntryFunction = tn; exports.TransactionPayloadMultiSig = nn; exports.TransactionPayloadScript = en; exports.TransactionPayloadVariants = Si; exports.TransactionResponseType = Pr; exports.TransactionVariants = xi; exports.TransactionWorker = Ar; exports.TransactionWorkerEventsEnum = sa; exports.TypeTag = K; exports.TypeTagAddress = X; exports.TypeTagBool = F; exports.TypeTagGeneric = z; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = _c; exports.TypeTagReference = Mn; exports.TypeTagSigner = Et; exports.TypeTagStruct = y; exports.TypeTagU128 = Ve; exports.TypeTagU16 = Me; exports.TypeTagU256 = $e; exports.TypeTagU32 = qe; exports.TypeTagU64 = Q; exports.TypeTagU8 = ue; exports.TypeTagVariants = wi; exports.TypeTagVector = E; exports.U128 = ye; exports.U16 = ge; exports.U256 = fe; exports.U32 = me; exports.U64 = O; exports.U8 = $; exports.ZeroKnowledgeSig = ce; exports.ZkProof = Pt; exports.ZkpVariant = _r; exports.aptosCoinStructTag = vm; exports.aptosRequest = Nn; exports.base64UrlDecode = _chunkHBPH2AD3js.e; exports.buildTransaction = ci; exports.checkOrConvertArgument = Mt; exports.convertAmountFromHumanReadableToOnChain = _chunkHBPH2AD3js.f; exports.convertAmountFromOnChainToHumanReadable = _chunkHBPH2AD3js.g; exports.convertArgument = ai; exports.convertNumber = ir; exports.createObjectAddress = Mr; exports.createResourceAddress = nm; exports.createTokenAddress = rm; exports.deriveKey = Cr; exports.deriveTransactionType = Vr; exports.deserializeFromScriptArgument = sc; exports.ensureBoolean = wr; exports.fetchEntryFunctionAbi = Yo; exports.fetchFunctionAbi = Zo; exports.fetchViewFunctionAbi = Jo; exports.findFirstNonSignerArg = Wo; exports.floorToWholeHour = _chunkHBPH2AD3js.d; exports.generateRawTransaction = Rc; exports.generateSignedTransaction = ui; exports.generateSignedTransactionForSimulation = ts; exports.generateSigningMessage = zt; exports.generateSigningMessageForSerializable = Fy; exports.generateSigningMessageForTransaction = kt; exports.generateTransactionPayload = ur; exports.generateTransactionPayloadWithABI = Ec; exports.generateUserTransactionHash = Wh; exports.generateViewFunctionPayload = es; exports.generateViewFunctionPayloadWithABI = Ic; exports.get = Gr; exports.getAptosFullNode = H; exports.getAptosPepperService = dl; exports.getAuthenticatorForSimulation = cr; exports.getFunctionParts = un; exports.getKeylessConfig = to; exports.hashValues = ns; exports.isBcsAddress = sr; exports.isBcsBool = Yr; exports.isBcsFixedBytes = bc; exports.isBcsString = Jr; exports.isBcsU128 = ii; exports.isBcsU16 = ti; exports.isBcsU256 = oi; exports.isBcsU32 = ni; exports.isBcsU64 = ri; exports.isBcsU8 = ei; exports.isBlockEpilogueTransactionResponse = Nu; exports.isBlockMetadataTransactionResponse = Bu; exports.isBool = $o; exports.isCanonicalEd25519Signature = va; exports.isEd25519Signature = Ou; exports.isEmptyOption = Lo; exports.isEncodedEntryFunctionArgument = Ho; exports.isEncodedStruct = _chunkHBPH2AD3js.i; exports.isFeePayerSignature = Vu; exports.isGenesisTransactionResponse = Du; exports.isLargeNumber = or; exports.isMultiAgentSignature = qu; exports.isMultiEd25519Signature = $u; exports.isNumber = hc; exports.isPendingTransactionResponse = zu; exports.isScriptDataInput = Qo; exports.isSecp256k1Signature = Mu; exports.isStateCheckpointTransactionResponse = Gu; exports.isString = We; exports.isUserTransactionResponse = ku; exports.isValidBIP44Path = zi; exports.isValidHardenedPath = ki; exports.isValidatorTransactionResponse = Fu; exports.mnemonicToSeed = zn; exports.normalizeBundle = ji; exports.nowInSeconds = _chunkHBPH2AD3js.c; exports.objectStructTag = ie; exports.optionStructTag = Cm; exports.outOfRangeErrorMessage = ma; exports.paginateWithCursor = St; exports.parseEncodedStruct = _chunkHBPH2AD3js.h; exports.parseTypeTag = Ke; exports.post = Yt; exports.postAptosFaucet = Zi; exports.postAptosFullNode = Ne; exports.postAptosIndexer = Xi; exports.postAptosPepperService = Yi; exports.postAptosProvingService = Ji; exports.promiseFulfilledStatus = oa; exports.request = Ya; exports.sleep = _chunkHBPH2AD3js.b; exports.splitPath = Bi; exports.standardizeTypeTags = ar; exports.stringStructTag = v; exports.throwTypeMismatch = U; exports.validateNumberInRange = De;
472
+ `;async function Xn(n){let{aptosConfig:t}=n,{data:e}=await H({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function wo(n){let{aptosConfig:t,limit:e}=n;return(await f({aptosConfig:t,query:{query:uo,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function f(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:i}=await Xi({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return i}async function yc(n){let{aptosConfig:t}=n;return(await f({aptosConfig:t,query:{query:Hr},originMethod:"getProcessorStatuses"})).processor_status}async function Zn(n){let t=await yc({aptosConfig:n.aptosConfig});return BigInt(t[0].last_success_version)}async function Yn(n){let{aptosConfig:t,processorType:e}=n;return(await f({aptosConfig:t,query:{query:Hr,variables:{where_condition:{processor:{_eq:e}}}},originMethod:"getProcessorStatus"})).processor_status[0]}async function Jn(n){let{aptosConfig:t,handle:e,data:r,options:i}=n;return(await Ne({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _54 => _54.ledgerVersion])},body:r})).data}async function So(n){let{aptosConfig:t,options:e}=n,r={query:Ao,variables:{where_condition:_optionalChain([e, 'optionalAccess', _55 => _55.where]),offset:_optionalChain([e, 'optionalAccess', _56 => _56.offset]),limit:_optionalChain([e, 'optionalAccess', _57 => _57.limit]),order_by:_optionalChain([e, 'optionalAccess', _58 => _58.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsData"})).table_items}async function xo(n){let{aptosConfig:t,options:e}=n,r={query:ho,variables:{where_condition:_optionalChain([e, 'optionalAccess', _59 => _59.where]),offset:_optionalChain([e, 'optionalAccess', _60 => _60.offset]),limit:_optionalChain([e, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([e, 'optionalAccess', _62 => _62.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getTableItemsMetadata"})).table_metadatas}async function xe(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await H({aptosConfig:t,originMethod:"getInfo",path:`accounts/${u.from(e).toString()}`});return r}async function vo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return St({aptosConfig:t,originMethod:"getModules",path:`accounts/${u.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _63 => _63.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _64 => _64.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _65 => _65.limit]), () => (1e3))}})}async function er(n){return _optionalChain([n, 'access', _66 => _66.options, 'optionalAccess', _67 => _67.ledgerVersion])!==void 0?_o(n):Oe(async()=>_o(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function _o(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:i}=n,{data:o}=await H({aptosConfig:t,originMethod:"getModule",path:`accounts/${u.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _68 => _68.ledgerVersion])}});return o}async function Co(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return St({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${u.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([r, 'optionalAccess', _70 => _70.limit])}})}async function Eo(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return St({aptosConfig:t,originMethod:"getResources",path:`accounts/${u.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _71 => _71.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _72 => _72.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.limit]), () => (999))}})}async function Wr(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:i}=n,{data:o}=await H({aptosConfig:t,originMethod:"getResource",path:`accounts/${u.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([i, 'optionalAccess', _74 => _74.ledgerVersion])}});return o.data}async function Nt(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,i=await Wr({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:o}}=i,s=u.from(e);try{let a=await Jn({aptosConfig:t,handle:o,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return u.from(a)}catch(a){if(a instanceof Ae&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Io(n){let{aptosConfig:t,accountAddress:e}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},s=await f({aptosConfig:t,query:{query:ao,variables:{where_condition:i}},originMethod:"getAccountTokensCount"});return s.current_token_ownerships_v2_aggregate.aggregate?s.current_token_ownerships_v2_aggregate.aggregate.count:0}async function Uo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _75 => _75.tokenStandard])&&(o.token_standard={_eq:_optionalChain([r, 'optionalAccess', _76 => _76.tokenStandard])});let s={query:oo,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _77 => _77.offset]),limit:_optionalChain([r, 'optionalAccess', _78 => _78.limit]),order_by:_optionalChain([r, 'optionalAccess', _79 => _79.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Ro(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:i}=n,o=u.from(e).toStringLong(),s=u.from(r).toStringLong(),a={owner_address:{_eq:o},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([i, 'optionalAccess', _80 => _80.tokenStandard])&&(a.token_standard={_eq:_optionalChain([i, 'optionalAccess', _81 => _81.tokenStandard])});let c={query:so,variables:{where_condition:a,offset:_optionalChain([i, 'optionalAccess', _82 => _82.offset]),limit:_optionalChain([i, 'optionalAccess', _83 => _83.limit]),order_by:_optionalChain([i, 'optionalAccess', _84 => _84.orderBy])}};return(await f({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Ko(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}};_optionalChain([r, 'optionalAccess', _85 => _85.tokenStandard])&&(o.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _86 => _86.tokenStandard])}});let s={query:io,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _87 => _87.offset]),limit:_optionalChain([r, 'optionalAccess', _88 => _88.limit]),order_by:_optionalChain([r, 'optionalAccess', _89 => _89.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function zo(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:co,variables:{address:r}},originMethod:"getAccountTransactionsCount"});return o.account_transactions_aggregate.aggregate?o.account_transactions_aggregate.aggregate.count:0}async function ko(n){let{aptosConfig:t,accountAddress:e,coinType:r,faMetadataAddress:i}=n,o=r,s;if(r!==void 0&&i!==void 0)s=u.from(i).toStringLong();else if(r!==void 0&&i===void 0)r===ot?s=u.A.toStringLong():s=Mr(u.A,r).toStringLong();else if(r===void 0&&i!==void 0){let d=u.from(i);s=d.toStringLong(),d===u.A&&(o=ot)}else throw new Error("Either coinType, fungibleAssetAddress, or both must be provided");let a=u.from(e).toStringLong(),c={asset_type:{_eq:s}};o!==void 0&&(c={asset_type:{_in:[o,s]}});let p=await jr({aptosConfig:t,accountAddress:a,options:{where:c}});return p[0]?p[0].amount:0}async function jr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i=u.from(e).toStringLong(),o={..._optionalChain([r, 'optionalAccess', _90 => _90.where]),owner_address:{_eq:i}},s={query:ro,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _91 => _91.offset]),limit:_optionalChain([r, 'optionalAccess', _92 => _92.limit]),order_by:_optionalChain([r, 'optionalAccess', _93 => _93.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Do(n){let{aptosConfig:t,accountAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:no,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 Bo(n){let{aptosConfig:t,accountAddress:e,options:r}=n,o={owner_address:{_eq:u.from(e).toStringLong()}},s={query:jn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _94 => _94.offset]),limit:_optionalChain([r, 'optionalAccess', _95 => _95.limit]),order_by:_optionalChain([r, 'optionalAccess', _96 => _96.orderBy])}};return(await f({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function Go(n){let{aptosConfig:t,privateKey:e}=n,r=new k(e.publicKey());if(e instanceof rt){let o=D.fromPublicKey({publicKey:r}).derivedAddress();return Le.fromPrivateKey({privateKey:e,address:o})}if(e instanceof W){let i=D.fromPublicKey({publicKey:r});if(await Po({authKey:i,aptosConfig:t})){let c=i.derivedAddress();return Le.fromPrivateKey({privateKey:e,address:c,legacy:!1})}let s=D.fromPublicKey({publicKey:r.publicKey});if(await Po({authKey:s,aptosConfig:t})){let c=s.derivedAddress();return Le.fromPrivateKey({privateKey:e,address:c,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Po(n){let{aptosConfig:t,authKey:e}=n,r=await Nt({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await xe({aptosConfig:t,accountAddress:r}),!0}catch(i){if(i.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}async function Zr(n){let{aptosConfig:t,options:e}=n;return St({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _97 => _97.offset]),limit:_optionalChain([e, 'optionalAccess', _98 => _98.limit])}})}async function nr(n){let{aptosConfig:t}=n;return Oe(async()=>{let{data:e}=await H({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function Fo(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await H({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function cn(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await H({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function No(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await cn({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _99 => _99.status])===404)return!0;throw r}}async function fc(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await H({aptosConfig:t,path:`transactions/wait_by_hash/${e}`,originMethod:"longWaitForTransaction"});return r}async function Ot(n){let{aptosConfig:t,transactionHash:e,options:r}=n,i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _100 => _100.timeoutSecs]), () => (20)),o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _101 => _101.checkSuccess]), () => (!0)),s=!0,a=0,c,p,d=200,T=1.5;function w(m){if(!(m instanceof Ae)||(p=m,m.status!==404&&m.status>=400&&m.status<500))throw m}try{c=await cn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(m){w(m)}if(s){let m=Date.now();try{c=await fc({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction"}catch(_){w(_)}a=(Date.now()-m)/1e3}for(;s&&!(a>=i);){try{if(c=await cn({aptosConfig:t,transactionHash:e}),s=c.type==="pending_transaction",!s)break}catch(m){w(m)}await _chunkHBPH2AD3js.b.call(void 0, d),a+=d/1e3,d*=T}if(c===void 0)throw p||new tr(`Fetching transaction ${e} failed and timed out after ${i} seconds`,c);if(c.type==="pending_transaction")throw new tr(`Transaction ${e} timed out in pending state after ${i} seconds`,c);if(!o)return c;if(!c.success)throw new Xr(`Transaction ${e} failed with an error: ${c.vm_status}`,c);return c}async function rr(n){let{aptosConfig:t,processorType:e}=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(e===void 0?s=await Zn({aptosConfig:t}):s=(await Yn({aptosConfig:t,processorType:e})).last_success_version,s>=r)break;await _chunkHBPH2AD3js.b.call(void 0, 200)}}var tr=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},Xr=class extends Error{constructor(e,r){super(e);this.transaction=r}};async function Oo(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:i}=await H({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _102 => _102.withTransactions])}});return qo({block:i,...n})}async function Mo(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:i}=await H({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _103 => _103.withTransactions])}});return qo({block:i,...n})}async function qo(n){let{aptosConfig:t,block:e,options:r}=n;if(_optionalChain([r, 'optionalAccess', _104 => _104.withTransactions])){e.transactions=_nullishCoalesce(e.transactions, () => ([]));let i=e.transactions[e.transactions.length-1],o=BigInt(e.first_version),s=BigInt(e.last_version),a=_optionalChain([i, 'optionalAccess', _105 => _105.version]),c;if(a===void 0?c=o-1n:c=BigInt(a),c===s)return e;let p=[],d=100n;for(let w=c+1n;w<s;w+=BigInt(100))p.push(Zr({aptosConfig:t,options:{offset:w,limit:Math.min(Number(d),Number(s-w+1n))}}));let T=await Promise.all(p);for(let w of T)e.transactions.push(...w)}return e}async function A(n){n.minimumLedgerVersion!==void 0&&await rr({aptosConfig:n.config,minimumLedgerVersion:n.minimumLedgerVersion,processorType:n.processorType})}function Vo(n){return typeof n=="boolean"}function We(n){return typeof n=="string"}function Ac(n){return typeof n=="number"}function ir(n){if(Ac(n))return n;if(We(n)&&n!=="")return Number.parseInt(n,10)}function or(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function $o(n){return n==null}function Lo(n){return Yr(n)||ei(n)||ti(n)||ni(n)||ri(n)||ii(n)||oi(n)||sr(n)||Jr(n)||hc(n)||n instanceof h||n instanceof L}function Yr(n){return n instanceof I}function sr(n){return n instanceof u}function Jr(n){return n instanceof S}function hc(n){return n instanceof et}function ei(n){return n instanceof $}function ti(n){return n instanceof ge}function ni(n){return n instanceof me}function ri(n){return n instanceof O}function ii(n){return n instanceof ye}function oi(n){return n instanceof fe}function Ho(n){return"bytecode"in n}function U(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Qo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function un(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],i=t[2];return{moduleAddress:e,moduleName:r,functionName:i}}function Wo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function jo(n){return!!n.match(/\s/)}function bc(n){return!!n.match(/^T[0-9]+$/)}function Tc(n){return!!n.match(/^&.+$/)}function wc(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 Sc(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!jo(r))break}return e}var xc=(_=>(_.InvalidTypeTag="unknown type",_.UnexpectedGenericType="unexpected generic type",_.UnexpectedTypeArgumentClose="unexpected '>'",_.UnexpectedWhitespaceCharacter="unexpected whitespace character",_.UnexpectedComma="unexpected ','",_.TypeArgumentCountMismatch="type argument count doesn't match expected amount",_.MissingTypeArgumentClose="no matching '>' for '<'",_.MissingTypeArgument="no type argument before ','",_.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",_.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",_.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",_.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",_.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",_.InvalidAddress="struct address must be valid",_))(xc||{}),N= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Ke(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _106 => _106.allowGenerics]), () => (!1)),r=[],i=[],o=[],s=0,a="",c=1;for(;s<n.length;){let p=n[s];if(p==="<")r.push({savedExpectedTypes:c,savedStr:a,savedTypes:o}),a="",o=[],c=1;else if(p===">"){if(a!==""){let _=pn(a,i,e);o.push(_)}let d=r.pop();if(d===void 0)throw new N(n,"unexpected '>'");if(c!==o.length)throw new N(n,"type argument count doesn't match expected amount");let{savedStr:T,savedTypes:w,savedExpectedTypes:m}=d;i=o,o=w,a=T,c=m}else if(p===","){if(r.length===0)throw new N(n,"unexpected ','");if(a.length===0)throw new N(n,"no type argument before ','");let d=pn(a,i,e);i=[],o.push(d),a="",c+=1}else if(jo(p)){let d=!1;if(a.length!==0){let w=pn(a,i,e);i=[],o.push(w),a="",d=!0}s=Sc(n,s);let T=n[s];if(s<n.length&&d&&T!==","&&T!==">")throw new N(n,"unexpected whitespace character");continue}else a+=p;s+=1}if(r.length>0)throw new N(n,"no matching '>' for '<'");switch(o.length){case 0:return pn(a,i,e);case 1:if(a==="")return o[0];throw new N(n,"unexpected ','");default:throw new N(n,"unexpected whitespace character")}}function pn(n,t,e){let r=n.trim(),i=r.toLowerCase();if(wc(i)&&t.length>0)throw new N(n,"primitive types not expected to have type arguments");switch(r.toLowerCase()){case"signer":return new Et;case"bool":return new F;case"address":return new X;case"u8":return new ue;case"u16":return new Me;case"u32":return new qe;case"u64":return new Q;case"u128":return new Ve;case"u256":return new $e;case"vector":if(t.length!==1)throw new N(n,"vector type expected to have exactly one type argument");return new E(t[0]);default:if(Tc(r)){let a=r.substring(1);return new Mn(pn(a,t,e))}if(bc(r)){if(e)return new z(Number(r.split("T")[1]));throw new N(n,"unexpected generic type")}if(!r.match(/:/))throw new N(n,"unknown type");let o=r.split("::");if(o.length!==3)throw new N(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");let s;try{s=u.fromString(o[0])}catch (e2){throw new N(n,"struct address must be valid")}if(!Wo(o[1]))throw new N(n,"module name must only contain alphanumeric or '_' characters");if(!Wo(o[2]))throw new N(n,"struct name must only contain alphanumeric or '_' characters");return new y(new Ue(s,new R(o[1]),new R(o[2]),t))}}var _c=new TextEncoder;function ar(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _107 => _107.map, 'call', _108 => _108(t=>We(t)?Ke(t):t)]), () => ([]))}async function Xo(n,t,e,r){let i=await er({aptosConfig:r,accountAddress:n,moduleName:t});if(i.abi)return i.abi.exposed_functions.find(o=>o.name===e)}async function Zo(n,t,e,r){let i=await Xo(n,t,e,r);if(!i)throw new Error(`Could not find entry function ABI for '${n}::${t}::${e}'`);if(!i.is_entry)throw new Error(`'${n}::${t}::${e}' is not an entry function`);let o=Qo(i),s=[];for(let a=o;a<i.params.length;a+=1)s.push(Ke(i.params[a],{allowGenerics:!0}));return{signers:o,typeParameters:i.generic_type_params,parameters:s}}async function Yo(n,t,e,r){let i=await Xo(n,t,e,r);if(!i)throw new Error(`Could not find view function ABI for '${n}::${t}::${e}'`);if(!i.is_view)throw new Error(`'${n}::${t}::${e}' is not an view function`);let o=[];for(let a=0;a<i.params.length;a+=1)o.push(Ke(i.params[a],{allowGenerics:!0}));let s=[];for(let a=0;a<i.return.length;a+=1)s.push(Ke(i.return[a],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:o,returnTypes:s}}function ai(n,t,e,r,i){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);let o=t.parameters[r];return Mt(e,o,r,i)}function Mt(n,t,e,r){return Lo(n)?(si(t,n,e),n):Pc(n,t,e,r)}function Pc(n,t,e,r){if(t.isBool()){if(Vo(n))return new I(n);if(We(n)){if(n==="true")return new I(!0);if(n==="false")return new I(!1)}U("boolean",e)}if(t.isAddress()){if(We(n))return u.fromString(n);U("string | AccountAddress",e)}if(t.isU8()){let i=ir(n);if(i!==void 0)return new $(i);U("number | string",e)}if(t.isU16()){let i=ir(n);if(i!==void 0)return new ge(i);U("number | string",e)}if(t.isU32()){let i=ir(n);if(i!==void 0)return new me(i);U("number | string",e)}if(t.isU64()){if(or(n))return new O(BigInt(n));U("bigint | number | string",e)}if(t.isU128()){if(or(n))return new ye(BigInt(n));U("bigint | number | string",e)}if(t.isU256()){if(or(n))return new fe(BigInt(n));U("bigint | number | string",e)}if(t.isGeneric()){let i=t.value;if(i<0||i>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);return Mt(n,r[i],e,r)}if(t.isVector()){if(t.value.isU8()){if(We(n))return h.U8(_c.encode(n));if(n instanceof Uint8Array)return h.U8(n);if(n instanceof ArrayBuffer)return h.U8(new Uint8Array(n))}if(Array.isArray(n))return new h(n.map(i=>Mt(i,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(We(n))return new S(n);U("string",e)}if(t.isObject()){if(We(n))return u.fromString(n);U("string | AccountAddress",e)}if(t.isOption()){if($o(n)){let i=t.value.typeArgs[0];return i instanceof F?new L(null):i instanceof X?new L(null):i instanceof ue?new L(null):i instanceof Me?new L(null):i instanceof qe?new L(null):i instanceof Q?new L(null):i instanceof Ve?new L(null):i instanceof $e?new L(null):new L(null)}return new L(Mt(n,t.value.typeArgs[0],e,r))}throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function si(n,t,e){if(n.isBool()){if(Yr(t))return;U("Bool",e)}if(n.isAddress()){if(sr(t))return;U("AccountAddress",e)}if(n.isU8()){if(ei(t))return;U("U8",e)}if(n.isU16()){if(ti(t))return;U("U16",e)}if(n.isU32()){if(ni(t))return;U("U32",e)}if(n.isU64()){if(ri(t))return;U("U64",e)}if(n.isU128()){if(ii(t))return;U("U128",e)}if(n.isU256()){if(oi(t))return;U("U256",e)}if(n.isVector()){if(t instanceof h){t.values.length>0&&si(n.value,t.values[0],e);return}U("MoveVector",e)}if(n instanceof y){if(n.isString()){if(Jr(t))return;U("MoveString",e)}if(n.isObject()){if(sr(t))return;U("AccountAddress",e)}if(n.isOption()){if(t instanceof L){t.value!==void 0&&si(n.value.typeArgs[0],t.value,e);return}U("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function ur(n){if(Ho(n))return Ic(n);let{moduleAddress:t,moduleName:e,functionName:r}=un(n.function),i=await ns({key:"entry-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Zo});return Cc({...n,abi:i})}function Cc(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=un(n.function),o=ar(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=n.functionArguments.map((c,p)=>ai(n.function,t,c,p,o));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);let a=pt.build(`${e}::${r}`,i,o,s);if("multisigAddress"in n){let c=u.from(n.multisigAddress);return new nn(new on(c,new sn(a)))}return new tn(a)}async function Jo(n){let{moduleAddress:t,moduleName:e,functionName:r}=un(n.function),i=await ns({key:"view-function",moduleAddress:t,moduleName:e,functionName:r,aptosConfig:n.aptosConfig,abi:n.abi,fetch:Yo});return Ec({abi:i,...n})}function Ec(n){let t=n.abi,{moduleAddress:e,moduleName:r,functionName:i}=un(n.function),o=ar(n.typeArguments);if(o.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${o.length}`);let s=_nullishCoalesce(_optionalChain([n, 'optionalAccess', _109 => _109.functionArguments, 'optionalAccess', _110 => _110.map, 'call', _111 => _111((a,c)=>ai(n.function,t,a,c,o))]), () => ([]));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${i}', expected ${t.parameters.length} but got ${s.length}`);return pt.build(`${e}::${r}`,i,o,s)}function Ic(n){return new en(new rn(g.fromHexInput(n.bytecode).toUint8Array(),ar(n.typeArguments),n.functionArguments))}async function Uc(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=async()=>Br[t.network]?{chainId:Br[t.network]}:{chainId:(await Xn({aptosConfig:t})).chain_id},a=async()=>_optionalChain([i, 'optionalAccess', _112 => _112.gasUnitPrice])?{gasEstimate:i.gasUnitPrice}:{gasEstimate:(await nr({aptosConfig:t})).gas_estimate},c=async()=>{let yt=async()=>_optionalChain([i, 'optionalAccess', _113 => _113.accountSequenceNumber])!==void 0?i.accountSequenceNumber:(await xe({aptosConfig:t,accountAddress:e})).sequence_number;if(o&&u.from(o).equals(u.ZERO))try{return await yt()}catch (e3){return 0}else return yt()},[{chainId:p},{gasEstimate:d},T]=await Promise.all([s(),a(),c()]),{maxGasAmount:w,gasUnitPrice:m,expireTimestamp:_}={maxGasAmount:_optionalChain([i, 'optionalAccess', _114 => _114.maxGasAmount])?BigInt(i.maxGasAmount):BigInt(2e5),gasUnitPrice:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _115 => _115.gasUnitPrice]), () => (BigInt(d))),expireTimestamp:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _116 => _116.expireTimestamp]), () => (BigInt(Math.floor(Date.now()/1e3)+20)))};return new pe(u.from(e),BigInt(T),r,BigInt(w),BigInt(m),BigInt(_),new Ct(p))}async function ci(n){let{aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o}=n,s=await Uc({aptosConfig:t,sender:e,payload:r,options:i,feePayerAddress:o});if("secondarySignerAddresses"in n){let a=_nullishCoalesce(_optionalChain([n, 'access', _117 => _117.secondarySignerAddresses, 'optionalAccess', _118 => _118.map, 'call', _119 => _119(c=>u.from(c))]), () => ([]));return new Ln(s,a,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}return new $n(s,n.feePayerAddress?u.from(n.feePayerAddress):void 0)}function es(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:i}=n,o=cr(t);if(e.feePayerAddress){let a=new lt(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),c=[];r&&(c=r.map(T=>cr(T)));let p=cr(i),d=new Rt(o,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),c,{address:e.feePayerAddress,authenticator:p});return new gt(a.raw_txn,d).bcsToBytes()}if(e.secondarySignerAddresses){let a=new dt(e.rawTransaction,e.secondarySignerAddresses),c=[];c=r.map(d=>cr(d));let p=new Ut(o,e.secondarySignerAddresses,c);return new gt(a.raw_txn,p).bcsToBytes()}let s;if(o instanceof be)s=new It(o.public_key,o.signature);else if(o instanceof te)s=new Kt(o);else throw new Error("Invalid public key");return new gt(e.rawTransaction,s).bcsToBytes()}function cr(n){let e=G.isInstance(n)||he.isInstance(n)||ve.isInstance(n)?new k(n):n,r=new C(new Uint8Array(64));if(P.isInstance(e))return new be(e,r);if(k.isInstance(e))return G.isInstance(e.publicKey)?new te(e,new M(Ie.getSimulationSignature())):new te(e,new M(r));throw new Error("Unsupported public key")}function ui(n){let{transaction:t,feePayerAuthenticator:e,additionalSignersAuthenticators:r}=n,i=ji(j,n.senderAuthenticator),o;if(t.feePayerAddress){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");o=new Rt(i,_nullishCoalesce(t.secondarySignerAddresses, () => ([])),_nullishCoalesce(r, () => ([])),{address:t.feePayerAddress,authenticator:e})}else if(t.secondarySignerAddresses){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");o=new Ut(i,t.secondarySignerAddresses,r)}else i instanceof be?o=new It(i.public_key,i.signature):o=new Kt(i);return new gt(t.rawTransaction,o).bcsToBytes()}function ts(n){let t=_sha3.sha3_256.create();for(let e of n)t.update(e);return t.digest()}var Rc=ts(["APTOS::Transaction"]);function Wh(n){let t=ui(n);return new g(ts([Rc,new Uint8Array([0]),t])).toString()}async function ns({key:n,moduleAddress:t,moduleName:e,functionName:r,aptosConfig:i,abi:o,fetch:s}){return o!==void 0?o:Oe(async()=>s(t,e,r,i),`${n}-${i.network}-${t}-${e}-${r}`,1e3*60*5)()}async function _e(n){let{aptosConfig:t,payload:e,options:r}=n,i=await Jo({...e,aptosConfig:t}),o=new V;i.serialize(o);let s=o.toUint8Array(),{data:a}=await Ne({aptosConfig:t,path:"view",originMethod:"view",contentType:"application/x.aptos.view_function+bcs",params:{ledger_version:_optionalChain([r, 'optionalAccess', _120 => _120.ledgerVersion])},body:s});return a}async function rs(n){let{aptosConfig:t,payload:e,options:r}=n,{data:i}=await Ne({aptosConfig:t,originMethod:"viewJson",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _121 => _121.ledgerVersion])},body:{function:e.function,type_arguments:_nullishCoalesce(e.typeArguments, () => ([])),arguments:_nullishCoalesce(e.functionArguments, () => ([]))}});return i}var dn=class{constructor(t){this.config=t}async getAccountInfo(t){return xe({aptosConfig:this.config,...t})}async getAccountModules(t){return vo({aptosConfig:this.config,...t})}async getAccountModule(t){return er({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Co({aptosConfig:this.config,...t})}async getAccountResources(t){return Eo({aptosConfig:this.config,...t})}async getAccountResource(t){return Wr({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return Nt({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),Io({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Uo({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ro({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),Ko({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"account_transactions_processor"}),zo({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),jr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"}),Do({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return this.getAccountCoinAmount({coinType:ot,faMetadataAddress:Vi,...t})}async getAccountCoinAmount(t){let{coinType:e,faMetadataAddress:r}=t;await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"fungible_asset_processor"});let i=e;if(e===void 0&&r!==void 0)try{let o=(await _e({aptosConfig:this.config,payload:{function:"0x1::coin::paired_coin",functionArguments:[r]}})).at(0);o.vec.length>0&&_chunkHBPH2AD3js.i.call(void 0, o.vec[0])&&(i=_chunkHBPH2AD3js.h.call(void 0, o.vec[0]))}catch (e4){}return ko({aptosConfig:this.config,...t,coinType:i})}async getAccountOwnedObjects(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),Bo({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Go({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var pr=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _122 => _122.network]), () => ("devnet")),this.fullnode=_optionalChain([t, 'optionalAccess', _123 => _123.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _124 => _124.faucet]),this.pepper=_optionalChain([t, 'optionalAccess', _125 => _125.pepper]),this.prover=_optionalChain([t, 'optionalAccess', _126 => _126.prover]),this.indexer=_optionalChain([t, 'optionalAccess', _127 => _127.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _128 => _128.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _129 => _129.clientConfig]), () => ({})),this.fullnodeConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _130 => _130.fullnodeConfig]), () => ({})),this.indexerConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _131 => _131.indexerConfig]), () => ({})),this.faucetConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _132 => _132.faucetConfig]), () => ({}))}getRequestUrl(t){switch(t){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 Qi[this.network];case"Faucet":if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Wi[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 Hi[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 zr[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 kr[this.network];default:throw Error(`apiType ${t} is not supported`)}}isPepperServiceRequest(t){return zr[this.network]===t}isProverServiceRequest(t){return kr[this.network]===t}};async function b(n){let t=await zc(n);return kc(n,t)}async function zc(n){let{aptosConfig:t,data:e}=n,r,i;return"bytecode"in e?i=await ur(e):"multisigAddress"in e?(r={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await ur(r)):(r={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments,abi:e.abi},i=await ur(r)),i}async function kc(n,t){let{aptosConfig:e,sender:r,options:i}=n,o;if(Dc(n)&&(o=u.ZERO.toString()),Bc(n)){let{secondarySignerAddresses:s}=n;return ci({aptosConfig:e,sender:r,payload:t,options:i,secondarySignerAddresses:s,feePayerAddress:o})}return ci({aptosConfig:e,sender:r,payload:t,options:i,feePayerAddress:o})}function Dc(n){return n.withFeePayer===!0}function Bc(n){return"secondarySignerAddresses"in n}function is(n){let{transaction:t}=n;return kt(t)}function dr(n){let{signer:t,transaction:e}=n;return t.signTransactionWithAuthenticator(e)}async function pi(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}=n,a=es({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:i,feePayerPublicKey:o,options:s}),{data:c}=await Ne({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _133 => _133.options, 'optionalAccess', _134 => _134.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _135 => _135.options, 'optionalAccess', _136 => _136.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return c}async function lr(n){let{aptosConfig:t}=n,e=ui({...n}),{data:r}=await Ne({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function ln(n){let{aptosConfig:t,signer:e,transaction:r}=n;(e instanceof He||e instanceof Qn)&&await e.waitForProofFetch();let i=dr({signer:e,transaction:r});return lr({aptosConfig:t,transaction:r,senderAuthenticator:i})}var Gc={typeParameters:[],parameters:[E.u8(),new E(E.u8())]};async function os(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:i,options:o}=n,s=i.map(a=>h.U8(a));return b({aptosConfig:t,sender:u.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[h.U8(r),new h(s)],abi:Gc},options:o})}var Fc={typeParameters:[],parameters:[new ue,E.u8(),new ue,E.u8(),E.u8(),E.u8()]};async function ss(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,i=await xe({aptosConfig:t,accountAddress:e.accountAddress}),o=Le.fromPrivateKey({privateKey:r,legacy:!0}),a=new Vn({sequenceNumber:BigInt(i.sequence_number),originator:e.accountAddress,currentAuthKey:u.from(i.authentication_key),newPublicKey:o.publicKey}).bcsToBytes(),c=e.sign(a),p=o.sign(a),d=await b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new $(e.signingScheme),h.U8(e.publicKey.toUint8Array()),new $(o.signingScheme),h.U8(o.publicKey.toUint8Array()),h.U8(c.toUint8Array()),h.U8(p.toUint8Array())],abi:Fc}});return ln({aptosConfig:t,signer:e,transaction:d})}var Nc={typeParameters:[{constraints:[]}],parameters:[new X,new Q]};async function as(n){let{aptosConfig:t,sender:e,recipient:r,amount:i,coinType:o,options:s}=n;return b({aptosConfig:t,sender:e,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[_nullishCoalesce(o, () => (ot))],functionArguments:[r,i],abi:Nc},options:s})}var gn=class{constructor(t){this.config=t}async transferCoinTransaction(t){return as({aptosConfig:this.config,...t})}};var je={BOOLEAN:"bool",U8:"u8",U16:"u16",U32:"u32",U64:"u64",U128:"u128",U256:"u256",ADDRESS:"address",STRING:"0x1::string::String",ARRAY:"vector<u8>"},de="0x4::token::Token";async function cs(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()}};return(await f({aptosConfig:t,query:{query:To,variables:{where_condition:r}},originMethod:"getDigitalAssetData"})).current_token_datas_v2[0]}async function us(n){let{aptosConfig:t,digitalAssetAddress:e}=n,r={token_data_id:{_eq:u.from(e).toStringLong()},amount:{_gt:0}};return(await f({aptosConfig:t,query:{query:Qr,variables:{where_condition:r}},originMethod:"getCurrentDigitalAssetOwnership"})).current_token_ownerships_v2[0]}async function ps(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,i={owner_address:{_eq:u.from(e).toStringLong()},amount:{_gt:0}},o={query:Qr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _139 => _139.offset]),limit:_optionalChain([r, 'optionalAccess', _140 => _140.limit]),order_by:_optionalChain([r, 'optionalAccess', _141 => _141.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getOwnedDigitalAssets"})).current_token_ownerships_v2}async function ds(n){let{aptosConfig:t,digitalAssetAddress:e,options:r}=n,i={token_data_id:{_eq:u.from(e).toStringLong()}},o={query:bo,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _142 => _142.offset]),limit:_optionalChain([r, 'optionalAccess', _143 => _143.limit]),order_by:_optionalChain([r, 'optionalAccess', _144 => _144.orderBy])}};return(await f({aptosConfig:t,query:o,originMethod:"getDigitalAssetActivity"})).token_activities_v2}var Oc={typeParameters:[],parameters:[new y(v()),new Q,new y(v()),new y(v()),new F,new F,new F,new F,new F,new F,new F,new F,new F,new Q,new Q]};async function ls(n){let{aptosConfig:t,options:e,creator:r}=n;return b({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new S(n.description),new O(_nullishCoalesce(n.maxSupply, () => (Ye))),new S(n.name),new S(n.uri),new I(_nullishCoalesce(n.mutableDescription, () => (!0))),new I(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new I(_nullishCoalesce(n.mutableURI, () => (!0))),new I(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new I(_nullishCoalesce(n.mutableTokenName, () => (!0))),new I(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new I(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new I(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new I(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new O(_nullishCoalesce(n.royaltyNumerator, () => (0))),new O(_nullishCoalesce(n.royaltyDenominator, () => (1)))],abi:Oc},options:e})}async function qt(n){let{aptosConfig:t,options:e}=n,r=_optionalChain([e, 'optionalAccess', _145 => _145.where]);_optionalChain([e, 'optionalAccess', _146 => _146.tokenStandard])&&(r.token_standard={_eq:_nullishCoalesce(_optionalChain([e, 'optionalAccess', _147 => _147.tokenStandard]), () => ("v2"))});let i={query:po,variables:{where_condition:r,offset:_optionalChain([e, 'optionalAccess', _148 => _148.offset]),limit:_optionalChain([e, 'optionalAccess', _149 => _149.limit])}};return(await f({aptosConfig:t,query:i,originMethod:"getCollectionData"})).current_collections_v2[0]}async function gs(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:i}=n,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _150 => _150.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _151 => _151.tokenStandard]), () => ("v2"))}),qt({aptosConfig:t,options:{...i,where:s}})}async function ms(n){let{aptosConfig:t,creatorAddress:e,options:r}=n,o={creator_address:{_eq:u.from(e).toStringLong()}};return _optionalChain([r, 'optionalAccess', _152 => _152.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _153 => _153.tokenStandard]), () => ("v2"))}),qt({aptosConfig:t,options:{...r,where:o}})}async function ys(n){let{aptosConfig:t,collectionId:e,options:r}=n,o={collection_id:{_eq:u.from(e).toStringLong()}};return _optionalChain([r, 'optionalAccess', _154 => _154.tokenStandard])&&(o.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _155 => _155.tokenStandard]), () => ("v2"))}),qt({aptosConfig:t,options:{...r,where:o}})}async function fs(n){let{creatorAddress:t,collectionName:e,options:r,aptosConfig:i}=n,o=u.from(t),s={collection_name:{_eq:e},creator_address:{_eq:o.toStringLong()}};return _optionalChain([r, 'optionalAccess', _156 => _156.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _157 => _157.tokenStandard]), () => ("v2"))}),(await qt({aptosConfig:i,options:{where:s}})).collection_id}var Mc={typeParameters:[],parameters:[new y(v()),new y(v()),new y(v()),new y(v()),new E(new y(v())),new E(new y(v())),new E(E.u8())]};async function As(n){let{aptosConfig:t,options:e,creator:r,collection:i,description:o,name:s,uri:a,propertyKeys:c,propertyTypes:p,propertyValues:d}=n,T=_optionalChain([p, 'optionalAccess', _158 => _158.map, 'call', _159 => _159(w=>je[w])]);return b({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new S(i),new S(o),new S(s),new S(a),h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(T, () => ([]))),Rs(_nullishCoalesce(d, () => ([])),_nullishCoalesce(T, () => ([])))],abi:Mc},options:e})}var qc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new X]};async function hs(n){let{aptosConfig:t,sender:e,digitalAssetAddress:r,recipient:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::object::transfer",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(r),u.from(i)],abi:qc},options:s})}var Vc={typeParameters:[],parameters:[new y(v()),new y(v()),new y(v()),new y(v()),new E(new y(v())),new E(new y(v())),new E(E.u8()),new X]};async function bs(n){let{aptosConfig:t,account:e,collection:r,description:i,name:o,uri:s,recipient:a,propertyKeys:c,propertyTypes:p,propertyValues:d,options:T}=n;if(_optionalChain([c, 'optionalAccess', _160 => _160.length])!==_optionalChain([d, 'optionalAccess', _161 => _161.length]))throw new Error("Property keys and property values counts do not match");if(_optionalChain([p, 'optionalAccess', _162 => _162.length])!==_optionalChain([d, 'optionalAccess', _163 => _163.length]))throw new Error("Property types and property values counts do not match");let w=_optionalChain([p, 'optionalAccess', _164 => _164.map, 'call', _165 => _165(m=>je[m])]);return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::mint_soul_bound",functionArguments:[r,i,o,s,h.MoveString(_nullishCoalesce(c, () => ([]))),h.MoveString(_nullishCoalesce(w, () => ([]))),Rs(_nullishCoalesce(d, () => ([])),_nullishCoalesce(w, () => ([]))),a],abi:Vc},options:T})}var $c={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function Ts(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::burn",typeArguments:[_nullishCoalesce(i, () => (de))],functionArguments:[u.from(r)],abi:$c},options:o})}var Lc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function ws(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::freeze_transfer",typeArguments:[_nullishCoalesce(i, () => (de))],functionArguments:[r],abi:Lc},options:o})}var Hc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0)))]};async function Ss(n){let{aptosConfig:t,creator:e,digitalAssetAddress:r,digitalAssetType:i,options:o}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::unfreeze_transfer",typeArguments:[_nullishCoalesce(i, () => (de))],functionArguments:[r],abi:Hc},options:o})}var Qc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function xs(n){let{aptosConfig:t,creator:e,description:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_description",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:Qc},options:s})}var Wc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function _s(n){let{aptosConfig:t,creator:e,name:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_name",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:Wc},options:s})}var jc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function Ps(n){let{aptosConfig:t,creator:e,uri:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::set_uri",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:jc},options:s})}var Xc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v()),new y(v()),E.u8()]};async function vs(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_property",typeArguments:[_nullishCoalesce(a, () => (de))],functionArguments:[u.from(s),new S(r),new S(je[i]),h.U8(di(o,je[i]))],abi:Xc},options:c})}var Zc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v())]};async function Cs(n){let{aptosConfig:t,creator:e,propertyKey:r,digitalAssetAddress:i,digitalAssetType:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::remove_property",typeArguments:[_nullishCoalesce(o, () => (de))],functionArguments:[u.from(i),new S(r)],abi:Zc},options:s})}var Yc={typeParameters:[{constraints:["key"]}],parameters:[new y(ie(new z(0))),new y(v()),new y(v()),E.u8()]};async function Es(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_property",typeArguments:[_nullishCoalesce(a, () => (de))],functionArguments:[u.from(s),new S(r),new S(je[i]),di(o,je[i])],abi:Yc},options:c})}var Jc={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ie(new z(0))),new y(v()),new z(1)]};async function Is(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::add_typed_property",typeArguments:[_nullishCoalesce(a, () => (de)),je[i]],functionArguments:[u.from(s),new S(r),o],abi:Jc},options:c})}var eu={typeParameters:[{constraints:["key"]},{constraints:[]}],parameters:[new y(ie(new z(0))),new y(v()),new z(1)]};async function Us(n){let{aptosConfig:t,creator:e,propertyKey:r,propertyType:i,propertyValue:o,digitalAssetAddress:s,digitalAssetType:a,options:c}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x4::aptos_token::update_typed_property",typeArguments:[_nullishCoalesce(a, () => (de)),je[i]],functionArguments:[u.from(s),new S(r),o],abi:eu},options:c})}function Rs(n,t){let e=new Array;return t.forEach((r,i)=>{e.push(di(n[i],r))}),e}function di(n,t){let e=Ke(t);return Mt(n,e,0,[]).bcsToBytes()}var mn=class{constructor(t){this.config=t}async getCollectionData(t){await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"});let{creatorAddress:e,collectionName:r,options:i}=t,o=u.from(e),s={collection_name:{_eq:r},creator_address:{_eq:o.toStringLong()}};return _optionalChain([i, 'optionalAccess', _166 => _166.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([i, 'optionalAccess', _167 => _167.tokenStandard]), () => ("v2"))}),qt({aptosConfig:this.config,options:{where:s}})}async getCollectionDataByCreatorAddressAndCollectionName(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),gs({aptosConfig:this.config,...t})}async getCollectionDataByCreatorAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ms({aptosConfig:this.config,...t})}async getCollectionDataByCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ys({aptosConfig:this.config,...t})}async getCollectionId(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),fs({aptosConfig:this.config,...t})}async getDigitalAssetData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),cs({aptosConfig:this.config,...t})}async getCurrentDigitalAssetOwnership(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),us({aptosConfig:this.config,...t})}async getOwnedDigitalAssets(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ps({aptosConfig:this.config,...t})}async getDigitalAssetActivity(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"token_v2_processor"}),ds({aptosConfig:this.config,...t})}async createCollectionTransaction(t){return ls({aptosConfig:this.config,...t})}async mintDigitalAssetTransaction(t){return As({aptosConfig:this.config,...t})}async transferDigitalAssetTransaction(t){return hs({aptosConfig:this.config,...t})}async mintSoulBoundTransaction(t){return bs({aptosConfig:this.config,...t})}async burnDigitalAssetTransaction(t){return Ts({aptosConfig:this.config,...t})}async freezeDigitalAssetTransaferTransaction(t){return ws({aptosConfig:this.config,...t})}async unfreezeDigitalAssetTransaferTransaction(t){return Ss({aptosConfig:this.config,...t})}async setDigitalAssetDescriptionTransaction(t){return xs({aptosConfig:this.config,...t})}async setDigitalAssetNameTransaction(t){return _s({aptosConfig:this.config,...t})}async setDigitalAssetURITransaction(t){return Ps({aptosConfig:this.config,...t})}async addDigitalAssetPropertyTransaction(t){return vs({aptosConfig:this.config,...t})}async removeDigitalAssetPropertyTransaction(t){return Cs({aptosConfig:this.config,...t})}async updateDigitalAssetPropertyTransaction(t){return Es({aptosConfig:this.config,...t})}async addDigitalAssetTypedPropertyTransaction(t){return Is({aptosConfig:this.config,...t})}async updateDigitalAssetTypedPropertyTransaction(t){return Us({aptosConfig:this.config,...t})}};var Ks=300,tu=n=>{if(n&&n.length>Ks)throw new Error(`Event type length exceeds the maximum length of ${Ks}`)};async function zs(n){let{aptosConfig:t,eventType:e,options:r}=n,i={_or:[{account_address:{_eq:e.split("::")[0]}},{account_address:{_eq:"0x0000000000000000000000000000000000000000000000000000000000000000"},sequence_number:{_eq:0},creation_number:{_eq:0}}],indexed_type:{_eq:e}};return yn({aptosConfig:t,options:{...r,where:i}})}async function ks(n){let{accountAddress:t,aptosConfig:e,creationNumber:r,options:i}=n,s={account_address:{_eq:u.from(t).toStringLong()},creation_number:{_eq:r}};return yn({aptosConfig:e,options:{...i,where:s}})}async function Ds(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:i}=n,s={account_address:{_eq:u.from(t).toStringLong()},indexed_type:{_eq:r}};return yn({aptosConfig:e,options:{...i,where:s}})}async function yn(n){let{aptosConfig:t,options:e}=n;tu(_optionalChain([e, 'optionalAccess', _168 => _168.where, 'optionalAccess', _169 => _169.indexed_type, 'optionalAccess', _170 => _170._eq]));let r={query:mo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _171 => _171.where]),offset:_optionalChain([e, 'optionalAccess', _172 => _172.offset]),limit:_optionalChain([e, 'optionalAccess', _173 => _173.limit]),order_by:_optionalChain([e, 'optionalAccess', _174 => _174.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var fn=class{constructor(t){this.config=t}async getModuleEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),zs({aptosConfig:this.config,...t})}async getAccountEventsByCreationNumber(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),ks({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"events_processor"}),Ds({aptosConfig:this.config,...t})}async getEvents(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _175 => _175.minimumLedgerVersion]),processorType:"events_processor"}),yn({aptosConfig:this.config,...t})}};async function Bs(n){let{aptosConfig:t,accountAddress:e,amount:r,options:i}=n,o=_optionalChain([i, 'optionalAccess', _176 => _176.timeoutSecs])||20,{data:s}=await Zi({aptosConfig:t,path:"fund",body:{address:u.from(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0],c=await Ot({aptosConfig:t,transactionHash:a,options:{timeoutSecs:o,checkSuccess:_optionalChain([i, 'optionalAccess', _177 => _177.checkSuccess])}});if(c.type==="user_transaction")return c;throw new Error(`Unexpected transaction received for fund account: ${c.type}`)}var An=class{constructor(t){this.config=t}async fundAccount(t){let e=await Bs({aptosConfig:this.config,...t});return(_optionalChain([t, 'access', _178 => _178.options, 'optionalAccess', _179 => _179.waitForIndexer])===void 0||_optionalChain([t, 'access', _180 => _180.options, 'optionalAccess', _181 => _181.waitForIndexer]))&&await rr({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version),processorType:"fungible_asset_processor"}),e}};async function gr(n){let{aptosConfig:t,options:e}=n,r={query:fo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _182 => _182.where]),limit:_optionalChain([e, 'optionalAccess', _183 => _183.limit]),offset:_optionalChain([e, 'optionalAccess', _184 => _184.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Gs(n){let{aptosConfig:t,options:e}=n,r={query:yo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _185 => _185.where]),limit:_optionalChain([e, 'optionalAccess', _186 => _186.limit]),offset:_optionalChain([e, 'optionalAccess', _187 => _187.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Fs(n){let{aptosConfig:t,options:e}=n,r={query:lo,variables:{where_condition:_optionalChain([e, 'optionalAccess', _188 => _188.where]),limit:_optionalChain([e, 'optionalAccess', _189 => _189.limit]),offset:_optionalChain([e, 'optionalAccess', _190 => _190.offset])}};return(await f({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var nu={typeParameters:[{constraints:[]}],parameters:[Ke("0x1::object::Object"),new X,new Q]};async function Ns(n){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:r,recipient:i,amount:o,options:s}=n;return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[r,i,o],abi:nu},options:s})}var hn=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _191 => _191.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),gr({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _192 => _192.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),(await gr({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetMetadataByCreatorAddress(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _193 => _193.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),await gr({aptosConfig:this.config,options:{where:{creator_address:{_eq:u.from(t.creatorAddress).toStringLong()}}}})}async getFungibleAssetActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _194 => _194.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Gs({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _195 => _195.minimumLedgerVersion]),processorType:"fungible_asset_processor"}),Fs({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return Ns({aptosConfig:this.config,...t})}};var bn=class{constructor(t){this.config=t}async getLedgerInfo(){return Xn({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Oo({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Mo({aptosConfig:this.config,...t})}async view(t){return _e({aptosConfig:this.config,...t})}async viewJson(t){return rs({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return wo({aptosConfig:this.config,...t})}async queryIndexer(t){return f({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Zn({aptosConfig:this.config})}async getProcessorStatus(t){return Yn({aptosConfig:this.config,processorType:t})}};var Os=["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 Ms(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function Xe(n){let[t,e,...r]=n.replace(/\.apt$/,"").split(".");if(r.length>0)throw new Error(`${n} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Ms(t))throw new Error(`${t} is not valid. ${Os}`);if(e&&!Ms(e))throw new Error(`${e} is not valid. ${Os}`);return{domainName:e||t,subdomainName:e?t:void 0}}function qs(n){if(!n)return!1;let t=new Date(n.domain_expiration_timestamp).getTime()<Date.now(),e=new Date(n.expiration_timestamp).getTime()<Date.now();return n.subdomain&&t?!1:n.subdomain&&n.subdomain_expiration_policy===1?!0:!e}var ru="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",iu={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:ru,custom:null,devnet:null};function ze(n){let t=iu[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var mr=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Vs(n){let{aptosConfig:t,name:e}=n,r=ze(t),{domainName:i,subdomainName:o}=Xe(e),s=await _e({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[i,o]}}),a=mr(s[0]);return a?u.from(a):void 0}async function $s(n){let{aptosConfig:t,expiration:e,name:r,sender:i,targetAddress:o,toAddress:s,options:a,transferable:c}=n,p=ze(t),{domainName:d,subdomainName:T}=Xe(r),w=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(T&&!w)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(w&&!T)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let Tr=_nullishCoalesce(e.years, () => (1));if(Tr!==1)throw new Error("For now, names can only be registered for 1 year at a time");let ua=Tr*31536e3;return await b({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[d,ua,o,s]},options:a})}if(!T)throw new Error(`${e.policy} requires a subdomain to be provided.`);let m=await li({aptosConfig:t,name:d});if(!m)throw new Error("The domain does not exist");let _=e.policy==="subdomain:independent"?e.expirationDate:m;if(_>m)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await b({aptosConfig:t,sender:i.accountAddress.toString(),data:{function:`${p}::router::register_subdomain`,functionArguments:[d,T,Math.round(_/1e3),e.policy==="subdomain:follow-domain"?1:0,!!c,o,s]},options:a})}async function li(n){let{aptosConfig:t,name:e}=n,r=ze(t),{domainName:i,subdomainName:o}=Xe(e);try{let s=await _e({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[i,o]}});return Number(s[0])*1e3}catch (e5){return}}async function Ls(n){let{aptosConfig:t,address:e}=n,r=ze(t),i=await _e({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[u.from(e).toString()]}}),o=mr(i[1]),s=mr(i[0]);if(o)return[s,o].filter(Boolean).join(".")}async function Hs(n){let{aptosConfig:t,sender:e,name:r,options:i}=n,o=ze(t);if(!r)return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::clear_primary_name`,functionArguments:[]},options:i});let{domainName:s,subdomainName:a}=Xe(r);return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${o}::router::set_primary_name`,functionArguments:[s,a]},options:i})}async function Qs(n){let{aptosConfig:t,name:e}=n,r=ze(t),{domainName:i,subdomainName:o}=Xe(e),s=await _e({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[i,o]}}),a=mr(s[0]);return a?u.from(a):void 0}async function Ws(n){let{aptosConfig:t,sender:e,name:r,address:i,options:o}=n,s=ze(t),{domainName:a,subdomainName:c}=Xe(r);return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,c,i]},options:o})}async function js(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:i=""}=Xe(e),a=(await f({aptosConfig:t,query:{query:Ft,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:i}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return a&&(a=Tn(a)),qs(a)?a:void 0}async function Xs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await gi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _196 => _196.limit]),offset:_optionalChain([e, 'optionalAccess', _197 => _197.offset]),order_by:_optionalChain([e, 'optionalAccess', _198 => _198.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _199 => _199.options, 'optionalAccess', _200 => _200.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i}}}}})).current_aptos_names.map(Tn)}async function Zs(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await gi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _201 => _201.limit]),offset:_optionalChain([e, 'optionalAccess', _202 => _202.offset]),order_by:_optionalChain([e, 'optionalAccess', _203 => _203.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _204 => _204.options, 'optionalAccess', _205 => _205.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_eq:""}}}}})).current_aptos_names.map(Tn)}async function Ys(n){let{aptosConfig:t,options:e,accountAddress:r}=n,i=await gi({aptosConfig:t});return(await f({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _206 => _206.limit]),offset:_optionalChain([e, 'optionalAccess', _207 => _207.offset]),order_by:_optionalChain([e, 'optionalAccess', _208 => _208.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _209 => _209.options, 'optionalAccess', _210 => _210.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:i},subdomain:{_neq:""}}}}})).current_aptos_names.map(Tn)}async function Js(n){let{aptosConfig:t,options:e,domain:r}=n;return(await f({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ft,variables:{limit:_optionalChain([e, 'optionalAccess', _211 => _211.limit]),offset:_optionalChain([e, 'optionalAccess', _212 => _212.offset]),order_by:_optionalChain([e, 'optionalAccess', _213 => _213.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _214 => _214.options, 'optionalAccess', _215 => _215.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names.map(Tn).filter(qs)}async function gi(n){let{aptosConfig:t}=n,e=ze(t),[r]=await _e({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),i=r/60/60/24,o=()=>new Date;return new Date(o().setDate(o().getDate()-i)).toISOString()}async function ea(n){let{aptosConfig:t,sender:e,name:r,years:i=1,options:o}=n,s=ze(t),a=i*31536e3,{domainName:c,subdomainName:p}=Xe(r);if(p)throw new Error("Subdomains cannot be renewed");if(i!==1)throw new Error("Currently, only 1 year renewals are supported");return await b({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[c,a]},options:o})}function Tn(n){return{...n,expiration_timestamp:new Date(n.expiration_timestamp).getTime()}}var wn=class{constructor(t){this.config=t}async getOwnerAddress(t){return Vs({aptosConfig:this.config,...t})}async getExpiration(t){return li({aptosConfig:this.config,...t})}async getTargetAddress(t){return Qs({aptosConfig:this.config,...t})}async setTargetAddress(t){return Ws({aptosConfig:this.config,...t})}async getPrimaryName(t){return Ls({aptosConfig:this.config,...t})}async setPrimaryName(t){return Hs({aptosConfig:this.config,...t})}async registerName(t){return $s({aptosConfig:this.config,...t})}async renewDomain(t){return ea({aptosConfig:this.config,...t})}async getName(t){return js({aptosConfig:this.config,...t})}async getAccountNames(t){return Xs({aptosConfig:this.config,...t})}async getAccountDomains(t){return Zs({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Ys({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Js({aptosConfig:this.config,...t})}};async function ta(n){let{aptosConfig:t,poolAddress:e}=n,r=u.from(e).toStringLong(),o=await f({aptosConfig:t,query:{query:Lr,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 na(n){let{aptosConfig:t,options:e}=n,r={query:Lr,variables:{order_by:_optionalChain([e, 'optionalAccess', _216 => _216.orderBy])}};return(await f({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function ra(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,i={query:go,variables:{delegatorAddress:u.from(e).toStringLong(),poolAddress:u.from(r).toStringLong()}};return(await f({aptosConfig:t,query:i})).delegated_staking_activities}var Sn=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _217 => _217.minimumLedgerVersion]),processorType:"stake_processor"}),ta({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _218 => _218.minimumLedgerVersion]),processorType:"stake_processor"}),na({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await A({config:this.config,minimumLedgerVersion:_optionalChain([t, 'optionalAccess', _219 => _219.minimumLedgerVersion]),processorType:"stake_processor"}),ra({aptosConfig:this.config,...t})}};var yr=class{constructor(t){this.config=t}async simple(t){return b({aptosConfig:this.config,...t})}async multiAgent(t){return b({aptosConfig:this.config,...t})}};function mi(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,i)},e}function yi(n,t,e){let r=e.value;return e.value=async function(...i){let[o]=i;if(o.transaction.feePayerAddress&&!o.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,i)},e}var Vt=class{constructor(t){this.config=t}async simple(t){return pi({aptosConfig:this.config,...t})}async multiAgent(t){return pi({aptosConfig:this.config,...t})}};_chunkHBPH2AD3js.a.call(void 0, [yi],Vt.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [yi],Vt.prototype,"multiAgent",1);var $t=class{constructor(t){this.config=t}async simple(t){return lr({aptosConfig:this.config,...t})}async multiAgent(t){return lr({aptosConfig:this.config,...t})}};_chunkHBPH2AD3js.a.call(void 0, [mi],$t.prototype,"simple",1),_chunkHBPH2AD3js.a.call(void 0, [mi],$t.prototype,"multiAgent",1);var fr=class{constructor(t,e,r,i,o){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=r,this.maximumInFlight=i,this.sleepTime=o}async nextSequenceNumber(){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=_chunkHBPH2AD3js.c.call(void 0, );for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),_chunkHBPH2AD3js.c.call(void 0, )-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await xe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await xe({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime);this.lock=!0;try{await this.update();let t=_chunkHBPH2AD3js.c.call(void 0, );for(;this.lastUncommintedNumber!==this.currentNumber;)_chunkHBPH2AD3js.c.call(void 0, )-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await _chunkHBPH2AD3js.b.call(void 0, this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var Lt=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){_optionalChain([this, 'access', _220 => _220.pendingDequeue, 'access', _221 => _221.shift, 'call', _222 => _222(), 'optionalAccess', _223 => _223.resolve, 'call', _224 => _224(t)]);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new Ht("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},Ht=class extends Error{};var ia="fulfilled",oa= exports.TransactionWorkerEventsEnum =(o=>(o.TransactionSent="transactionSent",o.TransactionSendFailed="transactionSendFailed",o.TransactionExecuted="transactionExecuted",o.TransactionExecutionFailed="transactionExecutionFailed",o.ExecutionFinish="executionFinish",o))(oa||{}),Ar= exports.TransactionWorker =class extends _eventemitter32.default{constructor(e,r,i=30,o=100,s=10){super();this.taskQueue=new Lt;this.transactionsQueue=new Lt;this.outstandingTransactions=new Lt;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=e,this.account=r,this.started=!1,this.accountSequnceNumber=new fr(e,r,i,o,s)}async submitNextTransaction(){try{for(;;){let e=await this.accountSequnceNumber.nextSequenceNumber();if(e===null)return;let r=await this.generateNextTransaction(this.account,e);if(!r)return;let i=ln({aptosConfig:this.aptosConfig,transaction:r,signer:this.account});await this.outstandingTransactions.enqueue([i,e])}}catch(e){if(e instanceof Ht)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async processTransactions(){try{for(;;){let e=[],r=[],[i,o]=await this.outstandingTransactions.dequeue();for(e.push(i),r.push(o);!this.outstandingTransactions.isEmpty();)[i,o]=await this.outstandingTransactions.dequeue(),e.push(i),r.push(o);let s=await Promise.allSettled(e);for(let a=0;a<s.length&&a<r.length;a+=1){let c=s[a];o=r[a],c.status===ia?(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(e){if(e instanceof Ht)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${e}`)}}async checkTransaction(e,r){try{let i=[];i.push(Ot({aptosConfig:this.aptosConfig,transactionHash:e.value.hash}));let o=await Promise.allSettled(i);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===ia?(this.executedTransactions.push([a.value.hash,r,null]),this.emit("transactionExecuted",{message:`transaction hash ${a.value.hash} has been executed on chain`,transactionHash:e.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(e,r){this.transactionsQueue.enqueue([e,r])}async generateNextTransaction(e,r){if(this.transactionsQueue.isEmpty())return;let[i,o]=await this.transactionsQueue.dequeue();return b({aptosConfig:this.aptosConfig,sender:e.accountAddress,data:i,options:{...o,accountSequenceNumber:r}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(e){throw new Error(`Unable to start transaction batching: ${e}`)}}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 hr=class extends _eventemitter32.default{constructor(e){super();this.config=e}start(e){let{sender:r}=e;this.account=r,this.transactionWorker=new Ar(this.config,r),this.transactionWorker.start(),this.registerToEvents()}push(e){let{data:r,options:i}=e;for(let o of r)this.transactionWorker.push(o,i)}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:r,data:i,options:o}=e;this.start({sender:r}),this.push({data:i,options:o})}catch(r){throw new Error(`failed to submit transactions with error: ${r}`)}}};var xn=class{constructor(t){this.config=t,this.build=new yr(this.config),this.simulate=new Vt(this.config),this.submit=new $t(this.config),this.batch=new hr(this.config)}async getTransactions(t){return Zr({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return Fo({aptosConfig:this.config,...t})}async getTransactionByHash(t){return cn({aptosConfig:this.config,...t})}async isPendingTransaction(t){return No({aptosConfig:this.config,...t})}async waitForTransaction(t){return Ot({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return nr({aptosConfig:this.config})}getSigningMessage(t){return is(t)}async publishPackageTransaction(t){return os({aptosConfig:this.config,...t})}async rotateAuthKey(t){return ss({aptosConfig:this.config,...t})}sign(t){return dr({...t})}signAsFeePayer(t){let{signer:e,transaction:r}=t;if(!r.feePayerAddress)throw new Error(`Transaction ${r} is not a Fee Payer transaction`);return r.feePayerAddress=e.accountAddress,dr({signer:e,transaction:r})}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:r,options:i}=t;this.batch.forSingleAccount({sender:e,data:r,options:i})}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return ln({aptosConfig:this.config,signer:e,transaction:r})}};var _n=class{constructor(t){this.config=t}async getTableItem(t){return Jn({aptosConfig:this.config,...t})}async getTableItemsData(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),So({aptosConfig:this.config,...t})}async getTableItemsMetadata(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"default_processor"}),xo({aptosConfig:this.config,...t})}};async function br(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,uidKey:i="sub",derivationPath:o}=n,s={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),uid_key:i,derivation_path:o},{data:a}=await Yi({aptosConfig:t,path:"fetch",body:s,originMethod:"getPepper",overrides:{WITH_CREDENTIALS:!1}});return g.fromHexInput(a.pepper).toUint8Array()}async function fi(n){let{aptosConfig:t,jwt:e,ephemeralKeyPair:r,pepper:i=await br(n),uidKey:o="sub"}=n;if(g.fromHexInput(i).toUint8Array().length!==Qe.PEPPER_LENGTH)throw new Error(`Pepper needs to be ${Qe.PEPPER_LENGTH} bytes`);let s=999999999999,a={jwt_b64:e,epk:r.getPublicKey().bcsToHex().toStringWithoutPrefix(),epk_blinder:g.fromHexInput(r.blinder).toStringWithoutPrefix(),exp_date_secs:r.expiryDateSecs,exp_horizon_secs:s,pepper:g.fromHexInput(i).toStringWithoutPrefix(),uid_key:o,use_insecure_test_jwk:!0};console.log(JSON.stringify(a));let{data:c}=await Ji({aptosConfig:t,path:"prove",body:a,originMethod:"getProof",overrides:{WITH_CREDENTIALS:!1}});console.log(JSON.stringify(c));let p=c.proof,d=new _t({a:p.a,b:p.b,c:p.c});return new ce({proof:new Pt(d,0),trainingWheelsSignature:we.fromHex(c.training_wheels_signature),expHorizonSecs:s})}async function sa(n){let{aptosConfig:t,jwt:e,jwkAddress:r,uidKey:i,proofFetchCallback:o,pepper:s=await br(n)}=n,a=fi({...n,pepper:s}),c=o?a:await a;if(r!==void 0){let T=he.fromJwtAndPepper({jwt:e,pepper:s,jwkAddress:r,uidKey:i}),w=await Nt({aptosConfig:t,authenticationKey:T.authKey().derivedAddress()});return Hn.create({...n,address:w,proof:c,pepper:s,proofFetchCallback:o,jwkAddress:r})}let p=G.fromJwtAndPepper({jwt:e,pepper:s,uidKey:i}),d=await Nt({aptosConfig:t,authenticationKey:p.authKey().derivedAddress()});return Qe.create({...n,address:d,proof:c,pepper:s,proofFetchCallback:o})}async function aa(n){let{aptosConfig:t,sender:e,iss:r}=n,i=_nullishCoalesce(n.jwksUrl, () => ((r.endsWith("/")?`${r}.well-known/jwks.json`:`${r}/.well-known/jwks.json`))),o=await fetch(i);if(!o.ok)throw new Error(`Failed to fetch JWKS: ${o.status} ${o.statusText}`);let s=await o.json();return b({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::jwks::update_federated_jwk_set",functionArguments:[r,h.MoveString(s.keys.map(a=>a.kid)),h.MoveString(s.keys.map(a=>a.alg)),h.MoveString(s.keys.map(a=>a.e)),h.MoveString(s.keys.map(a=>a.n))]}})}var Pn=class{constructor(t){this.config=t}async getPepper(t){return br({aptosConfig:this.config,...t})}async getProof(t){return fi({aptosConfig:this.config,...t})}async deriveKeylessAccount(t){return sa({aptosConfig:this.config,...t})}async updateFederatedKeylessJwkSetTransaction(t){return aa({aptosConfig:this.config,...t})}};async function au(n){let{aptosConfig:t,options:e}=n,r={query:jn,variables:{where_condition:_optionalChain([e, 'optionalAccess', _225 => _225.where]),offset:_optionalChain([e, 'optionalAccess', _226 => _226.offset]),limit:_optionalChain([e, 'optionalAccess', _227 => _227.limit]),order_by:_optionalChain([e, 'optionalAccess', _228 => _228.orderBy])}};return(await f({aptosConfig:t,query:r,originMethod:"getObjectData"})).current_objects}async function ca(n){let{aptosConfig:t,objectAddress:e,options:r}=n,o={object_address:{_eq:u.from(e).toStringLong()}};return(await au({aptosConfig:t,options:{...r,where:o}}))[0]}var vn=class{constructor(t){this.config=t}async getObjectDataByObjectAddress(t){return await A({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorType:"objects_processor"}),ca({aptosConfig:this.config,...t})}};var Z=class{constructor(t){this.config=new pr(t),this.account=new dn(this.config),this.ans=new wn(this.config),this.coin=new gn(this.config),this.digitalAsset=new mn(this.config),this.event=new fn(this.config),this.faucet=new An(this.config),this.fungibleAsset=new hn(this.config),this.general=new bn(this.config),this.staking=new Sn(this.config),this.transaction=new xn(this.config),this.table=new _n(this.config),this.keyless=new Pn(this.config),this.object=new vn(this.config)}};function oe(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let i=Object.getOwnPropertyDescriptor(t.prototype,r);i&&(i.value=function(...o){return this[e][r](...o)},Object.defineProperty(n.prototype,r,i))})}oe(Z,dn,"account");oe(Z,wn,"ans");oe(Z,gn,"coin");oe(Z,mn,"digitalAsset");oe(Z,fn,"event");oe(Z,An,"faucet");oe(Z,hn,"fungibleAsset");oe(Z,bn,"general");oe(Z,Sn,"staking");oe(Z,xn,"transaction");oe(Z,_n,"table");oe(Z,Pn,"keyless");oe(Z,vn,"object");exports.APTOS_BIP44_REGEX = Sa; exports.APTOS_COIN = ot; exports.APTOS_FA = Vi; exports.APTOS_HARDENED_REGEX = wa; exports.Account = Le; exports.AccountAddress = u; exports.AccountAuthenticator = j; exports.AccountAuthenticatorEd25519 = be; exports.AccountAuthenticatorMultiEd25519 = On; exports.AccountAuthenticatorMultiKey = ct; exports.AccountAuthenticatorSingleKey = te; exports.AccountAuthenticatorVariant = Pi; exports.AccountPublicKey = ee; exports.AccountSequenceNumber = fr; exports.AddressInvalidReason = Aa; exports.AnyPublicKey = k; exports.AnyPublicKeyVariant = Kn; exports.AnySignature = M; exports.AnySignatureVariant = vi; exports.Aptos = Z; exports.AptosApiError = Ae; exports.AptosApiType = wt; exports.AptosConfig = pr; exports.AuthenticationKey = D; exports.Bool = I; exports.CKDPriv = Di; exports.ChainId = Ct; exports.DEFAULT_MAX_GAS_AMOUNT = Mi; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = qi; exports.DEFAULT_TXN_TIMEOUT_SEC = Fn; exports.DeriveScheme = Ii; exports.Deserializer = q; exports.EPK_HORIZON_SECS = Ol; exports.Ed25519Account = Dt; exports.Ed25519PrivateKey = W; exports.Ed25519PublicKey = P; exports.Ed25519Signature = C; exports.EntryFunction = pt; exports.EntryFunctionBytes = Un; exports.EphemeralCertificate = xt; exports.EphemeralCertificateVariant = xr; exports.EphemeralKeyPair = mt; exports.EphemeralPublicKey = it; exports.EphemeralPublicKeyVariant = Sr; exports.EphemeralSignature = we; exports.EphemeralSignatureVariant = Ci; exports.FederatedKeylessAccount = Hn; exports.FederatedKeylessPublicKey = he; exports.FeePayerRawTransaction = lt; exports.FixedBytes = et; exports.Groth16Zkp = _t; exports.HARDENED_OFFSET = Ki; exports.Hex = g; exports.HexInvalidReason = la; exports.Identifier = R; exports.KeyType = xa; exports.KeylessAccount = Qe; exports.KeylessAccountCommon = He; exports.KeylessConfiguration = Nr; exports.KeylessPublicKey = G; exports.KeylessSignature = Ie; exports.MAX_AUD_VAL_BYTES = Ja; exports.MAX_COMMITED_EPK_BYTES = $l; exports.MAX_EXTRA_FIELD_BYTES = ql; exports.MAX_ISS_VAL_BYTES = Ml; exports.MAX_JWT_HEADER_B64_BYTES = Vl; exports.MAX_UID_KEY_BYTES = ec; exports.MAX_UID_VAL_BYTES = tc; exports.MimeType = Rn; exports.ModuleId = Jt; exports.MoveAbility = Ei; exports.MoveFunctionVisibility = ma; exports.MoveOption = L; exports.MoveString = S; exports.MoveVector = h; exports.MultiAgentRawTransaction = dt; exports.MultiAgentTransaction = Ln; exports.MultiEd25519PublicKey = ht; exports.MultiEd25519Signature = nt; exports.MultiKey = vt; exports.MultiKeyAccount = Qn; exports.MultiKeySignature = at; exports.MultiSig = on; exports.MultiSigTransactionPayload = sn; exports.Network = Dr; exports.NetworkToChainId = Br; exports.NetworkToFaucetAPI = Wi; exports.NetworkToIndexerAPI = Hi; exports.NetworkToNetworkName = Md; exports.NetworkToNodeAPI = Qi; exports.NetworkToPepperAPI = zr; exports.NetworkToProverAPI = kr; exports.ParsingError = J; exports.ProcessorType = Ce; exports.PublicKey = tt; exports.RAW_TRANSACTION_SALT = $i; exports.RAW_TRANSACTION_WITH_DATA_SALT = Rr; exports.RawTransaction = pe; exports.RawTransactionWithData = qn; exports.RoleType = ya; exports.RotationProofChallenge = Vn; exports.Script = rn; exports.ScriptTransactionArgumentVariants = Wt; exports.Secp256k1PrivateKey = rt; exports.Secp256k1PublicKey = ve; exports.Secp256k1Signature = Tt; exports.Serializable = l; exports.Serialized = jt; exports.Serializer = V; exports.Signature = B; exports.SignedTransaction = gt; exports.SigningScheme = le; exports.SigningSchemeInput = vr; exports.SimpleTransaction = $n; exports.SingleKeyAccount = Bt; exports.StructTag = Ue; exports.TransactionAndProof = $r; exports.TransactionAuthenticator = Re; exports.TransactionAuthenticatorEd25519 = It; exports.TransactionAuthenticatorFeePayer = Rt; exports.TransactionAuthenticatorMultiAgent = Ut; exports.TransactionAuthenticatorMultiEd25519 = qr; exports.TransactionAuthenticatorSingleSender = Kt; exports.TransactionAuthenticatorVariant = _i; exports.TransactionPayload = ut; exports.TransactionPayloadEntryFunction = tn; exports.TransactionPayloadMultiSig = nn; exports.TransactionPayloadScript = en; exports.TransactionPayloadVariants = Si; exports.TransactionResponseType = Pr; exports.TransactionVariants = xi; exports.TransactionWorker = Ar; exports.TransactionWorkerEventsEnum = oa; exports.TypeTag = K; exports.TypeTagAddress = X; exports.TypeTagBool = F; exports.TypeTagGeneric = z; exports.TypeTagParserError = N; exports.TypeTagParserErrorType = xc; exports.TypeTagReference = Mn; exports.TypeTagSigner = Et; exports.TypeTagStruct = y; exports.TypeTagU128 = Ve; exports.TypeTagU16 = Me; exports.TypeTagU256 = $e; exports.TypeTagU32 = qe; exports.TypeTagU64 = Q; exports.TypeTagU8 = ue; exports.TypeTagVariants = wi; exports.TypeTagVector = E; exports.U128 = ye; exports.U16 = ge; exports.U256 = fe; exports.U32 = me; exports.U64 = O; exports.U8 = $; exports.ZeroKnowledgeSig = ce; exports.ZkProof = Pt; exports.ZkpVariant = _r; exports.aptosCoinStructTag = vm; exports.aptosRequest = Nn; exports.base64UrlDecode = _chunkHBPH2AD3js.e; exports.buildTransaction = ci; exports.checkOrConvertArgument = Mt; exports.convertAmountFromHumanReadableToOnChain = _chunkHBPH2AD3js.f; exports.convertAmountFromOnChainToHumanReadable = _chunkHBPH2AD3js.g; exports.convertArgument = ai; exports.convertNumber = ir; exports.createObjectAddress = Mr; exports.createResourceAddress = nm; exports.createTokenAddress = rm; exports.deriveKey = Cr; exports.deriveTransactionType = Vr; exports.deserializeFromScriptArgument = oc; exports.ensureBoolean = wr; exports.fetchEntryFunctionAbi = Zo; exports.fetchFunctionAbi = Xo; exports.fetchViewFunctionAbi = Yo; exports.findFirstNonSignerArg = Qo; exports.floorToWholeHour = _chunkHBPH2AD3js.d; exports.generateRawTransaction = Uc; exports.generateSignedTransaction = ui; exports.generateSignedTransactionForSimulation = es; exports.generateSigningMessage = zt; exports.generateSigningMessageForSerializable = Fy; exports.generateSigningMessageForTransaction = kt; exports.generateTransactionPayload = ur; exports.generateTransactionPayloadWithABI = Cc; exports.generateUserTransactionHash = Wh; exports.generateViewFunctionPayload = Jo; exports.generateViewFunctionPayloadWithABI = Ec; exports.get = Gr; exports.getAptosFullNode = H; exports.getAptosPepperService = pl; exports.getAuthenticatorForSimulation = cr; exports.getFunctionParts = un; exports.getKeylessConfig = Ll; exports.hashValues = ts; exports.isBcsAddress = sr; exports.isBcsBool = Yr; exports.isBcsFixedBytes = hc; exports.isBcsString = Jr; exports.isBcsU128 = ii; exports.isBcsU16 = ti; exports.isBcsU256 = oi; exports.isBcsU32 = ni; exports.isBcsU64 = ri; exports.isBcsU8 = ei; exports.isBlockEpilogueTransactionResponse = Fu; exports.isBlockMetadataTransactionResponse = Du; exports.isBool = Vo; exports.isCanonicalEd25519Signature = Pa; exports.isEd25519Signature = Nu; exports.isEmptyOption = $o; exports.isEncodedEntryFunctionArgument = Lo; exports.isEncodedStruct = _chunkHBPH2AD3js.i; exports.isFeePayerSignature = qu; exports.isGenesisTransactionResponse = ku; exports.isLargeNumber = or; exports.isMultiAgentSignature = Mu; exports.isMultiEd25519Signature = Vu; exports.isNumber = Ac; exports.isPendingTransactionResponse = Ku; exports.isScriptDataInput = Ho; exports.isSecp256k1Signature = Ou; exports.isStateCheckpointTransactionResponse = Bu; exports.isString = We; exports.isUserTransactionResponse = zu; exports.isValidBIP44Path = zi; exports.isValidHardenedPath = ki; exports.isValidatorTransactionResponse = Gu; exports.mnemonicToSeed = zn; exports.normalizeBundle = ji; exports.nowInSeconds = _chunkHBPH2AD3js.c; exports.objectStructTag = ie; exports.optionStructTag = Cm; exports.outOfRangeErrorMessage = ga; exports.paginateWithCursor = St; exports.parseEncodedStruct = _chunkHBPH2AD3js.h; exports.parseTypeTag = Ke; exports.post = Yt; exports.postAptosFaucet = Zi; exports.postAptosFullNode = Ne; exports.postAptosIndexer = Xi; exports.postAptosPepperService = Yi; exports.postAptosProvingService = Ji; exports.promiseFulfilledStatus = ia; exports.request = Za; exports.sleep = _chunkHBPH2AD3js.b; exports.splitPath = Bi; exports.standardizeTypeTags = ar; exports.stringStructTag = v; exports.throwTypeMismatch = U; exports.validateNumberInRange = De;
473
473
  //# sourceMappingURL=index.js.map