@wormhole-foundation/wormhole-connect 2.3.0 → 2.3.1-beta.0-development

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 (77) hide show
  1. package/dist/main.js +2 -2
  2. package/lib/{aptos-BxqLqZNX.mjs → aptos-C4_KiV6e.mjs} +5 -5
  3. package/lib/{aptos-Dfr8g3l2.mjs → aptos-CdiL-sBA.mjs} +2 -2
  4. package/lib/{aptos-b5iDxSTg.js → aptos-DANdlJjj.js} +1 -1
  5. package/lib/{aptos-C0fgCR3U.js → aptos-DYaLZIfV.js} +2 -2
  6. package/lib/{base64-ftXBMu_Y.js → base64-DclgA4vp.js} +1 -1
  7. package/lib/{base64--OafHktr.mjs → base64-F_VTobz3.mjs} +1 -1
  8. package/lib/{ccip-Nyheo-pf.mjs → ccip-BojaGTep.mjs} +1 -1
  9. package/lib/{ccip-bB3Hb3p1.js → ccip-C6h0YUI_.js} +1 -1
  10. package/lib/{chunk-IMTC3J2M-CxyrTIXy.js → chunk-IMTC3J2M-CEVQOlox.js} +1 -1
  11. package/lib/{chunk-IMTC3J2M-B3JXHl8c.mjs → chunk-IMTC3J2M-CpVxVdD9.mjs} +3 -3
  12. package/lib/{events-B0EN-_lw.js → events-BA7kpKql.js} +1 -1
  13. package/lib/{events-CMAqq7WG.mjs → events-jNVA6cWP.mjs} +1 -1
  14. package/lib/{evm-BOjE2d7W.mjs → evm-Bk1o7Fvg.mjs} +5 -5
  15. package/lib/{evm-mcCNFzAo.mjs → evm-CL3rKZ3E.mjs} +5 -5
  16. package/lib/{evm-CKGFrxPp.js → evm-CpIvLF64.js} +1 -1
  17. package/lib/{evm-2eC8tBb8.js → evm-fRvH6-dV.js} +3 -3
  18. package/lib/{index-BYbcUh5K.mjs → index-0azU-iuS.mjs} +2 -2
  19. package/lib/{index-DfJOWZgf.mjs → index-1IQ95KAh.mjs} +1 -1
  20. package/lib/{index-B2taYdgD.js → index-73xAOJrz.js} +1 -1
  21. package/lib/{index-BfEF0Tek.mjs → index-B1MjJdN8.mjs} +4 -4
  22. package/lib/{index-Ba6qW0G9.mjs → index-BAfUt02V.mjs} +2 -2
  23. package/lib/{index-DGyhcRhy.js → index-BEaSGg8j.js} +1 -1
  24. package/lib/{index-D8L0gOjE.mjs → index-BGM05S-4.mjs} +1 -1
  25. package/lib/{index-DCXltTRQ.mjs → index-BRaNFctR.mjs} +1 -1
  26. package/lib/{index-DPwdAd1Z.js → index-BZ8rVEqB.js} +1 -1
  27. package/lib/{index-U0I19HyB.mjs → index-Bd142LTv.mjs} +3 -3
  28. package/lib/{index-eLxBNCA2.js → index-Bg1reAFa.js} +1 -1
  29. package/lib/{index-CqW6CJJD.mjs → index-BgnS4rCP.mjs} +1 -1
  30. package/lib/{index-BeNF4-bP.mjs → index-BjH9uVL-.mjs} +2 -2
  31. package/lib/{index-BgPLmEjh.mjs → index-BnuURGN1.mjs} +3 -3
  32. package/lib/{index-Bh68ln_H.js → index-C88dTq5e.js} +1 -1
  33. package/lib/{index-BdWdyObb.js → index-CATSQbx8.js} +1 -1
  34. package/lib/{index-D1YLa5Y6.mjs → index-CAYreeOz.mjs} +2 -2
  35. package/lib/{index-DMT1CxRy.js → index-CAq0lMQz.js} +1 -1
  36. package/lib/{index-DZWcS0lz.js → index-CDTxSrrm.js} +1 -1
  37. package/lib/{index-DdAYyX9y.js → index-CN6GPF75.js} +1 -1
  38. package/lib/{index-BpdpC7bc.mjs → index-CQytovK6.mjs} +1 -1
  39. package/lib/{index-CGkpUmfc.mjs → index-CtohU4n4.mjs} +1 -1
  40. package/lib/{index-D0km6dEP.js → index-Cui5cVsF.js} +1 -1
  41. package/lib/{index-r7xhXupc.mjs → index-CxsX-GTd.mjs} +22 -17
  42. package/lib/{index-B_UCj8xo.js → index-CyHKsrVh.js} +1 -1
  43. package/lib/{index-Ckn2JAfC.js → index-Czu6ahWP.js} +1 -1
  44. package/lib/{index-BFxsrgmC.mjs → index-D3hWkjCC.mjs} +5 -5
  45. package/lib/{index-DVX7DsmX.mjs → index-DKC8VMjs.mjs} +2 -2
  46. package/lib/{index-DHhwn6Cc.js → index-DNcZUq8E.js} +1 -1
  47. package/lib/{index-E2SOg6Ah.js → index-DTF7nwSK.js} +1 -1
  48. package/lib/{index-ZjG8y1YT.mjs → index-DWQ8-Uw2.mjs} +2 -2
  49. package/lib/{index-m31ry_Y2.mjs → index-DphKVJKK.mjs} +2 -2
  50. package/lib/{index-ClGDuGAH.js → index-DtU_4Od4.js} +1 -1
  51. package/lib/{index-CMgf8btt.js → index-Dwg0ykxL.js} +1 -1
  52. package/lib/{index-CqLCyep2.mjs → index-Dx2EJnjq.mjs} +1 -1
  53. package/lib/{index-BjZpM_ll.js → index-DxyZkIqh.js} +1 -1
  54. package/lib/{index-DHYCPrLZ.mjs → index-FtjEtl-M.mjs} +2 -2
  55. package/lib/{index-dAUnLH4Z.mjs → index-PsdMIkPF.mjs} +2 -2
  56. package/lib/{index-C5v_43HR.js → index-QKpno7AE.js} +2 -2
  57. package/lib/{index-D-TPMx4M.js → index-Sa4Pwao6.js} +1 -1
  58. package/lib/{index-BUPpsD6y.js → index-WMfxmHuw.js} +1 -1
  59. package/lib/{index-BlZ-gXWP.js → index-ruyCJXyG.js} +1 -1
  60. package/lib/{index.es-C_kwfz5b.mjs → index.es-BZzDKsxb.mjs} +6 -6
  61. package/lib/{index.es-BgHsoUXw.js → index.es-Cw0QYG9a.js} +2 -2
  62. package/lib/index.js +1 -1
  63. package/lib/index.mjs +1 -1
  64. package/lib/{signer-g3raRETb.mjs → signer-B6QN2w0s.mjs} +1 -1
  65. package/lib/{signer-BXnEcajC.js → signer-BIbvuLuH.js} +1 -1
  66. package/lib/solana-BlVvGoXN.js +1 -0
  67. package/lib/{solana-C4lFmDk6.js → solana-Br3-AhRS.js} +1 -1
  68. package/lib/{solana-CJTWTUey.mjs → solana-UObKGiAF.mjs} +5 -5
  69. package/lib/{solana-HjIwzEIV.mjs → solana-ZRevg4Vn.mjs} +4 -4
  70. package/lib/{solanaEmbed.esm-BSo4Y-GM.mjs → solanaEmbed.esm-C0_7Fw6u.mjs} +2 -2
  71. package/lib/{solanaEmbed.esm-BY9140pH.js → solanaEmbed.esm-q4DUNfSS.js} +1 -1
  72. package/lib/{sui-DolA6Isa.mjs → sui-BHHK5pBY.mjs} +1 -1
  73. package/lib/{sui-BYAvPQcW.mjs → sui-CkWKHVrG.mjs} +5 -5
  74. package/lib/{sui-DSbuDbhr.js → sui-DEn4aocN.js} +1 -1
  75. package/lib/{sui-D0YPksGW.js → sui-DetJUCZm.js} +2 -2
  76. package/package.json +1 -1
  77. package/lib/solana-BzGuWSEw.js +0 -1
@@ -1,9 +1,9 @@
1
1
  var S = Object.defineProperty;
