@aptos-labs/ts-sdk 0.0.6 → 0.0.7

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 (205) hide show
  1. package/README.md +9 -4
  2. package/dist/browser/index.d.ts +564 -338
  3. package/dist/browser/index.global.js +46 -25
  4. package/dist/browser/index.global.js.map +1 -1
  5. package/dist/common/index.d.ts +564 -338
  6. package/dist/common/index.js +45 -24
  7. package/dist/common/index.js.map +1 -1
  8. package/dist/esm/api/account.mjs +1 -1
  9. package/dist/esm/api/ans.d.mts +212 -18
  10. package/dist/esm/api/ans.mjs +1 -1
  11. package/dist/esm/api/aptos.d.mts +8 -0
  12. package/dist/esm/api/aptos.mjs +1 -1
  13. package/dist/esm/api/coin.d.mts +2 -2
  14. package/dist/esm/api/coin.mjs +1 -1
  15. package/dist/esm/api/digitalAsset.d.mts +3 -3
  16. package/dist/esm/api/digitalAsset.mjs +1 -1
  17. package/dist/esm/api/event.mjs +1 -1
  18. package/dist/esm/api/faucet.mjs +1 -1
  19. package/dist/esm/api/fungibleAsset.mjs +1 -1
  20. package/dist/esm/api/general.mjs +1 -1
  21. package/dist/esm/api/index.d.mts +4 -0
  22. package/dist/esm/api/index.mjs +1 -1
  23. package/dist/esm/api/staking.mjs +1 -1
  24. package/dist/esm/api/transaction.mjs +1 -1
  25. package/dist/esm/api/transactionSubmission/build.d.mts +53 -0
  26. package/dist/esm/api/transactionSubmission/build.mjs +2 -0
  27. package/dist/esm/api/transactionSubmission/build.mjs.map +1 -0
  28. package/dist/esm/api/transactionSubmission/sign.d.mts +50 -0
  29. package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
  30. package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
  31. package/dist/esm/api/transactionSubmission/simulate.d.mts +53 -0
  32. package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
  33. package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
  34. package/dist/esm/api/transactionSubmission/submit.d.mts +51 -0
  35. package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
  36. package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
  37. package/dist/esm/api/transactionSubmission.d.mts +9 -60
  38. package/dist/esm/api/transactionSubmission.mjs +1 -1
  39. package/dist/esm/{chunk-NGCFPQ22.mjs → chunk-2OZRBXLM.mjs} +2 -2
  40. package/dist/esm/{chunk-TQD4IGUM.mjs → chunk-33T7WTB6.mjs} +2 -2
  41. package/dist/esm/chunk-3732I6BR.mjs +2 -0
  42. package/dist/esm/chunk-3732I6BR.mjs.map +1 -0
  43. package/dist/esm/chunk-3VZ3OZKC.mjs +2 -0
  44. package/dist/esm/chunk-3VZ3OZKC.mjs.map +1 -0
  45. package/dist/esm/chunk-4KTQIWUP.mjs +2 -0
  46. package/dist/esm/chunk-4KTQIWUP.mjs.map +1 -0
  47. package/dist/esm/chunk-5LO7FR2P.mjs +2 -0
  48. package/dist/esm/chunk-5LO7FR2P.mjs.map +1 -0
  49. package/dist/esm/{chunk-Q6N6QACD.mjs → chunk-67OGU66P.mjs} +2 -2
  50. package/dist/esm/{chunk-V45RFKH7.mjs → chunk-72F5YXGC.mjs} +2 -2
  51. package/dist/esm/chunk-72F5YXGC.mjs.map +1 -0
  52. package/dist/esm/{chunk-2W744GUN.mjs → chunk-BFQRMCY2.mjs} +2 -2
  53. package/dist/esm/{chunk-WKY5ENCK.mjs → chunk-BM4HBROC.mjs} +2 -2
  54. package/dist/esm/chunk-DRPMIJH7.mjs +2 -0
  55. package/dist/esm/chunk-DRPMIJH7.mjs.map +1 -0
  56. package/dist/esm/{chunk-UPLWWSB4.mjs → chunk-GAI75GOG.mjs} +2 -2
  57. package/dist/esm/{chunk-7MNEEVXY.mjs → chunk-GU4OUKAF.mjs} +2 -2
  58. package/dist/esm/{chunk-EQ5BEDJ7.mjs → chunk-HO7K2UAK.mjs} +2 -2
  59. package/dist/esm/{chunk-U3LO2FSJ.mjs → chunk-IBH7IOIM.mjs} +2 -2
  60. package/dist/esm/{chunk-R26XML3D.mjs → chunk-J5BH7V37.mjs} +2 -2
  61. package/dist/esm/chunk-L7AA75WZ.mjs +2 -0
  62. package/dist/esm/chunk-L7AA75WZ.mjs.map +1 -0
  63. package/dist/esm/chunk-LACQ537H.mjs +2 -0
  64. package/dist/esm/{chunk-NYFVEKF6.mjs.map → chunk-LACQ537H.mjs.map} +1 -1
  65. package/dist/esm/{chunk-EGOYLZBU.mjs → chunk-LDAD54H5.mjs} +2 -2
  66. package/dist/esm/chunk-LXW3A3MJ.mjs +2 -0
  67. package/dist/esm/chunk-LXW3A3MJ.mjs.map +1 -0
  68. package/dist/esm/{chunk-4RVIA63I.mjs → chunk-M2V2POWK.mjs} +2 -2
  69. package/dist/esm/{chunk-3JVGSFHP.mjs → chunk-ND3ZQKTT.mjs} +2 -2
  70. package/dist/esm/chunk-O2B54NZT.mjs +2 -0
  71. package/dist/esm/chunk-O2B54NZT.mjs.map +1 -0
  72. package/dist/esm/chunk-OCW2L33Q.mjs +2 -0
  73. package/dist/esm/chunk-OCW2L33Q.mjs.map +1 -0
  74. package/dist/esm/{chunk-VMQWW5UT.mjs → chunk-OCYS4V2V.mjs} +2 -2
  75. package/dist/esm/{chunk-BWMNPUTK.mjs → chunk-OSTH5JRX.mjs} +2 -2
  76. package/dist/esm/chunk-OSTH5JRX.mjs.map +1 -0
  77. package/dist/esm/{chunk-Z2UDRTHA.mjs → chunk-OVHY6ZUJ.mjs} +2 -2
  78. package/dist/esm/chunk-PZCMSHY6.mjs +2 -0
  79. package/dist/esm/{chunk-P32MY5YF.mjs → chunk-RHS5ROLP.mjs} +2 -2
  80. package/dist/esm/chunk-RHS5ROLP.mjs.map +1 -0
  81. package/dist/esm/{chunk-BFSEVKNA.mjs → chunk-RKKU2SY5.mjs} +2 -2
  82. package/dist/esm/chunk-TGKB6ALT.mjs +2 -0
  83. package/dist/esm/chunk-TGKB6ALT.mjs.map +1 -0
  84. package/dist/esm/{chunk-GEFQFRL3.mjs → chunk-TPWSHFFI.mjs} +2 -2
  85. package/dist/esm/{chunk-WX43AJTD.mjs → chunk-UDBH4CER.mjs} +42 -21
  86. package/dist/esm/chunk-UDBH4CER.mjs.map +1 -0
  87. package/dist/esm/{chunk-VYAVLUPJ.mjs → chunk-WEJAI26R.mjs} +2 -2
  88. package/dist/esm/{chunk-JDS7K2WI.mjs → chunk-WL4OXZLN.mjs} +2 -2
  89. package/dist/esm/{chunk-AAIBCWZY.mjs → chunk-Y2HRRUZ6.mjs} +2 -2
  90. package/dist/esm/{chunk-J5ZFOJN2.mjs → chunk-ZLW65YCO.mjs} +2 -2
  91. package/dist/esm/chunk-ZUHN56GM.mjs +2 -0
  92. package/dist/esm/chunk-ZUHN56GM.mjs.map +1 -0
  93. package/dist/esm/client/core.mjs +1 -1
  94. package/dist/esm/client/get.mjs +1 -1
  95. package/dist/esm/client/index.mjs +1 -1
  96. package/dist/esm/client/post.mjs +1 -1
  97. package/dist/esm/core/account.mjs +1 -1
  98. package/dist/esm/core/authenticationKey.mjs +1 -1
  99. package/dist/esm/core/crypto/index.mjs +1 -1
  100. package/dist/esm/core/index.mjs +1 -1
  101. package/dist/esm/index.d.mts +6 -2
  102. package/dist/esm/index.mjs +1 -1
  103. package/dist/esm/internal/account.mjs +1 -1
  104. package/dist/esm/internal/ans.d.mts +80 -13
  105. package/dist/esm/internal/ans.mjs +1 -1
  106. package/dist/esm/internal/coin.d.mts +2 -2
  107. package/dist/esm/internal/coin.mjs +1 -1
  108. package/dist/esm/internal/digitalAsset.d.mts +3 -3
  109. package/dist/esm/internal/digitalAsset.mjs +1 -1
  110. package/dist/esm/internal/event.mjs +1 -1
  111. package/dist/esm/internal/faucet.d.mts +3 -3
  112. package/dist/esm/internal/faucet.mjs +1 -1
  113. package/dist/esm/internal/fungibleAsset.mjs +1 -1
  114. package/dist/esm/internal/general.mjs +1 -1
  115. package/dist/esm/internal/staking.d.mts +2 -2
  116. package/dist/esm/internal/staking.mjs +1 -1
  117. package/dist/esm/internal/transaction.mjs +1 -1
  118. package/dist/esm/internal/transactionSubmission.d.mts +13 -44
  119. package/dist/esm/internal/transactionSubmission.mjs +1 -1
  120. package/dist/esm/transactions/authenticator/account.mjs +1 -1
  121. package/dist/esm/transactions/authenticator/index.mjs +1 -1
  122. package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
  123. package/dist/esm/transactions/index.d.mts +1 -1
  124. package/dist/esm/transactions/index.mjs +1 -1
  125. package/dist/esm/transactions/instances/index.mjs +1 -1
  126. package/dist/esm/transactions/instances/moduleId.mjs +1 -1
  127. package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
  128. package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
  129. package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
  130. package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
  131. package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
  132. package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
  133. package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +3 -6
  134. package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
  135. package/dist/esm/transactions/typeTag/index.mjs +1 -1
  136. package/dist/esm/transactions/typeTag/parser.mjs +1 -1
  137. package/dist/esm/transactions/types.d.mts +15 -41
  138. package/dist/esm/types/generated/operations.d.mts +28 -2
  139. package/dist/esm/types/generated/queries.d.mts +5 -2
  140. package/dist/esm/types/generated/queries.mjs +1 -1
  141. package/dist/esm/types/index.d.mts +1 -1
  142. package/dist/esm/types/indexer.d.mts +3 -2
  143. package/package.json +1 -1
  144. package/src/api/ans.ts +250 -11
  145. package/src/api/aptos.ts +20 -0
  146. package/src/api/coin.ts +2 -2
  147. package/src/api/digitalAsset.ts +3 -3
  148. package/src/api/transactionSubmission/build.ts +42 -0
  149. package/src/api/transactionSubmission/sign.ts +44 -0
  150. package/src/api/transactionSubmission/simulate.ts +56 -0
  151. package/src/api/transactionSubmission/submit.ts +53 -0
  152. package/src/api/transactionSubmission.ts +4 -143
  153. package/src/internal/ans.ts +406 -20
  154. package/src/internal/coin.ts +3 -3
  155. package/src/internal/digitalAsset.ts +5 -5
  156. package/src/internal/queries/ansTokenFragment.graphql +9 -0
  157. package/src/internal/queries/getNames.graphql +11 -0
  158. package/src/internal/transactionSubmission.ts +29 -21
  159. package/src/transactions/transactionBuilder/transactionBuilder.ts +20 -43
  160. package/src/transactions/types.ts +14 -45
  161. package/src/types/generated/operations.ts +29 -0
  162. package/src/types/generated/queries.ts +34 -0
  163. package/src/types/indexer.ts +3 -0
  164. package/dist/esm/chunk-BP5ZO7NK.mjs +0 -2
  165. package/dist/esm/chunk-BP5ZO7NK.mjs.map +0 -1
  166. package/dist/esm/chunk-BWMNPUTK.mjs.map +0 -1
  167. package/dist/esm/chunk-EYXHVA6W.mjs +0 -2
  168. package/dist/esm/chunk-EYXHVA6W.mjs.map +0 -1
  169. package/dist/esm/chunk-IG5CHHSI.mjs +0 -2
  170. package/dist/esm/chunk-IG5CHHSI.mjs.map +0 -1
  171. package/dist/esm/chunk-IXMB2GOK.mjs +0 -2
  172. package/dist/esm/chunk-IXMB2GOK.mjs.map +0 -1
  173. package/dist/esm/chunk-NTD3H2S4.mjs +0 -2
  174. package/dist/esm/chunk-NTD3H2S4.mjs.map +0 -1
  175. package/dist/esm/chunk-NYFVEKF6.mjs +0 -2
  176. package/dist/esm/chunk-P32MY5YF.mjs.map +0 -1
  177. package/dist/esm/chunk-UNQNACJT.mjs +0 -2
  178. package/dist/esm/chunk-V45RFKH7.mjs.map +0 -1
  179. package/dist/esm/chunk-VOYW2TZW.mjs +0 -2
  180. package/dist/esm/chunk-VOYW2TZW.mjs.map +0 -1
  181. package/dist/esm/chunk-WX43AJTD.mjs.map +0 -1
  182. package/dist/esm/chunk-Y5DJPHJT.mjs +0 -2
  183. package/dist/esm/chunk-Y5DJPHJT.mjs.map +0 -1
  184. /package/dist/esm/{chunk-NGCFPQ22.mjs.map → chunk-2OZRBXLM.mjs.map} +0 -0
  185. /package/dist/esm/{chunk-TQD4IGUM.mjs.map → chunk-33T7WTB6.mjs.map} +0 -0
  186. /package/dist/esm/{chunk-Q6N6QACD.mjs.map → chunk-67OGU66P.mjs.map} +0 -0
  187. /package/dist/esm/{chunk-2W744GUN.mjs.map → chunk-BFQRMCY2.mjs.map} +0 -0
  188. /package/dist/esm/{chunk-WKY5ENCK.mjs.map → chunk-BM4HBROC.mjs.map} +0 -0
  189. /package/dist/esm/{chunk-UPLWWSB4.mjs.map → chunk-GAI75GOG.mjs.map} +0 -0
  190. /package/dist/esm/{chunk-7MNEEVXY.mjs.map → chunk-GU4OUKAF.mjs.map} +0 -0
  191. /package/dist/esm/{chunk-EQ5BEDJ7.mjs.map → chunk-HO7K2UAK.mjs.map} +0 -0
  192. /package/dist/esm/{chunk-U3LO2FSJ.mjs.map → chunk-IBH7IOIM.mjs.map} +0 -0
  193. /package/dist/esm/{chunk-R26XML3D.mjs.map → chunk-J5BH7V37.mjs.map} +0 -0
  194. /package/dist/esm/{chunk-EGOYLZBU.mjs.map → chunk-LDAD54H5.mjs.map} +0 -0
  195. /package/dist/esm/{chunk-4RVIA63I.mjs.map → chunk-M2V2POWK.mjs.map} +0 -0
  196. /package/dist/esm/{chunk-3JVGSFHP.mjs.map → chunk-ND3ZQKTT.mjs.map} +0 -0
  197. /package/dist/esm/{chunk-VMQWW5UT.mjs.map → chunk-OCYS4V2V.mjs.map} +0 -0
  198. /package/dist/esm/{chunk-Z2UDRTHA.mjs.map → chunk-OVHY6ZUJ.mjs.map} +0 -0
  199. /package/dist/esm/{chunk-UNQNACJT.mjs.map → chunk-PZCMSHY6.mjs.map} +0 -0
  200. /package/dist/esm/{chunk-BFSEVKNA.mjs.map → chunk-RKKU2SY5.mjs.map} +0 -0
  201. /package/dist/esm/{chunk-GEFQFRL3.mjs.map → chunk-TPWSHFFI.mjs.map} +0 -0
  202. /package/dist/esm/{chunk-VYAVLUPJ.mjs.map → chunk-WEJAI26R.mjs.map} +0 -0
  203. /package/dist/esm/{chunk-JDS7K2WI.mjs.map → chunk-WL4OXZLN.mjs.map} +0 -0
  204. /package/dist/esm/{chunk-AAIBCWZY.mjs.map → chunk-Y2HRRUZ6.mjs.map} +0 -0
  205. /package/dist/esm/{chunk-J5ZFOJN2.mjs.map → chunk-ZLW65YCO.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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var zo=Object.defineProperty;var Ro=Object.getOwnPropertyDescriptor;var ae=(n,t,e,r)=>{for(var o=r>1?void 0:r?Ro(t,e):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(t,e,o):s(o))||o);return r&&o&&zo(t,e,o),o};var J=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var kn="0.0.4";var en=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(en||{}),Bn= exports.TypeTagVariants =(l=>(l[l.Bool=0]="Bool",l[l.U8=1]="U8",l[l.U64=2]="U64",l[l.U128=3]="U128",l[l.Address=4]="Address",l[l.Signer=5]="Signer",l[l.Vector=6]="Vector",l[l.Struct=7]="Struct",l[l.U16=8]="U16",l[l.U32=9]="U32",l[l.U256=10]="U256",l[l.Reference=254]="Reference",l[l.Generic=255]="Generic",l))(Bn||{}),Xe= 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))(Xe||{}),Gn= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Gn||{}),Mn= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Mn||{}),On= exports.TransactionAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.SingleSender=4]="SingleSender",i))(On||{}),Dn= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Dn||{}),Fn= exports.AnyPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Fn||{}),Nn= exports.AnySignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Nn||{}),qn= exports.TransactionResponseType =(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(qn||{}),ko= exports.MoveFunctionVisibility =(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ko||{}),Bo= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Bo||{}),Go= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Go||{}),Ye= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Ye||{}),Kn= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(Kn||{}),Mo= exports.DeriveScheme =(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(Mo||{});var $n={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Oo(n,t){let{url:e,method:r,body:o,contentType:i,params:s,overrides:a}=n,u={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-ts-sdk/${kn}`,"content-type":_nullishCoalesce(i, () => ("application/json"))};return _optionalChain([a, 'optionalAccess', _3 => _3.AUTH_TOKEN])&&e.includes("faucet")&&(u.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _4 => _4.AUTH_TOKEN])}`),t.provider({url:e,method:r,body:o,params:s,headers:u,overrides:a})}async function bt(n,t){let{url:e,path:r}=n,o=`${e}/${_nullishCoalesce(r, () => (""))}`,i=await Oo({...n,url:o},t.client),s={status:i.status,statusText:i.statusText,data:i.data,headers:i.headers,config:i.config,request:i.request,url:o};if(t.isIndexerRequest(e)){let u=s.data;if(u.errors)throw new J(n,s,_nullishCoalesce(u.errors[0].message, () => (`Unhandled Error ${i.status} : ${i.statusText}`)));s.data=u.data}if(s.status>=200&&s.status<300)return s;let a;throw"message"in i.data&&"error_code"in i.data?a=JSON.stringify(i.data):s.status in $n?a=$n[s.status]:a=`Unhandled Error ${i.status} : ${i.statusText}`,new J(n,s,a)}var tn={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Hn= exports.NetworkToNodeAPI ={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},Ln= 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"},wt= exports.Network =(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(wt||{}),nn= exports.NetworkToChainId ={mainnet:1,testnet:2},Oi= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var _t=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))(_t||{}),Qn= exports.DEFAULT_NETWORK ="devnet",Vn= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,Wn= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,xt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,jn= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",Xn= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",rn= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData";async function Do(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:u}=n,d=t.getRequestUrl(u);return bt({url:d,method:"GET",originMethod:a,path:s,contentType:_optionalChain([o, 'optionalAccess', _5 => _5.valueOf, 'call', _6 => _6()]),acceptType:_optionalChain([i, 'optionalAccess', _7 => _7.valueOf, 'call', _8 => _8()]),params:r,overrides:{...t.clientConfig,...e}},t)}async function k(n){return Do({...n,type:0})}async function Ce(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await k({aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function on(n){let{type:t,originMethod:e,path:r,body:o,acceptType:i,contentType:s,params:a,aptosConfig:u,overrides:d}=n,y=u.getRequestUrl(t);return bt({url:y,method:"POST",originMethod:e,path:r,body:o,contentType:_optionalChain([s, 'optionalAccess', _9 => _9.valueOf, 'call', _10 => _10()]),acceptType:_optionalChain([i, 'optionalAccess', _11 => _11.valueOf, 'call', _12 => _12()]),params:a,overrides:{...u.clientConfig,...d}},u)}async function Ie(n){return on({...n,type:0})}async function Yn(n){return on({...n,type:1})}async function Zn(n){return on({...n,type:2})}var _utils = require('@noble/hashes/utils');var St=2**8-1,vt=2**16-1,ee=2**32-1,Ae=BigInt(2)**BigInt(64)-BigInt(1),Ze=BigInt(2)**BigInt(128)-BigInt(1),Ut=BigInt(2)**BigInt(256)-BigInt(1);var z=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var qo=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(qo||{}),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 fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new z("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 z("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){let o=r;throw new z(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){let r=e;return{valid:!1,invalidReason:r.invalidReason,invalidReasonMessage:r.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var p=class{bcsToBytes(){let t=new L;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},L= 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 o=new DataView(this.buffer,this.offset);t.apply(o,[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){sn(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(ee),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&Ae,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&Ze,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)})}};ae([he(0,St)],L.prototype,"serializeU8",1),ae([he(0,vt)],L.prototype,"serializeU16",1),ae([he(0,ee)],L.prototype,"serializeU32",1),ae([he(BigInt(0),Ae)],L.prototype,"serializeU64",1),ae([he(BigInt(0),Ze)],L.prototype,"serializeU128",1),ae([he(BigInt(0),Ut)],L.prototype,"serializeU256",1),ae([he(0,ee)],L.prototype,"serializeU32AsUleb128",1);function sn(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var Ko=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function ce(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(Ko(n,t,e))}function he(n,t){return(e,r,o)=>{let i=o.value;return o.value=function(a){return ce(a,n,t),i.apply(this,[a])},o}}var Ho=(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))(Ho||{}),f=class f extends p{constructor(e){super();if(e.length!==f.LENGTH)throw new z("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(f.LENGTH);return new f(r)}static fromString(e){if(!e.startsWith("0x"))throw new z("Hex string must start with a leading 0x.","leading_zero_x_required");let r=f.fromStringRelaxed(e);if(e.length!==f.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new z(`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 z(`The given hex string ${r} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromStringRelaxed(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new z("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new z("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(i){let s=i;throw new z(`Hex characters are invalid: ${s.message}`,"invalid_hex_chars")}return new f(o)}static fromRelaxed(e){return e instanceof f?e:e instanceof Uint8Array?new f(e):f.fromStringRelaxed(e)}static from(e){return e instanceof f?e:e instanceof Uint8Array?new f(e):f.fromString(e)}static isValid(e){try{return e.relaxed?f.fromRelaxed(e.input):f.from(e.input),{valid:!0}}catch(r){let o=r;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};f.LENGTH=32,f.LONG_STRING_LENGTH=64,f.ZERO=f.from("0x0"),f.ONE=f.from("0x1"),f.TWO=f.from("0x2"),f.THREE=f.from("0x3"),f.FOUR=f.from("0x4");var c=f;var _sha3 = require('@noble/hashes/sha3');var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var Ct=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}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}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<ee;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>ee)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 o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var Te=class n extends p{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 o=e.deserializeFixedBytes(r);return new n(o)}};var It=class n extends p{constructor(e){super();this.value=new Te(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=Te.deserialize(e,r);return new n(o.value)}};var x=class n extends p{constructor(e){super();sn(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())}},E= exports.U8 =class n extends p{constructor(e){super();ce(e,0,St),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())}},F= exports.U16 =class n extends p{constructor(e){super();ce(e,0,vt),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())}},N= exports.U32 =class n extends p{constructor(e){super();ce(e,0,ee),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())}},S= exports.U64 =class n extends p{constructor(e){super();ce(e,BigInt(0),Ae),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())}},q= exports.U128 =class n extends p{constructor(e){super();ce(e,BigInt(0),Ze),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())}},K= exports.U256 =class n extends p{constructor(e){super();ce(e,BigInt(0),Ut),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 A=class n extends p{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof E)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=g.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new E(o)))}static U16(e){return new n(e.map(r=>new F(r)))}static U32(e){return new n(e.map(r=>new N(r)))}static U64(e){return new n(e.map(r=>new S(r)))}static U128(e){return new n(e.map(r=>new q(r)))}static U256(e){return new n(e.map(r=>new K(r)))}static Bool(e){return new n(e.map(r=>new x(r)))}static MoveString(e){return new n(e.map(r=>new v(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1)i.push(r.deserialize(e));return new n(i)}},v= exports.MoveString =class n extends p{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);A.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},Q= exports.MoveOption =class n extends p{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new A([e]):this.vec=new A([]),[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(e):void 0)}static U16(e){return new n(e!=null?new F(e):void 0)}static U32(e){return new n(e!=null?new N(e):void 0)}static U64(e){return new n(e!=null?new S(e):void 0)}static U128(e){return new n(e!=null?new q(e):void 0)}static U256(e){return new n(e!=null?new K(e):void 0)}static Bool(e){return new n(e!=null?new x(e):void 0)}static MoveString(e){return new n(e!=null?new v(e):void 0)}static deserialize(e,r){let o=A.deserialize(e,r);return new n(o.values[0])}};var M=class extends p{},Pe= exports.PrivateKey =class extends p{},V= exports.Signature =class extends p{};var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var er = _interopRequireWildcard(_bip39);var Vo=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Wo= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,jo= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(jo||{}),tr= exports.HARDENED_OFFSET =2147483648;function nr(n){return Wo.test(n)}function rr(n){return Vo.test(n)}var an=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},or= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),i=new Uint8Array([0]),s=new Uint8Array([...i,...n,...o]);return an(t,s)},Xo=n=>n.replace("'",""),ir= exports.splitPath =n=>n.split("/").slice(1).map(Xo),Pt= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return er.mnemonicToSeedSync(t)};var be=class be extends M{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==be.LENGTH)throw new Error(`PublicKey length should be ${be.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=g.fromHexInput(r).toUint8Array(),s=o.toUint8Array();return _tweetnacl2.default.sign.detached.verify(i,s,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new be(r)}static load(e){let r=e.deserializeBytes();return new be(r)}};be.LENGTH=32;var T=be,R=class R extends Pe{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==R.LENGTH)throw new Error(`PrivateKey length should be ${R.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,R.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,R.LENGTH)}toString(){return g.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=g.fromHexInput(e),o=_tweetnacl2.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new U(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new R(r)}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new R(e.secretKey.slice(0,R.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new T(e)}static fromDerivationPath(e,r){if(!rr(e))throw new Error(`Invalid derivation path ${e}`);return R.fromDerivationPathInner(e,Pt(r))}static fromDerivationPathInner(e,r,o=tr){let{key:i,chainCode:s}=an(R.SLIP_0010_SEED,r),a=ir(e).map(d=>parseInt(d,10)),{key:u}=a.reduce((d,y)=>or(d,y+o),{key:i,chainCode:s});return new R(u)}};R.LENGTH=32,R.SLIP_0010_SEED="ed25519 seed";var ue=R,we=class we extends V{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==we.LENGTH)throw new Error(`Signature length should be ${we.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new we(r)}static load(e){let r=e.deserializeBytes();return new we(r)}};we.LENGTH=64;var U=we;var O=class O extends M{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>O.MAX_KEYS||r.length<O.MIN_KEYS)throw new Error(`Must have between ${O.MIN_KEYS} and ${O.MAX_KEYS} public keys, inclusive`);if(o<O.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${O.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*T.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*T.LENGTH)}),e[this.publicKeys.length*T.LENGTH]=this.threshold,e}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],i=[];for(let s=0;s<r.length-1;s+=T.LENGTH){let a=s;i.push(new T(r.subarray(a,a+T.LENGTH)))}return new O({publicKeys:i,threshold:o})}};O.MAX_KEYS=32,O.MIN_KEYS=2,O.MIN_THRESHOLD=1;var W=O,D=class D extends V{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==D.BITMAP_LEN)throw new Error(`"bitmap" length should be ${D.BITMAP_LEN}`);if(r.length>D.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${D.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*U.LENGTH+D.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*U.LENGTH)}),e.set(this.bitmap,this.signatures.length*U.LENGTH),e}toString(){return g.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=D.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${D.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let u=Math.floor(a/8),d=i[u];d|=o>>a%8,i[u]=d}),i}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),i=[];for(let s=0;s<r.length-o.length;s+=U.LENGTH){let a=s;i.push(new U(r.subarray(a,a+U.LENGTH)))}return new D({signatures:i,bitmap:o})}};D.MAX_SIGNATURES_SUPPORTED=32,D.BITMAP_LEN=4;var Ee=D;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var _e=class _e extends M{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==_e.LENGTH)throw new Error(`PublicKey length should be ${_e.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=g.fromHexInput(r).toUint8Array(),s=_sha3.sha3_256.call(void 0, i),a=o.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new _e(r)}static load(e){let r=e.deserializeBytes();return new _e(r)}};_e.LENGTH=65;var j=_e,te=class te extends Pe{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}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=g.fromHexInput(e),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());return new pe(i.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new te(r)}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new te(e)}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new j(e)}static fromDerivationPath(e,r){if(!nr(e))throw new Error(`Invalid derivation path ${e}`);return te.fromDerivationPathInner(e,Pt(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new te(o)}};te.LENGTH=32;var de=te,xe=class xe extends V{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==xe.LENGTH)throw new Error(`Signature length should be ${xe.LENGTH}, recieved ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new xe(r)}static load(e){let r=e.deserializeBytes();return new xe(r)}};xe.LENGTH=64;var pe=xe;var C=class n extends M{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:r,signature:o}=e;return this.publicKey.verifySignature({message:r,signature:o})}serialize(e){if(this.publicKey instanceof T)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof j)e.serializeU32AsUleb128(1),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(T.load(e));case 1:return new n(j.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}};var ze=class n extends M{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);let i=[];r.forEach(s=>{s instanceof C?i.push(s):i.push(new C(s))}),this.publicKeys=i,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+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 d=Math.floor(a/8),y=i[d];y|=o>>a%8,i[d]=y}),i}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(C),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var ne=class ne extends p{constructor(e){super();let{data:r}=e,o=g.fromHexInput(r);if(o.toUint8Array().length!==ne.LENGTH)throw new Error(`Authentication Key length should be ${ne.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(ne.LENGTH);return new ne({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:r,scheme:o}=e,i;switch(o){case 3:case 2:{let u=r.bcsToBytes();i=new Uint8Array([...u,o]);break}case 0:case 1:{let u=r.toUint8Array(),d=g.fromHexInput(u).toUint8Array();i=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new ne({data:a})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof T)o=0 .valueOf();else if(r instanceof W)o=1 .valueOf();else if(r instanceof C)o=2 .valueOf();else if(r instanceof ze)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return ne.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new c(this.data.toUint8Array())}};ne.LENGTH=32;var X=ne;var le=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,i=_nullishCoalesce(o, () => (!0));if(this.publicKey=e.publicKey(),this.publicKey instanceof T)i?this.signingScheme=0:(this.publicKey=new C(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof W)this.signingScheme=1;else if(this.publicKey instanceof j)this.publicKey=new C(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=r}static generate(t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _13 => _13.legacy]), () => (!0)),r,o;switch(_optionalChain([t, 'optionalAccess', _14 => _14.scheme])){case 2:r=de.generate(),o=new C(r.publicKey());break;default:r=ue.generate(),e===!1?o=new C(r.publicKey()):o=r.publicKey()}let s=X.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:s,legacy:_optionalChain([t, 'optionalAccess', _15 => _15.legacy])})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=_nullishCoalesce(r, () => (!0)),i;if(e instanceof de)i=new C(e.publicKey());else if(e instanceof ue)o?i=e.publicKey():i=new C(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let a=X.fromPublicKey({publicKey:i}).derivedAddress();return new n({privateKey:e,address:a,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:r,legacy:o}=t;return new n({privateKey:e,address:r,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:r,scheme:o,legacy:i}=t,s;switch(o){case 2:s=de.fromDerivationPath(e,r);break;case 0:s=ue.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:s,legacy:i})}static authKey(t){let{publicKey:e}=t;return X.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=g.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var Jo=`
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; } async function _asyncOptionalChain(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 = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var ti=Object.defineProperty;var ni=Object.getOwnPropertyDescriptor;var G=(n,t,e,r)=>{for(var o=r>1?void 0:r?ni(t,e):t,i=n.length-1,s;i>=0;i--)(s=n[i])&&(o=(r?s(t,e,o):s(o))||o);return r&&o&&ti(t,e,o),o};var Z=class extends Error{constructor(e,r,o){super(o);this.name="AptosApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.data=r.data,this.request=e}};var Ln="0.0.4";var dn=(r=>(r.JSON="application/json",r.BCS="application/x-bcs",r.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",r))(dn||{}),Qn= exports.TypeTagVariants =(l=>(l[l.Bool=0]="Bool",l[l.U8=1]="U8",l[l.U64=2]="U64",l[l.U128=3]="U128",l[l.Address=4]="Address",l[l.Signer=5]="Signer",l[l.Vector=6]="Vector",l[l.Struct=7]="Struct",l[l.U16=8]="U16",l[l.U32=9]="U32",l[l.U256=10]="U256",l[l.Reference=254]="Reference",l[l.Generic=255]="Generic",l))(Qn||{}),rt= 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))(rt||{}),Vn= exports.TransactionPayloadVariants =(r=>(r[r.Script=0]="Script",r[r.EntryFunction=2]="EntryFunction",r[r.Multisig=3]="Multisig",r))(Vn||{}),Wn= exports.TransactionVariants =(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Wn||{}),jn= exports.TransactionAuthenticatorVariant =(i=>(i[i.Ed25519=0]="Ed25519",i[i.MultiEd25519=1]="MultiEd25519",i[i.MultiAgent=2]="MultiAgent",i[i.FeePayer=3]="FeePayer",i[i.SingleSender=4]="SingleSender",i))(jn||{}),Xn= exports.AccountAuthenticatorVariant =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Xn||{}),Yn= exports.AnyPublicKeyVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Yn||{}),Zn= exports.AnySignatureVariant =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Zn||{}),Jn= exports.TransactionResponseType =(i=>(i.Pending="pending_transaction",i.User="user_transaction",i.Genesis="genesis_transaction",i.BlockMetadata="block_metadata_transaction",i.StateCheckpoint="state_checkpoint_transaction",i))(Jn||{}),ri= exports.MoveFunctionVisibility =(r=>(r.PRIVATE="private",r.PUBLIC="public",r.FRIEND="friend",r))(ri||{}),oi= exports.MoveAbility =(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(oi||{}),ii= exports.RoleType =(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(ii||{}),ot= exports.SigningScheme =(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(ot||{}),er= exports.SigningSchemeInput =(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(er||{}),si= exports.DeriveScheme =(i=>(i[i.DeriveAuid=251]="DeriveAuid",i[i.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",i[i.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",i[i.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",i[i.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",i))(si||{});var tr={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function ai(n,t){let{url:e,method:r,body:o,contentType:i,params:s,overrides:a}=n,u={..._optionalChain([a, 'optionalAccess', _2 => _2.HEADERS]),"x-aptos-client":`aptos-ts-sdk/${Ln}`,"content-type":_nullishCoalesce(i, () => ("application/json"))};return _optionalChain([a, 'optionalAccess', _3 => _3.AUTH_TOKEN])&&e.includes("faucet")&&(u.Authorization=`Bearer ${_optionalChain([a, 'optionalAccess', _4 => _4.AUTH_TOKEN])}`),t.provider({url:e,method:r,body:o,params:s,headers:u,overrides:a})}async function It(n,t){let{url:e,path:r}=n,o=`${e}/${_nullishCoalesce(r, () => (""))}`,i=await ai({...n,url:o},t.client),s={status:i.status,statusText:i.statusText,data:i.data,headers:i.headers,config:i.config,request:i.request,url:o};if(t.isIndexerRequest(e)){let u=s.data;if(u.errors)throw new Z(n,s,_nullishCoalesce(u.errors[0].message, () => (`Unhandled Error ${i.status} : ${i.statusText}`)));s.data=u.data}if(s.status>=200&&s.status<300)return s;let a;throw"message"in i.data&&"error_code"in i.data?a=JSON.stringify(i.data):s.status in tr?a=tr[s.status]:a=`Unhandled Error ${i.status} : ${i.statusText}`,new Z(n,s,a)}var pn={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},nr= exports.NetworkToNodeAPI ={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},rr= 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"},Et= exports.Network =(i=>(i.MAINNET="mainnet",i.TESTNET="testnet",i.DEVNET="devnet",i.LOCAL="local",i.CUSTOM="custom",i))(Et||{}),ln= exports.NetworkToChainId ={mainnet:1,testnet:2},as= exports.NetworkToNetworkName ={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var Rt=(r=>(r[r.FULLNODE=0]="FULLNODE",r[r.INDEXER=1]="INDEXER",r[r.FAUCET=2]="FAUCET",r))(Rt||{}),or= exports.DEFAULT_NETWORK ="devnet",ir= exports.DEFAULT_MAX_GAS_AMOUNT =2e5,sr= exports.DEFAULT_TXN_EXP_SEC_FROM_NOW =20,zt= exports.DEFAULT_TXN_TIMEOUT_SEC =20,ar= exports.APTOS_COIN ="0x1::aptos_coin::AptosCoin",cr= exports.RAW_TRANSACTION_SALT ="APTOS::RawTransaction",gn= exports.RAW_TRANSACTION_WITH_DATA_SALT ="APTOS::RawTransactionWithData";async function ci(n){let{aptosConfig:t,overrides:e,params:r,contentType:o,acceptType:i,path:s,originMethod:a,type:u}=n,d=t.getRequestUrl(u);return It({url:d,method:"GET",originMethod:a,path:s,contentType:_optionalChain([o, 'optionalAccess', _5 => _5.valueOf, 'call', _6 => _6()]),acceptType:_optionalChain([i, 'optionalAccess', _7 => _7.valueOf, 'call', _8 => _8()]),params:r,overrides:{...t.clientConfig,...e}},t)}async function N(n){return ci({...n,type:0})}async function ze(n){let t=[],e,r=n.params;for(;;){r.start=e;let o=await N({aptosConfig:n.aptosConfig,originMethod:n.originMethod,path:n.path,params:r,overrides:n.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function yn(n){let{type:t,originMethod:e,path:r,body:o,acceptType:i,contentType:s,params:a,aptosConfig:u,overrides:d}=n,m=u.getRequestUrl(t);return It({url:m,method:"POST",originMethod:e,path:r,body:o,contentType:_optionalChain([s, 'optionalAccess', _9 => _9.valueOf, 'call', _10 => _10()]),acceptType:_optionalChain([i, 'optionalAccess', _11 => _11.valueOf, 'call', _12 => _12()]),params:a,overrides:{...u.clientConfig,...d}},u)}async function ke(n){return yn({...n,type:0})}async function ur(n){return yn({...n,type:1})}async function dr(n){return yn({...n,type:2})}var _utils = require('@noble/hashes/utils');var kt=2**8-1,Gt=2**16-1,J=2**32-1,be=BigInt(2)**BigInt(64)-BigInt(1),it=BigInt(2)**BigInt(128)-BigInt(1),Bt=BigInt(2)**BigInt(256)-BigInt(1);var B=class extends Error{constructor(e,r){super(e);this.invalidReason=r}};var pi=(r=>(r.TOO_SHORT="too_short",r.INVALID_LENGTH="invalid_length",r.INVALID_HEX_CHARS="invalid_hex_chars",r))(pi||{}),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 fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new B("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 B("Hex string must be an even number of hex characters.","invalid_length");try{return new n(_utils.hexToBytes.call(void 0, e))}catch(r){let o=r;throw new B(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new n(t):n.fromString(t)}static isValid(t){try{return n.fromString(t),{valid:!0}}catch(e){let r=e;return{valid:!1,invalidReason:r.invalidReason,invalidReasonMessage:r.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,r)=>e===t.data[r])}};var p=class{bcsToBytes(){let t=new Q;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return g.fromHexInput(t)}},Q= 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 o=new DataView(this.buffer,this.offset);t.apply(o,[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){mn(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(J),r=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(r))}serializeU128(t){let e=BigInt(t)&be,r=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(r)}serializeU256(t){let e=BigInt(t)&it,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)})}};G([Te(0,kt)],Q.prototype,"serializeU8",1),G([Te(0,Gt)],Q.prototype,"serializeU16",1),G([Te(0,J)],Q.prototype,"serializeU32",1),G([Te(BigInt(0),be)],Q.prototype,"serializeU64",1),G([Te(BigInt(0),it)],Q.prototype,"serializeU128",1),G([Te(BigInt(0),Bt)],Q.prototype,"serializeU256",1),G([Te(0,J)],Q.prototype,"serializeU32AsUleb128",1);function mn(n){if(typeof n!="boolean")throw new Error(`${n} is not a boolean value`)}var li=(n,t,e)=>`${n} is out of range: [${t}, ${e}]`;function ce(n,t,e){let r=BigInt(n);if(r>BigInt(e)||r<BigInt(t))throw new Error(li(n,t,e))}function Te(n,t){return(e,r,o)=>{let i=o.value;return o.value=function(a){return ce(a,n,t),i.apply(this,[a])},o}}var yi=(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))(yi||{}),f=class f extends p{constructor(e){super();if(e.length!==f.LENGTH)throw new B("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(f.LENGTH);return new f(r)}static fromString(e){if(!e.startsWith("0x"))throw new B("Hex string must start with a leading 0x.","leading_zero_x_required");let r=f.fromStringRelaxed(e);if(e.length!==f.LONG_STRING_LENGTH+2)if(r.isSpecial()){if(e.length!==3)throw new B(`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 B(`The given hex string ${r} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return r}static fromStringRelaxed(e){let r=e;if(e.startsWith("0x")&&(r=e.slice(2)),r.length===0)throw new B("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(r.length>64)throw new B("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=_utils.hexToBytes.call(void 0, r.padStart(64,"0"))}catch(i){let s=i;throw new B(`Hex characters are invalid: ${s.message}`,"invalid_hex_chars")}return new f(o)}static fromRelaxed(e){return e instanceof f?e:e instanceof Uint8Array?new f(e):f.fromStringRelaxed(e)}static from(e){return e instanceof f?e:e instanceof Uint8Array?new f(e):f.fromString(e)}static isValid(e){try{return e.relaxed?f.fromRelaxed(e.input):f.from(e.input),{valid:!0}}catch(r){let o=r;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((r,o)=>r===e.data[o])}};f.LENGTH=32,f.LONG_STRING_LENGTH=64,f.ZERO=f.from("0x0"),f.ONE=f.from("0x1"),f.TWO=f.from("0x2"),f.THREE=f.from("0x3"),f.FOUR=f.from("0x4");var c=f;var _sha3 = require('@noble/hashes/sha3');var _tweetnacl = require('tweetnacl'); var _tweetnacl2 = _interopRequireDefault(_tweetnacl);var lr=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}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}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<J;){let r=this.deserializeU8();if(t|=BigInt(r&127)<<BigInt(e),!(r&128))break;e+=7}if(t>J)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 o=0;o<e;o+=1)r.push(this.deserialize(t));return r}};var we=class n extends p{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 o=e.deserializeFixedBytes(r);return new n(o)}};var Mt=class n extends p{constructor(e){super();this.value=new we(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,r){let o=we.deserialize(e,r);return new n(o.value)}};var x=class n extends p{constructor(e){super();mn(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())}},z= exports.U8 =class n extends p{constructor(e){super();ce(e,0,kt),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())}},K= exports.U16 =class n extends p{constructor(e){super();ce(e,0,Gt),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())}},$= exports.U32 =class n extends p{constructor(e){super();ce(e,0,J),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())}},U= exports.U64 =class n extends p{constructor(e){super();ce(e,BigInt(0),be),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())}},H= exports.U128 =class n extends p{constructor(e){super();ce(e,BigInt(0),it),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())}},L= exports.U256 =class n extends p{constructor(e){super();ce(e,BigInt(0),Bt),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 A=class n extends p{constructor(e){super();this.values=e}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){if(!(this.values[0]instanceof z)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let r;if(Array.isArray(e)&&typeof e[0]=="number")r=e;else if(typeof e=="string"){let o=g.fromHexInput(e);r=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)r=Array.from(e);else throw new Error("Invalid input type");return new n(r.map(o=>new z(o)))}static U16(e){return new n(e.map(r=>new K(r)))}static U32(e){return new n(e.map(r=>new $(r)))}static U64(e){return new n(e.map(r=>new U(r)))}static U128(e){return new n(e.map(r=>new H(r)))}static U256(e){return new n(e.map(r=>new L(r)))}static Bool(e){return new n(e.map(r=>new x(r)))}static MoveString(e){return new n(e.map(r=>new P(r)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,r){let o=e.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1)i.push(r.deserialize(e));return new n(i)}},P= exports.MoveString =class n extends p{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let r=this.bcsToBytes();e.serializeBytes(r)}serializeForScriptFunction(e){let r=this.bcsToBytes().slice(1);A.U8(r).serializeForScriptFunction(e)}static deserialize(e){return new n(e.deserializeStr())}},_e= exports.MoveOption =class n extends p{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new A([e]):this.vec=new A([]),[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 z(e):void 0)}static U16(e){return new n(e!=null?new K(e):void 0)}static U32(e){return new n(e!=null?new $(e):void 0)}static U64(e){return new n(e!=null?new U(e):void 0)}static U128(e){return new n(e!=null?new H(e):void 0)}static U256(e){return new n(e!=null?new L(e):void 0)}static Bool(e){return new n(e!=null?new x(e):void 0)}static MoveString(e){return new n(e!=null?new P(e):void 0)}static deserialize(e,r){let o=A.deserialize(e,r);return new n(o.values[0])}};var D=class extends p{},Ge= exports.PrivateKey =class extends p{},V= exports.Signature =class extends p{};var _hmac = require('@noble/hashes/hmac');var _sha512 = require('@noble/hashes/sha512');var _bip39 = require('@scure/bip39'); var gr = _interopRequireWildcard(_bip39);var Ai=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,hi= exports.APTOS_BIP44_REGEX =/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,bi= exports.KeyType =(t=>(t.ED25519="ed25519 seed",t))(bi||{}),yr= exports.HARDENED_OFFSET =2147483648;function mr(n){return hi.test(n)}function fr(n){return Ai.test(n)}var fn=(n,t)=>{let e=_hmac.hmac.create(_sha512.sha512,n).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},Ar= exports.CKDPriv =({key:n,chainCode:t},e)=>{let r=new ArrayBuffer(4);new DataView(r).setUint32(0,e);let o=new Uint8Array(r),i=new Uint8Array([0]),s=new Uint8Array([...i,...n,...o]);return fn(t,s)},Ti=n=>n.replace("'",""),hr= exports.splitPath =n=>n.split("/").slice(1).map(Ti),Nt= exports.mnemonicToSeed =n=>{let t=n.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return gr.mnemonicToSeedSync(t)};var xe=class xe extends D{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==xe.LENGTH)throw new Error(`PublicKey length should be ${xe.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=g.fromHexInput(r).toUint8Array(),s=o.toUint8Array();return _tweetnacl2.default.sign.detached.verify(i,s,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new xe(r)}static load(e){let r=e.deserializeBytes();return new xe(r)}};xe.LENGTH=32;var h=xe,M=class M extends Ge{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==M.LENGTH)throw new Error(`PrivateKey length should be ${M.LENGTH}`);this.signingKeyPair=_tweetnacl2.default.sign.keyPair.fromSeed(r.toUint8Array().slice(0,M.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,M.LENGTH)}toString(){return g.fromHexInput(this.toUint8Array()).toString()}sign(e){let r=g.fromHexInput(e),o=_tweetnacl2.default.sign.detached(r.toUint8Array(),this.signingKeyPair.secretKey);return new S(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new M(r)}static generate(){let e=_tweetnacl2.default.sign.keyPair();return new M(e.secretKey.slice(0,M.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new h(e)}static fromDerivationPath(e,r){if(!fr(e))throw new Error(`Invalid derivation path ${e}`);return M.fromDerivationPathInner(e,Nt(r))}static fromDerivationPathInner(e,r,o=yr){let{key:i,chainCode:s}=fn(M.SLIP_0010_SEED,r),a=hr(e).map(d=>parseInt(d,10)),{key:u}=a.reduce((d,m)=>Ar(d,m+o),{key:i,chainCode:s});return new M(u)}};M.LENGTH=32,M.SLIP_0010_SEED="ed25519 seed";var ue=M,Se=class Se extends V{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Se.LENGTH)throw new Error(`Signature length should be ${Se.LENGTH}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Se(r)}static load(e){let r=e.deserializeBytes();return new Se(r)}};Se.LENGTH=64;var S=Se;var F=class F extends D{constructor(e){super();let{publicKeys:r,threshold:o}=e;if(r.length>F.MAX_KEYS||r.length<F.MIN_KEYS)throw new Error(`Must have between ${F.MIN_KEYS} and ${F.MAX_KEYS} public keys, inclusive`);if(o<F.MIN_THRESHOLD||o>r.length)throw new Error(`Threshold must be between ${F.MIN_THRESHOLD} and ${r.length}, inclusive`);this.publicKeys=r,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*h.LENGTH+1);return this.publicKeys.forEach((r,o)=>{e.set(r.toUint8Array(),o*h.LENGTH)}),e[this.publicKeys.length*h.LENGTH]=this.threshold,e}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r[r.length-1],i=[];for(let s=0;s<r.length-1;s+=h.LENGTH){let a=s;i.push(new h(r.subarray(a,a+h.LENGTH)))}return new F({publicKeys:i,threshold:o})}};F.MAX_KEYS=32,F.MIN_KEYS=2,F.MIN_THRESHOLD=1;var W=F,q=class q extends V{constructor(e){super();let{signatures:r,bitmap:o}=e;if(o.length!==q.BITMAP_LEN)throw new Error(`"bitmap" length should be ${q.BITMAP_LEN}`);if(r.length>q.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${q.MAX_SIGNATURES_SUPPORTED}`);this.signatures=r,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*S.LENGTH+q.BITMAP_LEN);return this.signatures.forEach((r,o)=>{e.set(r.toUint8Array(),o*S.LENGTH)}),e.set(this.bitmap,this.signatures.length*S.LENGTH),e}toString(){return g.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach(a=>{if(a>=q.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${q.MAX_SIGNATURES_SUPPORTED-1}.`);if(s.has(a))throw new Error("Duplicate bits detected.");s.add(a);let u=Math.floor(a/8),d=i[u];d|=o>>a%8,i[u]=d}),i}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes(),o=r.subarray(r.length-4),i=[];for(let s=0;s<r.length-o.length;s+=S.LENGTH){let a=s;i.push(new S(r.subarray(a,a+S.LENGTH)))}return new q({signatures:i,bitmap:o})}};q.MAX_SIGNATURES_SUPPORTED=32,q.BITMAP_LEN=4;var Be=q;var _secp256k1 = require('@noble/curves/secp256k1');var _bip32 = require('@scure/bip32');var ve=class ve extends D{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==ve.LENGTH)throw new Error(`PublicKey length should be ${ve.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:r,signature:o}=e,i=g.fromHexInput(r).toUint8Array(),s=_sha3.sha3_256.call(void 0, i),a=o.toUint8Array();return _secp256k1.secp256k1.verify(a,s,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ve(r)}static load(e){let r=e.deserializeBytes();return new ve(r)}};ve.LENGTH=65;var j=ve,ee=class ee extends Ge{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==ee.LENGTH)throw new Error(`PrivateKey length should be ${ee.LENGTH}`);this.key=r}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let r=g.fromHexInput(e),o=_sha3.sha3_256.call(void 0, r.toUint8Array()),i=_secp256k1.secp256k1.sign(o,this.key.toUint8Array());return new pe(i.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new ee(r)}static generate(){let e=_secp256k1.secp256k1.utils.randomPrivateKey();return new ee(e)}publicKey(){let e=_secp256k1.secp256k1.getPublicKey(this.key.toUint8Array(),!1);return new j(e)}static fromDerivationPath(e,r){if(!mr(e))throw new Error(`Invalid derivation path ${e}`);return ee.fromDerivationPathInner(e,Nt(r))}static fromDerivationPathInner(e,r){let{privateKey:o}=_bip32.HDKey.fromMasterSeed(r).derive(e);if(o===null)throw new Error("Invalid key");return new ee(o)}};ee.LENGTH=32;var de=ee,Ce=class Ce extends V{constructor(e){super();let r=g.fromHexInput(e);if(r.toUint8Array().length!==Ce.LENGTH)throw new Error(`Signature length should be ${Ce.LENGTH}, recieved ${r.toUint8Array().length}`);this.data=r}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeBytes();return new Ce(r)}static load(e){let r=e.deserializeBytes();return new Ce(r)}};Ce.LENGTH=64;var pe=Ce;var v=class n extends D{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:r,signature:o}=e;return this.publicKey.verifySignature({message:r,signature:o})}serialize(e){if(this.publicKey instanceof h)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof j)e.serializeU32AsUleb128(1),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(h.load(e));case 1:return new n(j.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${r}`)}}};var Me=class n extends D{constructor(e){super();let{publicKeys:r,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(r.length<o)throw new Error(`Provided ${r.length} public keys is smaller than the ${o} required signatures`);let i=[];r.forEach(s=>{s instanceof v?i.push(s):i.push(new v(s))}),this.publicKeys=i,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:r}=e,o=128,i=new Uint8Array([0,0,0,0]),s=new Set;return r.forEach((a,u)=>{if(u+1>this.publicKeys.length)throw new Error(`Signature index ${u+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 d=Math.floor(a/8),m=i[d];m|=o>>a%8,i[d]=m}),i}toString(){return g.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let r=e.deserializeVector(v),o=e.deserializeU8();return new n({publicKeys:r,signaturesRequired:o})}};var te=class te extends p{constructor(e){super();let{data:r}=e,o=g.fromHexInput(r);if(o.toUint8Array().length!==te.LENGTH)throw new Error(`Authentication Key length should be ${te.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let r=e.deserializeFixedBytes(te.LENGTH);return new te({data:r})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:r,scheme:o}=e,i;switch(o){case 3:case 2:{let u=r.bcsToBytes();i=new Uint8Array([...u,o]);break}case 0:case 1:{let u=r.toUint8Array(),d=g.fromHexInput(u).toUint8Array();i=new Uint8Array([...d,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let s=_sha3.sha3_256.create();s.update(i);let a=s.digest();return new te({data:a})}static fromPublicKey(e){let{publicKey:r}=e,o;if(r instanceof h)o=0 .valueOf();else if(r instanceof W)o=1 .valueOf();else if(r instanceof v)o=2 .valueOf();else if(r instanceof Me)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return te.fromPublicKeyAndScheme({publicKey:r,scheme:o})}derivedAddress(){return new c(this.data.toUint8Array())}};te.LENGTH=32;var X=te;var le=class n{constructor(t){let{privateKey:e,address:r,legacy:o}=t,i=_nullishCoalesce(o, () => (!0));if(this.publicKey=e.publicKey(),this.publicKey instanceof h)i?this.signingScheme=0:(this.publicKey=new v(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof W)this.signingScheme=1;else if(this.publicKey instanceof j)this.publicKey=new v(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=r}static generate(t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _13 => _13.legacy]), () => (!0)),r,o;switch(_optionalChain([t, 'optionalAccess', _14 => _14.scheme])){case 2:r=de.generate(),o=new v(r.publicKey());break;default:r=ue.generate(),e===!1?o=new v(r.publicKey()):o=r.publicKey()}let s=X.fromPublicKey({publicKey:o}).derivedAddress();return new n({privateKey:r,address:s,legacy:_optionalChain([t, 'optionalAccess', _15 => _15.legacy])})}static fromPrivateKey(t){let{privateKey:e,legacy:r}=t,o=_nullishCoalesce(r, () => (!0)),i;if(e instanceof de)i=new v(e.publicKey());else if(e instanceof ue)o?i=e.publicKey():i=new v(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let a=X.fromPublicKey({publicKey:i}).derivedAddress();return new n({privateKey:e,address:a,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:r,legacy:o}=t;return new n({privateKey:e,address:r,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:r,scheme:o,legacy:i}=t,s;switch(o){case 2:s=de.fromDerivationPath(e,r);break;case 0:s=ue.fromDerivationPath(e,r);break;default:throw new Error(`Unsupported scheme ${o}`)}return n.fromPrivateKey({privateKey:s,legacy:i})}static authKey(t){let{publicKey:e}=t;return X.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:r}=t,o=g.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:r})}};var xi=`
2
2
  fragment TokenActivitiesFields on token_activities_v2 {
3
3
  after_value
4
4
  before_value
@@ -16,7 +16,17 @@
16
16
  transaction_version
17
17
  type
18
18
  }
19
- `,Rt=`
19
+ `,Si=`
20
+ fragment AnsTokenFragment on current_aptos_names {
21
+ domain
22
+ expiration_timestamp
23
+ registered_address
24
+ subdomain
25
+ token_standard
26
+ is_primary
27
+ owner_address
28
+ }
29
+ `,Ft=`
20
30
  fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
21
31
  token_standard
22
32
  token_properties_mutated_v1
@@ -62,7 +72,7 @@
62
72
  }
63
73
  }
64
74
  }
65
- `,ar=`
75
+ `,Tr=`
66
76
  query getAccountCoinsCount($address: String) {
67
77
  current_fungible_asset_balances_aggregate(
68
78
  where: {owner_address: {_eq: $address}}
@@ -72,7 +82,7 @@
72
82
  }
73
83
  }
74
84
  }
75
- `,cr=`
85
+ `,wr=`
76
86
  query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
77
87
  current_fungible_asset_balances(
78
88
  where: $where_condition
@@ -105,7 +115,7 @@
105
115
  }
106
116
  }
107
117
  }
108
- `,ur=`
118
+ `,_r=`
109
119
  query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
110
120
  current_collection_ownership_v2_view(
111
121
  where: $where_condition
@@ -139,7 +149,7 @@
139
149
  single_token_uri
140
150
  }
141
151
  }
142
- `,dr=`
152
+ `,xr=`
143
153
  query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
144
154
  current_objects(
145
155
  where: $where_condition
@@ -156,7 +166,7 @@
156
166
  is_deleted
157
167
  }
158
168
  }
159
- `,pr=`
169
+ `,Sr=`
160
170
  query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
161
171
  current_token_ownerships_v2(
162
172
  where: $where_condition
@@ -167,7 +177,7 @@
167
177
  ...CurrentTokenOwnershipFields
168
178
  }
169
179
  }
170
- ${Rt}`,Ya=`
180
+ ${Ft}`,wc=`
171
181
  query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
172
182
  current_token_ownerships_v2(
173
183
  where: $where_condition
@@ -178,7 +188,7 @@
178
188
  ...CurrentTokenOwnershipFields
179
189
  }
180
190
  }
181
- ${Rt}`,lr=`
191
+ ${Ft}`,vr=`
182
192
  query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
183
193
  current_token_ownerships_v2(
184
194
  where: $where_condition
@@ -189,7 +199,7 @@
189
199
  ...CurrentTokenOwnershipFields
190
200
  }
191
201
  }
192
- ${Rt}`,gr=`
202
+ ${Ft}`,Cr=`
193
203
  query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
194
204
  current_token_ownerships_v2_aggregate(
195
205
  where: $where_condition
@@ -201,7 +211,7 @@
201
211
  }
202
212
  }
203
213
  }
