@dcl/auth-site 4.5.1-21079238159.commit-2c55e0a → 4.5.1-21137956482.commit-e69aea2
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-Cp_FY-T3.js → ConstantsUtil-jtzseze8.js} +1 -1
- package/assets/{ExchangeController-BFAhxxVS.js → ExchangeController-CFBwyf8v.js} +1 -1
- package/assets/{HelpersUtil-CAmaMQsw.js → HelpersUtil-IHnTatPL.js} +1 -1
- package/assets/{NetworkUtil-BUNlaxoa.js → NetworkUtil-CvtSu_eG.js} +1 -1
- package/assets/{SwapController-Cn2UGKqN.js → SwapController-BVoC73vX.js} +1 -1
- package/assets/{biconomy-Dte-ClZ1.js → biconomy-Pgl9s3fN.js} +1 -1
- package/assets/{ccip-xZ3EX8TN.js → ccip-C0mEWIkc.js} +1 -1
- package/assets/{data-capture-Dy6A2QAA.js → data-capture-Br5OYiV4.js} +1 -1
- package/assets/{email-Boe8IApX.js → email-q4V_C5WC.js} +1 -1
- package/assets/{embedded-wallet-BNgvGY1I.js → embedded-wallet-O1kQCeDB.js} +1 -1
- package/assets/{engine-KYjHi9os.js → engine-BhAOdLbw.js} +1 -1
- package/assets/{extractIPFS-vJrEi7qY.js → extractIPFS-CGOJ5iK5.js} +1 -1
- package/assets/{features-ygvvGIPa.js → features-CH5r43mt.js} +1 -1
- package/assets/{fortmatic-DLKsJXo9.js → fortmatic-DmNY0qR0.js} +1 -1
- package/assets/{getInstalledModules-CA_R4T3H.js → getInstalledModules-CEuy7miG.js} +1 -1
- package/assets/{if-defined-PQV0Ib4N.js → if-defined-DioxnqPs.js} +1 -1
- package/assets/{in-app-wallet-calls-Bc8-aDZu.js → in-app-wallet-calls-BT9VKbnk.js} +1 -1
- package/assets/{index-Dt2MZrp8.js → index-6CnJE0NG.js} +1 -1
- package/assets/{index-BhPq4OrG.js → index-7PODkRJu.js} +1 -1
- package/assets/{index-C-EkdqSa.js → index-7RNkW8mM.js} +1 -1
- package/assets/{index-IBJEOofU.js → index-B3eh6-6_.js} +1 -1
- package/assets/{index-BtfPcyoq.js → index-B6yg4OfX.js} +2 -2
- package/assets/{index-scm6yI6H.js → index-B9UUiyKL.js} +4 -4
- package/assets/{index-Bh6B9tr1.js → index-B9ppq8lv.js} +1 -1
- package/assets/{index-Bft2zpkn.js → index-BE4jH3va.js} +1 -1
- package/assets/{index-ovbVBuYp.js → index-BH82juka.js} +1 -1
- package/assets/{index-Dqd_M55I.js → index-BStmHpTW.js} +1 -1
- package/assets/{index-BRyN-x7y.js → index-BTkmCvds.js} +1 -1
- package/assets/{index-DY4JM0Iz.js → index-B_r89_IW.js} +1 -1
- package/assets/{index-COtUDCT7.js → index-BgBtKnVv.js} +1 -1
- package/assets/{index-CAeGDNzc.js → index-BhSeVHFe.js} +1 -1
- package/assets/{index-Cyo5pnww.js → index-BxHA70_j.js} +1 -1
- package/assets/{index-DYL5CPAO.js → index-C8Qx737G.js} +3 -3
- package/assets/{index-Dbp6tZ_x.js → index-CDsJHlTg.js} +1 -1
- package/assets/{index-C1E6bkAj.js → index-CHRl7L0r.js} +1 -1
- package/assets/{index-njYFbPj7.js → index-CHSJ57bp.js} +1 -1
- package/assets/{index-W_l--YIv.js → index-CMZujxaF.js} +1 -1
- package/assets/{index-CH65MCvp.js → index-CMxqxBSF.js} +1 -1
- package/assets/{index-CjKwo-ZR.js → index-CQR8Fmzy.js} +1 -1
- package/assets/{index-Cnt5pXSe.js → index-CYWbZroe.js} +1 -1
- package/assets/{index-CV2HX6D8.js → index-Chlk47H2.js} +1 -1
- package/assets/{index-CfIqR9FD.js → index-Cth66lVY.js} +1 -1
- package/assets/{index-CGYSWxVP.js → index-CwOidauV.js} +1 -1
- package/assets/{index-BOkTItOq.js → index-Cy54ARco.js} +1 -1
- package/assets/{index-B96oFKTj.js → index-CzUwSJWT.js} +1 -1
- package/assets/{index-B_gXjqOS.js → index-D1OjZdjf.js} +39 -39
- package/assets/{index-VOm59Giv.js → index-DTkre0go.js} +1 -1
- package/assets/{index-Cry92o79.js → index-DZ2wXCdh.js} +1 -1
- package/assets/{index-C-2vHalf.js → index-D_wogF1y.js} +1 -1
- package/assets/{index-MFI6pEAS.js → index-DaC1dcar.js} +1 -1
- package/assets/{index-DgzmXztx.js → index-DdZa5SRs.js} +1 -1
- package/assets/{index-C8R6sT2b.js → index-DfqmktiQ.js} +1 -1
- package/assets/{index-DpHaeUOx.css → index-Gk-MjAaS.css} +1 -1
- package/assets/{index-DHemSrBl.js → index-LUkRNy8f.js} +1 -1
- package/assets/{index-D66YXuC2.js → index-S_2WxgAp.js} +1 -1
- package/assets/{index-DonowrSm.js → index-bC-wz677.js} +1 -1
- package/assets/{index-BKxLyLEt.js → index-czY13lqz.js} +1 -1
- package/assets/{index-Ba1L8gU2.js → index-jP_YzGPF.js} +1 -1
- package/assets/{index-BPYapYxW.js → index-psVSK9-5.js} +1 -1
- package/assets/{networks-6CwaWf9q.js → networks-DWdMhOAz.js} +1 -1
- package/assets/{onramp-DQZAkPqu.js → onramp-DqCCgXKo.js} +1 -1
- package/assets/{openzeppelin-BvxBgzxL.js → openzeppelin-Dejnytxt.js} +1 -1
- package/assets/{parse-typed-data-D2l3zJCc.js → parse-typed-data-qSihkYb1.js} +1 -1
- package/assets/{passkeys-L4PZpNqp.js → passkeys-NWmPnQ47.js} +1 -1
- package/assets/{pay-with-exchange-QfH6_NeA.js → pay-with-exchange-Dhi5HRV2.js} +1 -1
- package/assets/{receive-CfCSGJFb.js → receive-cvQks93r.js} +1 -1
- package/assets/{ref--WyxGu8a.js → ref-CkEx_z9u.js} +1 -1
- package/assets/{resolveImplementation-DGbhQK7c.js → resolveImplementation-DgTEX2VO.js} +1 -1
- package/assets/{secp256k1-DqxDz5ot.js → secp256k1-BHzabZ3a.js} +1 -1
- package/assets/{send-eip712-transaction-B8lI5Nl8.js → send-eip712-transaction-r2PbPkaQ.js} +1 -1
- package/assets/{send-gasless-transaction-BUH0JHe1.js → send-gasless-transaction-D5QodABW.js} +2 -2
- package/assets/{send-_sxwVxru.js → send-uYVw7eE0.js} +1 -1
- package/assets/{socials-Dtra5TSe.js → socials-C-jPodBk.js} +1 -1
- package/assets/{swaps-DiP4DKd_.js → swaps-xz9TJECX.js} +1 -1
- package/assets/{thirdweb-_0PRV2DQ.js → thirdweb-B-X7D-t-.js} +3 -3
- package/assets/{transactions-BFhutcFm.js → transactions-ZO_U6SLw.js} +1 -1
- package/assets/{ui-CPIb-uVJ.js → ui-C5Ikwo9e.js} +4 -4
- package/assets/{ui-CC8fNSYo.css → ui-CpFg30hJ.css} +3 -3
- package/assets/{vendor-01kwxxMG.js → vendor-Jqid35Oh.js} +1 -1
- package/assets/{verifyHash-1cBMSwlt.js → verifyHash-94xfg2Z4.js} +3 -3
- package/assets/{w3m-modal-Bd-ghlKA.js → w3m-modal-CbYVVkaw.js} +1 -1
- package/assets/{web-connector-CcVqFvP9.js → web-connector-CwXFIAOP.js} +3 -3
- package/index.html +6 -6
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pl(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}const Ys="modulepreload",qs=function(e){return"https://cdn.decentraland.org/@dcl/auth-site/4.5.1-21079238159.commit-2c55e0a/"+e},yn={},_=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(u=>{if(u=qs(u),u in yn)return;yn[u]=!0;const f=u.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const l=document.createElement("link");if(l.rel=f?"stylesheet":Ys,f||(l.as="script"),l.crossOrigin="",l.href=u,c&&l.setAttribute("nonce",c),document.head.appendChild(l),f)return new Promise((h,y)=>{l.addEventListener("load",h),l.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};function Js(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qn={exports:{}},E=qn.exports={},F,N;function _t(){throw new Error("setTimeout has not been defined")}function St(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?F=setTimeout:F=_t}catch{F=_t}try{typeof clearTimeout=="function"?N=clearTimeout:N=St}catch{N=St}})();function Jn(e){if(F===setTimeout)return setTimeout(e,0);if((F===_t||!F)&&setTimeout)return F=setTimeout,setTimeout(e,0);try{return F(e,0)}catch{try{return F.call(null,e,0)}catch{return F.call(this,e,0)}}}function Qs(e){if(N===clearTimeout)return clearTimeout(e);if((N===St||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(e);try{return N(e)}catch{try{return N.call(null,e)}catch{return N.call(this,e)}}}var W=[],pe=!1,ae,Ge=-1;function ei(){!pe||!ae||(pe=!1,ae.length?W=ae.concat(W):Ge=-1,W.length&&Qn())}function Qn(){if(!pe){var e=Jn(ei);pe=!0;for(var t=W.length;t;){for(ae=W,W=[];++Ge<t;)ae&&ae[Ge].run();Ge=-1,t=W.length}ae=null,pe=!1,Qs(e)}}E.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];W.push(new er(e,t)),W.length===1&&!pe&&Jn(Qn)};function er(e,t){this.fun=e,this.array=t}er.prototype.run=function(){this.fun.apply(null,this.array)};E.title="browser";E.browser=!0;E.env={};E.argv=[];E.version="";E.versions={};function X(){}E.on=X;E.addListener=X;E.once=X;E.off=X;E.removeListener=X;E.removeAllListeners=X;E.emit=X;E.prependListener=X;E.prependOnceListener=X;E.listeners=function(e){return[]};E.binding=function(e){throw new Error("process.binding is not supported")};E.cwd=function(){return"/"};E.chdir=function(e){throw new Error("process.chdir is not supported")};E.umask=function(){return 0};var ti=qn.exports;const ni=Js(ti);var pt={exports:{}},mn;function ri(){return mn||(mn=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function i(c,u,f,d,l){if(typeof f!="function")throw new TypeError("The listener must be a function");var h=new s(f,d||c,l),y=n?n+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],h]:c._events[y].push(h):(c._events[y]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)t.call(f,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},a.prototype.listeners=function(u){var f=n?n+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var l=0,h=d.length,y=new Array(h);l<h;l++)y[l]=d[l].fn;return y},a.prototype.listenerCount=function(u){var f=n?n+u:u,d=this._events[f];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,f,d,l,h,y){var m=n?n+u:u;if(!this._events[m])return!1;var p=this._events[m],x=arguments.length,g,w;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),x){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,f),!0;case 3:return p.fn.call(p.context,f,d),!0;case 4:return p.fn.call(p.context,f,d,l),!0;case 5:return p.fn.call(p.context,f,d,l,h),!0;case 6:return p.fn.call(p.context,f,d,l,h,y),!0}for(w=1,g=new Array(x-1);w<x;w++)g[w-1]=arguments[w];p.fn.apply(p.context,g)}else{var $=p.length,v;for(w=0;w<$;w++)switch(p[w].once&&this.removeListener(u,p[w].fn,void 0,!0),x){case 1:p[w].fn.call(p[w].context);break;case 2:p[w].fn.call(p[w].context,f);break;case 3:p[w].fn.call(p[w].context,f,d);break;case 4:p[w].fn.call(p[w].context,f,d,l);break;default:if(!g)for(v=1,g=new Array(x-1);v<x;v++)g[v-1]=arguments[v];p[w].fn.apply(p[w].context,g)}}return!0},a.prototype.on=function(u,f,d){return i(this,u,f,d,!1)},a.prototype.once=function(u,f,d){return i(this,u,f,d,!0)},a.prototype.removeListener=function(u,f,d,l){var h=n?n+u:u;if(!this._events[h])return this;if(!f)return o(this,h),this;var y=this._events[h];if(y.fn)y.fn===f&&(!l||y.once)&&(!d||y.context===d)&&o(this,h);else{for(var m=0,p=[],x=y.length;m<x;m++)(y[m].fn!==f||l&&!y[m].once||d&&y[m].context!==d)&&p.push(y[m]);p.length?this._events[h]=p.length===1?p[0]:p:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var f;return u?(f=n?n+u:u,this._events[f]&&o(this,f)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a})(pt)),pt.exports}function gn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function si(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qe(e,...t){if(!si(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 He(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 tr(e,t){qe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ii(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function yt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}const bn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oi(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function wn(e){for(let t=0;t<e.length;t++)e[t]=oi(e[t])}const ai=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ci=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function yl(e){if(qe(e),ai)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=ci[e[n]];return t}function ui(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Wt(e){return typeof e=="string"&&(e=ui(e)),qe(e),e}let nr=class{clone(){return this._cloneInto()}};function rr(e){const t=r=>e().update(Wt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function fi(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function di(e,t,n){return e&t^~e&n}function li(e,t,n){return e&t^e&n^t&n}let hi=class extends nr{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=yt(this.buffer)}update(t){He(this);const{view:n,buffer:r,blockLen:s}=this;t=Wt(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=yt(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){He(this),tr(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;fi(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=yt(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,f[d],i)}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:s,finished:i,destroyed:o,pos:a}=this;return t.length=s,t.pos=a,t.finished=i,t.destroyed=o,s%n&&t.buffer.set(r),t}};const pi=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]),q=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),J=new Uint32Array(64);let yi=class extends hi{constructor(t=32){super(64,t,8,!1),this.A=q[0]|0,this.B=q[1]|0,this.C=q[2]|0,this.D=q[3]|0,this.E=q[4]|0,this.F=q[5]|0,this.G=q[6]|0,this.H=q[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)J[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=J[d-15],h=J[d-2],y=C(l,7)^C(l,18)^l>>>3,m=C(h,17)^C(h,19)^h>>>10;J[d]=m+J[d-7]+y+J[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:u,H:f}=this;for(let d=0;d<64;d++){const l=C(a,6)^C(a,11)^C(a,25),h=f+l+di(a,c,u)+pi[d]+J[d]|0,m=(C(r,2)^C(r,13)^C(r,22))+li(r,s,i)|0;f=u,u=c,c=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,s,i,o,a,c,u,f)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const mi=rr(()=>new yi);var gi=ri();const wl=Xs(gi),bi="1.0.8";let O=class Bt extends Error{constructor(t,n={}){var o;const r=n.cause instanceof Bt?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof Bt&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${bi}`].join(`
|
|
1
|
+
var hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pl(e){if(Object.prototype.hasOwnProperty.call(e,"__esModule"))return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return e[r]}})}),n}const Ys="modulepreload",qs=function(e){return"https://cdn.decentraland.org/@dcl/auth-site/4.5.1-21137956482.commit-e69aea2/"+e},yn={},_=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(u){return Promise.all(u.map(f=>Promise.resolve(f).then(d=>({status:"fulfilled",value:d}),d=>({status:"rejected",reason:d}))))};document.getElementsByTagName("link");const a=document.querySelector("meta[property=csp-nonce]"),c=(a==null?void 0:a.nonce)||(a==null?void 0:a.getAttribute("nonce"));s=o(n.map(u=>{if(u=qs(u),u in yn)return;yn[u]=!0;const f=u.endsWith(".css"),d=f?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${d}`))return;const l=document.createElement("link");if(l.rel=f?"stylesheet":Ys,f||(l.as="script"),l.crossOrigin="",l.href=u,c&&l.setAttribute("nonce",c),document.head.appendChild(l),f)return new Promise((h,y)=>{l.addEventListener("load",h),l.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${u}`)))})}))}function i(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return s.then(o=>{for(const a of o||[])a.status==="rejected"&&i(a.reason);return t().catch(i)})};function Js(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qn={exports:{}},E=qn.exports={},F,N;function _t(){throw new Error("setTimeout has not been defined")}function St(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?F=setTimeout:F=_t}catch{F=_t}try{typeof clearTimeout=="function"?N=clearTimeout:N=St}catch{N=St}})();function Jn(e){if(F===setTimeout)return setTimeout(e,0);if((F===_t||!F)&&setTimeout)return F=setTimeout,setTimeout(e,0);try{return F(e,0)}catch{try{return F.call(null,e,0)}catch{return F.call(this,e,0)}}}function Qs(e){if(N===clearTimeout)return clearTimeout(e);if((N===St||!N)&&clearTimeout)return N=clearTimeout,clearTimeout(e);try{return N(e)}catch{try{return N.call(null,e)}catch{return N.call(this,e)}}}var W=[],pe=!1,ae,Ge=-1;function ei(){!pe||!ae||(pe=!1,ae.length?W=ae.concat(W):Ge=-1,W.length&&Qn())}function Qn(){if(!pe){var e=Jn(ei);pe=!0;for(var t=W.length;t;){for(ae=W,W=[];++Ge<t;)ae&&ae[Ge].run();Ge=-1,t=W.length}ae=null,pe=!1,Qs(e)}}E.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];W.push(new er(e,t)),W.length===1&&!pe&&Jn(Qn)};function er(e,t){this.fun=e,this.array=t}er.prototype.run=function(){this.fun.apply(null,this.array)};E.title="browser";E.browser=!0;E.env={};E.argv=[];E.version="";E.versions={};function X(){}E.on=X;E.addListener=X;E.once=X;E.off=X;E.removeListener=X;E.removeAllListeners=X;E.emit=X;E.prependListener=X;E.prependOnceListener=X;E.listeners=function(e){return[]};E.binding=function(e){throw new Error("process.binding is not supported")};E.cwd=function(){return"/"};E.chdir=function(e){throw new Error("process.chdir is not supported")};E.umask=function(){return 0};var ti=qn.exports;const ni=Js(ti);var pt={exports:{}},mn;function ri(){return mn||(mn=1,(function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,u,f){this.fn=c,this.context=u,this.once=f||!1}function i(c,u,f,d,l){if(typeof f!="function")throw new TypeError("The listener must be a function");var h=new s(f,d||c,l),y=n?n+u:u;return c._events[y]?c._events[y].fn?c._events[y]=[c._events[y],h]:c._events[y].push(h):(c._events[y]=h,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new r:delete c._events[u]}function a(){this._events=new r,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],f,d;if(this._eventsCount===0)return u;for(d in f=this._events)t.call(f,d)&&u.push(n?d.slice(1):d);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(f)):u},a.prototype.listeners=function(u){var f=n?n+u:u,d=this._events[f];if(!d)return[];if(d.fn)return[d.fn];for(var l=0,h=d.length,y=new Array(h);l<h;l++)y[l]=d[l].fn;return y},a.prototype.listenerCount=function(u){var f=n?n+u:u,d=this._events[f];return d?d.fn?1:d.length:0},a.prototype.emit=function(u,f,d,l,h,y){var m=n?n+u:u;if(!this._events[m])return!1;var p=this._events[m],x=arguments.length,g,w;if(p.fn){switch(p.once&&this.removeListener(u,p.fn,void 0,!0),x){case 1:return p.fn.call(p.context),!0;case 2:return p.fn.call(p.context,f),!0;case 3:return p.fn.call(p.context,f,d),!0;case 4:return p.fn.call(p.context,f,d,l),!0;case 5:return p.fn.call(p.context,f,d,l,h),!0;case 6:return p.fn.call(p.context,f,d,l,h,y),!0}for(w=1,g=new Array(x-1);w<x;w++)g[w-1]=arguments[w];p.fn.apply(p.context,g)}else{var $=p.length,v;for(w=0;w<$;w++)switch(p[w].once&&this.removeListener(u,p[w].fn,void 0,!0),x){case 1:p[w].fn.call(p[w].context);break;case 2:p[w].fn.call(p[w].context,f);break;case 3:p[w].fn.call(p[w].context,f,d);break;case 4:p[w].fn.call(p[w].context,f,d,l);break;default:if(!g)for(v=1,g=new Array(x-1);v<x;v++)g[v-1]=arguments[v];p[w].fn.apply(p[w].context,g)}}return!0},a.prototype.on=function(u,f,d){return i(this,u,f,d,!1)},a.prototype.once=function(u,f,d){return i(this,u,f,d,!0)},a.prototype.removeListener=function(u,f,d,l){var h=n?n+u:u;if(!this._events[h])return this;if(!f)return o(this,h),this;var y=this._events[h];if(y.fn)y.fn===f&&(!l||y.once)&&(!d||y.context===d)&&o(this,h);else{for(var m=0,p=[],x=y.length;m<x;m++)(y[m].fn!==f||l&&!y[m].once||d&&y[m].context!==d)&&p.push(y[m]);p.length?this._events[h]=p.length===1?p[0]:p:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var f;return u?(f=n?n+u:u,this._events[f]&&o(this,f)):(this._events=new r,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=n,a.EventEmitter=a,e.exports=a})(pt)),pt.exports}function gn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function si(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qe(e,...t){if(!si(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 He(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 tr(e,t){qe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ii(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function yt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}const bn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function oi(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function wn(e){for(let t=0;t<e.length;t++)e[t]=oi(e[t])}const ai=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",ci=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function yl(e){if(qe(e),ai)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=ci[e[n]];return t}function ui(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Wt(e){return typeof e=="string"&&(e=ui(e)),qe(e),e}let nr=class{clone(){return this._cloneInto()}};function rr(e){const t=r=>e().update(Wt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function fi(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function di(e,t,n){return e&t^~e&n}function li(e,t,n){return e&t^e&n^t&n}let hi=class extends nr{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=yt(this.buffer)}update(t){He(this);const{view:n,buffer:r,blockLen:s}=this;t=Wt(t);const i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=yt(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){He(this),tr(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;fi(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=yt(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,f[d],i)}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:s,finished:i,destroyed:o,pos:a}=this;return t.length=s,t.pos=a,t.finished=i,t.destroyed=o,s%n&&t.buffer.set(r),t}};const pi=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]),q=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),J=new Uint32Array(64);let yi=class extends hi{constructor(t=32){super(64,t,8,!1),this.A=q[0]|0,this.B=q[1]|0,this.C=q[2]|0,this.D=q[3]|0,this.E=q[4]|0,this.F=q[5]|0,this.G=q[6]|0,this.H=q[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)J[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=J[d-15],h=J[d-2],y=C(l,7)^C(l,18)^l>>>3,m=C(h,17)^C(h,19)^h>>>10;J[d]=m+J[d-7]+y+J[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:u,H:f}=this;for(let d=0;d<64;d++){const l=C(a,6)^C(a,11)^C(a,25),h=f+l+di(a,c,u)+pi[d]+J[d]|0,m=(C(r,2)^C(r,13)^C(r,22))+li(r,s,i)|0;f=u,u=c,c=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,s,i,o,a,c,u,f)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const mi=rr(()=>new yi);var gi=ri();const wl=Xs(gi),bi="1.0.8";let O=class Bt extends Error{constructor(t,n={}){var o;const r=n.cause instanceof Bt?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof Bt&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...s?[`Docs: https://abitype.dev${s}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${bi}`].join(`
|
|
2
2
|
`);super(i),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=s,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Y(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const sr=/^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)?$/,or=/^\(.+?\).*?$/,xn=/^tuple(?<array>(\[(\d*)\])*)$/;function Ot(e){let t=e.type;if(xn.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const i=e.components[s];t+=Ot(i),s<n-1&&(t+=", ")}const r=Y(xn,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Ot({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Ee(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=Ot(s),r!==n-1&&(t+=", ")}return t}function wi(e){var t;return e.type==="function"?`function ${e.name}(${Ee(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Ee(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Ee(e.inputs)})`:e.type==="error"?`error ${e.name}(${Ee(e.inputs)})`:e.type==="constructor"?`constructor(${Ee(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function xi(e){const t=[],n=e.length;for(let r=0;r<n;r++){const s=e[r],i=wi(s);t.push(i)}return t}const ar=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function $i(e){return ar.test(e)}function Ai(e){return Y(ar,e)}const cr=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ei(e){return cr.test(e)}function vi(e){return Y(cr,e)}const ur=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Pi(e){return ur.test(e)}function Ii(e){return Y(ur,e)}const fr=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Vt(e){return fr.test(e)}function Ti(e){return Y(fr,e)}const dr=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function _i(e){return dr.test(e)}function Si(e){return Y(dr,e)}const lr=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Bi(e){return lr.test(e)}function Oi(e){return Y(lr,e)}const Li=/^receive\(\) external payable$/;function Mi(e){return Li.test(e)}const Ui=new Set(["indexed"]),Lt=new Set(["calldata","memory","storage"]);class zi extends O{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 Ci extends O{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 ki extends O{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 Fi extends O{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Ni extends O{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 Di extends O{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 ji extends O{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 Ri extends O{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 we extends O{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Gi extends O{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Hi extends O{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 Wi extends O{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 Vi extends O{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 Ki(e,t,n){let r="";if(n)for(const s of Object.entries(n)){if(!s)continue;let i="";for(const o of s[1])i+=`[${o.type}${o.name?`:${o.name}`:""}]`;r+=`(${s[0]}{${i}})`}return t?`${t}:${e}${r}`:e}const mt=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 Mt(e,t={}){if(Pi(e))return Zi(e,t);if(Ei(e))return Xi(e,t);if($i(e))return Yi(e,t);if(_i(e))return qi(e,t);if(Bi(e))return Ji(e);if(Mi(e))return{type:"receive",stateMutability:"payable"};throw new Gi({signature:e})}function Zi(e,t={}){const n=Ii(e);if(!n)throw new we({signature:e,type:"function"});const r=M(n.parameters),s=[],i=r.length;for(let a=0;a<i;a++)s.push(fe(r[a],{modifiers:Lt,structs:t,type:"function"}));const o=[];if(n.returns){const a=M(n.returns),c=a.length;for(let u=0;u<c;u++)o.push(fe(a[u],{modifiers:Lt,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function Xi(e,t={}){const n=vi(e);if(!n)throw new we({signature:e,type:"event"});const r=M(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(fe(r[o],{modifiers:Ui,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function Yi(e,t={}){const n=Ai(e);if(!n)throw new we({signature:e,type:"error"});const r=M(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(fe(r[o],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:s}}function qi(e,t={}){const n=Si(e);if(!n)throw new we({signature:e,type:"constructor"});const r=M(n.parameters),s=[],i=r.length;for(let o=0;o<i;o++)s.push(fe(r[o],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:s}}function Ji(e){const t=Oi(e);if(!t)throw new we({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const Qi=/^(?<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$_]*))?$/,eo=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,to=/^u?int$/;function fe(e,t){var d,l;const n=Ki(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(mt.has(n))return mt.get(n);const r=or.test(e),s=Y(r?eo:Qi,e);if(!s)throw new Fi({param:e});if(s.name&&ro(s.name))throw new Ni({param:e,name:s.name});const i=s.name?{name:s.name}:{},o=s.modifier==="indexed"?{indexed:!0}:{},a=(t==null?void 0:t.structs)??{};let c,u={};if(r){c="tuple";const h=M(s.type),y=[],m=h.length;for(let p=0;p<m;p++)y.push(fe(h[p],{structs:a}));u={components:y}}else if(s.type in a)c="tuple",u={components:a[s.type]};else if(to.test(s.type))c=`${s.type}256`;else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!hr(c))throw new ki({type:c});if(s.modifier){if(!((l=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&l.call(d,s.modifier)))throw new Di({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(Lt.has(s.modifier)&&!so(c,!!s.array))throw new ji({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const f={type:`${c}${s.array??""}`,...i,...o,...u};return mt.set(n,f),f}function M(e,t=[],n="",r=0){const s=e.trim().length;for(let i=0;i<s;i++){const o=e[i],a=e.slice(i+1);switch(o){case",":return r===0?M(a,[...t,n.trim()]):M(a,t,`${n}${o}`,r);case"(":return M(a,t,`${n}${o}`,r+1);case")":return M(a,t,`${n}${o}`,r-1);default:return M(a,t,`${n}${o}`,r)}}if(n==="")return t;if(r!==0)throw new Vi({current:n,depth:r});return t.push(n.trim()),t}function hr(e){return e==="address"||e==="bool"||e==="function"||e==="string"||sr.test(e)||ir.test(e)}const no=/^(?: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 ro(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||sr.test(e)||ir.test(e)||no.test(e)}function so(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function pr(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!Vt(a))continue;const c=Ti(a);if(!c)throw new we({signature:a,type:"struct"});const u=c.properties.split(";"),f=[],d=u.length;for(let l=0;l<d;l++){const y=u[l].trim();if(!y)continue;const m=fe(y,{type:"struct"});f.push(m)}if(!f.length)throw new Hi({signature:a});t[c.name]=f}const r={},s=Object.entries(t),i=s.length;for(let o=0;o<i;o++){const[a,c]=s[o];r[a]=yr(c,t)}return r}const io=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function yr(e,t,n=new Set){const r=[],s=e.length;for(let i=0;i<s;i++){const o=e[i];if(or.test(o.type))r.push(o);else{const c=Y(io,o.type);if(!(c!=null&&c.type))throw new Ri({abiParameter:o});const{array:u,type:f}=c;if(f in t){if(n.has(f))throw new Wi({type:f});r.push({...o,type:`tuple${u??""}`,components:yr(t[f]??[],t,new Set([...n,f]))})}else if(hr(f))r.push(o);else throw new Ci({type:f})}}return r}function oo(e){const t=pr(e),n=[],r=e.length;for(let s=0;s<r;s++){const i=e[s];Vt(i)||n.push(Mt(i,t))}return n}function Je(e){let t;if(typeof e=="string")t=Mt(e);else{const n=pr(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(!Vt(i)){t=Mt(i,n);break}}}if(!t)throw new zi({signature:e});return t}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ao(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function mr(e,t){return Array.isArray(t)?t.length===0?!0:e?t.every(n=>typeof n=="string"):t.every(n=>Number.isSafeInteger(n)):!1}function We(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Kt(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Ut(e){if(!Array.isArray(e))throw new Error("array expected")}function Ve(e,t){if(!mr(!0,t))throw new Error(`${e}: array of strings expected`)}function co(e,t){if(!mr(!1,t))throw new Error(`${e}: array of numbers expected`)}function uo(...e){const t=i=>i,n=(i,o)=>a=>i(o(a)),r=e.map(i=>i.encode).reduceRight(n,t),s=e.map(i=>i.decode).reduce(n,t);return{encode:r,decode:s}}function fo(e){const t=typeof e=="string"?e.split(""):e,n=t.length;Ve("alphabet",t);const r=new Map(t.map((s,i)=>[s,i]));return{encode:s=>(Ut(s),s.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${e}`);return t[i]})),decode:s=>(Ut(s),s.map(i=>{We("alphabet.decode",i);const o=r.get(i);if(o===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return o}))}}function lo(e=""){return We("join",e),{encode:t=>(Ve("join.decode",t),t.join(e)),decode:t=>(We("join.decode",t),t.split(e))}}function ho(e,t="="){return Kt(e),We("padding",t),{encode(n){for(Ve("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){Ve("padding.decode",n);let r=n.length;if(r*e%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===t;r--)if((r-1)*e%8===0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}const gr=(e,t)=>t===0?e:gr(t,e%t),Ke=(e,t)=>e+(t-gr(e,t)),gt=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function $n(e,t,n,r){if(Ut(e),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(Ke(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Ke(t,n)}`);let s=0,i=0;const o=gt[t],a=gt[n]-1,c=[];for(const u of e){if(Kt(u),u>=o)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(s=s<<t|u,i+t>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${t}`);for(i+=t;i>=n;i-=n)c.push((s>>i-n&a)>>>0);const f=gt[i];if(f===void 0)throw new Error("invalid carry");s&=f-1}if(s=s<<n-i&a,!r&&i>=t)throw new Error("Excess padding");if(!r&&s>0)throw new Error(`Non-zero padding: ${s}`);return r&&i>0&&c.push(s>>>0),c}function po(e,t=!1){if(Kt(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Ke(8,e)>32||Ke(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!ao(n))throw new Error("radix2.encode input should be Uint8Array");return $n(Array.from(n),8,e,!t)},decode:n=>(co("radix2.decode",n),Uint8Array.from($n(n,e,8,t)))}}const xl=uo(po(5),fo("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ho(5),lo("")),br="rpc.thirdweb.com",yo="social.thirdweb.com",mo="embedded-wallet.thirdweb.com",go="pay.thirdweb.com",bo="storage.thirdweb.com",wo="bundler.thirdweb.com",xo="c.thirdweb.com",$o="insight.thirdweb.com",Ao="engine.thirdweb.com",Eo="bridge.thirdweb.com";let wr={analytics:xo,bridge:Eo,bundler:wo,engineCloud:Ao,inAppWallet:mo,insight:$o,pay:go,rpc:br,social:yo,storage:bo};const xe=()=>wr,vo=e=>{const t=wr[e];return t.startsWith("localhost")?`http://${t}`:`https://${t}`},Po="5.117.2";let Qe=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 An=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Io(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?"mobile":typeof navigator<"u"?"browser":"node"}function To(e){for(let t=0,n=An.length;t<n;t++){const[r,s]=An[t];if(s.exec(e))return r}return null}function zt(e){return e.split(".").length===3}var _o={};const So=typeof ni<"u"&&_o&&!1,Bo=6e4;function ze(e,t){async function n(r,s){const{requestTimeoutMs:i=Bo,useAuthToken:o,...a}=s||{};let c=a.headers?new Headers(a.headers):typeof r=="object"?r.headers:void 0;const u=typeof r=="string"?r:r.url;if(xr(u)){c||(c=new Headers);const l=o&&e.secretKey&&zt(e.secretKey)?e.secretKey:void 0,h=e.secretKey&&!zt(e.secretKey)?e.secretKey:void 0,y=e.clientId;l&&Uo(u)?(c.set("authorization",`Bearer ${l}`),e.teamId&&c.set("x-team-id",e.teamId),y&&c.set("x-client-id",y)):l&&!Lo(u)&&!Mo(u)?(c.set("authorization",`Bearer ${l}`),e.teamId&&c.set("x-team-id",e.teamId)):(h&&c.set("x-secret-key",h),y&&c.set("x-client-id",y)),t&&(c.set("x-ecosystem-id",t.id),t.partnerId&&c.set("x-ecosystem-partner-id",t.partnerId));for(const[m,p]of Co())c.set(m,p)}let f,d;return i&&(f=new AbortController,d=setTimeout(()=>{f==null||f.abort("timeout")},i)),fetch(r,{...a,headers:c,signal:f==null?void 0:f.signal}).finally(()=>{d&&clearTimeout(d)})}return n}const Oo=[".thirdweb.com",".ipfscdn.io",".thirdweb.dev",".thirdweb-dev.com",".thirdwebstorage-dev.com"],ke=new Qe(4096);function xr(e){if(ke.has(e))return ke.get(e);try{const{hostname:t}=new URL(e),n=Oo.some(r=>t.endsWith(r));return ke.set(e,n),n}catch{return ke.set(e,!1),!1}}function Lo(e){try{const{hostname:t}=new URL(e);return t.startsWith("pay.")}catch{return!1}}function Mo(e){try{const{hostname:t}=new URL(e);return t.startsWith("in-app-wallet.")||t.startsWith("embedded-wallet.")}catch{return!1}}function Uo(e){try{const{hostname:t}=new URL(e);return t.endsWith(".bundler.thirdweb.com")||t.endsWith(".bundler.thirdweb-dev.com")}catch{return!1}}const zo="unified-sdk";let Fe;function Co(){if(Fe)return Fe;let e=null;typeof navigator<"u"&&(e=To(navigator.userAgent));let t;return typeof globalThis<"u"&&"Application"in globalThis&&(t=globalThis.Application.applicationId),Fe=Object.entries({"x-sdk-name":zo,"x-sdk-os":e?ko(e):"unknown","x-sdk-platform":Io(),"x-sdk-version":Po,...t?{"x-bundle-id":t}:{}}),Fe}function ko(e){const t=e.toLowerCase();if(t.startsWith("win"))return"win";switch(e){case"Mac OS":return"mac";case"iOS":return"ios";case"Android OS":return"android";default:return t.replace(/\s/gi,"_")}}const Fo=new Map,No=new Map;function Do(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:o=>i.set(s,o)}),n=t(e,Fo),r=t(e,No);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function et(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=Do(t),s=r.response.get();if(s&&n>0&&Date.now()-s.created.getTime()<n)return s.data;let i=r.promise.get();i||(i=e(),r.promise.set(i));try{const o=await i;return r.response.set({created:new Date,data:o}),o}finally{r.promise.clear()}}const Se=new Map;function jo(e){const t=xe().rpc;if(typeof e=="number")return{id:e,rpc:`https://${e}.${t}`};if(Wo(e))return Ar(e);if(Ho(e))return $r(e);let n=e.rpc;n||(n=`https://${e.id}.${t}`);const r={...e,rpc:n};return Se.set(e.id,r),r}function Ro(e){if(Se.has(e))return Se.get(e);const t=xe().rpc;return{id:e,rpc:`https://${e}.${t}`}}function Go(e){return Se.get(e)}function Ho(e){return"rpc"in e&&Array.isArray(e.rpc)&&"slug"in e}function $r(e){var n;const t=xe().rpc;return{blockExplorers:(n=e==null?void 0:e.explorers)==null?void 0:n.map(r=>({apiUrl:r.url,name:r.name,url:r.url})),faucets:e.faucets?[...e.faucets]:void 0,icon:e.icon,id:e.chainId,name:e.name,nativeCurrency:{decimals:e.nativeCurrency.decimals,name:e.nativeCurrency.name,symbol:e.nativeCurrency.symbol},rpc:e.rpc[0]??`https://${e.chainId}.${t}`,testnet:e.testnet?!0:void 0}}function Wo(e){return"rpcUrls"in e&&!("rpc"in e)}function Ar(e){const t=xe().rpc;return{blockExplorers:e!=null&&e.blockExplorers?Object.values(e==null?void 0:e.blockExplorers).map(n=>({apiUrl:n.apiUrl,name:n.name,url:n.url})):[],id:e.id,name:e.name,nativeCurrency:{decimals:e.nativeCurrency.decimals,name:e.nativeCurrency.name,symbol:e.nativeCurrency.symbol},rpc:e.rpcUrls.default.http[0]??`https://${e.id}.${t}`,testnet:e.testnet?!0:void 0}}function Er(e){const t=xe().rpc;if(typeof e.chain=="number")return`https://${e.chain}.${t}/${e.client.clientId}`;const{rpc:n}=e.chain;if(xr(n)){const r=new URL(e.chain.rpc.replace(br,t));return(r.pathname==="/"||r.pathname.startsWith("/$"))&&(r.pathname=`/${e.client.clientId}`),r.toString()}return n}function Vo(e){const t=e.id;return et(async()=>{try{const n=await fetch(`https://api.thirdweb.com/v1/chains/${t}`);if(!n.ok)throw new Error(`Failed to fetch chain data for chainId ${t}. ${n.status} ${n.statusText}`);const r=await n.json();if(r.error)throw new Error(`Failed to fetch chain data for chainId ${t}`);if(!r.data)throw new Error(`Failed to fetch chain data for chainId ${t}`);const s=r.data;return En(e,s)}catch{return En(e)}},{cacheKey:`chain:${t}`,cacheTime:300*1e3})}function En(e,t){var r;const n=e.nativeCurrency?{...t==null?void 0:t.nativeCurrency,...e.nativeCurrency}:t==null?void 0:t.nativeCurrency;return{...t,chain:(t==null?void 0:t.chain)||e.name||"",chainId:e.id||(t==null?void 0:t.chainId)||-1,explorers:((r=e.blockExplorers)==null?void 0:r.map(s=>({name:s.name,standard:"EIP3091",url:s.url})))||(t==null?void 0:t.explorers),icon:e.icon||(t==null?void 0:t.icon),name:e.name||(t==null?void 0:t.name)||"",nativeCurrency:{decimals:(n==null?void 0:n.decimals)||18,name:(n==null?void 0:n.name)||"",symbol:(n==null?void 0:n.symbol)||""},rpc:e.rpc?[e.rpc]:(t==null?void 0:t.rpc)||[""],shortName:(t==null?void 0:t.shortName)||e.name||"",slug:(t==null?void 0:t.slug)||e.name||"",stackType:(t==null?void 0:t.stackType)||"",testnet:e.testnet||(t==null?void 0:t.testnet)||!1}}const Ko=Object.freeze(Object.defineProperty({__proto__:null,CUSTOM_CHAIN_MAP:Se,convertLegacyChain:$r,convertViemChain:Ar,defineChain:jo,getCachedChain:Ro,getCachedChainIfExists:Go,getChainMetadata:Vo,getRpcUrlForChain:Er},Symbol.toStringTag,{value:"Module"}));function Z(e,t,n){return JSON.stringify(e,(s,i)=>typeof i=="bigint"?i.toString():i,n)}const Zo="0.1.1";function Xo(){return Zo}let A=class Ct extends Error{constructor(t,n={}){const r=(()=>{var c;if(n.cause instanceof Ct){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:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof Ct&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`,a=[t||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`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@${Xo()}`}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=t}walk(t){return vr(this,t)}};function vr(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?vr(e.cause,t):t?null:e}const Yo="#__bigint";function Pr(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+Yo:s,n)}function Zt(e,t){if(Tn(e)>t)throw new ga({givenSize:Tn(e),maxSize:t})}const G={zero:48,nine:57,A:65,F:70,a:97,f:102};function vn(e){if(e>=G.zero&&e<=G.nine)return e-G.zero;if(e>=G.A&&e<=G.F)return e-(G.A-10);if(e>=G.a&&e<=G.f)return e-(G.a-10)}function Ir(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ba({size:e.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o=n==="right";s[o?i:r-i-1]=e[o?i:e.length-i-1]}return s}function qo(e,t={}){const{dir:n="left"}=t;let r=e,s=0;for(let i=0;i<r.length-1&&r[n==="left"?i:r.length-i-1].toString()==="0";i++)s++;return r=n==="left"?r.slice(s):r.slice(0,r.length-s),r}function tt(e,t){if(B(e)>t)throw new aa({givenSize:B(e),maxSize:t})}function Jo(e,t){if(typeof t=="number"&&t>0&&t>B(e)-1)throw new Or({offset:t,position:"start",size:B(e)})}function Qo(e,t,n){if(typeof t=="number"&&typeof n=="number"&&B(e)!==n-t)throw new Or({offset:n,position:"end",size:B(e)})}function Tr(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;const s=e.replace("0x","");if(s.length>r*2)throw new ca({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const ea=new TextEncoder,ta=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function na(e,t={}){const{strict:n=!1}=t;if(!e)throw new Pn(e);if(typeof e!="string")throw new Pn(e);if(n&&!/^0x[0-9a-fA-F]*$/.test(e))throw new In(e);if(!e.startsWith("0x"))throw new In(e)}function S(...e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Xt(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(tt(n,t.size),se(n,t.size)):n}function Yt(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=ta[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(tt(r,t.size),ie(r,t.size)):r}function U(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const u=typeof e=="bigint"?"n":"";throw new Br({max:i?`${i}${u}`:void 0,min:`${o}${u}`,signed:n,size:r,value:`${e}${u}`})}const c=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?se(c,r):c}function nt(e,t={}){return Yt(ea.encode(e),t)}function se(e,t){return Tr(e,{dir:"left",size:t})}function ie(e,t){return Tr(e,{dir:"right",size:t})}function _r(e,t,n,r={}){const{strict:s}=r;Jo(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Qo(i,t,n),i}function B(e){return Math.ceil((e.length-2)/2)}function Sr(e,t={}){const{signed:n}=t;t.size&&tt(e,t.size);const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n)-1n,o=i>>1n;return r<=o?r:r-i-1n}function ra(e,t={}){return $e(e,t)}function sa(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:Sr(e,t))}function ia(e,t={}){const{size:n}=t;let r=$e(e);return n&&(Zt(r,n),r=ma(r)),new TextDecoder().decode(r)}function oa(e,t={}){const{strict:n=!1}=t;try{return na(e,{strict:n}),!0}catch{return!1}}let Br=class extends A{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${s*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"})}};class Pn extends A{constructor(t){super(`Value \`${typeof t=="object"?Pr(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"})}}class In extends A{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"})}}let aa=class extends A{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"})}},Or=class extends A{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"})}},ca=class extends A{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 ua=new TextEncoder;function Lr(...e){let t=0;for(const r of e)t+=r.length;const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const i=e[r];n.set(i,s),s+=i.length}return n}function fa(e){return e instanceof Uint8Array?e:typeof e=="string"?$e(e):da(e)}function da(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function la(e,t={}){const{size:n}=t,r=new Uint8Array(1);return r[0]=Number(e),typeof n=="number"?(Zt(r,n),pa(r,n)):r}function $e(e,t={}){const{size:n}=t;let r=e;n&&(tt(e,n),r=ie(e,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const u=vn(s.charCodeAt(c++)),f=vn(s.charCodeAt(c++));if(u===void 0||f===void 0)throw new A(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=u*16+f}return o}function ha(e,t){const n=U(e,t);return $e(n)}function qt(e,t={}){const{size:n}=t,r=ua.encode(e);return typeof n=="number"?(Zt(r,n),ya(r,n)):r}function pa(e,t){return Ir(e,{dir:"left",size:t})}function ya(e,t){return Ir(e,{dir:"right",size:t})}function Tn(e){return e.length}function ma(e){return qo(e,{dir:"right"})}let ga=class extends A{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"})}},ba=class extends A{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 de(e,t={}){return oa(e,t)}function wa(e,t={}){switch(typeof e){case"number":case"bigint":return Aa(e,t);case"boolean":return xa(e,t);default:return de(e)?$a(e,t):Be(e,t)}}function xa(e,t={}){return la(e,t)}function $a(e,t={}){return $e(e,t)}function Aa(e,t){return ha(e,t)}function Be(e,t={}){return qt(e,t)}const Ne=BigInt(2**32-1),_n=BigInt(32);function Ea(e,t=!1){return t?{h:Number(e&Ne),l:Number(e>>_n&Ne)}:{h:Number(e>>_n&Ne)|0,l:Number(e&Ne)|0}}function va(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let s=0;s<e.length;s++){const{h:i,l:o}=Ea(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const Pa=(e,t,n)=>e<<n|t>>>32-n,Ia=(e,t,n)=>t<<n|e>>>32-n,Ta=(e,t,n)=>t<<n-32|e>>>64-n,_a=(e,t,n)=>e<<n-32|t>>>64-n,Mr=[],Ur=[],zr=[],Sa=BigInt(0),ve=BigInt(1),Ba=BigInt(2),Oa=BigInt(7),La=BigInt(256),Ma=BigInt(113);for(let e=0,t=ve,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Mr.push(2*(5*r+n)),Ur.push((e+1)*(e+2)/2%64);let s=Sa;for(let i=0;i<7;i++)t=(t<<ve^(t>>Oa)*Ma)%La,t&Ba&&(s^=ve<<(ve<<BigInt(i))-ve);zr.push(s)}const[Ua,za]=va(zr,!0),Sn=(e,t,n)=>n>32?Ta(e,t,n):Pa(e,t,n),Bn=(e,t,n)=>n>32?_a(e,t,n):Ia(e,t,n);function Ca(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],f=n[c+1],d=Sn(u,f,1)^n[a],l=Bn(u,f,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=l}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=Ur[o],c=Sn(s,i,a),u=Bn(s,i,a),f=Mr[o];s=e[f],i=e[f+1],e[f]=c,e[f+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]^=Ua[r],e[1]^=za[r]}n.fill(0)}let ka=class Cr extends nr{constructor(t,n,r,s=!1,i=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=s,this.rounds=i,gn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ii(this.state)}keccak(){bn||wn(this.state32),Ca(this.state32,this.rounds),bn||wn(this.state32),this.posOut=0,this.pos=0}update(t){He(this);const{blockLen:n,state:r}=this;t=Wt(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){He(this,!1),qe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=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 gn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(tr(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:s,rounds:i,enableXOF:o}=this;return t||(t=new Cr(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Fa=(e,t,n)=>rr(()=>new ka(t,e,n)),kr=Fa(1,136,256/8);function ue(e,t={}){const{dir:n,size:r=32}=t;return r===null?e:n==="right"?ie(e,r):se(e,r)}function _l(e,t={}){return ia(e,t)}function rt(e,t={}){return Sr(e,t)}function Na(e,t={}){return sa(e,t)}function Fr(e,t={}){return ra(e,t)}function Nr(e,t={}){return Xt(e,t)}function st(e,t={}){return Yt(e,t)}function z(e,t={}){return U(e,t)}function it(e,t={}){return nt(e,t)}function Dr(e,t={}){switch(typeof e){case"number":case"bigint":return z(e,t);case"string":return it(e,t);case"boolean":return Nr(e,t);default:return st(e,t)}}function V(e,t){const n=kr(de(e,{strict:!1})?Fr(e):e);return t==="bytes"?n:st(n)}const Da=/^0x[a-fA-F0-9]{40}$/,bt=new Qe(4096);function Jt(e){if(bt.has(e))return bt.get(e);const t=Da.test(e)&&(e.toLowerCase()===e||jr(e)===e);return bt.set(e,t),t}function jr(e){const t=e.substring(2).toLowerCase(),n=V(Be(t),"bytes"),r=t.split("");for(let s=0;s<40;s+=2)n[s>>1]>>4>=8&&e[s]&&(r[s]=r[s].toUpperCase()),(n[s>>1]&15)>=8&&e[s+1]&&(r[s+1]=r[s+1].toUpperCase());return`0x${r.join("")}`}function D(e){if(!Jt(e))throw new Error(`Invalid address: ${e}`);return jr(e)}function ja(e,t){const n=mi(de(e,{strict:!1})?Fr(e):e);return st(n)}const wt=new Qe(4096);function Ra(e){if(wt.has(e))return wt.get(e);const t=ja(Be(e)).slice(2,34);return wt.set(e,t),t}function Sl(e){const{clientId:t,secretKey:n,...r}=e;let s=t;if(n)if(zt(n)){if(!t)throw new Error("clientId must be provided when using a JWT secretKey")}else s=t??Ra(n);if(!s)throw new Error("clientId or secretKey must be provided");return{...r,clientId:s,secretKey:n}}const Bl="0x0000000000000000000000000000000000000000";function Ga(e){if(!e.client)throw new Error(`getContract validation error - invalid client: ${e.client}`);if(!Jt(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 Ha(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const On=/^tuple(?<array>(\[(\d*)\])*)$/;function kt(e){let t=e.type;if(On.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let s=0;s<n;s++){const i=e.components[s];t+=kt(i),s<n-1&&(t+=", ")}const r=Ha(On,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,kt({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Pe(e){let t="";const n=e.length;for(let r=0;r<n;r++){const s=e[r];t+=kt(s),r!==n-1&&(t+=", ")}return t}function Wa(e){var t;return e.type==="function"?`function ${e.name}(${Pe(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Pe(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Pe(e.inputs)})`:e.type==="error"?`error ${e.name}(${Pe(e.inputs)})`:e.type==="constructor"?`constructor(${Pe(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}function me(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new nc(e.type);return`${e.name}(${ot(e.inputs,{includeName:t})})`}function ot(e,{includeName:t=!1}={}){return e?e.map(n=>Va(n,{includeName:t})).join(t?", ":","):""}function Va(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ot(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function Ae(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function T(e){return Ae(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Rr="2.39.0";let Ie={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Rr}`};class b extends Error{constructor(t,n={}){var a;const r=(()=>{var c;return n.cause instanceof b?n.cause.details:(c=n.cause)!=null&&c.message?n.cause.message:n.details})(),s=n.cause instanceof b&&n.cause.docsPath||n.docsPath,i=(a=Ie.getDocsUrl)==null?void 0:a.call(Ie,{...n,docsPath:s}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...Ie.version?[`Version: ${Ie.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=s,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Rr}walk(t){return Gr(this,t)}}function Gr(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Gr(e.cause,t):t?null:e}class Hr extends b{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
@@ -15,6 +15,6 @@ var hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"
|
|
|
15
15
|
`),{name:"InvalidArrayError"})}};class nc extends b{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
16
16
|
`),{name:"InvalidDefinitionTypeError"})}}class rc extends b{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}class Zr extends b{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 Xr extends b{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function le(e,{dir:t,size:n=32}={}){return typeof e=="string"?ne(e,{dir:t,size:n}):sc(e,{dir:t,size:n})}function ne(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Xr({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function sc(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Xr({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let s=0;s<n;s++){const i=t==="right";r[i?s:n-s-1]=e[i?s:e.length-s-1]}return r}class Yr extends b{constructor({max:t,min:n,signed:r,size:s,value:i}){super(`Number "${i}" is not in safe ${s?`${s*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ic extends b{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 oc extends b{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Qt(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let s=0;s<n.length-1&&n[t==="left"?s:n.length-s-1].toString()==="0";s++)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 R(e,{size:t}){if(T(e)>t)throw new oc({givenSize:T(e),maxSize:t})}function qr(e,t={}){const{signed:n}=t;t.size&&R(e,{size:t.size});const r=BigInt(e);if(!n)return r;const s=(e.length-2)/2,i=(1n<<BigInt(s)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(s*2,"f")}`)-1n}function Ze(e,t={}){return Number(qr(e,t))}const ac=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jr(e,t={}){return typeof e=="number"||typeof e=="bigint"?P(e,t):typeof e=="string"?es(e,t):typeof e=="boolean"?Qr(e,t):j(e,t)}function Qr(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(R(n,{size:t.size}),le(n,{size:t.size})):n}function j(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=ac[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(R(r,{size:t.size}),le(r,{dir:"right",size:t.size})):r}function P(e,t={}){const{signed:n,size:r}=t,s=BigInt(e);let i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&s>i||s<o){const c=typeof e=="bigint"?"n":"";throw new Yr({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:r,value:`${e}${c}`})}const a=`0x${(n&&s<0?(1n<<BigInt(r*8))+BigInt(s):s).toString(16)}`;return r?le(a,{size:r}):a}const cc=new TextEncoder;function es(e,t={}){const n=cc.encode(e);return j(n,t)}const uc=new TextEncoder;function re(e,t={}){return typeof e=="number"||typeof e=="bigint"?dc(e,t):typeof e=="boolean"?fc(e,t):Ae(e)?at(e,t):ts(e,t)}function fc(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(R(n,{size:t.size}),le(n,{size:t.size})):n}const H={zero:48,nine:57,A:65,F:70,a:97,f:102};function Mn(e){if(e>=H.zero&&e<=H.nine)return e-H.zero;if(e>=H.A&&e<=H.F)return e-(H.A-10);if(e>=H.a&&e<=H.f)return e-(H.a-10)}function at(e,t={}){let n=e;t.size&&(R(n,{size:t.size}),n=le(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const s=r.length/2,i=new Uint8Array(s);for(let o=0,a=0;o<s;o++){const c=Mn(r.charCodeAt(a++)),u=Mn(r.charCodeAt(a++));if(c===void 0||u===void 0)throw new b(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[o]=c*16+u}return i}function dc(e,t){const n=P(e,t);return at(n)}function ts(e,t={}){const n=uc.encode(e);return typeof t.size=="number"?(R(n,{size:t.size}),le(n,{dir:"right",size:t.size})):n}const De=BigInt(2**32-1),Un=BigInt(32);function lc(e,t=!1){return t?{h:Number(e&De),l:Number(e>>Un&De)}:{h:Number(e>>Un&De)|0,l:Number(e&De)|0}}function hc(e,t=!1){const n=e.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:o,l:a}=lc(e[i],t);[r[i],s[i]]=[o,a]}return[r,s]}const pc=(e,t,n)=>e<<n|t>>>32-n,yc=(e,t,n)=>t<<n|e>>>32-n,mc=(e,t,n)=>t<<n-32|e>>>64-n,gc=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function bc(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function zn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Oe(e,...t){if(!bc(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 Xe(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 ns(e,t){Oe(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function wc(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Le(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function xt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function k(e,t){return e<<32-t|e>>>t}const xc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function $c(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ac(e){for(let t=0;t<e.length;t++)e[t]=$c(e[t]);return e}const Cn=xc?e=>e:Ac;function Ec(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function en(e){return typeof e=="string"&&(e=Ec(e)),Oe(e),e}class rs{}function ss(e){const t=r=>e().update(en(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const vc=BigInt(0),Te=BigInt(1),Pc=BigInt(2),Ic=BigInt(7),Tc=BigInt(256),_c=BigInt(113),is=[],os=[],as=[];for(let e=0,t=Te,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],is.push(2*(5*r+n)),os.push((e+1)*(e+2)/2%64);let s=vc;for(let i=0;i<7;i++)t=(t<<Te^(t>>Ic)*_c)%Tc,t&Pc&&(s^=Te<<(Te<<BigInt(i))-Te);as.push(s)}const cs=hc(as,!0),Sc=cs[0],Bc=cs[1],kn=(e,t,n)=>n>32?mc(e,t,n):pc(e,t,n),Fn=(e,t,n)=>n>32?gc(e,t,n):yc(e,t,n);function Oc(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],f=n[c+1],d=kn(u,f,1)^n[a],l=Fn(u,f,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=d,e[o+h+1]^=l}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=os[o],c=kn(s,i,a),u=Fn(s,i,a),f=is[o];s=e[f],i=e[f+1],e[f]=c,e[f+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]^=Sc[r],e[1]^=Bc[r]}Le(n)}class tn extends rs{constructor(t,n,r,s=!1,i=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=s,this.rounds=i,zn(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=wc(this.state)}clone(){return this._cloneInto()}keccak(){Cn(this.state32),Oc(this.state32,this.rounds),Cn(this.state32),this.posOut=0,this.pos=0}update(t){Xe(this),t=en(t),Oe(t);const{blockLen:n,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:s}=this;t[r]^=n,(n&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Xe(this,!1),Oe(t),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=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 zn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(ns(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,Le(this.state)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new tn(n,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Lc=(e,t,n)=>ss(()=>new tn(t,e,n)),Mc=Lc(1,136,256/8);function ct(e,t){const n=t||"hex",r=Mc(Ae(e,{strict:!1})?re(e):e);return n==="bytes"?r:Jr(r)}const Uc=e=>ct(re(e));function zc(e){return Uc(e)}function Cc(e){let t=!0,n="",r=0,s="",i=!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(s))s="";else if(s+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}s+=a,n+=a}}if(!i)throw new b("Unable to normalize signature.");return s}const kc=e=>{const t=typeof e=="string"?e:Wa(e);return Cc(t)};function nn(e){return zc(kc(e))}const ut=nn;let Nt=class extends b{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"})}},us=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 $t=new us(8192);function fs(e,t){if($t.has(`${e}.${t}`))return $t.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=ct(ts(n),"bytes"),s=n.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&s[o]&&(s[o]=s[o].toUpperCase()),(r[o>>1]&15)>=8&&s[o+1]&&(s[o+1]=s[o+1].toUpperCase());const i=`0x${s.join("")}`;return $t.set(`${e}.${t}`,i),i}const Fc=/^0x[a-fA-F0-9]{40}$/,At=new us(8192);function ge(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(At.has(r))return At.get(r);const s=Fc.test(e)?e.toLowerCase()===e?!0:n?fs(e)===e:!0:!1;return At.set(r,s),s}function be(e){return typeof e[0]=="string"?Dc(e):Nc(e)}function Nc(e){let t=0;for(const s of e)t+=s.length;const n=new Uint8Array(t);let r=0;for(const s of e)n.set(s,r),r+=s.length;return n}function Dc(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Ye(e,t,n,{strict:r}={}){return Ae(e,{strict:!1})?jc(e,t,n,{strict:r}):hs(e,t,n,{strict:r})}function ds(e,t){if(typeof t=="number"&&t>0&&t>T(e)-1)throw new Zr({offset:t,position:"start",size:T(e)})}function ls(e,t,n){if(typeof t=="number"&&typeof n=="number"&&T(e)!==n-t)throw new Zr({offset:n,position:"end",size:T(e)})}function hs(e,t,n,{strict:r}={}){ds(e,t);const s=e.slice(t,n);return r&&ls(s,t,n),s}function jc(e,t,n,{strict:r}={}){ds(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&ls(s,t,n),s}const Rc=/^(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 Gc(e,t){if(e.length!==t.length)throw new Xa({expectedLength:e.length,givenLength:t.length});const n=Hc({params:e,values:t}),r=sn(n);return r.length===0?"0x":r}function Hc({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(rn({param:e[r],value:t[r]}));return n}function rn({param:e,value:t}){const n=on(e.type);if(n){const[r,s]=n;return Vc(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return qc(t,{param:e});if(e.type==="address")return Wc(t);if(e.type==="bool")return Zc(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=Rc.exec(e.type)??[];return Xc(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return Kc(t,{param:e});if(e.type==="string")return Yc(t);throw new Qa(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function sn(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=T(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(P(t+s,{size:32})),r.push(a),s+=T(a)):n.push(a)}return be([...n,...r])}function Wc(e){if(!ge(e))throw new Nt({address:e});return{dynamic:!1,encoded:ne(e.toLowerCase())}}function Vc(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new tc(e);if(!r&&e.length!==t)throw new Ka({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let s=!1;const i=[];for(let o=0;o<e.length;o++){const a=rn({param:n,value:e[o]});a.dynamic&&(s=!0),i.push(a)}if(r||s){const o=sn(i);if(r){const a=P(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?be([a,o]):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:be(i.map(({encoded:o})=>o))}}function Kc(e,{param:t}){const[,n]=t.type.split("bytes"),r=T(e);if(!n){let s=e;return r%32!==0&&(s=ne(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:be([ne(P(r,{size:32})),s])}}if(r!==Number.parseInt(n,10))throw new Za({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:ne(e,{dir:"right"})}}function Zc(e){if(typeof e!="boolean")throw new b(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:ne(Qr(e))}}function Xc(e,{signed:t,size:n=256}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new Yr({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:P(e,{size:32,signed:t})}}function Yc(e){const t=es(e),n=Math.ceil(T(t)/32),r=[];for(let s=0;s<n;s++)r.push(ne(Ye(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:be([ne(P(T(t),{size:32})),...r])}}function qc(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const i=t.components[s],o=Array.isArray(e)?s:i.name,a=rn({param:i,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?sn(r):be(r.map(({encoded:s})=>s))}}function on(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const an=e=>Ye(nn(e),0,4);function Jc(e){const{abi:t,args:n=[],name:r}=e,s=Ae(r,{strict:!1}),i=t.filter(a=>s?a.type==="function"?an(a)===r:a.type==="event"?ut(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let o;for(const a of i){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,f)=>{const d="inputs"in a&&a.inputs[f];return d?Dt(u,d):!1})){if(o&&"inputs"in o&&o.inputs){const u=ps(a.inputs,o.inputs,n);if(u)throw new Ja({abiItem:a,type:u[0]},{abiItem:o,type:u[1]})}o=a}}return o||i[0]}function Dt(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ge(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((s,i)=>Dt(Object.values(e)[i],s)):/^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(s=>Dt(s,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function ps(e,t,n){for(const r in e){const s=e[r],i=t[r];if(s.type==="tuple"&&i.type==="tuple"&&"components"in s&&"components"in i)return ps(s.components,i.components,n[r]);const o=[s.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?ge(n[r],{strict:!1}):o.includes("address")&&o.includes("bytes")?ge(n[r],{strict:!1}):!1)return o}}const Nn="/docs/contract/encodeEventTopics";function Qc(e){var c;const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const u=Jc({abi:t,name:n});if(!u)throw new Ln(n,{docsPath:Nn});s=u}if(s.type!=="event")throw new Ln(void 0,{docsPath:Nn});const i=me(s),o=ut(i);let a=[];if(r&&"inputs"in s){const u=(c=s.inputs)==null?void 0:c.filter(d=>"indexed"in d&&d.indexed),f=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(d=>r[d.name]))??[]:[];f.length>0&&(a=(u==null?void 0:u.map((d,l)=>Array.isArray(f[l])?f[l].map((h,y)=>Dn({param:d,value:f[l][y]})):typeof f[l]<"u"&&f[l]!==null?Dn({param:d,value:f[l]}):null))??[])}return[o,...a]}function Dn({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return ct(re(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new rc(e.type);return Gc([e],[t])}const eu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},tu={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class jn extends b{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class ys extends b{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}}class nu extends b{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const ru={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 nu({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ys({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new jn({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 jn({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 ms(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ru);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function su(e,t={}){typeof t.size<"u"&&R(e,{size:t.size});const n=j(e,t);return qr(n,t)}function iu(e,t={}){let n=e;if(typeof t.size<"u"&&(R(n,{size:t.size}),n=Qt(n)),n.length>1||n[0]>1)throw new ic(n);return!!n[0]}function K(e,t={}){typeof t.size<"u"&&R(e,{size:t.size});const n=j(e,t);return Ze(n,t)}function ou(e,t={}){let n=e;return typeof t.size<"u"&&(R(n,{size:t.size}),n=Qt(n,{dir:"right"})),new TextDecoder().decode(n)}function ft(e,t){const n=typeof t=="string"?at(t):t,r=ms(n);if(T(n)===0&&e.length>0)throw new Wr;if(T(t)&&T(t)<32)throw new Hr({data:typeof t=="string"?t:j(t),params:e,size:T(t)});let s=0;const i=[];for(let o=0;o<e.length;++o){const a=e[o];r.setPosition(s);const[c,u]=ye(r,a,{staticPosition:0});s+=u,i.push(c)}return i}function ye(e,t,{staticPosition:n}){const r=on(t.type);if(r){const[s,i]=r;return cu(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return lu(e,t,{staticPosition:n});if(t.type==="address")return au(e);if(t.type==="bool")return uu(e);if(t.type.startsWith("bytes"))return fu(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return du(e,t);if(t.type==="string")return hu(e,{staticPosition:n});throw new ec(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const Rn=32,jt=32;function au(e){const t=e.readBytes(32);return[fs(j(hs(t,-20))),32]}function cu(e,t,{length:n,staticPosition:r}){if(!n){const o=K(e.readBytes(jt)),a=r+o,c=a+Rn;e.setPosition(a);const u=K(e.readBytes(Rn)),f=Me(t);let d=0;const l=[];for(let h=0;h<u;++h){e.setPosition(c+(f?h*32:d));const[y,m]=ye(e,t,{staticPosition:c});d+=m,l.push(y)}return e.setPosition(r+32),[l,32]}if(Me(t)){const o=K(e.readBytes(jt)),a=r+o,c=[];for(let u=0;u<n;++u){e.setPosition(a+u*32);const[f]=ye(e,t,{staticPosition:a});c.push(f)}return e.setPosition(r+32),[c,32]}let s=0;const i=[];for(let o=0;o<n;++o){const[a,c]=ye(e,t,{staticPosition:r+s});s+=c,i.push(a)}return[i,s]}function uu(e){return[iu(e.readBytes(32),{size:32}),32]}function fu(e,t,{staticPosition:n}){const[r,s]=t.type.split("bytes");if(!s){const o=K(e.readBytes(32));e.setPosition(n+o);const a=K(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];const c=e.readBytes(a);return e.setPosition(n+32),[j(c),32]}return[j(e.readBytes(Number.parseInt(s,10),32)),32]}function du(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),s=e.readBytes(32);return[r>48?su(s,{signed:n}):K(s,{signed:n}),32]}function lu(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:o})=>!o),s=r?[]:{};let i=0;if(Me(t)){const o=K(e.readBytes(jt)),a=n+o;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(a+i);const[f,d]=ye(e,u,{staticPosition:a});i+=d,s[r?c:u==null?void 0:u.name]=f}return e.setPosition(n+32),[s,32]}for(let o=0;o<t.components.length;++o){const a=t.components[o],[c,u]=ye(e,a,{staticPosition:n});s[r?o:a==null?void 0:a.name]=c,i+=u}return[s,i]}function hu(e,{staticPosition:t}){const n=K(e.readBytes(32)),r=t+n;e.setPosition(r);const s=K(e.readBytes(32));if(s===0)return e.setPosition(t+32),["",32];const i=e.readBytes(s,32),o=ou(Qt(i));return e.setPosition(t+32),[o,32]}function Me(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(Me);const n=on(e.type);return!!(n&&Me({...e,type:n[1]}))}function pu(e){const{abi:t,data:n}=e,r=Ye(n,0,4);if(r==="0x")throw new Wr;const i=[...t||[],eu,tu].find(o=>o.type==="error"&&r===an(me(o)));if(!i)throw new Ya(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?ft(i.inputs,Ye(n,4)):void 0,errorName:i.name}}const yu=(e,t,n)=>JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString():s,n);function Ul(e,t="hex"){const n=gs(e),r=ms(new Uint8Array(n.length));return n.encode(r),t==="hex"?j(r.bytes):r.bytes}function gs(e){return Array.isArray(e)?mu(e.map(t=>gs(t))):gu(e)}function mu(e){const t=e.reduce((s,i)=>s+i.length,0),n=bs(t);return{length:t<=55?1+t:1+n+t,encode(s){t<=55?s.pushByte(192+t):(s.pushByte(247+n),n===1?s.pushUint8(t):n===2?s.pushUint16(t):n===3?s.pushUint24(t):s.pushUint32(t));for(const{encode:i}of e)i(s)}}}function gu(e){const t=typeof e=="string"?at(e):e,n=bs(t.length);return{length:t.length===1&&t[0]<128?1:t.length<=55?1+t.length:1+n+t.length,encode(s){t.length===1&&t[0]<128?s.pushBytes(t):t.length<=55?(s.pushByte(128+t.length),s.pushBytes(t)):(s.pushByte(183+n),n===1?s.pushUint8(t.length):n===2?s.pushUint16(t.length):n===3?s.pushUint24(t.length):s.pushUint32(t.length),s.pushBytes(t))}}}function bs(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 b("Length is too large.")}const bu={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function wu(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=>j(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=P(e.gas)),typeof e.gasPrice<"u"&&(n.gasPrice=P(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(n.maxFeePerBlobGas=P(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(n.maxFeePerGas=P(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(n.maxPriorityFeePerGas=P(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(n.nonce=P(e.nonce)),typeof e.to<"u"&&(n.to=e.to),typeof e.type<"u"&&(n.type=bu[e.type]),typeof e.value<"u"&&(n.value=P(e.value)),n}function xu(e){return e.map(t=>({address:t.address,r:t.r?P(BigInt(t.r)):t.r,s:t.s?P(BigInt(t.s)):t.s,chainId:P(t.chainId),nonce:P(t.nonce),...typeof t.yParity<"u"?{yParity:P(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:P(t.v)}:{}}))}const $u=2n**16n-1n,ws={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function Au(e,t){const n={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ze(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?Ze(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?ws[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=Eu(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}function Eu(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 vu(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:Au(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}}function Pu(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),c=r?4:0,u=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+u,a,r)}function Iu(e,t,n){return e&t^~e&n}function Tu(e,t,n){return e&t^e&n^t&n}class _u extends rs{constructor(t,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=xt(this.buffer)}update(t){Xe(this),t=en(t),Oe(t);const{view:n,buffer:r,blockLen:s}=this,i=t.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=xt(t);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Xe(this),ns(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,Le(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let d=o;d<s;d++)n[d]=0;Pu(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=xt(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,f=this.get();if(u>f.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,f[d],i)}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:s,finished:i,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=i,t.length=s,t.pos=a,s%n&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Q=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Su=Uint32Array.from([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]),ee=new Uint32Array(64);class Bu extends _u{constructor(t=32){super(64,t,8,!1),this.A=Q[0]|0,this.B=Q[1]|0,this.C=Q[2]|0,this.D=Q[3]|0,this.E=Q[4]|0,this.F=Q[5]|0,this.G=Q[6]|0,this.H=Q[7]|0}get(){const{A:t,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[t,n,r,s,i,o,a,c]}set(t,n,r,s,i,o,a,c){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,n){for(let d=0;d<16;d++,n+=4)ee[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const l=ee[d-15],h=ee[d-2],y=k(l,7)^k(l,18)^l>>>3,m=k(h,17)^k(h,19)^h>>>10;ee[d]=m+ee[d-7]+y+ee[d-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:u,H:f}=this;for(let d=0;d<64;d++){const l=k(a,6)^k(a,11)^k(a,25),h=f+l+Iu(a,c,u)+Su[d]+ee[d]|0,m=(k(r,2)^k(r,13)^k(r,22))+Tu(r,s,i)|0;f=u,u=c,c=a,a=o+h|0,o=i,i=s,s=r,r=h+m|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(r,s,i,o,a,c,u,f)}roundClean(){Le(ee)}destroy(){this.set(0,0,0,0,0,0,0,0),Le(this.buffer)}}const Ou=ss(()=>new Bu),Lu=Ou;function Mu(e,t){const n=Lu(Ae(e,{strict:!1})?re(e):e);return Jr(n)}function Uu(e,t){if(!ge(e,{strict:!1}))throw new Nt({address:e});if(!ge(t,{strict:!1}))throw new Nt({address:t});return e.toLowerCase()===t.toLowerCase()}const Gn="/docs/contract/decodeEventLog";function zu(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[o,...a]=s;if(!o)throw new qa({docsPath:Gn});const c=t.find(m=>m.type==="event"&&o===ut(me(m)));if(!(c&&"name"in c)||c.type!=="event")throw new Vr(o,{docsPath:Gn});const{name:u,inputs:f}=c,d=f==null?void 0:f.some(m=>!("name"in m&&m.name)),l=d?[]:{},h=f.map((m,p)=>[m,p]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<h.length;m++){const[p,x]=h[m],g=a[m];if(!g)throw new Kr({abiItem:c,param:p});l[d?x:p.name||x]=Cu({param:p,value:g})}const y=f.filter(m=>!("indexed"in m&&m.indexed));if(y.length>0){if(n&&n!=="0x")try{const m=ft(y,n);if(m)if(d)for(let p=0;p<f.length;p++)l[p]=l[p]??m.shift();else for(let p=0;p<y.length;p++)l[y[p].name]=m[p]}catch(m){if(i)throw m instanceof Hr||m instanceof ys?new Ft({abiItem:c,data:n,params:y,size:T(n)}):m}else if(i)throw new Ft({abiItem:c,data:"0x",params:y,size:0})}return{eventName:u,args:Object.values(l).length>0?l:void 0}}function Cu({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(ft([e],t)||[])[0]}function ku(e){const{abi:t,args:n,logs:r,strict:s=!0}=e,i=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return r.map(o=>{var a;try{const c=t.find(f=>f.type==="event"&&o.topics[0]===ut(f));if(!c)return null;const u=zu({...o,abi:[c],strict:s});return i&&!i.includes(u.eventName)||!Fu({args:u.args,inputs:c.inputs,matchArgs:n})?null:{...u,...o}}catch(c){let u,f;if(c instanceof Vr)return null;if(c instanceof Ft||c instanceof Kr){if(s)return null;u=c.abiItem.name,f=(a=c.abiItem.inputs)==null?void 0:a.some(d=>!("name"in d&&d.name))}return{...o,args:f?[]:{},eventName:u}}}).filter(Boolean)}function Fu(e){const{args:t,inputs:n,matchArgs:r}=e;if(!r)return!0;if(!t)return!1;function s(i,o,a){try{return i.type==="address"?Uu(o,a):i.type==="string"||i.type==="bytes"?ct(re(o))===a:o===a}catch{return!1}}return Array.isArray(t)&&Array.isArray(r)?r.every((i,o)=>{if(i==null)return!0;const a=n[o];return a?(Array.isArray(i)?i:[i]).some(u=>s(a,u,t[o])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof r=="object"&&!Array.isArray(r)?Object.entries(r).every(([i,o])=>{if(o==null)return!0;const a=n.find(u=>u.name===i);return a?(Array.isArray(o)?o:[o]).some(u=>s(a,u,t[i])):!1}):!1}function Nu(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}const Du={"0x0":"reverted","0x1":"success"};function ju(e,t){const n={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(r=>Nu(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ze(e.transactionIndex):null,status:e.status?Du[e.status]:null,type:e.type?ws[e.type]||e.type:null};return e.blobGasPrice&&(n.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(n.blobGasUsed=BigInt(e.blobGasUsed)),n}function Ru(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const Et=new WeakMap;async function Ce(e){if(Et.has(e))return Et.get(e);const t=(async()=>{const[n,r,{concatHex:s}]=await Promise.all([xs(e),$s(e),_(()=>Promise.resolve().then(()=>Zd),void 0)]);return r?s([n,r]):n})();return Et.set(e,t),t}async function xs(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 $s(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 Gu=Object.freeze(Object.defineProperty({__proto__:null,encode:Ce,getDataFromTx:xs,getExtraCallDataFromTx:$s},Symbol.toStringTag,{value:"Module"}));async function Hu(e,t){const n=t.blockTag??"latest",r=t.includeTransactions??!1,s=t.blockNumber!==void 0?z(t.blockNumber):void 0,i=await e({method:"eth_getBlockByNumber",params:[s||n,r]});if(!i)throw new Error("Block not found");return vu(i)}async function Wu(e){const t=await e({method:"eth_maxPriorityFeePerGas"});return rt(t)}async function Vu(e,t,n){var s,i,o,a,c,u,f,d,l;const r=await ze(t)(e,{body:Z(n.requests),headers:{...(o=(i=(s=t.config)==null?void 0:s.rpc)==null?void 0:i.fetch)==null?void 0:o.headers,"Content-Type":"application/json"},keepalive:(u=(c=(a=t.config)==null?void 0:a.rpc)==null?void 0:c.fetch)==null?void 0:u.keepalive,method:"POST",requestTimeoutMs:n.requestTimeoutMs??((l=(d=(f=t.config)==null?void 0:f.rpc)==null?void 0:d.fetch)==null?void 0:l.requestTimeoutMs)});if(!r.ok){const h=await r.text().catch(()=>null);throw new Error(`RPC request failed with status ${r.status} - ${r.statusText}: ${h||"unknown error"}`)}return await r.json()}async function Ku(e,t,n){var s,i,o,a,c,u,f,d,l;const r=await ze(t)(e,{body:Z(n.request),headers:{...((o=(i=(s=t.config)==null?void 0:s.rpc)==null?void 0:i.fetch)==null?void 0:o.headers)||{},"Content-Type":"application/json"},keepalive:(u=(c=(a=t.config)==null?void 0:a.rpc)==null?void 0:c.fetch)==null?void 0:u.keepalive,method:"POST",requestTimeoutMs:n.requestTimeoutMs??((l=(d=(f=t.config)==null?void 0:f.rpc)==null?void 0:d.fetch)==null?void 0:l.requestTimeoutMs)});if(!r.ok){const h=await r.text().catch(()=>null);throw new Error(`RPC request failed with status ${r.status} - ${r.statusText}: ${h||"unknown error"}`)}return await r.json()}const vt=new WeakMap;function Zu(e){if(vt.has(e))return vt.get(e);const t=new Map;return vt.set(e,t),t}function Xu(e){return`${e.method}:${Z(e.params)}`}const Yu=100,qu=0;function oe(e){const t=Zu(e.client),n=e.chain.rpc;if(t.has(n))return t.get(n);const r=(()=>{var d,l,h,y,m,p;const s=Er({chain:e.chain,client:e.client}),i=((d=e.config)==null?void 0:d.maxBatchSize)??((h=(l=e.client.config)==null?void 0:l.rpc)==null?void 0:h.maxBatchSize)??Yu,o=((y=e.config)==null?void 0:y.batchTimeoutMs)??((p=(m=e.client.config)==null?void 0:m.rpc)==null?void 0:p.batchTimeoutMs)??qu,a=new Map;let c=[],u=null;function f(){var w;u&&(clearTimeout(u),u=null);const x=new Array(c.length),g=c.slice().map(($,v)=>($.request.id=v,$.request.jsonrpc="2.0",x[v]=$.request,$));c=[],Vu(s,e.client,{requests:x,requestTimeoutMs:(w=e.config)==null?void 0:w.requestTimeoutMs}).then($=>{g.forEach((v,ht)=>{const L=$[ht];L?L instanceof Error?v.reject(L):"error"in L?v.reject(L.error):typeof L=="string"?v.reject(new Error(L)):L.method==="eth_subscription"?v.reject("Subscriptions not supported yet"):v.resolve(L.result):v.reject(new Error(`RPC Error from ${s}:
|
|
17
17
|
requests: ${Z(x)}
|
|
18
|
-
responses: ${Z($)}`))})}).catch($=>{for(const v of g)v.reject($)}).finally(()=>{a.clear()})}return i===1?async x=>{var w;x.id=1,x.jsonrpc="2.0";const g=await Ku(s,e.client,{request:x,requestTimeoutMs:(w=e.config)==null?void 0:w.requestTimeoutMs});if(!g)throw new Error("No response");if("error"in g)throw g.error;return g.result}:async x=>{const g=Xu(x);if(a.has(g))return a.get(g);let w,$;const v=new Promise((ht,L)=>{w=ht,$=L});return a.set(g,v),c.push({reject:$,request:x,requestKey:g,resolve:w}),i>1?(u||(u=setTimeout(f,o)),c.length>=i&&f()):f(),v}})();return t.set(n,r),r}const Ju=Object.freeze(Object.defineProperty({__proto__:null,getRpcClient:oe},Symbol.toStringTag,{value:"Module"}));async function I(e){return typeof e=="function"?await e():e}function As(e,t){e.includes("e")&&(e=Number(e).toFixed(t));let[n,r=""]=e.split(".");const s=n.startsWith("-")?"-":"";if(s&&(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 i=r[t];i&&Number.parseInt(i,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(`${s}${n}${r}`)}function zl(e){return As(e,18)}async function Qu(e){const t=await e({method:"eth_gasPrice"});return rt(t)}async function Hn(e){const{client:t,chain:n,percentMultiplier:r}=e,s=oe({chain:n,client:t}),i=await Qu(s),o=r?i/BigInt(100)*BigInt(r):0n;return i+o}function _e(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const ef=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function Es(e){var o;const[t,n,r,s]=await Promise.all([I(e.maxFeePerGas),I(e.maxPriorityFeePerGas),I(e.gasPrice),I(e.type)]);if(t!==void 0&&n!==void 0)return{maxFeePerGas:t,maxPriorityFeePerGas:n};if(typeof r=="bigint")return{gasPrice:r};const i=await vs(e.client,e.chain,s==="legacy"?"legacy":"eip1559");return(o=e.chain.experimental)!=null&&o.increaseZeroByteCount?i.gasPrice?{gasPrice:_e(i.gasPrice)}:{maxFeePerGas:t??_e(i.maxFeePerGas??0n),maxPriorityFeePerGas:n??_e(i.maxPriorityFeePerGas??0n)}:i.gasPrice!==void 0?i:{maxFeePerGas:t??i.maxFeePerGas,maxPriorityFeePerGas:n??i.maxPriorityFeePerGas}}async function vs(e,t,n){if((n??t.feeType)==="legacy"||ef.includes(t.id))return{gasPrice:await Hn({chain:t,client:e,percentMultiplier:10})};const s=await tf(e,t);return s.maxFeePerGas!==null&&s.maxPriorityFeePerGas!==null?{maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas}:{gasPrice:await Hn({chain:t,client:e,percentMultiplier:10})}}async function tf(e,t,n=10){let r=null,s=null;const i=oe({chain:t,client:e}),[o,a]=await Promise.all([Hu(i,{blockTag:"latest"}),Wu(i).catch(()=>null)]),c=o==null?void 0:o.baseFeePerGas,u=t.id;return u===220||u===1220?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(u===80002||u===137?s=await of(u):a!==null&&(s=a),s==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(s=nf(s,n),r=c*2n+s,(u===42220||u===44787||u===62320)&&(s=r),{maxFeePerGas:r,maxPriorityFeePerGas:s}))}function nf(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function rf(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const sf=31n;async function of(e){const t=rf(e);try{const r=(await(await fetch(t)).json()).fast.maxPriorityFee;if(r>0){const s=Number.parseFloat(r).toFixed(9);return As(s,9)}}catch(n){console.error("failed to fetch gas",n)}return sf}const Cl=Object.freeze(Object.defineProperty({__proto__:null,getDefaultGasOverrides:vs,getGasOverridesForTransaction:Es},Symbol.toStringTag,{value:"Module"}));async function af(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 _(async()=>{const{getChainMetadata:r}=await Promise.resolve().then(()=>Ko);return{getChainMetadata:r}},void 0);return(await t(e)).stackType==="zksync_stack"}catch{return!1}}function cf(e){var r;if(!e)return!1;const n=(typeof e=="string"?e:(e==null?void 0:e.message)||((r=e==null?void 0:e.data)==null?void 0:r.message)||"").toLowerCase();return n.includes("insufficient funds")||n.includes("insufficient balance")||n.includes("insufficient")&&(n.includes("native")||n.includes("gas"))||(e==null?void 0:e.code)==="INSUFFICIENT_FUNDS"||(e==null?void 0:e.reason)==="insufficient funds"}function uf(e){var r;if(!e)return{message:"Unknown error"};const t=typeof e=="string"?e:(e==null?void 0:e.message)||((r=e==null?void 0:e.data)==null?void 0:r.message)||String(e);return{code:(e==null?void 0:e.code)||(e==null?void 0:e.reason),message:t}}async function Ps({client:e,ecosystem:t,data:n}){const r=ze(e,t),s={source:"sdk",...n};return r(`${vo("analytics")}/event`,{body:Z(s),method:"POST"}).catch(()=>{})}async function kl(e){return ff({...e,action:"transaction:sent"})}function ff(e){return Ps({client:e.client,data:{action:e.action,chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:Z(e.error),functionName:e.functionName,gasPrice:e.gasPrice,transactionHash:e.transactionHash,walletAddress:e.walletAddress,walletType:e.walletType},ecosystem:e.ecosystem})}async function df(e){var n,r,s;const t=uf(e.error);return Ps({client:e.client,data:{action:"transaction:insufficient_funds",chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:t.code?Z(t.code):void 0,errorMessage:t.message,functionName:e.functionName,requiredAmount:(n=e.requiredAmount)==null?void 0:n.toString(),transactionValue:(r=e.transactionValue)==null?void 0:r.toString(),userBalance:(s=e.userBalance)==null?void 0:s.toString(),walletAddress:e.walletAddress},ecosystem:e.ecosystem})}const Wn=$u*32n;class lf extends b{constructor({givenLength:t,maxBytecodeSize:n}){super(`Bytecode cannot be longer than ${n} bytes. Given length: ${t}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class hf extends b{constructor({givenLengthInWords:t}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${t}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class pf extends b{constructor({givenLength:t}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${t}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function Fl(e){const t=re(e);if(t.length%32!==0)throw new pf({givenLength:t.length});if(t.length>Wn)throw new lf({givenLength:t.length,maxBytecodeSize:Wn});const n=Mu(t),r=re(n),s=t.length/32;if(s%2===0)throw new hf({givenLengthInWords:s});const i=re(s),o=le(i,{size:2}),a=new Uint8Array([1,0]);return r.set(a,0),r.set(o,2),r}const yf=Ru({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}),mf="https://{clientId}.ipfscdn.io/ipfs/{cid}";function gf(e){var t,n;if(e.uri.startsWith("ipfs://")){const r=((n=(t=e.client.config)==null?void 0:t.storage)==null?void 0:n.gatewayUrl)??mf,s=e.client.clientId,i=bf(e.uri);let o;return typeof globalThis<"u"&&"Application"in globalThis&&(o=globalThis.Application.applicationId),`${r.replace("{clientId}",s).split("/ipfs")[0]}/ipfs/${i}${o?`?bundleId=${o}`:""}`}if(e.uri.startsWith("http"))return e.uri;throw new Error('Invalid URI scheme, expected "ipfs://" or "http(s)://"')}function bf(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}function Nl(e=32){return st(wf(e))}function wf(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}async function xf(e){var r,s,i,o,a,c,u,f,d;let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:l}=await _(async()=>{const{resolveArweaveScheme:h}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:h}},[]);t=l(e)}else t=gf(e);const n=await ze(e.client)(t,{headers:(i=(s=(r=e.client.config)==null?void 0:r.storage)==null?void 0:s.fetch)==null?void 0:i.headers,keepalive:(c=(a=(o=e.client.config)==null?void 0:o.storage)==null?void 0:a.fetch)==null?void 0:c.keepalive,requestTimeoutMs:e.requestTimeoutMs??((d=(f=(u=e.client.config)==null?void 0:u.storage)==null?void 0:f.fetch)==null?void 0:d.requestTimeoutMs)??6e4});if(!n.ok){const l=await n.text();throw new Error(`Failed to download file: ${n.status} ${n.statusText} ${l||""}`)}return n}function $f(e,t="https://contract.thirdweb.com/abi"){return et(async()=>{if(e.abi)return e.abi;if(e.chain.id===31337||e.chain.id===1337||e.chain.id===yf.id)return await Vn(e);try{return await Af(e,t)}catch{return await Vn(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function Af(e,t="https://contract.thirdweb.com/abi"){const r=await(await ze(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 Is(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([_(()=>import("./resolveImplementation-DGbhQK7c.js"),[]),_(()=>import("./extractIPFS-vJrEi7qY.js"),[])]),{bytecode:r}=await t(e);if(r==="0x"){const{id:i,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: ${i})]`)}const s=n(r);if(!s)return[];try{return(await(await xf({client:e.client,uri:s})).json()).output.abi}catch{return[]}}const Ef={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"},vf={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"},Pf={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 Vn(e,t,n){const[r,s,i,o,a]=await Promise.all([Is(e),If(e),Tf(e),_f(e),Sf(e)]),c=[...new Set([...s,...i,...o,...a])];if(!c.length)return r;const u=await Bf({contract:e,plugins:c,resolveSubAbi:n});return Of({pluginAbis:u,rootAbi:r})}async function If(e){try{const{readContract:t}=await _(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:Ef});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function Tf(e){try{const{readContract:t}=await _(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:vf});return n.length?[...new Set(n.map(r=>r.metadata.implementation))]:[]}catch{}return[]}async function _f(e){try{const{getInstalledModules:t}=await _(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-CA_R4T3H.js");return{getInstalledModules:r}},[]),n=await t({contract:e});return n.length?[...new Set(n.map(r=>r.implementation))]:[]}catch{}return[]}async function Sf(e){try{const{readContract:t}=await _(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:Pf});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function Bf(e){return Promise.all(e.plugins.map(t=>{const n=Ga({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):Is(n)}))}function Of(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(xi(t))];return oo(n)}async function Kn(e){var i;const{error:t,contract:n,fromAddress:r}=e;cf(t)&&n&&df({chainId:(i=n.chain)==null?void 0:i.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const s=await Lf({contract:n,error:t});return s?new Mf(s,n):t}async function Lf(e){const{error:t,contract:n}=e;if(typeof t=="object"){const r=t;if(r.data&&r.data!=="0x"&&de(r.data)){let s=n==null?void 0:n.abi;n&&!s&&(s=await $f(n).catch(()=>{}));const i=pu({abi:s,data:r.data});return`${i.errorName}${i.args?` - ${i.args}`:""}`}}return`Execution Reverted: ${yu(t)}`}class Mf extends Error{constructor(t,n){var s;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==null?void 0:n.address,this.chainId=(s=n==null?void 0:n.chain)==null?void 0:s.id,this.message=r}}const Pt=new WeakMap;async function Ts(e){var i,o;const t=typeof e.from=="string"?e.from??void 0:((i=e.from)==null?void 0:i.address)??((o=e.account)==null?void 0:o.address),n={...e.transaction,from:t};if(Pt.has(n))return Pt.get(n);const{account:r}=e,s=(async()=>{var p,x;const a=await I(e.transaction.gas);if(a!==void 0)return a;if(r!=null&&r.estimateGas)try{let g=await r.estimateGas(e.transaction);return(p=e.transaction.chain.experimental)!=null&&p.increaseZeroByteCount&&(g=_e(g)),g}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:c}=await _(async()=>{const{encode:g}=await Promise.resolve().then(()=>Gu);return{encode:g}},void 0),[u,f,d,l]=await Promise.all([c(e.transaction),I(e.transaction.to),I(e.transaction.value),I(e.transaction.authorizationList)]),[{getRpcClient:h},{eth_estimateGas:y}]=await Promise.all([_(()=>Promise.resolve().then(()=>Ju),void 0),_(()=>Promise.resolve().then(()=>Nf),void 0)]),m=h(e.transaction);try{const g=wu({authorizationList:l==null?void 0:l.map($=>({...$,address:D($.address),nonce:Number($.nonce),r:U($.r),s:U($.s)})),data:u,from:t?D(t):void 0,to:f?D(f):void 0,value:d});let w=await y(m,g);return(x=e.transaction.chain.experimental)!=null&&x.increaseZeroByteCount&&(w=_e(w)),w}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return Pt.set(n,s),s}const Dl=Object.freeze(Object.defineProperty({__proto__:null,estimateGas:Ts},Symbol.toStringTag,{value:"Module"}));async function Uf(e){if(await af(e.transaction.chain)){const{getZkGasFees:m}=await _(async()=>{const{getZkGasFees:w}=await import("./send-eip712-transaction-B8lI5Nl8.js").then($=>$.a);return{getZkGasFees:w}},[]),{gas:p,maxFeePerGas:x,maxPriorityFeePerGas:g}=await m({from:typeof e.from=="string"?D(e.from):e.from!==void 0?D(e.from.address):void 0,transaction:e.transaction});e.transaction={...e.transaction,gas:p,maxFeePerGas:x,maxPriorityFeePerGas:g}}const n=oe(e.transaction),r=e.transaction.chain.id,s=e.from;let[i,o,a,c,u,f,d,l,h]=await Promise.all([Ce(e.transaction),(async()=>{const m=await I(e.transaction.nonce);return m!==void 0?m:s?await _(async()=>{const{eth_getTransactionCount:p}=await Promise.resolve().then(()=>Rf);return{eth_getTransactionCount:p}},void 0).then(({eth_getTransactionCount:p})=>p(n,{address:D(typeof s=="string"?s:s.address),blockTag:"pending"})):void 0})(),Ts({...e,from:e.from}),Es(e.transaction),I(e.transaction.to),I(e.transaction.accessList),I(e.transaction.value),I(e.transaction.authorizationList),I(e.transaction.type)]);const y=await I(e.transaction.extraGas);return y&&(a+=y),{accessList:f,authorizationList:l,chainId:r,data:i,gas:a,nonce:o,to:u,type:h,value:d,...c}}async function zf(e){const t=await e({method:"eth_blockNumber"});return rt(t)}function Cf(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{balance:n.balance?z(n.balance):void 0,code:n.code,nonce:n.nonce?z(n.nonce):void 0,state:n.state,stateDiff:n.stateDiff}]))}async function kf(e,t){const{blockNumber:n,blockTag:r,...s}=t,o=(n?z(n):void 0)||r||"latest";return await e({method:"eth_call",params:t.stateOverrides?[s,o,Cf(t.stateOverrides)]:[s,o]})}async function Ff(e,t){const n=await e({method:"eth_estimateGas",params:[t]});return rt(n)}const Nf=Object.freeze(Object.defineProperty({__proto__:null,eth_estimateGas:Ff},Symbol.toStringTag,{value:"Module"}));async function Df(e,t){return e({method:"eth_getCode",params:[t.address,t.blockTag||"latest"]})}async function jl(e,t){return await e({method:"eth_getStorageAt",params:[D(t.address),t.position,t.blockTag??"latest"]})}async function jf(e,t){const n=await e({method:"eth_getTransactionCount",params:[t.address,t.blockNumber?z(t.blockNumber):t.blockTag||"pending"]});return Na(n)}const Rf=Object.freeze(Object.defineProperty({__proto__:null,eth_getTransactionCount:jf},Symbol.toStringTag,{value:"Module"}));async function Gf(e,t){const n=await e({method:"eth_getTransactionReceipt",params:[t.hash]});if(!n)throw new Error("Transaction receipt not found.");return ju(n)}async function Rl(e,t){return await e({method:"eth_sendRawTransaction",params:[t]})}function Hf(e){return new Promise(t=>setTimeout(t,e))}const Wf=5e3,Vf=1e3,Zn=500,Kf=2,_s=10;function Zf(e){for(;e.length<_s;)e.unshift(Vf);return e.reduce((n,r)=>n+r,0)/e.length}function Xf(e,t,n,r){let s=[],i=[],o=!1,a,c;const u=oe({chain:t,client:e});async function f(){if(!o)return;try{const h=await zf(u);if(!a||h>a){let y=[];if(a)for(let p=a+1n;p<=h;p++)y.push(BigInt(p));else y=[h];a=h;const m=Date.now();if(c){const p=(m-c)/y.length;i.push(p),i=i.slice(-_s)}c=m;for(const p of y)for(const x of s)x(p)}}catch(h){r?r(h):console.error(`[watchBlockNumber]: Failed to poll for latest block number: ${h}`)}const d=Zf(i),l=Math.max(Zn,Math.min(Wf,Math.max(Zn,d)));await Hf(l/(n??Kf)),f()}return function(l,h){return s.push(l),o||(a=h,o=!0,f()),function(){s=s.filter(m=>m!==l),s.length===0&&(a=void 0,c=void 0,o=!1)}}}const Xn=new Map;function Yf(e){const{client:t,chain:n,onNewBlockNumber:r,overPollRatio:s,latestBlockNumber:i,onError:o}=e,a=n.id;let c=Xn.get(a);return c||(c=Xf(t,n,s,o),Xn.set(a,c)),c(r,i)}function qf(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="event")}function Gl(e){const{signature:t}=e;let n;return qf(t)?n=t:n=Je(t),{abiEvent:n,hash:nn(n),topics:Qc({abi:[n],args:e.filters})}}function Hl(e){const{logs:t,events:n,strict:r}=e;return ku({abi:n.map(s=>s.abiEvent),logs:t,strict:r})}function ce(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=kr(fa(e));return n==="Bytes"?r:Yt(r)}class Jf 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 Qf={checksum:new Jf(8192)},It=Qf.checksum,ed=/^0x[a-fA-F0-9]{40}$/;function dt(e,t={}){const{strict:n=!0}=t;if(!ed.test(e))throw new Rt({address:e,cause:new Ss});if(n){if(e.toLowerCase()===e)return;if(td(e)!==e)throw new Rt({address:e,cause:new rd})}}function td(e){if(It.has(e))return It.get(e);dt(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=ce(qt(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return It.set(e,s),s}function nd(e,t={}){const{strict:n=!0}=t??{};try{return dt(e,{strict:n}),!0}catch{return!1}}class Rt extends A{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 Ss extends A{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 rd extends A{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const sd=/^(.*)\[([0-9]*)\]$/,Bs=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,cn=/^(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)?$/,Wl=2n**96n-1n;function id({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(un({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function un({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=hd(r.type);if(s){const[i,o]=s;return ad(n,{checksumAddress:e,length:i,parameter:{...r,type:o}})}if(r.type==="tuple")return ld(n,{checksumAddress:e,parameter:r});if(r.type==="address")return od(n,{checksum:e});if(r.type==="bool")return ud(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,o="256"]=cn.exec(r.type)??[];return fd(n,{signed:i,size:Number(o)})}if(r.type.startsWith("bytes"))return cd(n,{type:r.type});if(r.type==="string")return dd(n);throw new Us(r.type)}function fn(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=B(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(U(t+s,{size:32})),r.push(a),s+=B(a)):n.push(a)}return S(...n,...r)}function od(e,t){const{checksum:n=!1}=t;return dt(e,{strict:n}),{dynamic:!1,encoded:se(e.toLowerCase())}}function ad(e,t){const{checksumAddress:n,length:r,parameter:s}=t,i=r===null;if(!Array.isArray(e))throw new yd(e);if(!i&&e.length!==r)throw new pd({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const u=un({checksumAddress:n,parameter:s,value:e[c]});u.dynamic&&(o=!0),a.push(u)}if(i||o){const c=fn(a);if(i){const u=U(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?S(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:S(...a.map(({encoded:c})=>c))}}function cd(e,{type:t}){const[,n]=t.split("bytes"),r=B(e);if(!n){let s=e;return r%32!==0&&(s=ie(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:S(se(U(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new Ls({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:ie(e)}}function ud(e){if(typeof e!="boolean")throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:se(Xt(e))}}function fd(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new Br({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:U(e,{size:32,signed:t})}}function dd(e){const t=nt(e),n=Math.ceil(B(t)/32),r=[];for(let s=0;s<n;s++)r.push(ie(_r(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:S(ie(U(B(t),{size:32})),...r)}}function ld(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,u=un({checksumAddress:n,parameter:a,value:e[c]});i.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?fn(i):S(...i.map(({encoded:o})=>o))}}function hd(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Os(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Ms({expectedLength:e.length,givenLength:t.length});const s=id({checksumAddress:r,parameters:e,values:t}),i=fn(s);return i.length===0?"0x":i}function Gt(e,t){if(e.length!==t.length)throw new Ms({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(Gt.encode(s,i))}return S(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return dt(c),se(c.toLowerCase(),s?32:0)}if(n==="string")return nt(r);if(n==="bytes")return r;if(n==="bool")return se(Xt(r),s?32:1);const i=n.match(cn);if(i){const[c,u,f="256"]=i,d=Number.parseInt(f)/8;return U(r,{size:s?32:d,signed:u==="int"})}const o=n.match(Bs);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new Ls({expectedSize:Number.parseInt(u),value:r});return ie(r,s?32:0)}const a=n.match(sd);if(a&&Array.isArray(r)){const[c,u]=a,f=[];for(let d=0;d<r.length;d++)f.push(t(u,r[d],!0));return f.length===0?"0x":S(...f)}throw new Us(n)}e.encode=t})(Gt||(Gt={}));class pd extends A{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 Ls=class extends A{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${B(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}};class Ms extends A{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
19
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class yd extends A{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Us extends A{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 md(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(o,a)=>{for(const c of o){const{name:u,type:f}=c,d=a[u],l=f.match(cn);if(l&&(typeof d=="number"||typeof d=="bigint")){const[,m,p]=l;U(d,{signed:m==="int",size:Number.parseInt(p??"")/8})}if(f==="address"&&typeof d=="string"&&!nd(d))throw new Rt({address:d,cause:new Ss});const h=f.match(Bs);if(h){const[,m]=h;if(m&&B(d)!==Number.parseInt(m))throw new $d({expectedSize:Number.parseInt(m),givenSize:B(d)})}const y=s[f];y&&(Id(f),i(y,d))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new Ad({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new Ed({primaryType:r,types:s})}function gd(e){const{primaryType:t,types:n}=e;let r="";const s=Fs({primaryType:t,types:n});s.delete(t);const i=[t,...Array.from(s).sort()];for(const o of i)r+=`${o}(${(n[o]??[]).map(({name:a,type:c})=>`${c} ${a}`).join(",")})`;return r}function zs(e){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function bd(e){const{domain:t,types:n}=e;return wd({data:t,primaryType:"EIP712Domain",types:{...n,EIP712Domain:(n==null?void 0:n.EIP712Domain)||zs(t)}})}function wd(e){const{data:t,primaryType:n,types:r}=e,s=Cs({data:t,primaryType:n,types:r});return ce(s)}function xd(e){try{return md(e),!0}catch{return!1}}class $d extends A{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 Ad extends A{constructor({domain:t}){super(`Invalid domain "${Pr(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidDomainError"})}}class Ed extends A{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 vd extends A{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 Cs(e){const{data:t,primaryType:n,types:r}=e,s=[{type:"bytes32"}],i=[Pd({primaryType:n,types:r})];for(const o of r[n]??[]){const[a,c]=ks({types:r,name:o.name,type:o.type,value:t[o.name]});s.push(a),i.push(c)}return Os(s,i)}function Pd(e){const{primaryType:t,types:n}=e,r=nt(gd({primaryType:t,types:n}));return ce(r)}function ks(e){let{types:t,name:n,type:r,value:s}=e;if(t[r]!==void 0)return[{type:"bytes32"},ce(Cs({data:s,primaryType:r,types:t}))];if(r==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},ce(s,{as:"Hex"})];if(r==="string")return[{type:"bytes32"},ce(qt(s),{as:"Hex"})];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=s.map(a=>ks({name:n,type:i,types:t,value:a}));return[{type:"bytes32"},ce(Os(o.map(([a])=>a),o.map(([,a])=>a)))]}return[{type:r},s]}function Fs(e,t=new Set){const{primaryType:n,types:r}=e,s=n.match(/^\w*/u),i=s==null?void 0:s[0];if(t.has(i)||r[i]===void 0)return t;t.add(i);for(const o of r[i])Fs({primaryType:o.type,types:r},t);return t}function Id(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new vd({type:e})}function Ue(e){return de(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=Td({params:e,values:t}),r=ln(n);return r.length===0?"0x":r}function Td({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(dn({param:e[r],value:t[r]}));return n}function dn({param:e,value:t}){const n=zd(e.type);if(n){const[r,s]=n;return Sd(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return Ud(t,{param:e});if(e.type==="address")return _d(t);if(e.type==="bool")return Od(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int");return Ld(t,{signed:r})}if(e.type.startsWith("bytes"))return Bd(t,{param:e});if(e.type==="string")return Md(t);throw new Error(`Unsupported parameter type: ${e.type}`)}function ln(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=Ue(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(z(t+s,{size:32})),r.push(a),s+=Ue(a)):n.push(a)}return S(...n,...r)}function _d(e){if(e!==""&&e!==void 0&&!Jt(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:ue(e.toLowerCase())}}function Sd(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 s=!1;const i=[];for(let o=0;o<e.length;o++){const a=dn({param:n,value:e[o]});a.dynamic&&(s=!0),i.push(a)}if(r||s){const o=ln(i);if(r){const a=z(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?S(a,o):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:S(...i.map(({encoded:o})=>o))}}function Bd(e,{param:t}){const[,n]=t.type.split("bytes"),r=Ue(e);if(!n){let s=e;return r%32!==0&&(s=ue(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:S(ue(z(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new Error(`Invalid bytes${n} size: ${r}`);return{dynamic:!1,encoded:ue(e,{dir:"right"})}}function Od(e){return{dynamic:!1,encoded:ue(Nr(e))}}function Ld(e,{signed:t}){return{dynamic:!1,encoded:z(e,{signed:t,size:32})}}function Md(e){const t=it(e),n=Math.ceil(Ue(t)/32),r=[];for(let s=0;s<n;s++)r.push(ue(_r(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:S(ue(z(Ue(t),{size:32})),...r)}}function Ud(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const i=t.components[s],o=Array.isArray(e)?s:i.name,a=dn({param:i,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ln(r):S(...r.map(({encoded:s})=>s))}}function zd(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Tt=new Qe(4096);function te(e){const t=typeof e=="string"?e:Z(e);if(Tt.has(t))return Tt.get(t);const n=typeof e=="string"?Je(e):e,s=[an(n),n.inputs,n.outputs];return Tt.set(t,s),s}function Ns(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="function")}async function lt(e){const{contract:t,method:n,params:r}=e,s=async()=>{var d,l;if(Array.isArray(n))return n;if(Ns(n))return te(n);if(typeof n=="function")return te(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const h=Je(n);if(h.type==="function")return te(h);throw new Error('"method" passed is not of type "function"')}if(t.abi&&((d=t.abi)==null?void 0:d.length)>0){const h=(l=t.abi)==null?void 0:l.find(y=>y.type==="function"&&y.name===n);if(h)return te(h)}throw new Error(`Could not resolve method "${n}".`)},[i,o]=await Promise.all([s(),typeof r=="function"?r():r]);let a;i[1].length===0?a=i[0]:a=i[0]+he(i[1],o).slice(2);const c=oe({chain:t.chain,client:t.client}),u=await kf(c,{data:a,from:e.from?D(e.from):void 0,to:t.address}),f=ft(i[2],u);return Array.isArray(f)&&f.length===1?f[0]:f}const hn=Object.freeze(Object.defineProperty({__proto__:null,readContract:lt},Symbol.toStringTag,{value:"Module"})),Cd="0x313ce567",kd=[],Fd=[{type:"uint8"}];async function Nd(e){return lt({contract:e.contract,method:[Cd,kd,Fd],params:[]})}async function Dd(e){return et(()=>Nd(e),{cacheKey:`${e.contract.chain.id}:${e.contract.address}:decimals`,cacheTime:Number.POSITIVE_INFINITY})}const Kl=Object.freeze(Object.defineProperty({__proto__:null,decimals:Dd},Symbol.toStringTag,{value:"Module"}));function jd(e){const t=new Set;let n=e;const r=()=>{for(const s of t)s()};return{getValue(){return n},setValue(s){s!==n&&(n=s,r())},subscribe(s){return t.add(s),()=>{t.delete(s)}}}}const Ht=new Map;function Rd(e){const t=Ht.get(e);if(t)return t;const n=jd([]);return Ht.set(e,n),n}function Gd(e){const{address:t,transactionHash:n,chainId:r}=e,s=Rd(t);s.setValue([...s.getValue(),{chainId:r,transactionHash:n}]),Ht.set(t,s)}async function Hd(e){let{account:t,transaction:n,gasless:r}=e;if(t.onTransactionRequested&&await t.onTransactionRequested(n),n.eip712){const{sendEip712Transaction:o}=await _(async()=>{const{sendEip712Transaction:a}=await import("./send-eip712-transaction-B8lI5Nl8.js").then(c=>c.a);return{sendEip712Transaction:a}},[]);return o({account:t,transaction:n})}const s=await Uf({from:t,transaction:n});if(r){const{sendGaslessTransaction:o}=await _(async()=>{const{sendGaslessTransaction:a}=await import("./send-gasless-transaction-BUH0JHe1.js");return{sendGaslessTransaction:a}},[]);return o({account:t,gasless:r,serializableTransaction:s,transaction:n})}const i=await t.sendTransaction(s);return Gd({address:t.address,chainId:n.chain.id,transactionHash:i.transactionHash}),{...i,chain:n.chain,client:n.client}}const Wd=100,je=new Map;function Vd(e){const{transactionHash:t,chain:n,client:r}=e,i=`${n.id}:tx_${t}`,o=e.maxBlocksWaitTime??Wd;if(je.has(i))return je.get(i);const a=new Promise((c,u)=>{t||u(new Error("Transaction has no transactionHash to wait for, did you execute it?"));const f=oe({chain:n,client:r});let d=-1;const l=Yf({chain:n,client:r,onNewBlockNumber:async()=>{if(d++,d>=o){l(),u(new Error(`Transaction receipt for ${t} not found after ${o} blocks`));return}try{const h=await Gf(f,{hash:t});l(),c(h)}catch{}}})}).finally(()=>{je.delete(i)});return je.set(i,a),a}async function Zl(e){const t=await Hd(e);return Vd(t)}async function Xl(e){const{account:t,transactions:n}=e;if(!t)throw new Error("not connected");if(n.length===0)throw new Error("No transactions to send");const r=n[0];if(!r)throw new Error("No transactions to send");if(t.sendBatchTransaction){const s=await Promise.all(n.map(async o=>{const[a,c,u,f]=await Promise.all([Ce(o),I(o.to),I(o.accessList),I(o.value)]);return{accessList:u,chainId:o.chain.id,data:a,to:c,value:f}}));return{...await t.sendBatchTransaction(s),chain:r.chain,client:r.client}}throw new Error("Account doesn't implement sendBatchTransaction")}function Kd(e,t){return t&&(e.__preparedMethod=t.preparedMethod,e.__contract=t.contract),e}function pn(e){const{contract:t,method:n,params:r,...s}=e,i=()=>(async()=>{var o,a;if(Array.isArray(n))return n;if(Ns(n))return te(n);if(typeof n=="function")return te(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const c=Je(n);if(c.type==="function")return te(c);throw new Error('"method" passed is not of type "function"')}if(t.abi&&((o=t.abi)==null?void 0:o.length)>0){const c=(a=t.abi)==null?void 0:a.find(u=>u.type==="function"&&u.name===n);if(c)return te(c)}throw new Error(`Could not resolve method "${n}".`)})();return Kd({...s,chain:t.chain,client:t.client,data:async()=>{let o;return Array.isArray(n)?o=n:o=await i(),o[1].length===0?o[0]:o[0]+he(o[1],await I(r??[])).slice(2)},to:t.address},{contract:t,preparedMethod:i})}function Ds(e){return S(...e)}const Zd=Object.freeze(Object.defineProperty({__proto__:null,concatHex:Ds},Symbol.toStringTag,{value:"Module"})),Xd="0x1626ba7e",Yd=[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],qd=[{type:"bytes4"}];async function Jd(e){return lt({contract:e.contract,method:[Xd,Yd,qd],params:[e.hash,e.signature]})}const Re=new WeakMap;function Qd(e){if(Re.has(e))return Re.get(e);const t=(async()=>{const n=oe(e),r=await Df(n,{address:e.address,blockTag:"latest"});return r==="0x"&&Re.delete(e),r})();return Re.set(e,t),t}const Yn=new WeakSet;async function js(e){if(Yn.has(e))return!0;const n=await Qd(e)!=="0x";return n&&Yn.add(e),n}const el="0x6492649264926492649264926492649264926492649264926492649264926492";function Rs({address:e,data:t,signature:n}){return Ds([he([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,t,n]),el])}const tl="0x1626ba7e";async function Gs({hash:e,signature:t,contract:n}){try{return await Jd({contract:n,hash:e,signature:t})===tl}catch(r){return console.error("Error verifying EIP-1271 signature",r),!1}}const nl=`Ethereum Signed Message:
|
|
18
|
+
responses: ${Z($)}`))})}).catch($=>{for(const v of g)v.reject($)}).finally(()=>{a.clear()})}return i===1?async x=>{var w;x.id=1,x.jsonrpc="2.0";const g=await Ku(s,e.client,{request:x,requestTimeoutMs:(w=e.config)==null?void 0:w.requestTimeoutMs});if(!g)throw new Error("No response");if("error"in g)throw g.error;return g.result}:async x=>{const g=Xu(x);if(a.has(g))return a.get(g);let w,$;const v=new Promise((ht,L)=>{w=ht,$=L});return a.set(g,v),c.push({reject:$,request:x,requestKey:g,resolve:w}),i>1?(u||(u=setTimeout(f,o)),c.length>=i&&f()):f(),v}})();return t.set(n,r),r}const Ju=Object.freeze(Object.defineProperty({__proto__:null,getRpcClient:oe},Symbol.toStringTag,{value:"Module"}));async function I(e){return typeof e=="function"?await e():e}function As(e,t){e.includes("e")&&(e=Number(e).toFixed(t));let[n,r=""]=e.split(".");const s=n.startsWith("-")?"-":"";if(s&&(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 i=r[t];i&&Number.parseInt(i,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(`${s}${n}${r}`)}function zl(e){return As(e,18)}async function Qu(e){const t=await e({method:"eth_gasPrice"});return rt(t)}async function Hn(e){const{client:t,chain:n,percentMultiplier:r}=e,s=oe({chain:n,client:t}),i=await Qu(s),o=r?i/BigInt(100)*BigInt(r):0n;return i+o}function _e(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const ef=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function Es(e){var o;const[t,n,r,s]=await Promise.all([I(e.maxFeePerGas),I(e.maxPriorityFeePerGas),I(e.gasPrice),I(e.type)]);if(t!==void 0&&n!==void 0)return{maxFeePerGas:t,maxPriorityFeePerGas:n};if(typeof r=="bigint")return{gasPrice:r};const i=await vs(e.client,e.chain,s==="legacy"?"legacy":"eip1559");return(o=e.chain.experimental)!=null&&o.increaseZeroByteCount?i.gasPrice?{gasPrice:_e(i.gasPrice)}:{maxFeePerGas:t??_e(i.maxFeePerGas??0n),maxPriorityFeePerGas:n??_e(i.maxPriorityFeePerGas??0n)}:i.gasPrice!==void 0?i:{maxFeePerGas:t??i.maxFeePerGas,maxPriorityFeePerGas:n??i.maxPriorityFeePerGas}}async function vs(e,t,n){if((n??t.feeType)==="legacy"||ef.includes(t.id))return{gasPrice:await Hn({chain:t,client:e,percentMultiplier:10})};const s=await tf(e,t);return s.maxFeePerGas!==null&&s.maxPriorityFeePerGas!==null?{maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas}:{gasPrice:await Hn({chain:t,client:e,percentMultiplier:10})}}async function tf(e,t,n=10){let r=null,s=null;const i=oe({chain:t,client:e}),[o,a]=await Promise.all([Hu(i,{blockTag:"latest"}),Wu(i).catch(()=>null)]),c=o==null?void 0:o.baseFeePerGas,u=t.id;return u===220||u===1220?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(u===80002||u===137?s=await of(u):a!==null&&(s=a),s==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(s=nf(s,n),r=c*2n+s,(u===42220||u===44787||u===62320)&&(s=r),{maxFeePerGas:r,maxPriorityFeePerGas:s}))}function nf(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function rf(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const sf=31n;async function of(e){const t=rf(e);try{const r=(await(await fetch(t)).json()).fast.maxPriorityFee;if(r>0){const s=Number.parseFloat(r).toFixed(9);return As(s,9)}}catch(n){console.error("failed to fetch gas",n)}return sf}const Cl=Object.freeze(Object.defineProperty({__proto__:null,getDefaultGasOverrides:vs,getGasOverridesForTransaction:Es},Symbol.toStringTag,{value:"Module"}));async function af(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 _(async()=>{const{getChainMetadata:r}=await Promise.resolve().then(()=>Ko);return{getChainMetadata:r}},void 0);return(await t(e)).stackType==="zksync_stack"}catch{return!1}}function cf(e){var r;if(!e)return!1;const n=(typeof e=="string"?e:(e==null?void 0:e.message)||((r=e==null?void 0:e.data)==null?void 0:r.message)||"").toLowerCase();return n.includes("insufficient funds")||n.includes("insufficient balance")||n.includes("insufficient")&&(n.includes("native")||n.includes("gas"))||(e==null?void 0:e.code)==="INSUFFICIENT_FUNDS"||(e==null?void 0:e.reason)==="insufficient funds"}function uf(e){var r;if(!e)return{message:"Unknown error"};const t=typeof e=="string"?e:(e==null?void 0:e.message)||((r=e==null?void 0:e.data)==null?void 0:r.message)||String(e);return{code:(e==null?void 0:e.code)||(e==null?void 0:e.reason),message:t}}async function Ps({client:e,ecosystem:t,data:n}){const r=ze(e,t),s={source:"sdk",...n};return r(`${vo("analytics")}/event`,{body:Z(s),method:"POST"}).catch(()=>{})}async function kl(e){return ff({...e,action:"transaction:sent"})}function ff(e){return Ps({client:e.client,data:{action:e.action,chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:Z(e.error),functionName:e.functionName,gasPrice:e.gasPrice,transactionHash:e.transactionHash,walletAddress:e.walletAddress,walletType:e.walletType},ecosystem:e.ecosystem})}async function df(e){var n,r,s;const t=uf(e.error);return Ps({client:e.client,data:{action:"transaction:insufficient_funds",chainId:e.chainId,clientId:e.client.clientId,contractAddress:e.contractAddress,errorCode:t.code?Z(t.code):void 0,errorMessage:t.message,functionName:e.functionName,requiredAmount:(n=e.requiredAmount)==null?void 0:n.toString(),transactionValue:(r=e.transactionValue)==null?void 0:r.toString(),userBalance:(s=e.userBalance)==null?void 0:s.toString(),walletAddress:e.walletAddress},ecosystem:e.ecosystem})}const Wn=$u*32n;class lf extends b{constructor({givenLength:t,maxBytecodeSize:n}){super(`Bytecode cannot be longer than ${n} bytes. Given length: ${t}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class hf extends b{constructor({givenLengthInWords:t}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${t}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class pf extends b{constructor({givenLength:t}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${t}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function Fl(e){const t=re(e);if(t.length%32!==0)throw new pf({givenLength:t.length});if(t.length>Wn)throw new lf({givenLength:t.length,maxBytecodeSize:Wn});const n=Mu(t),r=re(n),s=t.length/32;if(s%2===0)throw new hf({givenLengthInWords:s});const i=re(s),o=le(i,{size:2}),a=new Uint8Array([1,0]);return r.set(a,0),r.set(o,2),r}const yf=Ru({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}),mf="https://{clientId}.ipfscdn.io/ipfs/{cid}";function gf(e){var t,n;if(e.uri.startsWith("ipfs://")){const r=((n=(t=e.client.config)==null?void 0:t.storage)==null?void 0:n.gatewayUrl)??mf,s=e.client.clientId,i=bf(e.uri);let o;return typeof globalThis<"u"&&"Application"in globalThis&&(o=globalThis.Application.applicationId),`${r.replace("{clientId}",s).split("/ipfs")[0]}/ipfs/${i}${o?`?bundleId=${o}`:""}`}if(e.uri.startsWith("http"))return e.uri;throw new Error('Invalid URI scheme, expected "ipfs://" or "http(s)://"')}function bf(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}function Nl(e=32){return st(wf(e))}function wf(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}async function xf(e){var r,s,i,o,a,c,u,f,d;let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:l}=await _(async()=>{const{resolveArweaveScheme:h}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:h}},[]);t=l(e)}else t=gf(e);const n=await ze(e.client)(t,{headers:(i=(s=(r=e.client.config)==null?void 0:r.storage)==null?void 0:s.fetch)==null?void 0:i.headers,keepalive:(c=(a=(o=e.client.config)==null?void 0:o.storage)==null?void 0:a.fetch)==null?void 0:c.keepalive,requestTimeoutMs:e.requestTimeoutMs??((d=(f=(u=e.client.config)==null?void 0:u.storage)==null?void 0:f.fetch)==null?void 0:d.requestTimeoutMs)??6e4});if(!n.ok){const l=await n.text();throw new Error(`Failed to download file: ${n.status} ${n.statusText} ${l||""}`)}return n}function $f(e,t="https://contract.thirdweb.com/abi"){return et(async()=>{if(e.abi)return e.abi;if(e.chain.id===31337||e.chain.id===1337||e.chain.id===yf.id)return await Vn(e);try{return await Af(e,t)}catch{return await Vn(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function Af(e,t="https://contract.thirdweb.com/abi"){const r=await(await ze(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 Is(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([_(()=>import("./resolveImplementation-DgTEX2VO.js"),[]),_(()=>import("./extractIPFS-CGOJ5iK5.js"),[])]),{bytecode:r}=await t(e);if(r==="0x"){const{id:i,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: ${i})]`)}const s=n(r);if(!s)return[];try{return(await(await xf({client:e.client,uri:s})).json()).output.abi}catch{return[]}}const Ef={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"},vf={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"},Pf={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 Vn(e,t,n){const[r,s,i,o,a]=await Promise.all([Is(e),If(e),Tf(e),_f(e),Sf(e)]),c=[...new Set([...s,...i,...o,...a])];if(!c.length)return r;const u=await Bf({contract:e,plugins:c,resolveSubAbi:n});return Of({pluginAbis:u,rootAbi:r})}async function If(e){try{const{readContract:t}=await _(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:Ef});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function Tf(e){try{const{readContract:t}=await _(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:vf});return n.length?[...new Set(n.map(r=>r.metadata.implementation))]:[]}catch{}return[]}async function _f(e){try{const{getInstalledModules:t}=await _(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-CEuy7miG.js");return{getInstalledModules:r}},[]),n=await t({contract:e});return n.length?[...new Set(n.map(r=>r.implementation))]:[]}catch{}return[]}async function Sf(e){try{const{readContract:t}=await _(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:Pf});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function Bf(e){return Promise.all(e.plugins.map(t=>{const n=Ga({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):Is(n)}))}function Of(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(xi(t))];return oo(n)}async function Kn(e){var i;const{error:t,contract:n,fromAddress:r}=e;cf(t)&&n&&df({chainId:(i=n.chain)==null?void 0:i.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const s=await Lf({contract:n,error:t});return s?new Mf(s,n):t}async function Lf(e){const{error:t,contract:n}=e;if(typeof t=="object"){const r=t;if(r.data&&r.data!=="0x"&&de(r.data)){let s=n==null?void 0:n.abi;n&&!s&&(s=await $f(n).catch(()=>{}));const i=pu({abi:s,data:r.data});return`${i.errorName}${i.args?` - ${i.args}`:""}`}}return`Execution Reverted: ${yu(t)}`}class Mf extends Error{constructor(t,n){var s;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==null?void 0:n.address,this.chainId=(s=n==null?void 0:n.chain)==null?void 0:s.id,this.message=r}}const Pt=new WeakMap;async function Ts(e){var i,o;const t=typeof e.from=="string"?e.from??void 0:((i=e.from)==null?void 0:i.address)??((o=e.account)==null?void 0:o.address),n={...e.transaction,from:t};if(Pt.has(n))return Pt.get(n);const{account:r}=e,s=(async()=>{var p,x;const a=await I(e.transaction.gas);if(a!==void 0)return a;if(r!=null&&r.estimateGas)try{let g=await r.estimateGas(e.transaction);return(p=e.transaction.chain.experimental)!=null&&p.increaseZeroByteCount&&(g=_e(g)),g}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:c}=await _(async()=>{const{encode:g}=await Promise.resolve().then(()=>Gu);return{encode:g}},void 0),[u,f,d,l]=await Promise.all([c(e.transaction),I(e.transaction.to),I(e.transaction.value),I(e.transaction.authorizationList)]),[{getRpcClient:h},{eth_estimateGas:y}]=await Promise.all([_(()=>Promise.resolve().then(()=>Ju),void 0),_(()=>Promise.resolve().then(()=>Nf),void 0)]),m=h(e.transaction);try{const g=wu({authorizationList:l==null?void 0:l.map($=>({...$,address:D($.address),nonce:Number($.nonce),r:U($.r),s:U($.s)})),data:u,from:t?D(t):void 0,to:f?D(f):void 0,value:d});let w=await y(m,g);return(x=e.transaction.chain.experimental)!=null&&x.increaseZeroByteCount&&(w=_e(w)),w}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return Pt.set(n,s),s}const Dl=Object.freeze(Object.defineProperty({__proto__:null,estimateGas:Ts},Symbol.toStringTag,{value:"Module"}));async function Uf(e){if(await af(e.transaction.chain)){const{getZkGasFees:m}=await _(async()=>{const{getZkGasFees:w}=await import("./send-eip712-transaction-r2PbPkaQ.js").then($=>$.a);return{getZkGasFees:w}},[]),{gas:p,maxFeePerGas:x,maxPriorityFeePerGas:g}=await m({from:typeof e.from=="string"?D(e.from):e.from!==void 0?D(e.from.address):void 0,transaction:e.transaction});e.transaction={...e.transaction,gas:p,maxFeePerGas:x,maxPriorityFeePerGas:g}}const n=oe(e.transaction),r=e.transaction.chain.id,s=e.from;let[i,o,a,c,u,f,d,l,h]=await Promise.all([Ce(e.transaction),(async()=>{const m=await I(e.transaction.nonce);return m!==void 0?m:s?await _(async()=>{const{eth_getTransactionCount:p}=await Promise.resolve().then(()=>Rf);return{eth_getTransactionCount:p}},void 0).then(({eth_getTransactionCount:p})=>p(n,{address:D(typeof s=="string"?s:s.address),blockTag:"pending"})):void 0})(),Ts({...e,from:e.from}),Es(e.transaction),I(e.transaction.to),I(e.transaction.accessList),I(e.transaction.value),I(e.transaction.authorizationList),I(e.transaction.type)]);const y=await I(e.transaction.extraGas);return y&&(a+=y),{accessList:f,authorizationList:l,chainId:r,data:i,gas:a,nonce:o,to:u,type:h,value:d,...c}}async function zf(e){const t=await e({method:"eth_blockNumber"});return rt(t)}function Cf(e){return Object.fromEntries(Object.entries(e).map(([t,n])=>[t,{balance:n.balance?z(n.balance):void 0,code:n.code,nonce:n.nonce?z(n.nonce):void 0,state:n.state,stateDiff:n.stateDiff}]))}async function kf(e,t){const{blockNumber:n,blockTag:r,...s}=t,o=(n?z(n):void 0)||r||"latest";return await e({method:"eth_call",params:t.stateOverrides?[s,o,Cf(t.stateOverrides)]:[s,o]})}async function Ff(e,t){const n=await e({method:"eth_estimateGas",params:[t]});return rt(n)}const Nf=Object.freeze(Object.defineProperty({__proto__:null,eth_estimateGas:Ff},Symbol.toStringTag,{value:"Module"}));async function Df(e,t){return e({method:"eth_getCode",params:[t.address,t.blockTag||"latest"]})}async function jl(e,t){return await e({method:"eth_getStorageAt",params:[D(t.address),t.position,t.blockTag??"latest"]})}async function jf(e,t){const n=await e({method:"eth_getTransactionCount",params:[t.address,t.blockNumber?z(t.blockNumber):t.blockTag||"pending"]});return Na(n)}const Rf=Object.freeze(Object.defineProperty({__proto__:null,eth_getTransactionCount:jf},Symbol.toStringTag,{value:"Module"}));async function Gf(e,t){const n=await e({method:"eth_getTransactionReceipt",params:[t.hash]});if(!n)throw new Error("Transaction receipt not found.");return ju(n)}async function Rl(e,t){return await e({method:"eth_sendRawTransaction",params:[t]})}function Hf(e){return new Promise(t=>setTimeout(t,e))}const Wf=5e3,Vf=1e3,Zn=500,Kf=2,_s=10;function Zf(e){for(;e.length<_s;)e.unshift(Vf);return e.reduce((n,r)=>n+r,0)/e.length}function Xf(e,t,n,r){let s=[],i=[],o=!1,a,c;const u=oe({chain:t,client:e});async function f(){if(!o)return;try{const h=await zf(u);if(!a||h>a){let y=[];if(a)for(let p=a+1n;p<=h;p++)y.push(BigInt(p));else y=[h];a=h;const m=Date.now();if(c){const p=(m-c)/y.length;i.push(p),i=i.slice(-_s)}c=m;for(const p of y)for(const x of s)x(p)}}catch(h){r?r(h):console.error(`[watchBlockNumber]: Failed to poll for latest block number: ${h}`)}const d=Zf(i),l=Math.max(Zn,Math.min(Wf,Math.max(Zn,d)));await Hf(l/(n??Kf)),f()}return function(l,h){return s.push(l),o||(a=h,o=!0,f()),function(){s=s.filter(m=>m!==l),s.length===0&&(a=void 0,c=void 0,o=!1)}}}const Xn=new Map;function Yf(e){const{client:t,chain:n,onNewBlockNumber:r,overPollRatio:s,latestBlockNumber:i,onError:o}=e,a=n.id;let c=Xn.get(a);return c||(c=Xf(t,n,s,o),Xn.set(a,c)),c(r,i)}function qf(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="event")}function Gl(e){const{signature:t}=e;let n;return qf(t)?n=t:n=Je(t),{abiEvent:n,hash:nn(n),topics:Qc({abi:[n],args:e.filters})}}function Hl(e){const{logs:t,events:n,strict:r}=e;return ku({abi:n.map(s=>s.abiEvent),logs:t,strict:r})}function ce(e,t={}){const{as:n=typeof e=="string"?"Hex":"Bytes"}=t,r=kr(fa(e));return n==="Bytes"?r:Yt(r)}class Jf 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 Qf={checksum:new Jf(8192)},It=Qf.checksum,ed=/^0x[a-fA-F0-9]{40}$/;function dt(e,t={}){const{strict:n=!0}=t;if(!ed.test(e))throw new Rt({address:e,cause:new Ss});if(n){if(e.toLowerCase()===e)return;if(td(e)!==e)throw new Rt({address:e,cause:new rd})}}function td(e){if(It.has(e))return It.get(e);dt(e,{strict:!1});const t=e.substring(2).toLowerCase(),n=ce(qt(t),{as:"Bytes"}),r=t.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(n[i>>1]&15)>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return It.set(e,s),s}function nd(e,t={}){const{strict:n=!0}=t??{};try{return dt(e,{strict:n}),!0}catch{return!1}}class Rt extends A{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 Ss extends A{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 rd extends A{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}const sd=/^(.*)\[([0-9]*)\]$/,Bs=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,cn=/^(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)?$/,Wl=2n**96n-1n;function id({checksumAddress:e,parameters:t,values:n}){const r=[];for(let s=0;s<t.length;s++)r.push(un({checksumAddress:e,parameter:t[s],value:n[s]}));return r}function un({checksumAddress:e=!1,parameter:t,value:n}){const r=t,s=hd(r.type);if(s){const[i,o]=s;return ad(n,{checksumAddress:e,length:i,parameter:{...r,type:o}})}if(r.type==="tuple")return ld(n,{checksumAddress:e,parameter:r});if(r.type==="address")return od(n,{checksum:e});if(r.type==="bool")return ud(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){const i=r.type.startsWith("int"),[,,o="256"]=cn.exec(r.type)??[];return fd(n,{signed:i,size:Number(o)})}if(r.type.startsWith("bytes"))return cd(n,{type:r.type});if(r.type==="string")return dd(n);throw new Us(r.type)}function fn(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=B(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(U(t+s,{size:32})),r.push(a),s+=B(a)):n.push(a)}return S(...n,...r)}function od(e,t){const{checksum:n=!1}=t;return dt(e,{strict:n}),{dynamic:!1,encoded:se(e.toLowerCase())}}function ad(e,t){const{checksumAddress:n,length:r,parameter:s}=t,i=r===null;if(!Array.isArray(e))throw new yd(e);if(!i&&e.length!==r)throw new pd({expectedLength:r,givenLength:e.length,type:`${s.type}[${r}]`});let o=!1;const a=[];for(let c=0;c<e.length;c++){const u=un({checksumAddress:n,parameter:s,value:e[c]});u.dynamic&&(o=!0),a.push(u)}if(i||o){const c=fn(a);if(i){const u=U(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?S(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:S(...a.map(({encoded:c})=>c))}}function cd(e,{type:t}){const[,n]=t.split("bytes"),r=B(e);if(!n){let s=e;return r%32!==0&&(s=ie(s,Math.ceil((e.length-2)/2/32)*32)),{dynamic:!0,encoded:S(se(U(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new Ls({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:ie(e)}}function ud(e){if(typeof e!="boolean")throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:se(Xt(e))}}function fd(e,{signed:t,size:n}){if(typeof n=="number"){const r=2n**(BigInt(n)-(t?1n:0n))-1n,s=t?-r-1n:0n;if(e>r||e<s)throw new Br({max:r.toString(),min:s.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:U(e,{size:32,signed:t})}}function dd(e){const t=nt(e),n=Math.ceil(B(t)/32),r=[];for(let s=0;s<n;s++)r.push(ie(_r(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:S(ie(U(B(t),{size:32})),...r)}}function ld(e,t){const{checksumAddress:n,parameter:r}=t;let s=!1;const i=[];for(let o=0;o<r.components.length;o++){const a=r.components[o],c=Array.isArray(e)?o:a.name,u=un({checksumAddress:n,parameter:a,value:e[c]});i.push(u),u.dynamic&&(s=!0)}return{dynamic:s,encoded:s?fn(i):S(...i.map(({encoded:o})=>o))}}function hd(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function Os(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Ms({expectedLength:e.length,givenLength:t.length});const s=id({checksumAddress:r,parameters:e,values:t}),i=fn(s);return i.length===0?"0x":i}function Gt(e,t){if(e.length!==t.length)throw new Ms({expectedLength:e.length,givenLength:t.length});const n=[];for(let r=0;r<e.length;r++){const s=e[r],i=t[r];n.push(Gt.encode(s,i))}return S(...n)}(function(e){function t(n,r,s=!1){if(n==="address"){const c=r;return dt(c),se(c.toLowerCase(),s?32:0)}if(n==="string")return nt(r);if(n==="bytes")return r;if(n==="bool")return se(Xt(r),s?32:1);const i=n.match(cn);if(i){const[c,u,f="256"]=i,d=Number.parseInt(f)/8;return U(r,{size:s?32:d,signed:u==="int"})}const o=n.match(Bs);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new Ls({expectedSize:Number.parseInt(u),value:r});return ie(r,s?32:0)}const a=n.match(sd);if(a&&Array.isArray(r)){const[c,u]=a,f=[];for(let d=0;d<r.length;d++)f.push(t(u,r[d],!0));return f.length===0?"0x":S(...f)}throw new Us(n)}e.encode=t})(Gt||(Gt={}));class pd extends A{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 Ls=class extends A{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${B(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}};class Ms extends A{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding parameters/values length mismatch.",`Expected length (parameters): ${t}`,`Given length (values): ${n}`].join(`
|
|
19
|
+
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class yd extends A{constructor(t){super(`Value \`${t}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class Us extends A{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 md(e){const{domain:t,message:n,primaryType:r,types:s}=e,i=(o,a)=>{for(const c of o){const{name:u,type:f}=c,d=a[u],l=f.match(cn);if(l&&(typeof d=="number"||typeof d=="bigint")){const[,m,p]=l;U(d,{signed:m==="int",size:Number.parseInt(p??"")/8})}if(f==="address"&&typeof d=="string"&&!nd(d))throw new Rt({address:d,cause:new Ss});const h=f.match(Bs);if(h){const[,m]=h;if(m&&B(d)!==Number.parseInt(m))throw new $d({expectedSize:Number.parseInt(m),givenSize:B(d)})}const y=s[f];y&&(Id(f),i(y,d))}};if(s.EIP712Domain&&t){if(typeof t!="object")throw new Ad({domain:t});i(s.EIP712Domain,t)}if(r!=="EIP712Domain")if(s[r])i(s[r],n);else throw new Ed({primaryType:r,types:s})}function gd(e){const{primaryType:t,types:n}=e;let r="";const s=Fs({primaryType:t,types:n});s.delete(t);const i=[t,...Array.from(s).sort()];for(const o of i)r+=`${o}(${(n[o]??[]).map(({name:a,type:c})=>`${c} ${a}`).join(",")})`;return r}function zs(e){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function bd(e){const{domain:t,types:n}=e;return wd({data:t,primaryType:"EIP712Domain",types:{...n,EIP712Domain:(n==null?void 0:n.EIP712Domain)||zs(t)}})}function wd(e){const{data:t,primaryType:n,types:r}=e,s=Cs({data:t,primaryType:n,types:r});return ce(s)}function xd(e){try{return md(e),!0}catch{return!1}}class $d extends A{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 Ad extends A{constructor({domain:t}){super(`Invalid domain "${Pr(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TypedData.InvalidDomainError"})}}class Ed extends A{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 vd extends A{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 Cs(e){const{data:t,primaryType:n,types:r}=e,s=[{type:"bytes32"}],i=[Pd({primaryType:n,types:r})];for(const o of r[n]??[]){const[a,c]=ks({types:r,name:o.name,type:o.type,value:t[o.name]});s.push(a),i.push(c)}return Os(s,i)}function Pd(e){const{primaryType:t,types:n}=e,r=nt(gd({primaryType:t,types:n}));return ce(r)}function ks(e){let{types:t,name:n,type:r,value:s}=e;if(t[r]!==void 0)return[{type:"bytes32"},ce(Cs({data:s,primaryType:r,types:t}))];if(r==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},ce(s,{as:"Hex"})];if(r==="string")return[{type:"bytes32"},ce(qt(s),{as:"Hex"})];if(r.lastIndexOf("]")===r.length-1){const i=r.slice(0,r.lastIndexOf("[")),o=s.map(a=>ks({name:n,type:i,types:t,value:a}));return[{type:"bytes32"},ce(Os(o.map(([a])=>a),o.map(([,a])=>a)))]}return[{type:r},s]}function Fs(e,t=new Set){const{primaryType:n,types:r}=e,s=n.match(/^\w*/u),i=s==null?void 0:s[0];if(t.has(i)||r[i]===void 0)return t;t.add(i);for(const o of r[i])Fs({primaryType:o.type,types:r},t);return t}function Id(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new vd({type:e})}function Ue(e){return de(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=Td({params:e,values:t}),r=ln(n);return r.length===0?"0x":r}function Td({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(dn({param:e[r],value:t[r]}));return n}function dn({param:e,value:t}){const n=zd(e.type);if(n){const[r,s]=n;return Sd(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return Ud(t,{param:e});if(e.type==="address")return _d(t);if(e.type==="bool")return Od(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int");return Ld(t,{signed:r})}if(e.type.startsWith("bytes"))return Bd(t,{param:e});if(e.type==="string")return Md(t);throw new Error(`Unsupported parameter type: ${e.type}`)}function ln(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=Ue(a)}const n=[],r=[];let s=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(z(t+s,{size:32})),r.push(a),s+=Ue(a)):n.push(a)}return S(...n,...r)}function _d(e){if(e!==""&&e!==void 0&&!Jt(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:ue(e.toLowerCase())}}function Sd(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 s=!1;const i=[];for(let o=0;o<e.length;o++){const a=dn({param:n,value:e[o]});a.dynamic&&(s=!0),i.push(a)}if(r||s){const o=ln(i);if(r){const a=z(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?S(a,o):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:S(...i.map(({encoded:o})=>o))}}function Bd(e,{param:t}){const[,n]=t.type.split("bytes"),r=Ue(e);if(!n){let s=e;return r%32!==0&&(s=ue(s,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:S(ue(z(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new Error(`Invalid bytes${n} size: ${r}`);return{dynamic:!1,encoded:ue(e,{dir:"right"})}}function Od(e){return{dynamic:!1,encoded:ue(Nr(e))}}function Ld(e,{signed:t}){return{dynamic:!1,encoded:z(e,{signed:t,size:32})}}function Md(e){const t=it(e),n=Math.ceil(Ue(t)/32),r=[];for(let s=0;s<n;s++)r.push(ue(_r(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:S(ue(z(Ue(t),{size:32})),...r)}}function Ud(e,{param:t}){let n=!1;const r=[];for(let s=0;s<t.components.length;s++){const i=t.components[s],o=Array.isArray(e)?s:i.name,a=dn({param:i,value:e[o]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ln(r):S(...r.map(({encoded:s})=>s))}}function zd(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Tt=new Qe(4096);function te(e){const t=typeof e=="string"?e:Z(e);if(Tt.has(t))return Tt.get(t);const n=typeof e=="string"?Je(e):e,s=[an(n),n.inputs,n.outputs];return Tt.set(t,s),s}function Ns(e){return!!(e&&typeof e=="object"&&"type"in e&&e.type==="function")}async function lt(e){const{contract:t,method:n,params:r}=e,s=async()=>{var d,l;if(Array.isArray(n))return n;if(Ns(n))return te(n);if(typeof n=="function")return te(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const h=Je(n);if(h.type==="function")return te(h);throw new Error('"method" passed is not of type "function"')}if(t.abi&&((d=t.abi)==null?void 0:d.length)>0){const h=(l=t.abi)==null?void 0:l.find(y=>y.type==="function"&&y.name===n);if(h)return te(h)}throw new Error(`Could not resolve method "${n}".`)},[i,o]=await Promise.all([s(),typeof r=="function"?r():r]);let a;i[1].length===0?a=i[0]:a=i[0]+he(i[1],o).slice(2);const c=oe({chain:t.chain,client:t.client}),u=await kf(c,{data:a,from:e.from?D(e.from):void 0,to:t.address}),f=ft(i[2],u);return Array.isArray(f)&&f.length===1?f[0]:f}const hn=Object.freeze(Object.defineProperty({__proto__:null,readContract:lt},Symbol.toStringTag,{value:"Module"})),Cd="0x313ce567",kd=[],Fd=[{type:"uint8"}];async function Nd(e){return lt({contract:e.contract,method:[Cd,kd,Fd],params:[]})}async function Dd(e){return et(()=>Nd(e),{cacheKey:`${e.contract.chain.id}:${e.contract.address}:decimals`,cacheTime:Number.POSITIVE_INFINITY})}const Kl=Object.freeze(Object.defineProperty({__proto__:null,decimals:Dd},Symbol.toStringTag,{value:"Module"}));function jd(e){const t=new Set;let n=e;const r=()=>{for(const s of t)s()};return{getValue(){return n},setValue(s){s!==n&&(n=s,r())},subscribe(s){return t.add(s),()=>{t.delete(s)}}}}const Ht=new Map;function Rd(e){const t=Ht.get(e);if(t)return t;const n=jd([]);return Ht.set(e,n),n}function Gd(e){const{address:t,transactionHash:n,chainId:r}=e,s=Rd(t);s.setValue([...s.getValue(),{chainId:r,transactionHash:n}]),Ht.set(t,s)}async function Hd(e){let{account:t,transaction:n,gasless:r}=e;if(t.onTransactionRequested&&await t.onTransactionRequested(n),n.eip712){const{sendEip712Transaction:o}=await _(async()=>{const{sendEip712Transaction:a}=await import("./send-eip712-transaction-r2PbPkaQ.js").then(c=>c.a);return{sendEip712Transaction:a}},[]);return o({account:t,transaction:n})}const s=await Uf({from:t,transaction:n});if(r){const{sendGaslessTransaction:o}=await _(async()=>{const{sendGaslessTransaction:a}=await import("./send-gasless-transaction-D5QodABW.js");return{sendGaslessTransaction:a}},[]);return o({account:t,gasless:r,serializableTransaction:s,transaction:n})}const i=await t.sendTransaction(s);return Gd({address:t.address,chainId:n.chain.id,transactionHash:i.transactionHash}),{...i,chain:n.chain,client:n.client}}const Wd=100,je=new Map;function Vd(e){const{transactionHash:t,chain:n,client:r}=e,i=`${n.id}:tx_${t}`,o=e.maxBlocksWaitTime??Wd;if(je.has(i))return je.get(i);const a=new Promise((c,u)=>{t||u(new Error("Transaction has no transactionHash to wait for, did you execute it?"));const f=oe({chain:n,client:r});let d=-1;const l=Yf({chain:n,client:r,onNewBlockNumber:async()=>{if(d++,d>=o){l(),u(new Error(`Transaction receipt for ${t} not found after ${o} blocks`));return}try{const h=await Gf(f,{hash:t});l(),c(h)}catch{}}})}).finally(()=>{je.delete(i)});return je.set(i,a),a}async function Zl(e){const t=await Hd(e);return Vd(t)}async function Xl(e){const{account:t,transactions:n}=e;if(!t)throw new Error("not connected");if(n.length===0)throw new Error("No transactions to send");const r=n[0];if(!r)throw new Error("No transactions to send");if(t.sendBatchTransaction){const s=await Promise.all(n.map(async o=>{const[a,c,u,f]=await Promise.all([Ce(o),I(o.to),I(o.accessList),I(o.value)]);return{accessList:u,chainId:o.chain.id,data:a,to:c,value:f}}));return{...await t.sendBatchTransaction(s),chain:r.chain,client:r.client}}throw new Error("Account doesn't implement sendBatchTransaction")}function Kd(e,t){return t&&(e.__preparedMethod=t.preparedMethod,e.__contract=t.contract),e}function pn(e){const{contract:t,method:n,params:r,...s}=e,i=()=>(async()=>{var o,a;if(Array.isArray(n))return n;if(Ns(n))return te(n);if(typeof n=="function")return te(await n(t));if(typeof n=="string"&&n.startsWith("function ")){const c=Je(n);if(c.type==="function")return te(c);throw new Error('"method" passed is not of type "function"')}if(t.abi&&((o=t.abi)==null?void 0:o.length)>0){const c=(a=t.abi)==null?void 0:a.find(u=>u.type==="function"&&u.name===n);if(c)return te(c)}throw new Error(`Could not resolve method "${n}".`)})();return Kd({...s,chain:t.chain,client:t.client,data:async()=>{let o;return Array.isArray(n)?o=n:o=await i(),o[1].length===0?o[0]:o[0]+he(o[1],await I(r??[])).slice(2)},to:t.address},{contract:t,preparedMethod:i})}function Ds(e){return S(...e)}const Zd=Object.freeze(Object.defineProperty({__proto__:null,concatHex:Ds},Symbol.toStringTag,{value:"Module"})),Xd="0x1626ba7e",Yd=[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],qd=[{type:"bytes4"}];async function Jd(e){return lt({contract:e.contract,method:[Xd,Yd,qd],params:[e.hash,e.signature]})}const Re=new WeakMap;function Qd(e){if(Re.has(e))return Re.get(e);const t=(async()=>{const n=oe(e),r=await Df(n,{address:e.address,blockTag:"latest"});return r==="0x"&&Re.delete(e),r})();return Re.set(e,t),t}const Yn=new WeakSet;async function js(e){if(Yn.has(e))return!0;const n=await Qd(e)!=="0x";return n&&Yn.add(e),n}const el="0x6492649264926492649264926492649264926492649264926492649264926492";function Rs({address:e,data:t,signature:n}){return Ds([he([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,t,n]),el])}const tl="0x1626ba7e";async function Gs({hash:e,signature:t,contract:n}){try{return await Jd({contract:n,hash:e,signature:t})===tl}catch(r){return console.error("Error verifying EIP-1271 signature",r),!1}}const nl=`Ethereum Signed Message:
|
|
20
20
|
`;function rl(e,t){const n=typeof e=="string"?Be(e):e.raw instanceof Uint8Array?e.raw:wa(e.raw),r=Be(`${nl}${n.length}`);return V(Lr(r,n),t)}function sl(e){const{domain:t={},message:n,primaryType:r}=e,s={EIP712Domain:zs(t),...e.types};xd({domain:t,message:n,primaryType:r,types:s});const i=["0x1901"];if(t&&i.push(bd({domain:t,types:s})),r!=="EIP712Domain"){const o=(()=>{const a=Hs({data:n,primaryType:r,types:s});return V(a)})();i.push(o)}return V(Lr(...i.map(o=>$e(o))))}function Hs({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],s=[il({primaryType:t,types:n})];if(!n[t])throw new Error("Invalid types");for(const i of n[t]){const[o,a]=Vs({name:i.name,type:i.type,types:n,value:e[i.name]});r.push(o),s.push(a)}return he(r,s)}function il({primaryType:e,types:t}){const n=Dr(ol({primaryType:e,types:t}));return V(n)}function ol({primaryType:e,types:t}){let n="";const r=Ws({primaryType:e,types:t});r.delete(e);const s=[e,...Array.from(r).sort()];for(const i of s){if(!t[i])throw new Error("Invalid types");n+=`${i}(${t[i].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`}return n}function Ws({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),s=r==null?void 0:r[0];if(n.has(s)||t[s]===void 0)return n;n.add(s);for(const i of t[s])Ws({primaryType:i.type,types:t},n);return n}function Vs({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},V(Hs({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},V(r)];if(n==="string")return[{type:"bytes32"},V(Dr(r))];if(n.lastIndexOf("]")===n.length-1){const s=n.slice(0,n.lastIndexOf("[")),i=r.map(o=>Vs({name:t,type:s,types:e,value:o}));return[{type:"bytes32"},V(he(i.map(([o])=>o),i.map(([,o])=>o)))]}return[{type:n},r]}const Yl="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",al="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",cl="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",Ks="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",ul="0x0000000071727De22E5E9d8BAf0edAc6f37da032",ql=50000n,Jl=e=>fl(e||Ks)==="v0.7"?cl:al,Ql=e=>{const t=xe().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${e.id}`:`https://${e.id}.${t}/v2`},fl=e=>{const t=D(e);if(t===Ks)return"v0.6";if(t===ul)return"v0.7";throw new Error("Unknown paymaster version")};async function eh(e){const{factoryContract:t,predictAddressOverride:n,adminAddress:r,accountSalt:s,accountAddress:i}=e;if(n)return n(t,r);if(i)return i;if(!r)throw new Error("Account address is required to predict the smart wallet address.");return et(async()=>{const o=s&&de(s)?s:it(s??"");let a,c=0;const u=3;for(;c<=u;)try{a=await lt({contract:t,method:"function getAddress(address, bytes) returns (address)",params:[r,o]});break}catch(f){if(c===u)throw f;const d=2**(c+1)*200;await new Promise(l=>setTimeout(l,d)),c++}if(!a)throw new Error(`No smart account address found for admin address ${r} and salt ${s}`);return a},{cacheKey:`${e.factoryContract.chain.id}-${e.factoryContract.address}-${e.adminAddress}-${e.accountSalt}`,cacheTime:1e3*60*60*24})}function Zs(e){const{adminAddress:t,factoryContract:n,createAccountOverride:r,accountSalt:s}=e;if(r)return r(n,t);const i=s&&de(s)?s:it(s??"");return pn({contract:n,method:"function createAccount(address, bytes) returns (address)",params:[t,i]})}function th(e){const{accountContract:t,transaction:n,executeOverride:r}=e;if(r)return r(t,n);let s=n.value||0n;return(n.chainId===295||n.chainId===296)&&(s=BigInt(s)/BigInt(10**10)),pn({contract:t,gas:n.gas?n.gas+21000n:void 0,method:"function execute(address, uint256, bytes)",params:[n.to||"",s,n.data||"0x"]})}function nh(e){var o;const{accountContract:t,transactions:n,executeBatchOverride:r}=e;if(r)return r(t,n);let s=n.map(a=>a.value||0n);const i=(o=n[0])==null?void 0:o.chainId;return(i===295||i===296)&&(s=s.map(a=>BigInt(a)/BigInt(10**10))),pn({contract:t,method:"function executeBatch(address[], uint256[], bytes[])",params:[n.map(a=>a.to||""),s,n.map(a=>a.data||"0x")]})}async function dl({accountContract:e,factoryContract:t,options:n,message:r}){var c,u;const s=rl(r);let i;const o=he([{type:"bytes32"}],[s]);if(i=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 js(e)){if(await Gs({contract:e,hash:s,signature:i}))return i;throw new Error("Failed to verify signature")}else{const f=Zs({accountSalt:(c=n.overrides)==null?void 0:c.accountSalt,adminAddress:n.personalAccount.address,createAccountOverride:(u=n.overrides)==null?void 0:u.createAccount,factoryContract:t});if(!f)throw new Error("Create account override not provided");const d=await Ce(f);return Rs({address:t.address,data:d,signature:i})}}async function ll({accountContract:e,factoryContract:t,options:n,typedData:r}){var u,f,d,l,h;if(((f=(u=r.domain)==null?void 0:u.verifyingContract)==null?void 0:f.toLowerCase())===((d=e.address)==null?void 0:d.toLowerCase()))return n.personalAccount.signTypedData(r);const i=sl(r);let o;const a=he([{type:"bytes32"}],[i]);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 js(e)){if(await Gs({contract:e,hash:i,signature:o}))return o;throw new Error("Failed to verify signature")}else{const y=Zs({accountSalt:(l=n.overrides)==null?void 0:l.accountSalt,adminAddress:n.personalAccount.address,createAccountOverride:(h=n.overrides)==null?void 0:h.createAccount,factoryContract:t});if(!y)throw new Error("Create account override not provided");const m=await Ce(y);return Rs({address:t.address,data:m,signature:o})}}const rh=Object.freeze(Object.defineProperty({__proto__:null,smartAccountSignMessage:dl,smartAccountSignTypedData:ll},Symbol.toStringTag,{value:"Module"}));export{le as $,Rl as A,Uf as B,I as C,Ds as D,Ul as E,Ce as F,at as G,$a as H,Gl as I,Ql as J,ze as K,Qe as L,Ks as M,Hl as N,pu as O,rt as P,ql as Q,jo as R,pn as S,Ro as T,et as U,As as V,zl as W,js as X,be as Y,Bl as Z,_,pl as a,Jr as a0,fl as a1,xr as a2,vs as a3,Zs as a4,he as a5,Wl as a6,Yl as a7,ul as a8,af as a9,Jl as aa,eh as ab,Hd as ac,kl as ad,th as ae,nh as af,cf as ag,df as ah,vo as ai,j as aj,Hf as ak,xe as al,_l as am,xl as an,ri as ao,yl as ap,mi as aq,wl as ar,Sl as as,Ps as at,Go as au,Cl as av,Dl as aw,Rf as ax,Kl as ay,rh as az,oe as b,hl as c,Zl as d,Gf as e,lt as f,Xs as g,Gd as h,Z as i,de as j,Ga as k,Gc as l,D as m,V as n,Qd as o,ni as p,Jt as q,Nl as r,Xl as s,sa as t,jl as u,oa as v,Vd as w,st as x,Dr as y,Fl as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as m,l as f,m as p}from"./index-
|
|
1
|
+
import{n as m,l as f,m as p}from"./index-B9UUiyKL.js";import{c as a}from"./index-BhSeVHFe.js";import"./index-DZ2wXCdh.js";import"./thirdweb-B-X7D-t-.js";import"./NetworkUtil-CvtSu_eG.js";import"./index-D1OjZdjf.js";import"./ui-C5Ikwo9e.js";import"./vendor-Jqid35Oh.js";import"./index-6CnJE0NG.js";import"./if-defined-DioxnqPs.js";import"./index-LUkRNy8f.js";import"./index-B9ppq8lv.js";import"./index-CwOidauV.js";const d=m`
|
|
2
2
|
:host > wui-flex:first-child {
|
|
3
3
|
height: 500px;
|
|
4
4
|
overflow-y: auto;
|