2
2
  var b = (a, e, t) => e in a ? S(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
3
  var i = (a, e, t) => b(a, typeof e != "symbol" ? e + "" : e, t);
4
- import { cd as v, ce as f, cf as I, c9 as x, cg as A, b6 as w, bA as U, bd as $, bB as m, r as o, aC as k, p as c, m as h, ch as C, bG as T, V as E, bD as F, k as _, be as u, ci as W, bj as N } from "./index-r7xhXupc.mjs";
4
+ import { cd as v, ce as f, cf as I, c9 as x, cg as A, b6 as w, bA as U, bd as $, bB as m, r as o, aC as k, p as c, m as h, ch as C, bG as T, V as E, bD as F, k as _, be as u, ci as W, bj as N } from "./index-CxsX-GTd.mjs";
5
5
  import { A as O } from "./unsignedTransaction-BDOQhqcZ.mjs";
6
- import { A as Q } from "./aptos-BxqLqZNX.mjs";
6
+ import { A as Q } from "./aptos-C4_KiV6e.mjs";
7
7
  const R = [
8
8
  { name: "tokenBridgeAddress", ...f },
9
9
  { name: "chain", ...I() },
@@ -1,8 +1,8 @@
1
1
  var d = Object.defineProperty;
2
2
  var h = (i, e, r) => e in i ? d(i, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : i[e] = r;
3
3
  var o = (i, e, r) => h(i, typeof e != "symbol" ? e + "" : e, r);
4
- import { b6 as m, cc as w, K as g, bj as p } from "./index-r7xhXupc.mjs";
5
- import { S as u } from "./sui-BYAvPQcW.mjs";
4
+ import { b6 as m, cc as w, K as g, bj as p } from "./index-CxsX-GTd.mjs";
5
+ import { S as u } from "./sui-CkWKHVrG.mjs";
6
6
  class c {
7
7
  constructor(e, r, t, n) {
8
8
  o(this, "network");
@@ -1 +1 @@
1
- "use strict";var l=Object.defineProperty;var y=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-C5v_43HR.js"),g=require("./unsignedTransaction-C1YeEl4G.js"),f=require("./aptos-C0fgCR3U.js"),w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],T=i=>s.serialize$1(w,i);class d{constructor(e,t,n,r){o(this,"network");o(this,"chain");o(this,"connection");o(this,"contracts");o(this,"chainId");o(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=n,this.contracts=r,this.chainId=s.toChainId(t);const a=r.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[n,r]=await f.AptosPlatform.chainFromRpc(e),a=t[r];if(a.network!==n)throw new Error("Network mismatch "+a.network+" !== "+n);return new d(n,r,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR),n=await this.connection.getAccountResource({accountAddress:t[0],resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`});if(!n)throw s.ErrNotWrapped(e.toString());const r=s.toChain(parseInt(n.token_chain.number)),a=new s.UniversalAddress(n.token_address.external_address);return{chain:r,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const n=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!n)throw new Error("Invalid asset address.");return new s.AptosAddress(n)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource({accountAddress:s.coalesceModuleAddress(t),resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`}),s.toNative(this.chain,t)}async isTransferCompleted(e){const n=(await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`})).consumed_vaas.elems.handle;try{return await this.connection.getTableItem({handle:n,data:{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const n={chain:this.chain,address:new s.AptosAddress(e)},r=await this.getAssetFullyQualifiedType(n);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,typeArguments:[r],functionArguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,typeArguments:[],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const n=await this.getAssetFullyQualifiedType(e.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,typeArguments:[n],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,n,r,a){const p=0n,c=0n,h=s.isNative(n)?s.APTOS_COIN:n.toString(),u=t.address.toUniversalAddress().toUint8Array(),A=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,typeArguments:[h],functionArguments:[r,A,u,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,typeArguments:[h],functionArguments:[r,A,u,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,n=!0){const r=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,typeArguments:[r],functionArguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`}),{handle:n}=t.native_infos,r=await this.connection.getTableItem({handle:n,data:{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}}});return r?[r.account_address,String.fromCharCode(...s.hex.decode(r.module_name)),String.fromCharCode(...s.hex.decode(r.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,n){if(s.isNative(n.address))throw new Error("Invalid token address");const r=T({chain:n.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:n.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(r),!0)}createUnsignedTx(e,t,n=!1){return new g.AptosUnsignedTransaction(e,this.network,this.chain,t,n)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
1
+ "use strict";var l=Object.defineProperty;var y=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-QKpno7AE.js"),g=require("./unsignedTransaction-C1YeEl4G.js"),f=require("./aptos-DYaLZIfV.js"),w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],T=i=>s.serialize$1(w,i);class d{constructor(e,t,n,r){o(this,"network");o(this,"chain");o(this,"connection");o(this,"contracts");o(this,"chainId");o(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=n,this.contracts=r,this.chainId=s.toChainId(t);const a=r.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[n,r]=await f.AptosPlatform.chainFromRpc(e),a=t[r];if(a.network!==n)throw new Error("Network mismatch "+a.network+" !== "+n);return new d(n,r,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR),n=await this.connection.getAccountResource({accountAddress:t[0],resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`});if(!n)throw s.ErrNotWrapped(e.toString());const r=s.toChain(parseInt(n.token_chain.number)),a=new s.UniversalAddress(n.token_address.external_address);return{chain:r,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const n=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!n)throw new Error("Invalid asset address.");return new s.AptosAddress(n)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource({accountAddress:s.coalesceModuleAddress(t),resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`}),s.toNative(this.chain,t)}async isTransferCompleted(e){const n=(await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`})).consumed_vaas.elems.handle;try{return await this.connection.getTableItem({handle:n,data:{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const n={chain:this.chain,address:new s.AptosAddress(e)},r=await this.getAssetFullyQualifiedType(n);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,typeArguments:[r],functionArguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,typeArguments:[],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const n=await this.getAssetFullyQualifiedType(e.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,typeArguments:[n],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,n,r,a){const p=0n,c=0n,h=s.isNative(n)?s.APTOS_COIN:n.toString(),u=t.address.toUniversalAddress().toUint8Array(),A=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,typeArguments:[h],functionArguments:[r,A,u,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,typeArguments:[h],functionArguments:[r,A,u,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,n=!0){const r=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,typeArguments:[r],functionArguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`}),{handle:n}=t.native_infos,r=await this.connection.getTableItem({handle:n,data:{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}}});return r?[r.account_address,String.fromCharCode(...s.hex.decode(r.module_name)),String.fromCharCode(...s.hex.decode(r.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,n){if(s.isNative(n.address))throw new Error("Invalid token address");const r=T({chain:n.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:n.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(r),!0)}createUnsignedTx(e,t,n=!1){return new g.AptosUnsignedTransaction(e,this.network,this.chain,t,n)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
@@ -1,4 +1,4 @@
1
- "use strict";var xr=Object.defineProperty;var Br=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var D=(t,e,r)=>Br(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index-C5v_43HR.js"),b=require("./sui-D0YPksGW.js");require("./index-BlZ-gXWP.js");const Ht=require("./unsignedTransaction-DzSLsK-p.js");class Cr extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:a}=e,o=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??o),s!=null&&(this.cause=o),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function $r(t){return K(t)&&typeof t[Symbol.iterator]=="function"}function K(t){return typeof t=="object"&&t!=null}function J(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Ur(t){const{done:e,value:r}=t.next();return e?void 0:r}function Pr(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:a,message:o=`Expected a value of type \`${c}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=t;return{value:n,type:c,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:o}}function*Lt(t,e,r,n){$r(t)||(t=[t]);for(const i of t){const s=Pr(i,e,r,n);s&&(yield s)}}function*lt(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),c&&e.type!=="type"&&K(e.schema)&&K(t)&&!Array.isArray(t)))for(const d in t)e.schema[d]===void 0&&delete t[d];let o="valid";for(const d of e.validator(t,a))d.explanation=r.message,o="not_valid",yield[d,void 0];for(let[d,u,h]of e.entries(t,a)){const m=lt(u,h,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,u],coerce:s,mask:c,message:r.message});for(const y of m)y[0]?(o=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(u=y[1],d===void 0?t=u:t instanceof Map?t.set(d,u):t instanceof Set?t.add(u):K(t)&&(u!==void 0||d in t)&&(t[d]=u))}if(o!=="not_valid")for(const d of e.refiner(t,a))d.explanation=r.message,o="not_refined",yield[d,void 0];o==="valid"&&(yield[void 0,t])}class te{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=o=>o,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=c,i?this.validator=(o,d)=>{const u=i(o,d);return Lt(u,d,this,o)}:this.validator=()=>[],s?this.refiner=(o,d)=>{const u=s(o,d);return Lt(u,d,this,o)}:this.refiner=()=>[]}assert(e,r){return nt(e,this,r)}create(e,r){return Xt(e,this,r)}is(e){return L(e,this)}mask(e,r){return Zt(e,this,r)}validate(e,r={}){return _e(e,this,r)}}function nt(t,e,r){const n=_e(t,e,{message:r});if(n[0])throw n[0]}function Xt(t,e,r){const n=_e(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Zt(t,e,r){const n=_e(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(t,e){return!_e(t,e)[0]}function _e(t,e,r={}){const n=lt(t,e,r),i=Ur(n);return i[0]?[new Cr(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function je(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Rr(n):p(n)}function W(t,e){return new te({type:t,schema:null,validator:e})}function it(){return W("any",()=>!0)}function E(t){return new te({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${J(e)}`}})}function Mr(){return W("bigint",t=>typeof t=="bigint")}function z(){return W("boolean",t=>typeof t=="boolean")}function ee(){return W("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${J(t)}`)}function k(t){const e=J(t),r=typeof t;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${J(n)}`}})}function Yt(){return W("never",()=>!1)}function $(t){return new te({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function ge(){return W("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${J(t)}`)}function p(t){const e=t?Object.keys(t):[],r=Yt();return new te({type:"object",schema:t||null,*entries(n){if(t&&K(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function v(t){return new te({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Q(t,e){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function g(){return W("string",t=>typeof t=="string"||`Expected a string, but received: ${J(t)}`)}function Qt(t){const e=Yt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(t){const e=Object.keys(t);return new te({type:"type",schema:t,*entries(r){if(K(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(t){const e=t.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=lt(r,s,n),[a]=c;if(a[0])for(const[o]of c)o&&i.push(o);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${J(r)}`,...i]}})}function er(){return W("unknown",()=>!0)}const ft=U([p({AddressOwner:g()}),p({ObjectOwner:g()}),p({Shared:p({initial_shared_version:$(g())})}),k("Immutable")]);W("SuiJsonValue",()=>!0);const Nr=U([p({u32:g()}),p({u64:g()}),p({f64:g()})]);p({attributes:Q(g(),$(Nr)),featureFlags:Q(g(),z()),maxSupportedProtocolVersion:g(),minSupportedProtocolVersion:g(),protocolVersion:g()});U([g(),k("package")]);const ce=p({digest:g(),objectId:g(),version:U([ge(),g(),Mr()])});p({owner:ft,reference:ce});p({objectId:g(),sequenceNumber:g()});p({payment:E(ce),owner:g(),price:g(),budget:g()});const Dr=je(ce,p({type:g(),owner:ft,previousTransaction:g()})),Vr=Q(g(),it()),zr=Q(g(),er()),Fr=p({type:g(),fields:Vr,hasPublicTransfer:z()}),Gr=p({disassembled:zr}),Lr=U([je(Fr,p({dataType:k("moveObject")})),je(Gr,p({dataType:k("package")}))]),Wr=p({type:g(),hasPublicTransfer:z(),version:g(),bcsBytes:g()}),Kr=p({id:g(),moduleMap:Q(g(),g())}),Jr=U([je(Wr,p({dataType:k("moveObject")})),je(Kr,p({dataType:k("package")}))]);BigInt(1e9);const tr=p({code:g(),error:v(g()),object_id:v(g()),parent_object_id:v(g()),version:v(g()),digest:v(g())}),qr=p({data:$(v(Q(g(),g()))),error:$(v(tr))}),Hr=U([qr,v(Q(g(),g()))]),rr=p({objectId:g(),version:g(),digest:g(),type:$(v(g())),content:$(v(Lr)),bcs:$(v(Jr)),owner:$(v(ft)),previousTransaction:$(v(g())),storageRebate:$(v(g())),display:$(v(Hr))});p({showType:$(v(z())),showContent:$(v(z())),showBcs:$(v(z())),showOwner:$(v(z())),showPreviousTransaction:$(v(z())),showStorageRebate:$(v(z())),showDisplay:$(v(z()))});U([k("Exists"),k("notExists"),k("Deleted")]);E(Dr);const Xr=p({data:$(v(rr)),error:$(v(tr))});function Zr(t){return t.data}function Yr(t){if(t.error&&"object_id"in t.error&&"version"in t.error&&"digest"in t.error){const e=t.error;return{objectId:e.object_id,version:e.version,digest:e.digest}}}function Wt(t){if("reference"in t)return t.reference;const e=Zr(t);return e?{objectId:e.objectId,version:e.version,digest:e.digest}:Yr(t)}p({objectId:g(),atCheckpoint:v(ge())});p({data:E(Xr),nextCursor:v($(g())),hasNextPage:z()});U([p({details:rr,status:k("VersionFound")}),p({details:g(),status:k("ObjectNotExists")}),p({details:ce,status:k("ObjectDeleted")}),p({details:Qt([g(),ge()]),status:k("VersionNotFound")}),p({details:p({asked_version:ge(),latest_version:ge(),object_id:g()}),status:k("VersionTooHigh")})]);const Qr=U([g(),p({Object:g()})]);E(Qr);const en=p({address:g(),name:g()}),tn=U([k("Private"),k("Public"),k("Friend")]),gt=p({abilities:E(g())}),rn=p({constraints:gt,isPhantom:z()}),nn=p({TypeParameter:ge()}),Xe=Qt([p({module:g(),package:g(),function:g()}),g()]);p({rank3Days:E(Xe),rank7Days:E(Xe),rank30Days:E(Xe)});function nr(t){if(!t)return!1;if(typeof t=="string"||L(t,nn)||ir(t))return!0;if(typeof t!="object")return!1;const e=t;return!!(L(e.Reference,me)||L(e.MutableReference,me)||L(e.Vector,me))}const me=W("SuiMoveNormalizedType",nr);function ir(t){if(!t||typeof t!="object")return!1;const e=t;if(!e.Struct||typeof e.Struct!="object")return!1;const r=e.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>nr(n)))}W("SuiMoveNormalizedStructType",ir);const sn=p({visibility:tn,isEntry:z(),typeParameters:E(gt),parameters:E(me),return:E(me)}),an=p({name:g(),type:me}),on=p({abilities:gt,typeParameters:E(rn),fields:E(an)}),cn=p({fileFormatVersion:ge(),address:g(),name:g(),friends:E(en),structs:Q(g(),on),exposedFunctions:Q(g(),sn)});Q(g(),cn);function st(t){return typeof t=="object"&&"MutableReference"in t?t.MutableReference:void 0}function sr(t){return typeof t=="object"&&"Reference"in t?t.Reference:void 0}function ht(t){if(typeof t=="object"&&"Struct"in t)return t;const e=sr(t),r=st(t);if(typeof e=="object"&&"Struct"in e)return e;if(typeof r=="object"&&"Struct"in r)return r}function un(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var c=t.length,a=t.charAt(0),o=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var S=0,T=0,f=0,O=y.length;f!==O&&y[f]===0;)f++,S++;for(var B=(O-f)*d+1>>>0,P=new Uint8Array(B);f!==O;){for(var A=y[f],j=0,M=B-1;(A!==0||j<T)&&M!==-1;M--,j++)A+=256*P[M]>>>0,P[M]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=j,f++}for(var q=B-T;q!==B&&P[q]===0;)q++;for(var pe=a.repeat(S);q<B;++q)pe+=t.charAt(P[q]);return pe}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var S=0,T=0,f=0;y[S]===a;)T++,S++;for(var O=(y.length-S)*o+1>>>0,B=new Uint8Array(O);y[S];){var P=e[y.charCodeAt(S)];if(P===255)return;for(var A=0,j=O-1;(P!==0||A<f)&&j!==-1;j--,A++)P+=c*B[j]>>>0,B[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,S++}for(var M=O-f;M!==O&&B[M]===0;)M++;for(var q=new Uint8Array(T+(O-M)),pe=T;M!==O;)q[pe++]=B[M++];return q}function m(y){var S=h(y);if(S)return S;throw new Error("Non-base"+c+" character")}return{encode:u,decodeUnsafe:h,decode:m}}var dn=un;const ln=dn,fn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var gn=ln(fn);const ar=w.getDefaultExportFromCjs(gn),xe=t=>ar.encode(t),pt=t=>ar.decode(t);function ue(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const Ze=8192;function Be(t){if(t.length<Ze)return btoa(String.fromCharCode(...t));let e="";for(var r=0;r<t.length;r+=Ze){const n=t.slice(r,r+Ze);e+=String.fromCharCode(...n)}return btoa(e)}function Je(t){var i;const e=t.startsWith("0x")?t.slice(2):t,n=((i=(e.length%2===0?e:`0${e}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function Ce(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function yt(t){let e=[],r=0;if(t===0)return[0];for(;t>0;)e[r]=t&127,(t>>=7)&&(e[r]|=128),r+=1;return e}function hn(t){let e=0,r=0,n=0;for(;;){let i=t[n];if(n+=1,e|=(i&127)<<r,!(i&128))break;r+=7}return{value:e,length:n}}class or{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,e),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(e){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(e(this,i,r));return n}}function pn(t,e){switch(e){case"base58":return xe(t);case"base64":return Be(t);case"hex":return Ce(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yn(t,e){switch(e){case"base58":return pt(t);case"base64":return ue(t);case"hex":return Je(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function mt(t,e=["<",">"]){const[r,n]=e,i=[];let s="",c=0;for(let a=0;a<t.length;a++){const o=t[a];if(o===r&&c++,o===n&&c--,c===0&&o===","){i.push(s.trim()),s="";continue}s+=o}return i.push(s.trim()),i}class cr{constructor({size:e=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=r||e,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const r=this.bytePosition+e;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Ye(BigInt(e),8).forEach(r=>this.write8(r)),this}write128(e){return Ye(BigInt(e),16).forEach(r=>this.write8(r)),this}write256(e){return Ye(BigInt(e),32).forEach(r=>this.write8(r)),this}writeULEB(e){return yt(e).forEach(r=>this.write8(r)),this}writeVec(e,r){return this.writeULEB(e.length),Array.from(e).forEach((n,i)=>r(this,n,i,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return pn(this.toBytes(),e)}}function Ye(t,e){let r=new Uint8Array(e),n=0;for(;t>0;)r[n]=Number(t%BigInt(256)),t=t/BigInt(256),n+=1;return r}var ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},X=(t,e,r)=>(ur(t,e,"read from private field"),r?r.call(t):e.get(t)),ze=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Fe=(t,e,r,n)=>(ur(t,e,"write to private field"),e.set(t,r),r),ye,Se,Me,ae;const dr=class{constructor(t){ze(this,ye,void 0),ze(this,Se,void 0),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fe(this,ye,t.write),Fe(this,Se,t.serialize??((e,r)=>{const n=new cr({size:this.serializedSize(e)??void 0,...r});return X(this,ye).call(this,e,n),n.toBytes()})),this.validate=t.validate??(()=>{})}write(t,e){this.validate(t),X(this,ye).call(this,t,e)}serialize(t,e){return this.validate(t),new mn(this,X(this,Se).call(this,t,e))}parse(t){const e=new or(t);return this.read(e)}transform({name:t,input:e,output:r}){return new dr({name:t??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ye).call(this,e(n),i),serializedSize:n=>this.serializedSize(e(n)),serialize:(n,i)=>X(this,Se).call(this,e(n),i),validate:n=>this.validate(e(n))})}};let Z=dr;ye=new WeakMap;Se=new WeakMap;const lr=Symbol.for("@mysten/serialized-bcs");function wt(t){return!!t&&typeof t=="object"&&t[lr]===!0}class mn{constructor(e,r){ze(this,Me,void 0),ze(this,ae,void 0),Fe(this,Me,e),Fe(this,ae,r)}get[lr](){return!0}toBytes(){return X(this,ae)}toHex(){return Ce(X(this,ae))}toBase64(){return Be(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Ge({size:t,...e}){return new Z({...e,serializedSize:()=>t})}function Qe({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function et({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function wn({serialize:t,...e}){const r=new Z({...e,serialize:t,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function bn({toBytes:t,fromBytes:e,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return e(s)},write:(n,i)=>{const s=t(n);i.writeULEB(s.length);for(let c=0;c<s.length;c++)i.write8(s[c])},serialize:n=>{const i=t(n),s=yt(i.length),c=new Uint8Array(s.length+i.length);return c.set(s,0),c.set(i,s.length),c},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function Sn(t){let e=null;function r(){return e||(e=t()),e}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const l={u8(t){return Qe({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...t})},u16(t){return Qe({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...t})},u32(t){return Qe({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...t})},u64(t){return et({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...t})},u128(t){return et({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...t})},u256(t){return et({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...t})},bool(t){return Ge({name:"bool",size:1,read:e=>e.read8()===1,write:(e,r)=>r.write8(e?1:0),...t,validate:e=>{var r;if((r=t==null?void 0:t.validate)==null||r.call(t,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(t){return wn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(yt(e)),...t})},bytes(t,e){return Ge({name:`bytes[${t}]`,size:t,read:r=>r.readBytes(t),write:(r,n)=>{for(let i=0;i<t;i++)n.write8(r[i]??0)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t)throw new TypeError(`Expected array of length ${t}, found ${r.length}`)}})},string(t){return bn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...t})},fixedArray(t,e,r){return new Z({name:`${e.name}[${t}]`,read:n=>{const i=new Array(t);for(let s=0;s<t;s++)i[s]=e.read(n);return i},write:(n,i)=>{for(const s of n)e.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==t)throw new TypeError(`Expected array of length ${t}, found ${n.length}`)}})},option(t){return l.enum(`Option<${t.name}>`,{None:null,Some:t}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>"Some"in e?e.Some:null})},vector(t,e){return new Z({name:`vector<${t.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=t.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)t.write(i,n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(t,e){return new Z({name:`(${t.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<t.length;i++){const s=t[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of t)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<t.length;i++)t[i].write(r[i],n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t.length)throw new TypeError(`Expected array of length ${t.length}, found ${r.length}`)}})},struct(t,e,r){const n=Object.entries(e);return new Z({name:t,serializedSize:i=>{let s=0;for(const[c,a]of n){const o=a.serializedSize(i[c]);if(o==null)return null;s+=o}return s},read:i=>{const s={};for(const[c,a]of n)s[c]=a.read(i);return s},write:(i,s)=>{for(const[c,a]of n)a.write(i[c],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(t,e,r){const n=Object.entries(e);return new Z({name:t,read:i=>{const s=i.readULEB(),[c,a]=n[s];return{[c]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[c,a]=Object.entries(i)[0];for(let o=0;o<n.length;o++){const[d,u]=n[o];if(d===c){s.writeULEB(o),u==null||u.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[c]=s;if(!Object.hasOwn(e,c))throw new TypeError(`Invalid enum variant ${c}`)}})},map(t,e){return l.vector(l.tuple([t,e])).transform({name:`Map<${t.name}, ${e.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(t,e){return(...r)=>e(...r).transform({name:`${e.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(t){return Sn(t)}},Tn=32,Te=class{constructor(t){if(this.types=new Map,this.counter=0,t instanceof Te){this.schema=t.schema,this.types=new Map(t.types);return}if(this.schema=t,this.registerAddressType(Te.ADDRESS,t.addressLength,t.addressEncoding),this.registerVectorType(t.vectorType),t.types&&t.types.structs)for(let e of Object.keys(t.types.structs))this.registerStructType(e,t.types.structs[e]);if(t.types&&t.types.enums)for(let e of Object.keys(t.types.enums))this.registerEnumType(e,t.types.enums[e]);if(t.types&&t.types.aliases)for(let e of Object.keys(t.types.aliases))this.registerAlias(e,t.types.aliases[e]);t.withPrimitives!==!1&&vn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(t,e,r){if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).encode(this,e,r,i)}if(typeof t=="object"){const n=this.tempKey();return new Te(this).registerStructType(n,t).ser(n,e,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
1
+ "use strict";var xr=Object.defineProperty;var Br=(t,e,r)=>e in t?xr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r;var D=(t,e,r)=>Br(t,typeof e!="symbol"?e+"":e,r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("./index-QKpno7AE.js"),b=require("./sui-DetJUCZm.js");require("./index-ruyCJXyG.js");const Ht=require("./unsignedTransaction-DzSLsK-p.js");class Cr extends TypeError{constructor(e,r){let n;const{message:i,explanation:s,...c}=e,{path:a}=e,o=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??o),s!=null&&(this.cause=o),Object.assign(this,c),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function $r(t){return K(t)&&typeof t[Symbol.iterator]=="function"}function K(t){return typeof t=="object"&&t!=null}function J(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Ur(t){const{done:e,value:r}=t.next();return e?void 0:r}function Pr(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:i,branch:s}=e,{type:c}=r,{refinement:a,message:o=`Expected a value of type \`${c}\`${a?` with refinement \`${a}\``:""}, but received: \`${J(n)}\``}=t;return{value:n,type:c,refinement:a,key:i[i.length-1],path:i,branch:s,...t,message:o}}function*Lt(t,e,r,n){$r(t)||(t=[t]);for(const i of t){const s=Pr(i,e,r,n);s&&(yield s)}}function*lt(t,e,r={}){const{path:n=[],branch:i=[t],coerce:s=!1,mask:c=!1}=r,a={path:n,branch:i};if(s&&(t=e.coercer(t,a),c&&e.type!=="type"&&K(e.schema)&&K(t)&&!Array.isArray(t)))for(const d in t)e.schema[d]===void 0&&delete t[d];let o="valid";for(const d of e.validator(t,a))d.explanation=r.message,o="not_valid",yield[d,void 0];for(let[d,u,h]of e.entries(t,a)){const m=lt(u,h,{path:d===void 0?n:[...n,d],branch:d===void 0?i:[...i,u],coerce:s,mask:c,message:r.message});for(const y of m)y[0]?(o=y[0].refinement!=null?"not_refined":"not_valid",yield[y[0],void 0]):s&&(u=y[1],d===void 0?t=u:t instanceof Map?t.set(d,u):t instanceof Set?t.add(u):K(t)&&(u!==void 0||d in t)&&(t[d]=u))}if(o!=="not_valid")for(const d of e.refiner(t,a))d.explanation=r.message,o="not_refined",yield[d,void 0];o==="valid"&&(yield[void 0,t])}class te{constructor(e){const{type:r,schema:n,validator:i,refiner:s,coercer:c=o=>o,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=c,i?this.validator=(o,d)=>{const u=i(o,d);return Lt(u,d,this,o)}:this.validator=()=>[],s?this.refiner=(o,d)=>{const u=s(o,d);return Lt(u,d,this,o)}:this.refiner=()=>[]}assert(e,r){return nt(e,this,r)}create(e,r){return Xt(e,this,r)}is(e){return L(e,this)}mask(e,r){return Zt(e,this,r)}validate(e,r={}){return _e(e,this,r)}}function nt(t,e,r){const n=_e(t,e,{message:r});if(n[0])throw n[0]}function Xt(t,e,r){const n=_e(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Zt(t,e,r){const n=_e(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function L(t,e){return!_e(t,e)[0]}function _e(t,e,r={}){const n=lt(t,e,r),i=Ur(n);return i[0]?[new Cr(i[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,i[1]]}function je(...t){const e=t[0].type==="type",r=t.map(i=>i.schema),n=Object.assign({},...r);return e?Rr(n):p(n)}function W(t,e){return new te({type:t,schema:null,validator:e})}function it(){return W("any",()=>!0)}function E(t){return new te({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${J(e)}`}})}function Mr(){return W("bigint",t=>typeof t=="bigint")}function z(){return W("boolean",t=>typeof t=="boolean")}function ee(){return W("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${J(t)}`)}function k(t){const e=J(t),r=typeof t;return new te({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${J(n)}`}})}function Yt(){return W("never",()=>!1)}function $(t){return new te({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function ge(){return W("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${J(t)}`)}function p(t){const e=t?Object.keys(t):[],r=Yt();return new te({type:"object",schema:t||null,*entries(n){if(t&&K(n)){const i=new Set(Object.keys(n));for(const s of e)i.delete(s),yield[s,n[s],t[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return K(n)||`Expected an object, but received: ${J(n)}`},coercer(n){return K(n)?{...n}:n}})}function v(t){return new te({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Q(t,e){return new te({type:"record",schema:null,*entries(r){if(K(r))for(const n in r){const i=r[n];yield[n,n,t],yield[n,i,e]}},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`}})}function g(){return W("string",t=>typeof t=="string"||`Expected a string, but received: ${J(t)}`)}function Qt(t){const e=Yt();return new te({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],t[i]||e]}},validator(r){return Array.isArray(r)||`Expected an array, but received: ${J(r)}`}})}function Rr(t){const e=Object.keys(t);return new te({type:"type",schema:t,*entries(r){if(K(r))for(const n of e)yield[n,r[n],t[n]]},validator(r){return K(r)||`Expected an object, but received: ${J(r)}`},coercer(r){return K(r)?{...r}:r}})}function U(t){const e=t.map(r=>r.type).join(" | ");return new te({type:"union",schema:null,coercer(r){for(const n of t){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of t){const[...c]=lt(r,s,n),[a]=c;if(a[0])for(const[o]of c)o&&i.push(o);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${J(r)}`,...i]}})}function er(){return W("unknown",()=>!0)}const ft=U([p({AddressOwner:g()}),p({ObjectOwner:g()}),p({Shared:p({initial_shared_version:$(g())})}),k("Immutable")]);W("SuiJsonValue",()=>!0);const Nr=U([p({u32:g()}),p({u64:g()}),p({f64:g()})]);p({attributes:Q(g(),$(Nr)),featureFlags:Q(g(),z()),maxSupportedProtocolVersion:g(),minSupportedProtocolVersion:g(),protocolVersion:g()});U([g(),k("package")]);const ce=p({digest:g(),objectId:g(),version:U([ge(),g(),Mr()])});p({owner:ft,reference:ce});p({objectId:g(),sequenceNumber:g()});p({payment:E(ce),owner:g(),price:g(),budget:g()});const Dr=je(ce,p({type:g(),owner:ft,previousTransaction:g()})),Vr=Q(g(),it()),zr=Q(g(),er()),Fr=p({type:g(),fields:Vr,hasPublicTransfer:z()}),Gr=p({disassembled:zr}),Lr=U([je(Fr,p({dataType:k("moveObject")})),je(Gr,p({dataType:k("package")}))]),Wr=p({type:g(),hasPublicTransfer:z(),version:g(),bcsBytes:g()}),Kr=p({id:g(),moduleMap:Q(g(),g())}),Jr=U([je(Wr,p({dataType:k("moveObject")})),je(Kr,p({dataType:k("package")}))]);BigInt(1e9);const tr=p({code:g(),error:v(g()),object_id:v(g()),parent_object_id:v(g()),version:v(g()),digest:v(g())}),qr=p({data:$(v(Q(g(),g()))),error:$(v(tr))}),Hr=U([qr,v(Q(g(),g()))]),rr=p({objectId:g(),version:g(),digest:g(),type:$(v(g())),content:$(v(Lr)),bcs:$(v(Jr)),owner:$(v(ft)),previousTransaction:$(v(g())),storageRebate:$(v(g())),display:$(v(Hr))});p({showType:$(v(z())),showContent:$(v(z())),showBcs:$(v(z())),showOwner:$(v(z())),showPreviousTransaction:$(v(z())),showStorageRebate:$(v(z())),showDisplay:$(v(z()))});U([k("Exists"),k("notExists"),k("Deleted")]);E(Dr);const Xr=p({data:$(v(rr)),error:$(v(tr))});function Zr(t){return t.data}function Yr(t){if(t.error&&"object_id"in t.error&&"version"in t.error&&"digest"in t.error){const e=t.error;return{objectId:e.object_id,version:e.version,digest:e.digest}}}function Wt(t){if("reference"in t)return t.reference;const e=Zr(t);return e?{objectId:e.objectId,version:e.version,digest:e.digest}:Yr(t)}p({objectId:g(),atCheckpoint:v(ge())});p({data:E(Xr),nextCursor:v($(g())),hasNextPage:z()});U([p({details:rr,status:k("VersionFound")}),p({details:g(),status:k("ObjectNotExists")}),p({details:ce,status:k("ObjectDeleted")}),p({details:Qt([g(),ge()]),status:k("VersionNotFound")}),p({details:p({asked_version:ge(),latest_version:ge(),object_id:g()}),status:k("VersionTooHigh")})]);const Qr=U([g(),p({Object:g()})]);E(Qr);const en=p({address:g(),name:g()}),tn=U([k("Private"),k("Public"),k("Friend")]),gt=p({abilities:E(g())}),rn=p({constraints:gt,isPhantom:z()}),nn=p({TypeParameter:ge()}),Xe=Qt([p({module:g(),package:g(),function:g()}),g()]);p({rank3Days:E(Xe),rank7Days:E(Xe),rank30Days:E(Xe)});function nr(t){if(!t)return!1;if(typeof t=="string"||L(t,nn)||ir(t))return!0;if(typeof t!="object")return!1;const e=t;return!!(L(e.Reference,me)||L(e.MutableReference,me)||L(e.Vector,me))}const me=W("SuiMoveNormalizedType",nr);function ir(t){if(!t||typeof t!="object")return!1;const e=t;if(!e.Struct||typeof e.Struct!="object")return!1;const r=e.Struct;return!(typeof r.address!="string"||typeof r.module!="string"||typeof r.name!="string"||!Array.isArray(r.typeArguments)||!r.typeArguments.every(n=>nr(n)))}W("SuiMoveNormalizedStructType",ir);const sn=p({visibility:tn,isEntry:z(),typeParameters:E(gt),parameters:E(me),return:E(me)}),an=p({name:g(),type:me}),on=p({abilities:gt,typeParameters:E(rn),fields:E(an)}),cn=p({fileFormatVersion:ge(),address:g(),name:g(),friends:E(en),structs:Q(g(),on),exposedFunctions:Q(g(),sn)});Q(g(),cn);function st(t){return typeof t=="object"&&"MutableReference"in t?t.MutableReference:void 0}function sr(t){return typeof t=="object"&&"Reference"in t?t.Reference:void 0}function ht(t){if(typeof t=="object"&&"Struct"in t)return t;const e=sr(t),r=st(t);if(typeof e=="object"&&"Struct"in e)return e;if(typeof r=="object"&&"Struct"in r)return r}function un(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var n=0;n<t.length;n++){var i=t.charAt(n),s=i.charCodeAt(0);if(e[s]!==255)throw new TypeError(i+" is ambiguous");e[s]=n}var c=t.length,a=t.charAt(0),o=Math.log(c)/Math.log(256),d=Math.log(256)/Math.log(c);function u(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var S=0,T=0,f=0,O=y.length;f!==O&&y[f]===0;)f++,S++;for(var B=(O-f)*d+1>>>0,P=new Uint8Array(B);f!==O;){for(var A=y[f],j=0,M=B-1;(A!==0||j<T)&&M!==-1;M--,j++)A+=256*P[M]>>>0,P[M]=A%c>>>0,A=A/c>>>0;if(A!==0)throw new Error("Non-zero carry");T=j,f++}for(var q=B-T;q!==B&&P[q]===0;)q++;for(var pe=a.repeat(S);q<B;++q)pe+=t.charAt(P[q]);return pe}function h(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;for(var S=0,T=0,f=0;y[S]===a;)T++,S++;for(var O=(y.length-S)*o+1>>>0,B=new Uint8Array(O);y[S];){var P=e[y.charCodeAt(S)];if(P===255)return;for(var A=0,j=O-1;(P!==0||A<f)&&j!==-1;j--,A++)P+=c*B[j]>>>0,B[j]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");f=A,S++}for(var M=O-f;M!==O&&B[M]===0;)M++;for(var q=new Uint8Array(T+(O-M)),pe=T;M!==O;)q[pe++]=B[M++];return q}function m(y){var S=h(y);if(S)return S;throw new Error("Non-base"+c+" character")}return{encode:u,decodeUnsafe:h,decode:m}}var dn=un;const ln=dn,fn="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";var gn=ln(fn);const ar=w.getDefaultExportFromCjs(gn),xe=t=>ar.encode(t),pt=t=>ar.decode(t);function ue(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}const Ze=8192;function Be(t){if(t.length<Ze)return btoa(String.fromCharCode(...t));let e="";for(var r=0;r<t.length;r+=Ze){const n=t.slice(r,r+Ze);e+=String.fromCharCode(...n)}return btoa(e)}function Je(t){var i;const e=t.startsWith("0x")?t.slice(2):t,n=((i=(e.length%2===0?e:`0${e}}`).match(/.{2}/g))==null?void 0:i.map(s=>parseInt(s,16)))??[];return Uint8Array.from(n)}function Ce(t){return t.reduce((e,r)=>e+r.toString(16).padStart(2,"0"),"")}function yt(t){let e=[],r=0;if(t===0)return[0];for(;t>0;)e[r]=t&127,(t>>=7)&&(e[r]|=128),r+=1;return e}function hn(t){let e=0,r=0,n=0;for(;;){let i=t[n];if(n+=1,e|=(i&127)<<r,!(i&128))break;r+=7}return{value:e,length:n}}class or{constructor(e){this.bytePosition=0,this.dataView=new DataView(e.buffer)}shift(e){return this.bytePosition+=e,this}read8(){let e=this.dataView.getUint8(this.bytePosition);return this.shift(1),e}read16(){let e=this.dataView.getUint16(this.bytePosition,!0);return this.shift(2),e}read32(){let e=this.dataView.getUint32(this.bytePosition,!0);return this.shift(4),e}read64(){let e=this.read32(),n=this.read32().toString(16)+e.toString(16).padStart(8,"0");return BigInt("0x"+n).toString(10)}read128(){let e=BigInt(this.read64()),n=BigInt(this.read64()).toString(16)+e.toString(16).padStart(16,"0");return BigInt("0x"+n).toString(10)}read256(){let e=BigInt(this.read128()),n=BigInt(this.read128()).toString(16)+e.toString(16).padStart(32,"0");return BigInt("0x"+n).toString(10)}readBytes(e){let r=this.bytePosition+this.dataView.byteOffset,n=new Uint8Array(this.dataView.buffer,r,e);return this.shift(e),n}readULEB(){let e=this.bytePosition+this.dataView.byteOffset,r=new Uint8Array(this.dataView.buffer,e),{value:n,length:i}=hn(r);return this.shift(i),n}readVec(e){let r=this.readULEB(),n=[];for(let i=0;i<r;i++)n.push(e(this,i,r));return n}}function pn(t,e){switch(e){case"base58":return xe(t);case"base64":return Be(t);case"hex":return Ce(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function yn(t,e){switch(e){case"base58":return pt(t);case"base64":return ue(t);case"hex":return Je(t);default:throw new Error("Unsupported encoding, supported values are: base64, hex")}}function mt(t,e=["<",">"]){const[r,n]=e,i=[];let s="",c=0;for(let a=0;a<t.length;a++){const o=t[a];if(o===r&&c++,o===n&&c--,c===0&&o===","){i.push(s.trim()),s="";continue}s+=o}return i.push(s.trim()),i}class cr{constructor({size:e=1024,maxSize:r,allocateSize:n=1024}={}){this.bytePosition=0,this.size=e,this.maxSize=r||e,this.allocateSize=n,this.dataView=new DataView(new ArrayBuffer(e))}ensureSizeOrGrow(e){const r=this.bytePosition+e;if(r>this.size){const n=Math.min(this.maxSize,this.size+this.allocateSize);if(r>n)throw new Error(`Attempting to serialize to BCS, but buffer does not have enough size. Allocated size: ${this.size}, Max size: ${this.maxSize}, Required size: ${r}`);this.size=n;const i=new ArrayBuffer(this.size);new Uint8Array(i).set(new Uint8Array(this.dataView.buffer)),this.dataView=new DataView(i)}}shift(e){return this.bytePosition+=e,this}write8(e){return this.ensureSizeOrGrow(1),this.dataView.setUint8(this.bytePosition,Number(e)),this.shift(1)}write16(e){return this.ensureSizeOrGrow(2),this.dataView.setUint16(this.bytePosition,Number(e),!0),this.shift(2)}write32(e){return this.ensureSizeOrGrow(4),this.dataView.setUint32(this.bytePosition,Number(e),!0),this.shift(4)}write64(e){return Ye(BigInt(e),8).forEach(r=>this.write8(r)),this}write128(e){return Ye(BigInt(e),16).forEach(r=>this.write8(r)),this}write256(e){return Ye(BigInt(e),32).forEach(r=>this.write8(r)),this}writeULEB(e){return yt(e).forEach(r=>this.write8(r)),this}writeVec(e,r){return this.writeULEB(e.length),Array.from(e).forEach((n,i)=>r(this,n,i,e.length)),this}*[Symbol.iterator](){for(let e=0;e<this.bytePosition;e++)yield this.dataView.getUint8(e);return this.toBytes()}toBytes(){return new Uint8Array(this.dataView.buffer.slice(0,this.bytePosition))}toString(e){return pn(this.toBytes(),e)}}function Ye(t,e){let r=new Uint8Array(e),n=0;for(;t>0;)r[n]=Number(t%BigInt(256)),t=t/BigInt(256),n+=1;return r}var ur=(t,e,r)=>{if(!e.has(t))throw TypeError("Cannot "+r)},X=(t,e,r)=>(ur(t,e,"read from private field"),r?r.call(t):e.get(t)),ze=(t,e,r)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,r)},Fe=(t,e,r,n)=>(ur(t,e,"write to private field"),e.set(t,r),r),ye,Se,Me,ae;const dr=class{constructor(t){ze(this,ye,void 0),ze(this,Se,void 0),this.name=t.name,this.read=t.read,this.serializedSize=t.serializedSize??(()=>null),Fe(this,ye,t.write),Fe(this,Se,t.serialize??((e,r)=>{const n=new cr({size:this.serializedSize(e)??void 0,...r});return X(this,ye).call(this,e,n),n.toBytes()})),this.validate=t.validate??(()=>{})}write(t,e){this.validate(t),X(this,ye).call(this,t,e)}serialize(t,e){return this.validate(t),new mn(this,X(this,Se).call(this,t,e))}parse(t){const e=new or(t);return this.read(e)}transform({name:t,input:e,output:r}){return new dr({name:t??this.name,read:n=>r(this.read(n)),write:(n,i)=>X(this,ye).call(this,e(n),i),serializedSize:n=>this.serializedSize(e(n)),serialize:(n,i)=>X(this,Se).call(this,e(n),i),validate:n=>this.validate(e(n))})}};let Z=dr;ye=new WeakMap;Se=new WeakMap;const lr=Symbol.for("@mysten/serialized-bcs");function wt(t){return!!t&&typeof t=="object"&&t[lr]===!0}class mn{constructor(e,r){ze(this,Me,void 0),ze(this,ae,void 0),Fe(this,Me,e),Fe(this,ae,r)}get[lr](){return!0}toBytes(){return X(this,ae)}toHex(){return Ce(X(this,ae))}toBase64(){return Be(X(this,ae))}toBase58(){return xe(X(this,ae))}parse(){return X(this,Me).parse(X(this,ae))}}Me=new WeakMap;ae=new WeakMap;function Ge({size:t,...e}){return new Z({...e,serializedSize:()=>t})}function Qe({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](n),validate:n=>{var i;if(n<0||n>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${n}. Expected value in range 0-${r.maxValue}`);(i=r.validate)==null||i.call(r,n)}})}function et({readMethod:t,writeMethod:e,...r}){return Ge({...r,read:n=>n[t](),write:(n,i)=>i[e](BigInt(n)),validate:n=>{var s;const i=BigInt(n);if(i<0||i>r.maxValue)throw new TypeError(`Invalid ${r.name} value: ${i}. Expected value in range 0-${r.maxValue}`);(s=r.validate)==null||s.call(r,i)}})}function wn({serialize:t,...e}){const r=new Z({...e,serialize:t,write:(n,i)=>{for(const s of r.serialize(n).toBytes())i.write8(s)}});return r}function bn({toBytes:t,fromBytes:e,...r}){return new Z({...r,read:n=>{const i=n.readULEB(),s=n.readBytes(i);return e(s)},write:(n,i)=>{const s=t(n);i.writeULEB(s.length);for(let c=0;c<s.length;c++)i.write8(s[c])},serialize:n=>{const i=t(n),s=yt(i.length),c=new Uint8Array(s.length+i.length);return c.set(s,0),c.set(i,s.length),c},validate:n=>{var i;if(typeof n!="string")throw new TypeError(`Invalid ${r.name} value: ${n}. Expected string`);(i=r.validate)==null||i.call(r,n)}})}function Sn(t){let e=null;function r(){return e||(e=t()),e}return new Z({name:"lazy",read:n=>r().read(n),serializedSize:n=>r().serializedSize(n),write:(n,i)=>r().write(n,i),serialize:(n,i)=>r().serialize(n,i).toBytes()})}const l={u8(t){return Qe({name:"u8",readMethod:"read8",writeMethod:"write8",size:1,maxValue:2**8-1,...t})},u16(t){return Qe({name:"u16",readMethod:"read16",writeMethod:"write16",size:2,maxValue:2**16-1,...t})},u32(t){return Qe({name:"u32",readMethod:"read32",writeMethod:"write32",size:4,maxValue:2**32-1,...t})},u64(t){return et({name:"u64",readMethod:"read64",writeMethod:"write64",size:8,maxValue:2n**64n-1n,...t})},u128(t){return et({name:"u128",readMethod:"read128",writeMethod:"write128",size:16,maxValue:2n**128n-1n,...t})},u256(t){return et({name:"u256",readMethod:"read256",writeMethod:"write256",size:32,maxValue:2n**256n-1n,...t})},bool(t){return Ge({name:"bool",size:1,read:e=>e.read8()===1,write:(e,r)=>r.write8(e?1:0),...t,validate:e=>{var r;if((r=t==null?void 0:t.validate)==null||r.call(t,e),typeof e!="boolean")throw new TypeError(`Expected boolean, found ${typeof e}`)}})},uleb128(t){return wn({name:"uleb128",read:e=>e.readULEB(),serialize:e=>Uint8Array.from(yt(e)),...t})},bytes(t,e){return Ge({name:`bytes[${t}]`,size:t,read:r=>r.readBytes(t),write:(r,n)=>{for(let i=0;i<t;i++)n.write8(r[i]??0)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t)throw new TypeError(`Expected array of length ${t}, found ${r.length}`)}})},string(t){return bn({name:"string",toBytes:e=>new TextEncoder().encode(e),fromBytes:e=>new TextDecoder().decode(e),...t})},fixedArray(t,e,r){return new Z({name:`${e.name}[${t}]`,read:n=>{const i=new Array(t);for(let s=0;s<t;s++)i[s]=e.read(n);return i},write:(n,i)=>{for(const s of n)e.write(s,i)},...r,validate:n=>{var i;if((i=r==null?void 0:r.validate)==null||i.call(r,n),!("length"in n))throw new TypeError(`Expected array, found ${typeof n}`);if(n.length!==t)throw new TypeError(`Expected array of length ${t}, found ${n.length}`)}})},option(t){return l.enum(`Option<${t.name}>`,{None:null,Some:t}).transform({input:e=>e==null?{None:!0}:{Some:e},output:e=>"Some"in e?e.Some:null})},vector(t,e){return new Z({name:`vector<${t.name}>`,read:r=>{const n=r.readULEB(),i=new Array(n);for(let s=0;s<n;s++)i[s]=t.read(r);return i},write:(r,n)=>{n.writeULEB(r.length);for(const i of r)t.write(i,n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!("length"in r))throw new TypeError(`Expected array, found ${typeof r}`)}})},tuple(t,e){return new Z({name:`(${t.map(r=>r.name).join(", ")})`,serializedSize:r=>{let n=0;for(let i=0;i<t.length;i++){const s=t[i].serializedSize(r[i]);if(s==null)return null;n+=s}return n},read:r=>{const n=[];for(const i of t)n.push(i.read(r));return n},write:(r,n)=>{for(let i=0;i<t.length;i++)t[i].write(r[i],n)},...e,validate:r=>{var n;if((n=e==null?void 0:e.validate)==null||n.call(e,r),!Array.isArray(r))throw new TypeError(`Expected array, found ${typeof r}`);if(r.length!==t.length)throw new TypeError(`Expected array of length ${t.length}, found ${r.length}`)}})},struct(t,e,r){const n=Object.entries(e);return new Z({name:t,serializedSize:i=>{let s=0;for(const[c,a]of n){const o=a.serializedSize(i[c]);if(o==null)return null;s+=o}return s},read:i=>{const s={};for(const[c,a]of n)s[c]=a.read(i);return s},write:(i,s)=>{for(const[c,a]of n)a.write(i[c],s)},...r,validate:i=>{var s;if((s=r==null?void 0:r.validate)==null||s.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`)}})},enum(t,e,r){const n=Object.entries(e);return new Z({name:t,read:i=>{const s=i.readULEB(),[c,a]=n[s];return{[c]:(a==null?void 0:a.read(i))??!0}},write:(i,s)=>{const[c,a]=Object.entries(i)[0];for(let o=0;o<n.length;o++){const[d,u]=n[o];if(d===c){s.writeULEB(o),u==null||u.write(a,s);return}}},...r,validate:i=>{var a;if((a=r==null?void 0:r.validate)==null||a.call(r,i),typeof i!="object"||i==null)throw new TypeError(`Expected object, found ${typeof i}`);const s=Object.keys(i);if(s.length!==1)throw new TypeError(`Expected object with one key, found ${s.length}`);const[c]=s;if(!Object.hasOwn(e,c))throw new TypeError(`Invalid enum variant ${c}`)}})},map(t,e){return l.vector(l.tuple([t,e])).transform({name:`Map<${t.name}, ${e.name}>`,input:r=>[...r.entries()],output:r=>{const n=new Map;for(const[i,s]of r)n.set(i,s);return n}})},generic(t,e){return(...r)=>e(...r).transform({name:`${e.name}<${r.map(n=>n.name).join(", ")}>`,input:n=>n,output:n=>n})},lazy(t){return Sn(t)}},Tn=32,Te=class{constructor(t){if(this.types=new Map,this.counter=0,t instanceof Te){this.schema=t.schema,this.types=new Map(t.types);return}if(this.schema=t,this.registerAddressType(Te.ADDRESS,t.addressLength,t.addressEncoding),this.registerVectorType(t.vectorType),t.types&&t.types.structs)for(let e of Object.keys(t.types.structs))this.registerStructType(e,t.types.structs[e]);if(t.types&&t.types.enums)for(let e of Object.keys(t.types.enums))this.registerEnumType(e,t.types.enums[e]);if(t.types&&t.types.aliases)for(let e of Object.keys(t.types.aliases))this.registerAlias(e,t.types.aliases[e]);t.withPrimitives!==!1&&vn(this)}tempKey(){return`bcs-struct-${++this.counter}`}ser(t,e,r){if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).encode(this,e,r,i)}if(typeof t=="object"){const n=this.tempKey();return new Te(this).registerStructType(n,t).ser(n,e,r)}throw new Error(`Incorrect type passed into the '.ser()' function.
2
2
  ${JSON.stringify(t)}`)}de(t,e,r){if(typeof e=="string")if(r)e=yn(e,r);else throw new Error("To pass a string to `bcs.de`, specify encoding");if(typeof t=="string"||Array.isArray(t)){const{name:n,params:i}=this.parseTypeName(t);return this.getTypeInterface(n).decode(this,e,i)}if(typeof t=="object"){const n=new Te(this),i=this.tempKey();return n.registerStructType(i,t).de(i,e,r)}throw new Error(`Incorrect type passed into the '.de()' function.
3
3
  ${JSON.stringify(t)}`)}hasType(t){return this.types.has(t)}registerAlias(t,e){return this.types.set(t,e),this}registerType(t,e,r,n=()=>!0){const{name:i,params:s}=this.parseTypeName(t);return this.types.set(i,{encode(c,a,o,d){const u=s.reduce((h,m,y)=>Object.assign(h,{[m]:d[y]}),{});return this._encodeRaw.call(c,new cr(o),a,d,u)},decode(c,a,o){const d=s.reduce((u,h,m)=>Object.assign(u,{[h]:o[m]}),{});return this._decodeRaw.call(c,new or(a),o,d)},_encodeRaw(c,a,o,d){if(n(a))return e.call(this,c,a,o,d);throw new Error(`Validation failed for type ${i}, data: ${a}`)},_decodeRaw(c,a,o){return r.call(this,c,a,o)}}),this}registerBcsType(t,e){return this.registerType(t,(r,n,i)=>{const s=i.map(c=>new Z({name:String(c),write:(a,o)=>{const{name:d,params:u}=this.parseTypeName(c),h=this.getTypeInterface(d),m=u.reduce((y,S,T)=>Object.assign(y,{[S]:i[T]}),{});return h._encodeRaw.call(this,o,a,u,m)},read:()=>{throw new Error("Not implemented")}}));return e(...s).write(n,r),r},(r,n)=>{const i=n.map(s=>new Z({name:String(s),write:(c,a)=>{throw new Error("Not implemented")},read:c=>{const{name:a,params:o}=this.parseTypeName(s),d=this.getTypeInterface(a),u=o.reduce((h,m,y)=>Object.assign(h,{[m]:n[y]}),{});return d._decodeRaw.call(this,c,o,u)}}));return e(...i).read(r)}),this}registerAddressType(t,e,r="hex"){switch(r){case"base64":return this.registerType(t,function(i,s){return ue(s).reduce((c,a)=>c.write8(a),i)},function(i){return Be(i.readBytes(e))});case"hex":return this.registerType(t,function(i,s){return Je(s).reduce((c,a)=>c.write8(a),i)},function(i){return Ce(i.readBytes(e))});default:throw new Error("Unsupported encoding! Use either hex or base64")}}registerVectorType(t){let{name:e,params:r}=this.parseTypeName(t);if(r.length>1)throw new Error("Vector can have only one type parameter; got "+e);return this.registerType(t,function(i,s,c,a){return i.writeVec(s,(o,d)=>{let u=c[0];if(!u)throw new Error(`Incorrect number of type parameters passed a to vector '${t}'`);let{name:h,params:m}=this.parseTypeName(u);if(this.hasType(h))return this.getTypeInterface(h)._encodeRaw.call(this,o,d,m,a);if(!(h in a))throw new Error(`Unable to find a matching type definition for ${h} in vector; make sure you passed a generic`);let{name:y,params:S}=this.parseTypeName(a[h]);return this.getTypeInterface(y)._encodeRaw.call(this,o,d,S,a)})},function(i,s,c){return i.readVec(a=>{let o=s[0];if(!o)throw new Error(`Incorrect number of type parameters passed to a vector '${t}'`);let{name:d,params:u}=this.parseTypeName(o);if(this.hasType(d))return this.getTypeInterface(d)._decodeRaw.call(this,a,u,c);if(!(d in c))throw new Error(`Unable to find a matching type definition for ${d} in vector; make sure you passed a generic`);let{name:h,params:m}=this.parseTypeName(c[d]);return this.getTypeInterface(h)._decodeRaw.call(this,a,m,c)})})}registerStructType(t,e){for(let c in e){let a=this.tempKey(),o=e[c];!Array.isArray(o)&&typeof o!="string"&&(e[c]=a,this.registerStructType(a,o))}let r=Object.freeze(e),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(t);return this.registerType(t,function(a,o,d,u){if(!o||o.constructor!==Object)throw new Error(`Expected ${i} to be an Object, got: ${o}`);if(d.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${d.length}`);for(let h of n){if(!(h in o))throw new Error(`Struct ${i} requires field ${h}:${r[h]}`);const{name:m,params:y}=this.parseTypeName(r[h]);if(!s.includes(m))this.getTypeInterface(m)._encodeRaw.call(this,a,o[h],y,u);else{const S=s.indexOf(m);let{name:T,params:f}=this.parseTypeName(d[S]);if(this.hasType(T)){this.getTypeInterface(T)._encodeRaw.call(this,a,o[h],f,u);continue}if(!(T in u))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:O,params:B}=this.parseTypeName(u[T]);this.getTypeInterface(O)._encodeRaw.call(this,a,o[h],B,u)}}return a},function(a,o,d){if(o.length!==s.length)throw new Error(`Incorrect number of generic parameters passed; expected: ${s.length}, got: ${o.length}`);let u={};for(let h of n){const{name:m,params:y}=this.parseTypeName(r[h]);if(!s.includes(m))u[h]=this.getTypeInterface(m)._decodeRaw.call(this,a,y,d);else{const S=s.indexOf(m);let{name:T,params:f}=this.parseTypeName(o[S]);if(this.hasType(T)){u[h]=this.getTypeInterface(T)._decodeRaw.call(this,a,f,d);continue}if(!(T in d))throw new Error(`Unable to find a matching type definition for ${T} in ${i}; make sure you passed a generic`);let{name:O,params:B}=this.parseTypeName(d[T]);u[h]=this.getTypeInterface(O)._decodeRaw.call(this,a,B,d)}}return u})}registerEnumType(t,e){for(let c in e){let a=this.tempKey(),o=e[c];o!==null&&!Array.isArray(o)&&typeof o!="string"&&(e[c]=a,this.registerStructType(a,o))}let r=Object.freeze(e),n=Object.keys(r),{name:i,params:s}=this.parseTypeName(t);return this.registerType(t,function(a,o,d,u){if(!o)throw new Error(`Unable to write enum "${i}", missing data.
4
4
  Received: "${o}"`);if(typeof o!="object")throw new Error(`Incorrect data passed into enum "${i}", expected object with properties: "${n.join(" | ")}".
@@ -1,4 +1,4 @@
1
- import { c5 as J, cv as Z } from "./index-r7xhXupc.mjs";
1
+ import { c5 as J, cv as Z } from "./index-CxsX-GTd.mjs";
2
2
  const j = "logger/5.7.0";
3
3
  let F = !1, k = !1;
4
4
  const U = { debug: 1, default: 2, info: 2, warning: 3, error: 4, off: 5 };