204
- `,yr=`
214
+ `,Ur=`
205
215
  query getAccountTransactionsCount($address: String) {
206
216
  account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
207
217
  aggregate {
@@ -209,13 +219,13 @@
209
219
  }
210
220
  }
211
221
  }
212
- `,mr=`
222
+ `,Pr=`
213
223
  query getChainTopUserTransactions($limit: Int) {
214
224
  user_transactions(limit: $limit, order_by: {version: desc}) {
215
225
  version
216
226
  }
217
227
  }
218
- `,fr=`
228
+ `,Ir=`
219
229
  query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
220
230
  current_collections_v2(where: $where_condition) {
221
231
  collection_id
@@ -234,7 +244,7 @@
234
244
  uri
235
245
  }
236
246
  }
237
- `,Ar=`
247
+ `,Er=`
238
248
  query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
239
249
  current_fungible_asset_balances(
240
250
  where: $where_condition
@@ -252,7 +262,7 @@
252
262
  token_standard
253
263
  }
254
264
  }
255
- `,hr=`
265
+ `,Rr=`
256
266
  query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
257
267
  delegated_staking_activities(
258
268
  where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
@@ -265,7 +275,7 @@
265
275
  transaction_version
266
276
  }
267
277
  }
268
- `,Tr=`
278
+ `,zr=`
269
279
  query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
