@dcl/explorer-website 2.6.1-25865517797.commit-b7a7cba → 2.6.1-25877826901.commit-3465800
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.
- package/assets/{ConstantsUtil-ByjAYmvC.js → ConstantsUtil-C4lJZ9QJ.js} +1 -1
- package/assets/{ExchangeController-Bp8ztJrX.js → ExchangeController-BSoHrJkH.js} +1 -1
- package/assets/{HelpersUtil-Dp4e1zvd.js → HelpersUtil-COJM8Fma.js} +1 -1
- package/assets/{NetworkUtil-DqGcuBfF.js → NetworkUtil-XsBaDkTf.js} +1 -1
- package/assets/{SwapController-DUCq2f7d.js → SwapController-CykJEtRW.js} +1 -1
- package/assets/{W3MFrameProviderSingleton-9eitOT0j.js → W3MFrameProviderSingleton-eYQGtm7P.js} +3 -3
- package/assets/{basic-C7tUDecp.js → basic-OoSQYHEk.js} +1 -1
- package/assets/{biconomy-plHCR2Qq.js → biconomy-PKn4tIKl.js} +1 -1
- package/assets/{browser-VYI7gorG.js → browser-DoJWAFam.js} +1 -1
- package/assets/browser-ponyfill-CqiVi-O8.js +1 -0
- package/assets/{ccip-CrAifiNa.js → ccip-BvTmJITs.js} +1 -1
- package/assets/{ccip-Bldffu31.js → ccip-ByLIoOC6.js} +1 -1
- package/assets/{chains-DTVDhUwv.js → chains-icJ3HR5v.js} +1 -1
- package/assets/{common-BEf2T7Hi.js → common-DMnogLd5.js} +1 -1
- package/assets/{controller-B8Iy-6V9.js → controller-BXwg_bJl.js} +2 -2
- package/assets/{core-XFvzSI58.js → core-DOL3gnfb.js} +4 -4
- package/assets/{custom-cPmISGcH.js → custom-CZYipZz1.js} +1 -1
- package/assets/{data-capture-DnvAEYWK.js → data-capture-CRDSEIY_.js} +1 -1
- package/assets/{decimals-8g2-fBFa.js → decimals-DNQm_OiO.js} +1 -1
- package/assets/decimals-DnutWGXb.js +1 -0
- package/assets/{detectExtension-yvI5WWZb.js → detectExtension-BfmE7TOs.js} +1 -1
- package/assets/{email-C8DRQjTT.js → email-CvS0g63O.js} +1 -1
- package/assets/{embedded-wallet-BxgtT1uV.js → embedded-wallet-BH2dkm4W.js} +1 -1
- package/assets/{engine-BERe87yT.js → engine-Di9rAbBn.js} +1 -1
- package/assets/{estimate-l1-fee-BTeKvFv5.js → estimate-l1-fee-D5Yk5K_j.js} +1 -1
- package/assets/eth_estimateGas-BmOR31h-.js +1 -0
- package/assets/{eth_getStorageAt-SbVMAQY-.js → eth_getStorageAt-7xIaoYHZ.js} +1 -1
- package/assets/{eth_getTransactionCount-qv0oO1Md.js → eth_getTransactionCount-DrnF23O4.js} +1 -1
- package/assets/{ethereum-BP59xYBe.js → ethereum-2kM2S7dx.js} +1 -1
- package/assets/{extractIPFS-BOFlZk7U.js → extractIPFS-C9Vdpa9n.js} +1 -1
- package/assets/{features-DVWd8_kC.js → features-DRiKivpi.js} +1 -1
- package/assets/{fetchTokenMetadata-BaJXN6RH.js → fetchTokenMetadata-DZl1qOjc.js} +2 -2
- package/assets/{fortmatic-DARkeYTE.js → fortmatic-6-9Hxtzg.js} +1 -1
- package/assets/get-ecosystem-wallet-info-DQQrfAsE.js +1 -0
- package/assets/{getBalance-D6wpo61w.js → getBalance-BfwFhtAu.js} +2 -2
- package/assets/{getInstalledModules-Dkj379ys.js → getInstalledModules-Dlcyw_6V.js} +1 -1
- package/assets/{getNFT-HMkoXD7L.js → getNFT-CkUzlgLt.js} +2 -2
- package/assets/{getNFT-Drn4rxrk.js → getNFT-DIu1VS3y.js} +1 -1
- package/assets/{hashTypedData-B5shS-rs.js → hashTypedData-CM_9VEoH.js} +1 -1
- package/assets/{hashTypedData-CMDSWYgs.js → hashTypedData-DrZol7nF.js} +1 -1
- package/assets/{in-app-wallet-calls-l9-2W_Em.js → in-app-wallet-calls-BABhagi9.js} +1 -1
- package/assets/{index-CH0zI801.js → index--SuwY_Sr.js} +1 -1
- package/assets/{index-B9U0GcYk.js → index-3gZjXx6v.js} +1 -1
- package/assets/{index-BXAxcybX.js → index-3jhEomSV.js} +1 -1
- package/assets/{index-D0LvjNIX.js → index-8eDD30Uv.js} +1 -1
- package/assets/{index-DfWsAOhN.js → index-B26CWJm4.js} +3 -3
- package/assets/{index-8M7OkBFm.js → index-B3Bk-Bdi.js} +1 -1
- package/assets/{index-DPxCDCvr.js → index-B7_b_SxX.js} +1 -1
- package/assets/{index-DK-ZMNLh.js → index-BI0nsxQ1.js} +1 -1
- package/assets/{index-BKL7nv1p.js → index-BPxeLdJF.js} +1 -1
- package/assets/{index-CWnFK_-0.js → index-BQJscq8u.js} +1 -1
- package/assets/{index-B5ECjSS9.js → index-BSmpP1mK.js} +1 -1
- package/assets/{index-JfVynEph.js → index-BUjSLaXy.js} +1 -1
- package/assets/{index-aoxVkzFE.js → index-BVL3WVs3.js} +1 -1
- package/assets/{index-829Uxa3Y.css → index-BXaGpRRD.css} +1 -1
- package/assets/{index-TBthDmkl.js → index-BYwd36WC.js} +1 -1
- package/assets/{index-0ShVRzxt.js → index-BlANYCHN.js} +1 -1
- package/assets/{index-BaGjqMte.js → index-BxZwJKty.js} +2 -2
- package/assets/{index-DOnRCLNP.js → index-C68kxEIB.js} +2 -2
- package/assets/{index-okvlQSs2.js → index-CEE50lK9.js} +1 -1
- package/assets/{index-BxdNwV86.js → index-CFn3Q12F.js} +1 -1
- package/assets/{index-DP1DuCnR.js → index-CNR7tadx.js} +1 -1
- package/assets/{index-CWGeCZBJ.js → index-CNttLYqM.js} +1 -1
- package/assets/{index-B-vyBZw9.js → index-CPCCdjXg.js} +1 -1
- package/assets/{index-C8NSq3HK.js → index-CQx7Nvt8.js} +1 -1
- package/assets/{index-I68folnJ.js → index-CUqVNGI9.js} +1 -1
- package/assets/{index-wds8TuUm.js → index-CYGUludi.js} +1 -1
- package/assets/{index-DS2Lm9tG.js → index-CcHsPndE.js} +1 -1
- package/assets/{index-DFE6t65x.js → index-CdCaVlZ8.js} +1 -1
- package/assets/{index-r_1z0VI_.js → index-CpGStcFm.js} +1 -1
- package/assets/{index-i4VBSYqA.js → index-CzGhZ9cz.js} +1 -1
- package/assets/{index-kXKMGszW.js → index-D2eOGoyM.js} +1 -1
- package/assets/{index-DIlwNfpB.js → index-D4_P_6_0.js} +1 -1
- package/assets/{index-D2ZBQG8w.js → index-D4h65XPa.js} +1 -1
- package/assets/{index-CE5G6IEJ.js → index-D6EwKnFm.js} +1 -1
- package/assets/{index-BDgZ3gDE.js → index-DD7htze-.js} +1 -1
- package/assets/{index-CjiwjbqL.js → index-DErCc5s3.js} +1 -1
- package/assets/{index-DvJmANzU.js → index-DIZhmTRA.js} +1 -1
- package/assets/{index-Cp7mdTuR.js → index-DNf75mcI.js} +1 -1
- package/assets/{index-BIPd_vR5.js → index-DVWnrfKr.js} +1 -1
- package/assets/{index-C5ciuua_.js → index-DcSeumRb.js} +1 -1
- package/assets/{index-DWRq2SN_.js → index-Dh25pQLC.js} +1 -1
- package/assets/{index-mZa0UiRt.js → index-DhJ5PMMP.js} +1 -1
- package/assets/{index-C51HwlD0.js → index-DvBfOXXL.js} +1 -1
- package/assets/{index-C-uqursN.js → index-ZSDK0Ila.js} +1 -1
- package/assets/{index-Cu4ZjLNb.js → index-a-a2MqTK.js} +5 -5
- package/assets/{index-B7Jt3b4d.js → index-jd0SXoNg.js} +1 -1
- package/assets/{index-BlykZ8Gp.js → index-kYi3llt9.js} +1 -1
- package/assets/{index-DbAu4Peg.js → index-mUrlue57.js} +3 -3
- package/assets/{index-Cy1X3n_C.js → index-vqWCp_18.js} +1 -1
- package/assets/{index.es-cEGj7JU0.js → index.es-B6W15sA5.js} +4 -4
- package/assets/{index.es-YpI01v2I.js → index.es-BpysnXQX.js} +1 -1
- package/assets/{index.es-CkxUaFYS.js → index.es-CjcoN6we.js} +1 -1
- package/assets/{localBatchGatewayRequest-CNIOIq-Z.js → localBatchGatewayRequest-BH_HSMtg.js} +1 -1
- package/assets/{networks-DJ72puSk.js → networks-xuo_6MCS.js} +1 -1
- package/assets/{onramp--l5ZLxWE.js → onramp-CYabKBjQ.js} +1 -1
- package/assets/{openzeppelin-CqtRqxtF.js → openzeppelin-ChIJtXh7.js} +1 -1
- package/assets/{ownerOf-cWkgEtd8.js → ownerOf-CpA7K1ak.js} +1 -1
- package/assets/{parseEventLogs-D1xiFnCH.js → parseEventLogs-DTRl5YJ_.js} +3 -3
- package/assets/{parseNft-DH5KlHPI.js → parseNft-BmgScKdM.js} +2 -2
- package/assets/{parseSignature-BYhcrVdX.js → parseSignature-On3IHrnn.js} +1 -1
- package/assets/{parseSignature-HAlgOHnm.js → parseSignature-XxRbPHFh.js} +3 -3
- package/assets/{pay-with-exchange-CiXPJJ6-.js → pay-with-exchange-DehF3o8r.js} +1 -1
- package/assets/{qr-overlay-CmFgwJBd.js → qr-overlay-BEl3x4xw.js} +3 -3
- package/assets/{receive-t2TxUItI.js → receive-C_KTgg4c.js} +1 -1
- package/assets/{resolveImplementation-iG9WRRnW.js → resolveImplementation-LbazawSf.js} +1 -1
- package/assets/{rpc-sIdV4wiJ.js → rpc-BVFdxD_n.js} +1 -1
- package/assets/{secp256k1-Co_Jve4c.js → secp256k1-6WLSeO2i.js} +1 -1
- package/assets/{secp256k1-Rk5k9i7o.js → secp256k1-CUFDPHqP.js} +1 -1
- package/assets/{secp256k1-Bg2aUJRs.js → secp256k1-DjijwK4n.js} +1 -1
- package/assets/{send-ByB5fOtm.js → send-BvXhUAZg.js} +1 -1
- package/assets/{send-batch-transaction-D79MC_wr.js → send-batch-transaction-PvOdFKh_.js} +1 -1
- package/assets/{send-eip712-transaction-CB6qLgks.js → send-eip712-transaction-DW2Z39R_.js} +2 -2
- package/assets/{send-gasless-transaction-Dt1qtUR8.js → send-gasless-transaction-DZNXePZn.js} +2 -2
- package/assets/{session-proposal-CY0k9Jnm.js → session-proposal-BDKOEjOS.js} +1 -1
- package/assets/{session-request-B_2glC9e.js → session-request-C6gEdmiF.js} +2 -2
- package/assets/{sha256-Dy8KQE_5.js → sha256-DOODwtIM.js} +1 -1
- package/assets/{signing-gNn6SJWz.js → signing-lyeTiv6v.js} +5 -5
- package/assets/{socials-Dx84-PrV.js → socials-J163g-WS.js} +1 -1
- package/assets/{swaps-CK9Sfcew.js → swaps-DhRGH4D_.js} +1 -1
- package/assets/{thirdweb-Bx5V_C1s.js → thirdweb-Dqspr20y.js} +3 -3
- package/assets/{totalSupply-O-VFDoRO.js → totalSupply-C4K7aOAr.js} +1 -1
- package/assets/{transactionReceipt-BqEjx5q-.js → transactionReceipt-DIRSM0gr.js} +1 -1
- package/assets/{transactions-BLOC2qYE.js → transactions-CIkqFxc1.js} +1 -1
- package/assets/{utils-h8VUSGPW.js → utils-Cj9H0gW-.js} +1 -1
- package/assets/{verifyHash-CNJ6t8Wp.js → verifyHash-CoWeO2NB.js} +1 -1
- package/assets/{w3m-modal-CCQuGDus.js → w3m-modal-BkrZujFe.js} +1 -1
- package/assets/{w3m-modal-nzPxg0Fr.js → w3m-modal-Cam7s-1S.js} +1 -1
- package/assets/{wait-for-tx-receipt-5pSBMNe2.js → wait-for-tx-receipt-CN6uf72q.js} +1 -1
- package/assets/{wallets-Bz03-Btm.js → wallets-HiUhftO5.js} +6 -6
- package/assets/{web-connector-CAOe_uvv.js → web-connector-Dq2kV8N4.js} +3 -3
- package/assets/{writeContract-CCar3Ocq.js → writeContract-jh5z7q6H.js} +1 -1
- package/assets/{zora-sepolia-D6mjhB5j.js → zora-sepolia-CS_uSNQg.js} +1 -1
- package/assets/{zoraTestnet-WLSFziQl.js → zoraTestnet-CvoUlJGq.js} +1 -1
- package/index.html +4 -4
- package/package.json +3 -3
- package/assets/browser-ponyfill-BmgQyNz0.js +0 -1
- package/assets/decimals-DR6jraOc.js +0 -1
- package/assets/eth_estimateGas-DKKwG-Ue.js +0 -1
- package/assets/get-ecosystem-wallet-info-Cvjz8DFX.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-
|
|
2
|
-
import{L as _i,c as ot,b as ea,e as zi,w as Oi}from"./utils-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/utils-Cj9H0gW-.js","assets/index-a-a2MqTK.js","assets/index-BXaGpRRD.css","assets/resolveImplementation-LbazawSf.js","assets/eth_getStorageAt-7xIaoYHZ.js","assets/extractIPFS-C9Vdpa9n.js","assets/getInstalledModules-Dlcyw_6V.js","assets/detectExtension-BfmE7TOs.js","assets/eth_estimateGas-BmOR31h-.js","assets/send-eip712-transaction-DW2Z39R_.js","assets/sha256-DOODwtIM.js","assets/eth_getTransactionCount-DrnF23O4.js","assets/send-gasless-transaction-DZNXePZn.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{L as _i,c as ot,b as ea,e as zi,w as Oi}from"./utils-Cj9H0gW-.js";import{_ as F}from"./index-a-a2MqTK.js";function fe(e,t,n){return JSON.stringify(e,(i,s)=>{const o=typeof s=="bigint"?s.toString():s;return typeof t=="function"?t(i,o):o},n)}const Lp=Object.freeze(Object.defineProperty({__proto__:null,stringify:fe},Symbol.toStringTag,{value:"Module"}));const or=BigInt(0),Rn=BigInt(1);function tt(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ar(e){if(!tt(e))throw new Error("Uint8Array expected")}function mt(e,t){if(typeof t!="boolean")throw new Error(e+" boolean expected, got "+t)}function Ot(e){const t=e.toString(16);return t.length&1?"0"+t:t}function Li(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?or:BigInt("0x"+e)}const Mi=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ta=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function bt(e){if(ar(e),Mi)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=ta[e[n]];return t}const ye={_0:48,_9:57,A:65,F:70,a:97,f:102};function Fr(e){if(e>=ye._0&&e<=ye._9)return e-ye._0;if(e>=ye.A&&e<=ye.F)return e-(ye.A-10);if(e>=ye.a&&e<=ye.f)return e-(ye.a-10)}function kt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Mi)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,s=0;i<n;i++,s+=2){const o=Fr(e.charCodeAt(s)),a=Fr(e.charCodeAt(s+1));if(o===void 0||a===void 0){const c=e[s]+e[s+1];throw new Error('hex string expected, got non-hex character "'+c+'" at index '+s)}r[i]=o*16+a}return r}function Ce(e){return Li(bt(e))}function Ci(e){return ar(e),Li(bt(Uint8Array.from(e).reverse()))}function wt(e,t){return kt(e.toString(16).padStart(t*2,"0"))}function Ni(e,t){return wt(e,t).reverse()}function se(e,t,n){let r;if(typeof t=="string")try{r=kt(t)}catch(s){throw new Error(e+" must be hex string or Uint8Array, cause: "+s)}else if(tt(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(e+" of length "+n+" expected, got "+i);return r}function jt(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];ar(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}const $n=e=>typeof e=="bigint"&&or<=e;function cr(e,t,n){return $n(e)&&$n(t)&&$n(n)&&t<=e&&e<n}function Je(e,t,n,r){if(!cr(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function na(e){let t;for(t=0;e>or;e>>=Rn,t+=1);return t}const Jt=e=>(Rn<<BigInt(e))-Rn,En=e=>new Uint8Array(e),Dr=e=>Uint8Array.from(e);function ra(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=En(e),i=En(e),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...f)=>n(i,r,...f),c=(f=En(0))=>{i=a(Dr([0]),f),r=a(),f.length!==0&&(i=a(Dr([1]),f),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const l=[];for(;f<t;){r=a();const p=r.slice();l.push(p),f+=r.length}return jt(...l)};return(f,l)=>{o(),c(f);let p;for(;!(p=l(u()));)c();return o(),p}}const ia={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||tt(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Qt(e,t,n={}){const r=(i,s,o)=>{const a=ia[s];if(typeof a!="function")throw new Error("invalid validator function");const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+c)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(n))r(i,s,!0);return e}function Hr(e){const t=new WeakMap;return(n,...r)=>{const i=t.get(n);if(i!==void 0)return i;const s=e(n,...r);return t.set(n,s),s}}const sa="0.1.1";function oa(){return sa}let $=class kn extends Error{constructor(t,n={}){const r=(()=>{if(n.cause instanceof kn){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&typeof n.cause.details=="string"?n.cause.details:n.cause?.message?n.cause.message:n.details})(),i=n.cause instanceof kn&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${i??""}`,a=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||i?["",r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0]:[]].filter(c=>typeof c=="string").join(`
|
|
3
3
|
`);super(a,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${oa()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=i,this.shortMessage=t}walk(t){return Ui(this,t)}};function Ui(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Ui(e.cause,t):t?null:e}const aa="#__bigint";function at(e,t,n){return JSON.stringify(e,(r,i)=>typeof t=="function"?t(r,i):typeof i=="bigint"?i.toString()+aa:i,n)}function je(e,t){if(Ye(e)>t)throw new za({givenSize:Ye(e),maxSize:t})}const ge={zero:48,nine:57,A:65,F:70,a:97,f:102};function Vr(e){if(e>=ge.zero&&e<=ge.nine)return e-ge.zero;if(e>=ge.A&&e<=ge.F)return e-(ge.A-10);if(e>=ge.a&&e<=ge.f)return e-(ge.a-10)}function Ri(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new Oa({size:e.length,targetSize:r,type:"Bytes"});const i=new Uint8Array(r);for(let s=0;s<r;s++){const o=n==="right";i[o?s:r-s-1]=e[o?s:e.length-s-1]}return i}function ki(e,t={}){const{dir:n="left"}=t;let r=e,i=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)i++;return r=n==="left"?r.slice(i):r.slice(0,r.length-i),r}function Pt(e,t){if(R(e)>t)throw new ba({givenSize:R(e),maxSize:t})}function ca(e,t){if(typeof t=="number"&&t>0&&t>R(e)-1)throw new Hi({offset:t,position:"start",size:R(e)})}function ua(e,t,n){if(typeof t=="number"&&typeof n=="number"&&R(e)!==n-t)throw new Hi({offset:n,position:"end",size:R(e)})}function ji(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const i=e.replace("0x","");if(i.length>r*2)throw new wa({size:Math.ceil(i.length/2),targetSize:r,type:"Hex"});return`0x${i[n==="right"?"padEnd":"padStart"](r*2,"0")}`}function fa(e,t={}){const{dir:n="left"}=t;let r=e.replace("0x",""),i=0;for(let s=0;s<r.length-1&&r[n==="left"?s:r.length-s-1].toString()==="0";s++)i++;return r=n==="left"?r.slice(i):r.slice(0,r.length-i),r==="0"?"0x":n==="right"&&r.length%2===1?`0x${r}0`:`0x${r}`}const da=new TextEncoder,la=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ha(e,t={}){const{strict:n=!1}=t;if(!e)throw new Gr(e);if(typeof e!="string")throw new Gr(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new qr(e);if(!e.startsWith("0x"))throw new qr(e)}function N(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function en(e){return e instanceof Uint8Array?Y(e):Array.isArray(e)?Y(new Uint8Array(e)):e}function ur(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(Pt(n,t.size),Te(n,t.size)):n}function Y(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=la[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(Pt(r,t.size),_e(r,t.size)):r}function E(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const u=typeof e=="bigint"?"n":"";throw new Di({max:s?`${s}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?Te(c,r):c}function It(e,t={}){return Y(da.encode(e),t)}function Te(e,t){return ji(e,{dir:"left",size:t})}function _e(e,t){return ji(e,{dir:"right",size:t})}function K(e,t,n,r={}){const{strict:i}=r;ca(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return i&&ua(s,t,n),s}function R(e){return Math.ceil((e.length-2)/2)}function xt(e){return fa(e,{dir:"left"})}function be(e,t={}){const{signed:n}=t;t.size&&Pt(e,t.size);const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n)-1n,o=s>>1n;return r<=o?r:r-s-1n}function pa(e,t={}){t.size&&Pt(e,t.size);const n=xt(e);if(n==="0x")return!1;if(n==="0x1")return!0;throw new ma(e)}function ya(e,t={}){return ze(e,t)}function Fi(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:be(e,t))}function ga(e,t={}){const{size:n}=t;let r=ze(e);return n&&(je(r,n),r=Ki(r)),new TextDecoder().decode(r)}function fr(e,t={}){const{strict:n=!1}=t;try{return ha(e,{strict:n}),!0}catch{return!1}}let Di=class extends ${constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number \`${s}\` is not in safe${i?` ${i*8}-bit`:""}${r?" signed":" unsigned"} integer range ${t?`(\`${n}\` to \`${t}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}},ma=class extends ${constructor(t){super(`Hex value \`"${t}"\` is not a valid boolean.`,{metaMessages:['The hex value must be `"0x0"` (false) or `"0x1"` (true).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexBooleanError"})}};class Gr extends ${constructor(t){super(`Value \`${typeof t=="object"?at(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}let qr=class extends ${constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}},ba=class extends ${constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}},Hi=class extends ${constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}},wa=class extends ${constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}};const xa=new TextDecoder,$a=new TextEncoder;function Ea(e){if(!(e instanceof Uint8Array)){if(!e)throw new Lt(e);if(typeof e!="object")throw new Lt(e);if(!("BYTES_PER_ELEMENT"in e))throw new Lt(e);if(e.BYTES_PER_ELEMENT!==1||e.constructor.name!=="Uint8Array")throw new Lt(e)}}function Vi(...e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}function jn(e){return e instanceof Uint8Array?e:typeof e=="string"?ze(e):va(e)}function va(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function Aa(e,t={}){const{size:n}=t,r=new Uint8Array(1);return r[0]=Number(e),typeof n=="number"?(je(r,n),Ia(r,n)):r}function ze(e,t={}){const{size:n}=t;let r=e;n&&(Pt(e,n),r=_e(e,n));let i=r.slice(2);i.length%2&&(i=`0${i}`);const s=i.length/2,o=new Uint8Array(s);for(let a=0,c=0;a<s;a++){const u=Vr(i.charCodeAt(c++)),d=Vr(i.charCodeAt(c++));if(u===void 0||d===void 0)throw new $(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);o[a]=u*16+d}return o}function Pa(e,t){const n=E(e,t);return ze(n)}function dr(e,t={}){const{size:n}=t,r=$a.encode(e);return typeof n=="number"?(je(r,n),Ba(r,n)):r}function Ia(e,t){return Ri(e,{dir:"left",size:t})}function Ba(e,t){return Ri(e,{dir:"right",size:t})}function Ye(e){return e.length}function Sa(e,t,n,r={}){const{strict:i}=r;return e.slice(t,n)}function Gi(e,t={}){const{size:n}=t;typeof n<"u"&&je(e,n);const r=Y(e,t);return be(r,t)}function qi(e,t={}){const{size:n}=t;let r=e;if(typeof n<"u"&&(je(r,n),r=Zi(r)),r.length>1||r[0]>1)throw new _a(r);return!!r[0]}function ce(e,t={}){const{size:n}=t;typeof n<"u"&&je(e,n);const r=Y(e,t);return Fi(r,t)}function Wi(e,t={}){const{size:n}=t;let r=e;return typeof n<"u"&&(je(r,n),r=Ki(r)),xa.decode(r)}function Zi(e){return ki(e,{dir:"left"})}function Ki(e){return ki(e,{dir:"right"})}function Ta(e){try{return Ea(e),!0}catch{return!1}}let _a=class extends ${constructor(t){super(`Bytes value \`${t}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}};class Lt extends ${constructor(t){super(`Value \`${typeof t=="object"?at(t):t}\` of type \`${typeof t}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}let za=class extends ${constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}},Oa=class extends ${constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}};function Fe(e,t={}){return fr(e,t)}function La(e,t={}){switch(typeof e){case"number":case"bigint":return Na(e,t);case"boolean":return Ma(e,t);default:return Fe(e)?Ca(e,t):Ft(e,t)}}function Ma(e,t={}){return Aa(e,t)}function Ca(e,t={}){return ze(e,t)}function Na(e,t){return Pa(e,t)}function Ft(e,t={}){return dr(e,t)}function Dt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Ua(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function ct(e,...t){if(!Ua(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ra(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Dt(e.outputLen),Dt(e.blockLen)}function nt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Yi(e,t){ct(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}const Mt=BigInt(2**32-1),Wr=BigInt(32);function ka(e,t=!1){return t?{h:Number(e&Mt),l:Number(e>>Wr&Mt)}:{h:Number(e>>Wr&Mt)|0,l:Number(e&Mt)|0}}function ja(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:s,l:o}=ka(e[i],t);[n[i],r[i]]=[s,o]}return[n,r]}const Fa=(e,t,n)=>e<<n|t>>>32-n,Da=(e,t,n)=>t<<n|e>>>32-n,Ha=(e,t,n)=>t<<n-32|e>>>64-n,Va=(e,t,n)=>e<<n-32|t>>>64-n,We=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Ga(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function vn(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function ae(e,t){return e<<32-t|e>>>t}const Zr=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function qa(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Kr(e){for(let t=0;t<e.length;t++)e[t]=qa(e[t])}const Wa=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Za=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Hp(e){if(ct(e),Wa)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=Za[e[n]];return t}function Ka(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function tn(e){return typeof e=="string"&&(e=Ka(e)),ct(e),e}function Ya(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];ct(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}let lr=class{clone(){return this._cloneInto()}};function Xi(e){const t=r=>e().update(tn(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Xa(e=32){if(We&&typeof We.getRandomValues=="function")return We.getRandomValues(new Uint8Array(e));if(We&&typeof We.randomBytes=="function")return Uint8Array.from(We.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const Ji=[],Qi=[],es=[],Ja=BigInt(0),ht=BigInt(1),Qa=BigInt(2),ec=BigInt(7),tc=BigInt(256),nc=BigInt(113);for(let e=0,t=ht,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ji.push(2*(5*r+n)),Qi.push((e+1)*(e+2)/2%64);let i=Ja;for(let s=0;s<7;s++)t=(t<<ht^(t>>ec)*nc)%tc,t&Qa&&(i^=ht<<(ht<<BigInt(s))-ht);es.push(i)}const[rc,ic]=ja(es,!0),Yr=(e,t,n)=>n>32?Ha(e,t,n):Fa(e,t,n),Xr=(e,t,n)=>n>32?Va(e,t,n):Da(e,t,n);function sc(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=Yr(u,d,1)^n[a],l=Xr(u,d,1)^n[a+1];for(let p=0;p<50;p+=10)e[o+p]^=f,e[o+p+1]^=l}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=Qi[o],c=Yr(i,s,a),u=Xr(i,s,a),d=Ji[o];i=e[d],s=e[d+1],e[d]=c,e[d+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=rc[r],e[1]^=ic[r]}n.fill(0)}let oc=class ts extends lr{constructor(t,n,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,Dt(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Ga(this.state)}keccak(){Zr||Kr(this.state32),sc(this.state32,this.rounds),Zr||Kr(this.state32),this.posOut=0,this.pos=0}update(t){nt(this);const{blockLen:n,state:r}=this;t=tn(t);const i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,(n&128)!==0&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){nt(this,!1),ct(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Dt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Yi(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new ts(n,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const ac=(e,t,n)=>Xi(()=>new oc(t,e,n)),ns=ac(1,136,256/8);function Ne(e,t={}){const{dir:n,size:r=32}=t;return r===null?e:n==="right"?_e(e,r):Te(e,r)}function cc(e,t={}){return ga(e,t)}function nn(e,t={}){return be(e,t)}function uc(e,t={}){return Fi(e,t)}function rs(e,t={}){return pa(e,t)}function is(e,t={}){return ya(e,t)}function Gp(e,t){const n=typeof t=="string"?{to:t}:t;switch(n.to){case"number":return uc(e,n);case"bigint":return nn(e,n);case"string":return cc(e,n);case"boolean":return rs(e,n);default:return is(e,n)}}function ss(e,t={}){return ur(e,t)}function hr(e,t={}){return Y(e,t)}function de(e,t={}){return E(e,t)}function rn(e,t={}){return It(e,t)}function os(e,t={}){switch(typeof e){case"number":case"bigint":return de(e,t);case"string":return rn(e,t);case"boolean":return ss(e,t);default:return hr(e,t)}}function $e(e,t){const n=ns(Fe(e,{strict:!1})?is(e):e);return t==="bytes"?n:hr(n)}const fc=/^0x[a-fA-F0-9]{40}$/,An=new _i(4096);function pr(e){if(An.has(e))return An.get(e);const t=fc.test(e)&&(e.toLowerCase()===e||as(e)===e);return An.set(e,t),t}function as(e){const t=e.substring(2).toLowerCase(),n=$e(Ft(t),"bytes"),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&e[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&e[i+1]&&(r[i+1]=r[i+1].toUpperCase());return`0x${r.join("")}`}function Ie(e){if(!pr(e))throw new Error(`Invalid address: ${e}`);return as(e)}function dc(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(n>>i&s),a=Number(n&s),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function lc(e,t,n){return e&t^~e&n}function hc(e,t,n){return e&t^e&n^t&n}class pc extends lr{constructor(t,n,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=vn(this.buffer)}update(t){nt(this);const{view:n,buffer:r,blockLen:i}=this;t=tn(t);const s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const c=vn(t);for(;i<=s-o;o+=i)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){nt(this),Yi(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let f=o;f<i;f++)n[f]=0;dc(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=vn(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,d[f],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%n&&t.buffer.set(r),t}}const yc=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ae=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Pe=new Uint32Array(64);class gc extends pc{constructor(t=32){super(64,t,8,!1),this.A=Ae[0]|0,this.B=Ae[1]|0,this.C=Ae[2]|0,this.D=Ae[3]|0,this.E=Ae[4]|0,this.F=Ae[5]|0,this.G=Ae[6]|0,this.H=Ae[7]|0}get(){const{A:t,B:n,C:r,D:i,E:s,F:o,G:a,H:c}=this;return[t,n,r,i,s,o,a,c]}set(t,n,r,i,s,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let f=0;f<16;f++,n+=4)Pe[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const l=Pe[f-15],p=Pe[f-2],g=ae(l,7)^ae(l,18)^l>>>3,y=ae(p,17)^ae(p,19)^p>>>10;Pe[f]=y+Pe[f-7]+g+Pe[f-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const l=ae(a,6)^ae(a,11)^ae(a,25),p=d+l+lc(a,c,u)+yc[f]+Pe[f]|0,y=(ae(r,2)^ae(r,13)^ae(r,22))+hc(r,i,s)|0;d=u,u=c,c=a,a=o+p|0,o=s,s=i,i=r,r=p+y|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(r,i,s,o,a,c,u,d)}roundClean(){Pe.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const mc=Xi(()=>new gc),bc="0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";function qp(e){return e.toLowerCase()===bc}const Wp="0x0000000000000000000000000000000000000000";function Ut(e){if(!e.client)throw new Error(`getContract validation error - invalid client: ${e.client}`);if(!pr(e.address))throw new Error(`getContract validation error - invalid address: ${e.address}`);if(!e.chain||!e.chain.id)throw new Error(`getContract validation error - invalid chain: ${e.chain}`);return e}function wc(e,t){return e.exec(t)?.groups}const Zp=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Kp=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Yp=/^\(.+?\).*?$/,Jr=/^tuple(?<array>(\[(\d*)\])*)$/;function Fn(e){let t=e.type;if(Jr.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const s=e.components[i];t+=Fn(s),i<n-1&&(t+=", ")}const r=wc(Jr,e.type);return t+=`)${r?.array??""}`,Fn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function pt(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=Fn(i),r!==n-1&&(t+=", ")}return t}function xc(e){return e.type==="function"?`function ${e.name}(${pt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${pt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${pt(e.inputs)})`:e.type==="error"?`error ${e.name}(${pt(e.inputs)})`:e.type==="constructor"?`constructor(${pt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function rt(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new zc(e.type);return`${e.name}(${sn(e.inputs,{includeName:t})})`}function sn(e,{includeName:t=!1}={}){return e?e.map(n=>$c(n,{includeName:t})).join(t?", ":","):""}function $c(e,{includeName:t}){return e.type.startsWith("tuple")?`(${sn(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Bt(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function G(e){return Bt(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const cs="2.39.0";let Rt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${cs}`};function Xp(e){Rt=e}let I=class Dn extends Error{constructor(t,n={}){const r=n.cause instanceof Dn?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof Dn&&n.cause.docsPath||n.docsPath,s=Rt.getDocsUrl?.({...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...Rt.version?[`Version: ${Rt.version}`]:[]].join(`
|
|
4
4
|
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=cs}walk(t){return us(this,t)}};function us(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?us(e.cause,t):t?null:e}class Jp extends I{constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
|
|
5
5
|
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Qp extends I{constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
|
|
@@ -23,8 +23,8 @@ import{L as _i,c as ot,b as ea,e as zi,w as Oi}from"./utils-h8VUSGPW.js";import{
|
|
|
23
23
|
`),{name:"InvalidArrayError"})}};class zc extends I{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
24
24
|
`),{name:"InvalidDefinitionTypeError"})}}class u0 extends I{constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}class Oc extends I{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}class ps extends I{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class ys extends I{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}class f0 extends I{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}function ut(e,{dir:t,size:n=32}={}){return typeof e=="string"?Se(e,{dir:t,size:n}):Lc(e,{dir:t,size:n})}function Se(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new ys({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Lc(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ys({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let i=0;i<n;i++){const s=t==="right";r[s?i:n-i-1]=e[s?i:e.length-i-1]}return r}class gs extends I{constructor({max:t,min:n,signed:r,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Mc extends I{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class Cc extends I{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}class d0 extends I{constructor(t){super(`Hex value "${t}" is an odd length (${t.length}). It must be an even length.`,{name:"InvalidHexValueError"})}}class Nc extends I{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Ue(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let i=0;i<n.length-1&&n[t==="left"?i:n.length-i-1].toString()==="0";i++)r++;return n=t==="left"?n.slice(r):n.slice(0,n.length-r),typeof e=="string"?(n.length===1&&t==="right"&&(n=`${n}0`),`0x${n.length%2===1?`0${n}`:n}`):n}function re(e,{size:t}){if(G(e)>t)throw new Nc({givenSize:G(e),maxSize:t})}function l0(e,t){const n=typeof t=="string"?{to:t}:t,r=n.to;return r==="number"?Ht(e,n):r==="bigint"?yr(e,n):r==="string"?Rc(e,n):r==="boolean"?Uc(e,n):St(e,n)}function yr(e,t={}){const{signed:n}=t;t.size&&re(e,{size:t.size});const r=BigInt(e);if(!n)return r;const i=(e.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Uc(e,t={}){let n=e;if(t.size&&(re(n,{size:t.size}),n=Ue(n)),Ue(n)==="0x00")return!1;if(Ue(n)==="0x01")return!0;throw new Cc(n)}function Ht(e,t={}){return Number(yr(e,t))}function Rc(e,t={}){let n=St(e);return t.size&&(re(n,{size:t.size}),n=Ue(n,{dir:"right"})),new TextDecoder().decode(n)}const kc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function jc(e,t={}){return typeof e=="number"||typeof e=="bigint"?j(e,t):typeof e=="string"?bs(e,t):typeof e=="boolean"?ms(e,t):le(e,t)}function ms(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(re(n,{size:t.size}),ut(n,{size:t.size})):n}function le(e,t={}){let n="";for(let i=0;i<e.length;i++)n+=kc[e[i]];const r=`0x${n}`;return typeof t.size=="number"?(re(r,{size:t.size}),ut(r,{dir:"right",size:t.size})):r}function j(e,t={}){const{signed:n,size:r}=t,i=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&n?-s-1n:0;if(s&&i>s||i<o){const c=typeof e=="bigint"?"n":"";throw new gs({max:s?`${s}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?ut(a,{size:r}):a}const Fc=new TextEncoder;function bs(e,t={}){const n=Fc.encode(e);return le(n,t)}const Dc=new TextEncoder;function on(e,t={}){return typeof e=="number"||typeof e=="bigint"?Vc(e,t):typeof e=="boolean"?Hc(e,t):Bt(e)?St(e,t):ws(e,t)}function Hc(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(re(n,{size:t.size}),ut(n,{size:t.size})):n}const me={zero:48,nine:57,A:65,F:70,a:97,f:102};function ei(e){if(e>=me.zero&&e<=me.nine)return e-me.zero;if(e>=me.A&&e<=me.F)return e-(me.A-10);if(e>=me.a&&e<=me.f)return e-(me.a-10)}function St(e,t={}){let n=e;t.size&&(re(n,{size:t.size}),n=ut(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const c=ei(r.charCodeAt(a++)),u=ei(r.charCodeAt(a++));if(c===void 0||u===void 0)throw new I(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);s[o]=c*16+u}return s}function Vc(e,t){const n=j(e,t);return St(n)}function ws(e,t={}){const n=Dc.encode(e);return typeof t.size=="number"?(re(n,{size:t.size}),ut(n,{dir:"right",size:t.size})):n}const Ct=BigInt(2**32-1),ti=BigInt(32);function Gc(e,t=!1){return t?{h:Number(e&Ct),l:Number(e>>ti&Ct)}:{h:Number(e>>ti&Ct)|0,l:Number(e&Ct)|0}}function qc(e,t=!1){const n=e.length;let r=new Uint32Array(n),i=new Uint32Array(n);for(let s=0;s<n;s++){const{h:o,l:a}=Gc(e[s],t);[r[s],i[s]]=[o,a]}return[r,i]}const Wc=(e,t,n)=>e<<n|t>>>32-n,Zc=(e,t,n)=>t<<n|e>>>32-n,Kc=(e,t,n)=>t<<n-32|e>>>64-n,Yc=(e,t,n)=>e<<n-32|t>>>64-n,Ze=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Xc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Vt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function $t(e,...t){if(!Xc(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function h0(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Vt(e.outputLen),Vt(e.blockLen)}function ni(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Jc(e,t){$t(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Qc(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function xs(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function p0(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y0(e,t){return e<<32-t|e>>>t}function g0(e,t){return e<<t|e>>>32-t>>>0}const eu=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function tu(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function nu(e){for(let t=0;t<e.length;t++)e[t]=tu(e[t]);return e}const ri=eu?e=>e:nu;function ru(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function $s(e){return typeof e=="string"&&(e=ru(e)),$t(e),e}function m0(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];$t(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const s=e[r];n.set(s,i),i+=s.length}return n}class iu{}function su(e){const t=r=>e().update($s(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function b0(e=32){if(Ze&&typeof Ze.getRandomValues=="function")return Ze.getRandomValues(new Uint8Array(e));if(Ze&&typeof Ze.randomBytes=="function")return Uint8Array.from(Ze.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}const ou=BigInt(0),yt=BigInt(1),au=BigInt(2),cu=BigInt(7),uu=BigInt(256),fu=BigInt(113),Es=[],vs=[],As=[];for(let e=0,t=yt,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Es.push(2*(5*r+n)),vs.push((e+1)*(e+2)/2%64);let i=ou;for(let s=0;s<7;s++)t=(t<<yt^(t>>cu)*fu)%uu,t&au&&(i^=yt<<(yt<<BigInt(s))-yt);As.push(i)}const Ps=qc(As,!0),du=Ps[0],lu=Ps[1],ii=(e,t,n)=>n>32?Kc(e,t,n):Wc(e,t,n),si=(e,t,n)=>n>32?Yc(e,t,n):Zc(e,t,n);function hu(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=ii(u,d,1)^n[a],l=si(u,d,1)^n[a+1];for(let p=0;p<50;p+=10)e[o+p]^=f,e[o+p+1]^=l}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=vs[o],c=ii(i,s,a),u=si(i,s,a),d=Es[o];i=e[d],s=e[d+1],e[d]=c,e[d+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=du[r],e[1]^=lu[r]}xs(n)}class gr extends iu{constructor(t,n,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=s,Vt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Qc(this.state)}clone(){return this._cloneInto()}keccak(){ri(this.state32),hu(this.state32,this.rounds),ri(this.state32),this.posOut=0,this.pos=0}update(t){ni(this),t=$s(t),$t(t);const{blockLen:n,state:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(n-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:i}=this;t[r]^=n,(n&128)!==0&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){ni(this,!1),$t(t),this.finish();const n=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Vt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Jc(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,xs(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new gr(n,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const pu=(e,t,n)=>su(()=>new gr(t,e,n)),yu=pu(1,136,256/8);function an(e,t){const n=t||"hex",r=yu(Bt(e,{strict:!1})?on(e):e);return n==="bytes"?r:jc(r)}const gu=e=>an(on(e));function mu(e){return gu(e)}function bu(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new I("Unable to normalize signature.");return i}const wu=e=>{const t=typeof e=="string"?e:xc(e);return bu(t)};function mr(e){return mu(wu(e))}const cn=mr;let Gt=class extends I{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}},Is=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}};const Pn=new Is(8192);function br(e,t){if(Pn.has(`${e}.${t}`))return Pn.get(`${e}.${t}`);const n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=an(ws(n),"bytes"),i=(t?n.substring(`${t}0x`.length):n).split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return Pn.set(`${e}.${t}`,s),s}function $0(e,t){if(!Re(e,{strict:!1}))throw new Gt({address:e});return br(e,t)}const xu=/^0x[a-fA-F0-9]{40}$/,In=new Is(8192);function Re(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(In.has(r))return In.get(r);const i=xu.test(e)?e.toLowerCase()===e?!0:n?br(e)===e:!0:!1;return In.set(r,i),i}function it(e){return typeof e[0]=="string"?Eu(e):$u(e)}function $u(e){let t=0;for(const i of e)t+=i.length;const n=new Uint8Array(t);let r=0;for(const i of e)n.set(i,r),r+=i.length;return n}function Eu(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function qt(e,t,n,{strict:r}={}){return Bt(e,{strict:!1})?vu(e,t,n,{strict:r}):Ts(e,t,n,{strict:r})}function Bs(e,t){if(typeof t=="number"&&t>0&&t>G(e)-1)throw new ps({offset:t,position:"start",size:G(e)})}function Ss(e,t,n){if(typeof t=="number"&&typeof n=="number"&&G(e)!==n-t)throw new ps({offset:n,position:"end",size:G(e)})}function Ts(e,t,n,{strict:r}={}){Bs(e,t);const i=e.slice(t,n);return r&&Ss(i,t,n),i}function vu(e,t,n,{strict:r}={}){Bs(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Ss(i,t,n),i}const E0=/^(.*)\[([0-9]*)\]$/,v0=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Au=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function Pu(e,t){if(e.length!==t.length)throw new Ac({expectedLength:e.length,givenLength:t.length});const n=Iu({params:e,values:t}),r=xr(n);return r.length===0?"0x":r}function Iu({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(wr({param:e[r],value:t[r]}));return n}function wr({param:e,value:t}){const n=$r(e.type);if(n){const[r,i]=n;return Su(t,{length:r,param:{...e,type:i}})}if(e.type==="tuple")return Lu(t,{param:e});if(e.type==="address")return Bu(t);if(e.type==="bool")return _u(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,i="256"]=Au.exec(e.type)??[];return zu(t,{signed:r,size:Number(i)})}if(e.type.startsWith("bytes"))return Tu(t,{param:e});if(e.type==="string")return Ou(t);throw new Sc(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function xr(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=G(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(j(t+i,{size:32})),r.push(a),i+=G(a)):n.push(a)}return it([...n,...r])}function Bu(e){if(!Re(e))throw new Gt({address:e});return{dynamic:!1,encoded:Se(e.toLowerCase())}}function Su(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new _c(e);if(!r&&e.length!==t)throw new Ec({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let i=!1;const s=[];for(let o=0;o<e.length;o++){const a=wr({param:n,value:e[o]});a.dynamic&&(i=!0),s.push(a)}if(r||i){const o=xr(s);if(r){const a=j(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?it([a,o]):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:it(s.map(({encoded:o})=>o))}}function Tu(e,{param:t}){const[,n]=t.type.split("bytes"),r=G(e);if(!n){let i=e;return r%32!==0&&(i=Se(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:it([Se(j(r,{size:32})),i])}}if(r!==Number.parseInt(n,10))throw new vc({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Se(e,{dir:"right"})}}function _u(e){if(typeof e!="boolean")throw new I(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Se(ms(e))}}function zu(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new gs({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:j(e,{size:32,signed:t})}}function Ou(e){const t=bs(e),n=Math.ceil(G(t)/32),r=[];for(let i=0;i<n;i++)r.push(Se(qt(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:it([Se(j(G(t),{size:32})),...r])}}function Lu(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const s=t.components[i],o=Array.isArray(e)?i:s.name,a=wr({param:s,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?xr(r):it(r.map(({encoded:i})=>i))}}function $r(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Er=e=>qt(mr(e),0,4);function Mu(e){const{abi:t,args:n=[],name:r}=e,i=Bt(r,{strict:!1}),s=t.filter(a=>i?a.type==="function"?Er(a)===r:a.type==="event"?cn(a)===r:!1:"name"in a&&a.name===r);if(s.length===0)return;if(s.length===1)return s[0];let o;for(const a of s){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((u,d)=>{const f="inputs"in a&&a.inputs[d];return f?Vn(u,f):!1})){if(o&&"inputs"in o&&o.inputs){const u=_s(a.inputs,o.inputs,n);if(u)throw new Bc({abiItem:a,type:u[0]},{abiItem:o,type:u[1]})}o=a}}return o||s[0]}function Vn(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Re(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((i,s)=>Vn(Object.values(e)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(i=>Vn(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function _s(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return _s(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Re(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?Re(n[r],{strict:!1}):!1)return o}}const oi="/docs/contract/encodeEventTopics";function Cu(e){const{abi:t,eventName:n,args:r}=e;let i=t[0];if(n){const c=Mu({abi:t,name:n});if(!c)throw new Qr(n,{docsPath:oi});i=c}if(i.type!=="event")throw new Qr(void 0,{docsPath:oi});const s=rt(i),o=cn(s);let a=[];if(r&&"inputs"in i){const c=i.inputs?.filter(d=>"indexed"in d&&d.indexed),u=Array.isArray(r)?r:Object.values(r).length>0?c?.map(d=>r[d.name])??[]:[];u.length>0&&(a=c?.map((d,f)=>Array.isArray(u[f])?u[f].map((l,p)=>ai({param:d,value:u[f][p]})):typeof u[f]<"u"&&u[f]!==null?ai({param:d,value:u[f]}):null)??[])}return[o,...a]}function ai({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return an(on(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new Oc(e.type);return Pu([e],[t])}const A0={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Nu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Uu={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};let ci=class extends I{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},zs=class extends I{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},Ru=class extends I{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};const ku={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new Ru({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new zs({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ci({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new ci({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function ju(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ku);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function S0(e,t){const n=typeof t=="string"?{to:t}:t,r=n.to;return r==="number"?ue(e,n):r==="bigint"?Os(e,n):r==="boolean"?Ls(e,n):r==="string"?Ms(e,n):le(e,n)}function Os(e,t={}){typeof t.size<"u"&&re(e,{size:t.size});const n=le(e,t);return yr(n,t)}function Ls(e,t={}){let n=e;if(typeof t.size<"u"&&(re(n,{size:t.size}),n=Ue(n)),n.length>1||n[0]>1)throw new Mc(n);return!!n[0]}function ue(e,t={}){typeof t.size<"u"&&re(e,{size:t.size});const n=le(e,t);return Ht(n,t)}function Ms(e,t={}){let n=e;return typeof t.size<"u"&&(re(n,{size:t.size}),n=Ue(n,{dir:"right"})),new TextDecoder().decode(n)}function un(e,t){const n=typeof t=="string"?St(t):t,r=ju(n);if(G(n)===0&&e.length>0)throw new ds;if(G(t)&&G(t)<32)throw new fs({data:typeof t=="string"?t:le(t),params:e,size:G(t)});let i=0;const s=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(i);const[c,u]=Qe(r,a,{staticPosition:0});i+=u,s.push(c)}return s}function Qe(e,t,{staticPosition:n}){const r=$r(t.type);if(r){const[i,s]=r;return Du(e,{...t,type:s},{length:i,staticPosition:n})}if(t.type==="tuple")return qu(e,t,{staticPosition:n});if(t.type==="address")return Fu(e);if(t.type==="bool")return Hu(e);if(t.type.startsWith("bytes"))return Vu(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Gu(e,t);if(t.type==="string")return Wu(e,{staticPosition:n});throw new Tc(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const ui=32,Gn=32;function Fu(e){const t=e.readBytes(32);return[br(le(Ts(t,-20))),32]}function Du(e,t,{length:n,staticPosition:r}){if(!n){const o=ue(e.readBytes(Gn)),a=r+o,c=a+ui;e.setPosition(a);const u=ue(e.readBytes(ui)),d=Et(t);let f=0;const l=[];for(let p=0;p<u;++p){e.setPosition(c+(d?p*32:f));const[g,y]=Qe(e,t,{staticPosition:c});f+=y,l.push(g)}return e.setPosition(r+32),[l,32]}if(Et(t)){const o=ue(e.readBytes(Gn)),a=r+o,c=[];for(let u=0;u<n;++u){e.setPosition(a+u*32);const[d]=Qe(e,t,{staticPosition:a});c.push(d)}return e.setPosition(r+32),[c,32]}let i=0;const s=[];for(let o=0;o<n;++o){const[a,c]=Qe(e,t,{staticPosition:r+i});i+=c,s.push(a)}return[s,i]}function Hu(e){return[Ls(e.readBytes(32),{size:32}),32]}function Vu(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=ue(e.readBytes(32));e.setPosition(n+o);const a=ue(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[le(c),32]}return[le(e.readBytes(Number.parseInt(i,10),32)),32]}function Gu(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[r>48?Os(i,{signed:n}):ue(i,{signed:n}),32]}function qu(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),i=r?[]:{};let s=0;if(Et(t)){const o=ue(e.readBytes(Gn)),a=n+o;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(a+s);const[d,f]=Qe(e,u,{staticPosition:a});s+=f,i[r?c:u?.name]=d}return e.setPosition(n+32),[i,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,u]=Qe(e,a,{staticPosition:n});i[r?o:a?.name]=c,s+=u}return[i,s]}function Wu(e,{staticPosition:t}){const n=ue(e.readBytes(32)),r=t+n;e.setPosition(r);const i=ue(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=Ms(Ue(s));return e.setPosition(t+32),[o,32]}function Et(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Et);const n=$r(e.type);return!!(n&&Et({...e,type:n[1]}))}function Zu(e){const{abi:t,data:n}=e,r=qt(n,0,4);if(r==="0x")throw new ds;const s=[...t||[],Nu,Uu].find(o=>o.type==="error"&&r===Er(rt(o)));if(!s)throw new Pc(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?un(s.inputs,qt(n,4)):void 0,errorName:s.name}}const Ku=(e,t,n)=>JSON.stringify(e,(r,i)=>{const s=typeof i=="bigint"?i.toString():i;return typeof t=="function"?t(r,s):s},n);function vr(e,t){return({exclude:n,format:r})=>({exclude:n,format:(i,s)=>{const o=t(i,s);if(n)for(const a of n)delete o[a];return{...o,...r(i,s)}},type:e})}const Yu={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Cs(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=Xu(e.authorizationList)),typeof e.accessList<"u"&&(n.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(n.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?n.blobs=e.blobs.map(r=>le(r)):n.blobs=e.blobs),typeof e.data<"u"&&(n.data=e.data),e.account&&(n.from=e.account.address),typeof e.from<"u"&&(n.from=e.from),typeof e.gas<"u"&&(n.gas=j(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=j(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=j(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=j(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=j(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=j(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=Yu[e.type]),typeof e.value<"u"&&(n.value=j(e.value)),n}const T0=vr("transactionRequest",Cs);function Xu(e){return e.map(t=>({address:t.address,r:t.r?j(BigInt(t.r)):t.r,s:t.s?j(BigInt(t.s)):t.s,chainId:j(t.chainId),nonce:j(t.nonce),...typeof t.yParity<"u"?{yParity:j(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:j(t.v)}:{}}))}const Ju={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Ns(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ht(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Ht(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?Ju[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(n.authorizationList=Qu(e.authorizationList)),n.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof n.v=="bigint"){if(n.v===0n||n.v===27n)return 0;if(n.v===1n||n.v===28n)return 1;if(n.v>=35n)return n.v%2n===0n?1:0}})(),n.type==="legacy"&&(delete n.accessList,delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas,delete n.yParity),n.type==="eip2930"&&(delete n.maxFeePerBlobGas,delete n.maxFeePerGas,delete n.maxPriorityFeePerGas),n.type==="eip1559"&&delete n.maxFeePerBlobGas,n}const _0=vr("transaction",Ns);function Qu(e){return e.map(t=>({address:t.address,chainId:Number(t.chainId),nonce:Number(t.nonce),r:t.r,s:t.s,yParity:Number(t.yParity)}))}function Us(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Ns(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:n,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}const z0=vr("block",Us);function ef(e,t){if(!Re(e,{strict:!1}))throw new Gt({address:e});if(!Re(t,{strict:!1}))throw new Gt({address:t});return e.toLowerCase()===t.toLowerCase()}const fi="/docs/contract/decodeEventLog";function tf(e){const{abi:t,data:n,strict:r,topics:i}=e,s=r??!0,[o,...a]=i;if(!o)throw new Ic({docsPath:fi});const c=t.find(y=>y.type==="event"&&o===cn(rt(y)));if(!(c&&"name"in c)||c.type!=="event")throw new ls(o,{docsPath:fi});const{name:u,inputs:d}=c,f=d?.some(y=>!("name"in y&&y.name)),l=f?[]:{},p=d.map((y,h)=>[y,h]).filter(([y])=>"indexed"in y&&y.indexed);for(let y=0;y<p.length;y++){const[h,m]=p[y],v=a[y];if(!v)throw new hs({abiItem:c,param:h});l[f?m:h.name||m]=nf({param:h,value:v})}const g=d.filter(y=>!("indexed"in y&&y.indexed));if(g.length>0){if(n&&n!=="0x")try{const y=un(g,n);if(y)if(f)for(let h=0;h<d.length;h++)l[h]=l[h]??y.shift();else for(let h=0;h<g.length;h++)l[g[h].name]=y[h]}catch(y){if(s)throw y instanceof fs||y instanceof zs?new Hn({abiItem:c,data:n,params:g,size:G(n)}):y}else if(s)throw new Hn({abiItem:c,data:"0x",params:g,size:0})}return{eventName:u,args:Object.values(l).length>0?l:void 0}}function nf({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(un([e],t)||[])[0]}function rf(e){const{abi:t,args:n,logs:r,strict:i=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(o=>{try{const a=t.find(u=>u.type==="event"&&o.topics[0]===cn(u));if(!a)return null;const c=tf({...o,abi:[a],strict:i});return s&&!s.includes(c.eventName)||!sf({args:c.args,inputs:a.inputs,matchArgs:n})?null:{...c,...o}}catch(a){let c,u;if(a instanceof ls)return null;if(a instanceof Hn||a instanceof hs){if(i)return null;c=a.abiItem.name,u=a.abiItem.inputs?.some(d=>!("name"in d&&d.name))}return{...o,args:u?[]:{},eventName:c}}}).filter(Boolean)}function sf(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function i(s,o,a){try{return s.type==="address"?ef(o,a):s.type==="string"||s.type==="bytes"?an(on(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((s,o)=>{if(s==null)return!0;const a=n[o];return a?(Array.isArray(s)?s:[s]).some(u=>i(a,u,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([s,o])=>{if(o==null)return!0;const a=n.find(u=>u.name===s);return a?(Array.isArray(o)?o:[o]).some(u=>i(a,u,t[s])):!1}):!1}function of(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const Bn=new WeakMap;async function fn(e){if(Bn.has(e))return Bn.get(e);const t=(async()=>{const[n,r,{concatHex:i}]=await Promise.all([Rs(e),ks(e),F(()=>Promise.resolve().then(()=>ap),void 0)]);return r?i([n,r]):n})();return Bn.set(e,t),t}async function Rs(e){if(e.data===void 0)return"0x";if(typeof e.data=="function"){const t=await e.data();return t||"0x"}return e.data}async function ks(e){if(e.extraCallData){if(typeof e.extraCallData=="function"){const t=await e.extraCallData();if(!t)return;if(!t.startsWith("0x"))throw Error("Invalid extra calldata - must be a hex string");return t==="0x"?void 0:t}if(!e.extraCallData.startsWith("0x"))throw Error("Invalid extra calldata - must be a hex string");return e.extraCallData}}const af=Object.freeze(Object.defineProperty({__proto__:null,encode:fn,getDataFromTx:Rs,getExtraCallDataFromTx:ks},Symbol.toStringTag,{value:"Module"}));async function cf(e,t){const n=t.blockTag??"latest",r=t.includeTransactions??!1,i=t.blockNumber!==void 0?de(t.blockNumber):void 0,s=await e({method:"eth_getBlockByNumber",params:[i||n,r]});if(!s)throw new Error("Block not found");return Us(s)}async function uf(e){const t=await e({method:"eth_maxPriorityFeePerGas"});return nn(t)}async function ff(e,t,n){const r=await ot(t)(e,{body:fe(n.requests),headers:{...t.config?.rpc?.fetch?.headers,"Content-Type":"application/json"},keepalive:t.config?.rpc?.fetch?.keepalive,method:"POST",requestTimeoutMs:n.requestTimeoutMs??t.config?.rpc?.fetch?.requestTimeoutMs});if(!r.ok){const i=await r.text().catch(()=>null);throw new Error(`RPC request failed with status ${r.status} - ${r.statusText}: ${i||"unknown error"}`)}return await r.json()}async function df(e,t,n){const r=await ot(t)(e,{body:fe(n.request),headers:{...t.config?.rpc?.fetch?.headers||{},"Content-Type":"application/json"},keepalive:t.config?.rpc?.fetch?.keepalive,method:"POST",requestTimeoutMs:n.requestTimeoutMs??t.config?.rpc?.fetch?.requestTimeoutMs});if(!r.ok){const i=await r.text().catch(()=>null);throw new Error(`RPC request failed with status ${r.status} - ${r.statusText}: ${i||"unknown error"}`)}return await r.json()}const Sn=new WeakMap;function lf(e){if(Sn.has(e))return Sn.get(e);const t=new Map;return Sn.set(e,t),t}function hf(e){return`${e.method}:${fe(e.params)}`}const pf=100,yf=0;function De(e){const t=lf(e.client),n=e.chain.rpc;if(t.has(n))return t.get(n);const r=(()=>{const i=ea({chain:e.chain,client:e.client}),s=e.config?.maxBatchSize??e.client.config?.rpc?.maxBatchSize??pf,o=e.config?.batchTimeoutMs??e.client.config?.rpc?.batchTimeoutMs??yf,a=new Map;let c=[],u=null;function d(){u&&(clearTimeout(u),u=null);const f=new Array(c.length),l=c.slice().map((p,g)=>(p.request.id=g,p.request.jsonrpc="2.0",f[g]=p.request,p));c=[],ff(i,e.client,{requests:f,requestTimeoutMs:e.config?.requestTimeoutMs}).then(p=>{l.forEach((g,y)=>{const h=p[y];h?h instanceof Error?g.reject(h):"error"in h?g.reject(h.error):typeof h=="string"?g.reject(new Error(h)):h.method==="eth_subscription"?g.reject("Subscriptions not supported yet"):g.resolve(h.result):g.reject(new Error(`RPC Error from ${i}:
|
|
25
25
|
requests: ${fe(f)}
|
|
26
|
-
responses: ${fe(p)}`))})}).catch(p=>{for(const g of l)g.reject(p)}).finally(()=>{a.clear()})}return s===1?async f=>{f.id=1,f.jsonrpc="2.0";const l=await df(i,e.client,{request:f,requestTimeoutMs:e.config?.requestTimeoutMs});if(!l)throw new Error("No response");if("error"in l)throw l.error;return l.result}:async f=>{const l=hf(f);if(a.has(l))return a.get(l);let p,g;const y=new Promise((h,m)=>{p=h,g=m});return a.set(l,y),c.push({reject:g,request:f,requestKey:l,resolve:p}),s>1?(u||(u=setTimeout(d,o)),c.length>=s&&d()):d(),y}})();return t.set(n,r),r}const gf=Object.freeze(Object.defineProperty({__proto__:null,getRpcClient:De},Symbol.toStringTag,{value:"Module"}));async function q(e){return typeof e=="function"?await e():e}function js(e,t){const n=e.toString(),r=n[0]==="-"?"-":"",s=(r?n.slice(1):n).padStart(t+1,"0"),o=s.length-t,a=s.slice(0,o)||"0";let c=s.slice(o);for(let u=c.length-1;u>=0;u--){if(c[u]!=="0"){c=c.slice(0,u+1);break}u===0&&(c="")}return`${r}${a}${c?`.${c}`:""}`}function mf(e){return js(e,18)}function dn(e,t){e.includes("e")&&(e=Number(e).toFixed(t));let[n,r=""]=e.split(".");const i=n.startsWith("-")?"-":"";if(i&&(n=n.slice(1)),r=r.padEnd(t,"0"),t===0)r[0]&&Number.parseInt(r[0])>=5&&(n=(BigInt(n)+1n).toString()),r="";else if(r.length>t){const s=r[t];s&&Number.parseInt(s,10)>=5?(r=(BigInt(r.substring(0,t))+1n).toString().padStart(t,"0"),r.length>t&&(n=(BigInt(n)+1n).toString(),r=r.substring(r.length-t))):r=r.substring(0,t)}return BigInt(`${i}${n}${r}`)}function bf(e){return dn(e,18)}function wf(e){return dn(e,9)}const O0=Object.freeze(Object.defineProperty({__proto__:null,fromGwei:wf,toEther:mf,toTokens:js,toUnits:dn,toWei:bf},Symbol.toStringTag,{value:"Module"}));async function xf(e){const t=await e({method:"eth_gasPrice"});return nn(t)}async function di(e){const{client:t,chain:n,percentMultiplier:r}=e,i=De({chain:n,client:t}),s=await xf(i),o=r?s/BigInt(100)*BigInt(r):0n;return s+o}function gt(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const $f=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function Fs(e){const[t,n,r,i]=await Promise.all([q(e.maxFeePerGas),q(e.maxPriorityFeePerGas),q(e.gasPrice),q(e.type)]);if(t!==void 0&&n!==void 0)return{maxFeePerGas:t,maxPriorityFeePerGas:n};if(typeof r=="bigint")return{gasPrice:r};const s=await Ds(e.client,e.chain,i==="legacy"?"legacy":"eip1559");return e.chain.experimental?.increaseZeroByteCount?s.gasPrice?{gasPrice:gt(s.gasPrice)}:{maxFeePerGas:t??gt(s.maxFeePerGas??0n),maxPriorityFeePerGas:n??gt(s.maxPriorityFeePerGas??0n)}:s.gasPrice!==void 0?s:{maxFeePerGas:t??s.maxFeePerGas,maxPriorityFeePerGas:n??s.maxPriorityFeePerGas}}async function Ds(e,t,n){if((n??t.feeType)==="legacy"||$f.includes(t.id))return{gasPrice:await di({chain:t,client:e,percentMultiplier:10})};const i=await Ef(e,t);return i.maxFeePerGas!==null&&i.maxPriorityFeePerGas!==null?{maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}:{gasPrice:await di({chain:t,client:e,percentMultiplier:10})}}async function Ef(e,t,n=10){let r=null,i=null;const s=De({chain:t,client:e}),[o,a]=await Promise.all([cf(s,{blockTag:"latest"}),uf(s).catch(()=>null)]),c=o?.baseFeePerGas,u=t.id;return u===220||u===1220?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(u===80002||u===137?i=await If(u):a!==null&&(i=a),i==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(i=vf(i,n),r=c*2n+i,(u===42220||u===44787||u===62320)&&(i=r),{maxFeePerGas:r,maxPriorityFeePerGas:i}))}function vf(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function Af(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const Pf=31n;async function If(e){const t=Af(e);try{const r=(await(await fetch(t)).json()).fast.maxPriorityFee;if(r>0){const i=Number.parseFloat(r).toFixed(9);return dn(i,9)}}catch(n){console.error("failed to fetch gas",n)}return Pf}const L0=Object.freeze(Object.defineProperty({__proto__:null,getDefaultGasOverrides:Ds,getGasOverridesForTransaction:Fs},Symbol.toStringTag,{value:"Module"}));async function Hs(e){if(e.id===1337||e.id===31337)return!1;if(e.id===324||e.id===300||e.id===302||e.id===11124||e.id===282||e.id===388||e.id===4654||e.id===333271||e.id===37111||e.id===978658||e.id===531050104||e.id===4457845||e.id===2741||e.id===240||e.id===555271||e.id===61166||e.id===555272)return!0;try{const{getChainMetadata:t}=await F(async()=>{const{getChainMetadata:r}=await import("./utils-
|
|
27
|
-
`);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}}function Ee(e,t){return e.exec(t)?.groups}const Gs=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,qs=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Ws=/^\(.+?\).*?$/,li=/^tuple(?<array>(\[(\d*)\])*)$/;function qn(e){let t=e.type;if(li.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const s=e.components[i];t+=qn(s),i<n-1&&(t+=", ")}const r=Ee(li,e.type);return t+=`)${r?.array??""}`,qn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ke(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=qn(i),r!==n-1&&(t+=", ")}return t}function Wt(e){return e.type==="function"?`function ${e.name}(${Ke(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Ke(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ke(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ke(e.inputs)})`:e.type==="constructor"?`constructor(${Ke(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function Of(e){const t=[],n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Wt(i);t.push(s)}return t}const Zs=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Lf(e){return Zs.test(e)}function Mf(e){return Ee(Zs,e)}const Ks=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Cf(e){return Ks.test(e)}function Nf(e){return Ee(Ks,e)}const Ys=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Uf(e){return Ys.test(e)}function Rf(e){return Ee(Ys,e)}const Xs=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ar(e){return Xs.test(e)}function kf(e){return Ee(Xs,e)}const Js=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function jf(e){return Js.test(e)}function Ff(e){return Ee(Js,e)}const Qs=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Df(e){return Qs.test(e)}function Hf(e){return Ee(Qs,e)}const Vf=/^receive\(\) external payable$/;function Gf(e){return Vf.test(e)}const qf=new Set(["indexed"]),Wn=new Set(["calldata","memory","storage"]);class Wf extends W{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Zf extends W{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Kf extends W{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Yf extends W{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Xf extends W{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Jf extends W{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Qf extends W{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class ed extends W{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class ft extends W{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class td extends W{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class nd extends W{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class rd extends W{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class id extends W{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function sd(e,t,n){let r="";if(n)for(const i of Object.entries(n)){if(!i)continue;let s="";for(const o of i[1])s+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${i[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Tn=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Zn(e,t={}){if(Uf(e))return od(e,t);if(Cf(e))return ad(e,t);if(Lf(e))return cd(e,t);if(jf(e))return ud(e,t);if(Df(e))return fd(e);if(Gf(e))return{type:"receive",stateMutability:"payable"};throw new td({signature:e})}function od(e,t={}){const n=Rf(e);if(!n)throw new ft({signature:e,type:"function"});const r=oe(n.parameters),i=[],s=r.length;for(let a=0;a<s;a++)i.push(ke(r[a],{modifiers:Wn,structs:t,type:"function"}));const o=[];if(n.returns){const a=oe(n.returns),c=a.length;for(let u=0;u<c;u++)o.push(ke(a[u],{modifiers:Wn,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:i,outputs:o}}function ad(e,t={}){const n=Nf(e);if(!n)throw new ft({signature:e,type:"event"});const r=oe(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(ke(r[o],{modifiers:qf,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:i}}function cd(e,t={}){const n=Mf(e);if(!n)throw new ft({signature:e,type:"error"});const r=oe(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(ke(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:i}}function ud(e,t={}){const n=Ff(e);if(!n)throw new ft({signature:e,type:"constructor"});const r=oe(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(ke(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:i}}function fd(e){const t=Hf(e);if(!t)throw new ft({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const dd=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ld=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,hd=/^u?int$/;function ke(e,t){const n=sd(e,t?.type,t?.structs);if(Tn.has(n))return Tn.get(n);const r=Ws.test(e),i=Ee(r?ld:dd,e);if(!i)throw new Yf({param:e});if(i.name&&yd(i.name))throw new Xf({param:e,name:i.name});const s=i.name?{name:i.name}:{},o=i.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{};let c,u={};if(r){c="tuple";const f=oe(i.type),l=[],p=f.length;for(let g=0;g<p;g++)l.push(ke(f[g],{structs:a}));u={components:l}}else if(i.type in a)c="tuple",u={components:a[i.type]};else if(hd.test(i.type))c=`${i.type}256`;else if(c=i.type,t?.type!=="struct"&&!eo(c))throw new Kf({type:c});if(i.modifier){if(!t?.modifiers?.has?.(i.modifier))throw new Jf({param:e,type:t?.type,modifier:i.modifier});if(Wn.has(i.modifier)&&!gd(c,!!i.array))throw new Qf({param:e,type:t?.type,modifier:i.modifier})}const d={type:`${c}${i.array??""}`,...s,...o,...u};return Tn.set(n,d),d}function oe(e,t=[],n="",r=0){const i=e.trim().length;for(let s=0;s<i;s++){const o=e[s],a=e.slice(s+1);switch(o){case",":return r===0?oe(a,[...t,n.trim()]):oe(a,t,`${n}${o}`,r);case"(":return oe(a,t,`${n}${o}`,r+1);case")":return oe(a,t,`${n}${o}`,r-1);default:return oe(a,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new id({current:n,depth:r});return t.push(n.trim()),t}function eo(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Gs.test(e)||qs.test(e)}const pd=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function yd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Gs.test(e)||qs.test(e)||pd.test(e)}function gd(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function to(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!Ar(a))continue;const c=kf(a);if(!c)throw new ft({signature:a,type:"struct"});const u=c.properties.split(";"),d=[],f=u.length;for(let l=0;l<f;l++){const g=u[l].trim();if(!g)continue;const y=ke(g,{type:"struct"});d.push(y)}if(!d.length)throw new nd({signature:a});t[c.name]=d}const r={},i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,c]=i[o];r[a]=no(c,t)}return r}const md=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function no(e,t,n=new Set){const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(Ws.test(o.type))r.push(o);else{const c=Ee(md,o.type);if(!c?.type)throw new ed({abiParameter:o});const{array:u,type:d}=c;if(d in t){if(n.has(d))throw new rd({type:d});r.push({...o,type:`tuple${u??""}`,components:no(t[d]??[],t,new Set([...n,d]))})}else if(eo(d))r.push(o);else throw new Zf({type:d})}}return r}function ro(e){const t=to(e),n=[],r=e.length;for(let i=0;i<r;i++){const s=e[i];Ar(s)||n.push(Zn(s,t))}return n}function st(e){let t;if(typeof e=="string")t=Zn(e);else{const n=to(e),r=e.length;for(let i=0;i<r;i++){const s=e[i];if(!Ar(s)){t=Zn(s,n);break}}}if(!t)throw new Wf({signature:e});return t}const bd=of({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://11155111.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:8928790}},testnet:!0}),wd="https://{clientId}.ipfscdn.io/ipfs/{cid}";function xd(e){if(e.uri.startsWith("ipfs://")){const t=e.client.config?.storage?.gatewayUrl??wd,n=e.client.clientId,r=$d(e.uri);let i;return typeof globalThis<"u"&&"Application"in globalThis&&(i=globalThis.Application.applicationId),`${t.replace("{clientId}",n).split("/ipfs")[0]}/ipfs/${r}${i?`?bundleId=${i}`:""}`}if(e.uri.startsWith("http"))return e.uri;throw new Error('Invalid URI scheme, expected "ipfs://" or "http(s)://"')}function $d(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}async function io(e){let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:r}=await F(async()=>{const{resolveArweaveScheme:i}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:i}},[]);t=r(e)}else t=xd(e);const n=await ot(e.client)(t,{headers:e.client.config?.storage?.fetch?.headers,keepalive:e.client.config?.storage?.fetch?.keepalive,requestTimeoutMs:e.requestTimeoutMs??e.client.config?.storage?.fetch?.requestTimeoutMs??6e4});if(!n.ok){const r=await n.text();throw new Error(`Failed to download file: ${n.status} ${n.statusText} ${r||""}`)}return n}const C0=Object.freeze(Object.defineProperty({__proto__:null,download:io},Symbol.toStringTag,{value:"Module"}));function Ed(e,t="https://contract.thirdweb.com/abi"){return Oi(async()=>{if(e.abi)return e.abi;if(e.chain.id===31337||e.chain.id===1337||e.chain.id===bd.id)return await hi(e);try{return await vd(e,t)}catch{return await hi(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function vd(e,t="https://contract.thirdweb.com/abi"){const r=await(await ot(e.client)(`${t}/${e.chain.id}/${e.address}`)).json();if(!r||r.error)throw new Error(`Failed to resolve ABI from contract API. ${r.error||""}`);return r}async function so(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([F(()=>import("./resolveImplementation-iG9WRRnW.js"),__vite__mapDeps([3,4,0,1,2])),F(()=>import("./extractIPFS-BOFlZk7U.js"),__vite__mapDeps([5,0,1,2]))]),{bytecode:r}=await t(e);if(r==="0x"){const{id:s,name:o}=e.chain;throw new Error(`Failed to load contract bytecode. Make sure the contract [${e.address}] exists on the chain [${o||"Unknown Chain"} (chain id: ${s})]`)}const i=n(r);if(!i)return[];try{return(await(await io({client:e.client,uri:i})).json()).output.abi}catch{return[]}}const Ad={inputs:[],name:"getAllPlugins",outputs:[{components:[{internalType:"bytes4",name:"functionSelector",type:"bytes4"},{internalType:"string",name:"functionSignature",type:"string"},{internalType:"address",name:"pluginAddress",type:"address"}],internalType:"struct IPluginMap.Plugin[]",name:"registered",type:"tuple[]"}],stateMutability:"view",type:"function"},Pd={inputs:[],name:"getAllExtensions",outputs:[{components:[{components:[{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"metadataURI",type:"string"},{internalType:"address",name:"implementation",type:"address"}],internalType:"struct IExtension.ExtensionMetadata",name:"metadata",type:"tuple"},{components:[{internalType:"bytes4",name:"functionSelector",type:"bytes4"},{internalType:"string",name:"functionSignature",type:"string"}],internalType:"struct IExtension.ExtensionFunction[]",name:"functions",type:"tuple[]"}],internalType:"struct IExtension.Extension[]",name:"allExtensions",type:"tuple[]"}],stateMutability:"view",type:"function"},Id={inputs:[],name:"facets",outputs:[{components:[{internalType:"address",name:"facetAddress",type:"address"},{internalType:"bytes4[]",name:"functionSelectors",type:"bytes4[]"}],type:"tuple[]"}],stateMutability:"view",type:"function"};async function hi(e,t,n){const[r,i,s,o,a]=await Promise.all([so(e),Bd(e),Sd(e),Td(e),_d(e)]),c=[...new Set([...i,...s,...o,...a])];if(!c.length)return r;const u=await zd({contract:e,plugins:c,resolveSubAbi:n});return Od({pluginAbis:u,rootAbi:r})}async function Bd(e){try{const{readContract:t}=await F(async()=>{const{readContract:r}=await Promise.resolve().then(()=>Ur);return{readContract:r}},void 0),n=await t({contract:e,method:Ad});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function Sd(e){try{const{readContract:t}=await F(async()=>{const{readContract:r}=await Promise.resolve().then(()=>Ur);return{readContract:r}},void 0),n=await t({contract:e,method:Pd});return n.length?[...new Set(n.map(r=>r.metadata.implementation))]:[]}catch{}return[]}async function Td(e){try{const{getInstalledModules:t}=await F(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-Dkj379ys.js");return{getInstalledModules:r}},__vite__mapDeps([6,7,0,1,2])),n=await t({contract:e});return n.length?[...new Set(n.map(r=>r.implementation))]:[]}catch{}return[]}async function _d(e){try{const{readContract:t}=await F(async()=>{const{readContract:r}=await Promise.resolve().then(()=>Ur);return{readContract:r}},void 0),n=await t({contract:e,method:Id});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function zd(e){return Promise.all(e.plugins.map(t=>{const n=Ut({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):so(n)}))}function Od(e){let t=e.pluginAbis.flat().filter(r=>r.type!=="constructor");e.rootAbi&&(t=[...e.rootAbi,...t].filter(r=>r.type!=="fallback"&&r.type!=="receive").filter(Boolean));const n=[...new Set(Of(t))];return ro(n)}async function pi(e){const{error:t,contract:n,fromAddress:r}=e;Bf(t)&&n&&_f({chainId:n.chain?.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const i=await Ld({contract:n,error:t});return i?new Md(i,n):t}async function Ld(e){const{error:t,contract:n}=e;if(typeof t=="object"){const r=t;if(r.data&&r.data!=="0x"&&Fe(r.data)){let i=n?.abi;n&&!i&&(i=await Ed(n).catch(()=>{}));const s=Zu({abi:i,data:r.data});return`${s.errorName}${s.args?` - ${s.args}`:""}`}}return`Execution Reverted: ${Ku(t)}`}class Md extends Error{constructor(t,n){let r=t;super(r),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chainId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TransactionError",this.contractAddress=n?.address,this.chainId=n?.chain?.id,this.message=r}}const _n=new WeakMap;async function oo(e){const t=typeof e.from=="string"?e.from??void 0:e.from?.address??e.account?.address,n={...e.transaction,from:t};if(_n.has(n))return _n.get(n);const{account:r}=e,i=(async()=>{const s=await q(e.transaction.gas);if(s!==void 0)return s;if(r?.estimateGas)try{let g=await r.estimateGas(e.transaction);return e.transaction.chain.experimental?.increaseZeroByteCount&&(g=gt(g)),g}catch(g){throw await pi({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:o}=await F(async()=>{const{encode:g}=await Promise.resolve().then(()=>af);return{encode:g}},void 0),[a,c,u,d]=await Promise.all([o(e.transaction),q(e.transaction.to),q(e.transaction.value),q(e.transaction.authorizationList)]),[{getRpcClient:f},{eth_estimateGas:l}]=await Promise.all([F(()=>Promise.resolve().then(()=>gf),void 0),F(()=>import("./eth_estimateGas-DKKwG-Ue.js"),__vite__mapDeps([8,0,1,2]))]),p=f(e.transaction);try{const g=Cs({authorizationList:d?.map(h=>({...h,address:Ie(h.address),nonce:Number(h.nonce),r:E(h.r),s:E(h.s)})),data:a,from:t?Ie(t):void 0,to:c?Ie(c):void 0,value:u});let y=await l(p,g);return e.transaction.chain.experimental?.increaseZeroByteCount&&(y=gt(y)),y}catch(g){throw await pi({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return _n.set(n,i),i}const N0=Object.freeze(Object.defineProperty({__proto__:null,estimateGas:oo},Symbol.toStringTag,{value:"Module"}));async function Cd(e){if(await Hs(e.transaction.chain)){const{getZkGasFees:y}=await F(async()=>{const{getZkGasFees:A}=await import("./send-eip712-transaction-CB6qLgks.js").then(T=>T.a);return{getZkGasFees:A}},__vite__mapDeps([9,1,2,10])),{gas:h,maxFeePerGas:m,maxPriorityFeePerGas:v}=await y({from:typeof e.from=="string"?Ie(e.from):e.from!==void 0?Ie(e.from.address):void 0,transaction:e.transaction});e.transaction={...e.transaction,gas:h,maxFeePerGas:m,maxPriorityFeePerGas:v}}const n=De(e.transaction),r=e.transaction.chain.id,i=e.from;let[s,o,a,c,u,d,f,l,p]=await Promise.all([fn(e.transaction),(async()=>{const y=await q(e.transaction.nonce);return y!==void 0?y:i?await F(async()=>{const{eth_getTransactionCount:h}=await import("./eth_getTransactionCount-qv0oO1Md.js");return{eth_getTransactionCount:h}},__vite__mapDeps([11,0,1,2])).then(({eth_getTransactionCount:h})=>h(n,{address:Ie(typeof i=="string"?i:i.address),blockTag:"pending"})):void 0})(),oo({...e,from:e.from}),Fs(e.transaction),q(e.transaction.to),q(e.transaction.accessList),q(e.transaction.value),q(e.transaction.authorizationList),q(e.transaction.type)]);const g=await q(e.transaction.extraGas);return g&&(a+=g),{accessList:d,authorizationList:l,chainId:r,data:s,gas:a,nonce:o,to:u,type:p,value:f,...c}}function Nd(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{balance:n.balance?de(n.balance):void 0,code:n.code,nonce:n.nonce?de(n.nonce):void 0,state:n.state,stateDiff:n.stateDiff}]))}async function ao(e,t){const{blockNumber:n,blockTag:r,...i}=t,o=(n?de(n):void 0)||r||"latest";return await e({method:"eth_call",params:t.stateOverrides?[i,o,Nd(t.stateOverrides)]:[i,o]})}async function U0(e,t){const n=await e({method:"eth_getBalance",params:[t.address,t.blockTag||"latest"]});return nn(n)}async function Ud(e,t){return e({method:"eth_getCode",params:[t.address,t.blockTag||"latest"]})}async function R0(e,t){return await e({method:"eth_sendRawTransaction",params:[t]})}async function k0({client:e,walletAddress:t,email:n,phone:r,id:i,externalWalletAddress:s,ecosystem:o}){if(!e.secretKey)throw new Error("A secret key is required to query for users. If you're making this request from the server, please add a secret key to your client.");const a=new URL(`${zi("inAppWallet")}/api/2023-11-30/embedded-wallet/user-details`);if(t)a.searchParams.set("queryBy","walletAddress"),a.searchParams.set("walletAddress",t);else if(n)a.searchParams.set("queryBy","email"),a.searchParams.set("email",n);else if(r)a.searchParams.set("queryBy","phone"),a.searchParams.set("phone",r);else if(i)a.searchParams.set("queryBy","id"),a.searchParams.set("id",i);else if(s)a.searchParams.set("queryBy","externalWalletAddress"),a.searchParams.set("externalWalletAddress",s);else throw new Error("Please provide a walletAddress, email, phone, id, or externalWalletAddress to query for users.");const u=await ot(e,o)(a.toString());if(!u.ok){const f=await u.text().catch(()=>"Unknown error");throw new Error(`Failed to get profiles. ${u.status} ${u.statusText}: ${f}`)}return(await u.json()).map(f=>({createdAt:f.createdAt,email:f.email,phone:f.phone,profiles:f.linkedAccounts.map(l=>({details:l.details,type:l.type==="siwe"?"wallet":l.type})),smartAccountAddress:f.smartAccountAddress,userId:f.userId,walletAddress:f.walletAddress}))[0]||null}function Rd(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="event")}function j0(e){const{signature:t}=e;let n;return Rd(t)?n=t:n=st(t),{abiEvent:n,hash:mr(n),topics:Cu({abi:[n],args:e.filters})}}function F0(e){const{logs:t,events:n,strict:r}=e;return rf({abi:n.map(i=>i.abiEvent),logs:t,strict:r})}function kd(e){for(const t of e)if(typeof t!="string")return!1;return!0}function jd(e){return kd(e)?ro(e):e}function ne(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=ns(jn(e));return n==="Bytes"?r:Y(r)}class Fd extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const Dd={checksum:new Fd(8192)},zn=Dd.checksum;function co(e,t={}){const{compressed:n}=t,{prefix:r,x:i,y:s}=e;if(n===!1||typeof i=="bigint"&&typeof s=="bigint"){if(r!==4)throw new yi({prefix:r,cause:new Zd});return}if(n===!0||typeof i=="bigint"&&typeof s>"u"){if(r!==3&&r!==2)throw new yi({prefix:r,cause:new Wd});return}throw new qd({publicKey:e})}function Hd(e){const t=(()=>{if(fr(e))return uo(e);if(Ta(e))return Vd(e);const{prefix:n,x:r,y:i}=e;return typeof r=="bigint"&&typeof i=="bigint"?{prefix:n??4,x:r,y:i}:{prefix:n,x:r}})();return co(t),t}function Vd(e){return uo(Y(e))}function uo(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new Kd({publicKey:e});if(e.length===130){const r=BigInt(K(e,0,32)),i=BigInt(K(e,32,64));return{prefix:4,x:r,y:i}}if(e.length===132){const r=Number(K(e,0,1)),i=BigInt(K(e,1,33)),s=BigInt(K(e,33,65));return{prefix:r,x:i,y:s}}const t=Number(K(e,0,1)),n=BigInt(K(e,1,33));return{prefix:t,x:n}}function Gd(e,t={}){co(e);const{prefix:n,x:r,y:i}=e,{includePrefix:s=!0}=t;return N(s?E(n,{size:1}):"0x",E(r,{size:32}),typeof i=="bigint"?E(i,{size:32}):"0x")}class qd extends ${constructor({publicKey:t}){super(`Value \`${at(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class yi extends ${constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class Wd extends ${constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class Zd extends ${constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let Kd=class extends ${constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${R(en(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Yd=/^0x[a-fA-F0-9]{40}$/;function he(e,t={}){const{strict:n=!0}=t;if(!Yd.test(e))throw new Kn({address:e,cause:new fo});if(n){if(e.toLowerCase()===e)return;if(Pr(e)!==e)throw new Kn({address:e,cause:new Qd})}}function Pr(e){if(zn.has(e))return zn.get(e);he(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=ne(dr(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const i=`0x${r.join("")}`;return zn.set(e,i),i}function Xd(e,t={}){const{checksum:n=!1}=t;return he(e),n?Pr(e):e}function Jd(e,t={}){const n=ne(`0x${Gd(e).slice(4)}`).substring(26);return Xd(`0x${n}`,t)}function Zt(e,t={}){const{strict:n=!0}=t??{};try{return he(e,{strict:n}),!0}catch{return!1}}class Kn extends ${constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class fo extends ${constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Qd extends ${constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Yn(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new $("Unable to normalize signature.");return i}function Xn(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Zt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((i,s)=>Xn(Object.values(e)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(i=>Xn(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function lo(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return lo(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Zt(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?Zt(n[r],{strict:!1}):!1)return o}}function el(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?st(e):e;return{...r,...n?{hash:Xe(r)}:{}}}function tl(e,t,n){const{args:r=[],prepare:i=!0}=n??{},s=fr(t,{strict:!1}),o=e.filter(u=>s?u.type==="function"||u.type==="error"?ho(u)===K(t,0,4):u.type==="event"?Xe(u)===t:!1:"name"in u&&u.name===t);if(o.length===0)throw new Kt({name:t});if(o.length===1)return{...o[0],...i?{hash:Xe(o[0])}:{}};let a;for(const u of o){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...i?{hash:Xe(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,l)=>{const p="inputs"in u&&u.inputs[l];return p?Xn(f,p):!1})){if(a&&"inputs"in a&&a.inputs){const f=lo(u.inputs,a.inputs,r);if(f)throw new rl({abiItem:u,type:f[0]},{abiItem:a,type:f[1]})}a=u}}const c=(()=>{if(a)return a;const[u,...d]=o;return{...u,overloads:d}})();if(!c)throw new Kt({name:t});return{...c,...i?{hash:Xe(c)}:{}}}function ho(e){return K(Xe(e),0,4)}function nl(e){const t=typeof e=="string"?e:Wt(e);return Yn(t)}function Xe(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:ne(It(nl(e)))}class rl extends ${constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Yn(Wt(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Yn(Wt(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Kt extends ${constructor({name:t,data:n,type:r="item"}){const i=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${i} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}class il extends ${constructor({data:t}){super(`Selector size is invalid. Expected 4 bytes. Received ${R(t)} bytes ("${t}").`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.InvalidSelectorSizeError"})}}const sl=/^(.*)\[([0-9]*)\]$/,po=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ir=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,H0=2n**96n-1n,gi=2n**256n-1n;function et(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=Tr(t.type);if(s){const[o,a]=s;return al(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:i})}if(t.type==="tuple")return dl(e,t,{checksumAddress:r,staticPosition:i});if(t.type==="address")return ol(e,{checksum:r});if(t.type==="bool")return cl(e);if(t.type.startsWith("bytes"))return ul(e,t,{staticPosition:i});if(t.type.startsWith("uint")||t.type.startsWith("int"))return fl(e,t);if(t.type==="string")return ll(e,{staticPosition:i});throw new _r(t.type)}const mi=32,Jn=32;function ol(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Pr(s):s)(Y(Sa(r,-20))),32]}function al(e,t,n){const{checksumAddress:r,length:i,staticPosition:s}=n;if(!i){const c=ce(e.readBytes(Jn)),u=s+c,d=u+mi;e.setPosition(u);const f=ce(e.readBytes(mi)),l=vt(t);let p=0;const g=[];for(let y=0;y<f;++y){e.setPosition(d+(l?y*32:p));const[h,m]=et(e,t,{checksumAddress:r,staticPosition:d});p+=m,g.push(h)}return e.setPosition(s+32),[g,32]}if(vt(t)){const c=ce(e.readBytes(Jn)),u=s+c,d=[];for(let f=0;f<i;++f){e.setPosition(u+f*32);const[l]=et(e,t,{checksumAddress:r,staticPosition:u});d.push(l)}return e.setPosition(s+32),[d,32]}let o=0;const a=[];for(let c=0;c<i;++c){const[u,d]=et(e,t,{checksumAddress:r,staticPosition:s+o});o+=d,a.push(u)}return[a,o]}function cl(e){return[qi(e.readBytes(32),{size:32}),32]}function ul(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=ce(e.readBytes(32));e.setPosition(n+o);const a=ce(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Y(c),32]}return[Y(e.readBytes(Number.parseInt(i),32)),32]}function fl(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),i=e.readBytes(32);return[r>48?Gi(i,{signed:n}):ce(i,{signed:n}),32]}function dl(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=t.components.length===0||t.components.some(({name:c})=>!c),o=s?[]:{};let a=0;if(vt(t)){const c=ce(e.readBytes(Jn)),u=i+c;for(let d=0;d<t.components.length;++d){const f=t.components[d];e.setPosition(u+a);const[l,p]=et(e,f,{checksumAddress:r,staticPosition:u});a+=p,o[s?d:f?.name]=l}return e.setPosition(i+32),[o,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[d,f]=et(e,u,{checksumAddress:r,staticPosition:i});o[s?c:u?.name]=d,a+=f}return[o,a]}function ll(e,{staticPosition:t}){const n=ce(e.readBytes(32)),r=t+n;e.setPosition(r);const i=ce(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=Wi(Zi(s));return e.setPosition(t+32),[o,32]}function hl({checksumAddress:e,parameters:t,values:n}){const r=[];for(let i=0;i<t.length;i++)r.push(Br({checksumAddress:e,parameter:t[i],value:n[i]}));return r}function Br({checksumAddress:e=!1,parameter:t,value:n}){const r=t,i=Tr(r.type);if(i){const[s,o]=i;return yl(n,{checksumAddress:e,length:s,parameter:{...r,type:o}})}if(r.type==="tuple")return xl(n,{checksumAddress:e,parameter:r});if(r.type==="address")return pl(n,{checksum:e});if(r.type==="bool")return ml(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,o="256"]=Ir.exec(r.type)??[];return bl(n,{signed:s,size:Number(o)})}if(r.type.startsWith("bytes"))return gl(n,{type:r.type});if(r.type==="string")return wl(n);throw new _r(r.type)}function Sr(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=R(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(E(t+i,{size:32})),r.push(a),i+=R(a)):n.push(a)}return N(...n,...r)}function pl(e,t){const{checksum:n=!1}=t;return he(e,{strict:n}),{dynamic:!1,encoded:Te(e.toLowerCase())}}function yl(e,t){const{checksumAddress:n,length:r,parameter:i}=t,s=r===null;if(!Array.isArray(e))throw new Sl(e);if(!s&&e.length!==r)throw new Bl({expectedLength:r,givenLength:e.length,type:`${i.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const u=Br({checksumAddress:n,parameter:i,value:e[c]});u.dynamic&&(o=!0),a.push(u)}if(s||o){const c=Sr(a);if(s){const u=E(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?N(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:N(...a.map(({encoded:c})=>c))}}function gl(e,{type:t}){const[,n]=t.split("bytes"),r=R(e);if(!n){let i=e;return r%32!==0&&(i=_e(i,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:N(Te(E(r,{size:32})),i)}}if(r!==Number.parseInt(n))throw new go({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:_e(e)}}function ml(e){if(typeof e!="boolean")throw new $(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Te(ur(e))}}function bl(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new Di({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:E(e,{size:32,signed:t})}}function wl(e){const t=It(e),n=Math.ceil(R(t)/32),r=[];for(let i=0;i<n;i++)r.push(_e(K(t,i*32,(i+1)*32)));return{dynamic:!0,encoded:N(_e(E(R(t),{size:32})),...r)}}function xl(e,t){const{checksumAddress:n,parameter:r}=t;let i=!1;const s=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,u=Br({checksumAddress:n,parameter:a,value:e[c]});s.push(u),u.dynamic&&(i=!0)}return{dynamic:i,encoded:i?Sr(s):N(...s.map(({encoded:o})=>o))}}function Tr(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function vt(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(vt);const n=Tr(e.type);return!!(n&&vt({...e,type:n[1]}))}const $l={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new vl({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new El({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new bi({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new bi({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function yo(e,{recursiveReadLimit:t=8192}={}){const n=Object.create($l);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class bi extends ${constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class El extends ${constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class vl extends ${constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Al(e,t,n={}){const{as:r="Array",checksumAddress:i=!1}=n,s=typeof t=="string"?ze(t):t,o=yo(s);if(Ye(s)===0&&e.length>0)throw new Il;if(Ye(s)&&Ye(s)<32)throw new Pl({data:typeof t=="string"?t:Y(t),parameters:e,size:Ye(s)});let a=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const d=e[u];o.setPosition(a);const[f,l]=et(o,d,{checksumAddress:i,staticPosition:0});a+=l,r==="Array"?c.push(f):c[d.name??u]=f}return c}function ln(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new mo({expectedLength:e.length,givenLength:t.length});const i=hl({checksumAddress:r,parameters:e,values:t}),s=Sr(i);return s.length===0?"0x":s}function Qn(e,t){if(e.length!==t.length)throw new mo({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r];n.push(Qn.encode(i,s))}return N(...n)}(function(e){function t(n,r,i=!1){if(n==="address"){const c=r;return he(c),Te(c.toLowerCase(),i?32:0)}if(n==="string")return It(r);if(n==="bytes")return r;if(n==="bool")return Te(ur(r),i?32:1);const s=n.match(Ir);if(s){const[c,u,d="256"]=s,f=Number.parseInt(d)/8;return E(r,{size:i?32:f,signed:u==="int"})}const o=n.match(po);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new go({expectedSize:Number.parseInt(u),value:r});return _e(r,i?32:0)}const a=n.match(sl);if(a&&Array.isArray(r)){const[c,u]=a,d=[];for(let f=0;f<r.length;f++)d.push(t(u,r[f],!0));return d.length===0?"0x":N(...d)}throw new _r(n)}e.encode=t})(Qn||(Qn={}));class Pl extends ${constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Ke(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Il extends ${constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Bl extends ${constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}let go=class extends ${constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${R(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}};class mo extends ${constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
26
|
+
responses: ${fe(p)}`))})}).catch(p=>{for(const g of l)g.reject(p)}).finally(()=>{a.clear()})}return s===1?async f=>{f.id=1,f.jsonrpc="2.0";const l=await df(i,e.client,{request:f,requestTimeoutMs:e.config?.requestTimeoutMs});if(!l)throw new Error("No response");if("error"in l)throw l.error;return l.result}:async f=>{const l=hf(f);if(a.has(l))return a.get(l);let p,g;const y=new Promise((h,m)=>{p=h,g=m});return a.set(l,y),c.push({reject:g,request:f,requestKey:l,resolve:p}),s>1?(u||(u=setTimeout(d,o)),c.length>=s&&d()):d(),y}})();return t.set(n,r),r}const gf=Object.freeze(Object.defineProperty({__proto__:null,getRpcClient:De},Symbol.toStringTag,{value:"Module"}));async function q(e){return typeof e=="function"?await e():e}function js(e,t){const n=e.toString(),r=n[0]==="-"?"-":"",s=(r?n.slice(1):n).padStart(t+1,"0"),o=s.length-t,a=s.slice(0,o)||"0";let c=s.slice(o);for(let u=c.length-1;u>=0;u--){if(c[u]!=="0"){c=c.slice(0,u+1);break}u===0&&(c="")}return`${r}${a}${c?`.${c}`:""}`}function mf(e){return js(e,18)}function dn(e,t){e.includes("e")&&(e=Number(e).toFixed(t));let[n,r=""]=e.split(".");const i=n.startsWith("-")?"-":"";if(i&&(n=n.slice(1)),r=r.padEnd(t,"0"),t===0)r[0]&&Number.parseInt(r[0])>=5&&(n=(BigInt(n)+1n).toString()),r="";else if(r.length>t){const s=r[t];s&&Number.parseInt(s,10)>=5?(r=(BigInt(r.substring(0,t))+1n).toString().padStart(t,"0"),r.length>t&&(n=(BigInt(n)+1n).toString(),r=r.substring(r.length-t))):r=r.substring(0,t)}return BigInt(`${i}${n}${r}`)}function bf(e){return dn(e,18)}function wf(e){return dn(e,9)}const O0=Object.freeze(Object.defineProperty({__proto__:null,fromGwei:wf,toEther:mf,toTokens:js,toUnits:dn,toWei:bf},Symbol.toStringTag,{value:"Module"}));async function xf(e){const t=await e({method:"eth_gasPrice"});return nn(t)}async function di(e){const{client:t,chain:n,percentMultiplier:r}=e,i=De({chain:n,client:t}),s=await xf(i),o=r?s/BigInt(100)*BigInt(r):0n;return s+o}function gt(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const $f=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function Fs(e){const[t,n,r,i]=await Promise.all([q(e.maxFeePerGas),q(e.maxPriorityFeePerGas),q(e.gasPrice),q(e.type)]);if(t!==void 0&&n!==void 0)return{maxFeePerGas:t,maxPriorityFeePerGas:n};if(typeof r=="bigint")return{gasPrice:r};const s=await Ds(e.client,e.chain,i==="legacy"?"legacy":"eip1559");return e.chain.experimental?.increaseZeroByteCount?s.gasPrice?{gasPrice:gt(s.gasPrice)}:{maxFeePerGas:t??gt(s.maxFeePerGas??0n),maxPriorityFeePerGas:n??gt(s.maxPriorityFeePerGas??0n)}:s.gasPrice!==void 0?s:{maxFeePerGas:t??s.maxFeePerGas,maxPriorityFeePerGas:n??s.maxPriorityFeePerGas}}async function Ds(e,t,n){if((n??t.feeType)==="legacy"||$f.includes(t.id))return{gasPrice:await di({chain:t,client:e,percentMultiplier:10})};const i=await Ef(e,t);return i.maxFeePerGas!==null&&i.maxPriorityFeePerGas!==null?{maxFeePerGas:i.maxFeePerGas,maxPriorityFeePerGas:i.maxPriorityFeePerGas}:{gasPrice:await di({chain:t,client:e,percentMultiplier:10})}}async function Ef(e,t,n=10){let r=null,i=null;const s=De({chain:t,client:e}),[o,a]=await Promise.all([cf(s,{blockTag:"latest"}),uf(s).catch(()=>null)]),c=o?.baseFeePerGas,u=t.id;return u===220||u===1220?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(u===80002||u===137?i=await If(u):a!==null&&(i=a),i==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(i=vf(i,n),r=c*2n+i,(u===42220||u===44787||u===62320)&&(i=r),{maxFeePerGas:r,maxPriorityFeePerGas:i}))}function vf(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function Af(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const Pf=31n;async function If(e){const t=Af(e);try{const r=(await(await fetch(t)).json()).fast.maxPriorityFee;if(r>0){const i=Number.parseFloat(r).toFixed(9);return dn(i,9)}}catch(n){console.error("failed to fetch gas",n)}return Pf}const L0=Object.freeze(Object.defineProperty({__proto__:null,getDefaultGasOverrides:Ds,getGasOverridesForTransaction:Fs},Symbol.toStringTag,{value:"Module"}));async function Hs(e){if(e.id===1337||e.id===31337)return!1;if(e.id===324||e.id===300||e.id===302||e.id===11124||e.id===282||e.id===388||e.id===4654||e.id===333271||e.id===37111||e.id===978658||e.id===531050104||e.id===4457845||e.id===2741||e.id===240||e.id===555271||e.id===61166||e.id===555272)return!0;try{const{getChainMetadata:t}=await F(async()=>{const{getChainMetadata:r}=await import("./utils-Cj9H0gW-.js").then(i=>i.u);return{getChainMetadata:r}},__vite__mapDeps([0,1,2]));return(await t(e)).stackType==="zksync_stack"}catch{return!1}}function Bf(e){if(!e)return!1;const n=(typeof e=="string"?e:e?.message||e?.data?.message||"").toLowerCase();return n.includes("insufficient funds")||n.includes("insufficient balance")||n.includes("insufficient")&&(n.includes("native")||n.includes("gas"))||e?.code==="INSUFFICIENT_FUNDS"||e?.reason==="insufficient funds"}function Sf(e){if(!e)return{message:"Unknown error"};const t=typeof e=="string"?e:e?.message||e?.data?.message||String(e);return{code:e?.code||e?.reason,message:t}}async function Vs({client:e,ecosystem:t,data:n}){const r=ot(e,t),i={source:"sdk",...n};return r(`${zi("analytics")}/event`,{body:fe(i),method:"POST"}).catch(()=>{})}async function M0(e){return Tf({...e,action:"transaction:sent"})}function Tf(e){return Vs({client:e.client,data:{action:e.action,chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:fe(e.error),functionName:e.functionName,gasPrice:e.gasPrice,transactionHash:e.transactionHash,walletAddress:e.walletAddress,walletType:e.walletType},ecosystem:e.ecosystem})}async function _f(e){const t=Sf(e.error);return Vs({client:e.client,data:{action:"transaction:insufficient_funds",chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:t.code?fe(t.code):void 0,errorMessage:t.message,functionName:e.functionName,requiredAmount:e.requiredAmount?.toString(),transactionValue:e.transactionValue?.toString(),userBalance:e.userBalance?.toString(),walletAddress:e.walletAddress},ecosystem:e.ecosystem})}const zf="1.0.8";class W extends Error{constructor(t,n={}){const r=n.cause instanceof W?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof W&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${zf}`].join(`
|
|
27
|
+
`);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.shortMessage=t}}function Ee(e,t){return e.exec(t)?.groups}const Gs=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,qs=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,Ws=/^\(.+?\).*?$/,li=/^tuple(?<array>(\[(\d*)\])*)$/;function qn(e){let t=e.type;if(li.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let i=0;i<n;i++){const s=e.components[i];t+=qn(s),i<n-1&&(t+=", ")}const r=Ee(li,e.type);return t+=`)${r?.array??""}`,qn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ke(e){let t="";const n=e.length;for(let r=0;r<n;r++){const i=e[r];t+=qn(i),r!==n-1&&(t+=", ")}return t}function Wt(e){return e.type==="function"?`function ${e.name}(${Ke(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${Ke(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ke(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ke(e.inputs)})`:e.type==="constructor"?`constructor(${Ke(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function Of(e){const t=[],n=e.length;for(let r=0;r<n;r++){const i=e[r],s=Wt(i);t.push(s)}return t}const Zs=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Lf(e){return Zs.test(e)}function Mf(e){return Ee(Zs,e)}const Ks=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Cf(e){return Ks.test(e)}function Nf(e){return Ee(Ks,e)}const Ys=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Uf(e){return Ys.test(e)}function Rf(e){return Ee(Ys,e)}const Xs=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ar(e){return Xs.test(e)}function kf(e){return Ee(Xs,e)}const Js=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function jf(e){return Js.test(e)}function Ff(e){return Ee(Js,e)}const Qs=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Df(e){return Qs.test(e)}function Hf(e){return Ee(Qs,e)}const Vf=/^receive\(\) external payable$/;function Gf(e){return Vf.test(e)}const qf=new Set(["indexed"]),Wn=new Set(["calldata","memory","storage"]);class Wf extends W{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class Zf extends W{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Kf extends W{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Yf extends W{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Xf extends W{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Jf extends W{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Qf extends W{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class ed extends W{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class ft extends W{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class td extends W{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class nd extends W{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class rd extends W{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class id extends W{constructor({current:t,depth:n}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${n>0?"opening":"closing"} parentheses.`],details:`Depth "${n}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function sd(e,t,n){let r="";if(n)for(const i of Object.entries(n)){if(!i)continue;let s="";for(const o of i[1])s+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${i[0]}{${s}})`}return t?`${t}:${e}${r}`:e}const Tn=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Zn(e,t={}){if(Uf(e))return od(e,t);if(Cf(e))return ad(e,t);if(Lf(e))return cd(e,t);if(jf(e))return ud(e,t);if(Df(e))return fd(e);if(Gf(e))return{type:"receive",stateMutability:"payable"};throw new td({signature:e})}function od(e,t={}){const n=Rf(e);if(!n)throw new ft({signature:e,type:"function"});const r=oe(n.parameters),i=[],s=r.length;for(let a=0;a<s;a++)i.push(ke(r[a],{modifiers:Wn,structs:t,type:"function"}));const o=[];if(n.returns){const a=oe(n.returns),c=a.length;for(let u=0;u<c;u++)o.push(ke(a[u],{modifiers:Wn,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:i,outputs:o}}function ad(e,t={}){const n=Nf(e);if(!n)throw new ft({signature:e,type:"event"});const r=oe(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(ke(r[o],{modifiers:qf,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:i}}function cd(e,t={}){const n=Mf(e);if(!n)throw new ft({signature:e,type:"error"});const r=oe(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(ke(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:i}}function ud(e,t={}){const n=Ff(e);if(!n)throw new ft({signature:e,type:"constructor"});const r=oe(n.parameters),i=[],s=r.length;for(let o=0;o<s;o++)i.push(ke(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:i}}function fd(e){const t=Hf(e);if(!t)throw new ft({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const dd=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,ld=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,hd=/^u?int$/;function ke(e,t){const n=sd(e,t?.type,t?.structs);if(Tn.has(n))return Tn.get(n);const r=Ws.test(e),i=Ee(r?ld:dd,e);if(!i)throw new Yf({param:e});if(i.name&&yd(i.name))throw new Xf({param:e,name:i.name});const s=i.name?{name:i.name}:{},o=i.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{};let c,u={};if(r){c="tuple";const f=oe(i.type),l=[],p=f.length;for(let g=0;g<p;g++)l.push(ke(f[g],{structs:a}));u={components:l}}else if(i.type in a)c="tuple",u={components:a[i.type]};else if(hd.test(i.type))c=`${i.type}256`;else if(c=i.type,t?.type!=="struct"&&!eo(c))throw new Kf({type:c});if(i.modifier){if(!t?.modifiers?.has?.(i.modifier))throw new Jf({param:e,type:t?.type,modifier:i.modifier});if(Wn.has(i.modifier)&&!gd(c,!!i.array))throw new Qf({param:e,type:t?.type,modifier:i.modifier})}const d={type:`${c}${i.array??""}`,...s,...o,...u};return Tn.set(n,d),d}function oe(e,t=[],n="",r=0){const i=e.trim().length;for(let s=0;s<i;s++){const o=e[s],a=e.slice(s+1);switch(o){case",":return r===0?oe(a,[...t,n.trim()]):oe(a,t,`${n}${o}`,r);case"(":return oe(a,t,`${n}${o}`,r+1);case")":return oe(a,t,`${n}${o}`,r-1);default:return oe(a,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new id({current:n,depth:r});return t.push(n.trim()),t}function eo(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Gs.test(e)||qs.test(e)}const pd=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function yd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Gs.test(e)||qs.test(e)||pd.test(e)}function gd(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function to(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!Ar(a))continue;const c=kf(a);if(!c)throw new ft({signature:a,type:"struct"});const u=c.properties.split(";"),d=[],f=u.length;for(let l=0;l<f;l++){const g=u[l].trim();if(!g)continue;const y=ke(g,{type:"struct"});d.push(y)}if(!d.length)throw new nd({signature:a});t[c.name]=d}const r={},i=Object.entries(t),s=i.length;for(let o=0;o<s;o++){const[a,c]=i[o];r[a]=no(c,t)}return r}const md=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function no(e,t,n=new Set){const r=[],i=e.length;for(let s=0;s<i;s++){const o=e[s];if(Ws.test(o.type))r.push(o);else{const c=Ee(md,o.type);if(!c?.type)throw new ed({abiParameter:o});const{array:u,type:d}=c;if(d in t){if(n.has(d))throw new rd({type:d});r.push({...o,type:`tuple${u??""}`,components:no(t[d]??[],t,new Set([...n,d]))})}else if(eo(d))r.push(o);else throw new Zf({type:d})}}return r}function ro(e){const t=to(e),n=[],r=e.length;for(let i=0;i<r;i++){const s=e[i];Ar(s)||n.push(Zn(s,t))}return n}function st(e){let t;if(typeof e=="string")t=Zn(e);else{const n=to(e),r=e.length;for(let i=0;i<r;i++){const s=e[i];if(!Ar(s)){t=Zn(s,n);break}}}if(!t)throw new Wf({signature:e});return t}const bd=of({id:11155111,name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://11155111.rpc.thirdweb.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://sepolia.etherscan.io",apiUrl:"https://api-sepolia.etherscan.io/api"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:751532},ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:8928790}},testnet:!0}),wd="https://{clientId}.ipfscdn.io/ipfs/{cid}";function xd(e){if(e.uri.startsWith("ipfs://")){const t=e.client.config?.storage?.gatewayUrl??wd,n=e.client.clientId,r=$d(e.uri);let i;return typeof globalThis<"u"&&"Application"in globalThis&&(i=globalThis.Application.applicationId),`${t.replace("{clientId}",n).split("/ipfs")[0]}/ipfs/${r}${i?`?bundleId=${i}`:""}`}if(e.uri.startsWith("http"))return e.uri;throw new Error('Invalid URI scheme, expected "ipfs://" or "http(s)://"')}function $d(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}async function io(e){let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:r}=await F(async()=>{const{resolveArweaveScheme:i}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:i}},[]);t=r(e)}else t=xd(e);const n=await ot(e.client)(t,{headers:e.client.config?.storage?.fetch?.headers,keepalive:e.client.config?.storage?.fetch?.keepalive,requestTimeoutMs:e.requestTimeoutMs??e.client.config?.storage?.fetch?.requestTimeoutMs??6e4});if(!n.ok){const r=await n.text();throw new Error(`Failed to download file: ${n.status} ${n.statusText} ${r||""}`)}return n}const C0=Object.freeze(Object.defineProperty({__proto__:null,download:io},Symbol.toStringTag,{value:"Module"}));function Ed(e,t="https://contract.thirdweb.com/abi"){return Oi(async()=>{if(e.abi)return e.abi;if(e.chain.id===31337||e.chain.id===1337||e.chain.id===bd.id)return await hi(e);try{return await vd(e,t)}catch{return await hi(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function vd(e,t="https://contract.thirdweb.com/abi"){const r=await(await ot(e.client)(`${t}/${e.chain.id}/${e.address}`)).json();if(!r||r.error)throw new Error(`Failed to resolve ABI from contract API. ${r.error||""}`);return r}async function so(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([F(()=>import("./resolveImplementation-LbazawSf.js"),__vite__mapDeps([3,4,0,1,2])),F(()=>import("./extractIPFS-C9Vdpa9n.js"),__vite__mapDeps([5,0,1,2]))]),{bytecode:r}=await t(e);if(r==="0x"){const{id:s,name:o}=e.chain;throw new Error(`Failed to load contract bytecode. Make sure the contract [${e.address}] exists on the chain [${o||"Unknown Chain"} (chain id: ${s})]`)}const i=n(r);if(!i)return[];try{return(await(await io({client:e.client,uri:i})).json()).output.abi}catch{return[]}}const Ad={inputs:[],name:"getAllPlugins",outputs:[{components:[{internalType:"bytes4",name:"functionSelector",type:"bytes4"},{internalType:"string",name:"functionSignature",type:"string"},{internalType:"address",name:"pluginAddress",type:"address"}],internalType:"struct IPluginMap.Plugin[]",name:"registered",type:"tuple[]"}],stateMutability:"view",type:"function"},Pd={inputs:[],name:"getAllExtensions",outputs:[{components:[{components:[{internalType:"string",name:"name",type:"string"},{internalType:"string",name:"metadataURI",type:"string"},{internalType:"address",name:"implementation",type:"address"}],internalType:"struct IExtension.ExtensionMetadata",name:"metadata",type:"tuple"},{components:[{internalType:"bytes4",name:"functionSelector",type:"bytes4"},{internalType:"string",name:"functionSignature",type:"string"}],internalType:"struct IExtension.ExtensionFunction[]",name:"functions",type:"tuple[]"}],internalType:"struct IExtension.Extension[]",name:"allExtensions",type:"tuple[]"}],stateMutability:"view",type:"function"},Id={inputs:[],name:"facets",outputs:[{components:[{internalType:"address",name:"facetAddress",type:"address"},{internalType:"bytes4[]",name:"functionSelectors",type:"bytes4[]"}],type:"tuple[]"}],stateMutability:"view",type:"function"};async function hi(e,t,n){const[r,i,s,o,a]=await Promise.all([so(e),Bd(e),Sd(e),Td(e),_d(e)]),c=[...new Set([...i,...s,...o,...a])];if(!c.length)return r;const u=await zd({contract:e,plugins:c,resolveSubAbi:n});return Od({pluginAbis:u,rootAbi:r})}async function Bd(e){try{const{readContract:t}=await F(async()=>{const{readContract:r}=await Promise.resolve().then(()=>Ur);return{readContract:r}},void 0),n=await t({contract:e,method:Ad});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function Sd(e){try{const{readContract:t}=await F(async()=>{const{readContract:r}=await Promise.resolve().then(()=>Ur);return{readContract:r}},void 0),n=await t({contract:e,method:Pd});return n.length?[...new Set(n.map(r=>r.metadata.implementation))]:[]}catch{}return[]}async function Td(e){try{const{getInstalledModules:t}=await F(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-Dlcyw_6V.js");return{getInstalledModules:r}},__vite__mapDeps([6,7,0,1,2])),n=await t({contract:e});return n.length?[...new Set(n.map(r=>r.implementation))]:[]}catch{}return[]}async function _d(e){try{const{readContract:t}=await F(async()=>{const{readContract:r}=await Promise.resolve().then(()=>Ur);return{readContract:r}},void 0),n=await t({contract:e,method:Id});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function zd(e){return Promise.all(e.plugins.map(t=>{const n=Ut({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):so(n)}))}function Od(e){let t=e.pluginAbis.flat().filter(r=>r.type!=="constructor");e.rootAbi&&(t=[...e.rootAbi,...t].filter(r=>r.type!=="fallback"&&r.type!=="receive").filter(Boolean));const n=[...new Set(Of(t))];return ro(n)}async function pi(e){const{error:t,contract:n,fromAddress:r}=e;Bf(t)&&n&&_f({chainId:n.chain?.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const i=await Ld({contract:n,error:t});return i?new Md(i,n):t}async function Ld(e){const{error:t,contract:n}=e;if(typeof t=="object"){const r=t;if(r.data&&r.data!=="0x"&&Fe(r.data)){let i=n?.abi;n&&!i&&(i=await Ed(n).catch(()=>{}));const s=Zu({abi:i,data:r.data});return`${s.errorName}${s.args?` - ${s.args}`:""}`}}return`Execution Reverted: ${Ku(t)}`}class Md extends Error{constructor(t,n){let r=t;super(r),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"chainId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name="TransactionError",this.contractAddress=n?.address,this.chainId=n?.chain?.id,this.message=r}}const _n=new WeakMap;async function oo(e){const t=typeof e.from=="string"?e.from??void 0:e.from?.address??e.account?.address,n={...e.transaction,from:t};if(_n.has(n))return _n.get(n);const{account:r}=e,i=(async()=>{const s=await q(e.transaction.gas);if(s!==void 0)return s;if(r?.estimateGas)try{let g=await r.estimateGas(e.transaction);return e.transaction.chain.experimental?.increaseZeroByteCount&&(g=gt(g)),g}catch(g){throw await pi({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:o}=await F(async()=>{const{encode:g}=await Promise.resolve().then(()=>af);return{encode:g}},void 0),[a,c,u,d]=await Promise.all([o(e.transaction),q(e.transaction.to),q(e.transaction.value),q(e.transaction.authorizationList)]),[{getRpcClient:f},{eth_estimateGas:l}]=await Promise.all([F(()=>Promise.resolve().then(()=>gf),void 0),F(()=>import("./eth_estimateGas-BmOR31h-.js"),__vite__mapDeps([8,0,1,2]))]),p=f(e.transaction);try{const g=Cs({authorizationList:d?.map(h=>({...h,address:Ie(h.address),nonce:Number(h.nonce),r:E(h.r),s:E(h.s)})),data:a,from:t?Ie(t):void 0,to:c?Ie(c):void 0,value:u});let y=await l(p,g);return e.transaction.chain.experimental?.increaseZeroByteCount&&(y=gt(y)),y}catch(g){throw await pi({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return _n.set(n,i),i}const N0=Object.freeze(Object.defineProperty({__proto__:null,estimateGas:oo},Symbol.toStringTag,{value:"Module"}));async function Cd(e){if(await Hs(e.transaction.chain)){const{getZkGasFees:y}=await F(async()=>{const{getZkGasFees:A}=await import("./send-eip712-transaction-DW2Z39R_.js").then(T=>T.a);return{getZkGasFees:A}},__vite__mapDeps([9,1,2,10])),{gas:h,maxFeePerGas:m,maxPriorityFeePerGas:v}=await y({from:typeof e.from=="string"?Ie(e.from):e.from!==void 0?Ie(e.from.address):void 0,transaction:e.transaction});e.transaction={...e.transaction,gas:h,maxFeePerGas:m,maxPriorityFeePerGas:v}}const n=De(e.transaction),r=e.transaction.chain.id,i=e.from;let[s,o,a,c,u,d,f,l,p]=await Promise.all([fn(e.transaction),(async()=>{const y=await q(e.transaction.nonce);return y!==void 0?y:i?await F(async()=>{const{eth_getTransactionCount:h}=await import("./eth_getTransactionCount-DrnF23O4.js");return{eth_getTransactionCount:h}},__vite__mapDeps([11,0,1,2])).then(({eth_getTransactionCount:h})=>h(n,{address:Ie(typeof i=="string"?i:i.address),blockTag:"pending"})):void 0})(),oo({...e,from:e.from}),Fs(e.transaction),q(e.transaction.to),q(e.transaction.accessList),q(e.transaction.value),q(e.transaction.authorizationList),q(e.transaction.type)]);const g=await q(e.transaction.extraGas);return g&&(a+=g),{accessList:d,authorizationList:l,chainId:r,data:s,gas:a,nonce:o,to:u,type:p,value:f,...c}}function Nd(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{balance:n.balance?de(n.balance):void 0,code:n.code,nonce:n.nonce?de(n.nonce):void 0,state:n.state,stateDiff:n.stateDiff}]))}async function ao(e,t){const{blockNumber:n,blockTag:r,...i}=t,o=(n?de(n):void 0)||r||"latest";return await e({method:"eth_call",params:t.stateOverrides?[i,o,Nd(t.stateOverrides)]:[i,o]})}async function U0(e,t){const n=await e({method:"eth_getBalance",params:[t.address,t.blockTag||"latest"]});return nn(n)}async function Ud(e,t){return e({method:"eth_getCode",params:[t.address,t.blockTag||"latest"]})}async function R0(e,t){return await e({method:"eth_sendRawTransaction",params:[t]})}async function k0({client:e,walletAddress:t,email:n,phone:r,id:i,externalWalletAddress:s,ecosystem:o}){if(!e.secretKey)throw new Error("A secret key is required to query for users. If you're making this request from the server, please add a secret key to your client.");const a=new URL(`${zi("inAppWallet")}/api/2023-11-30/embedded-wallet/user-details`);if(t)a.searchParams.set("queryBy","walletAddress"),a.searchParams.set("walletAddress",t);else if(n)a.searchParams.set("queryBy","email"),a.searchParams.set("email",n);else if(r)a.searchParams.set("queryBy","phone"),a.searchParams.set("phone",r);else if(i)a.searchParams.set("queryBy","id"),a.searchParams.set("id",i);else if(s)a.searchParams.set("queryBy","externalWalletAddress"),a.searchParams.set("externalWalletAddress",s);else throw new Error("Please provide a walletAddress, email, phone, id, or externalWalletAddress to query for users.");const u=await ot(e,o)(a.toString());if(!u.ok){const f=await u.text().catch(()=>"Unknown error");throw new Error(`Failed to get profiles. ${u.status} ${u.statusText}: ${f}`)}return(await u.json()).map(f=>({createdAt:f.createdAt,email:f.email,phone:f.phone,profiles:f.linkedAccounts.map(l=>({details:l.details,type:l.type==="siwe"?"wallet":l.type})),smartAccountAddress:f.smartAccountAddress,userId:f.userId,walletAddress:f.walletAddress}))[0]||null}function Rd(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="event")}function j0(e){const{signature:t}=e;let n;return Rd(t)?n=t:n=st(t),{abiEvent:n,hash:mr(n),topics:Cu({abi:[n],args:e.filters})}}function F0(e){const{logs:t,events:n,strict:r}=e;return rf({abi:n.map(i=>i.abiEvent),logs:t,strict:r})}function kd(e){for(const t of e)if(typeof t!="string")return!1;return!0}function jd(e){return kd(e)?ro(e):e}function ne(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=ns(jn(e));return n==="Bytes"?r:Y(r)}class Fd extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const Dd={checksum:new Fd(8192)},zn=Dd.checksum;function co(e,t={}){const{compressed:n}=t,{prefix:r,x:i,y:s}=e;if(n===!1||typeof i=="bigint"&&typeof s=="bigint"){if(r!==4)throw new yi({prefix:r,cause:new Zd});return}if(n===!0||typeof i=="bigint"&&typeof s>"u"){if(r!==3&&r!==2)throw new yi({prefix:r,cause:new Wd});return}throw new qd({publicKey:e})}function Hd(e){const t=(()=>{if(fr(e))return uo(e);if(Ta(e))return Vd(e);const{prefix:n,x:r,y:i}=e;return typeof r=="bigint"&&typeof i=="bigint"?{prefix:n??4,x:r,y:i}:{prefix:n,x:r}})();return co(t),t}function Vd(e){return uo(Y(e))}function uo(e){if(e.length!==132&&e.length!==130&&e.length!==68)throw new Kd({publicKey:e});if(e.length===130){const r=BigInt(K(e,0,32)),i=BigInt(K(e,32,64));return{prefix:4,x:r,y:i}}if(e.length===132){const r=Number(K(e,0,1)),i=BigInt(K(e,1,33)),s=BigInt(K(e,33,65));return{prefix:r,x:i,y:s}}const t=Number(K(e,0,1)),n=BigInt(K(e,1,33));return{prefix:t,x:n}}function Gd(e,t={}){co(e);const{prefix:n,x:r,y:i}=e,{includePrefix:s=!0}=t;return N(s?E(n,{size:1}):"0x",E(r,{size:32}),typeof i=="bigint"?E(i,{size:32}):"0x")}class qd extends ${constructor({publicKey:t}){super(`Value \`${at(t)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class yi extends ${constructor({prefix:t,cause:n}){super(`Prefix "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class Wd extends ${constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class Zd extends ${constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}let Kd=class extends ${constructor({publicKey:t}){super(`Value \`${t}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${R(en(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}};const Yd=/^0x[a-fA-F0-9]{40}$/;function he(e,t={}){const{strict:n=!0}=t;if(!Yd.test(e))throw new Kn({address:e,cause:new fo});if(n){if(e.toLowerCase()===e)return;if(Pr(e)!==e)throw new Kn({address:e,cause:new Qd})}}function Pr(e){if(zn.has(e))return zn.get(e);he(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=ne(dr(t),{as:"Bytes"}),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&r[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&r[s+1]&&(r[s+1]=r[s+1].toUpperCase());const i=`0x${r.join("")}`;return zn.set(e,i),i}function Xd(e,t={}){const{checksum:n=!1}=t;return he(e),n?Pr(e):e}function Jd(e,t={}){const n=ne(`0x${Gd(e).slice(4)}`).substring(26);return Xd(`0x${n}`,t)}function Zt(e,t={}){const{strict:n=!0}=t??{};try{return he(e,{strict:n}),!0}catch{return!1}}class Kn extends ${constructor({address:t,cause:n}){super(`Address "${t}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class fo extends ${constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class Qd extends ${constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function Yn(e){let t=!0,n="",r=0,i="",s=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function","error",""].includes(i))i="";else if(i+=a,a===")"){s=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}i+=a,n+=a}}if(!s)throw new $("Unable to normalize signature.");return i}function Xn(e,t){const n=typeof e,r=t.type;switch(r){case"address":return Zt(e,{strict:!1});case"bool":return n==="boolean";case"function":return n==="string";case"string":return n==="string";default:return r==="tuple"&&"components"in t?Object.values(t.components).every((i,s)=>Xn(Object.values(e)[s],i)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r)?Array.isArray(e)&&e.every(i=>Xn(i,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function lo(e,t,n){for(const r in e){const i=e[r],s=t[r];if(i.type==="tuple"&&s.type==="tuple"&&"components"in i&&"components"in s)return lo(i.components,s.components,n[r]);const o=[i.type,s.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?Zt(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?Zt(n[r],{strict:!1}):!1)return o}}function el(e,t={}){const{prepare:n=!0}=t,r=Array.isArray(e)||typeof e=="string"?st(e):e;return{...r,...n?{hash:Xe(r)}:{}}}function tl(e,t,n){const{args:r=[],prepare:i=!0}=n??{},s=fr(t,{strict:!1}),o=e.filter(u=>s?u.type==="function"||u.type==="error"?ho(u)===K(t,0,4):u.type==="event"?Xe(u)===t:!1:"name"in u&&u.name===t);if(o.length===0)throw new Kt({name:t});if(o.length===1)return{...o[0],...i?{hash:Xe(o[0])}:{}};let a;for(const u of o){if(!("inputs"in u))continue;if(!r||r.length===0){if(!u.inputs||u.inputs.length===0)return{...u,...i?{hash:Xe(u)}:{}};continue}if(!u.inputs||u.inputs.length===0||u.inputs.length!==r.length)continue;if(r.every((f,l)=>{const p="inputs"in u&&u.inputs[l];return p?Xn(f,p):!1})){if(a&&"inputs"in a&&a.inputs){const f=lo(u.inputs,a.inputs,r);if(f)throw new rl({abiItem:u,type:f[0]},{abiItem:a,type:f[1]})}a=u}}const c=(()=>{if(a)return a;const[u,...d]=o;return{...u,overloads:d}})();if(!c)throw new Kt({name:t});return{...c,...i?{hash:Xe(c)}:{}}}function ho(e){return K(Xe(e),0,4)}function nl(e){const t=typeof e=="string"?e:Wt(e);return Yn(t)}function Xe(e){return typeof e!="string"&&"hash"in e&&e.hash?e.hash:ne(It(nl(e)))}class rl extends ${constructor(t,n){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${t.type}\` in \`${Yn(Wt(t.abiItem))}\`, and`,`\`${n.type}\` in \`${Yn(Wt(n.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class Kt extends ${constructor({name:t,data:n,type:r="item"}){const i=t?` with name "${t}"`:n?` with data "${n}"`:"";super(`ABI ${r}${i} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}class il extends ${constructor({data:t}){super(`Selector size is invalid. Expected 4 bytes. Received ${R(t)} bytes ("${t}").`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.InvalidSelectorSizeError"})}}const sl=/^(.*)\[([0-9]*)\]$/,po=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ir=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,H0=2n**96n-1n,gi=2n**256n-1n;function et(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=Tr(t.type);if(s){const[o,a]=s;return al(e,{...t,type:a},{checksumAddress:r,length:o,staticPosition:i})}if(t.type==="tuple")return dl(e,t,{checksumAddress:r,staticPosition:i});if(t.type==="address")return ol(e,{checksum:r});if(t.type==="bool")return cl(e);if(t.type.startsWith("bytes"))return ul(e,t,{staticPosition:i});if(t.type.startsWith("uint")||t.type.startsWith("int"))return fl(e,t);if(t.type==="string")return ll(e,{staticPosition:i});throw new _r(t.type)}const mi=32,Jn=32;function ol(e,t={}){const{checksum:n=!1}=t,r=e.readBytes(32);return[(s=>n?Pr(s):s)(Y(Sa(r,-20))),32]}function al(e,t,n){const{checksumAddress:r,length:i,staticPosition:s}=n;if(!i){const c=ce(e.readBytes(Jn)),u=s+c,d=u+mi;e.setPosition(u);const f=ce(e.readBytes(mi)),l=vt(t);let p=0;const g=[];for(let y=0;y<f;++y){e.setPosition(d+(l?y*32:p));const[h,m]=et(e,t,{checksumAddress:r,staticPosition:d});p+=m,g.push(h)}return e.setPosition(s+32),[g,32]}if(vt(t)){const c=ce(e.readBytes(Jn)),u=s+c,d=[];for(let f=0;f<i;++f){e.setPosition(u+f*32);const[l]=et(e,t,{checksumAddress:r,staticPosition:u});d.push(l)}return e.setPosition(s+32),[d,32]}let o=0;const a=[];for(let c=0;c<i;++c){const[u,d]=et(e,t,{checksumAddress:r,staticPosition:s+o});o+=d,a.push(u)}return[a,o]}function cl(e){return[qi(e.readBytes(32),{size:32}),32]}function ul(e,t,{staticPosition:n}){const[r,i]=t.type.split("bytes");if(!i){const o=ce(e.readBytes(32));e.setPosition(n+o);const a=ce(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[Y(c),32]}return[Y(e.readBytes(Number.parseInt(i),32)),32]}function fl(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),i=e.readBytes(32);return[r>48?Gi(i,{signed:n}):ce(i,{signed:n}),32]}function dl(e,t,n){const{checksumAddress:r,staticPosition:i}=n,s=t.components.length===0||t.components.some(({name:c})=>!c),o=s?[]:{};let a=0;if(vt(t)){const c=ce(e.readBytes(Jn)),u=i+c;for(let d=0;d<t.components.length;++d){const f=t.components[d];e.setPosition(u+a);const[l,p]=et(e,f,{checksumAddress:r,staticPosition:u});a+=p,o[s?d:f?.name]=l}return e.setPosition(i+32),[o,32]}for(let c=0;c<t.components.length;++c){const u=t.components[c],[d,f]=et(e,u,{checksumAddress:r,staticPosition:i});o[s?c:u?.name]=d,a+=f}return[o,a]}function ll(e,{staticPosition:t}){const n=ce(e.readBytes(32)),r=t+n;e.setPosition(r);const i=ce(e.readBytes(32));if(i===0)return e.setPosition(t+32),["",32];const s=e.readBytes(i,32),o=Wi(Zi(s));return e.setPosition(t+32),[o,32]}function hl({checksumAddress:e,parameters:t,values:n}){const r=[];for(let i=0;i<t.length;i++)r.push(Br({checksumAddress:e,parameter:t[i],value:n[i]}));return r}function Br({checksumAddress:e=!1,parameter:t,value:n}){const r=t,i=Tr(r.type);if(i){const[s,o]=i;return yl(n,{checksumAddress:e,length:s,parameter:{...r,type:o}})}if(r.type==="tuple")return xl(n,{checksumAddress:e,parameter:r});if(r.type==="address")return pl(n,{checksum:e});if(r.type==="bool")return ml(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const s=r.type.startsWith("int"),[,,o="256"]=Ir.exec(r.type)??[];return bl(n,{signed:s,size:Number(o)})}if(r.type.startsWith("bytes"))return gl(n,{type:r.type});if(r.type==="string")return wl(n);throw new _r(r.type)}function Sr(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=R(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(E(t+i,{size:32})),r.push(a),i+=R(a)):n.push(a)}return N(...n,...r)}function pl(e,t){const{checksum:n=!1}=t;return he(e,{strict:n}),{dynamic:!1,encoded:Te(e.toLowerCase())}}function yl(e,t){const{checksumAddress:n,length:r,parameter:i}=t,s=r===null;if(!Array.isArray(e))throw new Sl(e);if(!s&&e.length!==r)throw new Bl({expectedLength:r,givenLength:e.length,type:`${i.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const u=Br({checksumAddress:n,parameter:i,value:e[c]});u.dynamic&&(o=!0),a.push(u)}if(s||o){const c=Sr(a);if(s){const u=E(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?N(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:N(...a.map(({encoded:c})=>c))}}function gl(e,{type:t}){const[,n]=t.split("bytes"),r=R(e);if(!n){let i=e;return r%32!==0&&(i=_e(i,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:N(Te(E(r,{size:32})),i)}}if(r!==Number.parseInt(n))throw new go({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:_e(e)}}function ml(e){if(typeof e!="boolean")throw new $(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Te(ur(e))}}function bl(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,i=t?-r-1n:0n;if(e>r||e<i)throw new Di({max:r.toString(),min:i.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:E(e,{size:32,signed:t})}}function wl(e){const t=It(e),n=Math.ceil(R(t)/32),r=[];for(let i=0;i<n;i++)r.push(_e(K(t,i*32,(i+1)*32)));return{dynamic:!0,encoded:N(_e(E(R(t),{size:32})),...r)}}function xl(e,t){const{checksumAddress:n,parameter:r}=t;let i=!1;const s=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,u=Br({checksumAddress:n,parameter:a,value:e[c]});s.push(u),u.dynamic&&(i=!0)}return{dynamic:i,encoded:i?Sr(s):N(...s.map(({encoded:o})=>o))}}function Tr(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function vt(e){const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(vt);const n=Tr(e.type);return!!(n&&vt({...e,type:n[1]}))}const $l={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new vl({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new El({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new bi({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new bi({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function yo(e,{recursiveReadLimit:t=8192}={}){const n=Object.create($l);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}class bi extends ${constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class El extends ${constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class vl extends ${constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function Al(e,t,n={}){const{as:r="Array",checksumAddress:i=!1}=n,s=typeof t=="string"?ze(t):t,o=yo(s);if(Ye(s)===0&&e.length>0)throw new Il;if(Ye(s)&&Ye(s)<32)throw new Pl({data:typeof t=="string"?t:Y(t),parameters:e,size:Ye(s)});let a=0;const c=r==="Array"?[]:{};for(let u=0;u<e.length;++u){const d=e[u];o.setPosition(a);const[f,l]=et(o,d,{checksumAddress:i,staticPosition:0});a+=l,r==="Array"?c.push(f):c[d.name??u]=f}return c}function ln(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new mo({expectedLength:e.length,givenLength:t.length});const i=hl({checksumAddress:r,parameters:e,values:t}),s=Sr(i);return s.length===0?"0x":s}function Qn(e,t){if(e.length!==t.length)throw new mo({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const i=e[r],s=t[r];n.push(Qn.encode(i,s))}return N(...n)}(function(e){function t(n,r,i=!1){if(n==="address"){const c=r;return he(c),Te(c.toLowerCase(),i?32:0)}if(n==="string")return It(r);if(n==="bytes")return r;if(n==="bool")return Te(ur(r),i?32:1);const s=n.match(Ir);if(s){const[c,u,d="256"]=s,f=Number.parseInt(d)/8;return E(r,{size:i?32:f,signed:u==="int"})}const o=n.match(po);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new go({expectedSize:Number.parseInt(u),value:r});return _e(r,i?32:0)}const a=n.match(sl);if(a&&Array.isArray(r)){const[c,u]=a,d=[];for(let f=0;f<r.length;f++)d.push(t(u,r[f],!0));return d.length===0?"0x":N(...d)}throw new _r(n)}e.encode=t})(Qn||(Qn={}));class Pl extends ${constructor({data:t,parameters:n,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${Ke(n)})`,`Data: ${t} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class Il extends ${constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class Bl extends ${constructor({expectedLength:t,givenLength:n,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${t}\`. Given: \`${n}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}let go=class extends ${constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${R(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}};class mo extends ${constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
28
28
|
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class Sl extends ${constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class _r extends ${constructor(t){super(`Type \`${t}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function Tl(e,t){const{bytecode:n,args:r}=t;return N(n,e.inputs?.length&&r?.length?ln(e.inputs,r):"0x")}function _l(e){const t=e.find(n=>n.type==="constructor");if(!t)throw new Kt({name:"constructor"});return t}function G0(e,t){const{overloads:n}=e;if(R(t)<4)throw new il({data:t});if(e.inputs.length===0)return;const r=n?zr([e,...n],t):e;if(!(R(t)<=4))return Al(r.inputs,K(t,4))}function zl(e,...t){const{overloads:n}=e,r=n?zr([e,...n],e.name,{args:t[0]}):e,i=Ol(r),s=t.length>0?ln(r.inputs,t[0]):void 0;return s?N(i,s):i}function q0(e,t={}){return el(e,t)}function zr(e,t,n){const r=tl(e,t,n);if(r.type!=="function")throw new Kt({name:t,type:"function"});return r}function Ol(e){return ho(e)}function Or(e){if(!e||e.length===0)return[];const t=[];for(const{address:n,storageKeys:r}of e){for(let i=0;i<r.length;i++)if(R(r[i])!==32)throw new Ll({storageKey:r[i]});n&&he(n,{strict:!1}),t.push([n,r])}return t}class Ll extends ${constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${R(t)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccessList.InvalidStorageKeySizeError"})}}function Ml(e,t){const{as:n}=t,r=bo(e),i=yo(new Uint8Array(r.length));return r.encode(i),n==="Hex"?Y(i.bytes):i.bytes}function Tt(e,t={}){const{as:n="Hex"}=t;return Ml(e,{as:n})}function bo(e){return Array.isArray(e)?Cl(e.map(t=>bo(t))):Nl(e)}function Cl(e){const t=e.reduce((i,s)=>i+s.length,0),n=wo(t);return{length:t<=55?1+t:1+n+t,encode(i){t<=55?i.pushByte(192+t):(i.pushByte(247+n),n===1?i.pushUint8(t):n===2?i.pushUint16(t):n===3?i.pushUint24(t):i.pushUint32(t));for(const{encode:s}of e)s(i)}}}function Nl(e){const t=typeof e=="string"?ze(e):e,n=wo(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(i){t.length===1&&t[0]<128?i.pushBytes(t):t.length<=55?(i.pushByte(128+t.length),i.pushBytes(t)):(i.pushByte(183+n),n===1?i.pushUint8(t.length):n===2?i.pushUint16(t.length):n===3?i.pushUint24(t.length):i.pushUint32(t.length),i.pushBytes(t))}}}function wo(e){if(e<2**8)return 1;if(e<2**16)return 2;if(e<2**24)return 3;if(e<2**32)return 4;throw new $("Length is too large.")}class xo extends lr{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Ra(t);const r=tn(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(t){return nt(this),this.iHash.update(t),this}digestInto(t){nt(this),ct(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const $o=(e,t,n)=>new xo(e,t).update(n).digest();$o.create=(e,t)=>new xo(e,t);const H=BigInt(0),U=BigInt(1),Me=BigInt(2),Ul=BigInt(3),er=BigInt(4),wi=BigInt(5),xi=BigInt(8);function Q(e,t){const n=e%t;return n>=H?n:t+n}function Rl(e,t,n){if(t<H)throw new Error("invalid exponent, negatives unsupported");if(n<=H)throw new Error("invalid modulus");if(n===U)return H;let r=U;for(;t>H;)t&U&&(r=r*e%n),e=e*e%n,t>>=U;return r}function te(e,t,n){let r=e;for(;t-- >H;)r*=r,r%=n;return r}function tr(e,t){if(e===H)throw new Error("invert: expected non-zero number");if(t<=H)throw new Error("invert: expected positive modulus, got "+t);let n=Q(e,t),r=t,i=H,s=U;for(;n!==H;){const a=r/n,c=r%n,u=i-s*a;r=n,n=c,i=s,s=u}if(r!==U)throw new Error("invert: does not exist");return Q(i,t)}function kl(e){const t=(e-U)/Me;let n,r,i;for(n=e-U,r=0;n%Me===H;n/=Me,r++);for(i=Me;i<e&&Rl(i,t,e)!==e-U;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(e+U)/er;return function(c,u){const d=c.pow(u,o);if(!c.eql(c.sqr(d),u))throw new Error("Cannot find square root");return d}}const s=(n+U)/Me;return function(a,c){if(a.pow(c,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,d=a.pow(a.mul(a.ONE,i),n),f=a.pow(c,s),l=a.pow(c,n);for(;!a.eql(l,a.ONE);){if(a.eql(l,a.ZERO))return a.ZERO;let p=1;for(let y=a.sqr(l);p<u&&!a.eql(y,a.ONE);p++)y=a.sqr(y);const g=a.pow(d,U<<BigInt(u-p-1));d=a.sqr(g),f=a.mul(f,g),l=a.mul(l,d),u=p}return f}}function jl(e){if(e%er===Ul){const t=(e+U)/er;return function(r,i){const s=r.pow(i,t);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(e%xi===wi){const t=(e-wi)/xi;return function(r,i){const s=r.mul(i,Me),o=r.pow(s,t),a=r.mul(i,o),c=r.mul(r.mul(a,Me),o),u=r.mul(a,r.sub(c,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return kl(e)}const Fl=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Dl(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Fl.reduce((r,i)=>(r[i]="function",r),t);return Qt(e,n)}function Hl(e,t,n){if(n<H)throw new Error("invalid exponent, negatives unsupported");if(n===H)return e.ONE;if(n===U)return t;let r=e.ONE,i=t;for(;n>H;)n&U&&(r=e.mul(r,i)),i=e.sqr(i),n>>=U;return r}function Vl(e,t){const n=new Array(t.length),r=t.reduce((s,o,a)=>e.is0(o)?s:(n[a]=s,e.mul(s,o)),e.ONE),i=e.inv(r);return t.reduceRight((s,o,a)=>e.is0(o)?s:(n[a]=e.mul(s,n[a]),e.mul(s,o)),i),n}function Eo(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function vo(e,t,n=!1,r={}){if(e<=H)throw new Error("invalid field: expected ORDER > 0, got "+e);const{nBitLength:i,nByteLength:s}=Eo(e,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:s,MASK:Jt(i),ZERO:H,ONE:U,create:c=>Q(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof c);return H<=c&&c<e},is0:c=>c===H,isOdd:c=>(c&U)===U,neg:c=>Q(-c,e),eql:(c,u)=>c===u,sqr:c=>Q(c*c,e),add:(c,u)=>Q(c+u,e),sub:(c,u)=>Q(c-u,e),mul:(c,u)=>Q(c*u,e),pow:(c,u)=>Hl(a,c,u),div:(c,u)=>Q(c*tr(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>tr(c,e),sqrt:r.sqrt||(c=>(o||(o=jl(e)),o(a,c))),invertBatch:c=>Vl(a,c),cmov:(c,u,d)=>d?u:c,toBytes:c=>n?Ni(c,s):wt(c,s),fromBytes:c=>{if(c.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+c.length);return n?Ci(c):Ce(c)}});return Object.freeze(a)}function Ao(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Po(e){const t=Ao(e);return t+Math.ceil(t/2)}function Gl(e,t,n=!1){const r=e.length,i=Ao(t),s=Po(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=n?Ci(e):Ce(e),a=Q(o,t-U)+U;return n?Ni(a,i):wt(a,i)}const $i=BigInt(0),nr=BigInt(1);function On(e,t){const n=t.negate();return e?n:t}function Io(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Ln(e,t){Io(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),i=2**e,s=Jt(e),o=BigInt(e);return{windows:n,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function Ei(e,t,n){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=n;let a=Number(e&i),c=e>>o;a>r&&(a-=s,c+=nr);const u=t*r,d=u+Math.abs(a)-1,f=a===0,l=a<0,p=t%2!==0;return{nextN:c,offset:d,isZero:f,isNeg:l,isNegF:p,offsetF:u}}function ql(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function Wl(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Mn=new WeakMap,Bo=new WeakMap;function Cn(e){return Bo.get(e)||1}function Zl(e,t){return{constTimeNegate:On,hasPrecomputes(n){return Cn(n)!==1},unsafeLadder(n,r,i=e.ZERO){let s=n;for(;r>$i;)r&nr&&(i=i.add(s)),s=s.double(),r>>=nr;return i},precomputeWindow(n,r){const{windows:i,windowSize:s}=Ln(r,t),o=[];let a=n,c=a;for(let u=0;u<i;u++){c=a,o.push(c);for(let d=1;d<s;d++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,i){let s=e.ZERO,o=e.BASE;const a=Ln(n,t);for(let c=0;c<a.windows;c++){const{nextN:u,offset:d,isZero:f,isNeg:l,isNegF:p,offsetF:g}=Ei(i,c,a);i=u,f?o=o.add(On(p,r[g])):s=s.add(On(l,r[d]))}return{p:s,f:o}},wNAFUnsafe(n,r,i,s=e.ZERO){const o=Ln(n,t);for(let a=0;a<o.windows&&i!==$i;a++){const{nextN:c,offset:u,isZero:d,isNeg:f}=Ei(i,a,o);if(i=c,!d){const l=r[u];s=s.add(f?l.negate():l)}}return s},getPrecomputes(n,r,i){let s=Mn.get(r);return s||(s=this.precomputeWindow(r,n),n!==1&&Mn.set(r,i(s))),s},wNAFCached(n,r,i){const s=Cn(n);return this.wNAF(s,this.getPrecomputes(s,n,i),r)},wNAFCachedUnsafe(n,r,i,s){const o=Cn(n);return o===1?this.unsafeLadder(n,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,n,i),r,s)},setWindowSize(n,r){Io(r,t),Bo.set(n,r),Mn.delete(n)}}}function Kl(e,t,n,r){if(ql(n,e),Wl(r,t),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,s=na(BigInt(n.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=Jt(o),c=new Array(Number(a)+1).fill(i),u=Math.floor((t.BITS-1)/o)*o;let d=i;for(let f=u;f>=0;f-=o){c.fill(i);for(let p=0;p<r.length;p++){const g=r[p],y=Number(g>>BigInt(f)&a);c[y]=c[y].add(n[p])}let l=i;for(let p=c.length-1,g=i;p>0;p--)g=g.add(c[p]),l=l.add(g);if(d=d.add(l),f!==0)for(let p=0;p<o;p++)d=d.double()}return d}function So(e){return Dl(e.Fp),Qt(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Eo(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}function vi(e){e.lowS!==void 0&&mt("lowS",e.lowS),e.prehash!==void 0&&mt("prehash",e.prehash)}function Yl(e){const t=So(e);Qt(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}class Xl extends Error{constructor(t=""){super(t)}}const we={Err:Xl,_tlv:{encode:(e,t)=>{const{Err:n}=we;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,i=Ot(r);if(i.length/2&128)throw new n("tlv.encode: long form length too big");const s=r>127?Ot(i.length/2|128):"";return Ot(e)+s+i+t},decode(e,t){const{Err:n}=we;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const c=i&127;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+c);if(u.length!==c)throw new n("tlv.decode: length bytes not complete");if(u[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const d of u)o=o<<8|d;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(e){const{Err:t}=we;if(e<xe)throw new t("integer: negative integers are not allowed");let n=Ot(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=we;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Ce(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=we,i=se("signature",e),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,s),{v:u,l:d}=r.decode(2,c);if(d.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(u)}},hexFromSig(e){const{_tlv:t,_int:n}=we,r=t.encode(2,n.encode(e.r)),i=t.encode(2,n.encode(e.s)),s=r+i;return t.encode(48,s)}},xe=BigInt(0),D=BigInt(1);BigInt(2);const Ai=BigInt(3);BigInt(4);function Jl(e){const t=Yl(e),{Fp:n}=t,r=vo(t.n,t.nBitLength),i=t.toBytes||((y,h,m)=>{const v=h.toAffine();return jt(Uint8Array.from([4]),n.toBytes(v.x),n.toBytes(v.y))}),s=t.fromBytes||(y=>{const h=y.subarray(1),m=n.fromBytes(h.subarray(0,n.BYTES)),v=n.fromBytes(h.subarray(n.BYTES,2*n.BYTES));return{x:m,y:v}});function o(y){const{a:h,b:m}=t,v=n.sqr(y),A=n.mul(v,y);return n.add(n.add(A,n.mul(y,h)),m)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(y){return cr(y,D,t.n)}function c(y){const{allowedPrivateKeyLengths:h,nByteLength:m,wrapPrivateKey:v,n:A}=t;if(h&&typeof y!="bigint"){if(tt(y)&&(y=bt(y)),typeof y!="string"||!h.includes(y.length))throw new Error("invalid private key");y=y.padStart(m*2,"0")}let T;try{T=typeof y=="bigint"?y:Ce(se("private key",y,m))}catch{throw new Error("invalid private key, expected hex or "+m+" bytes, got "+typeof y)}return v&&(T=Q(T,A)),Je("private key",T,D,A),T}function u(y){if(!(y instanceof l))throw new Error("ProjectivePoint expected")}const d=Hr((y,h)=>{const{px:m,py:v,pz:A}=y;if(n.eql(A,n.ONE))return{x:m,y:v};const T=y.is0();h==null&&(h=T?n.ONE:n.inv(A));const L=n.mul(m,h),z=n.mul(v,h),P=n.mul(A,h);if(T)return{x:n.ZERO,y:n.ZERO};if(!n.eql(P,n.ONE))throw new Error("invZ was invalid");return{x:L,y:z}}),f=Hr(y=>{if(y.is0()){if(t.allowInfinityPoint&&!n.is0(y.py))return;throw new Error("bad point: ZERO")}const{x:h,y:m}=y.toAffine();if(!n.isValid(h)||!n.isValid(m))throw new Error("bad point: x or y not FE");const v=n.sqr(m),A=o(h);if(!n.eql(v,A))throw new Error("bad point: equation left != right");if(!y.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class l{constructor(h,m,v){if(h==null||!n.isValid(h))throw new Error("x required");if(m==null||!n.isValid(m))throw new Error("y required");if(v==null||!n.isValid(v))throw new Error("z required");this.px=h,this.py=m,this.pz=v,Object.freeze(this)}static fromAffine(h){const{x:m,y:v}=h||{};if(!h||!n.isValid(m)||!n.isValid(v))throw new Error("invalid affine point");if(h instanceof l)throw new Error("projective point not allowed");const A=T=>n.eql(T,n.ZERO);return A(m)&&A(v)?l.ZERO:new l(m,v,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){const m=n.invertBatch(h.map(v=>v.pz));return h.map((v,A)=>v.toAffine(m[A])).map(l.fromAffine)}static fromHex(h){const m=l.fromAffine(s(se("pointHex",h)));return m.assertValidity(),m}static fromPrivateKey(h){return l.BASE.multiply(c(h))}static msm(h,m){return Kl(l,r,h,m)}_setWindowSize(h){g.setWindowSize(this,h)}assertValidity(){f(this)}hasEvenY(){const{y:h}=this.toAffine();if(n.isOdd)return!n.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){u(h);const{px:m,py:v,pz:A}=this,{px:T,py:L,pz:z}=h,P=n.eql(n.mul(m,z),n.mul(T,A)),_=n.eql(n.mul(v,z),n.mul(L,A));return P&&_}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:h,b:m}=t,v=n.mul(m,Ai),{px:A,py:T,pz:L}=this;let z=n.ZERO,P=n.ZERO,_=n.ZERO,B=n.mul(A,A),V=n.mul(T,T),C=n.mul(L,L),M=n.mul(A,T);return M=n.add(M,M),_=n.mul(A,L),_=n.add(_,_),z=n.mul(h,_),P=n.mul(v,C),P=n.add(z,P),z=n.sub(V,P),P=n.add(V,P),P=n.mul(z,P),z=n.mul(M,z),_=n.mul(v,_),C=n.mul(h,C),M=n.sub(B,C),M=n.mul(h,M),M=n.add(M,_),_=n.add(B,B),B=n.add(_,B),B=n.add(B,C),B=n.mul(B,M),P=n.add(P,B),C=n.mul(T,L),C=n.add(C,C),B=n.mul(C,M),z=n.sub(z,B),_=n.mul(C,V),_=n.add(_,_),_=n.add(_,_),new l(z,P,_)}add(h){u(h);const{px:m,py:v,pz:A}=this,{px:T,py:L,pz:z}=h;let P=n.ZERO,_=n.ZERO,B=n.ZERO;const V=t.a,C=n.mul(t.b,Ai);let M=n.mul(m,T),ee=n.mul(v,L),b=n.mul(A,z),w=n.add(m,v),x=n.add(T,L);w=n.mul(w,x),x=n.add(M,ee),w=n.sub(w,x),x=n.add(m,A);let S=n.add(T,z);return x=n.mul(x,S),S=n.add(M,b),x=n.sub(x,S),S=n.add(v,A),P=n.add(L,z),S=n.mul(S,P),P=n.add(ee,b),S=n.sub(S,P),B=n.mul(V,x),P=n.mul(C,b),B=n.add(P,B),P=n.sub(ee,B),B=n.add(ee,B),_=n.mul(P,B),ee=n.add(M,M),ee=n.add(ee,M),b=n.mul(V,b),x=n.mul(C,x),ee=n.add(ee,b),b=n.sub(M,b),b=n.mul(V,b),x=n.add(x,b),M=n.mul(ee,x),_=n.add(_,M),M=n.mul(S,x),P=n.mul(w,P),P=n.sub(P,M),M=n.mul(w,ee),B=n.mul(S,B),B=n.add(B,M),new l(P,_,B)}subtract(h){return this.add(h.negate())}is0(){return this.equals(l.ZERO)}wNAF(h){return g.wNAFCached(this,h,l.normalizeZ)}multiplyUnsafe(h){const{endo:m,n:v}=t;Je("scalar",h,xe,v);const A=l.ZERO;if(h===xe)return A;if(this.is0()||h===D)return this;if(!m||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,h,l.normalizeZ);let{k1neg:T,k1:L,k2neg:z,k2:P}=m.splitScalar(h),_=A,B=A,V=this;for(;L>xe||P>xe;)L&D&&(_=_.add(V)),P&D&&(B=B.add(V)),V=V.double(),L>>=D,P>>=D;return T&&(_=_.negate()),z&&(B=B.negate()),B=new l(n.mul(B.px,m.beta),B.py,B.pz),_.add(B)}multiply(h){const{endo:m,n:v}=t;Je("scalar",h,D,v);let A,T;if(m){const{k1neg:L,k1:z,k2neg:P,k2:_}=m.splitScalar(h);let{p:B,f:V}=this.wNAF(z),{p:C,f:M}=this.wNAF(_);B=g.constTimeNegate(L,B),C=g.constTimeNegate(P,C),C=new l(n.mul(C.px,m.beta),C.py,C.pz),A=B.add(C),T=V.add(M)}else{const{p:L,f:z}=this.wNAF(h);A=L,T=z}return l.normalizeZ([A,T])[0]}multiplyAndAddUnsafe(h,m,v){const A=l.BASE,T=(z,P)=>P===xe||P===D||!z.equals(A)?z.multiplyUnsafe(P):z.multiply(P),L=T(this,m).add(T(h,v));return L.is0()?void 0:L}toAffine(h){return d(this,h)}isTorsionFree(){const{h,isTorsionFree:m}=t;if(h===D)return!0;if(m)return m(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h,clearCofactor:m}=t;return h===D?this:m?m(l,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return mt("isCompressed",h),this.assertValidity(),i(l,this,h)}toHex(h=!0){return mt("isCompressed",h),bt(this.toRawBytes(h))}}l.BASE=new l(t.Gx,t.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,g=Zl(l,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:l,normPrivateKeyToScalar:c,weierstrassEquation:o,isWithinCurveOrder:a}}function Ql(e){const t=So(e);return Qt(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function eh(e){const t=Ql(e),{Fp:n,n:r}=t,i=n.BYTES+1,s=2*n.BYTES+1;function o(b){return Q(b,r)}function a(b){return tr(b,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:d,isWithinCurveOrder:f}=Jl({...t,toBytes(b,w,x){const S=w.toAffine(),O=n.toBytes(S.x),k=jt;return mt("isCompressed",x),x?k(Uint8Array.from([w.hasEvenY()?2:3]),O):k(Uint8Array.from([4]),O,n.toBytes(S.y))},fromBytes(b){const w=b.length,x=b[0],S=b.subarray(1);if(w===i&&(x===2||x===3)){const O=Ce(S);if(!cr(O,D,n.ORDER))throw new Error("Point is not on curve");const k=d(O);let X;try{X=n.sqrt(k)}catch(ie){const J=ie instanceof Error?": "+ie.message:"";throw new Error("Point is not on curve"+J)}const Z=(X&D)===D;return(x&1)===1!==Z&&(X=n.neg(X)),{x:O,y:X}}else if(w===s&&x===4){const O=n.fromBytes(S.subarray(0,n.BYTES)),k=n.fromBytes(S.subarray(n.BYTES,2*n.BYTES));return{x:O,y:k}}else{const O=i,k=s;throw new Error("invalid Point, expected length of "+O+", or uncompressed "+k+", got "+w)}}}),l=b=>bt(wt(b,t.nByteLength));function p(b){const w=r>>D;return b>w}function g(b){return p(b)?o(-b):b}const y=(b,w,x)=>Ce(b.slice(w,x));class h{constructor(w,x,S){Je("r",w,D,r),Je("s",x,D,r),this.r=w,this.s=x,S!=null&&(this.recovery=S),Object.freeze(this)}static fromCompact(w){const x=t.nByteLength;return w=se("compactSignature",w,x*2),new h(y(w,0,x),y(w,x,2*x))}static fromDER(w){const{r:x,s:S}=we.toSig(se("DER",w));return new h(x,S)}assertValidity(){}addRecoveryBit(w){return new h(this.r,this.s,w)}recoverPublicKey(w){const{r:x,s:S,recovery:O}=this,k=z(se("msgHash",w));if(O==null||![0,1,2,3].includes(O))throw new Error("recovery id invalid");const X=O===2||O===3?x+t.n:x;if(X>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const Z=(O&1)===0?"02":"03",pe=c.fromHex(Z+l(X)),ie=a(X),J=o(-k*ie),Ve=o(S*ie),ve=c.BASE.multiplyAndAddUnsafe(pe,J,Ve);if(!ve)throw new Error("point at infinify");return ve.assertValidity(),ve}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new h(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return kt(this.toDERHex())}toDERHex(){return we.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return kt(this.toCompactHex())}toCompactHex(){return l(this.r)+l(this.s)}}const m={isValidPrivateKey(b){try{return u(b),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const b=Po(t.n);return Gl(t.randomBytes(b),t.n)},precompute(b=8,w=c.BASE){return w._setWindowSize(b),w.multiply(BigInt(3)),w}};function v(b,w=!0){return c.fromPrivateKey(b).toRawBytes(w)}function A(b){const w=tt(b),x=typeof b=="string",S=(w||x)&&b.length;return w?S===i||S===s:x?S===2*i||S===2*s:b instanceof c}function T(b,w,x=!0){if(A(b))throw new Error("first arg must be private key");if(!A(w))throw new Error("second arg must be public key");return c.fromHex(w).multiply(u(b)).toRawBytes(x)}const L=t.bits2int||function(b){if(b.length>8192)throw new Error("input is too large");const w=Ce(b),x=b.length*8-t.nBitLength;return x>0?w>>BigInt(x):w},z=t.bits2int_modN||function(b){return o(L(b))},P=Jt(t.nBitLength);function _(b){return Je("num < 2^"+t.nBitLength,b,xe,P),wt(b,t.nByteLength)}function B(b,w,x=V){if(["recovered","canonical"].some(Oe=>Oe in x))throw new Error("sign() legacy options not supported");const{hash:S,randomBytes:O}=t;let{lowS:k,prehash:X,extraEntropy:Z}=x;k==null&&(k=!0),b=se("msgHash",b),vi(x),X&&(b=se("prehashed msgHash",S(b)));const pe=z(b),ie=u(w),J=[_(ie),_(pe)];if(Z!=null&&Z!==!1){const Oe=Z===!0?O(n.BYTES):Z;J.push(se("extraEntropy",Oe))}const Ve=jt(...J),ve=pe;function wn(Oe){const Ge=L(Oe);if(!f(Ge))return;const xn=a(Ge),dt=c.BASE.multiply(Ge).toAffine(),Le=o(dt.x);if(Le===xe)return;const lt=o(xn*o(ve+Le*ie));if(lt===xe)return;let qe=(dt.x===Le?0:2)|Number(dt.y&D),jr=lt;return k&&p(lt)&&(jr=g(lt),qe^=1),new h(Le,jr,qe)}return{seed:Ve,k2sig:wn}}const V={lowS:t.lowS,prehash:!1},C={lowS:t.lowS,prehash:!1};function M(b,w,x=V){const{seed:S,k2sig:O}=B(b,w,x),k=t;return ra(k.hash.outputLen,k.nByteLength,k.hmac)(S,O)}c.BASE._setWindowSize(8);function ee(b,w,x,S=C){const O=b;w=se("msgHash",w),x=se("publicKey",x);const{lowS:k,prehash:X,format:Z}=S;if(vi(S),"strict"in S)throw new Error("options.strict was renamed to lowS");if(Z!==void 0&&Z!=="compact"&&Z!=="der")throw new Error("format must be compact or der");const pe=typeof O=="string"||tt(O),ie=!pe&&!Z&&typeof O=="object"&&O!==null&&typeof O.r=="bigint"&&typeof O.s=="bigint";if(!pe&&!ie)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let J,Ve;try{if(ie&&(J=new h(O.r,O.s)),pe){try{Z!=="compact"&&(J=h.fromDER(O))}catch(qe){if(!(qe instanceof we.Err))throw qe}!J&&Z!=="der"&&(J=h.fromCompact(O))}Ve=c.fromHex(x)}catch{return!1}if(!J||k&&J.hasHighS())return!1;X&&(w=t.hash(w));const{r:ve,s:wn}=J,Oe=z(w),Ge=a(wn),xn=o(Oe*Ge),dt=o(ve*Ge),Le=c.BASE.multiplyAndAddUnsafe(Ve,xn,dt)?.toAffine();return Le?o(Le.x)===ve:!1}return{CURVE:t,getPublicKey:v,getSharedSecret:T,sign:M,verify:ee,ProjectivePoint:c,Signature:h,utils:m}}function th(e){return{hash:e,hmac:(t,...n)=>$o(e,t,Ya(...n)),randomBytes:Xa}}function nh(e,t){const n=r=>eh({...e,...th(r)});return{...n(t),create:n}}const To=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Pi=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),rh=BigInt(1),rr=BigInt(2),Ii=(e,t)=>(e+t/rr)/t;function ih(e){const t=To,n=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,d=u*u*e%t,f=te(d,n,t)*d%t,l=te(f,n,t)*d%t,p=te(l,rr,t)*u%t,g=te(p,i,t)*p%t,y=te(g,s,t)*g%t,h=te(y,a,t)*y%t,m=te(h,c,t)*h%t,v=te(m,a,t)*y%t,A=te(v,n,t)*d%t,T=te(A,o,t)*g%t,L=te(T,r,t)*u%t,z=te(L,rr,t);if(!ir.eql(ir.sqr(z),e))throw new Error("Cannot find square root");return z}const ir=vo(To,void 0,void 0,{sqrt:ih}),hn=nh({a:BigInt(0),b:BigInt(7),Fp:ir,n:Pi,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=Pi,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rh*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,o=BigInt("0x100000000000000000000000000000000"),a=Ii(s*e,t),c=Ii(-r*e,t);let u=Q(e-a*n-c*i,t),d=Q(-a*r-c*s,t);const f=u>o,l=d>o;if(f&&(u=t-u),l&&(d=t-d),u>o||d>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:l,k2:d}}}},mc);BigInt(0);hn.ProjectivePoint;function _o(e,t={}){const{recovered:n}=t;if(typeof e.r>"u")throw new Nn({signature:e});if(typeof e.s>"u")throw new Nn({signature:e});if(n&&typeof e.yParity>"u")throw new Nn({signature:e});if(e.r<0n||e.r>gi)throw new dh({value:e.r});if(e.s<0n||e.s>gi)throw new lh({value:e.s});if(typeof e.yParity=="number"&&e.yParity!==0&&e.yParity!==1)throw new gn({value:e.yParity})}function sh(e){return zo(Y(e))}function zo(e){if(e.length!==130&&e.length!==132)throw new fh({signature:e});const t=BigInt(K(e,0,32)),n=BigInt(K(e,32,64)),r=(()=>{const i=+`0x${e.slice(130)}`;if(!Number.isNaN(i))try{return yn(i)}catch{throw new gn({value:i})}})();return typeof r>"u"?{r:t,s:n}:{r:t,s:n,yParity:r}}function _t(e){if(!(typeof e.r>"u")&&!(typeof e.s>"u"))return oh(e)}function oh(e){const t=typeof e=="string"?zo(e):e instanceof Uint8Array?sh(e):typeof e.r=="string"?ah(e):e.v?Oo(e):{r:e.r,s:e.s,...typeof e.yParity<"u"?{yParity:e.yParity}:{}};return _o(t),t}function Oo(e){return{r:e.r,s:e.s,yParity:yn(e.v)}}function ah(e){const t=(()=>{const n=e.v?Number(e.v):void 0;let r=e.yParity?Number(e.yParity):void 0;if(typeof n=="number"&&typeof r!="number"&&(r=yn(n)),typeof r!="number")throw new gn({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}function ch(e){_o(e);const t=e.r,n=e.s;return N(E(t,{size:32}),E(n,{size:32}),typeof e.yParity=="number"?E(Lo(e.yParity),{size:1}):"0x")}function uh(e){const{r:t,s:n,yParity:r}=e;return{r:E(t,{size:32}),s:E(n,{size:32}),yParity:r===0?"0x0":"0x1"}}function pn(e){const{r:t,s:n,yParity:r}=e;return[r?"0x01":"0x",t===0n?"0x":xt(E(t)),n===0n?"0x":xt(E(n))]}function yn(e){if(e===0||e===27)return 0;if(e===1||e===28)return 1;if(e>=35)return e%2===0?1:0;throw new Mo({value:e})}function Lo(e){if(e===0)return 27;if(e===1)return 28;throw new gn({value:e})}class fh extends ${constructor({signature:t}){super(`Value \`${t}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${R(en(t))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Nn extends ${constructor({signature:t}){super(`Signature \`${at(t)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class dh extends ${constructor({value:t}){super(`Value \`${t}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class lh extends ${constructor({value:t}){super(`Value \`${t}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class gn extends ${constructor({value:t}){super(`Value \`${t}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Mo extends ${constructor({value:t}){super(`Value \`${t}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}function W0(e,t={}){return typeof e.chainId=="string"?hh(e):{...e,...t.signature}}function hh(e){const{address:t,chainId:n,nonce:r}=e,i=_t(e);return{address:t,chainId:Number(n),nonce:BigInt(r),...i}}function Z0(e){return ph(e)}function ph(e){return ne(N("0x05",Tt(Co(e))))}function yh(e){const{address:t,chainId:n,nonce:r,...i}=e;return{address:t,chainId:E(n),nonce:E(r),...uh(i)}}function K0(e){return e.map(yh)}function Co(e){const{address:t,chainId:n,nonce:r}=e,i=_t(e);return[n?E(n):"0x",t,r?E(r):"0x",...i?pn(i):[]]}function gh(e){if(!e||e.length===0)return[];const t=[];for(const n of e)t.push(Co(n));return t}let mh=!1;function Y0(e={}){const{as:t="Hex"}=e,n=hn.utils.randomPrivateKey();return t==="Hex"?Y(n):n}function X0(e){return Jd(bh(e))}function bh(e){const{payload:t,signature:n}=e,{r,s:i,yParity:s}=n,a=new hn.Signature(BigInt(r),BigInt(i)).addRecoveryBit(s).recoverPublicKey(en(t).substring(2));return Hd(a)}function wh(e){const{extraEntropy:t=mh,hash:n,payload:r,privateKey:i}=e,{r:s,s:o,recovery:a}=hn.sign(jn(r),jn(i),{extraEntropy:typeof t=="boolean"?t:en(t).slice(2),lowS:!0,...n?{prehash:!0}:{}});return{r:s,s:o,yParity:a}}const Bi={wei:0,gwei:9,szabo:12,finney:15,ether:18};function xh(e,t=0){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[i,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${i||"0"}${s?`.${s}`:""}`}function Yt(e,t="wei"){return xh(e,Bi.gwei-Bi[t])}function J0(e,t=0){if(!/^(-?)([0-9]*)\.?([0-9]*)$/.test(e))throw new $h({value:e});let[n="",r="0"]=e.split(".");const i=n.startsWith("-");if(i&&(n=n.slice(1)),r=r.replace(/(0+)$/,""),t===0)Math.round(+`.${r}`)===1&&(n=`${BigInt(n)+1n}`),r="";else if(r.length>t){const[s,o,a]=[r.slice(0,t-1),r.slice(t-1,t),r.slice(t)],c=Math.round(+`${o}.${a}`);c>9?r=`${BigInt(s)+BigInt(1)}0`.padStart(s.length+1,"0"):r=`${s}${c}`,r.length>t&&(r=r.slice(1),n=`${BigInt(n)+1n}`),r=r.slice(0,t)}else r=r.padEnd(t,"0");return BigInt(`${i?"-":""}${n}${r}`)}class $h extends ${constructor({value:t}){super(`Value \`${t}\` is not a valid decimal number.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Value.InvalidDecimalNumberError"})}}class Eh extends ${constructor({feeCap:t}={}){super(`The fee cap (\`maxFeePerGas\`/\`maxPriorityFeePerGas\`${t?` = ${Yt(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.FeeCapTooHighError"})}}class No extends ${constructor({gasPrice:t}={}){super(`The gas price (\`gasPrice\`${t?` = ${Yt(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.GasPriceTooHighError"})}}class mn extends ${constructor({chainId:t}){super(typeof t<"u"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.InvalidChainIdError"})}}class vh extends ${constructor({maxPriorityFeePerGas:t,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${Yt(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${Yt(n)} gwei`:""}).`].join(`
|
|
29
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.TipAboveFeeCapError"})}}function Uo(e){const{chainId:t,gasPrice:n,to:r}=e;if(r&&he(r,{strict:!1}),typeof t<"u"&&t<=0)throw new mn({chainId:t});if(n&&BigInt(n)>2n**256n-1n)throw new No({gasPrice:n})}function Ah(e,t={}){const{chainId:n=0,gas:r,data:i,input:s,nonce:o,to:a,value:c,gasPrice:u}=e;Uo(e);let d=[o?E(o):"0x",u?E(u):"0x",r?E(r):"0x",a??"0x",c?E(c):"0x",i??s??"0x"];const f=(()=>{if(t.signature)return{r:t.signature.r,s:t.signature.s,v:Lo(t.signature.yParity)};if(!(typeof e.r>"u"||typeof e.s>"u"))return{r:e.r,s:e.s,v:e.v}})();if(f){const l=(()=>{if(f.v>=35)return Math.floor((f.v-35)/2)>0?f.v:27+(f.v===35?0:1);if(n>0)return n*2+35+f.v-27;const p=27+(f.v===27?0:1);if(f.v!==p)throw new Mo({value:f.v});return p})();d=[...d,E(l),f.r===0n?"0x":xt(E(f.r)),f.s===0n?"0x":xt(E(f.s))]}else n>0&&(d=[...d,E(n),"0x","0x"]);return Tt(d)}const Ph="0x02";function Lr(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:i}=e;if(t<=0)throw new mn({chainId:t});if(i&&he(i,{strict:!1}),r&&BigInt(r)>2n**256n-1n)throw new Eh({feeCap:r});if(n&&r&&n>r)throw new vh({maxFeePerGas:r,maxPriorityFeePerGas:n})}function Ih(e,t={}){const{chainId:n,gas:r,nonce:i,to:s,value:o,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:u,data:d,input:f}=e;Lr(e);const l=Or(u),p=_t(t.signature||e),g=[E(n),i?E(i):"0x",c?E(c):"0x",a?E(a):"0x",r?E(r):"0x",s??"0x",o?E(o):"0x",d??f??"0x",l,...p?pn(p):[]];return N(Ph,Tt(g))}function Ro(e){const{chainId:t,gasPrice:n,to:r}=e;if(t<=0)throw new mn({chainId:t});if(r&&he(r,{strict:!1}),n&&BigInt(n)>2n**256n-1n)throw new No({gasPrice:n})}function Bh(e,t={}){const{chainId:n,gas:r,data:i,input:s,nonce:o,to:a,value:c,accessList:u,gasPrice:d}=e;Ro(e);const f=Or(u),l=_t(t.signature||e),p=[E(n),o?E(o):"0x",d?E(d):"0x",r?E(r):"0x",a??"0x",c?E(c):"0x",i??s??"0x",f,...l?pn(l):[]];return N("0x01",Tt(p))}const Sh="0x04";function ko(e){const{authorizationList:t}=e;if(t)for(const n of t){const{address:r,chainId:i}=n;if(r&&he(r,{strict:!1}),Number(i)<0)throw new mn({chainId:i})}Lr(e)}function Th(e,t={}){const{authorizationList:n,chainId:r,gas:i,nonce:s,to:o,value:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f,input:l}=e;ko(e);const p=Or(d),g=gh(n),y=_t(t.signature||e),h=[E(r),s?E(s):"0x",u?E(u):"0x",c?E(c):"0x",i?E(i):"0x",o??"0x",a?E(a):"0x",f??l??"0x",p,g,...y?pn(y):[]];return N(Sh,Tt(h))}function jo(e){const{domain:t,message:n,primaryType:r,types:i}=e,s=(o,a)=>{for(const c of o){const{name:u,type:d}=c,f=a[u],l=d.match(Ir);if(l&&(typeof f=="number"||typeof f=="bigint")){const[,y,h]=l;E(f,{signed:y==="int",size:Number.parseInt(h??"")/8})}if(d==="address"&&typeof f=="string"&&!Zt(f))throw new Kn({address:f,cause:new fo});const p=d.match(po);if(p){const[,y]=p;if(y&&R(f)!==Number.parseInt(y))throw new Lh({expectedSize:Number.parseInt(y),givenSize:R(f)})}const g=i[d];g&&(Rh(d),s(g,f))}};if(i.EIP712Domain&&t){if(typeof t!="object")throw new Mh({domain:t});s(i.EIP712Domain,t)}if(r!=="EIP712Domain")if(i[r])s(i[r],n);else throw new Ch({primaryType:r,types:i})}function _h(e){const{domain:t={},message:n,primaryType:r}=e,i={EIP712Domain:bn(t),...e.types};jo({domain:t,message:n,primaryType:r,types:i});const s=["0x19","0x01"];return t&&s.push(Fo({domain:t,types:i})),r!=="EIP712Domain"&&s.push(Do({data:n,primaryType:r,types:i})),N(...s)}function zh(e){const{primaryType:t,types:n}=e;let r="";const i=Go({primaryType:t,types:n});i.delete(t);const s=[t,...Array.from(i).sort()];for(const o of s)r+=`${o}(${(n[o]??[]).map(({name:a,type:c})=>`${c} ${a}`).join(",")})`;return r}function bn(e){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},typeof e?.chainId=="number"&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Q0(e){return ne(_h(e))}function Fo(e){const{domain:t,types:n}=e;return Do({data:t,primaryType:"EIP712Domain",types:{...n,EIP712Domain:n?.EIP712Domain||bn(t)}})}function Do(e){const{data:t,primaryType:n,types:r}=e,i=Ho({data:t,primaryType:n,types:r});return ne(i)}function ey(e){const{domain:t,message:n,primaryType:r,types:i}=e,s=(c,u)=>{const d={...u};for(const f of c){const{name:l,type:p}=f;p==="address"&&(d[l]=d[l].toLowerCase())}return d},o=(()=>{if(!t)return{};const c=i.EIP712Domain??bn(t);return s(c,t)})(),a=(()=>{if(r!=="EIP712Domain")return i[r]?s(i[r],n):{}})();return at({domain:o,message:a,primaryType:r,types:i},(c,u)=>typeof u=="bigint"?u.toString():u)}function Oh(e){try{return jo(e),!0}catch{return!1}}class Lh extends ${constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.BytesSizeMismatchError"})}}class Mh extends ${constructor({domain:t}){super(`Invalid domain "${at(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidDomainError"})}}class Ch extends ${constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{metaMessages:["Check that the primary type is a key in `types`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidPrimaryTypeError"})}}class Nh extends ${constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidStructTypeError"})}}function Ho(e){const{data:t,primaryType:n,types:r}=e,i=[{type:"bytes32"}],s=[Uh({primaryType:n,types:r})];for(const o of r[n]??[]){const[a,c]=Vo({types:r,name:o.name,type:o.type,value:t[o.name]});i.push(a),s.push(c)}return ln(i,s)}function Uh(e){const{primaryType:t,types:n}=e,r=It(zh({primaryType:t,types:n}));return ne(r)}function Vo(e){let{types:t,name:n,type:r,value:i}=e;if(t[r]!==void 0)return[{type:"bytes32"},ne(Ho({data:i,primaryType:r,types:t}))];if(r==="bytes")return i=`0x${(i.length%2?"0":"")+i.slice(2)}`,[{type:"bytes32"},ne(i,{as:"Hex"})];if(r==="string")return[{type:"bytes32"},ne(dr(i),{as:"Hex"})];if(r.lastIndexOf("]")===r.length-1){const s=r.slice(0,r.lastIndexOf("[")),o=i.map(a=>Vo({name:n,type:s,types:t,value:a}));return[{type:"bytes32"},ne(ln(o.map(([a])=>a),o.map(([,a])=>a)))]}return[{type:r},i]}function Go(e,t=new Set){const{primaryType:n,types:r}=e,s=n.match(/^\w*/u)?.[0];if(t.has(s)||r[s]===void 0)return t;t.add(s);for(const o of r[s])Go({primaryType:o.type,types:r},t);return t}function Rh(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Nh({type:e})}function At(e){return Fe(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function He(e,t){if(e.length!==t.length)throw new Error("The number of parameters and values must match.");const n=kh({params:e,values:t}),r=Cr(n);return r.length===0?"0x":r}function kh({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Mr({param:e[r],value:t[r]}));return n}function Mr({param:e,value:t}){const n=Wh(e.type);if(n){const[r,i]=n;return Fh(t,{length:r,param:{...e,type:i}})}if(e.type==="tuple")return qh(t,{param:e});if(e.type==="address")return jh(t);if(e.type==="bool")return Hh(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int");return Vh(t,{signed:r})}if(e.type.startsWith("bytes"))return Dh(t,{param:e});if(e.type==="string")return Gh(t);throw new Error(`Unsupported parameter type: ${e.type}`)}function Cr(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=At(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(de(t+i,{size:32})),r.push(a),i+=At(a)):n.push(a)}return N(...n,...r)}function jh(e){if(e!==""&&e!==void 0&&!pr(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:Ne(e.toLowerCase())}}function Fh(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Error("Invalid array value.");if(!r&&e.length!==t)throw new Error("Invalid array length.");let i=!1;const s=[];for(let o=0;o<e.length;o++){const a=Mr({param:n,value:e[o]});a.dynamic&&(i=!0),s.push(a)}if(r||i){const o=Cr(s);if(r){const a=de(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?N(a,o):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:N(...s.map(({encoded:o})=>o))}}function Dh(e,{param:t}){const[,n]=t.type.split("bytes"),r=At(e);if(!n){let i=e;return r%32!==0&&(i=Ne(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:N(Ne(de(r,{size:32})),i)}}if(r!==Number.parseInt(n))throw new Error(`Invalid bytes${n} size: ${r}`);return{dynamic:!1,encoded:Ne(e,{dir:"right"})}}function Hh(e){return{dynamic:!1,encoded:Ne(ss(e))}}function Vh(e,{signed:t}){return{dynamic:!1,encoded:de(e,{signed:t,size:32})}}function Gh(e){const t=rn(e),n=Math.ceil(At(t)/32),r=[];for(let i=0;i<n;i++)r.push(Ne(K(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:N(Ne(de(At(t),{size:32})),...r)}}function qh(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const s=t.components[i],o=Array.isArray(e)?i:s.name,a=Mr({param:s,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Cr(r):N(...r.map(({encoded:i})=>i))}}function Wh(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Un=new _i(4096);function Be(e){const t=typeof e=="string"?e:fe(e);if(Un.has(t))return Un.get(t);const n=typeof e=="string"?st(e):e,i=[Er(n),n.inputs,n.outputs];return Un.set(t,i),i}function qo(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="function")}async function Nr(e){const{contract:t,method:n,params:r}=e,i=async()=>{if(Array.isArray(n))return n;if(qo(n))return Be(n);if(typeof n=="function")return Be(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const f=st(n);if(f.type==="function")return Be(f);throw new Error('"method" passed is not of type "function"')}if(t.abi&&t.abi?.length>0){const f=t.abi?.find(l=>l.type==="function"&&l.name===n);if(f)return Be(f)}throw new Error(`Could not resolve method "${n}".`)},[s,o]=await Promise.all([i(),typeof r=="function"?r():r]);let a;s[1].length===0?a=s[0]:a=s[0]+He(s[1],o).slice(2);const c=De({chain:t.chain,client:t.client}),u=await ao(c,{data:a,from:e.from?Ie(e.from):void 0,to:t.address}),d=un(s[2],u);return Array.isArray(d)&&d.length===1?d[0]:d}const Ur=Object.freeze(Object.defineProperty({__proto__:null,readContract:Nr},Symbol.toStringTag,{value:"Module"}));function Zh(e){const t=new Set;let n=e;const r=()=>{for(const i of t)i()};return{getValue(){return n},setValue(i){i!==n&&(n=i,r())},subscribe(i){return t.add(i),()=>{t.delete(i)}}}}const sr=new Map;function Kh(e){const t=sr.get(e);if(t)return t;const n=Zh([]);return sr.set(e,n),n}function Yh(e){const{address:t,transactionHash:n,chainId:r}=e,i=Kh(t);i.setValue([...i.getValue(),{chainId:r,transactionHash:n}]),sr.set(t,i)}async function Xh(e){let{account:t,transaction:n,gasless:r}=e;if(t.onTransactionRequested&&await t.onTransactionRequested(n),n.eip712){const{sendEip712Transaction:o}=await F(async()=>{const{sendEip712Transaction:a}=await import("./send-eip712-transaction-CB6qLgks.js").then(c=>c.a);return{sendEip712Transaction:a}},__vite__mapDeps([9,1,2,10]));return o({account:t,transaction:n})}const i=await Cd({from:t,transaction:n});if(r){const{sendGaslessTransaction:o}=await F(async()=>{const{sendGaslessTransaction:a}=await import("./send-gasless-transaction-Dt1qtUR8.js");return{sendGaslessTransaction:a}},__vite__mapDeps([12,1,2,0]));return o({account:t,gasless:r,serializableTransaction:i,transaction:n})}const s=await t.sendTransaction(i);return Yh({address:t.address,chainId:n.chain.id,transactionHash:s.transactionHash}),{...s,chain:n.chain,client:n.client}}const Jh=Object.freeze(Object.defineProperty({__proto__:null,sendTransaction:Xh},Symbol.toStringTag,{value:"Module"}));function Si(e){const{transaction:t}=e,n=Qh(t),r=(()=>{if(e.signature)return"v"in e.signature&&typeof e.signature.v<"u"?Oo({r:be(e.signature.r),s:be(e.signature.s),v:Number(e.signature.v)}):{r:be(e.signature.r),s:be(e.signature.s),yParity:e.signature.yParity};if(!(typeof t.v>"u"&&typeof t.yParity>"u")){if(t.r===void 0||t.s===void 0)throw new Error("Invalid signature provided with transaction");return{r:typeof t.r=="bigint"?t.r:be(t.r),s:typeof t.s=="bigint"?t.s:be(t.s),yParity:typeof t.v<"u"&&typeof t.yParity>"u"?yn(Number(t.v)):Number(t.yParity)}}})();if(n==="eip1559"){const i=t;return Lr(i),Ih(i,{signature:r})}if(n==="legacy"){const i=t;return Uo(i),Ah(i,{signature:r})}if(n==="eip2930"){const i=t;return Ro(i),Bh(i,{signature:r})}if(n==="eip7702"){const i=t;return ko(i),Th(i,{signature:r})}throw new Error("Invalid transaction type")}function Qh(e){if(typeof e.type<"u")return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Error("Invalid transaction type")}function ty({transaction:e,privateKey:t}){const n=Si({transaction:e}),r=wh({payload:ne(n),privateKey:t});return Si({transaction:{...e,...r}})}const ep={eip1559:1,eip2930:2,eip4844:3,eip7702:4,legacy:0};function Wo(e,t){return t&&(e.__preparedMethod=t.preparedMethod,e.__contract=t.contract),e}const tp=Object.freeze(Object.defineProperty({__proto__:null,TransactionTypeMap:ep,prepareTransaction:Wo},Symbol.toStringTag,{value:"Module"}));function Rr(e){const{contract:t,method:n,params:r,...i}=e,s=()=>(async()=>{if(Array.isArray(n))return n;if(qo(n))return Be(n);if(typeof n=="function")return Be(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const o=st(n);if(o.type==="function")return Be(o);throw new Error('"method" passed is not of type "function"')}if(t.abi&&t.abi?.length>0){const o=t.abi?.find(a=>a.type==="function"&&a.name===n);if(o)return Be(o)}throw new Error(`Could not resolve method "${n}".`)})();return Wo({...i,chain:t.chain,client:t.client,data:async()=>{let o;return Array.isArray(n)?o=n:o=await s(),o[1].length===0?o[0]:o[0]+He(o[1],await q(r??[])).slice(2)},to:t.address},{contract:t,preparedMethod:s})}function np(e,t){const n=typeof t=="string"?{to:t}:t;switch(n.to){case"number":return sp(e,n);case"bigint":return rp(e,n);case"boolean":return ip(e,n);case"string":return op(e,n);default:return hr(e,n)}}function rp(e,t={}){return Gi(e,t)}function ip(e,t={}){return qi(e,t)}function sp(e,t={}){return ce(e,t)}function op(e,t={}){return Wi(e,t)}function Zo(e){return N(...e)}const ap=Object.freeze(Object.defineProperty({__proto__:null,concatHex:Zo},Symbol.toStringTag,{value:"Module"})),cp="0x6492649264926492649264926492649264926492649264926492649264926492",up="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",fp=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}];function dp(e){if(K(e,-32)!==cp)throw new hp(e)}function lp(e){try{return dp(e),!0}catch{return!1}}class hp extends ${constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WrappedSignature.InvalidWrappedSignatureError"})}}const pp="0x1626ba7e",yp=[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],gp=[{type:"bytes4"}];async function mp(e){return Nr({contract:e.contract,method:[pp,yp,gp],params:[e.hash,e.signature]})}const Nt=new WeakMap;function bp(e){if(Nt.has(e))return Nt.get(e);const t=(async()=>{const n=De(e),r=await Ud(n,{address:e.address,blockTag:"latest"});return r==="0x"&&Nt.delete(e),r})();return Nt.set(e,t),t}const Ti=new WeakSet;async function zt(e){if(Ti.has(e))return!0;const n=await bp(e)!=="0x";return n&&Ti.add(e),n}const wp=Object.freeze(Object.defineProperty({__proto__:null,isContractDeployed:zt},Symbol.toStringTag,{value:"Module"})),xp="0x6492649264926492649264926492649264926492649264926492649264926492";function kr({address:e,data:t,signature:n}){return Zo([He([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,t,n]),xp])}const $p="0xfB688330379976DA81eB64Fe4BF50d7401763B9C";async function ny({hash:e,signature:t,address:n,client:r,chain:i,accountFactory:s}){const o=(()=>{if(Fe(t))return t;if(typeof t=="object"&&"r"in t&&"s"in t)return ch(t);if(t instanceof Uint8Array)return np(t,"hex");throw new Error(`Invalid signature type for signature ${t}: ${typeof t}`)})();if(await zt(Ut({address:n,chain:i,client:r}))&&await Xt({contract:Ut({address:n,chain:i,client:r}),hash:e,signature:o}).catch(g=>(console.error("Error verifying EIP-1271 signature",g),!1)))return!0;const c=await(async()=>!s||lp(o)?o:kr({address:s.address,data:s.verificationCalldata,signature:o}))();let u;const d=await Hs(i),f=jd(fp);if(d)u={data:zl(zr(f,"isValidSig"),[n,e,c]),to:$p};else{const p=_l(f);u={data:Tl(p,{args:[n,e,c],bytecode:up})}}const l=De({chain:i,client:r});try{const p=await ao(l,u);return rs(p)}catch{return!!await Xt({contract:Ut({address:n,chain:i,client:r}),hash:e,signature:o}).catch(g=>(console.error("Error verifying EIP-1271 signature",g),!1))}}const Ep="0x1626ba7e";async function Xt({hash:e,signature:t,contract:n}){try{return await mp({contract:n,hash:e,signature:t})===Ep}catch(r){return console.error("Error verifying EIP-1271 signature",r),!1}}const vp=`Ethereum Signed Message:
|
|
29
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionEnvelope.TipAboveFeeCapError"})}}function Uo(e){const{chainId:t,gasPrice:n,to:r}=e;if(r&&he(r,{strict:!1}),typeof t<"u"&&t<=0)throw new mn({chainId:t});if(n&&BigInt(n)>2n**256n-1n)throw new No({gasPrice:n})}function Ah(e,t={}){const{chainId:n=0,gas:r,data:i,input:s,nonce:o,to:a,value:c,gasPrice:u}=e;Uo(e);let d=[o?E(o):"0x",u?E(u):"0x",r?E(r):"0x",a??"0x",c?E(c):"0x",i??s??"0x"];const f=(()=>{if(t.signature)return{r:t.signature.r,s:t.signature.s,v:Lo(t.signature.yParity)};if(!(typeof e.r>"u"||typeof e.s>"u"))return{r:e.r,s:e.s,v:e.v}})();if(f){const l=(()=>{if(f.v>=35)return Math.floor((f.v-35)/2)>0?f.v:27+(f.v===35?0:1);if(n>0)return n*2+35+f.v-27;const p=27+(f.v===27?0:1);if(f.v!==p)throw new Mo({value:f.v});return p})();d=[...d,E(l),f.r===0n?"0x":xt(E(f.r)),f.s===0n?"0x":xt(E(f.s))]}else n>0&&(d=[...d,E(n),"0x","0x"]);return Tt(d)}const Ph="0x02";function Lr(e){const{chainId:t,maxPriorityFeePerGas:n,maxFeePerGas:r,to:i}=e;if(t<=0)throw new mn({chainId:t});if(i&&he(i,{strict:!1}),r&&BigInt(r)>2n**256n-1n)throw new Eh({feeCap:r});if(n&&r&&n>r)throw new vh({maxFeePerGas:r,maxPriorityFeePerGas:n})}function Ih(e,t={}){const{chainId:n,gas:r,nonce:i,to:s,value:o,maxFeePerGas:a,maxPriorityFeePerGas:c,accessList:u,data:d,input:f}=e;Lr(e);const l=Or(u),p=_t(t.signature||e),g=[E(n),i?E(i):"0x",c?E(c):"0x",a?E(a):"0x",r?E(r):"0x",s??"0x",o?E(o):"0x",d??f??"0x",l,...p?pn(p):[]];return N(Ph,Tt(g))}function Ro(e){const{chainId:t,gasPrice:n,to:r}=e;if(t<=0)throw new mn({chainId:t});if(r&&he(r,{strict:!1}),n&&BigInt(n)>2n**256n-1n)throw new No({gasPrice:n})}function Bh(e,t={}){const{chainId:n,gas:r,data:i,input:s,nonce:o,to:a,value:c,accessList:u,gasPrice:d}=e;Ro(e);const f=Or(u),l=_t(t.signature||e),p=[E(n),o?E(o):"0x",d?E(d):"0x",r?E(r):"0x",a??"0x",c?E(c):"0x",i??s??"0x",f,...l?pn(l):[]];return N("0x01",Tt(p))}const Sh="0x04";function ko(e){const{authorizationList:t}=e;if(t)for(const n of t){const{address:r,chainId:i}=n;if(r&&he(r,{strict:!1}),Number(i)<0)throw new mn({chainId:i})}Lr(e)}function Th(e,t={}){const{authorizationList:n,chainId:r,gas:i,nonce:s,to:o,value:a,maxFeePerGas:c,maxPriorityFeePerGas:u,accessList:d,data:f,input:l}=e;ko(e);const p=Or(d),g=gh(n),y=_t(t.signature||e),h=[E(r),s?E(s):"0x",u?E(u):"0x",c?E(c):"0x",i?E(i):"0x",o??"0x",a?E(a):"0x",f??l??"0x",p,g,...y?pn(y):[]];return N(Sh,Tt(h))}function jo(e){const{domain:t,message:n,primaryType:r,types:i}=e,s=(o,a)=>{for(const c of o){const{name:u,type:d}=c,f=a[u],l=d.match(Ir);if(l&&(typeof f=="number"||typeof f=="bigint")){const[,y,h]=l;E(f,{signed:y==="int",size:Number.parseInt(h??"")/8})}if(d==="address"&&typeof f=="string"&&!Zt(f))throw new Kn({address:f,cause:new fo});const p=d.match(po);if(p){const[,y]=p;if(y&&R(f)!==Number.parseInt(y))throw new Lh({expectedSize:Number.parseInt(y),givenSize:R(f)})}const g=i[d];g&&(Rh(d),s(g,f))}};if(i.EIP712Domain&&t){if(typeof t!="object")throw new Mh({domain:t});s(i.EIP712Domain,t)}if(r!=="EIP712Domain")if(i[r])s(i[r],n);else throw new Ch({primaryType:r,types:i})}function _h(e){const{domain:t={},message:n,primaryType:r}=e,i={EIP712Domain:bn(t),...e.types};jo({domain:t,message:n,primaryType:r,types:i});const s=["0x19","0x01"];return t&&s.push(Fo({domain:t,types:i})),r!=="EIP712Domain"&&s.push(Do({data:n,primaryType:r,types:i})),N(...s)}function zh(e){const{primaryType:t,types:n}=e;let r="";const i=Go({primaryType:t,types:n});i.delete(t);const s=[t,...Array.from(i).sort()];for(const o of s)r+=`${o}(${(n[o]??[]).map(({name:a,type:c})=>`${c} ${a}`).join(",")})`;return r}function bn(e){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},typeof e?.chainId=="number"&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}function Q0(e){return ne(_h(e))}function Fo(e){const{domain:t,types:n}=e;return Do({data:t,primaryType:"EIP712Domain",types:{...n,EIP712Domain:n?.EIP712Domain||bn(t)}})}function Do(e){const{data:t,primaryType:n,types:r}=e,i=Ho({data:t,primaryType:n,types:r});return ne(i)}function ey(e){const{domain:t,message:n,primaryType:r,types:i}=e,s=(c,u)=>{const d={...u};for(const f of c){const{name:l,type:p}=f;p==="address"&&(d[l]=d[l].toLowerCase())}return d},o=(()=>{if(!t)return{};const c=i.EIP712Domain??bn(t);return s(c,t)})(),a=(()=>{if(r!=="EIP712Domain")return i[r]?s(i[r],n):{}})();return at({domain:o,message:a,primaryType:r,types:i},(c,u)=>typeof u=="bigint"?u.toString():u)}function Oh(e){try{return jo(e),!0}catch{return!1}}class Lh extends ${constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.BytesSizeMismatchError"})}}class Mh extends ${constructor({domain:t}){super(`Invalid domain "${at(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidDomainError"})}}class Ch extends ${constructor({primaryType:t,types:n}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(n))}\`.`,{metaMessages:["Check that the primary type is a key in `types`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidPrimaryTypeError"})}}class Nh extends ${constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidStructTypeError"})}}function Ho(e){const{data:t,primaryType:n,types:r}=e,i=[{type:"bytes32"}],s=[Uh({primaryType:n,types:r})];for(const o of r[n]??[]){const[a,c]=Vo({types:r,name:o.name,type:o.type,value:t[o.name]});i.push(a),s.push(c)}return ln(i,s)}function Uh(e){const{primaryType:t,types:n}=e,r=It(zh({primaryType:t,types:n}));return ne(r)}function Vo(e){let{types:t,name:n,type:r,value:i}=e;if(t[r]!==void 0)return[{type:"bytes32"},ne(Ho({data:i,primaryType:r,types:t}))];if(r==="bytes")return i=`0x${(i.length%2?"0":"")+i.slice(2)}`,[{type:"bytes32"},ne(i,{as:"Hex"})];if(r==="string")return[{type:"bytes32"},ne(dr(i),{as:"Hex"})];if(r.lastIndexOf("]")===r.length-1){const s=r.slice(0,r.lastIndexOf("[")),o=i.map(a=>Vo({name:n,type:s,types:t,value:a}));return[{type:"bytes32"},ne(ln(o.map(([a])=>a),o.map(([,a])=>a)))]}return[{type:r},i]}function Go(e,t=new Set){const{primaryType:n,types:r}=e,s=n.match(/^\w*/u)?.[0];if(t.has(s)||r[s]===void 0)return t;t.add(s);for(const o of r[s])Go({primaryType:o.type,types:r},t);return t}function Rh(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new Nh({type:e})}function At(e){return Fe(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function He(e,t){if(e.length!==t.length)throw new Error("The number of parameters and values must match.");const n=kh({params:e,values:t}),r=Cr(n);return r.length===0?"0x":r}function kh({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(Mr({param:e[r],value:t[r]}));return n}function Mr({param:e,value:t}){const n=Wh(e.type);if(n){const[r,i]=n;return Fh(t,{length:r,param:{...e,type:i}})}if(e.type==="tuple")return qh(t,{param:e});if(e.type==="address")return jh(t);if(e.type==="bool")return Hh(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int");return Vh(t,{signed:r})}if(e.type.startsWith("bytes"))return Dh(t,{param:e});if(e.type==="string")return Gh(t);throw new Error(`Unsupported parameter type: ${e.type}`)}function Cr(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?t+=32:t+=At(a)}const n=[],r=[];let i=0;for(let s=0;s<e.length;s++){const{dynamic:o,encoded:a}=e[s];o?(n.push(de(t+i,{size:32})),r.push(a),i+=At(a)):n.push(a)}return N(...n,...r)}function jh(e){if(e!==""&&e!==void 0&&!pr(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:Ne(e.toLowerCase())}}function Fh(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Error("Invalid array value.");if(!r&&e.length!==t)throw new Error("Invalid array length.");let i=!1;const s=[];for(let o=0;o<e.length;o++){const a=Mr({param:n,value:e[o]});a.dynamic&&(i=!0),s.push(a)}if(r||i){const o=Cr(s);if(r){const a=de(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?N(a,o):a}}if(i)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:N(...s.map(({encoded:o})=>o))}}function Dh(e,{param:t}){const[,n]=t.type.split("bytes"),r=At(e);if(!n){let i=e;return r%32!==0&&(i=Ne(i,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:N(Ne(de(r,{size:32})),i)}}if(r!==Number.parseInt(n))throw new Error(`Invalid bytes${n} size: ${r}`);return{dynamic:!1,encoded:Ne(e,{dir:"right"})}}function Hh(e){return{dynamic:!1,encoded:Ne(ss(e))}}function Vh(e,{signed:t}){return{dynamic:!1,encoded:de(e,{signed:t,size:32})}}function Gh(e){const t=rn(e),n=Math.ceil(At(t)/32),r=[];for(let i=0;i<n;i++)r.push(Ne(K(t,i*32,(i+1)*32),{dir:"right"}));return{dynamic:!0,encoded:N(Ne(de(At(t),{size:32})),...r)}}function qh(e,{param:t}){let n=!1;const r=[];for(let i=0;i<t.components.length;i++){const s=t.components[i],o=Array.isArray(e)?i:s.name,a=Mr({param:s,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Cr(r):N(...r.map(({encoded:i})=>i))}}function Wh(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Un=new _i(4096);function Be(e){const t=typeof e=="string"?e:fe(e);if(Un.has(t))return Un.get(t);const n=typeof e=="string"?st(e):e,i=[Er(n),n.inputs,n.outputs];return Un.set(t,i),i}function qo(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="function")}async function Nr(e){const{contract:t,method:n,params:r}=e,i=async()=>{if(Array.isArray(n))return n;if(qo(n))return Be(n);if(typeof n=="function")return Be(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const f=st(n);if(f.type==="function")return Be(f);throw new Error('"method" passed is not of type "function"')}if(t.abi&&t.abi?.length>0){const f=t.abi?.find(l=>l.type==="function"&&l.name===n);if(f)return Be(f)}throw new Error(`Could not resolve method "${n}".`)},[s,o]=await Promise.all([i(),typeof r=="function"?r():r]);let a;s[1].length===0?a=s[0]:a=s[0]+He(s[1],o).slice(2);const c=De({chain:t.chain,client:t.client}),u=await ao(c,{data:a,from:e.from?Ie(e.from):void 0,to:t.address}),d=un(s[2],u);return Array.isArray(d)&&d.length===1?d[0]:d}const Ur=Object.freeze(Object.defineProperty({__proto__:null,readContract:Nr},Symbol.toStringTag,{value:"Module"}));function Zh(e){const t=new Set;let n=e;const r=()=>{for(const i of t)i()};return{getValue(){return n},setValue(i){i!==n&&(n=i,r())},subscribe(i){return t.add(i),()=>{t.delete(i)}}}}const sr=new Map;function Kh(e){const t=sr.get(e);if(t)return t;const n=Zh([]);return sr.set(e,n),n}function Yh(e){const{address:t,transactionHash:n,chainId:r}=e,i=Kh(t);i.setValue([...i.getValue(),{chainId:r,transactionHash:n}]),sr.set(t,i)}async function Xh(e){let{account:t,transaction:n,gasless:r}=e;if(t.onTransactionRequested&&await t.onTransactionRequested(n),n.eip712){const{sendEip712Transaction:o}=await F(async()=>{const{sendEip712Transaction:a}=await import("./send-eip712-transaction-DW2Z39R_.js").then(c=>c.a);return{sendEip712Transaction:a}},__vite__mapDeps([9,1,2,10]));return o({account:t,transaction:n})}const i=await Cd({from:t,transaction:n});if(r){const{sendGaslessTransaction:o}=await F(async()=>{const{sendGaslessTransaction:a}=await import("./send-gasless-transaction-DZNXePZn.js");return{sendGaslessTransaction:a}},__vite__mapDeps([12,1,2,0]));return o({account:t,gasless:r,serializableTransaction:i,transaction:n})}const s=await t.sendTransaction(i);return Yh({address:t.address,chainId:n.chain.id,transactionHash:s.transactionHash}),{...s,chain:n.chain,client:n.client}}const Jh=Object.freeze(Object.defineProperty({__proto__:null,sendTransaction:Xh},Symbol.toStringTag,{value:"Module"}));function Si(e){const{transaction:t}=e,n=Qh(t),r=(()=>{if(e.signature)return"v"in e.signature&&typeof e.signature.v<"u"?Oo({r:be(e.signature.r),s:be(e.signature.s),v:Number(e.signature.v)}):{r:be(e.signature.r),s:be(e.signature.s),yParity:e.signature.yParity};if(!(typeof t.v>"u"&&typeof t.yParity>"u")){if(t.r===void 0||t.s===void 0)throw new Error("Invalid signature provided with transaction");return{r:typeof t.r=="bigint"?t.r:be(t.r),s:typeof t.s=="bigint"?t.s:be(t.s),yParity:typeof t.v<"u"&&typeof t.yParity>"u"?yn(Number(t.v)):Number(t.yParity)}}})();if(n==="eip1559"){const i=t;return Lr(i),Ih(i,{signature:r})}if(n==="legacy"){const i=t;return Uo(i),Ah(i,{signature:r})}if(n==="eip2930"){const i=t;return Ro(i),Bh(i,{signature:r})}if(n==="eip7702"){const i=t;return ko(i),Th(i,{signature:r})}throw new Error("Invalid transaction type")}function Qh(e){if(typeof e.type<"u")return e.type;if(typeof e.authorizationList<"u")return"eip7702";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Error("Invalid transaction type")}function ty({transaction:e,privateKey:t}){const n=Si({transaction:e}),r=wh({payload:ne(n),privateKey:t});return Si({transaction:{...e,...r}})}const ep={eip1559:1,eip2930:2,eip4844:3,eip7702:4,legacy:0};function Wo(e,t){return t&&(e.__preparedMethod=t.preparedMethod,e.__contract=t.contract),e}const tp=Object.freeze(Object.defineProperty({__proto__:null,TransactionTypeMap:ep,prepareTransaction:Wo},Symbol.toStringTag,{value:"Module"}));function Rr(e){const{contract:t,method:n,params:r,...i}=e,s=()=>(async()=>{if(Array.isArray(n))return n;if(qo(n))return Be(n);if(typeof n=="function")return Be(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const o=st(n);if(o.type==="function")return Be(o);throw new Error('"method" passed is not of type "function"')}if(t.abi&&t.abi?.length>0){const o=t.abi?.find(a=>a.type==="function"&&a.name===n);if(o)return Be(o)}throw new Error(`Could not resolve method "${n}".`)})();return Wo({...i,chain:t.chain,client:t.client,data:async()=>{let o;return Array.isArray(n)?o=n:o=await s(),o[1].length===0?o[0]:o[0]+He(o[1],await q(r??[])).slice(2)},to:t.address},{contract:t,preparedMethod:s})}function np(e,t){const n=typeof t=="string"?{to:t}:t;switch(n.to){case"number":return sp(e,n);case"bigint":return rp(e,n);case"boolean":return ip(e,n);case"string":return op(e,n);default:return hr(e,n)}}function rp(e,t={}){return Gi(e,t)}function ip(e,t={}){return qi(e,t)}function sp(e,t={}){return ce(e,t)}function op(e,t={}){return Wi(e,t)}function Zo(e){return N(...e)}const ap=Object.freeze(Object.defineProperty({__proto__:null,concatHex:Zo},Symbol.toStringTag,{value:"Module"})),cp="0x6492649264926492649264926492649264926492649264926492649264926492",up="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",fp=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}];function dp(e){if(K(e,-32)!==cp)throw new hp(e)}function lp(e){try{return dp(e),!0}catch{return!1}}class hp extends ${constructor(t){super(`Value \`${t}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WrappedSignature.InvalidWrappedSignatureError"})}}const pp="0x1626ba7e",yp=[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],gp=[{type:"bytes4"}];async function mp(e){return Nr({contract:e.contract,method:[pp,yp,gp],params:[e.hash,e.signature]})}const Nt=new WeakMap;function bp(e){if(Nt.has(e))return Nt.get(e);const t=(async()=>{const n=De(e),r=await Ud(n,{address:e.address,blockTag:"latest"});return r==="0x"&&Nt.delete(e),r})();return Nt.set(e,t),t}const Ti=new WeakSet;async function zt(e){if(Ti.has(e))return!0;const n=await bp(e)!=="0x";return n&&Ti.add(e),n}const wp=Object.freeze(Object.defineProperty({__proto__:null,isContractDeployed:zt},Symbol.toStringTag,{value:"Module"})),xp="0x6492649264926492649264926492649264926492649264926492649264926492";function kr({address:e,data:t,signature:n}){return Zo([He([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,t,n]),xp])}const $p="0xfB688330379976DA81eB64Fe4BF50d7401763B9C";async function ny({hash:e,signature:t,address:n,client:r,chain:i,accountFactory:s}){const o=(()=>{if(Fe(t))return t;if(typeof t=="object"&&"r"in t&&"s"in t)return ch(t);if(t instanceof Uint8Array)return np(t,"hex");throw new Error(`Invalid signature type for signature ${t}: ${typeof t}`)})();if(await zt(Ut({address:n,chain:i,client:r}))&&await Xt({contract:Ut({address:n,chain:i,client:r}),hash:e,signature:o}).catch(g=>(console.error("Error verifying EIP-1271 signature",g),!1)))return!0;const c=await(async()=>!s||lp(o)?o:kr({address:s.address,data:s.verificationCalldata,signature:o}))();let u;const d=await Hs(i),f=jd(fp);if(d)u={data:zl(zr(f,"isValidSig"),[n,e,c]),to:$p};else{const p=_l(f);u={data:Tl(p,{args:[n,e,c],bytecode:up})}}const l=De({chain:i,client:r});try{const p=await ao(l,u);return rs(p)}catch{return!!await Xt({contract:Ut({address:n,chain:i,client:r}),hash:e,signature:o}).catch(g=>(console.error("Error verifying EIP-1271 signature",g),!1))}}const Ep="0x1626ba7e";async function Xt({hash:e,signature:t,contract:n}){try{return await mp({contract:n,hash:e,signature:t})===Ep}catch(r){return console.error("Error verifying EIP-1271 signature",r),!1}}const vp=`Ethereum Signed Message:
|
|
30
30
|
`;function Ap(e,t){const n=typeof e=="string"?Ft(e):e.raw instanceof Uint8Array?e.raw:La(e.raw),r=Ft(`${vp}${n.length}`);return $e(Vi(r,n),t)}function Pp(e){const{domain:t={},message:n,primaryType:r}=e,i={EIP712Domain:bn(t),...e.types};Oh({domain:t,message:n,primaryType:r,types:i});const s=["0x1901"];if(t&&s.push(Fo({domain:t,types:i})),r!=="EIP712Domain"){const o=(()=>{const a=Ko({data:n,primaryType:r,types:i});return $e(a)})();s.push(o)}return $e(Vi(...s.map(o=>ze(o))))}function Ko({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],i=[Ip({primaryType:t,types:n})];if(!n[t])throw new Error("Invalid types");for(const s of n[t]){const[o,a]=Xo({name:s.name,type:s.type,types:n,value:e[s.name]});r.push(o),i.push(a)}return He(r,i)}function Ip({primaryType:e,types:t}){const n=os(Bp({primaryType:e,types:t}));return $e(n)}function Bp({primaryType:e,types:t}){let n="";const r=Yo({primaryType:e,types:t});r.delete(e);const i=[e,...Array.from(r).sort()];for(const s of i){if(!t[s])throw new Error("Invalid types");n+=`${s}(${t[s].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`}return n}function Yo({primaryType:e,types:t},n=new Set){const i=e.match(/^\w*/u)?.[0];if(n.has(i)||t[i]===void 0)return n;n.add(i);for(const s of t[i])Yo({primaryType:s.type,types:t},n);return n}function Xo({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},$e(Ko({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},$e(r)];if(n==="string")return[{type:"bytes32"},$e(os(r))];if(n.lastIndexOf("]")===n.length-1){const i=n.slice(0,n.lastIndexOf("[")),s=r.map(o=>Xo({name:t,type:i,types:e,value:o}));return[{type:"bytes32"},$e(He(s.map(([o])=>o),s.map(([,o])=>o)))]}return[{type:n},r]}async function ry(e){const{factoryContract:t,predictAddressOverride:n,adminAddress:r,accountSalt:i,accountAddress:s}=e;if(n)return n(t,r);if(s)return s;if(!r)throw new Error("Account address is required to predict the smart wallet address.");return Oi(async()=>{const o=i&&Fe(i)?i:rn(i??"");let a,c=0;const u=3;for(;c<=u;)try{a=await Nr({contract:t,method:"function getAddress(address, bytes) returns (address)",params:[r,o]});break}catch(d){if(c===u)throw d;const f=2**(c+1)*200;await new Promise(l=>setTimeout(l,f)),c++}if(!a)throw new Error(`No smart account address found for admin address ${r} and salt ${i}`);return a},{cacheKey:`${e.factoryContract.chain.id}-${e.factoryContract.address}-${e.adminAddress}-${e.accountSalt}`,cacheTime:1e3*60*60*24})}function Jo(e){const{adminAddress:t,factoryContract:n,createAccountOverride:r,accountSalt:i}=e;if(r)return r(n,t);const s=i&&Fe(i)?i:rn(i??"");return Rr({contract:n,method:"function createAccount(address, bytes) returns (address)",params:[t,s]})}function iy(e){const{accountContract:t,transaction:n,executeOverride:r}=e;if(r)return r(t,n);let i=n.value||0n;return(n.chainId===295||n.chainId===296)&&(i=BigInt(i)/BigInt(10**10)),Rr({contract:t,gas:n.gas?n.gas+21000n:void 0,method:"function execute(address, uint256, bytes)",params:[n.to||"",i,n.data||"0x"]})}function sy(e){const{accountContract:t,transactions:n,executeBatchOverride:r}=e;if(r)return r(t,n);let i=n.map(o=>o.value||0n);const s=n[0]?.chainId;return(s===295||s===296)&&(i=i.map(o=>BigInt(o)/BigInt(10**10))),Rr({contract:t,method:"function executeBatch(address[], uint256[], bytes[])",params:[n.map(o=>o.to||""),i,n.map(o=>o.data||"0x")]})}async function Sp({accountContract:e,factoryContract:t,options:n,message:r}){const i=Ap(r);let s;const o=He([{type:"bytes32"}],[i]);if(s=await n.personalAccount.signTypedData({domain:{chainId:n.chain.id,name:"Account",verifyingContract:e.address,version:"1"},message:{message:o},primaryType:"AccountMessage",types:{AccountMessage:[{name:"message",type:"bytes"}]}}),await zt(e)){if(await Xt({contract:e,hash:i,signature:s}))return s;throw new Error("Failed to verify signature")}else{const c=Jo({accountSalt:n.overrides?.accountSalt,adminAddress:n.personalAccount.address,createAccountOverride:n.overrides?.createAccount,factoryContract:t});if(!c)throw new Error("Create account override not provided");const u=await fn(c);return kr({address:t.address,data:u,signature:s})}}async function Tp({accountContract:e,factoryContract:t,options:n,typedData:r}){if(r.domain?.verifyingContract?.toLowerCase()===e.address?.toLowerCase())return n.personalAccount.signTypedData(r);const s=Pp(r);let o;const a=He([{type:"bytes32"}],[s]);if(o=await n.personalAccount.signTypedData({domain:{chainId:n.chain.id,name:"Account",verifyingContract:e.address,version:"1"},message:{message:a},primaryType:"AccountMessage",types:{AccountMessage:[{name:"message",type:"bytes"}]}}),await zt(e)){if(await Xt({contract:e,hash:s,signature:o}))return o;throw new Error("Failed to verify signature")}else{const u=Jo({accountSalt:n.overrides?.accountSalt,adminAddress:n.personalAccount.address,createAccountOverride:n.overrides?.createAccount,factoryContract:t});if(!u)throw new Error("Create account override not provided");const d=await fn(u);return kr({address:t.address,data:d,signature:o})}}async function Qo(e){const{accountContract:t}=e,n=Date.now(),r=6e4,{isContractDeployed:i}=await F(async()=>{const{isContractDeployed:o}=await Promise.resolve().then(()=>wp);return{isContractDeployed:o}},void 0);let s=await i(t);for(;!s;){if(Date.now()-n>r)throw new Error("Timeout: Smart account deployment not confirmed after 1 minute");await new Promise(o=>setTimeout(o,500)),s=await i(t)}}async function _p(e){const{chain:t,client:n,smartAccount:r,accountContract:i}=e;if(await zt(i))return;const[{sendTransaction:o},{prepareTransaction:a}]=await Promise.all([F(()=>Promise.resolve().then(()=>Jh),void 0),F(()=>Promise.resolve().then(()=>tp),void 0)]),c=a({chain:t,client:n,gas:50000n,to:i.address,value:0n}),u=await o({account:r,transaction:c});return await Qo({accountContract:i}),u}const oy=Object.freeze(Object.defineProperty({__proto__:null,confirmContractDeployment:Qo,deploySmartAccount:_p,smartAccountSignMessage:Sp,smartAccountSignTypedData:Tp},Symbol.toStringTag,{value:"Module"}));export{le as $,Ht as A,I as B,Ku as C,Bt as D,Zu as E,ef as F,it as G,bp as H,an as I,br as J,Au as K,j as L,Re as M,Gt as N,v0 as O,G as P,o0 as Q,jc as R,Ca as S,on as T,ut as U,os as V,R0 as W,St as X,Zo as Y,Wp as Z,ju as _,uc as a,wf as a$,iu as a0,p0 as a1,ni as a2,$s as a3,$t as a4,Jc as a5,xs as a6,su as a7,y0 as a8,qp as a9,mf as aA,bc as aB,J0 as aC,q0 as aD,G0 as aE,xh as aF,Cs as aG,ao as aH,pi as aI,st as aJ,Q0 as aK,X0 as aL,zo as aM,ny as aN,Ma as aO,ss as aP,rp as aQ,ip as aR,sp as aS,op as aT,_p as aU,xf as aV,U0 as aW,cf as aX,Ud as aY,uf as aZ,np as a_,js as aa,Rr as ab,dn as ac,bf as ad,zt as ae,Ds as af,Jo as ag,H0 as ah,Hs as ai,ry as aj,iy as ak,sy as al,Bf as am,_f as an,cc as ao,Hp as ap,mc as aq,is as ar,Ft as as,Us as at,Ns as au,Rd as av,j0 as aw,Ed as ax,F0 as ay,oo as az,Ut as b,Cu as b$,Gp as b0,di as b1,k0 as b2,rs as b3,Na as b4,Ne as b5,Wo as b6,ty as b7,La as b8,$0 as b9,Hn as bA,hs as bB,Oc as bC,gs as bD,Tc as bE,Sc as bF,_c as bG,Mc as bH,zc as bI,Cc as bJ,ys as bK,Nc as bL,ps as bM,u0 as bN,Hc as bO,ms as bP,Os as bQ,Ls as bR,ue as bS,Ms as bT,$u as bU,Eu as bV,tf as bW,z0 as bX,of as bY,_0 as bZ,T0 as b_,qt as ba,d0 as bb,g0 as bc,vu as bd,yr as be,Ue as bf,Se as bg,Is as bh,bs as bi,Jp as bj,Qp as bk,e0 as bl,fs as bm,ds as bn,Ec as bo,vc as bp,Ac as bq,t0 as br,n0 as bs,Pc as bt,Qr as bu,Ic as bv,ls as bw,r0 as bx,i0 as by,s0 as bz,Yh as c,S0 as c0,l0 as c1,Mu as c2,cn as c3,wu as c4,Uc as c5,Rc as c6,Vc as c7,Lc as c8,rf as c9,Y0 as cA,wc as cB,Zp as cC,Kp as cD,Yp as cE,rt as cF,A0 as cG,f0 as cH,Nu as cI,E0 as cJ,yu as cK,pt as cL,h0 as cM,Vt as cN,b0 as cO,m0 as cP,xc as cQ,Lp as cR,O0 as cS,L0 as cT,C0 as cU,N0 as cV,oy as cW,Yu as ca,Xp as cb,Ts as cc,ws as cd,mr as ce,bd as cf,ne as cg,en as ch,N as ci,It as cj,R as ck,Vs as cl,fr as cm,Fi as cn,bn as co,Oh as cp,ey as cq,Z0 as cr,K0 as cs,E as ct,wh as cu,ch as cv,hn as cw,W0 as cx,as as cy,Zh as cz,un as d,He as e,Er as f,Ie as g,nn as h,pr as i,fe as j,rn as k,M0 as l,De as m,de as n,Fe as o,Pu as p,$e as q,Nr as r,Si as s,Cd as t,hr as u,Xh as v,fn as w,q as x,vr as y,Ju as z};
|