@dcl/auth-site 4.11.9 → 4.11.10-22674067433.commit-ec9ee87
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-BAOMwrjB.js → ConstantsUtil-ESae-Z7-.js} +1 -1
- package/assets/{ContentfulRichText-BVJInl_X.js → ContentfulRichText-BtJfWm5x.js} +1 -1
- package/assets/{ExchangeController-CE1-qDFM.js → ExchangeController-IT3Dhd87.js} +1 -1
- package/assets/{HelpersUtil-p_2TOprz.js → HelpersUtil-DSNS5n-9.js} +1 -1
- package/assets/{NetworkUtil-ALrBtqvF.js → NetworkUtil-BCvAceLL.js} +1 -1
- package/assets/{SwapController-BmfRgnRE.js → SwapController-yDy01m5V.js} +1 -1
- package/assets/{biconomy-ZuBpxB_Z.js → biconomy-B599Ur_0.js} +1 -1
- package/assets/{ccip-zer9BVQd.js → ccip-_ZVU0YUG.js} +1 -1
- package/assets/{data-capture-DXFbD_2X.js → data-capture-CzsW3pB7.js} +1 -1
- package/assets/{email-CZZgeDwu.js → email-DWs9f9tH.js} +1 -1
- package/assets/{embedded-wallet-DhhuHH_S.js → embedded-wallet-P7U24FrG.js} +1 -1
- package/assets/{engine-ML4Qg8j7.js → engine-DAuziGro.js} +1 -1
- package/assets/{extractIPFS-6rL7YbLD.js → extractIPFS-DgGO_4eF.js} +1 -1
- package/assets/{features-oA675acZ.js → features--CaJUF7o.js} +1 -1
- package/assets/{fortmatic-D9QgSvQy.js → fortmatic-BouPZqQI.js} +1 -1
- package/assets/{getInstalledModules-u4tfyC0o.js → getInstalledModules-Bdsr8t_C.js} +1 -1
- package/assets/{if-defined-DEgQ1z7T.js → if-defined-2xQLKahR.js} +1 -1
- package/assets/{in-app-wallet-calls-3yC4gf2W.js → in-app-wallet-calls-D8l_xpYN.js} +1 -1
- package/assets/{index-BWB9yu1D.js → index-B9z9f635.js} +1 -1
- package/assets/{index-DiQ5FwKy.js → index-BIUEtDdG.js} +1 -1
- package/assets/{index-BQep68a1.js → index-BQsAkTBu.js} +1 -1
- package/assets/{index-BlSibOdP.js → index-BsWozatx.js} +1 -1
- package/assets/{index-B-NFA50q.js → index-Bv3VmA8e.js} +1 -1
- package/assets/{index-CJclPiJ6.js → index-C0hHgKRI.js} +1 -1
- package/assets/index-CA6Zy4Du.js +7 -0
- package/assets/{index-CN9hvq_d.js → index-CO5QKdxX.js} +1 -1
- package/assets/{index-9g7rK-S6.js → index-CPXKpbtw.js} +1 -1
- package/assets/{index-1Iyc_zW4.js → index-CQzRvO-C.js} +1 -1
- package/assets/{index-NeSzI640.js → index-CRA7VI9s.js} +1 -1
- package/assets/{index-BlHvjgXX.js → index-CRvDhax9.js} +1 -1
- package/assets/{index-BvpsDGXr.js → index-CUEaPFt-.js} +1 -1
- package/assets/{index-J7JPwLFu.js → index-CzHm4Ry3.js} +1 -1
- package/assets/{index-BYIDeuBS.js → index-CziCm94K.js} +1 -1
- package/assets/{index-DNU17x7j.js → index-D0cHggih.js} +1 -1
- package/assets/{index-d8qb3Bh1.js → index-D8AVDivV.js} +2 -2
- package/assets/{index-BIJ1HLK-.js → index-D9rT-G2z.js} +1 -1
- package/assets/{index-BkcXrz6w.js → index-DAoSp5q5.js} +1 -1
- package/assets/{index-CQfPnCB_.js → index-DIWcFA1F.js} +1 -1
- package/assets/{index-BXROPBR7.js → index-DJO0bodJ.js} +1 -1
- package/assets/{index-BeesMvem.js → index-DPpJj3DF.js} +1 -1
- package/assets/{index-WrFUPUVy.js → index-DRQzckTJ.js} +1 -1
- package/assets/{index-SRfS2tv8.js → index-DUoxxqna.js} +1 -1
- package/assets/{index-B2ekOHvY.js → index-DdCktyEF.js} +1 -1
- package/assets/{index-DNjjhYA1.js → index-Dl7iro_s.js} +1 -1
- package/assets/{index-CKuTxBMO.js → index-DvSlA4j0.js} +1 -1
- package/assets/index-DvuTX_1c.css +1 -0
- package/assets/{index-CHQeOazc.js → index-EfYw_r-L.js} +1 -1
- package/assets/{index-Ctooc5wh.js → index-HAgxNzWE.js} +1 -1
- package/assets/{index-De3fN9bR.js → index-JH3zlM2a.js} +3 -3
- package/assets/{index-DUab044w.js → index-JRJx2NpU.js} +1 -1
- package/assets/{index-DmnoYEjg.js → index-L_5Cs_kx.js} +1 -1
- package/assets/{index-D-htLeKo.js → index-MkZbQyDw.js} +4 -4
- package/assets/{index-WSsT16vn.js → index-MubCrWiB.js} +1 -1
- package/assets/{index-C5PmOkdY.js → index-UvGAZXmw.js} +1 -1
- package/assets/{index-IqSw10Sq.js → index-VsMuUpAO.js} +1 -1
- package/assets/{index-DUps-fXR.js → index-fG1WBhYz.js} +75 -75
- package/assets/{index-BjSGFaos.js → index-gcHRu1bF.js} +1 -1
- package/assets/{index-CDnwRYv4.js → index-jq6mMx3J.js} +1 -1
- package/assets/{index-CnUxTVea.js → index-ppPPH70g.js} +1 -1
- package/assets/{index-DCbuXsQl.js → index-vWAYjUUv.js} +1 -1
- package/assets/{index-Bh39Rbc1.js → index-xFdcXlRb.js} +1 -1
- package/assets/{networks-4rOVWxZC.js → networks-ZUADr5kB.js} +1 -1
- package/assets/{onramp-B98BEEIV.js → onramp-WAW9ejhZ.js} +1 -1
- package/assets/{openzeppelin-C09JYzFS.js → openzeppelin-DV82z7lJ.js} +1 -1
- package/assets/{parse-typed-data-Dy_RpQ65.js → parse-typed-data-8DIRR0Kb.js} +1 -1
- package/assets/{passkeys-CNW9UJaY.js → passkeys-BOJeUfAK.js} +1 -1
- package/assets/{pay-with-exchange-BGiQrnrX.js → pay-with-exchange-CNJhpLnE.js} +1 -1
- package/assets/{receive-Di7H3bRQ.js → receive-ss1HRI3I.js} +1 -1
- package/assets/{ref-Cs6aE0Nw.js → ref-CoyvS0l-.js} +1 -1
- package/assets/{resolveImplementation-BfuFbByz.js → resolveImplementation-C5lycJfC.js} +1 -1
- package/assets/{secp256k1-DTiizT7F.js → secp256k1-DW9CEMKa.js} +1 -1
- package/assets/{send-DGqbyS5L.js → send-C4Og1BUJ.js} +1 -1
- package/assets/{send-eip712-transaction-QgwzVlIl.js → send-eip712-transaction-C2PvhNcm.js} +1 -1
- package/assets/{send-gasless-transaction-DuSgxy0D.js → send-gasless-transaction-DIQuGEL1.js} +2 -2
- package/assets/{socials-BUpY92PE.js → socials-C7aTr6Px.js} +1 -1
- package/assets/{swaps-CwZrlZRn.js → swaps-BDatuUE1.js} +1 -1
- package/assets/{thirdweb-3rz-wQc6.js → thirdweb-juEAwwxR.js} +3 -3
- package/assets/{transactions-VHmPOc8T.js → transactions-Do481Xcb.js} +1 -1
- package/assets/ui-BsoeejM4.js +762 -0
- package/assets/{vendor-BlWFaBbX.js → vendor-C-guZ9WP.js} +1 -1
- package/assets/{w3m-modal-Daox802n.js → w3m-modal-Cj2A1qC_.js} +1 -1
- package/assets/{web-connector-BzT9ZilO.js → web-connector-DIFP2_dO.js} +3 -3
- package/index.html +5 -5
- package/package.json +3 -3
- package/assets/index-BIOPw-dr.css +0 -1
- package/assets/index-DiDUF14O.js +0 -21
- package/assets/ui-BRI7cdA1.js +0 -741
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const Vs="modulepreload",Ks=function(e){return"https://cdn.decentraland.org/@dcl/auth-site/4.11.9/"+e},yn={},S=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Ks(c),c in yn)return;yn[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Vs,u||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),u)return new Promise((l,h)=>{f.addEventListener("load",l),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}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)})};var hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pl(e){if(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}function Xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qn={exports:{}},E=qn.exports={},F,N;function St(){throw new Error("setTimeout has not been defined")}function _t(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?F=setTimeout:F=St}catch{F=St}try{typeof clearTimeout=="function"?N=clearTimeout:N=_t}catch{N=_t}})();function Jn(e){if(F===setTimeout)return setTimeout(e,0);if((F===St||!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 Ys(e){if(N===clearTimeout)return clearTimeout(e);if((N===_t||!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,He=-1;function qs(){!pe||!ae||(pe=!1,ae.length?W=ae.concat(W):He=-1,W.length&&Qn())}function Qn(){if(!pe){var e=Jn(qs);pe=!0;for(var t=W.length;t;){for(ae=W,W=[];++He<t;)ae&&ae[He].run();He=-1,t=W.length}ae=null,pe=!1,Ys(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 Js=qn.exports;const Qs=Xs(Js);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ei(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function tr(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 Ge(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Wt(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Bt(e){if(!Array.isArray(e))throw new Error("array expected")}function We(e,t){if(!tr(!0,t))throw new Error(`${e}: array of strings expected`)}function ti(e,t){if(!tr(!1,t))throw new Error(`${e}: array of numbers expected`)}function ni(...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 ri(e){const t=typeof e=="string"?e.split(""):e,n=t.length;We("alphabet",t);const r=new Map(t.map((s,i)=>[s,i]));return{encode:s=>(Bt(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=>(Bt(s),s.map(i=>{Ge("alphabet.decode",i);const o=r.get(i);if(o===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return o}))}}function si(e=""){return Ge("join",e),{encode:t=>(We("join.decode",t),t.join(e)),decode:t=>(Ge("join.decode",t),t.split(e))}}function ii(e,t="="){return Wt(e),Ge("padding",t),{encode(n){for(We("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){We("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 nr=(e,t)=>t===0?e:nr(t,e%t),Ve=(e,t)=>e+(t-nr(e,t)),pt=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function mn(e,t,n,r){if(Bt(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(Ve(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Ve(t,n)}`);let s=0,i=0;const o=pt[t],a=pt[n]-1,c=[];for(const u of e){if(Wt(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 d=pt[i];if(d===void 0)throw new Error("invalid carry");s&=d-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 oi(e,t=!1){if(Wt(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Ve(8,e)>32||Ve(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!ei(n))throw new Error("radix2.encode input should be Uint8Array");return mn(Array.from(n),8,e,!t)},decode:n=>(ti("radix2.decode",n),Uint8Array.from(mn(n,e,8,t)))}}const yl=ni(oi(5),ri("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ii(5),si(""));var yt={exports:{}},gn;function ai(){return gn||(gn=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,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,f,l){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new s(d,f||c,l),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],h]:c._events[m].push(h):(c._events[m]=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=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var l=0,h=f.length,m=new Array(h);l<h;l++)m[l]=f[l].fn;return m},a.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},a.prototype.emit=function(u,d,f,l,h,m){var y=n?n+u:u;if(!this._events[y])return!1;var p=this._events[y],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,d),!0;case 3:return p.fn.call(p.context,d,f),!0;case 4:return p.fn.call(p.context,d,f,l),!0;case 5:return p.fn.call(p.context,d,f,l,h),!0;case 6:return p.fn.call(p.context,d,f,l,h,m),!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,d);break;case 3:p[w].fn.call(p[w].context,d,f);break;case 4:p[w].fn.call(p[w].context,d,f,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,d,f){return i(this,u,d,f,!1)},a.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},a.prototype.removeListener=function(u,d,f,l){var h=n?n+u:u;if(!this._events[h])return this;if(!d)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===d&&(!l||m.once)&&(!f||m.context===f)&&o(this,h);else{for(var y=0,p=[],x=m.length;y<x;y++)(m[y].fn!==d||l&&!m[y].once||f&&m[y].context!==f)&&p.push(m[y]);p.length?this._events[h]=p.length===1?p[0]:p:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(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}(yt)),yt.exports}function bn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ci(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qe(e,...t){if(!ci(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 Ke(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 rr(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 ui(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function mt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}const wn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function fi(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function xn(e){for(let t=0;t<e.length;t++)e[t]=fi(e[t])}const di=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",li=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ml(e){if(qe(e),di)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=li[e[n]];return t}function hi(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Vt(e){return typeof e=="string"&&(e=hi(e)),qe(e),e}let sr=class{clone(){return this._cloneInto()}};function ir(e){const t=r=>e().update(Vt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function pi(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 yi(e,t,n){return e&t^~e&n}function mi(e,t,n){return e&t^e&n^t&n}let gi=class extends sr{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=mt(this.buffer)}update(t){Ke(this);const{view:n,buffer:r,blockLen:s}=this;t=Vt(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=mt(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){Ke(this),rr(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 f=o;f<s;f++)n[f]=0;pi(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=mt(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,d[f],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 bi=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 wi=class extends gi{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 f=0;f<16;f++,n+=4)J[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const l=J[f-15],h=J[f-2],m=C(l,7)^C(l,18)^l>>>3,y=C(h,17)^C(h,19)^h>>>10;J[f]=y+J[f-7]+m+J[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const l=C(a,6)^C(a,11)^C(a,25),h=d+l+yi(a,c,u)+bi[f]+J[f]|0,y=(C(r,2)^C(r,13)^C(r,22))+mi(r,s,i)|0;d=u,u=c,c=a,a=o+h|0,o=i,i=s,s=r,r=h+y|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,d=d+this.H|0,this.set(r,s,i,o,a,c,u,d)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const xi=ir(()=>new wi);var $i=ai();const xl=Zs($i),Ai="1.0.8";let O=class Ot extends Error{constructor(t,n={}){var o;const r=n.cause instanceof Ot?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof Ot&&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@${Ai}`].join(`
|
|
1
|
+
const Vs="modulepreload",Ks=function(e){return"https://cdn.decentraland.org/@dcl/auth-site/4.11.10-22674067433.commit-ec9ee87/"+e},yn={},S=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),a=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Ks(c),c in yn)return;yn[c]=!0;const u=c.endsWith(".css"),d=u?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${d}`))return;const f=document.createElement("link");if(f.rel=u?"stylesheet":Vs,u||(f.as="script"),f.crossOrigin="",f.href=c,a&&f.setAttribute("nonce",a),document.head.appendChild(f),u)return new Promise((l,h)=>{f.addEventListener("load",l),f.addEventListener("error",()=>h(new Error(`Unable to preload CSS for ${c}`)))})}))}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)})};var hl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Zs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function pl(e){if(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}function Xs(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var qn={exports:{}},E=qn.exports={},F,N;function St(){throw new Error("setTimeout has not been defined")}function _t(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?F=setTimeout:F=St}catch{F=St}try{typeof clearTimeout=="function"?N=clearTimeout:N=_t}catch{N=_t}})();function Jn(e){if(F===setTimeout)return setTimeout(e,0);if((F===St||!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 Ys(e){if(N===clearTimeout)return clearTimeout(e);if((N===_t||!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,He=-1;function qs(){!pe||!ae||(pe=!1,ae.length?W=ae.concat(W):He=-1,W.length&&Qn())}function Qn(){if(!pe){var e=Jn(qs);pe=!0;for(var t=W.length;t;){for(ae=W,W=[];++He<t;)ae&&ae[He].run();He=-1,t=W.length}ae=null,pe=!1,Ys(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 Js=qn.exports;const Qs=Xs(Js);/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ei(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function tr(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 Ge(e,t){if(typeof t!="string")throw new Error(`${e}: string expected`);return!0}function Wt(e){if(!Number.isSafeInteger(e))throw new Error(`invalid integer: ${e}`)}function Bt(e){if(!Array.isArray(e))throw new Error("array expected")}function We(e,t){if(!tr(!0,t))throw new Error(`${e}: array of strings expected`)}function ti(e,t){if(!tr(!1,t))throw new Error(`${e}: array of numbers expected`)}function ni(...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 ri(e){const t=typeof e=="string"?e.split(""):e,n=t.length;We("alphabet",t);const r=new Map(t.map((s,i)=>[s,i]));return{encode:s=>(Bt(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=>(Bt(s),s.map(i=>{Ge("alphabet.decode",i);const o=r.get(i);if(o===void 0)throw new Error(`Unknown letter: "${i}". Allowed: ${e}`);return o}))}}function si(e=""){return Ge("join",e),{encode:t=>(We("join.decode",t),t.join(e)),decode:t=>(Ge("join.decode",t),t.split(e))}}function ii(e,t="="){return Wt(e),Ge("padding",t),{encode(n){for(We("padding.encode",n);n.length*e%8;)n.push(t);return n},decode(n){We("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 nr=(e,t)=>t===0?e:nr(t,e%t),Ve=(e,t)=>e+(t-nr(e,t)),pt=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function mn(e,t,n,r){if(Bt(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(Ve(t,n)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${n} carryBits=${Ve(t,n)}`);let s=0,i=0;const o=pt[t],a=pt[n]-1,c=[];for(const u of e){if(Wt(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 d=pt[i];if(d===void 0)throw new Error("invalid carry");s&=d-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 oi(e,t=!1){if(Wt(e),e<=0||e>32)throw new Error("radix2: bits should be in (0..32]");if(Ve(8,e)>32||Ve(e,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!ei(n))throw new Error("radix2.encode input should be Uint8Array");return mn(Array.from(n),8,e,!t)},decode:n=>(ti("radix2.decode",n),Uint8Array.from(mn(n,e,8,t)))}}const yl=ni(oi(5),ri("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),ii(5),si(""));var yt={exports:{}},gn;function ai(){return gn||(gn=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,d){this.fn=c,this.context=u,this.once=d||!1}function i(c,u,d,f,l){if(typeof d!="function")throw new TypeError("The listener must be a function");var h=new s(d,f||c,l),m=n?n+u:u;return c._events[m]?c._events[m].fn?c._events[m]=[c._events[m],h]:c._events[m].push(h):(c._events[m]=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=[],d,f;if(this._eventsCount===0)return u;for(f in d=this._events)t.call(d,f)&&u.push(n?f.slice(1):f);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(d)):u},a.prototype.listeners=function(u){var d=n?n+u:u,f=this._events[d];if(!f)return[];if(f.fn)return[f.fn];for(var l=0,h=f.length,m=new Array(h);l<h;l++)m[l]=f[l].fn;return m},a.prototype.listenerCount=function(u){var d=n?n+u:u,f=this._events[d];return f?f.fn?1:f.length:0},a.prototype.emit=function(u,d,f,l,h,m){var y=n?n+u:u;if(!this._events[y])return!1;var p=this._events[y],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,d),!0;case 3:return p.fn.call(p.context,d,f),!0;case 4:return p.fn.call(p.context,d,f,l),!0;case 5:return p.fn.call(p.context,d,f,l,h),!0;case 6:return p.fn.call(p.context,d,f,l,h,m),!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,d);break;case 3:p[w].fn.call(p[w].context,d,f);break;case 4:p[w].fn.call(p[w].context,d,f,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,d,f){return i(this,u,d,f,!1)},a.prototype.once=function(u,d,f){return i(this,u,d,f,!0)},a.prototype.removeListener=function(u,d,f,l){var h=n?n+u:u;if(!this._events[h])return this;if(!d)return o(this,h),this;var m=this._events[h];if(m.fn)m.fn===d&&(!l||m.once)&&(!f||m.context===f)&&o(this,h);else{for(var y=0,p=[],x=m.length;y<x;y++)(m[y].fn!==d||l&&!m[y].once||f&&m[y].context!==f)&&p.push(m[y]);p.length?this._events[h]=p.length===1?p[0]:p:o(this,h)}return this},a.prototype.removeAllListeners=function(u){var d;return u?(d=n?n+u:u,this._events[d]&&o(this,d)):(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}(yt)),yt.exports}function bn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function ci(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function qe(e,...t){if(!ci(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 Ke(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 rr(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 ui(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function mt(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}const wn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function fi(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function xn(e){for(let t=0;t<e.length;t++)e[t]=fi(e[t])}const di=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",li=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ml(e){if(qe(e),di)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=li[e[n]];return t}function hi(e){if(typeof e!="string")throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Vt(e){return typeof e=="string"&&(e=hi(e)),qe(e),e}let sr=class{clone(){return this._cloneInto()}};function ir(e){const t=r=>e().update(Vt(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function pi(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 yi(e,t,n){return e&t^~e&n}function mi(e,t,n){return e&t^e&n^t&n}let gi=class extends sr{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=mt(this.buffer)}update(t){Ke(this);const{view:n,buffer:r,blockLen:s}=this;t=Vt(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=mt(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){Ke(this),rr(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 f=o;f<s;f++)n[f]=0;pi(r,s-8,BigInt(this.length*8),i),this.process(r,0);const a=mt(t),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=c/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,d[f],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 bi=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 wi=class extends gi{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 f=0;f<16;f++,n+=4)J[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const l=J[f-15],h=J[f-2],m=C(l,7)^C(l,18)^l>>>3,y=C(h,17)^C(h,19)^h>>>10;J[f]=y+J[f-7]+m+J[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const l=C(a,6)^C(a,11)^C(a,25),h=d+l+yi(a,c,u)+bi[f]+J[f]|0,y=(C(r,2)^C(r,13)^C(r,22))+mi(r,s,i)|0;d=u,u=c,c=a,a=o+h|0,o=i,i=s,s=r,r=h+y|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,d=d+this.H|0,this.set(r,s,i,o,a,c,u,d)}roundClean(){J.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const xi=ir(()=>new wi);var $i=ai();const xl=Zs($i),Ai="1.0.8";let O=class Ot extends Error{constructor(t,n={}){var o;const r=n.cause instanceof Ot?n.cause.details:(o=n.cause)!=null&&o.message?n.cause.message:n.details,s=n.cause instanceof Ot&&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@${Ai}`].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 or=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ar=/^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)?$/,cr=/^\(.+?\).*?$/,$n=/^tuple(?<array>(\[(\d*)\])*)$/;function Lt(e){let t=e.type;if($n.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+=Lt(i),s<n-1&&(t+=", ")}const r=Y($n,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Lt({...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+=Lt(s),r!==n-1&&(t+=", ")}return t}function Ei(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 vi(e){const t=[],n=e.length;for(let r=0;r<n;r++){const s=e[r],i=Ei(s);t.push(i)}return t}const ur=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Pi(e){return ur.test(e)}function Ii(e){return Y(ur,e)}const fr=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ti(e){return fr.test(e)}function Si(e){return Y(fr,e)}const dr=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function _i(e){return dr.test(e)}function Bi(e){return Y(dr,e)}const lr=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Kt(e){return lr.test(e)}function Oi(e){return Y(lr,e)}const hr=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Li(e){return hr.test(e)}function Mi(e){return Y(hr,e)}const pr=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Ui(e){return pr.test(e)}function zi(e){return Y(pr,e)}const Ci=/^receive\(\) external payable$/;function ki(e){return Ci.test(e)}const Fi=new Set(["indexed"]),Mt=new Set(["calldata","memory","storage"]);class Ni 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 Di 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 Ri 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 ji extends O{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Hi 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 Gi 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 Wi 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 Vi 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 Ki extends O{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Zi 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 Xi 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 Yi 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 qi(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 gt=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 Ut(e,t={}){if(_i(e))return Ji(e,t);if(Ti(e))return Qi(e,t);if(Pi(e))return eo(e,t);if(Li(e))return to(e,t);if(Ui(e))return no(e);if(ki(e))return{type:"receive",stateMutability:"payable"};throw new Ki({signature:e})}function Ji(e,t={}){const n=Bi(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:Mt,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:Mt,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:s,outputs:o}}function Qi(e,t={}){const n=Si(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:Fi,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:s}}function eo(e,t={}){const n=Ii(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 to(e,t={}){const n=Mi(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 no(e){const t=zi(e);if(!t)throw new we({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const ro=/^(?<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$_]*))?$/,so=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,io=/^u?int$/;function fe(e,t){var f,l;const n=qi(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(gt.has(n))return gt.get(n);const r=cr.test(e),s=Y(r?so:ro,e);if(!s)throw new ji({param:e});if(s.name&&ao(s.name))throw new Hi({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),m=[],y=h.length;for(let p=0;p<y;p++)m.push(fe(h[p],{structs:a}));u={components:m}}else if(s.type in a)c="tuple",u={components:a[s.type]};else if(io.test(s.type))c=`${s.type}256`;else if(c=s.type,(t==null?void 0:t.type)!=="struct"&&!yr(c))throw new Ri({type:c});if(s.modifier){if(!((l=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&l.call(f,s.modifier)))throw new Gi({param:e,type:t==null?void 0:t.type,modifier:s.modifier});if(Mt.has(s.modifier)&&!co(c,!!s.array))throw new Wi({param:e,type:t==null?void 0:t.type,modifier:s.modifier})}const d={type:`${c}${s.array??""}`,...i,...o,...u};return gt.set(n,d),d}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 Yi({current:n,depth:r});return t.push(n.trim()),t}function yr(e){return e==="address"||e==="bool"||e==="function"||e==="string"||or.test(e)||ar.test(e)}const oo=/^(?: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 ao(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||or.test(e)||ar.test(e)||oo.test(e)}function co(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function mr(e){const t={},n=e.length;for(let o=0;o<n;o++){const a=e[o];if(!Kt(a))continue;const c=Oi(a);if(!c)throw new we({signature:a,type:"struct"});const u=c.properties.split(";"),d=[],f=u.length;for(let l=0;l<f;l++){const m=u[l].trim();if(!m)continue;const y=fe(m,{type:"struct"});d.push(y)}if(!d.length)throw new Zi({signature:a});t[c.name]=d}const r={},s=Object.entries(t),i=s.length;for(let o=0;o<i;o++){const[a,c]=s[o];r[a]=gr(c,t)}return r}const uo=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function gr(e,t,n=new Set){const r=[],s=e.length;for(let i=0;i<s;i++){const o=e[i];if(cr.test(o.type))r.push(o);else{const c=Y(uo,o.type);if(!(c!=null&&c.type))throw new Vi({abiParameter:o});const{array:u,type:d}=c;if(d in t){if(n.has(d))throw new Xi({type:d});r.push({...o,type:`tuple${u??""}`,components:gr(t[d]??[],t,new Set([...n,d]))})}else if(yr(d))r.push(o);else throw new Di({type:d})}}return r}function fo(e){const t=mr(e),n=[],r=e.length;for(let s=0;s<r;s++){const i=e[s];Kt(i)||n.push(Ut(i,t))}return n}function Je(e){let t;if(typeof e=="string")t=Ut(e);else{const n=mr(e),r=e.length;for(let s=0;s<r;s++){const i=e[s];if(!Kt(i)){t=Ut(i,n);break}}}if(!t)throw new Ni({signature:e});return t}const br="rpc.thirdweb.com",lo="social.thirdweb.com",ho="embedded-wallet.thirdweb.com",po="pay.thirdweb.com",yo="storage.thirdweb.com",mo="bundler.thirdweb.com",go="c.thirdweb.com",bo="insight.thirdweb.com",wo="engine.thirdweb.com",xo="bridge.thirdweb.com";let wr={analytics:go,bridge:xo,bundler:mo,engineCloud:wo,inAppWallet:ho,insight:bo,pay:po,rpc:br,social:lo,storage:yo};const xe=()=>wr,$o=e=>{const t=wr[e];return t.startsWith("localhost")?`http://${t}`:`https://${t}`},Ao="5.116.1";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 Eo(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?"mobile":typeof navigator<"u"?"browser":"node"}function vo(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 Po={};const Io=typeof Qs<"u"&&Po&&!1,To=6e4;function ze(e,t){async function n(r,s){const{requestTimeoutMs:i=To,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,m=e.clientId;l&&Oo(u)?(c.set("authorization",`Bearer ${l}`),e.teamId&&c.set("x-team-id",e.teamId),m&&c.set("x-client-id",m)):l&&!_o(u)&&!Bo(u)?(c.set("authorization",`Bearer ${l}`),e.teamId&&c.set("x-team-id",e.teamId)):(h&&c.set("x-secret-key",h),m&&c.set("x-client-id",m)),t&&(c.set("x-ecosystem-id",t.id),t.partnerId&&c.set("x-ecosystem-partner-id",t.partnerId));for(const[y,p]of Mo())c.set(y,p)}let d,f;return i&&(d=new AbortController,f=setTimeout(()=>{d==null||d.abort("timeout")},i)),fetch(r,{...a,headers:c,signal:d==null?void 0:d.signal}).finally(()=>{f&&clearTimeout(f)})}return n}const So=[".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=So.some(r=>t.endsWith(r));return ke.set(e,n),n}catch{return ke.set(e,!1),!1}}function _o(e){try{const{hostname:t}=new URL(e);return t.startsWith("pay.")}catch{return!1}}function Bo(e){try{const{hostname:t}=new URL(e);return t.startsWith("in-app-wallet.")||t.startsWith("embedded-wallet.")}catch{return!1}}function Oo(e){try{const{hostname:t}=new URL(e);return t.endsWith(".bundler.thirdweb.com")||t.endsWith(".bundler.thirdweb-dev.com")}catch{return!1}}const Lo="unified-sdk";let Fe;function Mo(){if(Fe)return Fe;let e=null;typeof navigator<"u"&&(e=vo(navigator.userAgent));let t;return typeof globalThis<"u"&&"Application"in globalThis&&(t=globalThis.Application.applicationId),Fe=Object.entries({"x-sdk-name":Lo,"x-sdk-os":e?Uo(e):"unknown","x-sdk-platform":Eo(),"x-sdk-version":Ao,...t?{"x-bundle-id":t}:{}}),Fe}function Uo(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 zo=new Map,Co=new Map;function ko(e){const t=(s,i)=>({clear:()=>i.delete(s),get:()=>i.get(s),set:o=>i.set(s,o)}),n=t(e,zo),r=t(e,Co);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function et(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=ko(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 _e=new Map;function Fo(e){const t=xe().rpc;if(typeof e=="number")return{id:e,rpc:`https://${e}.${t}`};if(jo(e))return Ar(e);if(Ro(e))return $r(e);let n=e.rpc;n||(n=`https://${e.id}.${t}`);const r={...e,rpc:n};return _e.set(e.id,r),r}function No(e){if(_e.has(e))return _e.get(e);const t=xe().rpc;return{id:e,rpc:`https://${e}.${t}`}}function Do(e){return _e.get(e)}function Ro(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 jo(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 Ho(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:5*60*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 Go=Object.freeze(Object.defineProperty({__proto__:null,CUSTOM_CHAIN_MAP:_e,convertLegacyChain:$r,convertViemChain:Ar,defineChain:Fo,getCachedChain:No,getCachedChainIfExists:Do,getChainMetadata:Ho,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 Wo="0.1.1";function Vo(){return Wo}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@${Vo()}`}),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 Ko="#__bigint";function Pr(e,t,n){return JSON.stringify(e,(r,s)=>typeof s=="bigint"?s.toString()+Ko:s,n)}function Zt(e,t){if(Tn(e)>t)throw new pa({givenSize:Tn(e),maxSize:t})}const H={zero:48,nine:57,A:65,F:70,a:97,f:102};function vn(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 Ir(e,t={}){const{dir:n,size:r=32}=t;if(r===0)return e;if(e.length>r)throw new ya({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 Zo(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 sa({givenSize:B(e),maxSize:t})}function Xo(e,t){if(typeof t=="number"&&t>0&&t>B(e)-1)throw new Or({offset:t,position:"start",size:B(e)})}function Yo(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 ia({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s[n==="right"?"padEnd":"padStart"](r*2,"0")}`}const qo=new TextEncoder,Jo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Qo(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 _(...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+=Jo[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(qo.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 Sr(e,t,n,r={}){const{strict:s}=r;Xo(e,t);const i=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Yo(i,t,n),i}function B(e){return Math.ceil((e.length-2)/2)}function _r(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 ea(e,t={}){return $e(e,t)}function ta(e,t={}){const{signed:n,size:r}=t;return Number(!n&&!r?e:_r(e,t))}function na(e,t={}){const{size:n}=t;let r=$e(e);return n&&(Zt(r,n),r=ha(r)),new TextDecoder().decode(r)}function ra(e,t={}){const{strict:n=!1}=t;try{return Qo(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 sa=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"})}},ia=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 oa=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 aa(e){return e instanceof Uint8Array?e:typeof e=="string"?$e(e):ca(e)}function ca(e){return e instanceof Uint8Array?e:new Uint8Array(e)}function ua(e,t={}){const{size:n}=t,r=new Uint8Array(1);return r[0]=Number(e),typeof n=="number"?(Zt(r,n),da(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++)),d=vn(s.charCodeAt(c++));if(u===void 0||d===void 0)throw new A(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=u*16+d}return o}function fa(e,t){const n=U(e,t);return $e(n)}function qt(e,t={}){const{size:n}=t,r=oa.encode(e);return typeof n=="number"?(Zt(r,n),la(r,n)):r}function da(e,t){return Ir(e,{dir:"left",size:t})}function la(e,t){return Ir(e,{dir:"right",size:t})}function Tn(e){return e.length}function ha(e){return Zo(e,{dir:"right"})}let pa=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"})}},ya=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 ra(e,t)}function ma(e,t={}){switch(typeof e){case"number":case"bigint":return wa(e,t);case"boolean":return ga(e,t);default:return de(e)?ba(e,t):Be(e,t)}}function ga(e,t={}){return ua(e,t)}function ba(e,t={}){return $e(e,t)}function wa(e,t){return fa(e,t)}function Be(e,t={}){return qt(e,t)}const Ne=BigInt(2**32-1),Sn=BigInt(32);function xa(e,t=!1){return t?{h:Number(e&Ne),l:Number(e>>Sn&Ne)}:{h:Number(e>>Sn&Ne)|0,l:Number(e&Ne)|0}}function $a(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}=xa(e[s],t);[n[s],r[s]]=[i,o]}return[n,r]}const Aa=(e,t,n)=>e<<n|t>>>32-n,Ea=(e,t,n)=>t<<n|e>>>32-n,va=(e,t,n)=>t<<n-32|e>>>64-n,Pa=(e,t,n)=>e<<n-32|t>>>64-n,Mr=[],Ur=[],zr=[],Ia=BigInt(0),ve=BigInt(1),Ta=BigInt(2),Sa=BigInt(7),_a=BigInt(256),Ba=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=Ia;for(let i=0;i<7;i++)t=(t<<ve^(t>>Sa)*Ba)%_a,t&Ta&&(s^=ve<<(ve<<BigInt(i))-ve);zr.push(s)}const[Oa,La]=$a(zr,!0),_n=(e,t,n)=>n>32?va(e,t,n):Aa(e,t,n),Bn=(e,t,n)=>n>32?Pa(e,t,n):Ea(e,t,n);function Ma(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=_n(u,d,1)^n[a],l=Bn(u,d,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=f,e[o+h+1]^=l}let s=e[2],i=e[3];for(let o=0;o<24;o++){const a=Ur[o],c=_n(s,i,a),u=Bn(s,i,a),d=Mr[o];s=e[d],i=e[d+1],e[d]=c,e[d+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=Oa[r],e[1]^=La[r]}n.fill(0)}let Ua=class Cr extends sr{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,bn(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=ui(this.state)}keccak(){wn||xn(this.state32),Ma(this.state32,this.rounds),wn||xn(this.state32),this.posOut=0,this.pos=0}update(t){Ke(this);const{blockLen:n,state:r}=this;t=Vt(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&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){Ke(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 bn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(rr(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 za=(e,t,n)=>ir(()=>new Ua(t,e,n)),kr=za(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 Sl(e,t={}){return na(e,t)}function rt(e,t={}){return _r(e,t)}function Ca(e,t={}){return ta(e,t)}function Fr(e,t={}){return ea(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 ka=/^0x[a-fA-F0-9]{40}$/,bt=new Qe(4096);function Jt(e){if(bt.has(e))return bt.get(e);const t=ka.test(e)&&(e.toLowerCase()===e||Rr(e)===e);return bt.set(e,t),t}function Rr(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 Rr(e)}function Fa(e,t){const n=xi(de(e,{strict:!1})?Fr(e):e);return st(n)}const wt=new Qe(4096);function Na(e){if(wt.has(e))return wt.get(e);const t=Fa(Be(e)).slice(2,34);return wt.set(e,t),t}function _l(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??Na(n);if(!s)throw new Error("clientId or secretKey must be provided");return{...r,clientId:s,secretKey:n}}const Bl="0x0000000000000000000000000000000000000000";function Da(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 Ra(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=Ra(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 ja(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 Qa(e.type);return`${e.name}(${ot(e.inputs,{includeName:t})})`}function ot(e,{includeName:t=!1}={}){return e?e.map(n=>Ha(n,{includeName:t})).join(t?", ":","):""}function Ha(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 jr="2.39.0";let Ie={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${jr}`};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=jr}walk(t){return Hr(this,t)}}function Hr(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Hr(e.cause,t):t?null:e}class Gr 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 @@ const Vs="modulepreload",Ks=function(e){return"https://cdn.decentraland.org/@dcl
|
|
|
15
15
|
`),{name:"InvalidArrayError"})}};class Qa extends b{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
16
16
|
`),{name:"InvalidDefinitionTypeError"})}}class ec 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}):tc(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 tc(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 nc 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 rc 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 j(e,{size:t}){if(T(e)>t)throw new rc({givenSize:T(e),maxSize:t})}function qr(e,t={}){const{signed:n}=t;t.size&&j(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 sc=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):R(e,t)}function Qr(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(j(n,{size:t.size}),le(n,{size:t.size})):n}function R(e,t={}){let n="";for(let s=0;s<e.length;s++)n+=sc[e[s]];const r=`0x${n}`;return typeof t.size=="number"?(j(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 ic=new TextEncoder;function es(e,t={}){const n=ic.encode(e);return R(n,t)}const oc=new TextEncoder;function re(e,t={}){return typeof e=="number"||typeof e=="bigint"?cc(e,t):typeof e=="boolean"?ac(e,t):Ae(e)?at(e,t):ts(e,t)}function ac(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(j(n,{size:t.size}),le(n,{size:t.size})):n}const G={zero:48,nine:57,A:65,F:70,a:97,f:102};function Mn(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 at(e,t={}){let n=e;t.size&&(j(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 cc(e,t){const n=P(e,t);return at(n)}function ts(e,t={}){const n=oc.encode(e);return typeof t.size=="number"?(j(n,{size:t.size}),le(n,{dir:"right",size:t.size})):n}const De=BigInt(2**32-1),Un=BigInt(32);function uc(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 fc(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}=uc(e[i],t);[r[i],s[i]]=[o,a]}return[r,s]}const dc=(e,t,n)=>e<<n|t>>>32-n,lc=(e,t,n)=>t<<n|e>>>32-n,hc=(e,t,n)=>t<<n-32|e>>>64-n,pc=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function yc(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(!yc(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 mc(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 gc=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function bc(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function wc(e){for(let t=0;t<e.length;t++)e[t]=bc(e[t]);return e}const Cn=gc?e=>e:wc;function xc(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=xc(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 $c=BigInt(0),Te=BigInt(1),Ac=BigInt(2),Ec=BigInt(7),vc=BigInt(256),Pc=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=$c;for(let i=0;i<7;i++)t=(t<<Te^(t>>Ec)*Pc)%vc,t&Ac&&(s^=Te<<(Te<<BigInt(i))-Te);as.push(s)}const cs=fc(as,!0),Ic=cs[0],Tc=cs[1],kn=(e,t,n)=>n>32?hc(e,t,n):dc(e,t,n),Fn=(e,t,n)=>n>32?pc(e,t,n):lc(e,t,n);function Sc(e,t=24){const n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=n[c],d=n[c+1],f=kn(u,d,1)^n[a],l=Fn(u,d,1)^n[a+1];for(let h=0;h<50;h+=10)e[o+h]^=f,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),d=is[o];s=e[d],i=e[d+1],e[d]=c,e[d+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=Ic[r],e[1]^=Tc[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=mc(this.state)}clone(){return this._cloneInto()}keccak(){Cn(this.state32),Sc(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&&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 _c=(e,t,n)=>ss(()=>new tn(t,e,n)),Bc=_c(1,136,256/8);function ct(e,t){const n=t||"hex",r=Bc(Ae(e,{strict:!1})?re(e):e);return n==="bytes"?r:Jr(r)}const Oc=e=>ct(re(e));function Lc(e){return Oc(e)}function Mc(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 Uc=e=>{const t=typeof e=="string"?e:ja(e);return Mc(t)};function nn(e){return Lc(Uc(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 zc=/^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=zc.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"?kc(e):Cc(e)}function Cc(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 kc(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Ye(e,t,n,{strict:r}={}){return Ae(e,{strict:!1})?Fc(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 Fc(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 Nc=/^(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 Dc(e,t){if(e.length!==t.length)throw new Va({expectedLength:e.length,givenLength:t.length});const n=Rc({params:e,values:t}),r=sn(n);return r.length===0?"0x":r}function Rc({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 Hc(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return Zc(t,{param:e});if(e.type==="address")return jc(t);if(e.type==="bool")return Wc(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int"),[,,s="256"]=Nc.exec(e.type)??[];return Vc(t,{signed:r,size:Number(s)})}if(e.type.startsWith("bytes"))return Gc(t,{param:e});if(e.type==="string")return Kc(t);throw new Ya(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 jc(e){if(!ge(e))throw new Nt({address:e});return{dynamic:!1,encoded:ne(e.toLowerCase())}}function Hc(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new Ja(e);if(!r&&e.length!==t)throw new Ga({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 Gc(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 Wa({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:ne(e,{dir:"right"})}}function Wc(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 Vc(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 Kc(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 Zc(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 Xc(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,d)=>{const f="inputs"in a&&a.inputs[d];return f?Dt(u,f):!1})){if(o&&"inputs"in o&&o.inputs){const u=ps(a.inputs,o.inputs,n);if(u)throw new Xa({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 Yc(e){var c;const{abi:t,eventName:n,args:r}=e;let s=t[0];if(n){const u=Xc({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(f=>"indexed"in f&&f.indexed),d=Array.isArray(r)?r:Object.values(r).length>0?(u==null?void 0:u.map(f=>r[f.name]))??[]:[];d.length>0&&(a=(u==null?void 0:u.map((f,l)=>Array.isArray(d[l])?d[l].map((h,m)=>Dn({param:f,value:d[l][m]})):typeof d[l]<"u"&&d[l]!==null?Dn({param:f,value:d[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 ec(e.type);return Dc([e],[t])}const qc={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Jc={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class Rn 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 Qc extends b{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}const eu={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 Qc({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 Rn({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 Rn({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(eu);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function tu(e,t={}){typeof t.size<"u"&&j(e,{size:t.size});const n=R(e,t);return qr(n,t)}function nu(e,t={}){let n=e;if(typeof t.size<"u"&&(j(n,{size:t.size}),n=Qt(n)),n.length>1||n[0]>1)throw new nc(n);return!!n[0]}function K(e,t={}){typeof t.size<"u"&&j(e,{size:t.size});const n=R(e,t);return Ze(n,t)}function ru(e,t={}){let n=e;return typeof t.size<"u"&&(j(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 Gr({data:typeof t=="string"?t:R(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 iu(e,{...t,type:i},{length:s,staticPosition:n})}if(t.type==="tuple")return uu(e,t,{staticPosition:n});if(t.type==="address")return su(e);if(t.type==="bool")return ou(e);if(t.type.startsWith("bytes"))return au(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return cu(e,t);if(t.type==="string")return fu(e,{staticPosition:n});throw new qa(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const jn=32,Rt=32;function su(e){const t=e.readBytes(32);return[fs(R(hs(t,-20))),32]}function iu(e,t,{length:n,staticPosition:r}){if(!n){const o=K(e.readBytes(Rt)),a=r+o,c=a+jn;e.setPosition(a);const u=K(e.readBytes(jn)),d=Me(t);let f=0;const l=[];for(let h=0;h<u;++h){e.setPosition(c+(d?h*32:f));const[m,y]=ye(e,t,{staticPosition:c});f+=y,l.push(m)}return e.setPosition(r+32),[l,32]}if(Me(t)){const o=K(e.readBytes(Rt)),a=r+o,c=[];for(let u=0;u<n;++u){e.setPosition(a+u*32);const[d]=ye(e,t,{staticPosition:a});c.push(d)}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 ou(e){return[nu(e.readBytes(32),{size:32}),32]}function au(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),[R(c),32]}return[R(e.readBytes(Number.parseInt(s,10),32)),32]}function cu(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?tu(s,{signed:n}):K(s,{signed:n}),32]}function uu(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(Rt)),a=n+o;for(let c=0;c<t.components.length;++c){const u=t.components[c];e.setPosition(a+i);const[d,f]=ye(e,u,{staticPosition:a});i+=f,s[r?c:u==null?void 0:u.name]=d}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 fu(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=ru(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 du(e){const{abi:t,data:n}=e,r=Ye(n,0,4);if(r==="0x")throw new Wr;const i=[...t||[],qc,Jc].find(o=>o.type==="error"&&r===an(me(o)));if(!i)throw new Ka(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 lu=(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"?R(r.bytes):r.bytes}function gs(e){return Array.isArray(e)?hu(e.map(t=>gs(t))):pu(e)}function hu(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 pu(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 yu={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function mu(e,t){const n={};return typeof e.authorizationList<"u"&&(n.authorizationList=gu(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=>R(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=yu[e.type]),typeof e.value<"u"&&(n.value=P(e.value)),n}function gu(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 bu=2n**16n-1n,ws={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function wu(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=xu(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 xu(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 $u(e,t){const n=(e.transactions??[]).map(r=>typeof r=="string"?r:wu(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 Au(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 Eu(e,t,n){return e&t^~e&n}function vu(e,t,n){return e&t^e&n^t&n}class Pu 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 f=o;f<s;f++)n[f]=0;Au(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,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<u;f++)a.setUint32(4*f,d[f],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]),Iu=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 Tu extends Pu{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 f=0;f<16;f++,n+=4)ee[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){const l=ee[f-15],h=ee[f-2],m=k(l,7)^k(l,18)^l>>>3,y=k(h,17)^k(h,19)^h>>>10;ee[f]=y+ee[f-7]+m+ee[f-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:u,H:d}=this;for(let f=0;f<64;f++){const l=k(a,6)^k(a,11)^k(a,25),h=d+l+Eu(a,c,u)+Iu[f]+ee[f]|0,y=(k(r,2)^k(r,13)^k(r,22))+vu(r,s,i)|0;d=u,u=c,c=a,a=o+h|0,o=i,i=s,s=r,r=h+y|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,d=d+this.H|0,this.set(r,s,i,o,a,c,u,d)}roundClean(){Le(ee)}destroy(){this.set(0,0,0,0,0,0,0,0),Le(this.buffer)}}const Su=ss(()=>new Tu),_u=Su;function Bu(e,t){const n=_u(Ae(e,{strict:!1})?re(e):e);return Jr(n)}function Ou(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 Hn="/docs/contract/decodeEventLog";function Lu(e){const{abi:t,data:n,strict:r,topics:s}=e,i=r??!0,[o,...a]=s;if(!o)throw new Za({docsPath:Hn});const c=t.find(y=>y.type==="event"&&o===ut(me(y)));if(!(c&&"name"in c)||c.type!=="event")throw new Vr(o,{docsPath:Hn});const{name:u,inputs:d}=c,f=d==null?void 0:d.some(y=>!("name"in y&&y.name)),l=f?[]:{},h=d.map((y,p)=>[y,p]).filter(([y])=>"indexed"in y&&y.indexed);for(let y=0;y<h.length;y++){const[p,x]=h[y],g=a[y];if(!g)throw new Kr({abiItem:c,param:p});l[f?x:p.name||x]=Mu({param:p,value:g})}const m=d.filter(y=>!("indexed"in y&&y.indexed));if(m.length>0){if(n&&n!=="0x")try{const y=ft(m,n);if(y)if(f)for(let p=0;p<d.length;p++)l[p]=l[p]??y.shift();else for(let p=0;p<m.length;p++)l[m[p].name]=y[p]}catch(y){if(i)throw y instanceof Gr||y instanceof ys?new Ft({abiItem:c,data:n,params:m,size:T(n)}):y}else if(i)throw new Ft({abiItem:c,data:"0x",params:m,size:0})}return{eventName:u,args:Object.values(l).length>0?l:void 0}}function Mu({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(ft([e],t)||[])[0]}function Uu(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(d=>d.type==="event"&&o.topics[0]===ut(d));if(!c)return null;const u=Lu({...o,abi:[c],strict:s});return i&&!i.includes(u.eventName)||!zu({args:u.args,inputs:c.inputs,matchArgs:n})?null:{...u,...o}}catch(c){let u,d;if(c instanceof Vr)return null;if(c instanceof Ft||c instanceof Kr){if(s)return null;u=c.abiItem.name,d=(a=c.abiItem.inputs)==null?void 0:a.some(f=>!("name"in f&&f.name))}return{...o,args:d?[]:{},eventName:u}}}).filter(Boolean)}function zu(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"?Ou(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 Cu(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 ku={"0x0":"reverted","0x1":"success"};function Fu(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=>Cu(r)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ze(e.transactionIndex):null,status:e.status?ku[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 Nu(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),S(()=>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 Du=Object.freeze(Object.defineProperty({__proto__:null,encode:Ce,getDataFromTx:xs,getExtraCallDataFromTx:$s},Symbol.toStringTag,{value:"Module"}));async function Ru(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 $u(i)}async function ju(e){const t=await e({method:"eth_maxPriorityFeePerGas"});return rt(t)}async function Hu(e,t,n){var s,i,o,a,c,u,d,f,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=(f=(d=t.config)==null?void 0:d.rpc)==null?void 0:f.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 Gu(e,t,n){var s,i,o,a,c,u,d,f,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=(f=(d=t.config)==null?void 0:d.rpc)==null?void 0:f.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 Wu(e){if(vt.has(e))return vt.get(e);const t=new Map;return vt.set(e,t),t}function Vu(e){return`${e.method}:${Z(e.params)}`}const Ku=100,Zu=0;function oe(e){const t=Wu(e.client),n=e.chain.rpc;if(t.has(n))return t.get(n);const r=(()=>{var f,l,h,m,y,p;const s=Er({chain:e.chain,client:e.client}),i=((f=e.config)==null?void 0:f.maxBatchSize)??((h=(l=e.client.config)==null?void 0:l.rpc)==null?void 0:h.maxBatchSize)??Ku,o=((m=e.config)==null?void 0:m.batchTimeoutMs)??((p=(y=e.client.config)==null?void 0:y.rpc)==null?void 0:p.batchTimeoutMs)??Zu,a=new Map;let c=[],u=null;function d(){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=[],Hu(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 Gu(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=Vu(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(d,o)),c.length>=i&&d()):d(),v}})();return t.set(n,r),r}const Xu=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 Yu(e){const t=await e({method:"eth_gasPrice"});return rt(t)}async function Gn(e){const{client:t,chain:n,percentMultiplier:r}=e,s=oe({chain:n,client:t}),i=await Yu(s),o=r?i/BigInt(100)*BigInt(r):0n;return i+o}function Se(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const qu=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function Ju(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 Qu(e.client,e.chain,s==="legacy"?"legacy":"eip1559");return(o=e.chain.experimental)!=null&&o.increaseZeroByteCount?i.gasPrice?{gasPrice:Se(i.gasPrice)}:{maxFeePerGas:t??Se(i.maxFeePerGas??0n),maxPriorityFeePerGas:n??Se(i.maxPriorityFeePerGas??0n)}:i.gasPrice!==void 0?i:{maxFeePerGas:t??i.maxFeePerGas,maxPriorityFeePerGas:n??i.maxPriorityFeePerGas}}async function Qu(e,t,n){if((n??t.feeType)==="legacy"||qu.includes(t.id))return{gasPrice:await Gn({chain:t,client:e,percentMultiplier:10})};const s=await ef(e,t);return s.maxFeePerGas!==null&&s.maxPriorityFeePerGas!==null?{maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas}:{gasPrice:await Gn({chain:t,client:e,percentMultiplier:10})}}async function ef(e,t,n=10){let r=null,s=null;const i=oe({chain:t,client:e}),[o,a]=await Promise.all([Ru(i,{blockTag:"latest"}),ju(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 sf(u):a!==null&&(s=a),s==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(s=tf(s,n),r=c*2n+s,(u===42220||u===44787||u===62320)&&(s=r),{maxFeePerGas:r,maxPriorityFeePerGas:s}))}function tf(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function nf(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const rf=31n;async function sf(e){const t=nf(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 rf}async function of(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 S(async()=>{const{getChainMetadata:r}=await Promise.resolve().then(()=>Go);return{getChainMetadata:r}},void 0);return(await t(e)).stackType==="zksync_stack"}catch{return!1}}function af(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 cf(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 Es({client:e,ecosystem:t,data:n}){const r=ze(e,t),s={source:"sdk",...n};return r(`${$o("analytics")}/event`,{body:Z(s),method:"POST"}).catch(()=>{})}async function Cl(e){return uf({...e,action:"transaction:sent"})}function uf(e){return Es({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 ff(e){var n,r,s;const t=cf(e.error);return Es({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=bu*32n;class df extends b{constructor({givenLength:t,maxBytecodeSize:n}){super(`Bytecode cannot be longer than ${n} bytes. Given length: ${t}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class lf extends b{constructor({givenLengthInWords:t}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${t}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class hf extends b{constructor({givenLength:t}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${t}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function kl(e){const t=re(e);if(t.length%32!==0)throw new hf({givenLength:t.length});if(t.length>Wn)throw new df({givenLength:t.length,maxBytecodeSize:Wn});const n=Bu(t),r=re(n),s=t.length/32;if(s%2===0)throw new lf({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 pf=Nu({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}),yf="https://{clientId}.ipfscdn.io/ipfs/{cid}";function mf(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)??yf,s=e.client.clientId,i=gf(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 gf(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}function Fl(e=32){return st(bf(e))}function bf(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}async function wf(e){var r,s,i,o,a,c,u,d,f;let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:l}=await S(async()=>{const{resolveArweaveScheme:h}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:h}},[]);t=l(e)}else t=mf(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??((f=(d=(u=e.client.config)==null?void 0:u.storage)==null?void 0:d.fetch)==null?void 0:f.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 xf(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===pf.id)return await Vn(e);try{return await $f(e,t)}catch{return await Vn(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function $f(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 vs(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([S(()=>import("./resolveImplementation-BfuFbByz.js"),[]),S(()=>import("./extractIPFS-6rL7YbLD.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 wf({client:e.client,uri:s})).json()).output.abi}catch{return[]}}const Af={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"},Ef={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"},vf={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([vs(e),Pf(e),If(e),Tf(e),Sf(e)]),c=[...new Set([...s,...i,...o,...a])];if(!c.length)return r;const u=await _f({contract:e,plugins:c,resolveSubAbi:n});return Bf({pluginAbis:u,rootAbi:r})}async function Pf(e){try{const{readContract:t}=await S(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:Af});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function If(e){try{const{readContract:t}=await S(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.metadata.implementation))]:[]}catch{}return[]}async function Tf(e){try{const{getInstalledModules:t}=await S(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-u4tfyC0o.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 S(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:vf});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function _f(e){return Promise.all(e.plugins.map(t=>{const n=Da({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):vs(n)}))}function Bf(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(vi(t))];return fo(n)}async function Kn(e){var i;const{error:t,contract:n,fromAddress:r}=e;af(t)&&n&&ff({chainId:(i=n.chain)==null?void 0:i.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const s=await Of({contract:n,error:t});return s?new Lf(s,n):t}async function Of(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 xf(n).catch(()=>{}));const i=du({abi:s,data:r.data});return`${i.errorName}${i.args?` - ${i.args}`:""}`}}return`Execution Reverted: ${lu(t)}`}class Lf 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 Mf(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=Se(g)),g}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:c}=await S(async()=>{const{encode:g}=await Promise.resolve().then(()=>Du);return{encode:g}},void 0),[u,d,f,l]=await Promise.all([c(e.transaction),I(e.transaction.to),I(e.transaction.value),I(e.transaction.authorizationList)]),[{getRpcClient:h},{eth_estimateGas:m}]=await Promise.all([S(()=>Promise.resolve().then(()=>Xu),void 0),S(()=>Promise.resolve().then(()=>Nf),void 0)]),y=h(e.transaction);try{const g=mu({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:d?D(d):void 0,value:f});let w=await m(y,g);return(x=e.transaction.chain.experimental)!=null&&x.increaseZeroByteCount&&(w=Se(w)),w}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return Pt.set(n,s),s}async function Uf(e){if(await of(e.transaction.chain)){const{getZkGasFees:y}=await S(async()=>{const{getZkGasFees:w}=await import("./send-eip712-transaction-QgwzVlIl.js").then($=>$.a);return{getZkGasFees:w}},[]),{gas:p,maxFeePerGas:x,maxPriorityFeePerGas:g}=await y({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,d,f,l,h]=await Promise.all([Ce(e.transaction),(async()=>{const y=await I(e.transaction.nonce);return y!==void 0?y:s?await S(async()=>{const{eth_getTransactionCount:p}=await Promise.resolve().then(()=>jf);return{eth_getTransactionCount:p}},void 0).then(({eth_getTransactionCount:p})=>p(n,{address:D(typeof s=="string"?s:s.address),blockTag:"pending"})):void 0})(),Mf({...e,from:e.from}),Ju(e.transaction),I(e.transaction.to),I(e.transaction.accessList),I(e.transaction.value),I(e.transaction.authorizationList),I(e.transaction.type)]);const m=await I(e.transaction.extraGas);return m&&(a+=m),{accessList:d,authorizationList:l,chainId:r,data:i,gas:a,nonce:o,to:u,type:h,value:f,...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 Nl(e,t){return await e({method:"eth_getStorageAt",params:[D(t.address),t.position,t.blockTag??"latest"]})}async function Rf(e,t){const n=await e({method:"eth_getTransactionCount",params:[t.address,t.blockNumber?z(t.blockNumber):t.blockTag||"pending"]});return Ca(n)}const jf=Object.freeze(Object.defineProperty({__proto__:null,eth_getTransactionCount:Rf},Symbol.toStringTag,{value:"Module"}));async function Hf(e,t){const n=await e({method:"eth_getTransactionReceipt",params:[t.hash]});if(!n)throw new Error("Transaction receipt not found.");return Fu(n)}async function Dl(e,t){return await e({method:"eth_sendRawTransaction",params:[t]})}function Gf(e){return new Promise(t=>setTimeout(t,e))}const Wf=5e3,Vf=1e3,Zn=500,Kf=2,Ps=10;function Zf(e){for(;e.length<Ps;)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 d(){if(!o)return;try{const h=await zf(u);if(!a||h>a){let m=[];if(a)for(let p=a+1n;p<=h;p++)m.push(BigInt(p));else m=[h];a=h;const y=Date.now();if(c){const p=(y-c)/m.length;i.push(p),i=i.slice(-Ps)}c=y;for(const p of m)for(const x of s)x(p)}}catch(h){r?r(h):console.error(`[watchBlockNumber]: Failed to poll for latest block number: ${h}`)}const f=Zf(i),l=Math.max(Zn,Math.min(Wf,Math.max(Zn,f)));await Gf(l/(n??Kf)),d()}return function(l,h){return s.push(l),o||(a=h,o=!0,d()),function(){s=s.filter(y=>y!==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 Rl(e){const{signature:t}=e;let n;return qf(t)?n=t:n=Je(t),{abiEvent:n,hash:nn(n),topics:Yc({abi:[n],args:e.filters})}}function jl(e){const{logs:t,events:n,strict:r}=e;return Uu({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(aa(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 jt({address:e,cause:new Is});if(n){if(e.toLowerCase()===e)return;if(td(e)!==e)throw new jt({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 jt 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 Is 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]*)\]$/,Ts=/^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)?$/,Hl=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 Os(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 _(...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?_(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:_(...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:_(se(U(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new _s({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(Sr(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:_(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):_(...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 Ss(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Bs({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 Ht(e,t){if(e.length!==t.length)throw new Bs({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(Ht.encode(s,i))}return _(...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,d="256"]=i,f=Number.parseInt(d)/8;return U(r,{size:s?32:f,signed:u==="int"})}const o=n.match(Ts);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new _s({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,d=[];for(let f=0;f<r.length;f++)d.push(t(u,r[f],!0));return d.length===0?"0x":_(...d)}throw new Os(n)}e.encode=t})(Ht||(Ht={}));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 _s=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 Bs 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 Os 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:d}=c,f=a[u],l=d.match(cn);if(l&&(typeof f=="number"||typeof f=="bigint")){const[,y,p]=l;U(f,{signed:y==="int",size:Number.parseInt(p??"")/8})}if(d==="address"&&typeof f=="string"&&!nd(f))throw new jt({address:f,cause:new Is});const h=d.match(Ts);if(h){const[,y]=h;if(y&&B(f)!==Number.parseInt(y))throw new $d({expectedSize:Number.parseInt(y),givenSize:B(f)})}const m=s[d];m&&(Id(d),i(m,f))}};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=zs({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 Ls(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)||Ls(t)}})}function wd(e){const{data:t,primaryType:n,types:r}=e,s=Ms({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 Ms(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]=Us({types:r,name:o.name,type:o.type,value:t[o.name]});s.push(a),i.push(c)}return Ss(s,i)}function Pd(e){const{primaryType:t,types:n}=e,r=nt(gd({primaryType:t,types:n}));return ce(r)}function Us(e){let{types:t,name:n,type:r,value:s}=e;if(t[r]!==void 0)return[{type:"bytes32"},ce(Ms({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=>Us({name:n,type:i,types:t,value:a}));return[{type:"bytes32"},ce(Ss(o.map(([a])=>a),o.map(([,a])=>a)))]}return[{type:r},s]}function zs(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])zs({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 _d(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return Ud(t,{param:e});if(e.type==="address")return Sd(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 _(...n,...r)}function Sd(e){if(e!==""&&e!==void 0&&!Jt(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:ue(e.toLowerCase())}}function _d(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?_(a,o):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:_(...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:_(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(Sr(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:_(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):_(...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 Cs(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 f,l;if(Array.isArray(n))return n;if(Cs(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&&((f=t.abi)==null?void 0:f.length)>0){const h=(l=t.abi)==null?void 0:l.find(m=>m.type==="function"&&m.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}),d=ft(i[2],u);return Array.isArray(d)&&d.length===1?d[0]:d}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 Wl=Object.freeze(Object.defineProperty({__proto__:null,decimals:Dd},Symbol.toStringTag,{value:"Module"}));function Rd(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 Gt=new Map;function jd(e){const t=Gt.get(e);if(t)return t;const n=Rd([]);return Gt.set(e,n),n}function Hd(e){const{address:t,transactionHash:n,chainId:r}=e,s=jd(t);s.setValue([...s.getValue(),{chainId:r,transactionHash:n}]),Gt.set(t,s)}async function Gd(e){let{account:t,transaction:n,gasless:r}=e;if(t.onTransactionRequested&&await t.onTransactionRequested(n),n.eip712){const{sendEip712Transaction:o}=await S(async()=>{const{sendEip712Transaction:a}=await import("./send-eip712-transaction-QgwzVlIl.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 S(async()=>{const{sendGaslessTransaction:a}=await import("./send-gasless-transaction-DuSgxy0D.js");return{sendGaslessTransaction:a}},[]);return o({account:t,gasless:r,serializableTransaction:s,transaction:n})}const i=await t.sendTransaction(s);return Hd({address:t.address,chainId:n.chain.id,transactionHash:i.transactionHash}),{...i,chain:n.chain,client:n.client}}const Wd=100,Re=new Map;function Vd(e){const{transactionHash:t,chain:n,client:r}=e,i=`${n.id}:tx_${t}`,o=e.maxBlocksWaitTime??Wd;if(Re.has(i))return Re.get(i);const a=new Promise((c,u)=>{t||u(new Error("Transaction has no transactionHash to wait for, did you execute it?"));const d=oe({chain:n,client:r});let f=-1;const l=Yf({chain:n,client:r,onNewBlockNumber:async()=>{if(f++,f>=o){l(),u(new Error(`Transaction receipt for ${t} not found after ${o} blocks`));return}try{const h=await Hf(d,{hash:t});l(),c(h)}catch{}}})}).finally(()=>{Re.delete(i)});return Re.set(i,a),a}async function Vl(e){const t=await Gd(e);return Vd(t)}async function Kl(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,d]=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:d}}));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(Cs(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 ks(e){return _(...e)}const Zd=Object.freeze(Object.defineProperty({__proto__:null,concatHex:ks},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 je=new WeakMap;function Qd(e){if(je.has(e))return je.get(e);const t=(async()=>{const n=oe(e),r=await Df(n,{address:e.address,blockTag:"latest"});return r==="0x"&&je.delete(e),r})();return je.set(e,t),t}const Yn=new WeakSet;async function Fs(e){if(Yn.has(e))return!0;const n=await Qd(e)!=="0x";return n&&Yn.add(e),n}const el="0x6492649264926492649264926492649264926492649264926492649264926492";function Ns({address:e,data:t,signature:n}){return ks([he([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,t,n]),el])}const tl="0x1626ba7e";async function Ds({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 Gu(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=Vu(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(d,o)),c.length>=i&&d()):d(),v}})();return t.set(n,r),r}const Xu=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 Yu(e){const t=await e({method:"eth_gasPrice"});return rt(t)}async function Gn(e){const{client:t,chain:n,percentMultiplier:r}=e,s=oe({chain:n,client:t}),i=await Yu(s),o=r?i/BigInt(100)*BigInt(r):0n;return i+o}function Se(e){if(e===0n||(e&e-1n)===0n)return e;let t=1n;for(;e>0n;)e>>=1n,t<<=1n;return t}const qu=[78600,2040,248,9372,841,842,2016,9768,2442,1942999413,1952959480,994873017,19011,40875,1511670449,5464,2020,2021,98866,1417429182];async function Ju(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 Qu(e.client,e.chain,s==="legacy"?"legacy":"eip1559");return(o=e.chain.experimental)!=null&&o.increaseZeroByteCount?i.gasPrice?{gasPrice:Se(i.gasPrice)}:{maxFeePerGas:t??Se(i.maxFeePerGas??0n),maxPriorityFeePerGas:n??Se(i.maxPriorityFeePerGas??0n)}:i.gasPrice!==void 0?i:{maxFeePerGas:t??i.maxFeePerGas,maxPriorityFeePerGas:n??i.maxPriorityFeePerGas}}async function Qu(e,t,n){if((n??t.feeType)==="legacy"||qu.includes(t.id))return{gasPrice:await Gn({chain:t,client:e,percentMultiplier:10})};const s=await ef(e,t);return s.maxFeePerGas!==null&&s.maxPriorityFeePerGas!==null?{maxFeePerGas:s.maxFeePerGas,maxPriorityFeePerGas:s.maxPriorityFeePerGas}:{gasPrice:await Gn({chain:t,client:e,percentMultiplier:10})}}async function ef(e,t,n=10){let r=null,s=null;const i=oe({chain:t,client:e}),[o,a]=await Promise.all([Ru(i,{blockTag:"latest"}),ju(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 sf(u):a!==null&&(s=a),s==null||c==null?{maxFeePerGas:null,maxPriorityFeePerGas:null}:(s=tf(s,n),r=c*2n+s,(u===42220||u===44787||u===62320)&&(s=r),{maxFeePerGas:r,maxPriorityFeePerGas:s}))}function tf(e,t=10){const n=e/BigInt(100)*BigInt(t);return e+n}function nf(e){switch(e){case 137:return"https://gasstation.polygon.technology/v2";case 80002:return"https://gasstation.polygon.technology/amoy"}}const rf=31n;async function sf(e){const t=nf(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 rf}async function of(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 S(async()=>{const{getChainMetadata:r}=await Promise.resolve().then(()=>Go);return{getChainMetadata:r}},void 0);return(await t(e)).stackType==="zksync_stack"}catch{return!1}}function af(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 cf(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 Es({client:e,ecosystem:t,data:n}){const r=ze(e,t),s={source:"sdk",...n};return r(`${$o("analytics")}/event`,{body:Z(s),method:"POST"}).catch(()=>{})}async function Cl(e){return uf({...e,action:"transaction:sent"})}function uf(e){return Es({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 ff(e){var n,r,s;const t=cf(e.error);return Es({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=bu*32n;class df extends b{constructor({givenLength:t,maxBytecodeSize:n}){super(`Bytecode cannot be longer than ${n} bytes. Given length: ${t}`,{name:"BytecodeLengthExceedsMaxSizeError"})}}class lf extends b{constructor({givenLengthInWords:t}){super(`Bytecode length in 32-byte words must be odd. Given length in words: ${t}`,{name:"BytecodeLengthInWordsMustBeOddError"})}}class hf extends b{constructor({givenLength:t}){super(`The bytecode length in bytes must be divisible by 32. Given length: ${t}`,{name:"BytecodeLengthMustBeDivisibleBy32Error"})}}function kl(e){const t=re(e);if(t.length%32!==0)throw new hf({givenLength:t.length});if(t.length>Wn)throw new df({givenLength:t.length,maxBytecodeSize:Wn});const n=Bu(t),r=re(n),s=t.length/32;if(s%2===0)throw new lf({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 pf=Nu({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}),yf="https://{clientId}.ipfscdn.io/ipfs/{cid}";function mf(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)??yf,s=e.client.clientId,i=gf(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 gf(e){if(!e.startsWith("ipfs://"))return e;const t=e.search(/\/(Qm|baf)/i);return e.slice(t+1)}function Fl(e=32){return st(bf(e))}function bf(e=32){return globalThis.crypto.getRandomValues(new Uint8Array(e))}async function wf(e){var r,s,i,o,a,c,u,d,f;let t;if(e.uri.startsWith("ar://")){const{resolveArweaveScheme:l}=await S(async()=>{const{resolveArweaveScheme:h}=await import("./arweave-CAGvOb64.js");return{resolveArweaveScheme:h}},[]);t=l(e)}else t=mf(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??((f=(d=(u=e.client.config)==null?void 0:u.storage)==null?void 0:d.fetch)==null?void 0:f.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 xf(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===pf.id)return await Vn(e);try{return await $f(e,t)}catch{return await Vn(e)}},{cacheKey:`${e.chain.id}-${e.address}`,cacheTime:1e3*60*60*1})}async function $f(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 vs(e){const[{resolveImplementation:t},{extractIPFSUri:n}]=await Promise.all([S(()=>import("./resolveImplementation-C5lycJfC.js"),[]),S(()=>import("./extractIPFS-DgGO_4eF.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 wf({client:e.client,uri:s})).json()).output.abi}catch{return[]}}const Af={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"},Ef={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"},vf={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([vs(e),Pf(e),If(e),Tf(e),Sf(e)]),c=[...new Set([...s,...i,...o,...a])];if(!c.length)return r;const u=await _f({contract:e,plugins:c,resolveSubAbi:n});return Bf({pluginAbis:u,rootAbi:r})}async function Pf(e){try{const{readContract:t}=await S(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:Af});return n.length?[...new Set(n.map(r=>r.pluginAddress))]:[]}catch{}return[]}async function If(e){try{const{readContract:t}=await S(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.metadata.implementation))]:[]}catch{}return[]}async function Tf(e){try{const{getInstalledModules:t}=await S(async()=>{const{getInstalledModules:r}=await import("./getInstalledModules-Bdsr8t_C.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 S(async()=>{const{readContract:r}=await Promise.resolve().then(()=>hn);return{readContract:r}},void 0),n=await t({contract:e,method:vf});return n.length?n.map(r=>r.facetAddress):[]}catch{}return[]}async function _f(e){return Promise.all(e.plugins.map(t=>{const n=Da({...e.contract,address:t});return e.resolveSubAbi?e.resolveSubAbi(n):vs(n)}))}function Bf(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(vi(t))];return fo(n)}async function Kn(e){var i;const{error:t,contract:n,fromAddress:r}=e;af(t)&&n&&ff({chainId:(i=n.chain)==null?void 0:i.id,client:n.client,contractAddress:n.address,error:t,walletAddress:r});const s=await Of({contract:n,error:t});return s?new Lf(s,n):t}async function Of(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 xf(n).catch(()=>{}));const i=du({abi:s,data:r.data});return`${i.errorName}${i.args?` - ${i.args}`:""}`}}return`Execution Reverted: ${lu(t)}`}class Lf 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 Mf(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=Se(g)),g}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}const{encode:c}=await S(async()=>{const{encode:g}=await Promise.resolve().then(()=>Du);return{encode:g}},void 0),[u,d,f,l]=await Promise.all([c(e.transaction),I(e.transaction.to),I(e.transaction.value),I(e.transaction.authorizationList)]),[{getRpcClient:h},{eth_estimateGas:m}]=await Promise.all([S(()=>Promise.resolve().then(()=>Xu),void 0),S(()=>Promise.resolve().then(()=>Nf),void 0)]),y=h(e.transaction);try{const g=mu({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:d?D(d):void 0,value:f});let w=await m(y,g);return(x=e.transaction.chain.experimental)!=null&&x.increaseZeroByteCount&&(w=Se(w)),w}catch(g){throw await Kn({contract:e.transaction.__contract,error:g,fromAddress:t})}})();return Pt.set(n,s),s}async function Uf(e){if(await of(e.transaction.chain)){const{getZkGasFees:y}=await S(async()=>{const{getZkGasFees:w}=await import("./send-eip712-transaction-C2PvhNcm.js").then($=>$.a);return{getZkGasFees:w}},[]),{gas:p,maxFeePerGas:x,maxPriorityFeePerGas:g}=await y({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,d,f,l,h]=await Promise.all([Ce(e.transaction),(async()=>{const y=await I(e.transaction.nonce);return y!==void 0?y:s?await S(async()=>{const{eth_getTransactionCount:p}=await Promise.resolve().then(()=>jf);return{eth_getTransactionCount:p}},void 0).then(({eth_getTransactionCount:p})=>p(n,{address:D(typeof s=="string"?s:s.address),blockTag:"pending"})):void 0})(),Mf({...e,from:e.from}),Ju(e.transaction),I(e.transaction.to),I(e.transaction.accessList),I(e.transaction.value),I(e.transaction.authorizationList),I(e.transaction.type)]);const m=await I(e.transaction.extraGas);return m&&(a+=m),{accessList:d,authorizationList:l,chainId:r,data:i,gas:a,nonce:o,to:u,type:h,value:f,...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 Nl(e,t){return await e({method:"eth_getStorageAt",params:[D(t.address),t.position,t.blockTag??"latest"]})}async function Rf(e,t){const n=await e({method:"eth_getTransactionCount",params:[t.address,t.blockNumber?z(t.blockNumber):t.blockTag||"pending"]});return Ca(n)}const jf=Object.freeze(Object.defineProperty({__proto__:null,eth_getTransactionCount:Rf},Symbol.toStringTag,{value:"Module"}));async function Hf(e,t){const n=await e({method:"eth_getTransactionReceipt",params:[t.hash]});if(!n)throw new Error("Transaction receipt not found.");return Fu(n)}async function Dl(e,t){return await e({method:"eth_sendRawTransaction",params:[t]})}function Gf(e){return new Promise(t=>setTimeout(t,e))}const Wf=5e3,Vf=1e3,Zn=500,Kf=2,Ps=10;function Zf(e){for(;e.length<Ps;)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 d(){if(!o)return;try{const h=await zf(u);if(!a||h>a){let m=[];if(a)for(let p=a+1n;p<=h;p++)m.push(BigInt(p));else m=[h];a=h;const y=Date.now();if(c){const p=(y-c)/m.length;i.push(p),i=i.slice(-Ps)}c=y;for(const p of m)for(const x of s)x(p)}}catch(h){r?r(h):console.error(`[watchBlockNumber]: Failed to poll for latest block number: ${h}`)}const f=Zf(i),l=Math.max(Zn,Math.min(Wf,Math.max(Zn,f)));await Gf(l/(n??Kf)),d()}return function(l,h){return s.push(l),o||(a=h,o=!0,d()),function(){s=s.filter(y=>y!==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 Rl(e){const{signature:t}=e;let n;return qf(t)?n=t:n=Je(t),{abiEvent:n,hash:nn(n),topics:Yc({abi:[n],args:e.filters})}}function jl(e){const{logs:t,events:n,strict:r}=e;return Uu({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(aa(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 jt({address:e,cause:new Is});if(n){if(e.toLowerCase()===e)return;if(td(e)!==e)throw new jt({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 jt 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 Is 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]*)\]$/,Ts=/^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)?$/,Hl=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 Os(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 _(...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?_(u,c):u}}if(o)return{dynamic:!0,encoded:c}}return{dynamic:!1,encoded:_(...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:_(se(U(r,{size:32})),s)}}if(r!==Number.parseInt(n))throw new _s({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(Sr(t,s*32,(s+1)*32)));return{dynamic:!0,encoded:_(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):_(...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 Ss(e,t,n){const{checksumAddress:r=!1}={};if(e.length!==t.length)throw new Bs({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 Ht(e,t){if(e.length!==t.length)throw new Bs({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(Ht.encode(s,i))}return _(...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,d="256"]=i,f=Number.parseInt(d)/8;return U(r,{size:s?32:f,signed:u==="int"})}const o=n.match(Ts);if(o){const[c,u]=o;if(Number.parseInt(u)!==(r.length-2)/2)throw new _s({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,d=[];for(let f=0;f<r.length;f++)d.push(t(u,r[f],!0));return d.length===0?"0x":_(...d)}throw new Os(n)}e.encode=t})(Ht||(Ht={}));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 _s=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 Bs 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 Os 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:d}=c,f=a[u],l=d.match(cn);if(l&&(typeof f=="number"||typeof f=="bigint")){const[,y,p]=l;U(f,{signed:y==="int",size:Number.parseInt(p??"")/8})}if(d==="address"&&typeof f=="string"&&!nd(f))throw new jt({address:f,cause:new Is});const h=d.match(Ts);if(h){const[,y]=h;if(y&&B(f)!==Number.parseInt(y))throw new $d({expectedSize:Number.parseInt(y),givenSize:B(f)})}const m=s[d];m&&(Id(d),i(m,f))}};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=zs({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 Ls(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)||Ls(t)}})}function wd(e){const{data:t,primaryType:n,types:r}=e,s=Ms({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 Ms(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]=Us({types:r,name:o.name,type:o.type,value:t[o.name]});s.push(a),i.push(c)}return Ss(s,i)}function Pd(e){const{primaryType:t,types:n}=e,r=nt(gd({primaryType:t,types:n}));return ce(r)}function Us(e){let{types:t,name:n,type:r,value:s}=e;if(t[r]!==void 0)return[{type:"bytes32"},ce(Ms({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=>Us({name:n,type:i,types:t,value:a}));return[{type:"bytes32"},ce(Ss(o.map(([a])=>a),o.map(([,a])=>a)))]}return[{type:r},s]}function zs(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])zs({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 _d(t,{length:r,param:{...e,type:s}})}if(e.type==="tuple")return Ud(t,{param:e});if(e.type==="address")return Sd(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 _(...n,...r)}function Sd(e){if(e!==""&&e!==void 0&&!Jt(e))throw new Error(`Invalid address: ${e}`);return{dynamic:!1,encoded:ue(e.toLowerCase())}}function _d(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?_(a,o):a}}if(s)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:_(...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:_(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(Sr(t,s*32,(s+1)*32),{dir:"right"}));return{dynamic:!0,encoded:_(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):_(...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 Cs(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 f,l;if(Array.isArray(n))return n;if(Cs(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&&((f=t.abi)==null?void 0:f.length)>0){const h=(l=t.abi)==null?void 0:l.find(m=>m.type==="function"&&m.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}),d=ft(i[2],u);return Array.isArray(d)&&d.length===1?d[0]:d}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 Wl=Object.freeze(Object.defineProperty({__proto__:null,decimals:Dd},Symbol.toStringTag,{value:"Module"}));function Rd(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 Gt=new Map;function jd(e){const t=Gt.get(e);if(t)return t;const n=Rd([]);return Gt.set(e,n),n}function Hd(e){const{address:t,transactionHash:n,chainId:r}=e,s=jd(t);s.setValue([...s.getValue(),{chainId:r,transactionHash:n}]),Gt.set(t,s)}async function Gd(e){let{account:t,transaction:n,gasless:r}=e;if(t.onTransactionRequested&&await t.onTransactionRequested(n),n.eip712){const{sendEip712Transaction:o}=await S(async()=>{const{sendEip712Transaction:a}=await import("./send-eip712-transaction-C2PvhNcm.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 S(async()=>{const{sendGaslessTransaction:a}=await import("./send-gasless-transaction-DIQuGEL1.js");return{sendGaslessTransaction:a}},[]);return o({account:t,gasless:r,serializableTransaction:s,transaction:n})}const i=await t.sendTransaction(s);return Hd({address:t.address,chainId:n.chain.id,transactionHash:i.transactionHash}),{...i,chain:n.chain,client:n.client}}const Wd=100,Re=new Map;function Vd(e){const{transactionHash:t,chain:n,client:r}=e,i=`${n.id}:tx_${t}`,o=e.maxBlocksWaitTime??Wd;if(Re.has(i))return Re.get(i);const a=new Promise((c,u)=>{t||u(new Error("Transaction has no transactionHash to wait for, did you execute it?"));const d=oe({chain:n,client:r});let f=-1;const l=Yf({chain:n,client:r,onNewBlockNumber:async()=>{if(f++,f>=o){l(),u(new Error(`Transaction receipt for ${t} not found after ${o} blocks`));return}try{const h=await Hf(d,{hash:t});l(),c(h)}catch{}}})}).finally(()=>{Re.delete(i)});return Re.set(i,a),a}async function Vl(e){const t=await Gd(e);return Vd(t)}async function Kl(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,d]=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:d}}));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(Cs(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 ks(e){return _(...e)}const Zd=Object.freeze(Object.defineProperty({__proto__:null,concatHex:ks},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 je=new WeakMap;function Qd(e){if(je.has(e))return je.get(e);const t=(async()=>{const n=oe(e),r=await Df(n,{address:e.address,blockTag:"latest"});return r==="0x"&&je.delete(e),r})();return je.set(e,t),t}const Yn=new WeakSet;async function Fs(e){if(Yn.has(e))return!0;const n=await Qd(e)!=="0x";return n&&Yn.add(e),n}const el="0x6492649264926492649264926492649264926492649264926492649264926492";function Ns({address:e,data:t,signature:n}){return ks([he([{type:"address"},{type:"bytes"},{type:"bytes"}],[e,t,n]),el])}const tl="0x1626ba7e";async function Ds({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:ma(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:Ls(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=Rs({data:n,primaryType:r,types:s});return V(a)})();i.push(o)}return V(Lr(...i.map(o=>$e(o))))}function Rs({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]=Hs({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=js({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 js({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])js({primaryType:i.type,types:t},n);return n}function Hs({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},V(Rs({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=>Hs({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 Zl="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",al="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",cl="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",Gs="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",ul="0x0000000071727De22E5E9d8BAf0edAc6f37da032",Xl=50000n,Yl=e=>fl(e||Gs)==="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===Gs)return"v0.6";if(t===ul)return"v0.7";throw new Error("Unknown paymaster version")};async function Jl(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(d){if(c===u)throw d;const f=2**(c+1)*200;await new Promise(l=>setTimeout(l,f)),c++}if(!a)throw new Error(`No smart account address found for admin address ${r} and salt ${s}`);return a},{cacheKey:`${e.factoryContract.chain.id}-${e.factoryContract.address}-${e.adminAddress}-${e.accountSalt}`,cacheTime:1e3*60*60*24})}function Ws(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 Ql(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 eh(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 Fs(e)){if(await Ds({contract:e,hash:s,signature:i}))return i;throw new Error("Failed to verify signature")}else{const d=Ws({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(!d)throw new Error("Create account override not provided");const f=await Ce(d);return Ns({address:t.address,data:f,signature:i})}}async function ll({accountContract:e,factoryContract:t,options:n,typedData:r}){var u,d,f,l,h;if(((d=(u=r.domain)==null?void 0:u.verifyingContract)==null?void 0:d.toLowerCase())===((f=e.address)==null?void 0:f.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 Fs(e)){if(await Ds({contract:e,hash:i,signature:o}))return o;throw new Error("Failed to verify signature")}else{const m=Ws({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(!m)throw new Error("Create account override not provided");const y=await Ce(m);return Ns({address:t.address,data:y,signature:o})}}const th=Object.freeze(Object.defineProperty({__proto__:null,smartAccountSignMessage:dl,smartAccountSignTypedData:ll},Symbol.toStringTag,{value:"Module"}));export{le as $,Dl as A,Uf as B,I as C,ks as D,Ul as E,Ce as F,at as G,ba as H,Rl as I,ql as J,ze as K,Qe as L,Gs as M,jl as N,du as O,rt as P,Xl as Q,Fo as R,pn as S,No as T,et as U,As as V,zl as W,Fs as X,be as Y,Bl as Z,S as _,pl as a,Jr as a0,fl as a1,xr as a2,Qu as a3,Ws as a4,he as a5,Hl as a6,Zl as a7,ul as a8,of as a9,Yl as aa,Jl as ab,Gd as ac,Cl as ad,Ql as ae,eh as af,af as ag,ff as ah,$o as ai,R as aj,Gf as ak,xe as al,Sl as am,yl as an,ai as ao,ml as ap,xi as aq,xl as ar,_l as as,Es as at,Do as au,jf as av,Wl as aw,th as ax,oe as b,hl as c,Vl as d,Hf as e,lt as f,Zs as g,Hd as h,Z as i,de as j,Da as k,Dc as l,D as m,V as n,Qd as o,Qs as p,Jt as q,Fl as r,Kl as s,ta as t,Nl as u,ra as v,Vd as w,st as x,Dr as y,kl as z};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as f,o as m,q as p}from"./index-
|
|
1
|
+
import{t as f,o as m,q as p}from"./index-MkZbQyDw.js";import{c as a}from"./index-B9z9f635.js";import"./index-C0hHgKRI.js";import"./thirdweb-juEAwwxR.js";import"./NetworkUtil-BCvAceLL.js";import"./index-fG1WBhYz.js";import"./ui-BsoeejM4.js";import"./vendor-C-guZ9WP.js";import"./index-CziCm94K.js";import"./if-defined-2xQLKahR.js";import"./index-VsMuUpAO.js";import"./index-jq6mMx3J.js";import"./index-vWAYjUUv.js";const d=f`
|
|
2
2
|
:host > wui-flex:first-child {
|
|
3
3
|
height: 500px;
|
|
4
4
|
overflow-y: auto;
|