270
280
  events(
271
281
  where: $where_condition
@@ -284,7 +294,7 @@
284
294
  indexed_type
285
295
  }
286
296
  }
287
- `,br=`
297
+ `,kr=`
288
298
  query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
289
299
  fungible_asset_activities(
290
300
  where: $where_condition
@@ -309,7 +319,7 @@
309
319
  type
310
320
  }
311
321
  }
312
- `,wr=`
322
+ `,Gr=`
313
323
  query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
314
324
  fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
315
325
  icon_uri
@@ -326,14 +336,25 @@
326
336
  token_standard
327
337
  }
328
338
  }
329
- `,cn=`
339
+ `,Ne=`
340
+ query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
341
+ current_aptos_names(
342
+ limit: $limit
343
+ where: $where_condition
344
+ order_by: $order_by
345
+ offset: $offset
346
+ ) {
347
+ ...AnsTokenFragment
348
+ }
349
+ }
350
+ ${Si}`,An=`
330
351
  query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp!, $order_by: [num_active_delegator_per_pool_order_by!]) {
331
352
  num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
332
353
  num_active_delegator
333
354
  pool_address
334
355
  }
335
356
  }
336
- `,_r=`
357
+ `,Br=`
337
358
  query getProcessorStatus {
338
359
  processor_status {
339
360
  last_success_version
@@ -341,7 +362,7 @@
341
362
  last_updated
342
363
  }
343
364
  }
344
- `,xr=`
365
+ `,Mr=`
345
366
  query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
346
367
  token_activities_v2(
347
368
  where: $where_condition
@@ -352,7 +373,7 @@
352
373
  ...TokenActivitiesFields
353
374
  }
354
375
  }
355
- ${Jo}`,un=`
376
+ ${xi}`,hn=`
356
377
  query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
357
378
  current_token_ownerships_v2(
358
379
  where: $where_condition
@@ -363,7 +384,7 @@
363
384
  ...CurrentTokenOwnershipFields
364
385
  }
365
386
  }
366
- ${Rt}`,Sr=`
387
+ ${Ft}`,Nr=`
367
388
  query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
368
389
  current_token_datas_v2(
369
390
  where: $where_condition
@@ -402,5 +423,5 @@
402
423
  }
403
424
  }
404
425
  }
