@lukso/transaction-decoder 1.3.5 → 1.3.6-dev.184cdf1

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.
@@ -4,7 +4,7 @@
4
4
  * Then access via: window.TransactionDecoder
5
5
  */
6
6
  "use strict";var TransactionDecoder=(()=>{var No=Object.defineProperty;var w2=Object.getOwnPropertyDescriptor;var v2=Object.getOwnPropertyNames;var E2=Object.prototype.hasOwnProperty;var s=(e,t)=>No(e,"name",{value:t,configurable:!0});var P=(e,t)=>()=>(e&&(t=e(e=0)),t);var J0=(e,t)=>{for(var n in t)No(e,n,{get:t[n],enumerable:!0})},A2=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of v2(t))!E2.call(e,a)&&a!==n&&No(e,a,{get:()=>t[a],enumerable:!(r=w2(t,a))||r.enumerable});return e};var S2=e=>A2(No({},"__esModule",{value:!0}),e);var cy,yy=P(()=>{"use strict";cy="1.2.3"});var ve,pa=P(()=>{"use strict";yy();ve=class e extends Error{static{s(this,"BaseError")}constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath,o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: https://abitype.dev${a}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${cy}`].join(`
7
- `);super(o),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=a,this.metaMessages=n.metaMessages,this.shortMessage=t}}});function ct(e,t){return e.exec(t)?.groups}var Hd,zd,_o,ts=P(()=>{"use strict";s(ct,"execTyped");Hd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,zd=/^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)?$/,_o=/^\(.+?\).*?$/});function Fo(e){let t=e.type;if(fy.test(e.type)&&"components"in e){t="(";let n=e.components.length;for(let a=0;a<n;a++){let o=e.components[a];t+=Fo(o),a<n-1&&(t+=", ")}let r=ct(fy,e.type);return t+=`)${r?.array||""}`,Fo({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}var fy,ly=P(()=>{"use strict";ts();fy=/^tuple(?<array>(\[(\d*)\])*)$/;s(Fo,"formatAbiParameter")});function cn(e){let t="",n=e.length;for(let r=0;r<n;r++){let a=e[r];t+=Fo(a),r!==n-1&&(t+=", ")}return t}var Ud=P(()=>{"use strict";ly();s(cn,"formatAbiParameters")});function yr(e){return e.type==="function"?`function ${e.name}(${cn(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${cn(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${cn(e.inputs)})`:e.type==="error"?`error ${e.name}(${cn(e.inputs)})`:e.type==="constructor"?`constructor(${cn(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}var my=P(()=>{"use strict";Ud();s(yr,"formatAbiItem")});function hy(e){return by.test(e)}function xy(e){return ct(by,e)}function Ty(e){return gy.test(e)}function wy(e){return ct(gy,e)}function Ey(e){return vy.test(e)}function Ay(e){return ct(vy,e)}function Rn(e){return Sy.test(e)}function ky(e){return ct(Sy,e)}function Py(e){return Iy.test(e)}function Cy(e){return ct(Iy,e)}function Dy(e){return Oy.test(e)}function Ry(e){return ct(Oy,e)}function Ny(e){return P2.test(e)}var by,gy,vy,Sy,Iy,Oy,P2,Kd,My,$o,da=P(()=>{"use strict";ts();by=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;s(hy,"isErrorSignature");s(xy,"execErrorSignature");gy=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;s(Ty,"isEventSignature");s(wy,"execEventSignature");vy=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;s(Ey,"isFunctionSignature");s(Ay,"execFunctionSignature");Sy=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;s(Rn,"isStructSignature");s(ky,"execStructSignature");Iy=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;s(Py,"isConstructorSignature");s(Cy,"execConstructorSignature");Oy=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;s(Dy,"isFallbackSignature");s(Ry,"execFallbackSignature");P2=/^receive\(\) external payable$/;s(Ny,"isReceiveSignature");Kd=new Set(["memory","indexed","storage","calldata"]),My=new Set(["indexed"]),$o=new Set(["calldata","memory","storage"])});var ns,rs,Vo,Ho=P(()=>{"use strict";pa();ns=class extends ve{static{s(this,"InvalidAbiItemError")}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"})}},rs=class extends ve{static{s(this,"UnknownTypeError")}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"})}},Vo=class extends ve{static{s(this,"UnknownSolidityTypeError")}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"})}}});var as,ss,os,is,ps,ds,zo=P(()=>{"use strict";pa();as=class extends ve{static{s(this,"InvalidAbiParametersError")}constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},ss=class extends ve{static{s(this,"InvalidParameterError")}constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},os=class extends ve{static{s(this,"SolidityProtectedKeywordError")}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"})}},is=class extends ve{static{s(this,"InvalidModifierError")}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"})}},ps=class extends ve{static{s(this,"InvalidFunctionModifierError")}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"})}},ds=class extends ve{static{s(this,"InvalidAbiTypeParameterError")}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"})}}});var Nt,us,cs,jd=P(()=>{"use strict";pa();Nt=class extends ve{static{s(this,"InvalidSignatureError")}constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},us=class extends ve{static{s(this,"UnknownSignatureError")}constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},cs=class extends ve{static{s(this,"InvalidStructSignatureError")}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"})}}});var ys,Ly=P(()=>{"use strict";pa();ys=class extends ve{static{s(this,"CircularReferenceError")}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"})}}});var fs,By=P(()=>{"use strict";pa();fs=class extends ve{static{s(this,"InvalidParenthesisError")}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 _y(e,t,n){let r="";if(n)for(let a of Object.entries(n)){if(!a)continue;let o="";for(let i of a[1])o+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${a[0]}{${o}})`}return t?`${t}:${e}${r}`:`${e}${r}`}var Uo,Fy=P(()=>{"use strict";s(_y,"getParameterCacheKey");Uo=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 ls(e,t={}){if(Ey(e))return C2(e,t);if(Ty(e))return O2(e,t);if(hy(e))return D2(e,t);if(Py(e))return R2(e,t);if(Dy(e))return N2(e);if(Ny(e))return{type:"receive",stateMutability:"payable"};throw new us({signature:e})}function C2(e,t={}){let n=Ay(e);if(!n)throw new Nt({signature:e,type:"function"});let r=tt(n.parameters),a=[],o=r.length;for(let p=0;p<o;p++)a.push(Mt(r[p],{modifiers:$o,structs:t,type:"function"}));let i=[];if(n.returns){let p=tt(n.returns),d=p.length;for(let u=0;u<d;u++)i.push(Mt(p[u],{modifiers:$o,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:a,outputs:i}}function O2(e,t={}){let n=wy(e);if(!n)throw new Nt({signature:e,type:"event"});let r=tt(n.parameters),a=[],o=r.length;for(let i=0;i<o;i++)a.push(Mt(r[i],{modifiers:My,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:a}}function D2(e,t={}){let n=xy(e);if(!n)throw new Nt({signature:e,type:"error"});let r=tt(n.parameters),a=[],o=r.length;for(let i=0;i<o;i++)a.push(Mt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:a}}function R2(e,t={}){let n=Cy(e);if(!n)throw new Nt({signature:e,type:"constructor"});let r=tt(n.parameters),a=[],o=r.length;for(let i=0;i<o;i++)a.push(Mt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:a}}function N2(e){let t=Ry(e);if(!t)throw new Nt({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}function Mt(e,t){let n=_y(e,t?.type,t?.structs);if(Uo.has(n))return Uo.get(n);let r=_o.test(e),a=ct(r?L2:M2,e);if(!a)throw new ss({param:e});if(a.name&&F2(a.name))throw new os({param:e,name:a.name});let o=a.name?{name:a.name}:{},i=a.modifier==="indexed"?{indexed:!0}:{},p=t?.structs??{},d,u={};if(r){d="tuple";let y=tt(a.type),f=[],l=y.length;for(let m=0;m<l;m++)f.push(Mt(y[m],{structs:p}));u={components:f}}else if(a.type in p)d="tuple",u={components:p[a.type]};else if(B2.test(a.type))d=`${a.type}256`;else if(a.type==="address payable")d="address";else if(d=a.type,t?.type!=="struct"&&!qd(d))throw new Vo({type:d});if(a.modifier){if(!t?.modifiers?.has?.(a.modifier))throw new is({param:e,type:t?.type,modifier:a.modifier});if($o.has(a.modifier)&&!$2(d,!!a.array))throw new ps({param:e,type:t?.type,modifier:a.modifier})}let c={type:`${d}${a.array??""}`,...o,...i,...u};return Uo.set(n,c),c}function tt(e,t=[],n="",r=0){let a=e.trim().length;for(let o=0;o<a;o++){let i=e[o],p=e.slice(o+1);switch(i){case",":return r===0?tt(p,[...t,n.trim()]):tt(p,t,`${n}${i}`,r);case"(":return tt(p,t,`${n}${i}`,r+1);case")":return tt(p,t,`${n}${i}`,r-1);default:return tt(p,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new fs({current:n,depth:r});return t.push(n.trim()),t}function qd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Hd.test(e)||zd.test(e)}function F2(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Hd.test(e)||zd.test(e)||_2.test(e)}function $2(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}var M2,L2,B2,_2,ua=P(()=>{"use strict";ts();Ho();zo();jd();By();Fy();da();s(ls,"parseSignature");s(C2,"parseFunctionSignature");s(O2,"parseEventSignature");s(D2,"parseErrorSignature");s(R2,"parseConstructorSignature");s(N2,"parseFallbackSignature");M2=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,L2=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,B2=/^u?int$/;s(Mt,"parseAbiParameter");s(tt,"splitParameters");s(qd,"isSolidityType");_2=/^(?: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)$/;s(F2,"isSolidityKeyword");s($2,"isValidDataLocation")});function ca(e){let t={},n=e.length;for(let i=0;i<n;i++){let p=e[i];if(!Rn(p))continue;let d=ky(p);if(!d)throw new Nt({signature:p,type:"struct"});let u=d.properties.split(";"),c=[],y=u.length;for(let f=0;f<y;f++){let m=u[f].trim();if(!m)continue;let b=Mt(m,{type:"struct"});c.push(b)}if(!c.length)throw new cs({signature:p});t[d.name]=c}let r={},a=Object.entries(t),o=a.length;for(let i=0;i<o;i++){let[p,d]=a[i];r[p]=$y(d,t)}return r}function $y(e=[],t={},n=new Set){let r=[],a=e.length;for(let o=0;o<a;o++){let i=e[o];if(_o.test(i.type))r.push(i);else{let d=ct(V2,i.type);if(!d?.type)throw new ds({abiParameter:i});let{array:u,type:c}=d;if(c in t){if(n.has(c))throw new ys({type:c});r.push({...i,type:`tuple${u??""}`,components:$y(t[c],t,new Set([...n,c]))})}else if(qd(c))r.push(i);else throw new rs({type:c})}}return r}var V2,Ko=P(()=>{"use strict";ts();Ho();zo();jd();Ly();da();ua();s(ca,"parseStructs");V2=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;s($y,"resolveStructs")});function ms(e){let t=ca(e),n=[],r=e.length;for(let a=0;a<r;a++){let o=e[a];Rn(o)||n.push(ls(o,t))}return n}var Vy=P(()=>{"use strict";da();Ko();ua();s(ms,"parseAbi")});function bs(e){let t;if(typeof e=="string")t=ls(e);else{let n=ca(e),r=e.length;for(let a=0;a<r;a++){let o=e[a];if(!Rn(o)){t=ls(o,n);break}}}if(!t)throw new ns({signature:e});return t}var Hy=P(()=>{"use strict";Ho();da();Ko();ua();s(bs,"parseAbiItem")});function Lt(e){let t=[];if(typeof e=="string"){let n=tt(e),r=n.length;for(let a=0;a<r;a++)t.push(Mt(n[a],{modifiers:Kd}))}else{let n=ca(e),r=e.length;for(let a=0;a<r;a++){let o=e[a];if(Rn(o))continue;let i=tt(o),p=i.length;for(let d=0;d<p;d++)t.push(Mt(i[d],{modifiers:Kd,structs:n}))}}if(t.length===0)throw new as({params:e});return t}var zy=P(()=>{"use strict";zo();da();Ko();ua();ua();s(Lt,"parseAbiParameters")});var ya=P(()=>{"use strict";my();Ud();Vy();Hy();zy()});function fe(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new hs(e.type);return`${e.name}(${fa(e.inputs,{includeName:t})})`}function fa(e,{includeName:t=!1}={}){return e?e.map(n=>H2(n,{includeName:t})).join(t?", ":","):""}function H2(e,{includeName:t}){return e.type.startsWith("tuple")?`(${fa(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}var qt=P(()=>{"use strict";be();s(fe,"formatAbiItem");s(fa,"formatAbiParams");s(H2,"formatAbiParam")});function j(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var Tt=P(()=>{"use strict";s(j,"isHex")});function K(e){return j(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var wt=P(()=>{"use strict";Tt();s(K,"size")});var Gd,Ky=P(()=>{"use strict";Gd="2.43.3"});function jy(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?jy(e.cause,t):t?null:e}var Wd,A,te=P(()=>{"use strict";Ky();Wd={getDocsUrl:s(({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,"getDocsUrl"),version:`viem@${Gd}`},A=class e extends Error{static{s(this,"BaseError")}constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath,o=Wd.getDocsUrl?.({...n,docsPath:a}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: ${o}`]:[],...r?[`Details: ${r}`]:[],...Wd.version?[`Version: ${Wd.version}`]:[]].join(`
7
+ `);super(o),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=a,this.metaMessages=n.metaMessages,this.shortMessage=t}}});function ct(e,t){return e.exec(t)?.groups}var Hd,zd,_o,ts=P(()=>{"use strict";s(ct,"execTyped");Hd=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,zd=/^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)?$/,_o=/^\(.+?\).*?$/});function Fo(e){let t=e.type;if(fy.test(e.type)&&"components"in e){t="(";let n=e.components.length;for(let a=0;a<n;a++){let o=e.components[a];t+=Fo(o),a<n-1&&(t+=", ")}let r=ct(fy,e.type);return t+=`)${r?.array||""}`,Fo({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}var fy,ly=P(()=>{"use strict";ts();fy=/^tuple(?<array>(\[(\d*)\])*)$/;s(Fo,"formatAbiParameter")});function cn(e){let t="",n=e.length;for(let r=0;r<n;r++){let a=e[r];t+=Fo(a),r!==n-1&&(t+=", ")}return t}var Ud=P(()=>{"use strict";ly();s(cn,"formatAbiParameters")});function yr(e){return e.type==="function"?`function ${e.name}(${cn(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${cn(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${cn(e.inputs)})`:e.type==="error"?`error ${e.name}(${cn(e.inputs)})`:e.type==="constructor"?`constructor(${cn(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}var my=P(()=>{"use strict";Ud();s(yr,"formatAbiItem")});function hy(e){return by.test(e)}function xy(e){return ct(by,e)}function Ty(e){return gy.test(e)}function wy(e){return ct(gy,e)}function Ey(e){return vy.test(e)}function Ay(e){return ct(vy,e)}function Rn(e){return Sy.test(e)}function ky(e){return ct(Sy,e)}function Py(e){return Iy.test(e)}function Cy(e){return ct(Iy,e)}function Dy(e){return Oy.test(e)}function Ry(e){return ct(Oy,e)}function Ny(e){return P2.test(e)}var by,gy,vy,Sy,Iy,Oy,P2,Kd,My,$o,da=P(()=>{"use strict";ts();by=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;s(hy,"isErrorSignature");s(xy,"execErrorSignature");gy=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;s(Ty,"isEventSignature");s(wy,"execEventSignature");vy=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;s(Ey,"isFunctionSignature");s(Ay,"execFunctionSignature");Sy=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;s(Rn,"isStructSignature");s(ky,"execStructSignature");Iy=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;s(Py,"isConstructorSignature");s(Cy,"execConstructorSignature");Oy=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;s(Dy,"isFallbackSignature");s(Ry,"execFallbackSignature");P2=/^receive\(\) external payable$/;s(Ny,"isReceiveSignature");Kd=new Set(["memory","indexed","storage","calldata"]),My=new Set(["indexed"]),$o=new Set(["calldata","memory","storage"])});var ns,rs,Vo,Ho=P(()=>{"use strict";pa();ns=class extends ve{static{s(this,"InvalidAbiItemError")}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"})}},rs=class extends ve{static{s(this,"UnknownTypeError")}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"})}},Vo=class extends ve{static{s(this,"UnknownSolidityTypeError")}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"})}}});var as,ss,os,is,ps,ds,zo=P(()=>{"use strict";pa();as=class extends ve{static{s(this,"InvalidAbiParametersError")}constructor({params:t}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}},ss=class extends ve{static{s(this,"InvalidParameterError")}constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},os=class extends ve{static{s(this,"SolidityProtectedKeywordError")}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"})}},is=class extends ve{static{s(this,"InvalidModifierError")}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"})}},ps=class extends ve{static{s(this,"InvalidFunctionModifierError")}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"})}},ds=class extends ve{static{s(this,"InvalidAbiTypeParameterError")}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"})}}});var Nt,us,cs,jd=P(()=>{"use strict";pa();Nt=class extends ve{static{s(this,"InvalidSignatureError")}constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},us=class extends ve{static{s(this,"UnknownSignatureError")}constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},cs=class extends ve{static{s(this,"InvalidStructSignatureError")}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"})}}});var ys,Ly=P(()=>{"use strict";pa();ys=class extends ve{static{s(this,"CircularReferenceError")}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"})}}});var fs,By=P(()=>{"use strict";pa();fs=class extends ve{static{s(this,"InvalidParenthesisError")}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 _y(e,t,n){let r="";if(n)for(let a of Object.entries(n)){if(!a)continue;let o="";for(let i of a[1])o+=`[${i.type}${i.name?`:${i.name}`:""}]`;r+=`(${a[0]}{${o}})`}return t?`${t}:${e}${r}`:`${e}${r}`}var Uo,Fy=P(()=>{"use strict";s(_y,"getParameterCacheKey");Uo=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 ls(e,t={}){if(Ey(e))return C2(e,t);if(Ty(e))return O2(e,t);if(hy(e))return D2(e,t);if(Py(e))return R2(e,t);if(Dy(e))return N2(e);if(Ny(e))return{type:"receive",stateMutability:"payable"};throw new us({signature:e})}function C2(e,t={}){let n=Ay(e);if(!n)throw new Nt({signature:e,type:"function"});let r=tt(n.parameters),a=[],o=r.length;for(let p=0;p<o;p++)a.push(Mt(r[p],{modifiers:$o,structs:t,type:"function"}));let i=[];if(n.returns){let p=tt(n.returns),d=p.length;for(let u=0;u<d;u++)i.push(Mt(p[u],{modifiers:$o,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:a,outputs:i}}function O2(e,t={}){let n=wy(e);if(!n)throw new Nt({signature:e,type:"event"});let r=tt(n.parameters),a=[],o=r.length;for(let i=0;i<o;i++)a.push(Mt(r[i],{modifiers:My,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:a}}function D2(e,t={}){let n=xy(e);if(!n)throw new Nt({signature:e,type:"error"});let r=tt(n.parameters),a=[],o=r.length;for(let i=0;i<o;i++)a.push(Mt(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:a}}function R2(e,t={}){let n=Cy(e);if(!n)throw new Nt({signature:e,type:"constructor"});let r=tt(n.parameters),a=[],o=r.length;for(let i=0;i<o;i++)a.push(Mt(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:a}}function N2(e){let t=Ry(e);if(!t)throw new Nt({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}function Mt(e,t){let n=_y(e,t?.type,t?.structs);if(Uo.has(n))return Uo.get(n);let r=_o.test(e),a=ct(r?L2:M2,e);if(!a)throw new ss({param:e});if(a.name&&F2(a.name))throw new os({param:e,name:a.name});let o=a.name?{name:a.name}:{},i=a.modifier==="indexed"?{indexed:!0}:{},p=t?.structs??{},d,u={};if(r){d="tuple";let y=tt(a.type),f=[],l=y.length;for(let m=0;m<l;m++)f.push(Mt(y[m],{structs:p}));u={components:f}}else if(a.type in p)d="tuple",u={components:p[a.type]};else if(B2.test(a.type))d=`${a.type}256`;else if(a.type==="address payable")d="address";else if(d=a.type,t?.type!=="struct"&&!qd(d))throw new Vo({type:d});if(a.modifier){if(!t?.modifiers?.has?.(a.modifier))throw new is({param:e,type:t?.type,modifier:a.modifier});if($o.has(a.modifier)&&!$2(d,!!a.array))throw new ps({param:e,type:t?.type,modifier:a.modifier})}let c={type:`${d}${a.array??""}`,...o,...i,...u};return Uo.set(n,c),c}function tt(e,t=[],n="",r=0){let a=e.trim().length;for(let o=0;o<a;o++){let i=e[o],p=e.slice(o+1);switch(i){case",":return r===0?tt(p,[...t,n.trim()]):tt(p,t,`${n}${i}`,r);case"(":return tt(p,t,`${n}${i}`,r+1);case")":return tt(p,t,`${n}${i}`,r-1);default:return tt(p,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new fs({current:n,depth:r});return t.push(n.trim()),t}function qd(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Hd.test(e)||zd.test(e)}function F2(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Hd.test(e)||zd.test(e)||_2.test(e)}function $2(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}var M2,L2,B2,_2,ua=P(()=>{"use strict";ts();Ho();zo();jd();By();Fy();da();s(ls,"parseSignature");s(C2,"parseFunctionSignature");s(O2,"parseEventSignature");s(D2,"parseErrorSignature");s(R2,"parseConstructorSignature");s(N2,"parseFallbackSignature");M2=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,L2=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,B2=/^u?int$/;s(Mt,"parseAbiParameter");s(tt,"splitParameters");s(qd,"isSolidityType");_2=/^(?: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)$/;s(F2,"isSolidityKeyword");s($2,"isValidDataLocation")});function ca(e){let t={},n=e.length;for(let i=0;i<n;i++){let p=e[i];if(!Rn(p))continue;let d=ky(p);if(!d)throw new Nt({signature:p,type:"struct"});let u=d.properties.split(";"),c=[],y=u.length;for(let f=0;f<y;f++){let m=u[f].trim();if(!m)continue;let b=Mt(m,{type:"struct"});c.push(b)}if(!c.length)throw new cs({signature:p});t[d.name]=c}let r={},a=Object.entries(t),o=a.length;for(let i=0;i<o;i++){let[p,d]=a[i];r[p]=$y(d,t)}return r}function $y(e=[],t={},n=new Set){let r=[],a=e.length;for(let o=0;o<a;o++){let i=e[o];if(_o.test(i.type))r.push(i);else{let d=ct(V2,i.type);if(!d?.type)throw new ds({abiParameter:i});let{array:u,type:c}=d;if(c in t){if(n.has(c))throw new ys({type:c});r.push({...i,type:`tuple${u??""}`,components:$y(t[c],t,new Set([...n,c]))})}else if(qd(c))r.push(i);else throw new rs({type:c})}}return r}var V2,Ko=P(()=>{"use strict";ts();Ho();zo();jd();Ly();da();ua();s(ca,"parseStructs");V2=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;s($y,"resolveStructs")});function ms(e){let t=ca(e),n=[],r=e.length;for(let a=0;a<r;a++){let o=e[a];Rn(o)||n.push(ls(o,t))}return n}var Vy=P(()=>{"use strict";da();Ko();ua();s(ms,"parseAbi")});function bs(e){let t;if(typeof e=="string")t=ls(e);else{let n=ca(e),r=e.length;for(let a=0;a<r;a++){let o=e[a];if(!Rn(o)){t=ls(o,n);break}}}if(!t)throw new ns({signature:e});return t}var Hy=P(()=>{"use strict";Ho();da();Ko();ua();s(bs,"parseAbiItem")});function Lt(e){let t=[];if(typeof e=="string"){let n=tt(e),r=n.length;for(let a=0;a<r;a++)t.push(Mt(n[a],{modifiers:Kd}))}else{let n=ca(e),r=e.length;for(let a=0;a<r;a++){let o=e[a];if(Rn(o))continue;let i=tt(o),p=i.length;for(let d=0;d<p;d++)t.push(Mt(i[d],{modifiers:Kd,structs:n}))}}if(t.length===0)throw new as({params:e});return t}var zy=P(()=>{"use strict";zo();da();Ko();ua();ua();s(Lt,"parseAbiParameters")});var ya=P(()=>{"use strict";my();Ud();Vy();Hy();zy()});function fe(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new hs(e.type);return`${e.name}(${fa(e.inputs,{includeName:t})})`}function fa(e,{includeName:t=!1}={}){return e?e.map(n=>H2(n,{includeName:t})).join(t?", ":","):""}function H2(e,{includeName:t}){return e.type.startsWith("tuple")?`(${fa(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}var qt=P(()=>{"use strict";be();s(fe,"formatAbiItem");s(fa,"formatAbiParams");s(H2,"formatAbiParam")});function j(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}var Tt=P(()=>{"use strict";s(j,"isHex")});function K(e){return j(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var wt=P(()=>{"use strict";Tt();s(K,"size")});var Gd,Ky=P(()=>{"use strict";Gd="2.43.5"});function jy(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?jy(e.cause,t):t?null:e}var Wd,A,te=P(()=>{"use strict";Ky();Wd={getDocsUrl:s(({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,"getDocsUrl"),version:`viem@${Gd}`},A=class e extends Error{static{s(this,"BaseError")}constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,a=n.cause instanceof e&&n.cause.docsPath||n.docsPath,o=Wd.getDocsUrl?.({...n,docsPath:a}),i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: ${o}`]:[],...r?[`Details: ${r}`]:[],...Wd.version?[`Version: ${Wd.version}`]:[]].join(`
8
8
  `);super(i,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=a,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Gd}walk(t){return jy(this,t)}};s(jy,"walk")});var xs,la,yn,yt,gs,Ts,fr,ws,ma,lr,mr,br,ba,vt,hr,xr,jo,gr,ft,Bt,vs,Es,Tr,hs,As,be=P(()=>{"use strict";qt();wt();te();xs=class extends A{static{s(this,"AbiConstructorNotFoundError")}constructor({docsPath:t}){super(["A constructor was not found on the ABI.","Make sure you are using the correct ABI and that the constructor exists on it."].join(`
9
9
  `),{docsPath:t,name:"AbiConstructorNotFoundError"})}},la=class extends A{static{s(this,"AbiConstructorParamsNotFoundError")}constructor({docsPath:t}){super(["Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.","Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."].join(`
10
10
  `),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}},yn=class extends A{static{s(this,"AbiDecodingDataSizeTooSmallError")}constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
@@ -24,7 +24,7 @@
24
24
  `),{docsPath:n,name:"InvalidAbiEncodingType"})}},Es=class extends A{static{s(this,"InvalidAbiDecodingTypeError")}constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
25
25
  `),{docsPath:n,name:"InvalidAbiDecodingType"})}},Tr=class extends A{static{s(this,"InvalidArrayError")}constructor(t){super([`Value "${t}" is not a valid array.`].join(`
26
26
  `),{name:"InvalidArrayError"})}},hs=class extends A{static{s(this,"InvalidDefinitionTypeError")}constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
27
- `),{name:"InvalidDefinitionTypeError"})}},As=class extends A{static{s(this,"UnsupportedPackedAbiType")}constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}});var Ss,ks,Is,Go=P(()=>{"use strict";te();Ss=class extends A{static{s(this,"SliceOffsetOutOfBoundsError")}constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},ks=class extends A{static{s(this,"SizeExceedsPaddingSizeError")}constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}},Is=class extends A{static{s(this,"InvalidBytesLengthError")}constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}});function ne(e,{dir:t,size:n=32}={}){return typeof e=="string"?Gt(e,{dir:t,size:n}):qy(e,{dir:t,size:n})}function Gt(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace("0x","");if(r.length>n*2)throw new ks({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function qy(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ks({size:e.length,targetSize:n,type:"bytes"});let r=new Uint8Array(n);for(let a=0;a<n;a++){let o=t==="right";r[o?a:n-a-1]=e[o?a:e.length-a-1]}return r}var ha=P(()=>{"use strict";Go();s(ne,"pad");s(Gt,"padHex");s(qy,"padBytes")});var xa,Wo,Yo,Zo,Ps=P(()=>{"use strict";te();xa=class extends A{static{s(this,"IntegerOutOfRangeError")}constructor({max:t,min:n,signed:r,size:a,value:o}){super(`Number "${o}" is not in safe ${a?`${a*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},Wo=class extends A{static{s(this,"InvalidBytesBooleanError")}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"})}},Yo=class extends A{static{s(this,"InvalidHexBooleanError")}constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}},Zo=class extends A{static{s(this,"SizeOverflowError")}constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function Et(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let a=0;a<n.length-1&&n[t==="left"?a:n.length-a-1].toString()==="0";a++)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}var Cs=P(()=>{"use strict";s(Et,"trim")});function We(e,{size:t}){if(K(e)>t)throw new Zo({givenSize:K(e),maxSize:t})}function Ee(e,t={}){let{signed:n}=t;t.size&&We(e,{size:t.size});let r=BigInt(e);if(!n)return r;let a=(e.length-2)/2,o=(1n<<BigInt(a)*8n-1n)-1n;return r<=o?r:r-BigInt(`0x${"f".padStart(a*2,"f")}`)-1n}function Xo(e,t={}){let n=e;if(t.size&&(We(n,{size:t.size}),n=Et(n)),Et(n)==="0x00")return!1;if(Et(n)==="0x01")return!0;throw new Yo(n)}function we(e,t={}){return Number(Ee(e,t))}function _t(e,t={}){let n=pe(e);return t.size&&(We(n,{size:t.size}),n=Et(n,{dir:"right"})),new TextDecoder().decode(n)}var He=P(()=>{"use strict";Ps();wt();Cs();De();s(We,"assertSize");s(Ee,"hexToBigInt");s(Xo,"hexToBool");s(we,"hexToNumber");s(_t,"hexToString")});function de(e,t={}){return typeof e=="number"||typeof e=="bigint"?R(e,t):typeof e=="string"?Re(e,t):typeof e=="boolean"?wr(e,t):Z(e,t)}function wr(e,t={}){let n=`0x${Number(e)}`;return typeof t.size=="number"?(We(n,{size:t.size}),ne(n,{size:t.size})):n}function Z(e,t={}){let n="";for(let a=0;a<e.length;a++)n+=z2[e[a]];let r=`0x${n}`;return typeof t.size=="number"?(We(r,{size:t.size}),ne(r,{dir:"right",size:t.size})):r}function R(e,t={}){let{signed:n,size:r}=t,a=BigInt(e),o;r?n?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof o=="bigint"&&n?-o-1n:0;if(o&&a>o||a<i){let d=typeof e=="bigint"?"n":"";throw new xa({max:o?`${o}${d}`:void 0,min:`${i}${d}`,signed:n,size:r,value:`${e}${d}`})}let p=`0x${(n&&a<0?(1n<<BigInt(r*8))+BigInt(a):a).toString(16)}`;return r?ne(p,{size:r}):p}function Re(e,t={}){let n=U2.encode(e);return Z(n,t)}var z2,U2,G=P(()=>{"use strict";Ps();ha();He();z2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));s(de,"toHex");s(wr,"boolToHex");s(Z,"bytesToHex");s(R,"numberToHex");U2=new TextEncoder;s(Re,"stringToHex")});function he(e,t={}){return typeof e=="number"||typeof e=="bigint"?Yy(e,t):typeof e=="boolean"?Wy(e,t):j(e)?pe(e,t):nt(e,t)}function Wy(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(We(n,{size:t.size}),ne(n,{size:t.size})):n}function Gy(e){if(e>=fn.zero&&e<=fn.nine)return e-fn.zero;if(e>=fn.A&&e<=fn.F)return e-(fn.A-10);if(e>=fn.a&&e<=fn.f)return e-(fn.a-10)}function pe(e,t={}){let n=e;t.size&&(We(n,{size:t.size}),n=ne(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let a=r.length/2,o=new Uint8Array(a);for(let i=0,p=0;i<a;i++){let d=Gy(r.charCodeAt(p++)),u=Gy(r.charCodeAt(p++));if(d===void 0||u===void 0)throw new A(`Invalid byte sequence ("${r[p-2]}${r[p-1]}" in "${r}").`);o[i]=d*16+u}return o}function Yy(e,t){let n=R(e,t);return pe(n)}function nt(e,t={}){let n=K2.encode(e);return typeof t.size=="number"?(We(n,{size:t.size}),ne(n,{dir:"right",size:t.size})):n}var K2,fn,De=P(()=>{"use strict";te();Tt();ha();He();G();K2=new TextEncoder;s(he,"toBytes");s(Wy,"boolToBytes");fn={zero:48,nine:57,A:65,F:70,a:97,f:102};s(Gy,"charCodeToBase16");s(pe,"hexToBytes");s(Yy,"numberToBytes");s(nt,"stringToBytes")});function j2(e,t=!1){return t?{h:Number(e&Jo),l:Number(e>>Zy&Jo)}:{h:Number(e>>Zy&Jo)|0,l:Number(e&Jo)|0}}function Xy(e,t=!1){let n=e.length,r=new Uint32Array(n),a=new Uint32Array(n);for(let o=0;o<n;o++){let{h:i,l:p}=j2(e[o],t);[r[o],a[o]]=[i,p]}return[r,a]}var Jo,Zy,Jy,Qy,ef,tf,nf=P(()=>{"use strict";Jo=BigInt(4294967295),Zy=BigInt(32);s(j2,"fromBig");s(Xy,"split");Jy=s((e,t,n)=>e<<n|t>>>32-n,"rotlSH"),Qy=s((e,t,n)=>t<<n|e>>>32-n,"rotlSL"),ef=s((e,t,n)=>t<<n-32|e>>>64-n,"rotlBH"),tf=s((e,t,n)=>e<<n-32|t>>>64-n,"rotlBL")});var vr,rf=P(()=>{"use strict";vr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function q2(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Er(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Wt(e,...t){if(!q2(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 af(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Er(e.outputLen),Er(e.blockLen)}function ln(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 Qo(e,t){Wt(e);let n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function sf(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Yt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ei(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ft(e,t){return e<<32-t|e>>>t}function W2(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Y2(e){for(let t=0;t<e.length;t++)e[t]=W2(e[t]);return e}function Z2(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ar(e){return typeof e=="string"&&(e=Z2(e)),Wt(e),e}function of(...e){let t=0;for(let r=0;r<e.length;r++){let a=e[r];Wt(a),t+=a.length}let n=new Uint8Array(t);for(let r=0,a=0;r<e.length;r++){let o=e[r];n.set(o,a),a+=o.length}return n}function ti(e){let t=s(r=>e().update(Ar(r)).digest(),"hashC"),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ni(e=32){if(vr&&typeof vr.getRandomValues=="function")return vr.getRandomValues(new Uint8Array(e));if(vr&&typeof vr.randomBytes=="function")return Uint8Array.from(vr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}var G2,Yd,Nn,Mn=P(()=>{"use strict";rf();s(q2,"isBytes");s(Er,"anumber");s(Wt,"abytes");s(af,"ahash");s(ln,"aexists");s(Qo,"aoutput");s(sf,"u32");s(Yt,"clean");s(ei,"createView");s(Ft,"rotr");G2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;s(W2,"byteSwap");s(Y2,"byteSwap32");Yd=G2?e=>e:Y2;s(Z2,"utf8ToBytes");s(Ar,"toBytes");s(of,"concatBytes");Nn=class{static{s(this,"Hash")}};s(ti,"createHasher");s(ni,"randomBytes")});function a8(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let p=(i+8)%10,d=(i+2)%10,u=n[d],c=n[d+1],y=pf(u,c,1)^n[p],f=df(u,c,1)^n[p+1];for(let l=0;l<50;l+=10)e[i+l]^=y,e[i+l+1]^=f}let a=e[2],o=e[3];for(let i=0;i<24;i++){let p=cf[i],d=pf(a,o,p),u=df(a,o,p),c=uf[i];a=e[c],o=e[c+1],e[c]=d,e[c+1]=u}for(let i=0;i<50;i+=10){for(let p=0;p<10;p++)n[p]=e[i+p];for(let p=0;p<10;p++)e[i+p]^=~n[(p+2)%10]&n[(p+4)%10]}e[0]^=n8[r],e[1]^=r8[r]}Yt(n)}var X2,Os,J2,Q2,e8,t8,uf,cf,yf,ff,n8,r8,pf,df,Zd,s8,ri,Xd=P(()=>{"use strict";nf();Mn();X2=BigInt(0),Os=BigInt(1),J2=BigInt(2),Q2=BigInt(7),e8=BigInt(256),t8=BigInt(113),uf=[],cf=[],yf=[];for(let e=0,t=Os,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],uf.push(2*(5*r+n)),cf.push((e+1)*(e+2)/2%64);let a=X2;for(let o=0;o<7;o++)t=(t<<Os^(t>>Q2)*t8)%e8,t&J2&&(a^=Os<<(Os<<BigInt(o))-Os);yf.push(a)}ff=Xy(yf,!0),n8=ff[0],r8=ff[1],pf=s((e,t,n)=>n>32?ef(e,t,n):Jy(e,t,n),"rotlH"),df=s((e,t,n)=>n>32?tf(e,t,n):Qy(e,t,n),"rotlL");s(a8,"keccakP");Zd=class e extends Nn{static{s(this,"Keccak")}constructor(t,n,r,a=!1,o=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=a,this.rounds=o,Er(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=sf(this.state)}clone(){return this._cloneInto()}keccak(){Yd(this.state32),a8(this.state32,this.rounds),Yd(this.state32),this.posOut=0,this.pos=0}update(t){ln(this),t=Ar(t),Wt(t);let{blockLen:n,state:r}=this,a=t.length;for(let o=0;o<a;){let i=Math.min(n-this.pos,a-o);for(let p=0;p<i;p++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:a}=this;t[r]^=n,(n&128)!==0&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){ln(this,!1),Wt(t),this.finish();let n=this.state,{blockLen:r}=this;for(let a=0,o=t.length;a<o;){this.posOut>=r&&this.keccak();let i=Math.min(r-this.posOut,o-a);t.set(n.subarray(this.posOut,this.posOut+i),a),this.posOut+=i,a+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Er(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Qo(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,Yt(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:a,rounds:o,enableXOF:i}=this;return t||(t=new e(n,r,a,i,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=a,t.enableXOF=i,t.destroyed=this.destroyed,t}},s8=s((e,t,n)=>ti(()=>new Zd(t,e,n)),"gen"),ri=s8(1,136,256/8)});function Y(e,t){let n=t||"hex",r=ri(j(e,{strict:!1})?he(e):e);return n==="bytes"?r:de(r)}var At=P(()=>{"use strict";Xd();Tt();De();G();s(Y,"keccak256")});function lf(e){return o8(e)}var o8,mf=P(()=>{"use strict";De();At();o8=s(e=>Y(he(e)),"hash");s(lf,"hashSignature")});function bf(e){let t=!0,n="",r=0,a="",o=!1;for(let i=0;i<e.length;i++){let p=e[i];if(["(",")",","].includes(p)&&(t=!0),p==="("&&r++,p===")"&&r--,!!t){if(r===0){if(p===" "&&["event","function",""].includes(a))a="";else if(a+=p,p===")"){o=!0;break}continue}if(p===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}a+=p,n+=p}}if(!o)throw new A("Unable to normalize signature.");return a}var hf=P(()=>{"use strict";te();s(bf,"normalizeSignature")});var xf,gf=P(()=>{"use strict";ya();hf();xf=s(e=>{let t=typeof e=="string"?e:yr(e);return bf(t)},"toSignature")});function ai(e){return lf(xf(e))}var Jd=P(()=>{"use strict";mf();gf();s(ai,"toSignatureHash")});var St,ga=P(()=>{"use strict";Jd();St=ai});var Le,Ln=P(()=>{"use strict";te();Le=class extends A{static{s(this,"InvalidAddressError")}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"})}}});var Zt,Ds=P(()=>{"use strict";Zt=class extends Map{static{s(this,"LruMap")}constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let 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){let r=this.keys().next().value;r&&this.delete(r)}return this}}});function Bn(e,t){if(Qd.has(`${e}.${t}`))return Qd.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Y(nt(n),"bytes"),a=(t?n.substring(`${t}0x`.length):n).split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&a[i]&&(a[i]=a[i].toUpperCase()),(r[i>>1]&15)>=8&&a[i+1]&&(a[i+1]=a[i+1].toUpperCase());let o=`0x${a.join("")}`;return Qd.set(`${e}.${t}`,o),o}function Xt(e,t){if(!ee(e,{strict:!1}))throw new Le({address:e});return Bn(e,t)}var Qd,Sr=P(()=>{"use strict";Ln();De();At();Ds();$t();Qd=new Zt(8192);s(Bn,"checksumAddress");s(Xt,"getAddress")});function ee(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(eu.has(r))return eu.get(r);let a=i8.test(e)?e.toLowerCase()===e?!0:n?Bn(e)===e:!0:!1;return eu.set(r,a),a}var i8,eu,$t=P(()=>{"use strict";Ds();Sr();i8=/^0x[a-fA-F0-9]{40}$/,eu=new Zt(8192);s(ee,"isAddress")});function xe(e){return typeof e[0]=="string"?Ye(e):Tf(e)}function Tf(e){let t=0;for(let a of e)t+=a.length;let n=new Uint8Array(t),r=0;for(let a of e)n.set(a,r),r+=a.length;return n}function Ye(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}var rt=P(()=>{"use strict";s(xe,"concat");s(Tf,"concatBytes");s(Ye,"concatHex")});function Q(e,t,n,{strict:r}={}){return j(e,{strict:!1})?Ef(e,t,n,{strict:r}):si(e,t,n,{strict:r})}function wf(e,t){if(typeof t=="number"&&t>0&&t>K(e)-1)throw new Ss({offset:t,position:"start",size:K(e)})}function vf(e,t,n){if(typeof t=="number"&&typeof n=="number"&&K(e)!==n-t)throw new Ss({offset:n,position:"end",size:K(e)})}function si(e,t,n,{strict:r}={}){wf(e,t);let a=e.slice(t,n);return r&&vf(a,t,n),a}function Ef(e,t,n,{strict:r}={}){wf(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&vf(a,t,n),a}var kr=P(()=>{"use strict";Go();Tt();wt();s(Q,"slice");s(wf,"assertStartOffset");s(vf,"assertEndOffset");s(si,"sliceBytes");s(Ef,"sliceHex")});var Af,oi,Ta,ii=P(()=>{"use strict";Af=/^(.*)\[([0-9]*)\]$/,oi=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ta=/^(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 ae(e,t){if(e.length!==t.length)throw new fr({expectedLength:e.length,givenLength:t.length});let n=p8({params:e,values:t}),r=nu(n);return r.length===0?"0x":r}function p8({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(tu({param:e[r],value:t[r]}));return n}function tu({param:e,value:t}){let n=pi(e.type);if(n){let[r,a]=n;return u8(t,{length:r,param:{...e,type:a}})}if(e.type==="tuple")return m8(t,{param:e});if(e.type==="address")return d8(t);if(e.type==="bool")return y8(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let r=e.type.startsWith("int"),[,,a="256"]=Ta.exec(e.type)??[];return f8(t,{signed:r,size:Number(a)})}if(e.type.startsWith("bytes"))return c8(t,{param:e});if(e.type==="string")return l8(t);throw new vs(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function nu(e){let t=0;for(let o=0;o<e.length;o++){let{dynamic:i,encoded:p}=e[o];i?t+=32:t+=K(p)}let n=[],r=[],a=0;for(let o=0;o<e.length;o++){let{dynamic:i,encoded:p}=e[o];i?(n.push(R(t+a,{size:32})),r.push(p),a+=K(p)):n.push(p)}return xe([...n,...r])}function d8(e){if(!ee(e))throw new Le({address:e});return{dynamic:!1,encoded:Gt(e.toLowerCase())}}function u8(e,{length:t,param:n}){let r=t===null;if(!Array.isArray(e))throw new Tr(e);if(!r&&e.length!==t)throw new gs({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let a=!1,o=[];for(let i=0;i<e.length;i++){let p=tu({param:n,value:e[i]});p.dynamic&&(a=!0),o.push(p)}if(r||a){let i=nu(o);if(r){let p=R(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?xe([p,i]):p}}if(a)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:xe(o.map(({encoded:i})=>i))}}function c8(e,{param:t}){let[,n]=t.type.split("bytes"),r=K(e);if(!n){let a=e;return r%32!==0&&(a=Gt(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:xe([Gt(R(r,{size:32})),a])}}if(r!==Number.parseInt(n,10))throw new Ts({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Gt(e,{dir:"right"})}}function y8(e){if(typeof e!="boolean")throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Gt(wr(e))}}function f8(e,{signed:t,size:n=256}){if(typeof n=="number"){let r=2n**(BigInt(n)-(t?1n:0n))-1n,a=t?-r-1n:0n;if(e>r||e<a)throw new xa({max:r.toString(),min:a.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:R(e,{size:32,signed:t})}}function l8(e){let t=Re(e),n=Math.ceil(K(t)/32),r=[];for(let a=0;a<n;a++)r.push(Gt(Q(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:xe([Gt(R(K(t),{size:32})),...r])}}function m8(e,{param:t}){let n=!1,r=[];for(let a=0;a<t.components.length;a++){let o=t.components[a],i=Array.isArray(e)?a:o.name,p=tu({param:o,value:e[i]});r.push(p),p.dynamic&&(n=!0)}return{dynamic:n,encoded:n?nu(r):xe(r.map(({encoded:a})=>a))}}function pi(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Jt=P(()=>{"use strict";be();Ln();te();Ps();$t();rt();ha();wt();kr();G();ii();s(ae,"encodeAbiParameters");s(p8,"prepareParams");s(tu,"prepareParam");s(nu,"encodeParams");s(d8,"encodeAddress");s(u8,"encodeArray");s(c8,"encodeBytes");s(y8,"encodeBool");s(f8,"encodeNumber");s(l8,"encodeString");s(m8,"encodeTuple");s(pi,"getArrayComponents")});var at,Ir=P(()=>{"use strict";kr();Jd();at=s(e=>Q(ai(e),0,4),"toFunctionSelector")});function st(e){let{abi:t,args:n=[],name:r}=e,a=j(r,{strict:!1}),o=t.filter(p=>a?p.type==="function"?at(p)===r:p.type==="event"?St(p)===r:!1:"name"in p&&p.name===r);if(o.length===0)return;if(o.length===1)return o[0];let i;for(let p of o){if(!("inputs"in p))continue;if(!n||n.length===0){if(!p.inputs||p.inputs.length===0)return p;continue}if(!p.inputs||p.inputs.length===0||p.inputs.length!==n.length)continue;if(n.every((u,c)=>{let y="inputs"in p&&p.inputs[c];return y?ru(u,y):!1})){if(i&&"inputs"in i&&i.inputs){let u=Sf(p.inputs,i.inputs,n);if(u)throw new jo({abiItem:p,type:u[0]},{abiItem:i,type:u[1]})}i=p}}return i||o[0]}function ru(e,t){let n=typeof e,r=t.type;switch(r){case"address":return ee(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((a,o)=>ru(Object.values(e)[o],a)):/^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(a=>ru(a,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sf(e,t,n){for(let r in e){let a=e[r],o=t[r];if(a.type==="tuple"&&o.type==="tuple"&&"components"in a&&"components"in o)return Sf(a.components,o.components,n[r]);let i=[a.type,o.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ee(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ee(n[r],{strict:!1}):!1)return i}}var _n=P(()=>{"use strict";be();Tt();$t();ga();Ir();s(st,"getAbiItem");s(ru,"isArgOfType");s(Sf,"getAmbiguousTypes")});function ye(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var lt=P(()=>{"use strict";s(ye,"parseAccount")});function Cf(e){let{abi:t,args:n,functionName:r}=e,a=t[0];if(r){let o=st({abi:t,args:n,name:r});if(!o)throw new vt(r,{docsPath:Pf});a=o}if(a.type!=="function")throw new vt(void 0,{docsPath:Pf});return{abi:[a],functionName:at(fe(a))}}var Pf,Of=P(()=>{"use strict";be();Ir();qt();_n();Pf="/docs/contract/encodeFunctionData";s(Cf,"prepareEncodeFunctionData")});function Ae(e){let{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:Cf(e),a=n[0],o=r,i="inputs"in a&&a.inputs?ae(a.inputs,t??[]):void 0;return Ye([o,i??"0x"])}var Vt=P(()=>{"use strict";rt();Jt();Of();s(Ae,"encodeFunctionData")});var Df,ui,Rf,ci=P(()=>{"use strict";Df={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},ui={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Rf={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}});var Rs,wa,yi,au=P(()=>{"use strict";te();Rs=class extends A{static{s(this,"NegativeOffsetError")}constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},wa=class extends A{static{s(this,"PositionOutOfBoundsError")}constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},yi=class extends A{static{s(this,"RecursiveReadLimitExceededError")}constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}});function va(e,{recursiveReadLimit:t=8192}={}){let n=Object.create(b8);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}var b8,fi=P(()=>{"use strict";au();b8={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 yi({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new wa({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Rs({offset:e});let 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 Rs({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let 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();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};s(va,"createCursor")});function su(e,t={}){typeof t.size<"u"&&We(e,{size:t.size});let n=Z(e,t);return Ee(n,t)}function ou(e,t={}){let n=e;if(typeof t.size<"u"&&(We(n,{size:t.size}),n=Et(n)),n.length>1||n[0]>1)throw new Wo(n);return!!n[0]}function Ht(e,t={}){typeof t.size<"u"&&We(e,{size:t.size});let n=Z(e,t);return we(n,t)}function Ns(e,t={}){let n=e;return typeof t.size<"u"&&(We(n,{size:t.size}),n=Et(n,{dir:"right"})),new TextDecoder().decode(n)}var iu=P(()=>{"use strict";Ps();Cs();He();G();s(su,"bytesToBigInt");s(ou,"bytesToBool");s(Ht,"bytesToNumber");s(Ns,"bytesToString")});function ge(e,t){let n=typeof t=="string"?pe(t):t,r=va(n);if(K(n)===0&&e.length>0)throw new yt;if(K(t)&&K(t)<32)throw new yn({data:typeof t=="string"?t:Z(t),params:e,size:K(t)});let a=0,o=[];for(let i=0;i<e.length;++i){let p=e[i];r.setPosition(a);let[d,u]=Ea(r,p,{staticPosition:0});a+=u,o.push(d)}return o}function Ea(e,t,{staticPosition:n}){let r=pi(t.type);if(r){let[a,o]=r;return x8(e,{...t,type:o},{length:a,staticPosition:n})}if(t.type==="tuple")return v8(e,t,{staticPosition:n});if(t.type==="address")return h8(e);if(t.type==="bool")return g8(e);if(t.type.startsWith("bytes"))return T8(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return w8(e,t);if(t.type==="string")return E8(e,{staticPosition:n});throw new Es(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function h8(e){let t=e.readBytes(32);return[Bn(Z(si(t,-20))),32]}function x8(e,t,{length:n,staticPosition:r}){if(!n){let i=Ht(e.readBytes(pu)),p=r+i,d=p+Nf;e.setPosition(p);let u=Ht(e.readBytes(Nf)),c=Ms(t),y=0,f=[];for(let l=0;l<u;++l){e.setPosition(d+(c?l*32:y));let[m,b]=Ea(e,t,{staticPosition:d});y+=b,f.push(m)}return e.setPosition(r+32),[f,32]}if(Ms(t)){let i=Ht(e.readBytes(pu)),p=r+i,d=[];for(let u=0;u<n;++u){e.setPosition(p+u*32);let[c]=Ea(e,t,{staticPosition:p});d.push(c)}return e.setPosition(r+32),[d,32]}let a=0,o=[];for(let i=0;i<n;++i){let[p,d]=Ea(e,t,{staticPosition:r+a});a+=d,o.push(p)}return[o,a]}function g8(e){return[ou(e.readBytes(32),{size:32}),32]}function T8(e,t,{staticPosition:n}){let[r,a]=t.type.split("bytes");if(!a){let i=Ht(e.readBytes(32));e.setPosition(n+i);let p=Ht(e.readBytes(32));if(p===0)return e.setPosition(n+32),["0x",32];let d=e.readBytes(p);return e.setPosition(n+32),[Z(d),32]}return[Z(e.readBytes(Number.parseInt(a,10),32)),32]}function w8(e,t){let n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),a=e.readBytes(32);return[r>48?su(a,{signed:n}):Ht(a,{signed:n}),32]}function v8(e,t,{staticPosition:n}){let r=t.components.length===0||t.components.some(({name:i})=>!i),a=r?[]:{},o=0;if(Ms(t)){let i=Ht(e.readBytes(pu)),p=n+i;for(let d=0;d<t.components.length;++d){let u=t.components[d];e.setPosition(p+o);let[c,y]=Ea(e,u,{staticPosition:p});o+=y,a[r?d:u?.name]=c}return e.setPosition(n+32),[a,32]}for(let i=0;i<t.components.length;++i){let p=t.components[i],[d,u]=Ea(e,p,{staticPosition:n});a[r?i:p?.name]=d,o+=u}return[a,o]}function E8(e,{staticPosition:t}){let n=Ht(e.readBytes(32)),r=t+n;e.setPosition(r);let a=Ht(e.readBytes(32));if(a===0)return e.setPosition(t+32),["",32];let o=e.readBytes(a,32),i=Ns(Et(o));return e.setPosition(t+32),[i,32]}function Ms(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Ms);let n=pi(e.type);return!!(n&&Ms({...e,type:n[1]}))}var Nf,pu,Aa=P(()=>{"use strict";be();Sr();fi();wt();kr();Cs();iu();De();G();Jt();s(ge,"decodeAbiParameters");s(Ea,"decodeParameter");Nf=32,pu=32;s(h8,"decodeAddress");s(x8,"decodeArray");s(g8,"decodeBool");s(T8,"decodeBytes");s(w8,"decodeNumber");s(v8,"decodeTuple");s(E8,"decodeString");s(Ms,"hasDynamicChild")});function li(e){let{abi:t,data:n}=e,r=Q(n,0,4);if(r==="0x")throw new yt;let o=[...t||[],ui,Rf].find(i=>i.type==="error"&&r===at(fe(i)));if(!o)throw new lr(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?ge(o.inputs,Q(n,4)):void 0,errorName:o.name}}var du=P(()=>{"use strict";ci();be();kr();Ir();Aa();qt();s(li,"decodeErrorResult")});var se,ot=P(()=>{"use strict";se=s((e,t,n)=>JSON.stringify(e,(r,a)=>{let o=typeof a=="bigint"?a.toString():a;return typeof t=="function"?t(r,o):o},n),"stringify")});function uu({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((a,o)=>`${r&&a.name?`${a.name}: `:""}${typeof t[o]=="object"?se(t[o]):t[o]}`).join(", ")})`}var Mf=P(()=>{"use strict";ot();s(uu,"formatAbiItemWithArgs")});var Lf,Bf,cu=P(()=>{"use strict";Lf={gwei:9,wei:18},Bf={ether:-9,wei:9}});function mi(e,t){let n=e.toString(),r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[a,o]=[n.slice(0,n.length-t),n.slice(n.length-t)];return o=o.replace(/(0+)$/,""),`${r?"-":""}${a||"0"}${o?`.${o}`:""}`}var yu=P(()=>{"use strict";s(mi,"formatUnits")});function Sa(e,t="wei"){return mi(e,Lf[t])}var bi=P(()=>{"use strict";cu();yu();s(Sa,"formatEther")});function Ne(e,t="wei"){return mi(e,Bf[t])}var ka=P(()=>{"use strict";cu();yu();s(Ne,"formatGwei")});function _f(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
27
+ `),{name:"InvalidDefinitionTypeError"})}},As=class extends A{static{s(this,"UnsupportedPackedAbiType")}constructor(t){super(`Type "${t}" is not supported for packed encoding.`,{name:"UnsupportedPackedAbiType"})}}});var Ss,ks,Is,Go=P(()=>{"use strict";te();Ss=class extends A{static{s(this,"SliceOffsetOutOfBoundsError")}constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},ks=class extends A{static{s(this,"SizeExceedsPaddingSizeError")}constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}},Is=class extends A{static{s(this,"InvalidBytesLengthError")}constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}}});function ne(e,{dir:t,size:n=32}={}){return typeof e=="string"?Gt(e,{dir:t,size:n}):qy(e,{dir:t,size:n})}function Gt(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace("0x","");if(r.length>n*2)throw new ks({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function qy(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ks({size:e.length,targetSize:n,type:"bytes"});let r=new Uint8Array(n);for(let a=0;a<n;a++){let o=t==="right";r[o?a:n-a-1]=e[o?a:e.length-a-1]}return r}var ha=P(()=>{"use strict";Go();s(ne,"pad");s(Gt,"padHex");s(qy,"padBytes")});var xa,Wo,Yo,Zo,Ps=P(()=>{"use strict";te();xa=class extends A{static{s(this,"IntegerOutOfRangeError")}constructor({max:t,min:n,signed:r,size:a,value:o}){super(`Number "${o}" is not in safe ${a?`${a*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},Wo=class extends A{static{s(this,"InvalidBytesBooleanError")}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"})}},Yo=class extends A{static{s(this,"InvalidHexBooleanError")}constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}},Zo=class extends A{static{s(this,"SizeOverflowError")}constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}});function Et(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let a=0;a<n.length-1&&n[t==="left"?a:n.length-a-1].toString()==="0";a++)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}var Cs=P(()=>{"use strict";s(Et,"trim")});function We(e,{size:t}){if(K(e)>t)throw new Zo({givenSize:K(e),maxSize:t})}function Ee(e,t={}){let{signed:n}=t;t.size&&We(e,{size:t.size});let r=BigInt(e);if(!n)return r;let a=(e.length-2)/2,o=(1n<<BigInt(a)*8n-1n)-1n;return r<=o?r:r-BigInt(`0x${"f".padStart(a*2,"f")}`)-1n}function Xo(e,t={}){let n=e;if(t.size&&(We(n,{size:t.size}),n=Et(n)),Et(n)==="0x00")return!1;if(Et(n)==="0x01")return!0;throw new Yo(n)}function we(e,t={}){return Number(Ee(e,t))}function _t(e,t={}){let n=pe(e);return t.size&&(We(n,{size:t.size}),n=Et(n,{dir:"right"})),new TextDecoder().decode(n)}var He=P(()=>{"use strict";Ps();wt();Cs();De();s(We,"assertSize");s(Ee,"hexToBigInt");s(Xo,"hexToBool");s(we,"hexToNumber");s(_t,"hexToString")});function de(e,t={}){return typeof e=="number"||typeof e=="bigint"?R(e,t):typeof e=="string"?Re(e,t):typeof e=="boolean"?wr(e,t):Z(e,t)}function wr(e,t={}){let n=`0x${Number(e)}`;return typeof t.size=="number"?(We(n,{size:t.size}),ne(n,{size:t.size})):n}function Z(e,t={}){let n="";for(let a=0;a<e.length;a++)n+=z2[e[a]];let r=`0x${n}`;return typeof t.size=="number"?(We(r,{size:t.size}),ne(r,{dir:"right",size:t.size})):r}function R(e,t={}){let{signed:n,size:r}=t,a=BigInt(e),o;r?n?o=(1n<<BigInt(r)*8n-1n)-1n:o=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(o=BigInt(Number.MAX_SAFE_INTEGER));let i=typeof o=="bigint"&&n?-o-1n:0;if(o&&a>o||a<i){let d=typeof e=="bigint"?"n":"";throw new xa({max:o?`${o}${d}`:void 0,min:`${i}${d}`,signed:n,size:r,value:`${e}${d}`})}let p=`0x${(n&&a<0?(1n<<BigInt(r*8))+BigInt(a):a).toString(16)}`;return r?ne(p,{size:r}):p}function Re(e,t={}){let n=U2.encode(e);return Z(n,t)}var z2,U2,G=P(()=>{"use strict";Ps();ha();He();z2=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));s(de,"toHex");s(wr,"boolToHex");s(Z,"bytesToHex");s(R,"numberToHex");U2=new TextEncoder;s(Re,"stringToHex")});function he(e,t={}){return typeof e=="number"||typeof e=="bigint"?Yy(e,t):typeof e=="boolean"?Wy(e,t):j(e)?pe(e,t):nt(e,t)}function Wy(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(We(n,{size:t.size}),ne(n,{size:t.size})):n}function Gy(e){if(e>=fn.zero&&e<=fn.nine)return e-fn.zero;if(e>=fn.A&&e<=fn.F)return e-(fn.A-10);if(e>=fn.a&&e<=fn.f)return e-(fn.a-10)}function pe(e,t={}){let n=e;t.size&&(We(n,{size:t.size}),n=ne(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let a=r.length/2,o=new Uint8Array(a);for(let i=0,p=0;i<a;i++){let d=Gy(r.charCodeAt(p++)),u=Gy(r.charCodeAt(p++));if(d===void 0||u===void 0)throw new A(`Invalid byte sequence ("${r[p-2]}${r[p-1]}" in "${r}").`);o[i]=d*16+u}return o}function Yy(e,t){let n=R(e,t);return pe(n)}function nt(e,t={}){let n=K2.encode(e);return typeof t.size=="number"?(We(n,{size:t.size}),ne(n,{dir:"right",size:t.size})):n}var K2,fn,De=P(()=>{"use strict";te();Tt();ha();He();G();K2=new TextEncoder;s(he,"toBytes");s(Wy,"boolToBytes");fn={zero:48,nine:57,A:65,F:70,a:97,f:102};s(Gy,"charCodeToBase16");s(pe,"hexToBytes");s(Yy,"numberToBytes");s(nt,"stringToBytes")});function j2(e,t=!1){return t?{h:Number(e&Jo),l:Number(e>>Zy&Jo)}:{h:Number(e>>Zy&Jo)|0,l:Number(e&Jo)|0}}function Xy(e,t=!1){let n=e.length,r=new Uint32Array(n),a=new Uint32Array(n);for(let o=0;o<n;o++){let{h:i,l:p}=j2(e[o],t);[r[o],a[o]]=[i,p]}return[r,a]}var Jo,Zy,Jy,Qy,ef,tf,nf=P(()=>{"use strict";Jo=BigInt(4294967295),Zy=BigInt(32);s(j2,"fromBig");s(Xy,"split");Jy=s((e,t,n)=>e<<n|t>>>32-n,"rotlSH"),Qy=s((e,t,n)=>t<<n|e>>>32-n,"rotlSL"),ef=s((e,t,n)=>t<<n-32|e>>>64-n,"rotlBH"),tf=s((e,t,n)=>e<<n-32|t>>>64-n,"rotlBL")});var vr,rf=P(()=>{"use strict";vr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0});function q2(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Er(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function Wt(e,...t){if(!q2(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 af(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Er(e.outputLen),Er(e.blockLen)}function ln(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 Qo(e,t){Wt(e);let n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function sf(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Yt(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ei(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ft(e,t){return e<<32-t|e>>>t}function W2(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Y2(e){for(let t=0;t<e.length;t++)e[t]=W2(e[t]);return e}function Z2(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Ar(e){return typeof e=="string"&&(e=Z2(e)),Wt(e),e}function of(...e){let t=0;for(let r=0;r<e.length;r++){let a=e[r];Wt(a),t+=a.length}let n=new Uint8Array(t);for(let r=0,a=0;r<e.length;r++){let o=e[r];n.set(o,a),a+=o.length}return n}function ti(e){let t=s(r=>e().update(Ar(r)).digest(),"hashC"),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ni(e=32){if(vr&&typeof vr.getRandomValues=="function")return vr.getRandomValues(new Uint8Array(e));if(vr&&typeof vr.randomBytes=="function")return Uint8Array.from(vr.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}var G2,Yd,Nn,Mn=P(()=>{"use strict";rf();s(q2,"isBytes");s(Er,"anumber");s(Wt,"abytes");s(af,"ahash");s(ln,"aexists");s(Qo,"aoutput");s(sf,"u32");s(Yt,"clean");s(ei,"createView");s(Ft,"rotr");G2=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;s(W2,"byteSwap");s(Y2,"byteSwap32");Yd=G2?e=>e:Y2;s(Z2,"utf8ToBytes");s(Ar,"toBytes");s(of,"concatBytes");Nn=class{static{s(this,"Hash")}};s(ti,"createHasher");s(ni,"randomBytes")});function a8(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(let i=0;i<10;i+=2){let p=(i+8)%10,d=(i+2)%10,u=n[d],c=n[d+1],y=pf(u,c,1)^n[p],f=df(u,c,1)^n[p+1];for(let l=0;l<50;l+=10)e[i+l]^=y,e[i+l+1]^=f}let a=e[2],o=e[3];for(let i=0;i<24;i++){let p=cf[i],d=pf(a,o,p),u=df(a,o,p),c=uf[i];a=e[c],o=e[c+1],e[c]=d,e[c+1]=u}for(let i=0;i<50;i+=10){for(let p=0;p<10;p++)n[p]=e[i+p];for(let p=0;p<10;p++)e[i+p]^=~n[(p+2)%10]&n[(p+4)%10]}e[0]^=n8[r],e[1]^=r8[r]}Yt(n)}var X2,Os,J2,Q2,e8,t8,uf,cf,yf,ff,n8,r8,pf,df,Zd,s8,ri,Xd=P(()=>{"use strict";nf();Mn();X2=BigInt(0),Os=BigInt(1),J2=BigInt(2),Q2=BigInt(7),e8=BigInt(256),t8=BigInt(113),uf=[],cf=[],yf=[];for(let e=0,t=Os,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],uf.push(2*(5*r+n)),cf.push((e+1)*(e+2)/2%64);let a=X2;for(let o=0;o<7;o++)t=(t<<Os^(t>>Q2)*t8)%e8,t&J2&&(a^=Os<<(Os<<BigInt(o))-Os);yf.push(a)}ff=Xy(yf,!0),n8=ff[0],r8=ff[1],pf=s((e,t,n)=>n>32?ef(e,t,n):Jy(e,t,n),"rotlH"),df=s((e,t,n)=>n>32?tf(e,t,n):Qy(e,t,n),"rotlL");s(a8,"keccakP");Zd=class e extends Nn{static{s(this,"Keccak")}constructor(t,n,r,a=!1,o=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=a,this.rounds=o,Er(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=sf(this.state)}clone(){return this._cloneInto()}keccak(){Yd(this.state32),a8(this.state32,this.rounds),Yd(this.state32),this.posOut=0,this.pos=0}update(t){ln(this),t=Ar(t),Wt(t);let{blockLen:n,state:r}=this,a=t.length;for(let o=0;o<a;){let i=Math.min(n-this.pos,a-o);for(let p=0;p<i;p++)r[this.pos++]^=t[o++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:a}=this;t[r]^=n,(n&128)!==0&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){ln(this,!1),Wt(t),this.finish();let n=this.state,{blockLen:r}=this;for(let a=0,o=t.length;a<o;){this.posOut>=r&&this.keccak();let i=Math.min(r-this.posOut,o-a);t.set(n.subarray(this.posOut,this.posOut+i),a),this.posOut+=i,a+=i}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Er(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Qo(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,Yt(this.state)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:a,rounds:o,enableXOF:i}=this;return t||(t=new e(n,r,a,i,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=r,t.outputLen=a,t.enableXOF=i,t.destroyed=this.destroyed,t}},s8=s((e,t,n)=>ti(()=>new Zd(t,e,n)),"gen"),ri=s8(1,136,256/8)});function Y(e,t){let n=t||"hex",r=ri(j(e,{strict:!1})?he(e):e);return n==="bytes"?r:de(r)}var At=P(()=>{"use strict";Xd();Tt();De();G();s(Y,"keccak256")});function lf(e){return o8(e)}var o8,mf=P(()=>{"use strict";De();At();o8=s(e=>Y(he(e)),"hash");s(lf,"hashSignature")});function bf(e){let t=!0,n="",r=0,a="",o=!1;for(let i=0;i<e.length;i++){let p=e[i];if(["(",")",","].includes(p)&&(t=!0),p==="("&&r++,p===")"&&r--,!!t){if(r===0){if(p===" "&&["event","function",""].includes(a))a="";else if(a+=p,p===")"){o=!0;break}continue}if(p===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}a+=p,n+=p}}if(!o)throw new A("Unable to normalize signature.");return a}var hf=P(()=>{"use strict";te();s(bf,"normalizeSignature")});var xf,gf=P(()=>{"use strict";ya();hf();xf=s(e=>{let t=typeof e=="string"?e:yr(e);return bf(t)},"toSignature")});function ai(e){return lf(xf(e))}var Jd=P(()=>{"use strict";mf();gf();s(ai,"toSignatureHash")});var St,ga=P(()=>{"use strict";Jd();St=ai});var Le,Ln=P(()=>{"use strict";te();Le=class extends A{static{s(this,"InvalidAddressError")}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"})}}});var Zt,Ds=P(()=>{"use strict";Zt=class extends Map{static{s(this,"LruMap")}constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let 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){let r=this.keys().next().value;r&&this.delete(r)}return this}}});function Bn(e,t){if(Qd.has(`${e}.${t}`))return Qd.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=Y(nt(n),"bytes"),a=(t?n.substring(`${t}0x`.length):n).split("");for(let i=0;i<40;i+=2)r[i>>1]>>4>=8&&a[i]&&(a[i]=a[i].toUpperCase()),(r[i>>1]&15)>=8&&a[i+1]&&(a[i+1]=a[i+1].toUpperCase());let o=`0x${a.join("")}`;return Qd.set(`${e}.${t}`,o),o}function Xt(e,t){if(!ee(e,{strict:!1}))throw new Le({address:e});return Bn(e,t)}var Qd,Sr=P(()=>{"use strict";Ln();De();At();Ds();$t();Qd=new Zt(8192);s(Bn,"checksumAddress");s(Xt,"getAddress")});function ee(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(eu.has(r))return eu.get(r);let a=i8.test(e)?e.toLowerCase()===e?!0:n?Bn(e)===e:!0:!1;return eu.set(r,a),a}var i8,eu,$t=P(()=>{"use strict";Ds();Sr();i8=/^0x[a-fA-F0-9]{40}$/,eu=new Zt(8192);s(ee,"isAddress")});function xe(e){return typeof e[0]=="string"?Ye(e):Tf(e)}function Tf(e){let t=0;for(let a of e)t+=a.length;let n=new Uint8Array(t),r=0;for(let a of e)n.set(a,r),r+=a.length;return n}function Ye(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}var rt=P(()=>{"use strict";s(xe,"concat");s(Tf,"concatBytes");s(Ye,"concatHex")});function Q(e,t,n,{strict:r}={}){return j(e,{strict:!1})?Ef(e,t,n,{strict:r}):si(e,t,n,{strict:r})}function wf(e,t){if(typeof t=="number"&&t>0&&t>K(e)-1)throw new Ss({offset:t,position:"start",size:K(e)})}function vf(e,t,n){if(typeof t=="number"&&typeof n=="number"&&K(e)!==n-t)throw new Ss({offset:n,position:"end",size:K(e)})}function si(e,t,n,{strict:r}={}){wf(e,t);let a=e.slice(t,n);return r&&vf(a,t,n),a}function Ef(e,t,n,{strict:r}={}){wf(e,t);let a=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&vf(a,t,n),a}var kr=P(()=>{"use strict";Go();Tt();wt();s(Q,"slice");s(wf,"assertStartOffset");s(vf,"assertEndOffset");s(si,"sliceBytes");s(Ef,"sliceHex")});var Af,oi,Ta,ii=P(()=>{"use strict";Af=/^(.*)\[([0-9]*)\]$/,oi=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ta=/^(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 ae(e,t){if(e.length!==t.length)throw new fr({expectedLength:e.length,givenLength:t.length});let n=p8({params:e,values:t}),r=nu(n);return r.length===0?"0x":r}function p8({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(tu({param:e[r],value:t[r]}));return n}function tu({param:e,value:t}){let n=pi(e.type);if(n){let[r,a]=n;return u8(t,{length:r,param:{...e,type:a}})}if(e.type==="tuple")return m8(t,{param:e});if(e.type==="address")return d8(t);if(e.type==="bool")return y8(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let r=e.type.startsWith("int"),[,,a="256"]=Ta.exec(e.type)??[];return f8(t,{signed:r,size:Number(a)})}if(e.type.startsWith("bytes"))return c8(t,{param:e});if(e.type==="string")return l8(t);throw new vs(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function nu(e){let t=0;for(let o=0;o<e.length;o++){let{dynamic:i,encoded:p}=e[o];i?t+=32:t+=K(p)}let n=[],r=[],a=0;for(let o=0;o<e.length;o++){let{dynamic:i,encoded:p}=e[o];i?(n.push(R(t+a,{size:32})),r.push(p),a+=K(p)):n.push(p)}return xe([...n,...r])}function d8(e){if(!ee(e))throw new Le({address:e});return{dynamic:!1,encoded:Gt(e.toLowerCase())}}function u8(e,{length:t,param:n}){let r=t===null;if(!Array.isArray(e))throw new Tr(e);if(!r&&e.length!==t)throw new gs({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let a=!1,o=[];for(let i=0;i<e.length;i++){let p=tu({param:n,value:e[i]});p.dynamic&&(a=!0),o.push(p)}if(r||a){let i=nu(o);if(r){let p=R(o.length,{size:32});return{dynamic:!0,encoded:o.length>0?xe([p,i]):p}}if(a)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:xe(o.map(({encoded:i})=>i))}}function c8(e,{param:t}){let[,n]=t.type.split("bytes"),r=K(e);if(!n){let a=e;return r%32!==0&&(a=Gt(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:xe([Gt(R(r,{size:32})),a])}}if(r!==Number.parseInt(n,10))throw new Ts({expectedSize:Number.parseInt(n,10),value:e});return{dynamic:!1,encoded:Gt(e,{dir:"right"})}}function y8(e){if(typeof e!="boolean")throw new A(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:Gt(wr(e))}}function f8(e,{signed:t,size:n=256}){if(typeof n=="number"){let r=2n**(BigInt(n)-(t?1n:0n))-1n,a=t?-r-1n:0n;if(e>r||e<a)throw new xa({max:r.toString(),min:a.toString(),signed:t,size:n/8,value:e.toString()})}return{dynamic:!1,encoded:R(e,{size:32,signed:t})}}function l8(e){let t=Re(e),n=Math.ceil(K(t)/32),r=[];for(let a=0;a<n;a++)r.push(Gt(Q(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:xe([Gt(R(K(t),{size:32})),...r])}}function m8(e,{param:t}){let n=!1,r=[];for(let a=0;a<t.components.length;a++){let o=t.components[a],i=Array.isArray(e)?a:o.name,p=tu({param:o,value:e[i]});r.push(p),p.dynamic&&(n=!0)}return{dynamic:n,encoded:n?nu(r):xe(r.map(({encoded:a})=>a))}}function pi(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Jt=P(()=>{"use strict";be();Ln();te();Ps();$t();rt();ha();wt();kr();G();ii();s(ae,"encodeAbiParameters");s(p8,"prepareParams");s(tu,"prepareParam");s(nu,"encodeParams");s(d8,"encodeAddress");s(u8,"encodeArray");s(c8,"encodeBytes");s(y8,"encodeBool");s(f8,"encodeNumber");s(l8,"encodeString");s(m8,"encodeTuple");s(pi,"getArrayComponents")});var at,Ir=P(()=>{"use strict";kr();Jd();at=s(e=>Q(ai(e),0,4),"toFunctionSelector")});function st(e){let{abi:t,args:n=[],name:r}=e,a=j(r,{strict:!1}),o=t.filter(p=>a?p.type==="function"?at(p)===r:p.type==="event"?St(p)===r:!1:"name"in p&&p.name===r);if(o.length===0)return;if(o.length===1)return o[0];let i;for(let p of o){if(!("inputs"in p))continue;if(!n||n.length===0){if(!p.inputs||p.inputs.length===0)return p;continue}if(!p.inputs||p.inputs.length===0||p.inputs.length!==n.length)continue;if(n.every((u,c)=>{let y="inputs"in p&&p.inputs[c];return y?ru(u,y):!1})){if(i&&"inputs"in i&&i.inputs){let u=Sf(p.inputs,i.inputs,n);if(u)throw new jo({abiItem:p,type:u[0]},{abiItem:i,type:u[1]})}i=p}}return i||o[0]}function ru(e,t){let n=typeof e,r=t.type;switch(r){case"address":return ee(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((a,o)=>n==="object"&&ru(Object.values(e)[o],a)):/^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(a=>ru(a,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Sf(e,t,n){for(let r in e){let a=e[r],o=t[r];if(a.type==="tuple"&&o.type==="tuple"&&"components"in a&&"components"in o)return Sf(a.components,o.components,n[r]);let i=[a.type,o.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ee(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ee(n[r],{strict:!1}):!1)return i}}var _n=P(()=>{"use strict";be();Tt();$t();ga();Ir();s(st,"getAbiItem");s(ru,"isArgOfType");s(Sf,"getAmbiguousTypes")});function ye(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var lt=P(()=>{"use strict";s(ye,"parseAccount")});function Cf(e){let{abi:t,args:n,functionName:r}=e,a=t[0];if(r){let o=st({abi:t,args:n,name:r});if(!o)throw new vt(r,{docsPath:Pf});a=o}if(a.type!=="function")throw new vt(void 0,{docsPath:Pf});return{abi:[a],functionName:at(fe(a))}}var Pf,Of=P(()=>{"use strict";be();Ir();qt();_n();Pf="/docs/contract/encodeFunctionData";s(Cf,"prepareEncodeFunctionData")});function Ae(e){let{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:Cf(e),a=n[0],o=r,i="inputs"in a&&a.inputs?ae(a.inputs,t??[]):void 0;return Ye([o,i??"0x"])}var Vt=P(()=>{"use strict";rt();Jt();Of();s(Ae,"encodeFunctionData")});var Df,ui,Rf,ci=P(()=>{"use strict";Df={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},ui={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Rf={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}});var Rs,wa,yi,au=P(()=>{"use strict";te();Rs=class extends A{static{s(this,"NegativeOffsetError")}constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},wa=class extends A{static{s(this,"PositionOutOfBoundsError")}constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},yi=class extends A{static{s(this,"RecursiveReadLimitExceededError")}constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}}});function va(e,{recursiveReadLimit:t=8192}={}){let n=Object.create(b8);return n.bytes=e,n.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}var b8,fi=P(()=>{"use strict";au();b8={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 yi({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new wa({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new Rs({offset:e});let 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 Rs({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let 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();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};s(va,"createCursor")});function su(e,t={}){typeof t.size<"u"&&We(e,{size:t.size});let n=Z(e,t);return Ee(n,t)}function ou(e,t={}){let n=e;if(typeof t.size<"u"&&(We(n,{size:t.size}),n=Et(n)),n.length>1||n[0]>1)throw new Wo(n);return!!n[0]}function Ht(e,t={}){typeof t.size<"u"&&We(e,{size:t.size});let n=Z(e,t);return we(n,t)}function Ns(e,t={}){let n=e;return typeof t.size<"u"&&(We(n,{size:t.size}),n=Et(n,{dir:"right"})),new TextDecoder().decode(n)}var iu=P(()=>{"use strict";Ps();Cs();He();G();s(su,"bytesToBigInt");s(ou,"bytesToBool");s(Ht,"bytesToNumber");s(Ns,"bytesToString")});function ge(e,t){let n=typeof t=="string"?pe(t):t,r=va(n);if(K(n)===0&&e.length>0)throw new yt;if(K(t)&&K(t)<32)throw new yn({data:typeof t=="string"?t:Z(t),params:e,size:K(t)});let a=0,o=[];for(let i=0;i<e.length;++i){let p=e[i];r.setPosition(a);let[d,u]=Ea(r,p,{staticPosition:0});a+=u,o.push(d)}return o}function Ea(e,t,{staticPosition:n}){let r=pi(t.type);if(r){let[a,o]=r;return x8(e,{...t,type:o},{length:a,staticPosition:n})}if(t.type==="tuple")return v8(e,t,{staticPosition:n});if(t.type==="address")return h8(e);if(t.type==="bool")return g8(e);if(t.type.startsWith("bytes"))return T8(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return w8(e,t);if(t.type==="string")return E8(e,{staticPosition:n});throw new Es(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function h8(e){let t=e.readBytes(32);return[Bn(Z(si(t,-20))),32]}function x8(e,t,{length:n,staticPosition:r}){if(!n){let i=Ht(e.readBytes(pu)),p=r+i,d=p+Nf;e.setPosition(p);let u=Ht(e.readBytes(Nf)),c=Ms(t),y=0,f=[];for(let l=0;l<u;++l){e.setPosition(d+(c?l*32:y));let[m,b]=Ea(e,t,{staticPosition:d});y+=b,f.push(m)}return e.setPosition(r+32),[f,32]}if(Ms(t)){let i=Ht(e.readBytes(pu)),p=r+i,d=[];for(let u=0;u<n;++u){e.setPosition(p+u*32);let[c]=Ea(e,t,{staticPosition:p});d.push(c)}return e.setPosition(r+32),[d,32]}let a=0,o=[];for(let i=0;i<n;++i){let[p,d]=Ea(e,t,{staticPosition:r+a});a+=d,o.push(p)}return[o,a]}function g8(e){return[ou(e.readBytes(32),{size:32}),32]}function T8(e,t,{staticPosition:n}){let[r,a]=t.type.split("bytes");if(!a){let i=Ht(e.readBytes(32));e.setPosition(n+i);let p=Ht(e.readBytes(32));if(p===0)return e.setPosition(n+32),["0x",32];let d=e.readBytes(p);return e.setPosition(n+32),[Z(d),32]}return[Z(e.readBytes(Number.parseInt(a,10),32)),32]}function w8(e,t){let n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256",10),a=e.readBytes(32);return[r>48?su(a,{signed:n}):Ht(a,{signed:n}),32]}function v8(e,t,{staticPosition:n}){let r=t.components.length===0||t.components.some(({name:i})=>!i),a=r?[]:{},o=0;if(Ms(t)){let i=Ht(e.readBytes(pu)),p=n+i;for(let d=0;d<t.components.length;++d){let u=t.components[d];e.setPosition(p+o);let[c,y]=Ea(e,u,{staticPosition:p});o+=y,a[r?d:u?.name]=c}return e.setPosition(n+32),[a,32]}for(let i=0;i<t.components.length;++i){let p=t.components[i],[d,u]=Ea(e,p,{staticPosition:n});a[r?i:p?.name]=d,o+=u}return[a,o]}function E8(e,{staticPosition:t}){let n=Ht(e.readBytes(32)),r=t+n;e.setPosition(r);let a=Ht(e.readBytes(32));if(a===0)return e.setPosition(t+32),["",32];let o=e.readBytes(a,32),i=Ns(Et(o));return e.setPosition(t+32),[i,32]}function Ms(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(Ms);let n=pi(e.type);return!!(n&&Ms({...e,type:n[1]}))}var Nf,pu,Aa=P(()=>{"use strict";be();Sr();fi();wt();kr();Cs();iu();De();G();Jt();s(ge,"decodeAbiParameters");s(Ea,"decodeParameter");Nf=32,pu=32;s(h8,"decodeAddress");s(x8,"decodeArray");s(g8,"decodeBool");s(T8,"decodeBytes");s(w8,"decodeNumber");s(v8,"decodeTuple");s(E8,"decodeString");s(Ms,"hasDynamicChild")});function li(e){let{abi:t,data:n}=e,r=Q(n,0,4);if(r==="0x")throw new yt;let o=[...t||[],ui,Rf].find(i=>i.type==="error"&&r===at(fe(i)));if(!o)throw new lr(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?ge(o.inputs,Q(n,4)):void 0,errorName:o.name}}var du=P(()=>{"use strict";ci();be();kr();Ir();Aa();qt();s(li,"decodeErrorResult")});var se,ot=P(()=>{"use strict";se=s((e,t,n)=>JSON.stringify(e,(r,a)=>{let o=typeof a=="bigint"?a.toString():a;return typeof t=="function"?t(r,o):o},n),"stringify")});function uu({abiItem:e,args:t,includeFunctionName:n=!0,includeName:r=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${n?e.name:""}(${e.inputs.map((a,o)=>`${r&&a.name?`${a.name}: `:""}${typeof t[o]=="object"?se(t[o]):t[o]}`).join(", ")})`}var Mf=P(()=>{"use strict";ot();s(uu,"formatAbiItemWithArgs")});var Lf,Bf,cu=P(()=>{"use strict";Lf={gwei:9,wei:18},Bf={ether:-9,wei:9}});function mi(e,t){let n=e.toString(),r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[a,o]=[n.slice(0,n.length-t),n.slice(n.length-t)];return o=o.replace(/(0+)$/,""),`${r?"-":""}${a||"0"}${o?`.${o}`:""}`}var yu=P(()=>{"use strict";s(mi,"formatUnits")});function Sa(e,t="wei"){return mi(e,Lf[t])}var bi=P(()=>{"use strict";cu();yu();s(Sa,"formatEther")});function Ne(e,t="wei"){return mi(e,Bf[t])}var ka=P(()=>{"use strict";cu();yu();s(Ne,"formatGwei")});function _f(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
28
28
  `,"")}function Ff(e){return e.reduce((t,{address:n,...r})=>{let a=`${t} ${n}:
29
29
  `;return r.nonce&&(a+=` nonce: ${r.nonce}
30
30
  `),r.balance&&(a+=` balance: ${r.balance}