var Bt="1.21.3";var St=e=>e,ce=e=>e,It=()=>`viem@${Bt}`;var a=class e extends Error{constructor(t,r={}){super(),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:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:It()});let n=r.cause instanceof e?r.cause.details:r.cause?.message?r.cause.message:r.details,o=r.cause instanceof e&&r.cause.docsPath||r.docsPath;this.message=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://viem.sh${o}.html${r.docsSlug?`#${r.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(`
`),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.shortMessage=t;}walk(t){return zt(this,t)}};function zt(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?zt(e.cause,t):t?null:e}function $(e,{strict:t=!0}={}){return !e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function U(e){return typeof e[0]=="string"?_e(e):en(e)}function en(e){let t=0;for(let o of e)t+=o.length;let r=new Uint8Array(t),n=0;for(let o of e)r.set(o,n),n+=o.length;return r}function _e(e){return `0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}function v(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new xe(e.type);return `${e.name}(${le(e.inputs,{includeName:t})})`}function le(e,{includeName:t=!1}={}){return e?e.map(r=>tn(r,{includeName:t})).join(t?", ":","):""}function tn(e,{includeName:t}){return e.type.startsWith("tuple")?`(${le(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function h(e){return $(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Ct=class extends a{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(`
`),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"});}},Ft=class extends a{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(`
`),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"});}};var fe=class extends a{constructor({data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(`
`),{metaMessages:[`Params: (${le(r,{includeName:!0})})`,`Data:   ${t} (${n} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=r,this.size=n;}},q=class extends a{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"});}},we=class extends a{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"});}},ve=class extends a{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${h(r)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"});}},Pe=class extends a{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"});}};var V=class extends a{constructor(t,{docsPath:r}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t;}},Lt=class extends a{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureEmptyTopicsError"});}},Ht=class extends a{constructor(t,{docsPath:r}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"});}},Rt=class extends a{constructor(t,{docsPath:r}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"});}},S=class extends a{constructor(t,{docsPath:r}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"});}},$e=class extends a{constructor(t,{docsPath:r}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"});}};var Ae=class extends a{constructor(t,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${v(t.abiItem)}\`, and`,`\`${r.type}\` in \`${v(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"});}},Nt=class extends a{constructor({expectedSize:t,givenSize:r}){super(`Expected bytes${t}, got bytes${r}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"});}},Ut=class extends a{constructor({abiItem:t,data:r,params:n,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
`),{metaMessages:[`Params: (${le(n,{includeName:!0})})`,`Data:   ${r} (${o} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=r,this.params=n,this.size=o;}},Dt=class extends a{constructor({abiItem:t,param:r}){super([`Expected a topic for indexed event parameter${r.name?` "${r.name}"`:""} on event "${v(t,{includeName:!0})}".`].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t;}},je=class extends a{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"});}},Oe=class extends a{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
`),{docsPath:r}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"});}},Ee=class extends a{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"});}},xe=class extends a{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"});}};var E=class extends a{constructor({address:t}){super(`Address "${t}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"});}};var rn=/^0x[a-fA-F0-9]{40}$/;function P(e){return rn.test(e)}var de=class extends a{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${n}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"});}},pe=class extends a{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${r}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"});}};function I(e,{dir:t,size:r=32}={}){return typeof e=="string"?T(e,{dir:t,size:r}):nn(e,{dir:t,size:r})}function T(e,{dir:t,size:r=32}={}){if(r===null)return e;let n=e.replace("0x","");if(n.length>r*2)throw new pe({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return `0x${n[t==="right"?"padEnd":"padStart"](r*2,"0")}`}function nn(e,{dir:t,size:r=32}={}){if(r===null)return e;if(e.length>r)throw new pe({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let o=0;o<r;o++){let i=t==="right";n[i?o:r-o-1]=e[i?o:e.length-o-1];}return n}function b(e,t,r,{strict:n}={}){return $(e,{strict:!1})?sn(e,t,r,{strict:n}):on(e,t,r,{strict:n})}function Gt(e,t){if(typeof t=="number"&&t>0&&t>h(e)-1)throw new de({offset:t,position:"start",size:h(e)})}function Wt(e,t,r){if(typeof t=="number"&&typeof r=="number"&&h(e)!==r-t)throw new de({offset:r,position:"end",size:h(e)})}function on(e,t,r,{strict:n}={}){Gt(e,t);let o=e.slice(t,r);return n&&Wt(o,t,r),o}function sn(e,t,r,{strict:n}={}){Gt(e,t);let o=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&Wt(o,t,r),o}var Te=class extends a{constructor({max:t,min:r,signed:n,size:o,value:i}){super(`Number "${i}" is not in safe ${o?`${o*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${r} to ${t})`:`(above ${r})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"});}};var ke=class extends a{constructor(t){super(`Hex value "${t}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidHexBooleanError"});}};var Me=class extends a{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed ${r} bytes. Given size: ${t} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"});}};function D(e,{dir:t="left"}={}){let r=typeof e=="string"?e.replace("0x",""):e,n=0;for(let o=0;o<r.length-1&&r[t==="left"?o:r.length-o-1].toString()==="0";o++)n++;return r=t==="left"?r.slice(n):r.slice(0,r.length-n),typeof e=="string"?(r.length===1&&t==="right"&&(r=`${r}0`),`0x${r.length%2===1?`0${r}`:r}`):r}var un=new TextEncoder;function _(e,t={}){return typeof e=="number"||typeof e=="bigint"?cn(e,t):typeof e=="boolean"?an(e,t):$(e)?Be(e,t):Xe(e,t)}function an(e,t={}){let r=new Uint8Array(1);return r[0]=Number(e),typeof t.size=="number"?(A(r,{size:t.size}),I(r,{size:t.size})):r}var k={zero:48,nine:57,A:65,F:70,a:97,f:102};function qt(e){if(e>=k.zero&&e<=k.nine)return e-k.zero;if(e>=k.A&&e<=k.F)return e-(k.A-10);if(e>=k.a&&e<=k.f)return e-(k.a-10)}function Be(e,t={}){let r=e;t.size&&(A(r,{size:t.size}),r=I(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let o=n.length/2,i=new Uint8Array(o);for(let s=0,u=0;s<o;s++){let c=qt(n.charCodeAt(u++)),f=qt(n.charCodeAt(u++));if(c===void 0||f===void 0)throw new a(`Invalid byte sequence ("${n[u-2]}${n[u-1]}" in "${n}").`);i[s]=c*16+f;}return i}function cn(e,t){let r=g(e,t);return Be(r)}function Xe(e,t={}){let r=un.encode(e);return typeof t.size=="number"?(A(r,{size:t.size}),I(r,{dir:"right",size:t.size})):r}function A(e,{size:t}){if(h(e)>t)throw new Me({givenSize:h(e),maxSize:t})}function Je(e,t={}){let{signed:r}=t;t.size&&A(e,{size:t.size});let n=BigInt(e);if(!r)return n;let o=(e.length-2)/2,i=(1n<<BigInt(o)*8n-1n)-1n;return n<=i?n:n-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Vt(e,t={}){let r=e;if(t.size&&(A(r,{size:t.size}),r=D(r)),D(r)==="0x00")return !1;if(D(r)==="0x01")return !0;throw new ke(r)}function j(e,t={}){return Number(Je(e,t))}function _t(e,t={}){let r=Be(e);return t.size&&(A(r,{size:t.size}),r=D(r,{dir:"right"})),new TextDecoder().decode(r)}var ln=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Xt(e,t={}){return typeof e=="number"||typeof e=="bigint"?g(e,t):typeof e=="string"?Ze(e,t):typeof e=="boolean"?Ye(e,t):Jt(e,t)}function Ye(e,t={}){let r=`0x${Number(e)}`;return typeof t.size=="number"?(A(r,{size:t.size}),I(r,{size:t.size})):r}function Jt(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=ln[e[o]];let n=`0x${r}`;return typeof t.size=="number"?(A(n,{size:t.size}),I(n,{dir:"right",size:t.size})):n}function g(e,t={}){let{signed:r,size:n}=t,o=BigInt(e),i;n?r?i=(1n<<BigInt(n)*8n-1n)-1n:i=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));let s=typeof i=="bigint"&&r?-i-1n:0;if(i&&o>i||o<s){let c=typeof e=="bigint"?"n":"";throw new Te({max:i?`${i}${c}`:void 0,min:`${s}${c}`,signed:r,size:n,value:`${e}${c}`})}let u=`0x${(r&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?I(u,{size:n}):u}var fn=new TextEncoder;function Ze(e,t={}){let r=fn.encode(e);return Jt(r,t)}function Yt(e,t){if(e.length!==t.length)throw new Pe({expectedLength:e.length,givenLength:t.length});let r=dn({params:e,values:t}),n=Qe(r);return n.length===0?"0x":n}function dn({params:e,values:t}){let r=[];for(let n=0;n<e.length;n++)r.push(Ke({param:e[n],value:t[n]}));return r}function Ke({param:e,value:t}){let r=me(e.type);if(r){let[n,o]=r;return mn(t,{length:n,param:{...e,type:o}})}if(e.type==="tuple")return xn(t,{param:e});if(e.type==="address")return pn(t);if(e.type==="bool")return hn(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let n=e.type.startsWith("int");return gn(t,{signed:n})}if(e.type.startsWith("bytes"))return bn(t,{param:e});if(e.type==="string")return yn(t);throw new je(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Qe(e){let t=0;for(let i=0;i<e.length;i++){let{dynamic:s,encoded:u}=e[i];s?t+=32:t+=h(u);}let r=[],n=[],o=0;for(let i=0;i<e.length;i++){let{dynamic:s,encoded:u}=e[i];s?(r.push(g(t+o,{size:32})),n.push(u),o+=h(u)):r.push(u);}return U([...r,...n])}function pn(e){if(!P(e))throw new E({address:e});return {dynamic:!1,encoded:T(e.toLowerCase())}}function mn(e,{length:t,param:r}){let n=t===null;if(!Array.isArray(e))throw new Ee(e);if(!n&&e.length!==t)throw new we({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let o=!1,i=[];for(let s=0;s<e.length;s++){let u=Ke({param:r,value:e[s]});u.dynamic&&(o=!0),i.push(u);}if(n||o){let s=Qe(i);if(n){let u=g(i.length,{size:32});return {dynamic:!0,encoded:i.length>0?U([u,s]):u}}if(o)return {dynamic:!0,encoded:s}}return {dynamic:!1,encoded:U(i.map(({encoded:s})=>s))}}function bn(e,{param:t}){let[,r]=t.type.split("bytes"),n=h(e);if(!r){let o=e;return n%32!==0&&(o=T(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:U([T(g(n,{size:32})),o])}}if(n!==parseInt(r))throw new ve({expectedSize:parseInt(r),value:e});return {dynamic:!1,encoded:T(e,{dir:"right"})}}function hn(e){return {dynamic:!1,encoded:T(Ye(e))}}function gn(e,{signed:t}){return {dynamic:!1,encoded:g(e,{size:32,signed:t})}}function yn(e){let t=Ze(e),r=Math.ceil(h(t)/32),n=[];for(let o=0;o<r;o++)n.push(T(b(t,o*32,(o+1)*32),{dir:"right"}));return {dynamic:!0,encoded:U([T(g(h(t),{size:32})),...n])}}function xn(e,{param:t}){let r=!1,n=[];for(let o=0;o<t.components.length;o++){let i=t.components[o],s=Array.isArray(e)?o:i.name,u=Ke({param:i,value:e[s]});n.push(u),u.dynamic&&(r=!0);}return {dynamic:r,encoded:r?Qe(n):U(n.map(({encoded:o})=>o))}}function me(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}var Zt={1:"An `assert` condition failed.",17:"Arithmic 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."},Kt={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Qt={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function er(e,t){return e.exec(t)?.groups}var tr=/^tuple(?<array>(\[(\d*)\])*)$/;function Se(e){let t=e.type;if(tr.test(e.type)&&"components"in e){t="(";let r=e.components.length;for(let o=0;o<r;o++){let i=e.components[o];t+=Se(i),o<r-1&&(t+=", ");}let n=er(tr,e.type);return t+=`)${n?.array??""}`,Se({...e,type:t})}return "indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function X(e){let t="",r=e.length;for(let n=0;n<r;n++){let o=e[n];t+=Se(o),n!==r-1&&(t+=", ");}return t}function et(e){return e.type==="function"?`function ${e.name}(${X(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${X(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${X(e.inputs)})`:e.type==="error"?`error ${e.name}(${X(e.inputs)})`:e.type==="constructor"?`constructor(${X(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?"fallback()":"receive() external payable"}function rr(e){let t=!0,r="",n=0,o="",i=!1;for(let s=0;s<e.length;s++){let u=e[s];if(["(",")",","].includes(u)&&(t=!0),u==="("&&n++,u===")"&&n--,!!t){if(n===0){if(u===" "&&["event","function",""].includes(o))o="";else if(o+=u,u===")"){i=!0;break}continue}if(u===" "){e[s-1]!==","&&r!==","&&r!==",("&&(r="",t=!1);continue}o+=u,r+=u;}}if(!i)throw new a("Unable to normalize signature.");return o}var Ie=e=>{let t=typeof e=="string"?e:et(e);return rr(t)};function tt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function rt(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function nt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function nr(e,t){rt(e);let r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var ze=BigInt(4294967295),or=BigInt(32);function wn(e,t=!1){return t?{h:Number(e&ze),l:Number(e>>or&ze)}:{h:Number(e>>or&ze)|0,l:Number(e&ze)|0}}function ir(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:i,l:s}=wn(e[o],t);[r[o],n[o]]=[i,s];}return [r,n]}var sr=(e,t,r)=>e<<r|t>>>32-r,ur=(e,t,r)=>t<<r|e>>>32-r,ar=(e,t,r)=>t<<r-32|e>>>64-r,cr=(e,t,r)=>e<<r-32|t>>>64-r;var vn=e=>e instanceof Uint8Array;var lr=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));var Pn=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Pn)throw new Error("Non little-endian hardware is not supported");function $n(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Fe(e){if(typeof e=="string"&&(e=$n(e)),!vn(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var Ce=class{clone(){return this._cloneInto()}};function fr(e){let t=n=>e().update(Fe(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function dr(e){let t=(n,o)=>e(o).update(Fe(n)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=n=>e(n),t}var[br,hr,gr]=[[],[],[]],An=BigInt(0),be=BigInt(1),jn=BigInt(2),On=BigInt(7),En=BigInt(256),Tn=BigInt(113);for(let e=0,t=be,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],br.push(2*(5*n+r)),hr.push((e+1)*(e+2)/2%64);let o=An;for(let i=0;i<7;i++)t=(t<<be^(t>>On)*Tn)%En,t&jn&&(o^=be<<(be<<BigInt(i))-be);gr.push(o);}var[kn,Mn]=ir(gr,!0),pr=(e,t,r)=>r>32?ar(e,t,r):sr(e,t,r),mr=(e,t,r)=>r>32?cr(e,t,r):ur(e,t,r);function Bn(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let s=0;s<10;s++)r[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let u=(s+8)%10,c=(s+2)%10,f=r[c],l=r[c+1],m=pr(f,l,1)^r[u],d=mr(f,l,1)^r[u+1];for(let p=0;p<50;p+=10)e[s+p]^=m,e[s+p+1]^=d;}let o=e[2],i=e[3];for(let s=0;s<24;s++){let u=hr[s],c=pr(o,i,u),f=mr(o,i,u),l=br[s];o=e[l],i=e[l+1],e[l]=c,e[l+1]=f;}for(let s=0;s<50;s+=10){for(let u=0;u<10;u++)r[u]=e[s+u];for(let u=0;u<10;u++)e[s+u]^=~r[(u+2)%10]&r[(u+4)%10];}e[0]^=kn[n],e[1]^=Mn[n];}r.fill(0);}var Le=class e extends Ce{constructor(t,r,n,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,tt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=lr(this.state);}keccak(){Bn(this.state32,this.rounds),this.posOut=0,this.pos=0;}update(t){nt(this);let{blockLen:r,state:n}=this;t=Fe(t);let o=t.length;for(let i=0;i<o;){let s=Math.min(r-this.pos,o-i);for(let u=0;u<s;u++)n[this.pos++]^=t[i++];this.pos===r&&this.keccak();}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:r,pos:n,blockLen:o}=this;t[n]^=r,r&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak();}writeInto(t){nt(this,!1),rt(t),this.finish();let r=this.state,{blockLen:n}=this;for(let o=0,i=t.length;o<i;){this.posOut>=n&&this.keccak();let s=Math.min(n-this.posOut,i-o);t.set(r.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s;}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return tt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(nr(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0);}_cloneInto(t){let{blockLen:r,suffix:n,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(r,n,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},z=(e,t,r)=>fr(()=>new Le(t,e,r));z(6,144,224/8);z(6,136,256/8);z(6,104,384/8);z(6,72,512/8);z(1,144,224/8);var yr=z(1,136,256/8);z(1,104,384/8);z(1,72,512/8);var xr=(e,t,r)=>dr((n={})=>new Le(t,e,n.dkLen===void 0?r:n.dkLen,!0));xr(31,168,128/8);xr(31,136,256/8);function J(e,t){let r=t||"hex",n=yr($(e,{strict:!1})?_(e):e);return r==="bytes"?n:Xt(n)}var Sn=e=>J(_(e)),Y=e=>b(Sn(Ie(e)),0,4);function ot(e,t){let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=J(Xe(r),"bytes"),o=(t?r.substring(`${t}0x`.length):r).split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&o[i]&&(o[i]=o[i].toUpperCase()),(n[i>>1]&15)>=8&&o[i+1]&&(o[i+1]=o[i+1].toUpperCase());return `0x${o.join("")}`}function Ri(e,t){if(!P(e))throw new E({address:e});return ot(e,t)}function Re(e,t){if(t==="0x"&&e.length>0)throw new q;if(h(t)&&h(t)<32)throw new fe({data:t,params:e,size:h(t)});return In({data:t,params:e})}function In({data:e,params:t}){let r=[],n=0;for(let o=0;o<t.length;o++){if(n>=h(e))throw new fe({data:e,params:t,size:h(e)});let i=t[o],{consumed:s,value:u}=Z({data:e,param:i,position:n});r.push(u),n+=s;}return r}function Z({data:e,param:t,position:r}){let n=me(t.type);if(n){let[i,s]=n;return Cn(e,{length:i,param:{...t,type:s},position:r})}if(t.type==="tuple")return Nn(e,{param:t,position:r});if(t.type==="string")return Rn(e,{position:r});if(t.type.startsWith("bytes"))return Ln(e,{param:t,position:r});let o=b(e,r,r+32,{strict:!0});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Hn(o,{param:t});if(t.type==="address")return zn(o);if(t.type==="bool")return Fn(o);throw new Oe(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}function zn(e){return {consumed:32,value:ot(b(e,-20))}}function Cn(e,{param:t,length:r,position:n}){if(!r){let s=j(b(e,n,n+32,{strict:!0})),u=j(b(e,s,s+32,{strict:!0})),c=0,f=[];for(let l=0;l<u;++l){let m=Z({data:b(e,s+32),param:t,position:c});c+=m.consumed,f.push(m.value);}return {value:f,consumed:32}}if(He(t)){let u=!me(t.type)?.[0],c=0,f=[];for(let l=0;l<r;++l){let m=j(b(e,n,n+32,{strict:!0})),d=Z({data:b(e,m),param:t,position:u?c:l*32});c+=d.consumed,f.push(d.value);}return {value:f,consumed:32}}let o=0,i=[];for(let s=0;s<r;++s){let u=Z({data:e,param:t,position:n+o});o+=u.consumed,i.push(u.value);}return {value:i,consumed:o}}function Fn(e){return {consumed:32,value:Vt(e)}}function Ln(e,{param:t,position:r}){let[n,o]=t.type.split("bytes");if(!o){let s=j(b(e,r,r+32,{strict:!0})),u=j(b(e,s,s+32,{strict:!0}));return u===0?{consumed:32,value:"0x"}:{consumed:32,value:b(e,s+32,s+32+u,{strict:!0})}}return {consumed:32,value:b(e,r,r+parseInt(o),{strict:!0})}}function Hn(e,{param:t}){let r=t.type.startsWith("int");return {consumed:32,value:parseInt(t.type.split("int")[1]||"256")>48?Je(e,{signed:r}):j(e,{signed:r})}}function Rn(e,{position:t}){let r=j(b(e,t,t+32,{strict:!0})),n=j(b(e,r,r+32,{strict:!0}));return n===0?{consumed:32,value:""}:{consumed:32,value:_t(D(b(e,r+32,r+32+n,{strict:!0})))}}function Nn(e,{param:t,position:r}){let n=t.components.length===0||t.components.some(({name:s})=>!s),o=n?[]:{},i=0;if(He(t)){let s=j(b(e,r,r+32,{strict:!0}));for(let u=0;u<t.components.length;++u){let c=t.components[u],f=Z({data:b(e,s),param:c,position:i});i+=f.consumed,o[n?u:c?.name]=f.value;}return {consumed:32,value:o}}for(let s=0;s<t.components.length;++s){let u=t.components[s],c=Z({data:e,param:u,position:r+i});i+=c.consumed,o[n?s:u?.name]=c.value;}return {consumed:i,value:o}}function He(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return !0;if(t==="tuple")return e.components?.some(He);let r=me(e.type);return !!(r&&He({...e,type:r[1]}))}function wr({abi:e,data:t}){let r=b(t,0,4);if(r==="0x")throw new q;let o=[...e||[],Kt,Qt].find(i=>i.type==="error"&&r===Y(v(i)));if(!o)throw new V(r,{docsPath:"/docs/contract/decodeErrorResult"});return {abiItem:o,args:"inputs"in o&&o.inputs&&o.inputs.length>0?Re(o.inputs,b(t,4)):void 0,errorName:o.name}}var G=(e,t,r)=>JSON.stringify(e,(n,o)=>{let i=typeof o=="bigint"?o.toString():o;return typeof t=="function"?t(n,i):i},r);var vr=class extends a{constructor({body:t,details:r,headers:n,status:o,url:i}){super("HTTP request failed.",{details:r,metaMessages:[o&&`Status: ${o}`,`URL: ${ce(i)}`,t&&`Request body: ${G(t)}`].filter(Boolean)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=t,this.headers=n,this.status=o,this.url=i;}},Pr=class extends a{constructor({body:t,details:r,url:n}){super("WebSocket request failed.",{details:r,metaMessages:[`URL: ${ce(n)}`,`Request body: ${G(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WebSocketRequestError"});}},Ne=class extends a{constructor({body:t,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${ce(n)}`,`Request body: ${G(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code;}},$r=class extends a{constructor({body:t,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${ce(r)}`,`Request body: ${G(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"});}};function K(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var it=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],Ar=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"}],as=[...Ar,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],cs=[...Ar,{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],ls=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],fs=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}];var ds=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}];var jr="0x82ad56cb";var W=class extends a{constructor({blockNumber:t,chain:r,contract:n}){super(`Chain "${r.name}" does not support contract "${n.name}".`,{metaMessages:["This could be due to any of the following:",...t&&n.blockCreated&&n.blockCreated>t?[`- The contract "${n.name}" was not deployed until block ${n.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${n.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"});}},Or=class extends a{constructor({chain:t,currentChainId:r}){super(`The current chain of the wallet (id: ${r}) does not match the target chain for the transaction (id: ${t.id} \u2013 ${t.name}).`,{metaMessages:[`Current Chain ID:  ${r}`,`Expected Chain ID: ${t.id} \u2013 ${t.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"});}},Er=class extends a{constructor(){super(["No chain was provided to the request.","Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"});}},he=class extends a{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"});}},Tr=class extends a{constructor({chainId:t}){super(`Chain ID "${t}" is invalid.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidChainIdError"});}};function st({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return `${r?e.name:""}(${e.inputs.map((o,i)=>`${n&&o.name?`${o.name}: `:""}${typeof t[i]=="object"?G(t[i]):t[i]}`).join(", ")})`}var kr=e=>Ie(e);var Un=e=>J(_(e)),Mr=e=>Un(kr(e));function Q({abi:e,args:t=[],name:r}){let n=$(r,{strict:!1}),o=e.filter(s=>n?s.type==="function"?Y(s)===r:s.type==="event"?Mr(s)===r:!1:"name"in s&&s.name===r);if(o.length===0)return;if(o.length===1)return o[0];let i;for(let s of o){if(!("inputs"in s))continue;if(!t||t.length===0){if(!s.inputs||s.inputs.length===0)return s;continue}if(!s.inputs||s.inputs.length===0||s.inputs.length!==t.length)continue;if(t.every((c,f)=>{let l="inputs"in s&&s.inputs[f];return l?ut(c,l):!1})){if(i&&"inputs"in i&&i.inputs){let c=Br(s.inputs,i.inputs,t);if(c)throw new Ae({abiItem:s,type:c[0]},{abiItem:i,type:c[1]})}i=s;}}return i||o[0]}function ut(e,t){let r=typeof e,n=t.type;switch(n){case"address":return P(e);case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in t?Object.values(t.components).every((o,i)=>ut(Object.values(e)[i],o)):/^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(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(e)&&e.every(o=>ut(o,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Br(e,t,r){for(let n in e){let o=e[n],i=t[n];if(o.type==="tuple"&&i.type==="tuple"&&"components"in o&&"components"in i)return Br(o.components,i.components,r[n]);let s=[o.type,i.type];if(s.includes("address")&&s.includes("bytes20")?!0:s.includes("address")&&s.includes("string")?P(r[n]):s.includes("address")&&s.includes("bytes")?P(r[n]):!1)return s}}var Sr={gwei:9,wei:18},Ir={ether:-9,wei:9},Bs={ether:-18,gwei:-9};function Ue(e,t){let r=e.toString(),n=r.startsWith("-");n&&(r=r.slice(1)),r=r.padStart(t,"0");let[o,i]=[r.slice(0,r.length-t),r.slice(r.length-t)];return i=i.replace(/(0+)$/,""),`${n?"-":""}${o||"0"}${i?`.${i}`:""}`}function De(e,t="wei"){return Ue(e,Sr[t])}function w(e,t="wei"){return Ue(e,Ir[t])}function ge(e){let t=Object.entries(e).map(([n,o])=>o===void 0||o===!1?null:[n,o]).filter(Boolean),r=t.reduce((n,[o])=>Math.max(n,o.length),0);return t.map(([n,o])=>`  ${`${n}:`.padEnd(r+1)}  ${o}`).join(`
`)}var Ge=class extends a{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"});}},zr=class extends a{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidLegacyVError"});}},Cr=class extends a{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",ge(t),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"});}};var Fr=class extends a{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStorageKeySizeError"});}},Lr=class extends a{constructor(t,{account:r,docsPath:n,chain:o,data:i,gas:s,gasPrice:u,maxFeePerGas:c,maxPriorityFeePerGas:f,nonce:l,to:m,value:d}){let p=ge({chain:o&&`${o?.name} (id: ${o?.id})`,from:r?.address,to:m,value:typeof d<"u"&&`${De(d)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof u<"u"&&`${w(u)} gwei`,maxFeePerGas:typeof c<"u"&&`${w(c)} gwei`,maxPriorityFeePerGas:typeof f<"u"&&`${w(f)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",p].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionExecutionError"}),this.cause=t;}},Hr=class extends a{constructor({blockHash:t,blockNumber:r,blockTag:n,hash:o,index:i}){let s="Transaction";n&&i!==void 0&&(s=`Transaction at block time "${n}" at index "${i}"`),t&&i!==void 0&&(s=`Transaction at block hash "${t}" at index "${i}"`),r&&i!==void 0&&(s=`Transaction at block number "${r}" at index "${i}"`),o&&(s=`Transaction with hash "${o}"`),super(`${s} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"});}},Rr=class extends a{constructor({hash:t}){super(`Transaction receipt with hash "${t}" could not be found. The Transaction may not be processed on a block yet.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionReceiptNotFoundError"});}},Nr=class extends a{constructor({hash:t}){super(`Timed out while waiting for transaction with hash "${t}" to be confirmed.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WaitForTransactionReceiptTimeoutError"});}};var We=class extends a{constructor(t,{account:r,docsPath:n,chain:o,data:i,gas:s,gasPrice:u,maxFeePerGas:c,maxPriorityFeePerGas:f,nonce:l,to:m,value:d}){let p=r?K(r):void 0,x=ge({from:p?.address,to:m,value:typeof d<"u"&&`${De(d)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof u<"u"&&`${w(u)} gwei`,maxFeePerGas:typeof c<"u"&&`${w(c)} gwei`,maxPriorityFeePerGas:typeof f<"u"&&`${w(f)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",x].filter(Boolean)}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CallExecutionError"}),this.cause=t;}},Ur=class extends a{constructor(t,{abi:r,args:n,contractAddress:o,docsPath:i,functionName:s,sender:u}){let c=Q({abi:r,args:n,name:s}),f=c?st({abiItem:c,args:n,includeFunctionName:!1,includeName:!1}):void 0,l=c?v(c,{includeName:!0}):void 0,m=ge({address:o&&St(o),function:l,args:f&&f!=="()"&&`${[...Array(s?.length??0).keys()].map(()=>" ").join("")}${f}`,sender:u});super(t.shortMessage||`An unknown error occurred while executing the contract function "${s}".`,{cause:t,docsPath:i,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Contract Call:",m].filter(Boolean)}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionExecutionError"}),this.abi=r,this.args=n,this.cause=t,this.contractAddress=o,this.functionName=s,this.sender=u;}},Dr=class extends a{constructor({abi:t,data:r,functionName:n,message:o}){let i,s,u,c;if(r&&r!=="0x")try{s=wr({abi:t,data:r});let{abiItem:l,errorName:m,args:d}=s;if(m==="Error")c=d[0];else if(m==="Panic"){let[p]=d;c=Zt[p];}else {let p=l?v(l,{includeName:!0}):void 0,x=l&&d?st({abiItem:l,args:d,includeFunctionName:!1,includeName:!1}):void 0;u=[p?`Error: ${p}`:"",x&&x!=="()"?`       ${[...Array(m?.length??0).keys()].map(()=>" ").join("")}${x}`:""];}}catch(l){i=l;}else o&&(c=o);let f;i instanceof V&&(f=i.signature,u=[`Unable to decode signature "${f}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${f}.`]),super(c&&c!=="execution reverted"||f?[`The contract function "${n}" reverted with the following ${f?"signature":"reason"}:`,c||f].join(`
`):`The contract function "${n}" reverted.`,{cause:i,metaMessages:u}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=s,this.reason=c,this.signature=f;}},Gr=class extends a{constructor({functionName:t}){super(`The contract function "${t}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",`  - The contract does not have the function "${t}",`,"  - The parameters passed to the contract function may be invalid, or","  - The address is not a contract."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ContractFunctionZeroDataError"});}},qe=class extends a{constructor({data:t,message:r}){super(r||""),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RawContractError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t;}};var at="/docs/contract/decodeFunctionResult";function Wr({abi:e,args:t,functionName:r,data:n}){let o=e[0];if(r&&(o=Q({abi:e,args:t,name:r}),!o))throw new S(r,{docsPath:at});if(o.type!=="function")throw new S(void 0,{docsPath:at});if(!o.outputs)throw new $e(o.name,{docsPath:at});let i=Re(o.outputs,n);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}function qr({abi:e,args:t,functionName:r}){let n=e[0];if(r&&(n=Q({abi:e,args:t,name:r}),!n))throw new S(r,{docsPath:"/docs/contract/encodeFunctionData"});if(n.type!=="function")throw new S(void 0,{docsPath:"/docs/contract/encodeFunctionData"});let o=v(n),i=Y(o),s="inputs"in n&&n.inputs?Yt(n.inputs,t??[]):void 0;return _e([i,s??"0x"])}function Vr({blockNumber:e,chain:t,contract:r}){let n=t?.contracts?.[r];if(!n)throw new W({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new W({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}var M=class extends a{constructor({cause:t,message:r}={}){let n=r?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${n?`with reason: ${n}`:"for an unknown reason"}.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"});}};Object.defineProperty(M,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(M,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});var C=class extends a{constructor({cause:t,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${w(r)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooHigh"});}};Object.defineProperty(C,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});var ee=class extends a{constructor({cause:t,maxFeePerGas:r}={}){super(`The fee cap (\`maxFeePerGas\`${r?` = ${w(r)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeCapTooLow"});}};Object.defineProperty(ee,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});var te=class extends a{constructor({cause:t,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}is higher than the next one expected.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"});}};Object.defineProperty(te,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});var re=class extends a{constructor({cause:t,nonce:r}={}){super([`Nonce provided for the transaction ${r?`(${r}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
`),{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"});}};Object.defineProperty(re,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});var ne=class extends a{constructor({cause:t,nonce:r}={}){super(`Nonce provided for the transaction ${r?`(${r}) `:""}exceeds the maximum allowed nonce.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"});}};Object.defineProperty(ne,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});var oe=class extends a{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
`),{cause:t,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InsufficientFundsError"});}};Object.defineProperty(oe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});var ie=class extends a{constructor({cause:t,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooHighError"});}};Object.defineProperty(ie,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});var se=class extends a{constructor({cause:t,gas:r}={}){super(`The amount of gas ${r?`(${r}) `:""}provided for the transaction is too low.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"});}};Object.defineProperty(se,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});var ue=class extends a{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionTypeNotSupportedError"});}};Object.defineProperty(ue,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});var F=class extends a{constructor({cause:t,maxPriorityFeePerGas:r,maxFeePerGas:n}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${r?` = ${w(r)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${n?` = ${w(n)} gwei`:""}).`].join(`
`),{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"});}};Object.defineProperty(F,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});var ae=class extends a{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"});}};var Dn=-1,y=class extends a{constructor(t,{code:r,docsPath:n,metaMessages:o,shortMessage:i}){super(i,{cause:t,docsPath:n,metaMessages:o||t?.metaMessages}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=t.name,this.code=t instanceof Ne?t.code:r??Dn;}},L=class extends y{constructor(t,r){super(t,r),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderRpcError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data;}},ct=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ParseRpcError"});}};Object.defineProperty(ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});var lt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"});}};Object.defineProperty(lt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});var ft=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"});}};Object.defineProperty(ft,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});var dt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"});}};Object.defineProperty(dt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});var pt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"});}};Object.defineProperty(pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});var mt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"});}};Object.defineProperty(mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});var bt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"});}};Object.defineProperty(bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});var ht=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"});}};Object.defineProperty(ht,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});var gt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"});}};Object.defineProperty(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});var yt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"});}};Object.defineProperty(yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});var xt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"});}};Object.defineProperty(xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});var wt=class e extends y{constructor(t){super(t,{code:e.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"});}};Object.defineProperty(wt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});var vt=class e extends L{constructor(t){super(t,{code:e.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"});}};Object.defineProperty(vt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});var Pt=class e extends L{constructor(t){super(t,{code:e.code,shortMessage:"The requested method and/or account has not been authorized by the user."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnauthorizedProviderError"});}};Object.defineProperty(Pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});var $t=class e extends L{constructor(t){super(t,{code:e.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"});}};Object.defineProperty($t,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});var At=class e extends L{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"});}};Object.defineProperty(At,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});var jt=class e extends L{constructor(t){super(t,{code:e.code,shortMessage:"The Provider is not connected to the requested chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDisconnectedError"});}};Object.defineProperty(jt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});var Ot=class e extends L{constructor(t){super(t,{code:e.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"});}};Object.defineProperty(Ot,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});var _r=class extends y{constructor(t){super(t,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"});}};function Xr(e,t){let r=(e.details||"").toLowerCase(),n=e.walk(o=>o.code===M.code);return n instanceof a?new M({cause:e,message:n.details}):M.nodeMessage.test(r)?new M({cause:e,message:e.details}):C.nodeMessage.test(r)?new C({cause:e,maxFeePerGas:t?.maxFeePerGas}):ee.nodeMessage.test(r)?new ee({cause:e,maxFeePerGas:t?.maxFeePerGas}):te.nodeMessage.test(r)?new te({cause:e,nonce:t?.nonce}):re.nodeMessage.test(r)?new re({cause:e,nonce:t?.nonce}):ne.nodeMessage.test(r)?new ne({cause:e,nonce:t?.nonce}):oe.nodeMessage.test(r)?new oe({cause:e}):ie.nodeMessage.test(r)?new ie({cause:e,gas:t?.gas}):se.nodeMessage.test(r)?new se({cause:e,gas:t?.gas}):ue.nodeMessage.test(r)?new ue({cause:e}):F.nodeMessage.test(r)?new F({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new ae({cause:e})}function Jr(e,{docsPath:t,...r}){let n=(()=>{let o=Xr(e,r);return o instanceof ae?e:o})();return new We(n,{docsPath:t,...r})}function Yr(e,{format:t}){if(!t)return {};let r={};function n(i){let s=Object.keys(i);for(let u of s)u in e&&(r[u]=e[u]),i[u]&&typeof i[u]=="object"&&!Array.isArray(i[u])&&n(i[u]);}let o=t(e||{});return n(o),r}function Zr(e,t){return ({exclude:r,format:n})=>({exclude:r,format:o=>{let i=t(o);if(r)for(let s of r)delete i[s];return {...i,...n(o)}},type:e})}var Gn={legacy:"0x0",eip2930:"0x1",eip1559:"0x2"};function Et(e){return {...e,gas:typeof e.gas<"u"?g(e.gas):void 0,gasPrice:typeof e.gasPrice<"u"?g(e.gasPrice):void 0,maxFeePerGas:typeof e.maxFeePerGas<"u"?g(e.maxFeePerGas):void 0,maxPriorityFeePerGas:typeof e.maxPriorityFeePerGas<"u"?g(e.maxPriorityFeePerGas):void 0,nonce:typeof e.nonce<"u"?g(e.nonce):void 0,type:typeof e.type<"u"?Gn[e.type]:void 0,value:typeof e.value<"u"?g(e.value):void 0}}var Iu=Zr("transactionRequest",Et);var Tt=new Map;function Kr({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:o}){let i=async()=>{let l=c();s();let m=l.map(({args:d})=>d);m.length!==0&&e(m).then(d=>{o&&Array.isArray(d)&&d.sort(o);for(let p=0;p<l.length;p++){let{pendingPromise:x}=l[p];x.resolve?.([d[p],d]);}}).catch(d=>{for(let p=0;p<l.length;p++){let{pendingPromise:x}=l[p];x.reject?.(d);}});},s=()=>Tt.delete(t),u=()=>c().map(({args:l})=>l),c=()=>Tt.get(t)||[],f=l=>Tt.set(t,[...c(),l]);return {flush:s,async schedule(l){let m={},d=new Promise((H,B)=>{m.resolve=H,m.reject=B;});return r?.([...u(),l])&&i(),c().length>0?(f({args:l,pendingPromise:m}),d):(f({args:l,pendingPromise:m}),setTimeout(i,n),d)}}}function Qr(e){let{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:o,to:i}=e,s=t?K(t):void 0;if(s&&!P(s.address))throw new E({address:s.address});if(i&&!P(i))throw new E({address:i});if(typeof r<"u"&&(typeof n<"u"||typeof o<"u"))throw new Ge;if(n&&n>2n**256n-1n)throw new C({maxFeePerGas:n});if(o&&n&&o>n)throw new F({maxFeePerGas:n,maxPriorityFeePerGas:o})}async function na(e,t){let{account:r=e.account,batch:n=!!e.batch?.multicall,blockNumber:o,blockTag:i="latest",accessList:s,data:u,gas:c,gasPrice:f,maxFeePerGas:l,maxPriorityFeePerGas:m,nonce:d,to:p,value:x,...H}=t,B=r?K(r):void 0;try{Qr(t);let O=(o?g(o):void 0)||i,N=e.chain?.formatters?.transactionRequest?.format,ye=(N||Et)({...Yr(H,{format:N}),from:B?.address,accessList:s,data:u,gas:c,gasPrice:f,maxFeePerGas:l,maxPriorityFeePerGas:m,nonce:d,to:p,value:x});if(n&&Wn({request:ye}))try{return await qn(e,{...ye,blockNumber:o,blockTag:i})}catch(Ve){if(!(Ve instanceof he)&&!(Ve instanceof W))throw Ve}let Mt=await e.request({method:"eth_call",params:O?[ye,O]:[ye]});return Mt==="0x"?{data:void 0}:{data:Mt}}catch(R){let O=Vn(R),{offchainLookup:N,offchainLookupSignature:kt}=await import('./ccip-GQVVPNQB.js');if(O?.slice(0,10)===kt&&p)return {data:await N(e,{data:O,to:p})};throw Jr(R,{...t,account:B,chain:e.chain})}}function Wn({request:e}){let{data:t,to:r,...n}=e;return !(!t||t.startsWith(jr)||!r||Object.values(n).filter(o=>typeof o<"u").length>0)}async function qn(e,t){let{batchSize:r=1024,wait:n=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:i="latest",data:s,multicallAddress:u,to:c}=t,f=u;if(!f){if(!e.chain)throw new he;f=Vr({blockNumber:o,chain:e.chain,contract:"multicall3"});}let m=(o?g(o):void 0)||i,{schedule:d}=Kr({id:`${e.uid}.${m}`,wait:n,shouldSplitBatch(H){return H.reduce((R,{data:O})=>R+(O.length-2),0)>r*2},fn:async H=>{let B=H.map(N=>({allowFailure:!0,callData:N.data,target:N.to})),R=qr({abi:it,args:[B],functionName:"aggregate3"}),O=await e.request({method:"eth_call",params:[{data:R,to:f},m]});return Wr({abi:it,args:[B],functionName:"aggregate3",data:O||"0x"})}}),[{returnData:p,success:x}]=await d({data:s,to:c});if(!x)throw new qe({data:p});return p==="0x"?{data:void 0}:{data:p}}function Vn(e){if(!(e instanceof a))return;let t=e.walk();return typeof t.data=="object"?t.data.data:t.data}/*! Bundled license information:

@noble/hashes/esm/utils.js:
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
*/

export { G as $, F as A, gt as Aa, ae as B, yt as Ba, P as C, xt as Ca, U as D, wt as Da, _e as E, vt as Ea, v as F, Pt as Fa, Ct as G, $t as Ga, Ft as H, At as Ha, fe as I, jt as Ia, q as J, Ot as Ja, Lt as K, _r as Ka, Ht as L, Xr as La, Rt as M, Yr as Ma, Nt as N, Qr as Na, Ut as O, Wr as Oa, Dt as P, it as Pa, J as Q, as as Qa, Mr as R, cs as Ra, Yt as S, ls as Sa, Q as T, fs as Ta, K as U, ds as Ua, qr as V, Vr as Va, Zt as W, Kr as Wa, ot as X, na as Xa, Ri as Y, Re as Z, wr as _, ce as a, De as aa, a as b, ge as ba, $ as c, zr as ca, h as d, Cr as da, D as e, Fr as ea, Xt as f, Lr as fa, Jt as g, Hr as ga, g as h, Rr as ha, Ze as i, Nr as ia, _ as j, We as ja, Be as k, Ur as ka, Xe as l, Dr as la, Je as m, Gr as ma, j as n, qe as na, _t as o, vr as oa, Zr as p, Pr as pa, Et as q, Ne as qa, Iu as r, $r as ra, E as s, ct as sa, Or as t, lt as ta, Er as u, ft as ua, Tr as v, dt as va, Bs as w, pt as wa, Ue as x, mt as xa, w as y, bt as ya, C as z, ht as za };