405
- `;async function kt(n){let{aptosConfig:t}=n,{data:e}=await k({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function vr(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await k({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _16 => _16.withTransactions])}});return o}async function Ur(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await k({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _17 => _17.withTransactions])}});return o}async function Bt(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await Ie({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _18 => _18.ledgerVersion])},body:r})).data}async function Gt(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await Ie({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _19 => _19.ledgerVersion])},body:{function:e.function,type_arguments:_nullishCoalesce(e.typeArguments, () => ([])),arguments:_nullishCoalesce(e.functionArguments, () => ([]))}});return o}async function Cr(n){let{aptosConfig:t,limit:e}=n;return(await m({aptosConfig:t,query:{query:mr,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function m(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await Yn({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function ei(n){let{aptosConfig:t}=n;return(await m({aptosConfig:t,query:{query:_r},originMethod:"getProcessorStatuses"})).processor_status}async function Mt(n){return(await ei({aptosConfig:n.aptosConfig}))[0].last_success_version}var dn=new Map;function Re(n,t,e){return async(...r)=>{if(dn.has(t)){let{value:i,timestamp:s}=dn.get(t);if(e===void 0||Date.now()-s<=e)return i}let o=await n(...r);return dn.set(t,{value:o,timestamp:Date.now()}),o}}async function Se(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await k({aptosConfig:t,originMethod:"getInfo",path:`accounts/${c.from(e).toString()}`});return r}async function Er(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ce({aptosConfig:t,originMethod:"getModules",path:`accounts/${c.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _20 => _20.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _21 => _21.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _22 => _22.limit]), () => (1e3))}})}async function Ot(n){return _optionalChain([n, 'access', _23 => _23.options, 'optionalAccess', _24 => _24.ledgerVersion])!==void 0?Ir(n):Re(async()=>Ir(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function Ir(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:i}=await k({aptosConfig:t,originMethod:"getModule",path:`accounts/${c.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _25 => _25.ledgerVersion])}});return i}async function zr(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ce({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${c.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _26 => _26.offset]),limit:_optionalChain([r, 'optionalAccess', _27 => _27.limit])}})}async function Rr(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return Ce({aptosConfig:t,originMethod:"getResources",path:`accounts/${c.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _28 => _28.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _29 => _29.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _30 => _30.limit]), () => (999))}})}async function pn(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:i}=await k({aptosConfig:t,originMethod:"getResource",path:`accounts/${c.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _31 => _31.ledgerVersion])}});return i.data}async function ln(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await pn({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:i}}=o,s=c.from(e);try{let a=await Bt({aptosConfig:t,handle:i,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return c.from(a)}catch(a){if(a instanceof J&&a.data.error_code==="table_item_not_found")return s;throw a}}async function kr(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}},s=await m({aptosConfig:t,query:{query:gr,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!s.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return s.current_token_ownerships_v2_aggregate.aggregate.count}async function Br(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _32 => _32.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _33 => _33.tokenStandard])});let s={query:pr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _34 => _34.pagination, 'optionalAccess', _35 => _35.offset]),limit:_optionalChain([r, 'optionalAccess', _36 => _36.pagination, 'optionalAccess', _37 => _37.limit]),order_by:_optionalChain([r, 'optionalAccess', _38 => _38.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Gr(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,i=c.from(e).toStringLong(),s=c.from(r).toStringLong(),a={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _39 => _39.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _40 => _40.tokenStandard])});let u={query:lr,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _41 => _41.pagination, 'optionalAccess', _42 => _42.offset]),limit:_optionalChain([o, 'optionalAccess', _43 => _43.pagination, 'optionalAccess', _44 => _44.limit]),order_by:_optionalChain([o, 'optionalAccess', _45 => _45.orderBy])}};return(await m({aptosConfig:t,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Mr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _46 => _46.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _47 => _47.tokenStandard])}});let s={query:ur,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _48 => _48.pagination, 'optionalAccess', _49 => _49.offset]),limit:_optionalChain([r, 'optionalAccess', _50 => _50.pagination, 'optionalAccess', _51 => _51.limit]),order_by:_optionalChain([r, 'optionalAccess', _52 => _52.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Or(n){let{aptosConfig:t,accountAddress:e}=n,r=c.from(e).toStringLong(),i=await m({aptosConfig:t,query:{query:yr,variables:{address:r}},originMethod:"getAccountTransactionsCount"});if(!i.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return i.account_transactions_aggregate.aggregate.count}async function Dr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()}},s={query:cr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _53 => _53.pagination, 'optionalAccess', _54 => _54.offset]),limit:_optionalChain([r, 'optionalAccess', _55 => _55.pagination, 'optionalAccess', _56 => _56.limit]),order_by:_optionalChain([r, 'optionalAccess', _57 => _57.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Fr(n){let{aptosConfig:t,accountAddress:e}=n,r=c.from(e).toStringLong(),i=await m({aptosConfig:t,query:{query:ar,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function Nr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()}},s={query:dr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _58 => _58.pagination, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.pagination, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([r, 'optionalAccess', _62 => _62.orderBy])}};return(await m({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function qr(n){let{aptosConfig:t,privateKey:e}=n,r=new C(e.publicKey());if(e instanceof de){let i=X.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return le.fromPrivateKeyAndAddress({privateKey:e,address:i})}if(e instanceof ue){let o=X.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Pr({authKey:o,aptosConfig:t})){let u=o.derivedAddress();return le.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let s=X.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await Pr({authKey:s,aptosConfig:t})){let u=s.derivedAddress();return le.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Pr(n){let{aptosConfig:t,authKey:e}=n,r=await ln({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await Se({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}var Je=class{constructor(t){this.config=t}async getAccountInfo(t){return Se({aptosConfig:this.config,...t})}async getAccountModules(t){return Er({aptosConfig:this.config,...t})}async getAccountModule(t){return Ot({aptosConfig:this.config,...t})}async getAccountTransactions(t){return zr({aptosConfig:this.config,...t})}async getAccountResources(t){return Rr({aptosConfig:this.config,...t})}async getAccountResource(t){return pn({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return ln({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return kr({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return Br({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return Gr({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return Mr({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return Or({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return Dr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return Fr({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return Nr({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return qr({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Dt=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _63 => _63.network]), () => (Qn)),this.fullnode=_optionalChain([t, 'optionalAccess', _64 => _64.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _65 => _65.faucet]),this.indexer=_optionalChain([t, 'optionalAccess', _66 => _66.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _67 => _67.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _68 => _68.clientConfig]), () => ({}))}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Hn[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return Ln[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return tn[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return tn[this.network]===t}};var Ft=class extends p{constructor(e){super();this.accountAddress=c.ONE;this.moduleName=new v("account");this.structName=new v("RotationProofChallenge");this.sequenceNumber=new S(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=A.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 n extends V{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof U)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof pe)e.serializeU32AsUleb128(1),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(U.load(e));case 1:return new n(pe.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function gn(n){return new Promise(t=>{setTimeout(t,n)})}async function Kr(n){let{aptosConfig:t,options:e}=n;return Ce({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([e, 'optionalAccess', _70 => _70.limit])}})}async function Nt(n){let{aptosConfig:t}=n;return Re(async()=>{let{data:e}=await k({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function $r(n){let{aptosConfig:t,ledgerVersion:e}=n,{data:r}=await k({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function qt(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await k({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function Hr(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await qt({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _71 => _71.status])===404)return!0;throw r}}async function Kt(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _72 => _72.timeoutSecs]), () => (xt)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.checkSuccess]), () => (!0)),s=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _74 => _74.indexerVersionCheck]), () => (!0)),a=!0,u=0,d,y,P=200,h=1.5;for(;a&&!(u>=o);){try{if(d=await qt({aptosConfig:t,transactionHash:e}),a=d.type==="pending_transaction",!a)break}catch(l){if(!(l instanceof J)||(y=l,l.status!==404&&l.status>=400&&l.status<500))throw l}await gn(P),u+=P/1e3,P*=h}if(d===void 0)throw y||new et(`Fetching transaction ${e} failed and timed out after ${o} seconds`,d);if(d.type==="pending_transaction")throw new et(`Transaction ${e} timed out in pending state after ${o} seconds`,d);if(!i)return d;if(!d.success)throw new yn(`Transaction ${e} failed with an error: ${d.vm_status}`,d);if(s)try{await ni({aptosConfig:t,ledgerVersion:Number(d.version)})}catch (e2){throw new et(`Transaction ${e} committed, but timed out waiting for indexer to sync with ledger version ${d.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,d)}return d}async function ni(n){let{aptosConfig:t,ledgerVersion:e}=n,r=3e3,o=new Date().getTime(),i=-1;for(;i<e;){if(new Date().getTime()-o>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(i=await Mt({aptosConfig:t}),i>=e)break;await gn(200)}}var et=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},yn=class extends Error{constructor(e,r){super(e);this.transaction=r}};var B=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ge.load(t);case 1:return mn.load(t);case 2:return oe.load(t);case 3:return tt.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},ge= exports.AccountAuthenticatorEd25519 =class n extends B{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=T.deserialize(e),o=U.deserialize(e);return new n(r,o)}},mn= exports.AccountAuthenticatorMultiEd25519 =class n extends B{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=W.deserialize(e),o=Ee.deserialize(e);return new n(r,o)}},oe= exports.AccountAuthenticatorSingleKey =class n extends B{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=C.deserialize(e),o=re.deserialize(e);return new n(r,o)}},tt= exports.AccountAuthenticatorMultiKey =class n extends B{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=ze.deserialize(e),o=e.deserializeVector(re),i=e.deserializeBytes();return new n(r,o,i)}};var ie=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ke.load(t);case 1:return fn.load(t);case 2:return Be.load(t);case 3:return Ge.load(t);case 4:return Me.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},ke= exports.TransactionAuthenticatorEd25519 =class n extends ie{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=T.deserialize(e),o=U.deserialize(e);return new n(r,o)}},fn= exports.TransactionAuthenticatorMultiEd25519 =class n extends ie{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=W.deserialize(e),o=Ee.deserialize(e);return new n(r,o)}},Be= exports.TransactionAuthenticatorMultiAgent =class n extends ie{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}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=B.deserialize(e),o=e.deserializeVector(c),i=e.deserializeVector(B);return new n(r,o,i)}},Ge= exports.TransactionAuthenticatorFeePayer =class n extends ie{constructor(e,r,o,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=B.deserialize(e),o=e.deserializeVector(c),i=e.deserializeVector(B),s=c.deserialize(e),a=B.deserialize(e),u={address:s,authenticator:a};return new n(r,o,i,u)}},Me= exports.TransactionAuthenticatorSingleSender =class n extends ie{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=B.deserialize(e);return new n(r)}};var Oe=class n extends p{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var _=class n extends p{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var nt=class n extends p{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(c.fromStringRelaxed(r[0]),new _(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=c.deserialize(e),o=_.deserialize(e);return new n(r,o)}};var I=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return De.load(t);case 1:return Fe.load(t);case 2:return Ke.load(t);case 3:return $e.load(t);case 4:return Le.load(t);case 5:return ve.load(t);case 6:return Ve.load(t);case 7:return ye.load(t);case 8:return Ne.load(t);case 9:return qe.load(t);case 10:return He.load(t);case 255:return Qe.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof De}isAddress(){return this instanceof Le}isGeneric(){return this instanceof Qe}isSigner(){return this instanceof ve}isVector(){return this instanceof Ve}isStruct(){return this instanceof ye}isU8(){return this instanceof Fe}isU16(){return this instanceof Ne}isU32(){return this instanceof qe}isU64(){return this instanceof Ke}isU128(){return this instanceof $e}isU256(){return this instanceof He}},De= exports.TypeTagBool =class n extends I{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Fe= exports.TypeTagU8 =class n extends I{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Ne= exports.TypeTagU16 =class n extends I{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},qe= exports.TypeTagU32 =class n extends I{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},Ke= exports.TypeTagU64 =class n extends I{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},$e= exports.TypeTagU128 =class n extends I{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},He= exports.TypeTagU256 =class n extends I{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},Le= exports.TypeTagAddress =class n extends I{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},ve= exports.TypeTagSigner =class n extends I{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},$t= exports.TypeTagReference =class n extends I{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=I.deserialize(e);return new n(r)}},Qe= exports.TypeTagGeneric =class n extends I{constructor(e){super();this.value=e}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)}},Ve= exports.TypeTagVector =class n extends I{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=I.deserialize(e);return new n(r)}},ye= exports.TypeTagStruct =class n extends I{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=se.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(c.ONE,"string","String")}isOption(){return this.isTypeTag(c.ONE,"option","Option")}isObject(){return this.isTypeTag(c.ONE,"object","Object")}},se= exports.StructTag =class n extends p{constructor(e,r,o,i){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=c.deserialize(e),o=_.deserialize(e),i=_.deserialize(e),s=e.deserializeVector(I);return new n(r,o,i,s)}};function ju(){return new se(c.ONE,new _("aptos_coin"),new _("AptosCoin"),[])}function Xu(){return new se(c.ONE,new _("string"),new _("String"),[])}function Yu(n){return new se(c.ONE,new _("option"),new _("Option"),[n])}function Zu(n){return new se(c.ONE,new _("object"),new _("Object"),[n])}function ri(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return E.deserialize(n);case 1:return S.deserialize(n);case 2:return q.deserialize(n);case 3:return c.deserialize(n);case 4:return A.deserialize(n,E);case 5:return x.deserialize(n);case 6:return F.deserialize(n);case 7:return N.deserialize(n);case 8:return K.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Ue=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return rt.load(t);case 2:return ot.load(t);case 3:return it.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},rt= exports.TransactionPayloadScript =class n extends Ue{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=st.deserialize(e);return new n(r)}},ot= exports.TransactionPayloadEntryFunction =class n extends Ue{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=We.deserialize(e);return new n(r)}},it= exports.TransactionPayloadMultisig =class n extends Ue{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=at.deserialize(e);return new n(r)}},We= exports.EntryFunction =class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(nt.fromStr(t),new _(e),r,o)}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=nt.deserialize(t),r=_.deserialize(t),o=t.deserializeVector(I),i=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let u=t.deserializeUleb128AsU32(),d=It.deserialize(t,u);s.push(d)}return new n(e,r,o,s)}},st= 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(I),o=t.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=ri(t);i.push(a)}return new n(e,r,i)}},at= 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=c.deserialize(t),r=t.deserializeBool(),o;return r&&(o=ct.deserialize(t)),new n(e,o)}},ct= exports.MultisigTransactionPayload =class n{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new n(We.deserialize(t))}};var Y=class n extends p{constructor(e,r,o,i,s,a,u){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=u}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=c.deserialize(e),o=e.deserializeU64(),i=Ue.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),u=e.deserializeU64(),d=Oe.deserialize(e);return new n(r,o,i,s,a,u,d)}},Ht= exports.RawTransactionWithData =class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return me.load(t);case 1:return fe.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},me= exports.MultiAgentRawTransaction =class n extends Ht{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=Y.deserialize(e),o=e.deserializeVector(c);return new n(r,o)}},fe= exports.FeePayerRawTransaction =class n extends Ht{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}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=Y.deserialize(e),o=e.deserializeVector(c),i=c.deserialize(e);return new n(r,o,i)}};var Z=class n extends p{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=Y.deserialize(e),o=ie.deserialize(e);return new n(r,o)}};function Lr(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function Qr(n){return!!n.match(/\s/)}function oi(n){return!!n.match(/^T[0-9]+$/)}function ii(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!Qr(r))break}return e}var si=(h=>(h.InvalidTypeTag="unknown type",h.UnexpectedGenericType="unexpected generic type",h.UnexpectedTypeArgumentClose="unexpected '>'",h.UnexpectedWhitespaceCharacter="unexpected whitespace character",h.UnexpectedComma="unexpected ','",h.TypeArgumentCountMismatch="type argument count doesn't match expected amount",h.MissingTypeArgumentClose="no matching '>' for '<'",h.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",h.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",h.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",h.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",h.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",h))(si||{}),b= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function ut(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _75 => _75.allowGenerics]), () => (!1)),r=[],o=[],i=[],s=0,a="",u=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:u,savedStr:a,savedTypes:i}),a="",i=[],u=1;else if(d===">"){if(a!==""){let Rn=Lt(a,o,e);i.push(Rn)}let y=r.pop();if(y===void 0)throw new b(n,"unexpected '>'");if(u!==i.length)throw new b(n,"type argument count doesn't match expected amount");let{savedStr:P,savedTypes:h,savedExpectedTypes:l}=y;o=i,i=h,a=P,u=l}else if(d===","){if(a.length!==0){let y=Lt(a,o,e);o=[],i.push(y),a="",u+=1}}else if(Qr(d)){let y=!1;if(a.length!==0){let h=Lt(a,o,e);o=[],i.push(h),a="",y=!0}s=ii(n,s);let P=n[s];if(s<n.length&&y&&P!==","&&P!==">")throw new b(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new b(n,"no matching '>' for '<'");switch(i.length){case 0:return Lt(a,o,e);case 1:if(a==="")return i[0];throw new b(n,"unexpected ','");default:throw new b(n,"unexpected whitespace character")}}function Lt(n,t,e){switch(n){case"&signer":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new $t(new ve);case"signer":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new ve;case"bool":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new De;case"address":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Le;case"u8":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Fe;case"u16":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Ne;case"u32":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new qe;case"u64":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Ke;case"u128":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new $e;case"u256":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new He;case"vector":if(t.length!==1)throw new b(n,"vector type expected to have exactly one type argument");return new Ve(t[0]);default:if(oi(n)){if(e)return new Qe(Number(n.split("T")[1]));throw new b(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new b(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new b(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!Lr(r[1]))throw new b(n,"module name must only contain alphanumeric or '_' characters");if(!Lr(r[2]))throw new b(n,"struct name must only contain alphanumeric or '_' characters");return new ye(new se(c.fromStringRelaxed(r[0]),new _(r[1]),new _(r[2]),t))}}function Vr(n){return typeof n=="boolean"}function je(n){return typeof n=="string"}function Qt(n){return typeof n=="number"}function Vt(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function Wr(n){return n==null}function An(n){return n instanceof x}function Wt(n){return n instanceof c}function hn(n){return n instanceof v}function jr(n){return n instanceof Te}function Tn(n){return n instanceof E}function bn(n){return n instanceof F}function wn(n){return n instanceof N}function _n(n){return n instanceof S}function xn(n){return n instanceof q}function Sn(n){return n instanceof K}function vn(n){return"bytecode"in n}function w(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function Xr(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],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}function Yr(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _76 => _76.map, 'call', _77 => _77(t=>je(t)?ut(t):t)]), () => ([]))}async function Zr(n,t,e,r){let i=await _asyncOptionalChain([(await Ot({aptosConfig:r,accountAddress:n,moduleName:t})), 'access', async _78 => _78.abi, 'optionalAccess', async _79 => _79.exposed_functions, 'access', async _80 => _80.find, 'call', async _81 => _81(u=>u.name===e)]);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 s=Xr(i),a=[];for(let u=s;u<i.params.length;u+=1)a.push(ut(i.params[u],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:a}}function Jr(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);return An(e)||Tn(e)||bn(e)||wn(e)||_n(e)||xn(e)||Sn(e)||Wt(e)||hn(e)||jr(e)||e instanceof A||e instanceof Q?(ai(t,e,r),e):jt(e,t.parameters[r],r,o)}function jt(n,t,e,r){if(t.isBool()){if(Vr(n))return new x(n);w("boolean",e)}if(t.isAddress()){if(je(n))return c.fromStringRelaxed(n);w("string",e)}if(t.isU8()){if(Qt(n))return new E(n);w("number",e)}if(t.isU16()){if(Qt(n))return new F(n);w("number",e)}if(t.isU32()){if(Qt(n))return new N(n);w("number",e)}if(t.isU64()){if(Vt(n))return new S(BigInt(n));w("bigint | number | string",e)}if(t.isU128()){if(Vt(n))return new q(BigInt(n));w("bigint | number | string",e)}if(t.isU256()){if(Vt(n))return new K(BigInt(n));w("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);jt(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()&&je(n))return A.U8(g.fromHexInput(n).toUint8Array());if(Array.isArray(n))return new A(n.map(o=>jt(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(je(n))return new v(n);w("string",e)}if(t.isObject()){if(je(n))return c.fromStringRelaxed(n);w("string",e)}if(t.isOption())return Wr(n)?new Q(null):new Q(jt(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 ai(n,t,e){let r=n.parameters[e];if(r.isBool()){if(An(t))return;w("Bool",e)}if(r.isAddress()){if(Wt(t))return;w("AccountAddress",e)}if(r.isU8()){if(Tn(t))return;w("U8",e)}if(r.isU16()){if(bn(t))return;w("U16",e)}if(r.isU32()){if(wn(t))return;w("U32",e)}if(r.isU64()){if(_n(t))return;w("U64",e)}if(r.isU128()){if(xn(t))return;w("U128",e)}if(r.isU256()){if(Sn(t))return;w("U256",e)}if(r.isVector()){if(t instanceof A)return;w("MoveVector",e)}if(r instanceof ye){if(r.isString()){if(hn(t))return;w("MoveString",e)}if(r.isObject()){if(Wt(t))return;w("AccountAddress",e)}if(r.isOption()){if(t instanceof Q)return;w("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${r.toString()}'`)}async function Yt(n){if(vn(n))return eo(n);let{moduleAddress:t,moduleName:e,functionName:r}=Un(n.function),o=await Re(async()=>Zr(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return ui(n,o)}function ui(n,t){if(vn(n))return eo(n);let{moduleAddress:e,moduleName:r,functionName:o}=Un(n.function),i=Yr(n.typeArguments);if(i.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${i.length}`);let s=n.functionArguments.map((u,d)=>Jr(n.function,t,u,d,i));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${s.length}`);let a=We.build(`${e}::${r}`,o,i,s);if("multisigAddress"in n){let u;return typeof n.multisigAddress=="string"?u=c.from(n.multisigAddress):u=n.multisigAddress,new it(new at(u,new ct(a)))}return new ot(a)}function eo(n){return new rt(new st(g.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function di(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _82 => _82.accountSequenceNumber])?Promise.resolve({sequence_number:o.accountSequenceNumber}):Se({aptosConfig:t,accountAddress:e}),s=nn[t.network]?Promise.resolve({chain_id:nn[t.network]}):kt({aptosConfig:t}),a=_optionalChain([o, 'optionalAccess', _83 => _83.gasUnitPrice])?Promise.resolve({gas_estimate:o.gasUnitPrice}):Nt({aptosConfig:t}),[{sequence_number:u},{chain_id:d},{gas_estimate:y}]=await Promise.all([i,s,a]),{maxGasAmount:P,gasUnitPrice:h,expireTimestamp:l}={maxGasAmount:_optionalChain([o, 'optionalAccess', _84 => _84.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(Vn),gasUnitPrice:BigInt(y),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Wn),...o};return new Y(c.fromRelaxed(e),BigInt(u),r,BigInt(P),BigInt(h),BigInt(l),new Oe(d))}async function Zt(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=await di({aptosConfig:t,sender:e,payload:r,options:o});if("feePayerAddress"in n){let s=_nullishCoalesce(_optionalChain([n, 'access', _85 => _85.secondarySignerAddresses, 'optionalAccess', _86 => _86.map, 'call', _87 => _87(a=>c.fromRelaxed(a))]), () => ([]));return{rawTransaction:i,secondarySignerAddresses:s,feePayerAddress:_optionalChain([n, 'optionalAccess', _88 => _88.feePayerAddress])!==void 0?c.fromRelaxed(n.feePayerAddress):void 0}}if("secondarySignerAddresses"in n){let s=_nullishCoalesce(_optionalChain([n, 'access', _89 => _89.secondarySignerAddresses, 'optionalAccess', _90 => _90.map, 'call', _91 => _91(a=>c.fromRelaxed(a))]), () => ([]));return{rawTransaction:i,secondarySignerAddresses:s}}return{rawTransaction:i}}function to(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=new Ct(e.rawTransaction.bcsToBytes()),s=Y.deserialize(i),a=Xt(t);if("feePayerAddress"in e){let d=new fe(s,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),y=[];r&&(y=r.map(l=>Xt(l)));let P=Xt(o),h=new Ge(a,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),y,{address:e.feePayerAddress,authenticator:P});return new Z(d.raw_txn,h).bcsToBytes()}if("secondarySignerAddresses"in e){let d=new me(s,e.secondarySignerAddresses),y=[];y=r.map(h=>Xt(h));let P=new Be(a,e.secondarySignerAddresses,y);return new Z(d.raw_txn,P).bcsToBytes()}let u;if(a instanceof ge)u=new ke(a.public_key,a.signature);else if(a instanceof oe)u=new Me(a);else throw new Error("Invalid public key");return new Z(s,u).bcsToBytes()}function Xt(n){if(n instanceof C){if(n.publicKey instanceof T)return new oe(n,new re(new U(new Uint8Array(64))));if(n.publicKey instanceof j)return new oe(n,new re(new pe(new Uint8Array(64))))}return new ge(new T(n.toUint8Array()),new U(new Uint8Array(64)))}function no(n){let{signer:t,transaction:e}=n,r=oo(e),o=li(r),i=t.sign(o);switch(t.signingScheme){case 0:return new ge(new T(t.publicKey.toUint8Array()),new U(i.toUint8Array()));case 2:return new oe(t.publicKey,new re(i));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function ro(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,i=oo(t);if(r||o)return pi(i,e,r,o);if(e instanceof ge){let s=new ke(e.public_key,e.signature);return new Z(i,s).bcsToBytes()}if(e instanceof oe||e instanceof tt){let s=new Me(e);return new Z(i,s).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function oo(n){return"feePayerAddress"in n?new fe(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):"secondarySignerAddresses"in n?new me(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function pi(n,t,e,r){if(n instanceof fe){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new Ge(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:e});return new Z(n.raw_txn,o).bcsToBytes()}if(n instanceof me){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Be(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new Z(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function li(n){let t=_sha3.sha3_256.create();if(n instanceof Y)t.update(Xn);else if(n instanceof me)t.update(rn);else if(n instanceof fe)t.update(rn);else throw new Error(`Unknown transaction type to sign on: ${n}`);let e=t.digest(),r=n.bcsToBytes(),o=new Uint8Array(e.length+r.length);return o.set(e),o.set(r,e.length),o}async function $(n){let{aptosConfig:t,sender:e,data:r,options:o}=n,i;if("bytecode"in r?i=r:"multisigAddress"in r?i={aptosConfig:t,multisigAddress:r.multisigAddress,function:r.function,functionArguments:r.functionArguments,typeArguments:r.typeArguments}:i={aptosConfig:t,function:r.function,functionArguments:r.functionArguments,typeArguments:r.typeArguments},gi(n)){let{secondarySignerAddresses:a}=n,u=n.hasFeePayer?c.ZERO:void 0,d=await Yt(i);return Zt({aptosConfig:t,sender:e,payload:d,options:o,secondarySignerAddresses:a,feePayerAddress:u})}if(yi(n)){let{secondarySignerAddresses:a}=n,u=await Yt(i);return Zt({aptosConfig:t,sender:e,payload:u,options:o,secondarySignerAddresses:a})}let s=await Yt(i);return Zt({aptosConfig:t,sender:e,payload:s,options:o})}function gi(n){return"hasFeePayer"in n}function yi(n){return"secondarySignerAddresses"in n}function Cn(n){return no({...n})}async function io(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=to({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:u}=await Ie({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _92 => _92.options, 'optionalAccess', _93 => _93.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _94 => _94.options, 'optionalAccess', _95 => _95.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _96 => _96.options, 'optionalAccess', _97 => _97.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return u}async function In(n){let{aptosConfig:t}=n,e=ro({...n}),{data:r}=await Ie({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function Pn(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=Cn({signer:e,transaction:r});return In({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function so(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(u=>A.U8(u));return await $({aptosConfig:t,sender:c.fromRelaxed(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[A.U8(r),new A(s)]},options:i})}async function ao(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await Se({aptosConfig:t,accountAddress:e.accountAddress.toString()}),i=le.fromPrivateKey({privateKey:r,legacy:!0}),a=new Ft({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:c.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),u=e.sign(a),d=i.sign(a),y=await $({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new E(e.signingScheme.valueOf()),A.U8(e.publicKey.toUint8Array()),new E(i.signingScheme.valueOf()),A.U8(i.publicKey.toUint8Array()),A.U8(u.toUint8Array()),A.U8(d.toUint8Array())]}});return await Pn({aptosConfig:t,signer:e,transaction:y})}async function co(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:i,options:s}=n,a=_nullishCoalesce(i, () => (jn));return await $({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[ut(a)],functionArguments:[c.from(r),new S(o)]},options:s})}var dt=class{constructor(t){this.config=t}async transferCoinTransaction(t){return co({aptosConfig:this.config,...t})}};async function uo(n){let{aptosConfig:t,options:e,creator:r}=n;return await $({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new v(n.collection),new v(n.description),new v(n.name),new v(n.uri),A.MoveString([]),A.MoveString([]),new A([])]},options:e})}async function po(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:c.from(e).toStringLong()}};return(await m({aptosConfig:t,query:{query:Sr,variables:{where_condition:r}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function lo(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:c.from(e).toStringLong()}};return(await m({aptosConfig:t,query:{query:un,variables:{where_condition:r}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function go(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:c.from(e).toStringLong()}},i={query:un,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _98 => _98.pagination, 'optionalAccess', _99 => _99.offset]),limit:_optionalChain([r, 'optionalAccess', _100 => _100.pagination, 'optionalAccess', _101 => _101.limit]),order_by:_optionalChain([r, 'optionalAccess', _102 => _102.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function yo(n){let{aptosConfig:t,tokenAddress:e,options:r}=n,o={token_data_id:{_eq:c.from(e).toStringLong()}},i={query:xr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _103 => _103.pagination, 'optionalAccess', _104 => _104.offset]),limit:_optionalChain([r, 'optionalAccess', _105 => _105.pagination, 'optionalAccess', _106 => _106.limit]),order_by:_optionalChain([r, 'optionalAccess', _107 => _107.orderBy])}};return(await m({aptosConfig:t,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function mo(n){let{aptosConfig:t,options:e,creator:r}=n;return await $({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new v(n.description),new S(_nullishCoalesce(n.maxSupply, () => (Ae))),new v(n.name),new v(n.uri),new x(_nullishCoalesce(n.mutableDescription, () => (!0))),new x(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new x(_nullishCoalesce(n.mutableURI, () => (!0))),new x(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new x(_nullishCoalesce(n.mutableTokenName, () => (!0))),new x(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new x(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new x(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new x(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new S(_nullishCoalesce(n.royaltyNumerator, () => (0))),new S(_nullishCoalesce(n.royaltyDenominator, () => (1)))]},options:e})}async function En(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,i=c.from(e),s={collection_name:{_eq:r},creator_address:{_eq:i.toStringLong()}};return _optionalChain([o, 'optionalAccess', _108 => _108.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _109 => _109.tokenStandard]), () => ("v2"))}),(await m({aptosConfig:t,query:{query:fr,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function fo(n){return(await En(n)).collection_id}var pt=class{constructor(t){this.config=t}async createCollectionTransaction(t){return mo({aptosConfig:this.config,...t})}async getCollectionData(t){return En({aptosConfig:this.config,...t})}async getCollectionId(t){return fo({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return uo({aptosConfig:this.config,...t})}async getTokenData(t){return po({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return lo({aptosConfig:this.config,...t})}async getOwnedTokens(t){return go({aptosConfig:this.config,...t})}async getTokenActivity(t){return yo({aptosConfig:this.config,...t})}};async function Ao(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,i={account_address:{_eq:c.from(t).toStringLong()},creation_number:{_eq:r}};return Jt({aptosConfig:e,options:{where:i}})}async function ho(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,a={where:{account_address:{_eq:c.fromRelaxed(t).toStringLong()},indexed_type:{_eq:r}},pagination:_optionalChain([o, 'optionalAccess', _110 => _110.pagination]),orderBy:_optionalChain([o, 'optionalAccess', _111 => _111.orderBy])};return Jt({aptosConfig:e,options:a})}async function Jt(n){let{aptosConfig:t,options:e}=n,r={query:Tr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _112 => _112.where]),offset:_optionalChain([e, 'optionalAccess', _113 => _113.pagination, 'optionalAccess', _114 => _114.offset]),limit:_optionalChain([e, 'optionalAccess', _115 => _115.pagination, 'optionalAccess', _116 => _116.limit]),order_by:_optionalChain([e, 'optionalAccess', _117 => _117.orderBy])}};return(await m({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var lt=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return Ao({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return ho({aptosConfig:this.config,...t})}async getEvents(t){return Jt({aptosConfig:this.config,...t})}};async function To(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _118 => _118.timeoutSecs])||xt,{data:s}=await Zn({aptosConfig:t,path:"fund",body:{address:c.fromRelaxed(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0];return await Kt({aptosConfig:t,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _119 => _119.checkSuccess]),indexerVersionCheck:_optionalChain([o, 'optionalAccess', _120 => _120.indexerVersionCheck])}}),a}var gt=class{constructor(t){this.config=t}async fundAccount(t){return To({aptosConfig:this.config,...t})}};async function zn(n){let{aptosConfig:t,options:e}=n,r={query:wr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _121 => _121.where]),limit:_optionalChain([e, 'optionalAccess', _122 => _122.pagination, 'optionalAccess', _123 => _123.limit]),offset:_optionalChain([e, 'optionalAccess', _124 => _124.pagination, 'optionalAccess', _125 => _125.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function bo(n){let{aptosConfig:t,options:e}=n,r={query:br,variables:{where_condition:_optionalChain([e, 'optionalAccess', _126 => _126.where]),limit:_optionalChain([e, 'optionalAccess', _127 => _127.pagination, 'optionalAccess', _128 => _128.limit]),offset:_optionalChain([e, 'optionalAccess', _129 => _129.pagination, 'optionalAccess', _130 => _130.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function wo(n){let{aptosConfig:t,options:e}=n,r={query:Ar,variables:{where_condition:_optionalChain([e, 'optionalAccess', _131 => _131.where]),limit:_optionalChain([e, 'optionalAccess', _132 => _132.pagination, 'optionalAccess', _133 => _133.limit]),offset:_optionalChain([e, 'optionalAccess', _134 => _134.pagination, 'optionalAccess', _135 => _135.offset])}};return(await m({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var yt=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return zn({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return(await zn({aptosConfig:this.config,options:{where:{asset_type:{_eq:t}}}}))[0]}async getFungibleAssetActivities(t){return bo({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return wo({aptosConfig:this.config,...t})}};var mt=class{constructor(t){this.config=t}async getLedgerInfo(){return kt({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return vr({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Ur({aptosConfig:this.config,...t})}async getTableItem(t){return Bt({aptosConfig:this.config,...t})}async view(t){return Gt({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Cr({aptosConfig:this.config,...t})}async queryIndexer(t){return m({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return Mt({aptosConfig:this.config})}};var _o=["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 xo(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function So(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(!xo(t))throw new Error(`${t} is not valid. ${_o}`);if(e&&!xo(e))throw new Error(`${e} is not valid. ${_o}`);return{domainName:e||t,subdomainName:e?t:void 0}}var mi="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",fi={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:mi,custom:null,devnet:null};function vo(n){let t=fi[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var Ai=n=>({vec:[n]}),hi=()=>({vec:[]}),Ti=n=>n!=null?Ai(n):hi(),bi=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Uo(n){let{aptosConfig:t,name:e}=n,r=vo(t),{domainName:o,subdomainName:i}=So(e),s=await Gt({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,Ti(i)]}}),a=bi(s[0]);return a?c.fromRelaxed(a).toString():void 0}async function Co(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:i,toAddress:s,options:a}=n,u=vo(t),{domainName:d,subdomainName:y}=So(r),P=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(y&&!P)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(P&&!y)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){if(e.years!==1)throw new Error("For now, names can only be registered for 1 year at a time");let h=e.years*31536e3;return await $({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${u}::router::register_domain`,functionArguments:[new v(d),new S(h),new Q(i?c.from(i):null),new Q(s?c.from(s):null)]},options:a})}throw new Error(`Policy ${e.policy} is not supported yet`)}var ft=class{constructor(t){this.config=t}async getOwnerAddress(t){return Uo({aptosConfig:this.config,...t})}async registerName(t){return Co({aptosConfig:this.config,...t})}};async function Io(n){let{aptosConfig:t,poolAddress:e}=n,r=c.fromRelaxed(e).toStringLong(),i=await m({aptosConfig:t,query:{query:cn,variables:{where_condition:{pool_address:{_eq:r}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function Po(n){let{aptosConfig:t,options:e}=n,r={query:cn,variables:{where_condition:{},order_by:_optionalChain([e, 'optionalAccess', _136 => _136.orderBy])}};return(await m({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Eo(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:hr,variables:{delegatorAddress:c.fromRelaxed(e).toStringLong(),poolAddress:c.fromRelaxed(r).toStringLong()}};return(await m({aptosConfig:t,query:o})).delegated_staking_activities}var At=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return Io({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return Po({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return Eo({aptosConfig:this.config,...t})}};var ht=class{constructor(t){this.config=t}async getTransactions(t){return Kr({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return $r({aptosConfig:this.config,...t})}async getTransactionByHash(t){return qt({aptosConfig:this.config,...t})}async isPendingTransaction(t){return Hr({aptosConfig:this.config,...t})}async waitForTransaction(t){return Kt({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Nt({aptosConfig:this.config})}};var Tt=class{constructor(t){this.config=t}async generateTransaction(t){return $({aptosConfig:this.config,...t})}signTransaction(t){let{signer:e,transaction:r,asFeePayer:o}=t;if("feePayerAddress"in r&&o)r.feePayerAddress=e.accountAddress;else if(o)throw new Error("Transaction being signed is not a Fee payer transaction, but `asFeePayer` is set to true");return Cn({signer:e,transaction:r})}async simulateTransaction(t){return io({aptosConfig:this.config,...t})}async submitTransaction(t){return In({aptosConfig:this.config,...t})}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return Pn({aptosConfig:this.config,signer:e,transaction:r})}async publishPackageTransaction(t){return so({aptosConfig:this.config,...t})}async rotateAuthKey(t){return ao({aptosConfig:this.config,...t})}};var G=class{constructor(t){this.config=new Dt(t),this.account=new Je(this.config),this.ans=new ft(this.config),this.coin=new dt(this.config),this.digitalAsset=new pt(this.config),this.event=new lt(this.config),this.faucet=new gt(this.config),this.fungibleAsset=new yt(this.config),this.general=new mt(this.config),this.staking=new At(this.config),this.transaction=new ht(this.config),this.transactionSubmission=new Tt(this.config)}};function H(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...i){return this[e][r](...i)},Object.defineProperty(n.prototype,r,o))})}H(G,Je,"account");H(G,ft,"ans");H(G,dt,"coin");H(G,pt,"digitalAsset");H(G,lt,"event");H(G,gt,"faucet");H(G,yt,"fungibleAsset");H(G,mt,"general");H(G,At,"staking");H(G,ht,"transaction");H(G,Tt,"transactionSubmission");exports.APTOS_BIP44_REGEX = Wo; exports.APTOS_COIN = jn; exports.APTOS_HARDENED_REGEX = Vo; exports.Account = le; exports.AccountAddress = c; exports.AccountAuthenticator = B; exports.AccountAuthenticatorEd25519 = ge; exports.AccountAuthenticatorMultiEd25519 = mn; exports.AccountAuthenticatorMultiKey = tt; exports.AccountAuthenticatorSingleKey = oe; exports.AccountAuthenticatorVariant = Dn; exports.AddressInvalidReason = Ho; exports.AnyPublicKeyVariant = Fn; exports.AnySignatureVariant = Nn; exports.Aptos = G; exports.AptosApiError = J; exports.AptosApiType = _t; exports.AptosConfig = Dt; exports.AuthenticationKey = X; exports.Bool = x; exports.CKDPriv = or; exports.ChainId = Oe; exports.DEFAULT_MAX_GAS_AMOUNT = Vn; exports.DEFAULT_NETWORK = Qn; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = Wn; exports.DEFAULT_TXN_TIMEOUT_SEC = xt; exports.DeriveScheme = Mo; exports.Deserializer = Ct; exports.Ed25519PrivateKey = ue; exports.Ed25519PublicKey = T; exports.Ed25519Signature = U; exports.EntryFunction = We; exports.EntryFunctionBytes = It; exports.FeePayerRawTransaction = fe; exports.FixedBytes = Te; exports.HARDENED_OFFSET = tr; exports.Hex = g; exports.HexInvalidReason = qo; exports.Identifier = _; exports.KeyType = jo; exports.MimeType = en; exports.ModuleId = nt; exports.MoveAbility = Bo; exports.MoveFunctionVisibility = ko; exports.MoveOption = Q; exports.MoveString = v; exports.MoveVector = A; exports.MultiAgentRawTransaction = me; exports.MultiEd25519PublicKey = W; exports.MultiEd25519Signature = Ee; exports.MultiKey = ze; exports.MultiSig = at; exports.MultisigTransactionPayload = ct; exports.Network = wt; exports.NetworkToChainId = nn; exports.NetworkToFaucetAPI = Ln; exports.NetworkToIndexerAPI = tn; exports.NetworkToNetworkName = Oi; exports.NetworkToNodeAPI = Hn; exports.ParsingError = z; exports.PrivateKey = Pe; exports.PublicKey = M; exports.RAW_TRANSACTION_SALT = Xn; exports.RAW_TRANSACTION_WITH_DATA_SALT = rn; exports.RawTransaction = Y; exports.RawTransactionWithData = Ht; exports.RoleType = Go; exports.RotationProofChallenge = Ft; exports.Script = st; exports.ScriptTransactionArgumentVariants = Xe; exports.Secp256k1PrivateKey = de; exports.Secp256k1PublicKey = j; exports.Secp256k1Signature = pe; exports.Serializable = p; exports.Serializer = L; exports.Signature = V; exports.SignedTransaction = Z; exports.SigningScheme = Ye; exports.SigningSchemeInput = Kn; exports.StructTag = se; exports.TransactionAuthenticator = ie; exports.TransactionAuthenticatorEd25519 = ke; exports.TransactionAuthenticatorFeePayer = Ge; exports.TransactionAuthenticatorMultiAgent = Be; exports.TransactionAuthenticatorMultiEd25519 = fn; exports.TransactionAuthenticatorSingleSender = Me; exports.TransactionAuthenticatorVariant = On; exports.TransactionPayload = Ue; exports.TransactionPayloadEntryFunction = ot; exports.TransactionPayloadMultisig = it; exports.TransactionPayloadScript = rt; exports.TransactionPayloadVariants = Gn; exports.TransactionResponseType = qn; exports.TransactionVariants = Mn; exports.TypeTag = I; exports.TypeTagAddress = Le; exports.TypeTagBool = De; exports.TypeTagGeneric = Qe; exports.TypeTagParserError = b; exports.TypeTagParserErrorType = si; exports.TypeTagReference = $t; exports.TypeTagSigner = ve; exports.TypeTagStruct = ye; exports.TypeTagU128 = $e; exports.TypeTagU16 = Ne; exports.TypeTagU256 = He; exports.TypeTagU32 = qe; exports.TypeTagU64 = Ke; exports.TypeTagU8 = Fe; exports.TypeTagVariants = Bn; exports.TypeTagVector = Ve; exports.U128 = q; exports.U16 = F; exports.U256 = K; exports.U32 = N; exports.U64 = S; exports.U8 = E; exports.aptosCoinStructTag = ju; exports.aptosRequest = bt; exports.buildTransaction = Zt; exports.convertArgument = Jr; exports.deriveKey = an; exports.deriveTransactionType = oo; exports.deserializeFromScriptArgument = ri; exports.ensureBoolean = sn; exports.fetchEntryFunctionAbi = Zr; exports.findFirstNonSignerArg = Xr; exports.generateMultiSignersSignedTransaction = pi; exports.generateRawTransaction = di; exports.generateSignedTransaction = ro; exports.generateSignedTransactionForSimulation = to; exports.generateTransactionPayload = Yt; exports.generateTransactionPayloadWithABI = ui; exports.get = Do; exports.getAptosFullNode = k; exports.getAuthenticatorForSimulation = Xt; exports.getFunctionParts = Un; exports.getSigningMessage = li; exports.isBcsAddress = Wt; exports.isBcsBool = An; exports.isBcsFixedBytes = jr; exports.isBcsString = hn; exports.isBcsU128 = xn; exports.isBcsU16 = bn; exports.isBcsU256 = Sn; exports.isBcsU32 = wn; exports.isBcsU64 = _n; exports.isBcsU8 = Tn; exports.isBool = Vr; exports.isLargeNumber = Vt; exports.isNull = Wr; exports.isNumber = Qt; exports.isScriptDataInput = vn; exports.isString = je; exports.isValidBIP44Path = nr; exports.isValidHardenedPath = rr; exports.mnemonicToSeed = Pt; exports.objectStructTag = Zu; exports.optionStructTag = Yu; exports.outOfRangeErrorMessage = Ko; exports.paginateWithCursor = Ce; exports.parseTypeTag = ut; exports.post = on; exports.postAptosFaucet = Zn; exports.postAptosFullNode = Ie; exports.postAptosIndexer = Yn; exports.request = Oo; exports.sign = no; exports.splitPath = ir; exports.standardizeTypeTags = Yr; exports.stringStructTag = Xu; exports.throwTypeMismatch = w; exports.validateNumberInRange = ce;
426
+ `;async function qt(n){let{aptosConfig:t}=n,{data:e}=await N({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Or(n){let{aptosConfig:t,ledgerVersion:e,options:r}=n,{data:o}=await N({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _16 => _16.withTransactions])}});return o}async function Dr(n){let{aptosConfig:t,blockHeight:e,options:r}=n,{data:o}=await N({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:_optionalChain([r, 'optionalAccess', _17 => _17.withTransactions])}});return o}async function Kt(n){let{aptosConfig:t,handle:e,data:r,options:o}=n;return(await ke({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _18 => _18.ledgerVersion])},body:r})).data}async function ge(n){let{aptosConfig:t,payload:e,options:r}=n,{data:o}=await ke({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:_optionalChain([r, 'optionalAccess', _19 => _19.ledgerVersion])},body:{function:e.function,type_arguments:_nullishCoalesce(e.typeArguments, () => ([])),arguments:_nullishCoalesce(e.functionArguments, () => ([]))}});return o}async function Fr(n){let{aptosConfig:t,limit:e}=n;return(await y({aptosConfig:t,query:{query:Pr,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function y(n){let{aptosConfig:t,query:e,originMethod:r}=n,{data:o}=await ur({aptosConfig:t,originMethod:_nullishCoalesce(r, () => ("queryIndexer")),path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function vi(n){let{aptosConfig:t}=n;return(await y({aptosConfig:t,query:{query:Br},originMethod:"getProcessorStatuses"})).processor_status}async function $t(n){return(await vi({aptosConfig:n.aptosConfig}))[0].last_success_version}var bn=new Map;function Oe(n,t,e){return async(...r)=>{if(bn.has(t)){let{value:i,timestamp:s}=bn.get(t);if(e===void 0||Date.now()-s<=e)return i}let o=await n(...r);return bn.set(t,{value:o,timestamp:Date.now()}),o}}async function Ue(n){let{aptosConfig:t,accountAddress:e}=n,{data:r}=await N({aptosConfig:t,originMethod:"getInfo",path:`accounts/${c.from(e).toString()}`});return r}async function $r(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return ze({aptosConfig:t,originMethod:"getModules",path:`accounts/${c.from(e).toString()}/modules`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _20 => _20.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _21 => _21.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _22 => _22.limit]), () => (1e3))}})}async function Ht(n){return _optionalChain([n, 'access', _23 => _23.options, 'optionalAccess', _24 => _24.ledgerVersion])!==void 0?qr(n):Oe(async()=>qr(n),`module-${n.accountAddress}-${n.moduleName}`,1e3*60*5)()}async function qr(n){let{aptosConfig:t,accountAddress:e,moduleName:r,options:o}=n,{data:i}=await N({aptosConfig:t,originMethod:"getModule",path:`accounts/${c.from(e).toString()}/module/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _25 => _25.ledgerVersion])}});return i}async function Hr(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return ze({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${c.from(e).toString()}/transactions`,params:{start:_optionalChain([r, 'optionalAccess', _26 => _26.offset]),limit:_optionalChain([r, 'optionalAccess', _27 => _27.limit])}})}async function Lr(n){let{aptosConfig:t,accountAddress:e,options:r}=n;return ze({aptosConfig:t,originMethod:"getResources",path:`accounts/${c.from(e).toString()}/resources`,params:{ledger_version:_optionalChain([r, 'optionalAccess', _28 => _28.ledgerVersion]),start:_optionalChain([r, 'optionalAccess', _29 => _29.offset]),limit:_nullishCoalesce(_optionalChain([r, 'optionalAccess', _30 => _30.limit]), () => (999))}})}async function Tn(n){let{aptosConfig:t,accountAddress:e,resourceType:r,options:o}=n,{data:i}=await N({aptosConfig:t,originMethod:"getResource",path:`accounts/${c.from(e).toString()}/resource/${r}`,params:{ledger_version:_optionalChain([o, 'optionalAccess', _31 => _31.ledgerVersion])}});return i.data}async function wn(n){let{aptosConfig:t,authenticationKey:e,options:r}=n,o=await Tn({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:r}),{address_map:{handle:i}}=o,s=c.from(e);try{let a=await Kt({aptosConfig:t,handle:i,data:{key:s.toString(),key_type:"address",value_type:"address"},options:r});return c.from(a)}catch(a){if(a instanceof Z&&a.data.error_code==="table_item_not_found")return s;throw a}}async function Qr(n){let{aptosConfig:t,accountAddress:e}=n,o={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}},s=await y({aptosConfig:t,query:{query:Cr,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!s.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return s.current_token_ownerships_v2_aggregate.aggregate.count}async function Vr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _32 => _32.tokenStandard])&&(i.token_standard={_eq:_optionalChain([r, 'optionalAccess', _33 => _33.tokenStandard])});let s={query:Sr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _34 => _34.pagination, 'optionalAccess', _35 => _35.offset]),limit:_optionalChain([r, 'optionalAccess', _36 => _36.pagination, 'optionalAccess', _37 => _37.limit]),order_by:_optionalChain([r, 'optionalAccess', _38 => _38.orderBy])}};return(await y({aptosConfig:t,query:s,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Wr(n){let{aptosConfig:t,accountAddress:e,collectionAddress:r,options:o}=n,i=c.from(e).toStringLong(),s=c.from(r).toStringLong(),a={owner_address:{_eq:i},current_token_data:{collection_id:{_eq:s}},amount:{_gt:0}};_optionalChain([o, 'optionalAccess', _39 => _39.tokenStandard])&&(a.token_standard={_eq:_optionalChain([o, 'optionalAccess', _40 => _40.tokenStandard])});let u={query:vr,variables:{where_condition:a,offset:_optionalChain([o, 'optionalAccess', _41 => _41.pagination, 'optionalAccess', _42 => _42.offset]),limit:_optionalChain([o, 'optionalAccess', _43 => _43.pagination, 'optionalAccess', _44 => _44.limit]),order_by:_optionalChain([o, 'optionalAccess', _45 => _45.orderBy])}};return(await y({aptosConfig:t,query:u,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function jr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()},amount:{_gt:0}};_optionalChain([r, 'optionalAccess', _46 => _46.tokenStandard])&&(i.current_collection={token_standard:{_eq:_optionalChain([r, 'optionalAccess', _47 => _47.tokenStandard])}});let s={query:_r,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _48 => _48.pagination, 'optionalAccess', _49 => _49.offset]),limit:_optionalChain([r, 'optionalAccess', _50 => _50.pagination, 'optionalAccess', _51 => _51.limit]),order_by:_optionalChain([r, 'optionalAccess', _52 => _52.orderBy])}};return(await y({aptosConfig:t,query:s,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Xr(n){let{aptosConfig:t,accountAddress:e}=n,r=c.from(e).toStringLong(),i=await y({aptosConfig:t,query:{query:Ur,variables:{address:r}},originMethod:"getAccountTransactionsCount"});if(!i.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return i.account_transactions_aggregate.aggregate.count}async function Yr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()}},s={query:wr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _53 => _53.pagination, 'optionalAccess', _54 => _54.offset]),limit:_optionalChain([r, 'optionalAccess', _55 => _55.pagination, 'optionalAccess', _56 => _56.limit]),order_by:_optionalChain([r, 'optionalAccess', _57 => _57.orderBy])}};return(await y({aptosConfig:t,query:s,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Zr(n){let{aptosConfig:t,accountAddress:e}=n,r=c.from(e).toStringLong(),i=await y({aptosConfig:t,query:{query:Tr,variables:{address:r}},originMethod:"getAccountCoinsCount"});if(!i.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return i.current_fungible_asset_balances_aggregate.aggregate.count}async function Jr(n){let{aptosConfig:t,accountAddress:e,options:r}=n,i={owner_address:{_eq:c.from(e).toStringLong()}},s={query:xr,variables:{where_condition:i,offset:_optionalChain([r, 'optionalAccess', _58 => _58.pagination, 'optionalAccess', _59 => _59.offset]),limit:_optionalChain([r, 'optionalAccess', _60 => _60.pagination, 'optionalAccess', _61 => _61.limit]),order_by:_optionalChain([r, 'optionalAccess', _62 => _62.orderBy])}};return(await y({aptosConfig:t,query:s,originMethod:"getAccountOwnedObjects"})).current_objects}async function eo(n){let{aptosConfig:t,privateKey:e}=n,r=new v(e.publicKey());if(e instanceof de){let i=X.fromPublicKeyAndScheme({publicKey:r,scheme:2}).derivedAddress();return le.fromPrivateKeyAndAddress({privateKey:e,address:i})}if(e instanceof ue){let o=X.fromPublicKeyAndScheme({publicKey:r,scheme:2});if(await Kr({authKey:o,aptosConfig:t})){let u=o.derivedAddress();return le.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!1})}let s=X.fromPublicKeyAndScheme({publicKey:r,scheme:0});if(await Kr({authKey:s,aptosConfig:t})){let u=s.derivedAddress();return le.fromPrivateKeyAndAddress({privateKey:e,address:u,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Kr(n){let{aptosConfig:t,authKey:e}=n,r=await wn({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await Ue({aptosConfig:t,accountAddress:r}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${r.toString()}`)}}var st=class{constructor(t){this.config=t}async getAccountInfo(t){return Ue({aptosConfig:this.config,...t})}async getAccountModules(t){return $r({aptosConfig:this.config,...t})}async getAccountModule(t){return Ht({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Hr({aptosConfig:this.config,...t})}async getAccountResources(t){return Lr({aptosConfig:this.config,...t})}async getAccountResource(t){return Tn({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return wn({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return Qr({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return Vr({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return Wr({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return jr({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return Xr({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return Yr({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return Zr({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return Jr({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return eo({aptosConfig:this.config,...t})}};var _aptosclient = require('@aptos-labs/aptos-client'); var _aptosclient2 = _interopRequireDefault(_aptosclient);var Lt=class{constructor(t){this.network=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _63 => _63.network]), () => (or)),this.fullnode=_optionalChain([t, 'optionalAccess', _64 => _64.fullnode]),this.faucet=_optionalChain([t, 'optionalAccess', _65 => _65.faucet]),this.indexer=_optionalChain([t, 'optionalAccess', _66 => _66.indexer]),this.client=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _67 => _67.client]), () => ({provider:_aptosclient2.default})),this.clientConfig=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _68 => _68.clientConfig]), () => ({}))}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return nr[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return rr[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return pn[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return pn[this.network]===t}};var Qt=class extends p{constructor(e){super();this.accountAddress=c.ONE;this.moduleName=new P("account");this.structName=new P("RotationProofChallenge");this.sequenceNumber=new U(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=A.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 ne=class n extends V{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof S)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof pe)e.serializeU32AsUleb128(1),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(S.load(e));case 1:return new n(pe.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${r}`)}}};async function _n(n){return new Promise(t=>{setTimeout(t,n)})}async function to(n){let{aptosConfig:t,options:e}=n;return ze({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:_optionalChain([e, 'optionalAccess', _69 => _69.offset]),limit:_optionalChain([e, 'optionalAccess', _70 => _70.limit])}})}async function Vt(n){let{aptosConfig:t}=n;return Oe(async()=>{let{data:e}=await N({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 N({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return r}async function Wt(n){let{aptosConfig:t,transactionHash:e}=n,{data:r}=await N({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return r}async function ro(n){let{aptosConfig:t,transactionHash:e}=n;try{return(await Wt({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(r){if(_optionalChain([r, 'optionalAccess', _71 => _71.status])===404)return!0;throw r}}async function jt(n){let{aptosConfig:t,transactionHash:e,options:r}=n,o=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _72 => _72.timeoutSecs]), () => (zt)),i=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _73 => _73.checkSuccess]), () => (!0)),s=_nullishCoalesce(_optionalChain([r, 'optionalAccess', _74 => _74.indexerVersionCheck]), () => (!0)),a=!0,u=0,d,m,I=200,T=1.5;for(;a&&!(u>=o);){try{if(d=await Wt({aptosConfig:t,transactionHash:e}),a=d.type==="pending_transaction",!a)break}catch(l){if(!(l instanceof Z)||(m=l,l.status!==404&&l.status>=400&&l.status<500))throw l}await _n(I),u+=I/1e3,I*=T}if(d===void 0)throw m||new at(`Fetching transaction ${e} failed and timed out after ${o} seconds`,d);if(d.type==="pending_transaction")throw new at(`Transaction ${e} timed out in pending state after ${o} seconds`,d);if(!i)return d;if(!d.success)throw new xn(`Transaction ${e} failed with an error: ${d.vm_status}`,d);if(s)try{await Ui({aptosConfig:t,ledgerVersion:Number(d.version)})}catch (e2){throw new at(`Transaction ${e} committed, but timed out waiting for indexer to sync with ledger version ${d.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,d)}return d}async function Ui(n){let{aptosConfig:t,ledgerVersion:e}=n,r=3e3,o=new Date().getTime(),i=-1;for(;i<e;){if(new Date().getTime()-o>r)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(i=await $t({aptosConfig:t}),i>=e)break;await _n(200)}}var at=class extends Error{constructor(e,r){super(e);this.lastSubmittedTransaction=r}},xn=class extends Error{constructor(e,r){super(e);this.transaction=r}};var O=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return ye.load(t);case 1:return Sn.load(t);case 2:return re.load(t);case 3:return ct.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},ye= exports.AccountAuthenticatorEd25519 =class n extends O{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=h.deserialize(e),o=S.deserialize(e);return new n(r,o)}},Sn= exports.AccountAuthenticatorMultiEd25519 =class n extends O{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=W.deserialize(e),o=Be.deserialize(e);return new n(r,o)}},re= exports.AccountAuthenticatorSingleKey =class n extends O{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=v.deserialize(e),o=ne.deserialize(e);return new n(r,o)}},ct= exports.AccountAuthenticatorMultiKey =class n extends O{constructor(e,r,o){super();this.public_keys=e,this.signatures=r,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let r=Me.deserialize(e),o=e.deserializeVector(ne),i=e.deserializeBytes();return new n(r,o,i)}};var oe=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return De.load(t);case 1:return vn.load(t);case 2:return Fe.load(t);case 3:return qe.load(t);case 4:return Ke.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},De= exports.TransactionAuthenticatorEd25519 =class n extends oe{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=h.deserialize(e),o=S.deserialize(e);return new n(r,o)}},vn= exports.TransactionAuthenticatorMultiEd25519 =class n extends oe{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=W.deserialize(e),o=Be.deserialize(e);return new n(r,o)}},Fe= exports.TransactionAuthenticatorMultiAgent =class n extends oe{constructor(e,r,o){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o}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=O.deserialize(e),o=e.deserializeVector(c),i=e.deserializeVector(O);return new n(r,o,i)}},qe= exports.TransactionAuthenticatorFeePayer =class n extends oe{constructor(e,r,o,i){super();this.sender=e,this.secondary_signer_addresses=r,this.secondary_signers=o,this.fee_payer=i}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let r=O.deserialize(e),o=e.deserializeVector(c),i=e.deserializeVector(O),s=c.deserialize(e),a=O.deserialize(e),u={address:s,authenticator:a};return new n(r,o,i,u)}},Ke= exports.TransactionAuthenticatorSingleSender =class n extends oe{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let r=O.deserialize(e);return new n(r)}};var $e=class n extends p{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let r=e.deserializeU8();return new n(r)}};var _=class n extends p{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let r=e.deserializeStr();return new n(r)}};var ut=class n extends p{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(c.fromStringRelaxed(r[0]),new _(r[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let r=c.deserialize(e),o=_.deserialize(e);return new n(r,o)}};var C=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return He.load(t);case 1:return Le.load(t);case 2:return We.load(t);case 3:return je.load(t);case 4:return Ye.load(t);case 5:return Pe.load(t);case 6:return Je.load(t);case 7:return me.load(t);case 8:return Qe.load(t);case 9:return Ve.load(t);case 10:return Xe.load(t);case 255:return Ze.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof He}isAddress(){return this instanceof Ye}isGeneric(){return this instanceof Ze}isSigner(){return this instanceof Pe}isVector(){return this instanceof Je}isStruct(){return this instanceof me}isU8(){return this instanceof Le}isU16(){return this instanceof Qe}isU32(){return this instanceof Ve}isU64(){return this instanceof We}isU128(){return this instanceof je}isU256(){return this instanceof Xe}},He= exports.TypeTagBool =class n extends C{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new n}},Le= exports.TypeTagU8 =class n extends C{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new n}},Qe= exports.TypeTagU16 =class n extends C{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new n}},Ve= exports.TypeTagU32 =class n extends C{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new n}},We= exports.TypeTagU64 =class n extends C{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new n}},je= exports.TypeTagU128 =class n extends C{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new n}},Xe= exports.TypeTagU256 =class n extends C{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new n}},Ye= exports.TypeTagAddress =class n extends C{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new n}},Pe= exports.TypeTagSigner =class n extends C{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new n}},Xt= exports.TypeTagReference =class n extends C{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let r=C.deserialize(e);return new n(r)}},Ze= exports.TypeTagGeneric =class n extends C{constructor(e){super();this.value=e}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)}},Je= exports.TypeTagVector =class n extends C{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let r=C.deserialize(e);return new n(r)}},me= exports.TypeTagStruct =class n extends C{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=ie.deserialize(e);return new n(r)}isTypeTag(e,r,o){return this.value.moduleName.identifier===r&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(c.ONE,"string","String")}isOption(){return this.isTypeTag(c.ONE,"option","Option")}isObject(){return this.isTypeTag(c.ONE,"object","Object")}},ie= exports.StructTag =class n extends p{constructor(e,r,o,i){super();this.address=e,this.moduleName=r,this.name=o,this.typeArgs=i}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let r=c.deserialize(e),o=_.deserialize(e),i=_.deserialize(e),s=e.deserializeVector(C);return new n(r,o,i,s)}};function bd(){return new ie(c.ONE,new _("aptos_coin"),new _("AptosCoin"),[])}function Td(){return new ie(c.ONE,new _("string"),new _("String"),[])}function wd(n){return new ie(c.ONE,new _("option"),new _("Option"),[n])}function _d(n){return new ie(c.ONE,new _("object"),new _("Object"),[n])}function Pi(n){let t=n.deserializeUleb128AsU32();switch(t){case 0:return z.deserialize(n);case 1:return U.deserialize(n);case 2:return H.deserialize(n);case 3:return c.deserialize(n);case 4:return A.deserialize(n,z);case 5:return x.deserialize(n);case 6:return K.deserialize(n);case 7:return $.deserialize(n);case 8:return L.deserialize(n);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var Ie=class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return dt.load(t);case 2:return pt.load(t);case 3:return lt.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},dt= exports.TransactionPayloadScript =class n extends Ie{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let r=gt.deserialize(e);return new n(r)}},pt= exports.TransactionPayloadEntryFunction =class n extends Ie{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let r=et.deserialize(e);return new n(r)}},lt= exports.TransactionPayloadMultisig =class n extends Ie{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let r=yt.deserialize(e);return new n(r)}},et= exports.EntryFunction =class n{constructor(t,e,r,o){this.module_name=t,this.function_name=e,this.type_args=r,this.args=o}static build(t,e,r,o){return new n(ut.fromStr(t),new _(e),r,o)}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=ut.deserialize(t),r=_.deserialize(t),o=t.deserializeVector(C),i=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<i;a+=1){let u=t.deserializeUleb128AsU32(),d=Mt.deserialize(t,u);s.push(d)}return new n(e,r,o,s)}},gt= 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(C),o=t.deserializeUleb128AsU32(),i=new Array;for(let s=0;s<o;s+=1){let a=Pi(t);i.push(a)}return new n(e,r,i)}},yt= 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=c.deserialize(t),r=t.deserializeBool(),o;return r&&(o=mt.deserialize(t)),new n(e,o)}},mt= exports.MultisigTransactionPayload =class n{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new n(et.deserialize(t))}};var se=class n extends p{constructor(e,r,o,i,s,a,u){super();this.sender=e,this.sequence_number=r,this.payload=o,this.max_gas_amount=i,this.gas_unit_price=s,this.expiration_timestamp_secs=a,this.chain_id=u}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=c.deserialize(e),o=e.deserializeU64(),i=Ie.deserialize(e),s=e.deserializeU64(),a=e.deserializeU64(),u=e.deserializeU64(),d=$e.deserialize(e);return new n(r,o,i,s,a,u,d)}},Yt= exports.RawTransactionWithData =class extends p{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return fe.load(t);case 1:return Ae.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},fe= exports.MultiAgentRawTransaction =class n extends Yt{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=se.deserialize(e),o=e.deserializeVector(c);return new n(r,o)}},Ae= exports.FeePayerRawTransaction =class n extends Yt{constructor(e,r,o){super();this.raw_txn=e,this.secondary_signer_addresses=r,this.fee_payer_address=o}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=se.deserialize(e),o=e.deserializeVector(c),i=c.deserialize(e);return new n(r,o,i)}};var Y=class n extends p{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=se.deserialize(e),o=oe.deserialize(e);return new n(r,o)}};function oo(n){return!!n.match(/^[_a-zA-Z0-9]+$/)}function io(n){return!!n.match(/\s/)}function Ii(n){return!!n.match(/^T[0-9]+$/)}function Ei(n,t){let e=t;for(;e<n.length;e+=1){let r=n[e];if(!io(r))break}return e}var Ri=(T=>(T.InvalidTypeTag="unknown type",T.UnexpectedGenericType="unexpected generic type",T.UnexpectedTypeArgumentClose="unexpected '>'",T.UnexpectedWhitespaceCharacter="unexpected whitespace character",T.UnexpectedComma="unexpected ','",T.TypeArgumentCountMismatch="type argument count doesn't match expected amount",T.MissingTypeArgumentClose="no matching '>' for '<'",T.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",T.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",T.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",T.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",T.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",T))(Ri||{}),b= exports.TypeTagParserError =class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function ft(n,t){let e=_nullishCoalesce(_optionalChain([t, 'optionalAccess', _75 => _75.allowGenerics]), () => (!1)),r=[],o=[],i=[],s=0,a="",u=1;for(;s<n.length;){let d=n[s];if(d==="<")r.push({savedExpectedTypes:u,savedStr:a,savedTypes:i}),a="",i=[],u=1;else if(d===">"){if(a!==""){let nt=Zt(a,o,e);i.push(nt)}let m=r.pop();if(m===void 0)throw new b(n,"unexpected '>'");if(u!==i.length)throw new b(n,"type argument count doesn't match expected amount");let{savedStr:I,savedTypes:T,savedExpectedTypes:l}=m;o=i,i=T,a=I,u=l}else if(d===","){if(a.length!==0){let m=Zt(a,o,e);o=[],i.push(m),a="",u+=1}}else if(io(d)){let m=!1;if(a.length!==0){let T=Zt(a,o,e);o=[],i.push(T),a="",m=!0}s=Ei(n,s);let I=n[s];if(s<n.length&&m&&I!==","&&I!==">")throw new b(n,"unexpected whitespace character");continue}else a+=d;s+=1}if(r.length>0)throw new b(n,"no matching '>' for '<'");switch(i.length){case 0:return Zt(a,o,e);case 1:if(a==="")return i[0];throw new b(n,"unexpected ','");default:throw new b(n,"unexpected whitespace character")}}function Zt(n,t,e){switch(n){case"&signer":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Xt(new Pe);case"signer":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Pe;case"bool":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new He;case"address":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Ye;case"u8":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Le;case"u16":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Qe;case"u32":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Ve;case"u64":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new We;case"u128":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new je;case"u256":if(t.length>0)throw new b(n,"primitive types not expected to have type arguments");return new Xe;case"vector":if(t.length!==1)throw new b(n,"vector type expected to have exactly one type argument");return new Je(t[0]);default:if(Ii(n)){if(e)return new Ze(Number(n.split("T")[1]));throw new b(n,"unexpected generic type")}if(!n.match(/.*:.*/))throw new b(n,"unknown type");let r=n.split("::");if(r.length!==3)throw new b(n,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!oo(r[1]))throw new b(n,"module name must only contain alphanumeric or '_' characters");if(!oo(r[2]))throw new b(n,"struct name must only contain alphanumeric or '_' characters");return new me(new ie(c.fromStringRelaxed(r[0]),new _(r[1]),new _(r[2]),t))}}function so(n){return typeof n=="boolean"}function tt(n){return typeof n=="string"}function Jt(n){return typeof n=="number"}function en(n){return typeof n=="number"||typeof n=="bigint"||typeof n=="string"}function ao(n){return n==null}function Cn(n){return n instanceof x}function tn(n){return n instanceof c}function Un(n){return n instanceof P}function co(n){return n instanceof we}function Pn(n){return n instanceof z}function In(n){return n instanceof K}function En(n){return n instanceof $}function Rn(n){return n instanceof U}function zn(n){return n instanceof H}function kn(n){return n instanceof L}function Gn(n){return"bytecode"in n}function w(n,t){throw new Error(`Type mismatch for argument ${t}, expected '${n}'`)}function uo(n){let t=n.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?n.params.length:t}function Bn(n){let t=n.split("::");if(t.length!==3)throw new Error(`Invalid function ${n}`);let e=t[0],r=t[1],o=t[2];return{moduleAddress:e,moduleName:r,functionName:o}}function po(n){return _nullishCoalesce(_optionalChain([n, 'optionalAccess', _76 => _76.map, 'call', _77 => _77(t=>tt(t)?ft(t):t)]), () => ([]))}async function lo(n,t,e,r){let i=await _asyncOptionalChain([(await Ht({aptosConfig:r,accountAddress:n,moduleName:t})), 'access', async _78 => _78.abi, 'optionalAccess', async _79 => _79.exposed_functions, 'access', async _80 => _80.find, 'call', async _81 => _81(u=>u.name===e)]);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 s=uo(i),a=[];for(let u=s;u<i.params.length;u+=1)a.push(ft(i.params[u],{allowGenerics:!0}));return{typeParameters:i.generic_type_params,parameters:a}}function go(n,t,e,r,o){if(r>=t.parameters.length)throw new Error(`Too many arguments for '${n}', expected ${t.parameters.length}`);return Cn(e)||Pn(e)||In(e)||En(e)||Rn(e)||zn(e)||kn(e)||tn(e)||Un(e)||co(e)||e instanceof A||e instanceof _e?(zi(t,e,r),e):nn(e,t.parameters[r],r,o)}function nn(n,t,e,r){if(t.isBool()){if(so(n))return new x(n);w("boolean",e)}if(t.isAddress()){if(tt(n))return c.fromStringRelaxed(n);w("string",e)}if(t.isU8()){if(Jt(n))return new z(n);w("number",e)}if(t.isU16()){if(Jt(n))return new K(n);w("number",e)}if(t.isU32()){if(Jt(n))return new $(n);w("number",e)}if(t.isU64()){if(en(n))return new U(BigInt(n));w("bigint | number | string",e)}if(t.isU128()){if(en(n))return new H(BigInt(n));w("bigint | number | string",e)}if(t.isU256()){if(en(n))return new L(BigInt(n));w("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=r.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);nn(n,r[o],e,r)}if(t.isVector()){if(t.value.isU8()&&tt(n))return A.U8(g.fromHexInput(n).toUint8Array());if(Array.isArray(n))return new A(n.map(o=>nn(o,t.value,e,r)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(tt(n))return new P(n);w("string",e)}if(t.isObject()){if(tt(n))return c.fromStringRelaxed(n);w("string",e)}if(t.isOption())return ao(n)?new _e(null):new _e(nn(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 zi(n,t,e){let r=n.parameters[e];if(r.isBool()){if(Cn(t))return;w("Bool",e)}if(r.isAddress()){if(tn(t))return;w("AccountAddress",e)}if(r.isU8()){if(Pn(t))return;w("U8",e)}if(r.isU16()){if(In(t))return;w("U16",e)}if(r.isU32()){if(En(t))return;w("U32",e)}if(r.isU64()){if(Rn(t))return;w("U64",e)}if(r.isU128()){if(zn(t))return;w("U128",e)}if(r.isU256()){if(kn(t))return;w("U256",e)}if(r.isVector()){if(t instanceof A)return;w("MoveVector",e)}if(r instanceof me){if(r.isString()){if(Un(t))return;w("MoveString",e)}if(r.isObject()){if(tn(t))return;w("AccountAddress",e)}if(r.isOption()){if(t instanceof _e)return;w("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${r.toString()}'`)}async function on(n){if(Gn(n))return yo(n);let{moduleAddress:t,moduleName:e,functionName:r}=Bn(n.function),o=await Oe(async()=>lo(t,e,r,n.aptosConfig),`entry-function-${n.aptosConfig.network}-${t}-${e}-${r}`,1e3*60*5)();return Gi(n,o)}function Gi(n,t){if(Gn(n))return yo(n);let{moduleAddress:e,moduleName:r,functionName:o}=Bn(n.function),i=po(n.typeArguments);if(i.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${i.length}`);let s=n.functionArguments.map((u,d)=>go(n.function,t,u,d,i));if(s.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${r}::${o}', expected ${t.parameters.length} but got ${s.length}`);let a=et.build(`${e}::${r}`,o,i,s);if("multisigAddress"in n){let u;return typeof n.multisigAddress=="string"?u=c.from(n.multisigAddress):u=n.multisigAddress,new lt(new yt(u,new mt(a)))}return new pt(a)}function yo(n){return new dt(new gt(g.fromHexInput(n.bytecode).toUint8Array(),_nullishCoalesce(n.typeArguments, () => ([])),n.functionArguments))}async function Bi(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _82 => _82.accountSequenceNumber])?Promise.resolve({sequence_number:o.accountSequenceNumber}):Ue({aptosConfig:t,accountAddress:e}),s=ln[t.network]?Promise.resolve({chain_id:ln[t.network]}):qt({aptosConfig:t}),a=_optionalChain([o, 'optionalAccess', _83 => _83.gasUnitPrice])?Promise.resolve({gas_estimate:o.gasUnitPrice}):Vt({aptosConfig:t}),[{sequence_number:u},{chain_id:d},{gas_estimate:m}]=await Promise.all([i,s,a]),{maxGasAmount:I,gasUnitPrice:T,expireTimestamp:l}={maxGasAmount:_optionalChain([o, 'optionalAccess', _84 => _84.maxGasAmount])?BigInt(o.maxGasAmount):BigInt(ir),gasUnitPrice:BigInt(m),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+sr),...o};return new se(c.fromRelaxed(e),BigInt(u),r,BigInt(I),BigInt(T),BigInt(l),new $e(d))}async function Mn(n){let{aptosConfig:t,sender:e,payload:r,options:o}=n,i=await Bi({aptosConfig:t,sender:e,payload:r,options:o});if("secondarySignerAddresses"in n){let s=_nullishCoalesce(_optionalChain([n, 'access', _85 => _85.secondarySignerAddresses, 'optionalAccess', _86 => _86.map, 'call', _87 => _87(a=>c.fromRelaxed(a))]), () => ([]));return{rawTransaction:i,secondarySignerAddresses:s,feePayerAddress:n.feePayerAddress?c.fromRelaxed(n.feePayerAddress):void 0}}return{rawTransaction:i,feePayerAddress:n.feePayerAddress?c.fromRelaxed(n.feePayerAddress):void 0}}function mo(n){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:r,feePayerPublicKey:o}=n,i=rn(t);if(e.feePayerAddress){let a=new Ae(e.rawTransaction,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),e.feePayerAddress),u=[];r&&(u=r.map(I=>rn(I)));let d=rn(o),m=new qe(i,_nullishCoalesce(e.secondarySignerAddresses, () => ([])),u,{address:e.feePayerAddress,authenticator:d});return new Y(a.raw_txn,m).bcsToBytes()}if(e.secondarySignerAddresses){let a=new fe(e.rawTransaction,e.secondarySignerAddresses),u=[];u=r.map(m=>rn(m));let d=new Fe(i,e.secondarySignerAddresses,u);return new Y(a.raw_txn,d).bcsToBytes()}let s;if(i instanceof ye)s=new De(i.public_key,i.signature);else if(i instanceof re)s=new Ke(i);else throw new Error("Invalid public key");return new Y(e.rawTransaction,s).bcsToBytes()}function rn(n){if(n instanceof v){if(n.publicKey instanceof h)return new re(n,new ne(new S(new Uint8Array(64))));if(n.publicKey instanceof j)return new re(n,new ne(new pe(new Uint8Array(64))))}return new ye(new h(n.toUint8Array()),new S(new Uint8Array(64)))}function fo(n){let{signer:t,transaction:e}=n,r=ho(e),o=Ni(r),i=t.sign(o);switch(t.signingScheme){case 0:return new ye(new h(t.publicKey.toUint8Array()),new S(i.toUint8Array()));case 2:return new re(t.publicKey,new ne(i));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function Ao(n){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:r,additionalSignersAuthenticators:o}=n,i=ho(t);if(r||o)return Mi(i,e,r,o);if(e instanceof ye){let s=new De(e.public_key,e.signature);return new Y(i,s).bcsToBytes()}if(e instanceof re||e instanceof ct){let s=new Ke(e);return new Y(i,s).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function ho(n){return n.feePayerAddress?new Ae(n.rawTransaction,_nullishCoalesce(n.secondarySignerAddresses, () => ([])),n.feePayerAddress):n.secondarySignerAddresses?new fe(n.rawTransaction,n.secondarySignerAddresses):n.rawTransaction}function Mi(n,t,e,r){if(n instanceof Ae){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new qe(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])),{address:n.fee_payer_address,authenticator:e});return new Y(n.raw_txn,o).bcsToBytes()}if(n instanceof fe){if(!r)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new Fe(t,n.secondary_signer_addresses,_nullishCoalesce(r, () => ([])));return new Y(n.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof n} transaction is not supported`)}function Ni(n){let t=_sha3.sha3_256.create();if(n instanceof se)t.update(cr);else if(n instanceof fe)t.update(gn);else if(n instanceof Ae)t.update(gn);else throw new Error(`Unknown transaction type to sign on: ${n}`);let e=t.digest(),r=n.bcsToBytes(),o=new Uint8Array(e.length+r.length);return o.set(e),o.set(r,e.length),o}async function E(n){let{aptosConfig:t,sender:e,data:r,options:o}=n,i,s;"bytecode"in r?(i=r,s=await on(i)):"multisigAddress"in r?(i={aptosConfig:t,multisigAddress:r.multisigAddress,function:r.function,functionArguments:r.functionArguments,typeArguments:r.typeArguments},s=await on(i)):(i={aptosConfig:t,function:r.function,functionArguments:r.functionArguments,typeArguments:r.typeArguments},s=await on(i));let a;if(Oi(n)&&(a=c.ZERO.toString()),Di(n)){let{secondarySignerAddresses:u}=n;return Mn({aptosConfig:t,sender:e,payload:s,options:o,secondarySignerAddresses:u,feePayerAddress:a})}return Mn({aptosConfig:t,sender:e,payload:s,options:o,feePayerAddress:a})}function Oi(n){return n.withFeePayer===!0}function Di(n){return"secondarySignerAddresses"in n}function sn(n){return fo({...n})}async function Nn(n){let{aptosConfig:t,transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}=n,a=mo({transaction:e,signerPublicKey:r,secondarySignersPublicKeys:o,feePayerPublicKey:i,options:s}),{data:u}=await ke({aptosConfig:t,body:a,path:"transactions/simulate",params:{estimate_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _88 => _88.options, 'optionalAccess', _89 => _89.estimateGasUnitPrice]), () => (!1)),estimate_max_gas_amount:_nullishCoalesce(_optionalChain([n, 'access', _90 => _90.options, 'optionalAccess', _91 => _91.estimateMaxGasAmount]), () => (!1)),estimate_prioritized_gas_unit_price:_nullishCoalesce(_optionalChain([n, 'access', _92 => _92.options, 'optionalAccess', _93 => _93.estimatePrioritizedGasUnitPrice]), () => (!1))},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return u}async function an(n){let{aptosConfig:t}=n,e=Ao({...n}),{data:r}=await ke({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return r}async function On(n){let{aptosConfig:t,signer:e,transaction:r}=n,o=sn({signer:e,transaction:r});return an({aptosConfig:t,transaction:r,senderAuthenticator:o})}async function bo(n){let{aptosConfig:t,account:e,metadataBytes:r,moduleBytecode:o,options:i}=n,s=o.map(u=>A.U8(u));return await E({aptosConfig:t,sender:c.fromRelaxed(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[A.U8(r),new A(s)]},options:i})}async function To(n){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:r}=n,o=await Ue({aptosConfig:t,accountAddress:e.accountAddress.toString()}),i=le.fromPrivateKey({privateKey:r,legacy:!0}),a=new Qt({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:c.from(o.authentication_key),newPublicKey:i.publicKey}).bcsToBytes(),u=e.sign(a),d=i.sign(a),m=await E({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new z(e.signingScheme.valueOf()),A.U8(e.publicKey.toUint8Array()),new z(i.signingScheme.valueOf()),A.U8(i.publicKey.toUint8Array()),A.U8(u.toUint8Array()),A.U8(d.toUint8Array())]}});return await On({aptosConfig:t,signer:e,transaction:m})}async function wo(n){let{aptosConfig:t,sender:e,recipient:r,amount:o,coinType:i,options:s}=n,a=_nullishCoalesce(i, () => (ar));return await E({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[ft(a)],functionArguments:[c.from(r),new U(o)]},options:s})}var At=class{constructor(t){this.config=t}async transferCoinTransaction(t){return wo({aptosConfig:this.config,...t})}};async function _o(n){let{aptosConfig:t,options:e,creator:r}=n;return await E({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new P(n.collection),new P(n.description),new P(n.name),new P(n.uri),A.MoveString([]),A.MoveString([]),new A([])]},options:e})}async function xo(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:c.from(e).toStringLong()}};return(await y({aptosConfig:t,query:{query:Nr,variables:{where_condition:r}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function So(n){let{aptosConfig:t,tokenAddress:e}=n,r={token_data_id:{_eq:c.from(e).toStringLong()}};return(await y({aptosConfig:t,query:{query:hn,variables:{where_condition:r}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function vo(n){let{aptosConfig:t,ownerAddress:e,options:r}=n,o={owner_address:{_eq:c.from(e).toStringLong()}},i={query:hn,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _94 => _94.pagination, 'optionalAccess', _95 => _95.offset]),limit:_optionalChain([r, 'optionalAccess', _96 => _96.pagination, 'optionalAccess', _97 => _97.limit]),order_by:_optionalChain([r, 'optionalAccess', _98 => _98.orderBy])}};return(await y({aptosConfig:t,query:i,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function Co(n){let{aptosConfig:t,tokenAddress:e,options:r}=n,o={token_data_id:{_eq:c.from(e).toStringLong()}},i={query:Mr,variables:{where_condition:o,offset:_optionalChain([r, 'optionalAccess', _99 => _99.pagination, 'optionalAccess', _100 => _100.offset]),limit:_optionalChain([r, 'optionalAccess', _101 => _101.pagination, 'optionalAccess', _102 => _102.limit]),order_by:_optionalChain([r, 'optionalAccess', _103 => _103.orderBy])}};return(await y({aptosConfig:t,query:i,originMethod:"getTokenActivity"})).token_activities_v2}async function Uo(n){let{aptosConfig:t,options:e,creator:r}=n;return await E({aptosConfig:t,sender:r.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new P(n.description),new U(_nullishCoalesce(n.maxSupply, () => (be))),new P(n.name),new P(n.uri),new x(_nullishCoalesce(n.mutableDescription, () => (!0))),new x(_nullishCoalesce(n.mutableRoyalty, () => (!0))),new x(_nullishCoalesce(n.mutableURI, () => (!0))),new x(_nullishCoalesce(n.mutableTokenDescription, () => (!0))),new x(_nullishCoalesce(n.mutableTokenName, () => (!0))),new x(_nullishCoalesce(n.mutableTokenProperties, () => (!0))),new x(_nullishCoalesce(n.mutableTokenURI, () => (!0))),new x(_nullishCoalesce(n.tokensBurnableByCreator, () => (!0))),new x(_nullishCoalesce(n.tokensFreezableByCreator, () => (!0))),new U(_nullishCoalesce(n.royaltyNumerator, () => (0))),new U(_nullishCoalesce(n.royaltyDenominator, () => (1)))]},options:e})}async function Dn(n){let{aptosConfig:t,creatorAddress:e,collectionName:r,options:o}=n,i=c.from(e),s={collection_name:{_eq:r},creator_address:{_eq:i.toStringLong()}};return _optionalChain([o, 'optionalAccess', _104 => _104.tokenStandard])&&(s.token_standard={_eq:_nullishCoalesce(_optionalChain([o, 'optionalAccess', _105 => _105.tokenStandard]), () => ("v2"))}),(await y({aptosConfig:t,query:{query:Ir,variables:{where_condition:s}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Po(n){return(await Dn(n)).collection_id}var ht=class{constructor(t){this.config=t}async createCollectionTransaction(t){return Uo({aptosConfig:this.config,...t})}async getCollectionData(t){return Dn({aptosConfig:this.config,...t})}async getCollectionId(t){return Po({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return _o({aptosConfig:this.config,...t})}async getTokenData(t){return xo({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return So({aptosConfig:this.config,...t})}async getOwnedTokens(t){return vo({aptosConfig:this.config,...t})}async getTokenActivity(t){return Co({aptosConfig:this.config,...t})}};async function Io(n){let{accountAddress:t,aptosConfig:e,creationNumber:r}=n,i={account_address:{_eq:c.from(t).toStringLong()},creation_number:{_eq:r}};return cn({aptosConfig:e,options:{where:i}})}async function Eo(n){let{accountAddress:t,aptosConfig:e,eventType:r,options:o}=n,a={where:{account_address:{_eq:c.fromRelaxed(t).toStringLong()},indexed_type:{_eq:r}},pagination:_optionalChain([o, 'optionalAccess', _106 => _106.pagination]),orderBy:_optionalChain([o, 'optionalAccess', _107 => _107.orderBy])};return cn({aptosConfig:e,options:a})}async function cn(n){let{aptosConfig:t,options:e}=n,r={query:zr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _108 => _108.where]),offset:_optionalChain([e, 'optionalAccess', _109 => _109.pagination, 'optionalAccess', _110 => _110.offset]),limit:_optionalChain([e, 'optionalAccess', _111 => _111.pagination, 'optionalAccess', _112 => _112.limit]),order_by:_optionalChain([e, 'optionalAccess', _113 => _113.orderBy])}};return(await y({aptosConfig:t,query:r,originMethod:"getEvents"})).events}var bt=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return Io({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return Eo({aptosConfig:this.config,...t})}async getEvents(t){return cn({aptosConfig:this.config,...t})}};async function Ro(n){let{aptosConfig:t,accountAddress:e,amount:r,options:o}=n,i=_optionalChain([o, 'optionalAccess', _114 => _114.timeoutSecs])||zt,{data:s}=await dr({aptosConfig:t,path:"fund",body:{address:c.fromRelaxed(e).toString(),amount:r},originMethod:"fundAccount"}),a=s.txn_hashes[0];return await jt({aptosConfig:t,transactionHash:a,options:{timeoutSecs:i,checkSuccess:_optionalChain([o, 'optionalAccess', _115 => _115.checkSuccess]),indexerVersionCheck:_optionalChain([o, 'optionalAccess', _116 => _116.indexerVersionCheck])}}),a}var Tt=class{constructor(t){this.config=t}async fundAccount(t){return Ro({aptosConfig:this.config,...t})}};async function Fn(n){let{aptosConfig:t,options:e}=n,r={query:Gr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _117 => _117.where]),limit:_optionalChain([e, 'optionalAccess', _118 => _118.pagination, 'optionalAccess', _119 => _119.limit]),offset:_optionalChain([e, 'optionalAccess', _120 => _120.pagination, 'optionalAccess', _121 => _121.offset])}};return(await y({aptosConfig:t,query:r,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function zo(n){let{aptosConfig:t,options:e}=n,r={query:kr,variables:{where_condition:_optionalChain([e, 'optionalAccess', _122 => _122.where]),limit:_optionalChain([e, 'optionalAccess', _123 => _123.pagination, 'optionalAccess', _124 => _124.limit]),offset:_optionalChain([e, 'optionalAccess', _125 => _125.pagination, 'optionalAccess', _126 => _126.offset])}};return(await y({aptosConfig:t,query:r,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function ko(n){let{aptosConfig:t,options:e}=n,r={query:Er,variables:{where_condition:_optionalChain([e, 'optionalAccess', _127 => _127.where]),limit:_optionalChain([e, 'optionalAccess', _128 => _128.pagination, 'optionalAccess', _129 => _129.limit]),offset:_optionalChain([e, 'optionalAccess', _130 => _130.pagination, 'optionalAccess', _131 => _131.offset])}};return(await y({aptosConfig:t,query:r,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var wt=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return Fn({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return(await Fn({aptosConfig:this.config,options:{where:{asset_type:{_eq:t}}}}))[0]}async getFungibleAssetActivities(t){return zo({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return ko({aptosConfig:this.config,...t})}};var _t=class{constructor(t){this.config=t}async getLedgerInfo(){return qt({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Or({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Dr({aptosConfig:this.config,...t})}async getTableItem(t){return Kt({aptosConfig:this.config,...t})}async view(t){return ge({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Fr({aptosConfig:this.config,...t})}async queryIndexer(t){return y({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return $t({aptosConfig:this.config})}};var Go=["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 Bo(n){return!(!n||n.length<3||n.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(n))}function he(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(!Bo(t))throw new Error(`${t} is not valid. ${Go}`);if(e&&!Bo(e))throw new Error(`${e} is not valid. ${Go}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Fi="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",qi={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Fi,custom:null,devnet:null};function ae(n){let t=qi[n.network];if(!t)throw new Error(`The ANS contract is not deployed to ${n.network}`);return t}var Ki=n=>({vec:[n]}),$i=()=>({vec:[]}),qn=n=>n!=null?Ki(n):$i(),un=n=>{if(n&&typeof n=="object"&&"vec"in n&&Array.isArray(n.vec))return n.vec[0]};async function Mo(n){let{aptosConfig:t,name:e}=n,r=ae(t),{domainName:o,subdomainName:i}=he(e),s=await ge({aptosConfig:t,payload:{function:`${r}::router::get_owner_addr`,functionArguments:[o,qn(i)]}}),a=un(s[0]);return a?c.fromRelaxed(a).toString():void 0}async function No(n){let{aptosConfig:t,expiration:e,name:r,sender:o,targetAddress:i,toAddress:s,options:a,transferable:u}=n,d=ae(t),{domainName:m,subdomainName:I}=he(r),T=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(I&&!T)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(T&&!I)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let Hn=_nullishCoalesce(e.years, () => (1));if(Hn!==1)throw new Error("For now, names can only be registered for 1 year at a time");let ei=Hn*31536e3;return await E({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_domain`,functionArguments:[m,ei,i,s]},options:a})}if(!I)throw new Error(`${e.policy} requires a subdomain to be provided.`);let l=await Kn({aptosConfig:t,name:m});if(!l)throw new Error("The domain does not exist");l*=1e3;let nt=e.policy==="subdomain:independent"?e.expirationDate.valueOf():l;if(nt>l)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await E({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${d}::router::register_subdomain`,functionArguments:[m,I,Math.round(nt/1e3),e.policy==="subdomain:follow-domain"?1:0,!!u,i,s]},options:a})}async function Kn(n){let{aptosConfig:t,name:e}=n,r=ae(t),{domainName:o,subdomainName:i}=he(e);try{return(await ge({aptosConfig:t,payload:{function:`${r}::router::get_expiration`,functionArguments:[o,qn(i)]}}))[0]}catch (e3){return}}async function Oo(n){let{aptosConfig:t,address:e}=n,r=ae(t),o=await ge({aptosConfig:t,payload:{function:`${r}::router::get_primary_name`,functionArguments:[c.fromRelaxed(e).toString()]}}),i=un(o[1]),s=un(o[0]);if(i)return[s,i].filter(Boolean).join(".")}async function Do(n){let{aptosConfig:t,sender:e,name:r,options:o}=n,i=ae(t);if(!r)return await E({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:s,subdomainName:a}=he(r);return await E({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${i}::router::set_primary_name`,functionArguments:[s,a]},options:o})}async function Fo(n){let{aptosConfig:t,name:e}=n,r=ae(t),{domainName:o,subdomainName:i}=he(e),s=await ge({aptosConfig:t,payload:{function:`${r}::router::get_target_addr`,functionArguments:[o,qn(i)]}}),a=un(s[0]);return a?c.fromRelaxed(a).toString():void 0}async function qo(n){let{aptosConfig:t,sender:e,name:r,address:o,options:i}=n,s=ae(t),{domainName:a,subdomainName:u}=he(r);return await E({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_target_addr`,functionArguments:[a,u,o]},options:i})}async function Ko(n){let{aptosConfig:t,name:e}=n,{domainName:r,subdomainName:o=""}=he(e);return(await y({aptosConfig:t,query:{query:Ne,variables:{where_condition:{domain:{_eq:r},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0]}async function $o(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await $n({aptosConfig:t});return(await y({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ne,variables:{limit:_optionalChain([e, 'optionalAccess', _132 => _132.pagination, 'optionalAccess', _133 => _133.limit]),offset:_optionalChain([e, 'optionalAccess', _134 => _134.pagination, 'optionalAccess', _135 => _135.offset]),order_by:_optionalChain([e, 'optionalAccess', _136 => _136.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _137 => _137.options, 'optionalAccess', _138 => _138.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names}async function Ho(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await $n({aptosConfig:t});return(await y({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ne,variables:{limit:_optionalChain([e, 'optionalAccess', _139 => _139.pagination, 'optionalAccess', _140 => _140.limit]),offset:_optionalChain([e, 'optionalAccess', _141 => _141.pagination, 'optionalAccess', _142 => _142.offset]),order_by:_optionalChain([e, 'optionalAccess', _143 => _143.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _144 => _144.options, 'optionalAccess', _145 => _145.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names}async function Lo(n){let{aptosConfig:t,options:e,accountAddress:r}=n,o=await $n({aptosConfig:t});return(await y({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ne,variables:{limit:_optionalChain([e, 'optionalAccess', _146 => _146.pagination, 'optionalAccess', _147 => _147.limit]),offset:_optionalChain([e, 'optionalAccess', _148 => _148.pagination, 'optionalAccess', _149 => _149.offset]),order_by:_optionalChain([e, 'optionalAccess', _150 => _150.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _151 => _151.options, 'optionalAccess', _152 => _152.where]), () => ({})),owner_address:{_eq:r.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names}async function Qo(n){let{aptosConfig:t,options:e,domain:r}=n;return(await y({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ne,variables:{limit:_optionalChain([e, 'optionalAccess', _153 => _153.pagination, 'optionalAccess', _154 => _154.limit]),offset:_optionalChain([e, 'optionalAccess', _155 => _155.pagination, 'optionalAccess', _156 => _156.offset]),order_by:_optionalChain([e, 'optionalAccess', _157 => _157.orderBy]),where_condition:{..._nullishCoalesce(_optionalChain([n, 'access', _158 => _158.options, 'optionalAccess', _159 => _159.where]), () => ({})),domain:{_eq:r},subdomain:{_neq:""}}}}})).current_aptos_names}async function $n(n){let{aptosConfig:t}=n,e=ae(t),i=(await ge({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}))[0]/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-i)).toISOString()}async function Vo(n){let{aptosConfig:t,sender:e,name:r,years:o=1,options:i}=n,s=ae(t),a=o*31536e3,{domainName:u,subdomainName:d}=he(r);if(d)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await E({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::renew_domain`,functionArguments:[u,a]},options:i})}var xt=class{constructor(t){this.config=t}async getOwnerAddress(t){return Mo({aptosConfig:this.config,...t})}async getExpiration(t){return Kn({aptosConfig:this.config,...t})}async getTargetAddress(t){return Fo({aptosConfig:this.config,...t})}async setTargetAddress(t){return qo({aptosConfig:this.config,...t})}async getPrimaryName(t){return Oo({aptosConfig:this.config,...t})}async setPrimaryName(t){return Do({aptosConfig:this.config,...t})}async registerName(t){return No({aptosConfig:this.config,...t})}async renewDomain(t){return Vo({aptosConfig:this.config,...t})}async getName(t){return Ko({aptosConfig:this.config,...t})}async getAccountNames(t){return $o({aptosConfig:this.config,...t})}async getAccountDomains(t){return Ho({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return Lo({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return Qo({aptosConfig:this.config,...t})}};async function Wo(n){let{aptosConfig:t,poolAddress:e}=n,r=c.fromRelaxed(e).toStringLong(),i=await y({aptosConfig:t,query:{query:An,variables:{where_condition:{pool_address:{_eq:r}}}}});if(i.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return i.num_active_delegator_per_pool[0].num_active_delegator}async function jo(n){let{aptosConfig:t,options:e}=n,r={query:An,variables:{where_condition:{},order_by:_optionalChain([e, 'optionalAccess', _160 => _160.orderBy])}};return(await y({aptosConfig:t,query:r})).num_active_delegator_per_pool}async function Xo(n){let{aptosConfig:t,delegatorAddress:e,poolAddress:r}=n,o={query:Rr,variables:{delegatorAddress:c.fromRelaxed(e).toStringLong(),poolAddress:c.fromRelaxed(r).toStringLong()}};return(await y({aptosConfig:t,query:o})).delegated_staking_activities}var St=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return Wo({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return jo({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return Xo({aptosConfig:this.config,...t})}};var vt=class{constructor(t){this.config=t}async getTransactions(t){return to({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return no({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Wt({aptosConfig:this.config,...t})}async isPendingTransaction(t){return ro({aptosConfig:this.config,...t})}async waitForTransaction(t){return jt({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Vt({aptosConfig:this.config})}};var Ct=class{constructor(t){this.config=t}async signAndSubmitTransaction(t){let{signer:e,transaction:r}=t;return On({aptosConfig:this.config,signer:e,transaction:r})}async publishPackageTransaction(t){return bo({aptosConfig:this.config,...t})}async rotateAuthKey(t){return To({aptosConfig:this.config,...t})}};var Ut=class{constructor(t){this.config=t}async transaction(t){return E({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return E({aptosConfig:this.config,...t})}};var Pt=class{constructor(t){this.config=t}transaction(t){return sn({...t})}transactionAsFeePayer(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,sn({signer:e,transaction:r})}};var Ee=class{constructor(t){this.config=t}async transaction(t){return Nn({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return Nn({aptosConfig:this.config,...t})}};G([Yo],Ee.prototype,"transaction",1),G([Yo],Ee.prototype,"multiAgentTransaction",1);function Yo(n,t,e){let r=e.value;return e.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return r.apply(this,o)},e}var Re=class{constructor(t){this.config=t}async transaction(t){return an({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return an({aptosConfig:this.config,...t})}};G([Zo],Re.prototype,"transaction",1),G([Zo],Re.prototype,"multiAgentTransaction",1);function Zo(n,t,e){let r=e.value;return e.value=async function(...o){let[i]=o;if(i.transaction.feePayerAddress&&!i.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return r.apply(this,o)},e}var R=class{constructor(t){this.config=new Lt(t),this.account=new st(this.config),this.ans=new xt(this.config),this.coin=new At(this.config),this.digitalAsset=new ht(this.config),this.event=new bt(this.config),this.faucet=new Tt(this.config),this.fungibleAsset=new wt(this.config),this.general=new _t(this.config),this.staking=new St(this.config),this.transaction=new vt(this.config),this.transactionSubmission=new Ct(this.config),this.build=new Ut(this.config),this.sign=new Pt(this.config),this.simulate=new Ee(this.config),this.submit=new Re(this.config)}};function k(n,t,e){Object.getOwnPropertyNames(t.prototype).forEach(r=>{let o=Object.getOwnPropertyDescriptor(t.prototype,r);o&&(o.value=function(...i){return this[e][r](...i)},Object.defineProperty(n.prototype,r,o))})}k(R,st,"account");k(R,xt,"ans");k(R,At,"coin");k(R,ht,"digitalAsset");k(R,bt,"event");k(R,Tt,"faucet");k(R,wt,"fungibleAsset");k(R,_t,"general");k(R,St,"staking");k(R,vt,"transaction");k(R,Ct,"transactionSubmission");k(R,Ut,"build");k(R,Pt,"sign");k(R,Ee,"simulate");k(R,Re,"submit");exports.APTOS_BIP44_REGEX = hi; exports.APTOS_COIN = ar; exports.APTOS_HARDENED_REGEX = Ai; exports.Account = le; exports.AccountAddress = c; exports.AccountAuthenticator = O; exports.AccountAuthenticatorEd25519 = ye; exports.AccountAuthenticatorMultiEd25519 = Sn; exports.AccountAuthenticatorMultiKey = ct; exports.AccountAuthenticatorSingleKey = re; exports.AccountAuthenticatorVariant = Xn; exports.AddressInvalidReason = yi; exports.AnyPublicKeyVariant = Yn; exports.AnySignatureVariant = Zn; exports.Aptos = R; exports.AptosApiError = Z; exports.AptosApiType = Rt; exports.AptosConfig = Lt; exports.AuthenticationKey = X; exports.Bool = x; exports.CKDPriv = Ar; exports.ChainId = $e; exports.DEFAULT_MAX_GAS_AMOUNT = ir; exports.DEFAULT_NETWORK = or; exports.DEFAULT_TXN_EXP_SEC_FROM_NOW = sr; exports.DEFAULT_TXN_TIMEOUT_SEC = zt; exports.DeriveScheme = si; exports.Deserializer = lr; exports.Ed25519PrivateKey = ue; exports.Ed25519PublicKey = h; exports.Ed25519Signature = S; exports.EntryFunction = et; exports.EntryFunctionBytes = Mt; exports.FeePayerRawTransaction = Ae; exports.FixedBytes = we; exports.HARDENED_OFFSET = yr; exports.Hex = g; exports.HexInvalidReason = pi; exports.Identifier = _; exports.KeyType = bi; exports.MimeType = dn; exports.ModuleId = ut; exports.MoveAbility = oi; exports.MoveFunctionVisibility = ri; exports.MoveOption = _e; exports.MoveString = P; exports.MoveVector = A; exports.MultiAgentRawTransaction = fe; exports.MultiEd25519PublicKey = W; exports.MultiEd25519Signature = Be; exports.MultiKey = Me; exports.MultiSig = yt; exports.MultisigTransactionPayload = mt; exports.Network = Et; exports.NetworkToChainId = ln; exports.NetworkToFaucetAPI = rr; exports.NetworkToIndexerAPI = pn; exports.NetworkToNetworkName = as; exports.NetworkToNodeAPI = nr; exports.ParsingError = B; exports.PrivateKey = Ge; exports.PublicKey = D; exports.RAW_TRANSACTION_SALT = cr; exports.RAW_TRANSACTION_WITH_DATA_SALT = gn; exports.RawTransaction = se; exports.RawTransactionWithData = Yt; exports.RoleType = ii; exports.RotationProofChallenge = Qt; exports.Script = gt; exports.ScriptTransactionArgumentVariants = rt; exports.Secp256k1PrivateKey = de; exports.Secp256k1PublicKey = j; exports.Secp256k1Signature = pe; exports.Serializable = p; exports.Serializer = Q; exports.Signature = V; exports.SignedTransaction = Y; exports.SigningScheme = ot; exports.SigningSchemeInput = er; exports.StructTag = ie; exports.TransactionAuthenticator = oe; exports.TransactionAuthenticatorEd25519 = De; exports.TransactionAuthenticatorFeePayer = qe; exports.TransactionAuthenticatorMultiAgent = Fe; exports.TransactionAuthenticatorMultiEd25519 = vn; exports.TransactionAuthenticatorSingleSender = Ke; exports.TransactionAuthenticatorVariant = jn; exports.TransactionPayload = Ie; exports.TransactionPayloadEntryFunction = pt; exports.TransactionPayloadMultisig = lt; exports.TransactionPayloadScript = dt; exports.TransactionPayloadVariants = Vn; exports.TransactionResponseType = Jn; exports.TransactionVariants = Wn; exports.TypeTag = C; exports.TypeTagAddress = Ye; exports.TypeTagBool = He; exports.TypeTagGeneric = Ze; exports.TypeTagParserError = b; exports.TypeTagParserErrorType = Ri; exports.TypeTagReference = Xt; exports.TypeTagSigner = Pe; exports.TypeTagStruct = me; exports.TypeTagU128 = je; exports.TypeTagU16 = Qe; exports.TypeTagU256 = Xe; exports.TypeTagU32 = Ve; exports.TypeTagU64 = We; exports.TypeTagU8 = Le; exports.TypeTagVariants = Qn; exports.TypeTagVector = Je; exports.U128 = H; exports.U16 = K; exports.U256 = L; exports.U32 = $; exports.U64 = U; exports.U8 = z; exports.aptosCoinStructTag = bd; exports.aptosRequest = It; exports.buildTransaction = Mn; exports.convertArgument = go; exports.deriveKey = fn; exports.deriveTransactionType = ho; exports.deserializeFromScriptArgument = Pi; exports.ensureBoolean = mn; exports.fetchEntryFunctionAbi = lo; exports.findFirstNonSignerArg = uo; exports.generateMultiSignersSignedTransaction = Mi; exports.generateRawTransaction = Bi; exports.generateSignedTransaction = Ao; exports.generateSignedTransactionForSimulation = mo; exports.generateTransactionPayload = on; exports.generateTransactionPayloadWithABI = Gi; exports.get = ci; exports.getAptosFullNode = N; exports.getAuthenticatorForSimulation = rn; exports.getFunctionParts = Bn; exports.getSigningMessage = Ni; exports.isBcsAddress = tn; exports.isBcsBool = Cn; exports.isBcsFixedBytes = co; exports.isBcsString = Un; exports.isBcsU128 = zn; exports.isBcsU16 = In; exports.isBcsU256 = kn; exports.isBcsU32 = En; exports.isBcsU64 = Rn; exports.isBcsU8 = Pn; exports.isBool = so; exports.isLargeNumber = en; exports.isNull = ao; exports.isNumber = Jt; exports.isScriptDataInput = Gn; exports.isString = tt; exports.isValidBIP44Path = mr; exports.isValidHardenedPath = fr; exports.mnemonicToSeed = Nt; exports.objectStructTag = _d; exports.optionStructTag = wd; exports.outOfRangeErrorMessage = li; exports.paginateWithCursor = ze; exports.parseTypeTag = ft; exports.post = yn; exports.postAptosFaucet = dr; exports.postAptosFullNode = ke; exports.postAptosIndexer = ur; exports.request = ai; exports.sign = fo; exports.splitPath = hr; exports.standardizeTypeTags = po; exports.stringStructTag = Td; exports.throwTypeMismatch = w; exports.validateNumberInRange = ce;
406
427
  //# sourceMappingURL=index.js.map