@pufferfinance/puffer-sdk 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/api/puffer-client.d.ts +12 -0
- package/dist/{ccip-BERTKE3h.js → ccip-CzWPognK.js} +2 -2
- package/dist/{ccip-BERTKE3h.js.map → ccip-CzWPognK.js.map} +1 -1
- package/dist/{ccip-CsTi3xD2.cjs → ccip-DNUqn1xf.cjs} +2 -2
- package/dist/{ccip-CsTi3xD2.cjs.map → ccip-DNUqn1xf.cjs.map} +1 -1
- package/dist/contracts/abis/mainnet/PufLocker.d.ts +476 -0
- package/dist/contracts/abis/mainnet/PufToken.d.ts +676 -0
- package/dist/contracts/abis/mainnet/PufferL2Depositor.d.ts +351 -0
- package/dist/contracts/abis/puf-locker-abis.d.ts +480 -0
- package/dist/contracts/abis/puf-token-abis.d.ts +680 -0
- package/dist/contracts/abis/puffer-depositor-abis.d.ts +355 -0
- package/dist/contracts/addresses.d.ts +2 -0
- package/dist/contracts/handlers/erc20-permit-handler.d.ts +13705 -0
- package/dist/contracts/handlers/puf-locker-handler.d.ts +31064 -0
- package/dist/contracts/handlers/puf-locker-handler.test.d.ts +1 -0
- package/dist/contracts/handlers/puf-token-handler.test.d.ts +1 -0
- package/dist/contracts/handlers/puffer-depositor-handler.d.ts +9866 -4
- package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +22867 -0
- package/dist/contracts/handlers/puffer-l2-depositor-handler.test.d.ts +1 -0
- package/dist/contracts/tokens.d.ts +14 -1
- package/dist/main--Ww95s5e.cjs +41 -0
- package/dist/main--Ww95s5e.cjs.map +1 -0
- package/dist/{main-CjjW4BLK.js → main-Cl9ZFxdC.js} +4728 -2629
- package/dist/main-Cl9ZFxdC.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +6 -5
- package/package.json +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.d.ts +0 -62
- package/dist/contracts/handlers/tokens-handler.d.ts +0 -46
- package/dist/main-C4aA8dQe.cjs +0 -41
- package/dist/main-C4aA8dQe.cjs.map +0 -1
- package/dist/main-CjjW4BLK.js.map +0 -1
- /package/dist/contracts/handlers/{tokens-handler.test.d.ts → erc20-permit-handler.test.d.ts} +0 -0
package/dist/main-C4aA8dQe.cjs
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";var ii=Object.defineProperty;var oi=(e,t,n)=>t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var we=(e,t,n)=>oi(e,typeof t!="symbol"?t+"":t,n);const ui="1.0.0";let ee=class Sn extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Sn?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,a=n.cause instanceof Sn&&n.cause.docsPath||n.docsPath,s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: https://abitype.dev${a}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${ui}`].join(`
|
|
2
|
-
`);super(s),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=t}};function Se(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const va=/^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)?$/,xa=/^\(.+?\).*?$/,_r=/^tuple(?<array>(\[(\d*)\])*)$/;function Mn(e){let t=e.type;if(_r.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let a=0;a<n;a++){const s=e.components[a];t+=Mn(s),a<n-1&&(t+=", ")}const r=Se(_r,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,Mn({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function ut(e){let t="";const n=e.length;for(let r=0;r<n;r++){const a=e[r];t+=Mn(a),r!==n-1&&(t+=", ")}return t}function ci(e){return e.type==="function"?`function ${e.name}(${ut(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${ut(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${ut(e.inputs)})`:e.type==="error"?`error ${e.name}(${ut(e.inputs)})`:e.type==="constructor"?`constructor(${ut(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?"fallback()":"receive() external payable"}const Ea=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function li(e){return Ea.test(e)}function di(e){return Se(Ea,e)}const Pa=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function pi(e){return Pa.test(e)}function fi(e){return Se(Pa,e)}const Aa=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function yi(e){return Aa.test(e)}function mi(e){return Se(Aa,e)}const Ia=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ca(e){return Ia.test(e)}function bi(e){return Se(Ia,e)}const Ba=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function hi(e){return Ba.test(e)}function gi(e){return Se(Ba,e)}const wi=/^fallback\(\)$/;function vi(e){return wi.test(e)}const Ti=/^receive\(\) external payable$/;function xi(e){return Ti.test(e)}const Ei=new Set(["indexed"]),$n=new Set(["calldata","memory","storage"]);class Pi extends ee{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class Ai extends ee{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}class Ii extends ee{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Ci extends ee{constructor({param:t,name:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class Bi extends ee{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class Si extends ee{constructor({param:t,type:n,modifier:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${r}" not allowed${n?` in "${n}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Mi extends ee{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}class dt extends ee{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class $i extends ee{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Oi extends ee{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}class Ri extends ee{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}class ki extends ee{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 Fi(e,t){return t?`${t}:${e}`:e}const hn=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 Ni(e,t={}){if(yi(e)){const n=mi(e);if(!n)throw new dt({signature:e,type:"function"});const r=ae(n.parameters),a=[],s=r.length;for(let o=0;o<s;o++)a.push(Re(r[o],{modifiers:$n,structs:t,type:"function"}));const i=[];if(n.returns){const o=ae(n.returns),u=o.length;for(let c=0;c<u;c++)i.push(Re(o[c],{modifiers:$n,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:a,outputs:i}}if(pi(e)){const n=fi(e);if(!n)throw new dt({signature:e,type:"event"});const r=ae(n.parameters),a=[],s=r.length;for(let i=0;i<s;i++)a.push(Re(r[i],{modifiers:Ei,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:a}}if(li(e)){const n=di(e);if(!n)throw new dt({signature:e,type:"error"});const r=ae(n.parameters),a=[],s=r.length;for(let i=0;i<s;i++)a.push(Re(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:a}}if(hi(e)){const n=gi(e);if(!n)throw new dt({signature:e,type:"constructor"});const r=ae(n.parameters),a=[],s=r.length;for(let i=0;i<s;i++)a.push(Re(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:a}}if(vi(e))return{type:"fallback"};if(xi(e))return{type:"receive",stateMutability:"payable"};throw new $i({signature:e})}const ji=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Ui=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Di=/^u?int$/;function Re(e,t){var l,p;const n=Fi(e,t==null?void 0:t.type);if(hn.has(n))return hn.get(n);const r=xa.test(e),a=Se(r?Ui:ji,e);if(!a)throw new Ii({param:e});if(a.name&&zi(a.name))throw new Ci({param:e,name:a.name});const s=a.name?{name:a.name}:{},i=a.modifier==="indexed"?{indexed:!0}:{},o=(t==null?void 0:t.structs)??{};let u,c={};if(r){u="tuple";const b=ae(a.type),y=[],f=b.length;for(let m=0;m<f;m++)y.push(Re(b[m],{structs:o}));c={components:y}}else if(a.type in o)u="tuple",c={components:o[a.type]};else if(Di.test(a.type))u=`${a.type}256`;else if(u=a.type,(t==null?void 0:t.type)!=="struct"&&!Sa(u))throw new Ai({type:u});if(a.modifier){if(!((p=(l=t==null?void 0:t.modifiers)==null?void 0:l.has)!=null&&p.call(l,a.modifier)))throw new Bi({param:e,type:t==null?void 0:t.type,modifier:a.modifier});if($n.has(a.modifier)&&!Hi(u,!!a.array))throw new Si({param:e,type:t==null?void 0:t.type,modifier:a.modifier})}const d={type:`${u}${a.array??""}`,...s,...i,...c};return hn.set(n,d),d}function ae(e,t=[],n="",r=0){const a=e.trim().length;for(let s=0;s<a;s++){const i=e[s],o=e.slice(s+1);switch(i){case",":return r===0?ae(o,[...t,n.trim()]):ae(o,t,`${n}${i}`,r);case"(":return ae(o,t,`${n}${i}`,r+1);case")":return ae(o,t,`${n}${i}`,r-1);default:return ae(o,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new ki({current:n,depth:r});return t.push(n.trim()),t}function Sa(e){return e==="address"||e==="bool"||e==="function"||e==="string"||va.test(e)||Ta.test(e)}const Li=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;function zi(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||va.test(e)||Ta.test(e)||Li.test(e)}function Hi(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function _i(e){const t={},n=e.length;for(let i=0;i<n;i++){const o=e[i];if(!Ca(o))continue;const u=bi(o);if(!u)throw new dt({signature:o,type:"struct"});const c=u.properties.split(";"),d=[],l=c.length;for(let p=0;p<l;p++){const y=c[p].trim();if(!y)continue;const f=Re(y,{type:"struct"});d.push(f)}if(!d.length)throw new Oi({signature:o});t[u.name]=d}const r={},a=Object.entries(t),s=a.length;for(let i=0;i<s;i++){const[o,u]=a[i];r[o]=Ma(u,t)}return r}const qi=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Ma(e,t,n=new Set){const r=[],a=e.length;for(let s=0;s<a;s++){const i=e[s];if(xa.test(i.type))r.push(i);else{const u=Se(qi,i.type);if(!(u!=null&&u.type))throw new Mi({abiParameter:i});const{array:c,type:d}=u;if(d in t){if(n.has(d))throw new Ri({type:d});r.push({...i,type:`tuple${c??""}`,components:Ma(t[d]??[],t,new Set([...n,d]))})}else if(Sa(d))r.push(i);else throw new Pi({type:d})}}return r}function Gi(e){const t=_i(e),n=[],r=e.length;for(let a=0;a<r;a++){const s=e[a];Ca(s)||n.push(Ni(s,t))}return n}function S(e,t,n){return r=>{var a,s;return((a=e[t.name])==null?void 0:a.call(e,r))??((s=e[n])==null?void 0:s.call(e,r))??t(e,r)}}function me(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new oo(e.type);return`${e.name}(${Jt(e.inputs,{includeName:t})})`}function Jt(e,{includeName:t=!1}={}){return e?e.map(n=>Vi(n,{includeName:t})).join(t?", ":","):""}function Vi(e,{includeName:t}){return e.type.startsWith("tuple")?`(${Jt(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function se(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function D(e){return se(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Wi="2.14.0",Zi=e=>e,Xt=e=>e,Ki=()=>`viem@${Wi}`;class T extends Error{constructor(t,n={}){var s;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:Ki()});const r=n.cause instanceof T?n.cause.details:(s=n.cause)!=null&&s.message?n.cause.message:n.details,a=n.cause instanceof T&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...a?[`Docs: ${n.docsBaseUrl??"https://viem.sh"}${a}${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...r?[`Details: ${r}`]:[],`Version: ${this.version}`].join(`
|
|
3
|
-
`),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=a,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return $a(this,t)}}function $a(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e?$a(e.cause,t):t?null:e}class Yi extends T{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(`
|
|
4
|
-
`),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorNotFoundError"})}}class qr extends T{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(`
|
|
5
|
-
`),{docsPath:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiConstructorParamsNotFoundError"})}}class Oa extends T{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
6
|
-
`),{metaMessages:[`Params: (${Jt(n,{includeName:!0})})`,`Data: ${t} (${r} 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=n,this.size=r}}class Qt extends T{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class Ji extends T{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
7
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class Xi extends T{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${D(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class Qi extends T{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
8
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class Ra extends T{constructor(t,{docsPath:n}){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(`
|
|
9
|
-
`),{docsPath:n}),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}}class eo extends T{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"})}}class ka extends T{constructor(t,{docsPath:n}){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(`
|
|
10
|
-
`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventSignatureNotFoundError"})}}class Gr extends T{constructor(t,{docsPath:n}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
|
|
11
|
-
`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEventNotFoundError"})}}class qt extends T{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
12
|
-
`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class to extends T{constructor(t,{docsPath:n}){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(`
|
|
13
|
-
`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionOutputsNotFoundError"})}}class no extends T{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${me(t.abiItem)}\`, and`,`\`${n.type}\` in \`${me(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class ro extends T{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class pt extends T{constructor({abiItem:t,data:n,params:r,size:a}){super([`Data size of ${a} bytes is too small for non-indexed event parameters.`].join(`
|
|
14
|
-
`),{metaMessages:[`Params: (${Jt(r,{includeName:!0})})`,`Data: ${n} (${a} 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=n,this.params=r,this.size=a}}class en extends T{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${me(t,{includeName:!0})}".`].join(`
|
|
15
|
-
`)),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}}class ao extends T{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
16
|
-
`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class so extends T{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
17
|
-
`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiDecodingType"})}}class io extends T{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
18
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class oo extends T{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
19
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class uo extends T{constructor(t){super(`Filter type "${t}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}class Fa extends T{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}}class Na extends T{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}class Vr extends T{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.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesLengthError"})}}function nt(e,{dir:t,size:n=32}={}){return typeof e=="string"?xe(e,{dir:t,size:n}):co(e,{dir:t,size:n})}function xe(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new Na({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function co(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Na({size:e.length,targetSize:n,type:"bytes"});const r=new Uint8Array(n);for(let a=0;a<n;a++){const s=t==="right";r[s?a:n-a-1]=e[s?a:e.length-a-1]}return r}class lo extends T{constructor({max:t,min:n,signed:r,size:a,value:s}){super(`Number "${s}" is not in safe ${a?`${a*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class po extends T{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.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidBytesBooleanError"})}}class fo extends T{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}function tn(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}function le(e,{size:t}){if(D(e)>t)throw new fo({givenSize:D(e),maxSize:t})}function Ze(e,t={}){const{signed:n}=t;t.size&&le(e,{size:t.size});const r=BigInt(e);if(!n)return r;const a=(e.length-2)/2,s=(1n<<BigInt(a)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(a*2,"f")}`)-1n}function Ee(e,t={}){return Number(Ze(e,t))}const yo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Me(e,t={}){return typeof e=="number"||typeof e=="bigint"?O(e,t):typeof e=="string"?tr(e,t):typeof e=="boolean"?ja(e,t):_(e,t)}function ja(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(le(n,{size:t.size}),nt(n,{size:t.size})):n}function _(e,t={}){let n="";for(let a=0;a<e.length;a++)n+=yo[e[a]];const r=`0x${n}`;return typeof t.size=="number"?(le(r,{size:t.size}),nt(r,{dir:"right",size:t.size})):r}function O(e,t={}){const{signed:n,size:r}=t,a=BigInt(e);let s;r?n?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof s=="bigint"&&n?-s-1n:0;if(s&&a>s||a<i){const u=typeof e=="bigint"?"n":"";throw new lo({max:s?`${s}${u}`:void 0,min:`${i}${u}`,signed:n,size:r,value:`${e}${u}`})}const o=`0x${(n&&a<0?(1n<<BigInt(r*8))+BigInt(a):a).toString(16)}`;return r?nt(o,{size:r}):o}const mo=new TextEncoder;function tr(e,t={}){const n=mo.encode(e);return _(n,t)}const bo=new TextEncoder;function Pe(e,t={}){return typeof e=="number"||typeof e=="bigint"?go(e,t):typeof e=="boolean"?ho(e,t):se(e)?Ue(e,t):fe(e,t)}function ho(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(le(n,{size:t.size}),nt(n,{size:t.size})):n}const de={zero:48,nine:57,A:65,F:70,a:97,f:102};function Wr(e){if(e>=de.zero&&e<=de.nine)return e-de.zero;if(e>=de.A&&e<=de.F)return e-(de.A-10);if(e>=de.a&&e<=de.f)return e-(de.a-10)}function Ue(e,t={}){let n=e;t.size&&(le(n,{size:t.size}),n=nt(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);const a=r.length/2,s=new Uint8Array(a);for(let i=0,o=0;i<a;i++){const u=Wr(r.charCodeAt(o++)),c=Wr(r.charCodeAt(o++));if(u===void 0||c===void 0)throw new T(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);s[i]=u*16+c}return s}function go(e,t){const n=O(e,t);return Ue(n)}function fe(e,t={}){const n=bo.encode(e);return typeof t.size=="number"?(le(n,{size:t.size}),nt(n,{dir:"right",size:t.size})):n}function Gt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function nr(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 wo(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Gt(e.outputLen),Gt(e.blockLen)}function Ke(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ua(e,t){nr(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Dt=BigInt(2**32-1),Zr=BigInt(32);function vo(e,t=!1){return t?{h:Number(e&Dt),l:Number(e>>Zr&Dt)}:{h:Number(e>>Zr&Dt)|0,l:Number(e&Dt)|0}}function To(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let a=0;a<e.length;a++){const{h:s,l:i}=vo(e[a],t);[n[a],r[a]]=[s,i]}return[n,r]}const xo=(e,t,n)=>e<<n|t>>>32-n,Eo=(e,t,n)=>t<<n|e>>>32-n,Po=(e,t,n)=>t<<n-32|e>>>64-n,Ao=(e,t,n)=>e<<n-32|t>>>64-n,gn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Da=e=>e instanceof Uint8Array,Io=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),wn=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),oe=(e,t)=>e<<32-t|e>>>t,Co=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Co)throw new Error("Non little-endian hardware is not supported");function Bo(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function nn(e){if(typeof e=="string"&&(e=Bo(e)),!Da(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function So(...e){const t=new Uint8Array(e.reduce((r,a)=>r+a.length,0));let n=0;return e.forEach(r=>{if(!Da(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}class rr{clone(){return this._cloneInto()}}function La(e){const t=r=>e().update(nn(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Mo(e=32){if(gn&&typeof gn.getRandomValues=="function")return gn.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[za,Ha,_a]=[[],[],[]],$o=BigInt(0),ct=BigInt(1),Oo=BigInt(2),Ro=BigInt(7),ko=BigInt(256),Fo=BigInt(113);for(let e=0,t=ct,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],za.push(2*(5*r+n)),Ha.push((e+1)*(e+2)/2%64);let a=$o;for(let s=0;s<7;s++)t=(t<<ct^(t>>Ro)*Fo)%ko,t&Oo&&(a^=ct<<(ct<<BigInt(s))-ct);_a.push(a)}const[No,jo]=To(_a,!0),Kr=(e,t,n)=>n>32?Po(e,t,n):xo(e,t,n),Yr=(e,t,n)=>n>32?Ao(e,t,n):Eo(e,t,n);function Uo(e,t=24){const 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){const o=(i+8)%10,u=(i+2)%10,c=n[u],d=n[u+1],l=Kr(c,d,1)^n[o],p=Yr(c,d,1)^n[o+1];for(let b=0;b<50;b+=10)e[i+b]^=l,e[i+b+1]^=p}let a=e[2],s=e[3];for(let i=0;i<24;i++){const o=Ha[i],u=Kr(a,s,o),c=Yr(a,s,o),d=za[i];a=e[d],s=e[d+1],e[d]=u,e[d+1]=c}for(let i=0;i<50;i+=10){for(let o=0;o<10;o++)n[o]=e[i+o];for(let o=0;o<10;o++)e[i+o]^=~n[(o+2)%10]&n[(o+4)%10]}e[0]^=No[r],e[1]^=jo[r]}n.fill(0)}class ar extends rr{constructor(t,n,r,a=!1,s=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=a,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Gt(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Io(this.state)}keccak(){Uo(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Ke(this);const{blockLen:n,state:r}=this;t=nn(t);const a=t.length;for(let s=0;s<a;){const i=Math.min(n-this.pos,a-s);for(let o=0;o<i;o++)r[this.pos++]^=t[s++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:r,blockLen:a}=this;t[r]^=n,n&128&&r===a-1&&this.keccak(),t[a-1]^=128,this.keccak()}writeInto(t){Ke(this,!1),nr(t),this.finish();const n=this.state,{blockLen:r}=this;for(let a=0,s=t.length;a<s;){this.posOut>=r&&this.keccak();const i=Math.min(r-this.posOut,s-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 Gt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ua(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:r,outputLen:a,rounds:s,enableXOF:i}=this;return t||(t=new ar(n,r,a,i,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=a,t.enableXOF=i,t.destroyed=this.destroyed,t}}const Do=(e,t,n)=>La(()=>new ar(t,e,n)),Lo=Do(1,136,256/8);function W(e,t){const n=t||"hex",r=Lo(se(e,{strict:!1})?Pe(e):e);return n==="bytes"?r:Me(r)}const zo=e=>W(Pe(e));function Ho(e){return zo(e)}function _o(e){let t=!0,n="",r=0,a="",s=!1;for(let i=0;i<e.length;i++){const o=e[i];if(["(",")",","].includes(o)&&(t=!0),o==="("&&r++,o===")"&&r--,!!t){if(r===0){if(o===" "&&["event","function",""].includes(a))a="";else if(a+=o,o===")"){s=!0;break}continue}if(o===" "){e[i-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}a+=o,n+=o}}if(!s)throw new T("Unable to normalize signature.");return a}const qo=e=>{const t=typeof e=="string"?e:ci(e);return _o(t)};function qa(e){return Ho(qo(e))}const sr=qa;class Ae extends T{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."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class Ga extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}set(t,n){return super.set(t,n),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}const vn=new Ga(8192);function rn(e,t){if(vn.has(`${e}.${t}`))return vn.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=W(fe(n),"bytes"),a=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());const s=`0x${a.join("")}`;return vn.set(`${e}.${t}`,s),s}function Go(e,t){if(!ie(e,{strict:!1}))throw new Ae({address:e});return rn(e,t)}const Vo=/^0x[a-fA-F0-9]{40}$/,Tn=new Ga(8192);function ie(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Tn.has(r))return Tn.get(r);const a=Vo.test(e)?e.toLowerCase()===e?!0:n?rn(e)===e:!0:!1;return Tn.set(r,a),a}function ue(e){return typeof e[0]=="string"?ir(e):Wo(e)}function Wo(e){let t=0;for(const a of e)t+=a.length;const n=new Uint8Array(t);let r=0;for(const a of e)n.set(a,r),r+=a.length;return n}function ir(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Vt(e,t,n,{strict:r}={}){return se(e,{strict:!1})?Zo(e,t,n,{strict:r}):Za(e,t,n,{strict:r})}function Va(e,t){if(typeof t=="number"&&t>0&&t>D(e)-1)throw new Fa({offset:t,position:"start",size:D(e)})}function Wa(e,t,n){if(typeof t=="number"&&typeof n=="number"&&D(e)!==n-t)throw new Fa({offset:n,position:"end",size:D(e)})}function Za(e,t,n,{strict:r}={}){Va(e,t);const a=e.slice(t,n);return r&&Wa(a,t,n),a}function Zo(e,t,n,{strict:r}={}){Va(e,t);const a=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Wa(a,t,n),a}function rt(e,t){if(e.length!==t.length)throw new Qi({expectedLength:e.length,givenLength:t.length});const n=Ko({params:e,values:t}),r=ur(n);return r.length===0?"0x":r}function Ko({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(or({param:e[r],value:t[r]}));return n}function or({param:e,value:t}){const n=cr(e.type);if(n){const[r,a]=n;return Jo(t,{length:r,param:{...e,type:a}})}if(e.type==="tuple")return nu(t,{param:e});if(e.type==="address")return Yo(t);if(e.type==="bool")return Qo(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int");return eu(t,{signed:r})}if(e.type.startsWith("bytes"))return Xo(t,{param:e});if(e.type==="string")return tu(t);throw new ao(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function ur(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:o}=e[s];i?t+=32:t+=D(o)}const n=[],r=[];let a=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:o}=e[s];i?(n.push(O(t+a,{size:32})),r.push(o),a+=D(o)):n.push(o)}return ue([...n,...r])}function Yo(e){if(!ie(e))throw new Ae({address:e});return{dynamic:!1,encoded:xe(e.toLowerCase())}}function Jo(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new io(e);if(!r&&e.length!==t)throw new Ji({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let a=!1;const s=[];for(let i=0;i<e.length;i++){const o=or({param:n,value:e[i]});o.dynamic&&(a=!0),s.push(o)}if(r||a){const i=ur(s);if(r){const o=O(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?ue([o,i]):o}}if(a)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:ue(s.map(({encoded:i})=>i))}}function Xo(e,{param:t}){const[,n]=t.type.split("bytes"),r=D(e);if(!n){let a=e;return r%32!==0&&(a=xe(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:ue([xe(O(r,{size:32})),a])}}if(r!==Number.parseInt(n))throw new Xi({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:xe(e,{dir:"right"})}}function Qo(e){if(typeof e!="boolean")throw new T(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:xe(ja(e))}}function eu(e,{signed:t}){return{dynamic:!1,encoded:O(e,{size:32,signed:t})}}function tu(e){const t=tr(e),n=Math.ceil(D(t)/32),r=[];for(let a=0;a<n;a++)r.push(xe(Vt(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:ue([xe(O(D(t),{size:32})),...r])}}function nu(e,{param:t}){let n=!1;const r=[];for(let a=0;a<t.components.length;a++){const s=t.components[a],i=Array.isArray(e)?a:s.name,o=or({param:s,value:e[i]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?ur(r):ue(r.map(({encoded:a})=>a))}}function cr(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const lr=e=>Vt(qa(e),0,4);function Mt(e){const{abi:t,args:n=[],name:r}=e,a=se(r,{strict:!1}),s=t.filter(o=>a?o.type==="function"?lr(o)===r:o.type==="event"?sr(o)===r:!1:"name"in o&&o.name===r);if(s.length===0)return;if(s.length===1)return s[0];let i;for(const o of s){if(!("inputs"in o))continue;if(!n||n.length===0){if(!o.inputs||o.inputs.length===0)return o;continue}if(!o.inputs||o.inputs.length===0||o.inputs.length!==n.length)continue;if(n.every((c,d)=>{const l="inputs"in o&&o.inputs[d];return l?On(c,l):!1})){if(i&&"inputs"in i&&i.inputs){const c=Ka(o.inputs,i.inputs,n);if(c)throw new no({abiItem:o,type:c[0]},{abiItem:i,type:c[1]})}i=o}}return i||s[0]}function On(e,t){const n=typeof e,r=t.type;switch(r){case"address":return ie(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,s)=>On(Object.values(e)[s],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=>On(a,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ka(e,t,n){for(const r in e){const a=e[r],s=t[r];if(a.type==="tuple"&&s.type==="tuple"&&"components"in a&&"components"in s)return Ka(a.components,s.components,n[r]);const i=[a.type,s.type];if(i.includes("address")&&i.includes("bytes20")?!0:i.includes("address")&&i.includes("string")?ie(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?ie(n[r],{strict:!1}):!1)return i}}const Jr="/docs/contract/encodeEventTopics";function $t(e){var u;const{abi:t,eventName:n,args:r}=e;let a=t[0];if(n){const c=Mt({abi:t,name:n});if(!c)throw new Gr(n,{docsPath:Jr});a=c}if(a.type!=="event")throw new Gr(void 0,{docsPath:Jr});const s=me(a),i=sr(s);let o=[];if(r&&"inputs"in a){const c=(u=a.inputs)==null?void 0:u.filter(l=>"indexed"in l&&l.indexed),d=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(l=>r[l.name]))??[]:[];d.length>0&&(o=(c==null?void 0:c.map((l,p)=>Array.isArray(d[p])?d[p].map((b,y)=>Xr({param:l,value:d[p][y]})):d[p]?Xr({param:l,value:d[p]}):null))??[])}return[i,...o]}function Xr({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return W(Pe(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new uo(e.type);return rt([e],[t])}function an(e,{method:t}){var r,a;const n={};return e.transport.type==="fallback"&&((a=(r=e.transport).onResponse)==null||a.call(r,({method:s,response:i,status:o,transport:u})=>{o==="success"&&t===s&&(n[i]=u.request)})),s=>n[s]||e.request}async function dr(e,t){const{address:n,abi:r,args:a,eventName:s,fromBlock:i,strict:o,toBlock:u}=t,c=an(e,{method:"eth_newFilter"}),d=s?$t({abi:r,args:a,eventName:s}):void 0,l=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?O(i):i,toBlock:typeof u=="bigint"?O(u):u,topics:d}]});return{abi:r,args:a,eventName:s,id:l,request:c(l),strict:!!o,type:"event"}}function te(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const Qr="/docs/contract/encodeFunctionData";function ru(e){const{abi:t,args:n,functionName:r}=e;let a=t[0];if(r){const s=Mt({abi:t,args:n,name:r});if(!s)throw new qt(r,{docsPath:Qr});a=s}if(a.type!=="function")throw new qt(void 0,{docsPath:Qr});return{abi:[a],functionName:lr(me(a))}}function $e(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var o;return e.abi.length===1&&((o=e.functionName)!=null&&o.startsWith("0x"))?e:ru(e)})(),a=n[0],s=r,i="inputs"in a&&a.inputs?rt(a.inputs,t??[]):void 0;return ir([s,i??"0x"])}const Ya={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."},au={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},su={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class ea extends T{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class Ja extends T{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PositionOutOfBoundsError"})}}class iu extends T{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"RecursiveReadLimitExceededError"})}}const ou={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 iu({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new Ja({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ea({offset:e});const t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new ea({offset:e});const t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){const n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){const t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){const t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){const t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){const t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();const e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();const n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();const e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();const e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();const e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();const e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){const t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;const e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function Xa(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(ou);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function uu(e,t={}){typeof t.size<"u"&&le(e,{size:t.size});const n=_(e,t);return Ze(n,t)}function cu(e,t={}){let n=e;if(typeof t.size<"u"&&(le(n,{size:t.size}),n=tn(n)),n.length>1||n[0]>1)throw new po(n);return!!n[0]}function ye(e,t={}){typeof t.size<"u"&&le(e,{size:t.size});const n=_(e,t);return Ee(n,t)}function lu(e,t={}){let n=e;return typeof t.size<"u"&&(le(n,{size:t.size}),n=tn(n,{dir:"right"})),new TextDecoder().decode(n)}function sn(e,t){const n=typeof t=="string"?Ue(t):t,r=Xa(n);if(D(n)===0&&e.length>0)throw new Qt;if(D(t)&&D(t)<32)throw new Oa({data:typeof t=="string"?t:_(t),params:e,size:D(t)});let a=0;const s=[];for(let i=0;i<e.length;++i){const o=e[i];r.setPosition(a);const[u,c]=Ve(r,o,{staticPosition:0});a+=c,s.push(u)}return s}function Ve(e,t,{staticPosition:n}){const r=cr(t.type);if(r){const[a,s]=r;return pu(e,{...t,type:s},{length:a,staticPosition:n})}if(t.type==="tuple")return bu(e,t,{staticPosition:n});if(t.type==="address")return du(e);if(t.type==="bool")return fu(e);if(t.type.startsWith("bytes"))return yu(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return mu(e,t);if(t.type==="string")return hu(e,{staticPosition:n});throw new so(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const ta=32,Rn=32;function du(e){const t=e.readBytes(32);return[rn(_(Za(t,-20))),32]}function pu(e,t,{length:n,staticPosition:r}){if(!n){const i=ye(e.readBytes(Rn)),o=r+i,u=o+ta;e.setPosition(o);const c=ye(e.readBytes(ta)),d=ft(t);let l=0;const p=[];for(let b=0;b<c;++b){e.setPosition(u+(d?b*32:l));const[y,f]=Ve(e,t,{staticPosition:u});l+=f,p.push(y)}return e.setPosition(r+32),[p,32]}if(ft(t)){const i=ye(e.readBytes(Rn)),o=r+i,u=[];for(let c=0;c<n;++c){e.setPosition(o+c*32);const[d]=Ve(e,t,{staticPosition:o});u.push(d)}return e.setPosition(r+32),[u,32]}let a=0;const s=[];for(let i=0;i<n;++i){const[o,u]=Ve(e,t,{staticPosition:r+a});a+=u,s.push(o)}return[s,a]}function fu(e){return[cu(e.readBytes(32),{size:32}),32]}function yu(e,t,{staticPosition:n}){const[r,a]=t.type.split("bytes");if(!a){const i=ye(e.readBytes(32));e.setPosition(n+i);const o=ye(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const u=e.readBytes(o);return e.setPosition(n+32),[_(u),32]}return[_(e.readBytes(Number.parseInt(a),32)),32]}function mu(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),a=e.readBytes(32);return[r>48?uu(a,{signed:n}):ye(a,{signed:n}),32]}function bu(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),a=r?[]:{};let s=0;if(ft(t)){const i=ye(e.readBytes(Rn)),o=n+i;for(let u=0;u<t.components.length;++u){const c=t.components[u];e.setPosition(o+s);const[d,l]=Ve(e,c,{staticPosition:o});s+=l,a[r?u:c==null?void 0:c.name]=d}return e.setPosition(n+32),[a,32]}for(let i=0;i<t.components.length;++i){const o=t.components[i],[u,c]=Ve(e,o,{staticPosition:n});a[r?i:o==null?void 0:o.name]=u,s+=c}return[a,s]}function hu(e,{staticPosition:t}){const n=ye(e.readBytes(32)),r=t+n;e.setPosition(r);const a=ye(e.readBytes(32));if(a===0)return e.setPosition(t+32),["",32];const s=e.readBytes(a,32),i=lu(tn(s));return e.setPosition(t+32),[i,32]}function ft(e){var r;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(r=e.components)==null?void 0:r.some(ft);const n=cr(e.type);return!!(n&&ft({...e,type:n[1]}))}function Qa(e){const{abi:t,data:n}=e,r=Vt(n,0,4);if(r==="0x")throw new Qt;const s=[...t||[],au,su].find(i=>i.type==="error"&&r===lr(me(i)));if(!s)throw new Ra(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?sn(s.inputs,Vt(n,4)):void 0,errorName:s.name}}const H=(e,t,n)=>JSON.stringify(e,(r,a)=>typeof a=="bigint"?a.toString():a,n);function es({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,s)=>`${r&&a.name?`${a.name}: `:""}${typeof t[s]=="object"?H(t[s]):t[s]}`).join(", ")})`}const gu={gwei:9,wei:18},wu={ether:-9,wei:9};function ts(e,t){let n=e.toString();const r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[a,s]=[n.slice(0,n.length-t),n.slice(n.length-t)];return s=s.replace(/(0+)$/,""),`${r?"-":""}${a||"0"}${s?`.${s}`:""}`}function pr(e,t="wei"){return ts(e,gu[t])}function Z(e,t="wei"){return ts(e,wu[t])}class vu extends T{constructor({address:t}){super(`State for account "${t}" is set multiple times.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountStateConflictError"})}}class Tu extends T{constructor(){super("state and stateDiff are set on the same account."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"StateAssignmentConflictError"})}}function na(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
20
|
-
`,"")}function xu(e){return e.reduce((t,{address:n,...r})=>{let a=`${t} ${n}:
|
|
21
|
-
`;return r.nonce&&(a+=` nonce: ${r.nonce}
|
|
22
|
-
`),r.balance&&(a+=` balance: ${r.balance}
|
|
23
|
-
`),r.code&&(a+=` code: ${r.code}
|
|
24
|
-
`),r.state&&(a+=` state:
|
|
25
|
-
`,a+=na(r.state)),r.stateDiff&&(a+=` stateDiff:
|
|
26
|
-
`,a+=na(r.stateDiff)),a},` State Override:
|
|
27
|
-
`).slice(0,-1)}function Ot(e){const t=Object.entries(e).map(([r,a])=>a===void 0||a===!1?null:[r,a]).filter(Boolean),n=t.reduce((r,[a])=>Math.max(r,a.length),0);return t.map(([r,a])=>` ${`${r}:`.padEnd(n+1)} ${a}`).join(`
|
|
28
|
-
`)}class Eu extends T{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
29
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FeeConflictError"})}}class Pu extends T{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ot(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","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- a Legacy Transaction with `gasPrice`"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSerializableTransactionError"})}}class Au extends T{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:l,value:p}){var y;const b=Ot({chain:a&&`${a==null?void 0:a.name} (id: ${a==null?void 0:a.id})`,from:n==null?void 0:n.address,to:l,value:typeof p<"u"&&`${pr(p)} ${((y=a==null?void 0:a.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof o<"u"&&`${Z(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${Z(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Z(c)} gwei`,nonce:d});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",b].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}}class ns extends T{constructor({blockHash:t,blockNumber:n,blockTag:r,hash:a,index:s}){let i="Transaction";r&&s!==void 0&&(i=`Transaction at block time "${r}" at index "${s}"`),t&&s!==void 0&&(i=`Transaction at block hash "${t}" at index "${s}"`),n&&s!==void 0&&(i=`Transaction at block number "${n}" at index "${s}"`),a&&(i=`Transaction with hash "${a}"`),super(`${i} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionNotFoundError"})}}class rs extends T{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"})}}class ra extends T{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"})}}class as extends T{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:l,value:p,stateOverride:b}){var m;const y=n?te(n):void 0;let f=Ot({from:y==null?void 0:y.address,to:l,value:typeof p<"u"&&`${pr(p)} ${((m=a==null?void 0:a.nativeCurrency)==null?void 0:m.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof o<"u"&&`${Z(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${Z(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Z(c)} gwei`,nonce:d});b&&(f+=`
|
|
30
|
-
${xu(b)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",f].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}}class Iu extends T{constructor(t,{abi:n,args:r,contractAddress:a,docsPath:s,functionName:i,sender:o}){const u=Mt({abi:n,args:r,name:i}),c=u?es({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,d=u?me(u,{includeName:!0}):void 0,l=Ot({address:a&&Zi(a),function:d,args:c&&c!=="()"&&`${[...Array((i==null?void 0:i.length)??0).keys()].map(()=>" ").join("")}${c}`,sender:o});super(t.shortMessage||`An unknown error occurred while executing the contract function "${i}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Contract Call:",l].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=n,this.args=r,this.cause=t,this.contractAddress=a,this.functionName=i,this.sender=o}}class kn extends T{constructor({abi:t,data:n,functionName:r,message:a}){let s,i,o,u;if(n&&n!=="0x")try{i=Qa({abi:t,data:n});const{abiItem:d,errorName:l,args:p}=i;if(l==="Error")u=p[0];else if(l==="Panic"){const[b]=p;u=Ya[b]}else{const b=d?me(d,{includeName:!0}):void 0,y=d&&p?es({abiItem:d,args:p,includeFunctionName:!1,includeName:!1}):void 0;o=[b?`Error: ${b}`:"",y&&y!=="()"?` ${[...Array((l==null?void 0:l.length)??0).keys()].map(()=>" ").join("")}${y}`:""]}}catch(d){s=d}else a&&(u=a);let c;s instanceof Ra&&(c=s.signature,o=[`Unable to decode signature "${c}" 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=${c}.`]),super(u&&u!=="execution reverted"||c?[`The contract function "${r}" reverted with the following ${c?"signature":"reason"}:`,u||c].join(`
|
|
31
|
-
`):`The contract function "${r}" reverted.`,{cause:s,metaMessages:o}),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=i,this.reason=u,this.signature=c}}class Cu extends T{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"})}}class Bu extends T{constructor({factory:t}){super(`Deployment for counterfactual contract call failed for factory "${t}".`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CounterfactualDeploymentFailedError"})}}class fr extends T{constructor({data:t,message:n}){super(n||""),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}}class We extends T{constructor({body:t,details:n,headers:r,status:a,url:s}){super("HTTP request failed.",{details:n,metaMessages:[a&&`Status: ${a}`,`URL: ${Xt(s)}`,t&&`Request body: ${H(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=r,this.status=a,this.url=s}}class ss extends T{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${Xt(r)}`,`Request body: ${H(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=n.code}}class aa extends T{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Xt(n)}`,`Request body: ${H(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}const Su=-1;class K extends T{constructor(t,{code:n,docsPath:r,metaMessages:a,shortMessage:s}){super(s,{cause:t,docsPath:r,metaMessages:a||(t==null?void 0: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 ss?t.code:n??Su}}class at extends K{constructor(t,n){super(t,n),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=n.data}}class yt extends K{constructor(t){super(t,{code:yt.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(yt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class mt extends K{constructor(t){super(t,{code:mt.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class bt extends K{constructor(t){super(t,{code:bt.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class ht extends K{constructor(t){super(t,{code:ht.code,shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
32
|
-
`)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParamsRpcError"})}}Object.defineProperty(ht,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class De extends K{constructor(t){super(t,{code:De.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(De,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class Le extends K{constructor(t){super(t,{code:Le.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
33
|
-
`)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(Le,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class gt extends K{constructor(t){super(t,{code:gt.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class wt extends K{constructor(t){super(t,{code:wt.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(wt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Ye extends K{constructor(t){super(t,{code:Ye.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(Ye,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class vt extends K{constructor(t){super(t,{code:vt.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(vt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Je extends K{constructor(t){super(t,{code:Je.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(Je,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Tt extends K{constructor(t){super(t,{code:Tt.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(Tt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ne extends at{constructor(t){super(t,{code:Ne.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(Ne,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class xt extends at{constructor(t){super(t,{code:xt.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(xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Et extends at{constructor(t){super(t,{code:Et.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(Et,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Pt extends at{constructor(t){super(t,{code:Pt.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(Pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class At extends at{constructor(t){super(t,{code:At.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(At,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class It extends at{constructor(t){super(t,{code:It.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(It,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Mu extends K{constructor(t){super(t,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}const $u=3;function Ct(e,{abi:t,address:n,args:r,docsPath:a,functionName:s,sender:i}){const{code:o,data:u,message:c,shortMessage:d}=e instanceof fr?e:e instanceof T?e.walk(p=>"data"in p)||e.walk():{},l=e instanceof Qt?new Cu({functionName:s}):[$u,De.code].includes(o)&&(u||c||d)?new kn({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:d??c}):e;return new Iu(l,{abi:t,args:r,contractAddress:n,docsPath:a,functionName:s,sender:i})}class Ou extends T{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:d,to:l,value:p}){var y;const b=Ot({from:n==null?void 0:n.address,to:l,value:typeof p<"u"&&`${pr(p)} ${((y=a==null?void 0:a.nativeCurrency)==null?void 0:y.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof o<"u"&&`${Z(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${Z(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${Z(c)} gwei`,nonce:d});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",b].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:"EstimateGasExecutionError"}),this.cause=t}}class Ge extends T{constructor({cause:t,message:n}={}){var a;const r=(a=n==null?void 0:n.replace("execution reverted: ",""))==null?void 0:a.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ExecutionRevertedError"})}}Object.defineProperty(Ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Ge,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Wt extends T{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Z(n)} 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(Wt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class Fn extends T{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${Z(n)}`:""} 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(Fn,"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/});class Nn extends T{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooHighError"})}}Object.defineProperty(Nn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class jn extends T{constructor({cause:t,nonce:n}={}){super([`Nonce provided for the transaction ${n?`(${n}) `:""}is lower than the current nonce of the account.`,"Try increasing the nonce or find the latest nonce with `getTransactionCount`."].join(`
|
|
34
|
-
`),{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceTooLowError"})}}Object.defineProperty(jn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class Un extends T{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NonceMaxValueError"})}}Object.defineProperty(Un,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class Dn extends T{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
35
|
-
`),{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(Dn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class Ln extends T{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}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(Ln,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class zn extends T{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntrinsicGasTooLowError"})}}Object.defineProperty(zn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Hn extends T{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(Hn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Zt extends T{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${Z(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${Z(r)} gwei`:""}).`].join(`
|
|
36
|
-
`),{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(Zt,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class on extends T{constructor({cause:t}){super(`An error occurred while executing: ${t==null?void 0:t.shortMessage}`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownNodeError"})}}function yr(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof T?e.walk(a=>a.code===Ge.code):e;return r instanceof T?new Ge({cause:e,message:r.details}):Ge.nodeMessage.test(n)?new Ge({cause:e,message:e.details}):Wt.nodeMessage.test(n)?new Wt({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Fn.nodeMessage.test(n)?new Fn({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Nn.nodeMessage.test(n)?new Nn({cause:e,nonce:t==null?void 0:t.nonce}):jn.nodeMessage.test(n)?new jn({cause:e,nonce:t==null?void 0:t.nonce}):Un.nodeMessage.test(n)?new Un({cause:e,nonce:t==null?void 0:t.nonce}):Dn.nodeMessage.test(n)?new Dn({cause:e}):Ln.nodeMessage.test(n)?new Ln({cause:e,gas:t==null?void 0:t.gas}):zn.nodeMessage.test(n)?new zn({cause:e,gas:t==null?void 0:t.gas}):Hn.nodeMessage.test(n)?new Hn({cause:e}):Zt.nodeMessage.test(n)?new Zt({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new on({cause:e})}function Ru(e,{docsPath:t,...n}){const r=(()=>{const a=yr(e,n);return a instanceof on?e:a})();return new Ou(r,{docsPath:t,...n})}function mr(e,{format:t}){if(!t)return{};const n={};function r(s){const i=Object.keys(s);for(const o of i)o in e&&(n[o]=e[o]),s[o]&&typeof s[o]=="object"&&!Array.isArray(s[o])&&r(s[o])}const a=t(e||{});return r(a),n}const ku={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function un(e){const t={};return typeof e.accessList<"u"&&(t.accessList=e.accessList),typeof e.blobVersionedHashes<"u"&&(t.blobVersionedHashes=e.blobVersionedHashes),typeof e.blobs<"u"&&(typeof e.blobs[0]!="string"?t.blobs=e.blobs.map(n=>_(n)):t.blobs=e.blobs),typeof e.data<"u"&&(t.data=e.data),typeof e.from<"u"&&(t.from=e.from),typeof e.gas<"u"&&(t.gas=O(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=O(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=O(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=O(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=O(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=O(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=ku[e.type]),typeof e.value<"u"&&(t.value=O(e.value)),t}function sa(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new Vr({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new Vr({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Fu(e){const{balance:t,nonce:n,state:r,stateDiff:a,code:s}=e,i={};if(s!==void 0&&(i.code=s),t!==void 0&&(i.balance=O(t)),n!==void 0&&(i.nonce=O(n)),r!==void 0&&(i.state=sa(r)),a!==void 0){if(i.state)throw new Tu;i.stateDiff=sa(a)}return i}function is(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!ie(n,{strict:!1}))throw new Ae({address:n});if(t[n])throw new vu({address:n});t[n]=Fu(r)}return t}function Rt(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:a,to:s}=e,i=t?te(t):void 0;if(i&&!ie(i.address))throw new Ae({address:i.address});if(s&&!ie(s))throw new Ae({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof a<"u"))throw new Eu;if(r&&r>2n**256n-1n)throw new Wt({maxFeePerGas:r});if(a&&r&&a>r)throw new Zt({maxFeePerGas:r,maxPriorityFeePerGas:a})}class Nu extends T{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class br extends T{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class ju extends T{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${Z(t)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class os extends T{constructor({blockHash:t,blockNumber:n}){let r="Block";t&&(r=`Block at hash "${t}"`),n&&(r=`Block at number "${n}"`),super(`${r} could not be found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlockNotFoundError"})}}const us={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function cs(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ee(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?Ee(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?us[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return t.yParity=(()=>{if(e.yParity)return Number(e.yParity);if(typeof t.v=="bigint"){if(t.v===0n||t.v===27n)return 0;if(t.v===1n||t.v===28n)return 1;if(t.v>=35n)return t.v%2n===0n?1:0}})(),t.type==="legacy"&&(delete t.accessList,delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas,delete t.yParity),t.type==="eip2930"&&(delete t.maxFeePerBlobGas,delete t.maxFeePerGas,delete t.maxPriorityFeePerGas),t.type==="eip1559"&&delete t.maxFeePerBlobGas,t}function ls(e){var n;const t=(n=e.transactions)==null?void 0:n.map(r=>typeof r=="string"?r:cs(r));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:t,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}async function Ie(e,{blockHash:t,blockNumber:n,blockTag:r,includeTransactions:a}={}){var d,l,p;const s=r??"latest",i=a??!1,o=n!==void 0?O(n):void 0;let u=null;if(t?u=await e.request({method:"eth_getBlockByHash",params:[t,i]}):u=await e.request({method:"eth_getBlockByNumber",params:[o||s,i]}),!u)throw new os({blockHash:t,blockNumber:n});return(((p=(l=(d=e.chain)==null?void 0:d.formatters)==null?void 0:l.block)==null?void 0:p.format)||ls)(u)}async function hr(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Uu(e,t){return ds(e,t)}async function ds(e,t){var s,i,o;const{block:n,chain:r=e.chain,request:a}=t||{};if(typeof((s=r==null?void 0:r.fees)==null?void 0:s.defaultPriorityFee)=="function"){const u=n||await S(e,Ie,"getBlock")({});return r.fees.defaultPriorityFee({block:u,client:e,request:a})}if(typeof((i=r==null?void 0:r.fees)==null?void 0:i.defaultPriorityFee)<"u")return(o=r==null?void 0:r.fees)==null?void 0:o.defaultPriorityFee;try{const u=await e.request({method:"eth_maxPriorityFeePerGas"});return Ze(u)}catch{const[u,c]=await Promise.all([n?Promise.resolve(n):S(e,Ie,"getBlock")({}),S(e,hr,"getGasPrice")({})]);if(typeof u.baseFeePerGas!="bigint")throw new br;const d=c-u.baseFeePerGas;return d<0n?0n:d}}async function Du(e,t){return _n(e,t)}async function _n(e,t){var p,b;const{block:n,chain:r=e.chain,request:a,type:s="eip1559"}=t||{},i=await(async()=>{var y,f;return typeof((y=r==null?void 0:r.fees)==null?void 0:y.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:a}):((f=r==null?void 0:r.fees)==null?void 0:f.baseFeeMultiplier)??1.2})();if(i<1)throw new Nu;const u=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=y=>y*BigInt(Math.ceil(i*u))/BigInt(u),d=n||await S(e,Ie,"getBlock")({});if(typeof((b=r==null?void 0:r.fees)==null?void 0:b.estimateFeesPerGas)=="function"){const y=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:c,request:a,type:s});if(y!==null)return y}if(s==="eip1559"){if(typeof d.baseFeePerGas!="bigint")throw new br;const y=typeof(a==null?void 0:a.maxPriorityFeePerGas)=="bigint"?a.maxPriorityFeePerGas:await ds(e,{block:d,chain:r,request:a}),f=c(d.baseFeePerGas);return{maxFeePerGas:(a==null?void 0:a.maxFeePerGas)??f+y,maxPriorityFeePerGas:y}}return{gasPrice:(a==null?void 0:a.gasPrice)??c(await S(e,hr,"getGasPrice")({}))}}async function ps(e,{address:t,blockTag:n="latest",blockNumber:r}){const a=await e.request({method:"eth_getTransactionCount",params:[t,r?O(r):n]});return Ee(a)}function fs(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(s=>Ue(s)):e.blobs,a=[];for(const s of r)a.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?a:a.map(s=>_(s))}function ys(e){const{kzg:t}=e,n=e.to??(typeof e.blobs[0]=="string"?"hex":"bytes"),r=typeof e.blobs[0]=="string"?e.blobs.map(i=>Ue(i)):e.blobs,a=typeof e.commitments[0]=="string"?e.commitments.map(i=>Ue(i)):e.commitments,s=[];for(let i=0;i<r.length;i++){const o=r[i],u=a[i];s.push(Uint8Array.from(t.computeBlobKzgProof(o,u)))}return n==="bytes"?s:s.map(i=>_(i))}function Lu(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const a=BigInt(32),s=BigInt(4294967295),i=Number(n>>a&s),o=Number(n&s),u=r?4:0,c=r?0:4;e.setUint32(t+u,i,r),e.setUint32(t+c,o,r)}class zu extends rr{constructor(t,n,r,a){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=a,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=wn(this.buffer)}update(t){Ke(this);const{view:n,buffer:r,blockLen:a}=this;t=nn(t);const s=t.length;for(let i=0;i<s;){const o=Math.min(a-this.pos,s-i);if(o===a){const u=wn(t);for(;a<=s-i;i+=a)this.process(u,i);continue}r.set(t.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===a&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ke(this),Ua(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:a,isLE:s}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>a-i&&(this.process(r,0),i=0);for(let l=i;l<a;l++)n[l]=0;Lu(r,a-8,BigInt(this.length*8),s),this.process(r,0);const o=wn(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=u/4,d=this.get();if(c>d.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<c;l++)o.setUint32(4*l,d[l],s)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:a,finished:s,destroyed:i,pos:o}=this;return t.length=a,t.pos=o,t.finished=s,t.destroyed=i,a%n&&t.buffer.set(r),t}}const Hu=(e,t,n)=>e&t^~e&n,_u=(e,t,n)=>e&t^e&n^t&n,qu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ve=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=new Uint32Array(64);class Gu extends zu{constructor(){super(64,32,8,!1),this.A=ve[0]|0,this.B=ve[1]|0,this.C=ve[2]|0,this.D=ve[3]|0,this.E=ve[4]|0,this.F=ve[5]|0,this.G=ve[6]|0,this.H=ve[7]|0}get(){const{A:t,B:n,C:r,D:a,E:s,F:i,G:o,H:u}=this;return[t,n,r,a,s,i,o,u]}set(t,n,r,a,s,i,o,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=a|0,this.E=s|0,this.F=i|0,this.G=o|0,this.H=u|0}process(t,n){for(let l=0;l<16;l++,n+=4)Te[l]=t.getUint32(n,!1);for(let l=16;l<64;l++){const p=Te[l-15],b=Te[l-2],y=oe(p,7)^oe(p,18)^p>>>3,f=oe(b,17)^oe(b,19)^b>>>10;Te[l]=f+Te[l-7]+y+Te[l-16]|0}let{A:r,B:a,C:s,D:i,E:o,F:u,G:c,H:d}=this;for(let l=0;l<64;l++){const p=oe(o,6)^oe(o,11)^oe(o,25),b=d+p+Hu(o,u,c)+qu[l]+Te[l]|0,f=(oe(r,2)^oe(r,13)^oe(r,22))+_u(r,a,s)|0;d=c,c=u,u=o,o=i+b|0,i=s,s=a,a=r,r=b+f|0}r=r+this.A|0,a=a+this.B|0,s=s+this.C|0,i=i+this.D|0,o=o+this.E|0,u=u+this.F|0,c=c+this.G|0,d=d+this.H|0,this.set(r,a,s,i,o,u,c,d)}roundClean(){Te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ms=La(()=>new Gu);function Vu(e,t){return ms(se(e,{strict:!1})?Pe(e):e)}function Wu(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),a=Vu(t);return a.set([n],0),r==="bytes"?a:_(a)}function Zu(e){const{commitments:t,version:n}=e,r=e.to??(typeof t[0]=="string"?"hex":"bytes"),a=[];for(const s of t)a.push(Wu({commitment:s,to:r,version:n}));return a}const ia=6,bs=32,gr=4096,hs=bs*gr,oa=hs*ia-1-1*gr*ia;class Ku extends T{constructor({maxSize:t,size:n}){super("Blob size is too large.",{metaMessages:[`Max: ${t} bytes`,`Given: ${n} bytes`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BlobSizeTooLargeError"})}}class Yu extends T{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}function Ju(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?Ue(e.data):e.data,r=D(n);if(!r)throw new Yu;if(r>oa)throw new Ku({maxSize:oa,size:r});const a=[];let s=!0,i=0;for(;s;){const o=Xa(new Uint8Array(hs));let u=0;for(;u<gr;){const c=n.slice(i,i+(bs-1));if(o.pushByte(0),o.pushBytes(c),c.length<31){o.pushByte(128),s=!1;break}u++,i+=31}a.push(o)}return t==="bytes"?a.map(o=>o.bytes):a.map(o=>_(o.bytes))}function Xu(e){const{data:t,kzg:n,to:r}=e,a=e.blobs??Ju({data:t,to:r}),s=e.commitments??fs({blobs:a,kzg:n,to:r}),i=e.proofs??ys({blobs:a,commitments:s,kzg:n,to:r}),o=[];for(let u=0;u<a.length;u++)o.push({blob:a[u],commitment:s[u],proof:i[u]});return o}function Qu(e){if(e.type)return e.type;if(typeof e.blobs<"u"||typeof e.blobVersionedHashes<"u"||typeof e.maxFeePerBlobGas<"u"||typeof e.sidecars<"u")return"eip4844";if(typeof e.maxFeePerGas<"u"||typeof e.maxPriorityFeePerGas<"u")return"eip1559";if(typeof e.gasPrice<"u")return typeof e.accessList<"u"?"eip2930":"legacy";throw new Pu({transaction:e})}async function kt(e){const t=await e.request({method:"eth_chainId"});return Ee(t)}const gs=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function cn(e,t){const{account:n=e.account,blobs:r,chain:a,chainId:s,gas:i,kzg:o,nonce:u,parameters:c=gs,type:d}=t,l=n?te(n):void 0,p={...t,...l?{from:l==null?void 0:l.address}:{}};let b;async function y(){return b||(b=await S(e,Ie,"getBlock")({blockTag:"latest"}),b)}if((c.includes("blobVersionedHashes")||c.includes("sidecars"))&&r&&o){const f=fs({blobs:r,kzg:o});if(c.includes("blobVersionedHashes")){const m=Zu({commitments:f,to:"hex"});p.blobVersionedHashes=m}if(c.includes("sidecars")){const m=ys({blobs:r,commitments:f,kzg:o}),h=Xu({blobs:r,commitments:f,proofs:m,to:"hex"});p.sidecars=h}}if(c.includes("chainId")&&(a?p.chainId=a.id:typeof s<"u"?p.chainId=s:p.chainId=await S(e,kt,"getChainId")({})),c.includes("nonce")&&typeof u>"u"&&l&&(p.nonce=await S(e,ps,"getTransactionCount")({address:l.address,blockTag:"pending"})),(c.includes("fees")||c.includes("type"))&&typeof d>"u")try{p.type=Qu(p)}catch{const f=await y();p.type=typeof(f==null?void 0:f.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(c.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const f=await y(),{maxFeePerGas:m,maxPriorityFeePerGas:h}=await _n(e,{block:f,chain:a,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<h)throw new ju({maxPriorityFeePerGas:h});p.maxPriorityFeePerGas=h,p.maxFeePerGas=m}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new br;const f=await y(),{gasPrice:m}=await _n(e,{block:f,chain:a,request:p,type:"legacy"});p.gasPrice=m}return c.includes("gas")&&typeof i>"u"&&(p.gas=await S(e,wr,"estimateGas")({...p,account:l?{address:l.address,type:"json-rpc"}:void 0})),Rt(p),delete p.parameters,p}async function wr(e,t){var a,s,i;const n=t.account??e.account,r=n?te(n):void 0;try{const{accessList:o,blobs:u,blobVersionedHashes:c,blockNumber:d,blockTag:l,data:p,gas:b,gasPrice:y,maxFeePerBlobGas:f,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:g,to:w,value:x,stateOverride:P,...v}=await cn(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),E=(d?O(d):void 0)||l,B=is(P);Rt(t);const M=(i=(s=(a=e.chain)==null?void 0:a.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,F=(M||un)({...mr(v,{format:M}),from:r==null?void 0:r.address,accessList:o,blobs:u,blobVersionedHashes:c,data:p,gas:b,gasPrice:y,maxFeePerBlobGas:f,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:g,to:w,value:x}),k=await e.request({method:"eth_estimateGas",params:B?[F,E??"latest",B]:E?[F,E]:[F]});return BigInt(k)}catch(o){throw Ru(o,{...t,account:r,chain:e.chain})}}async function ws(e,t){const{abi:n,address:r,args:a,functionName:s,...i}=t,o=$e({abi:n,args:a,functionName:s});try{return await S(e,wr,"estimateGas")({data:o,to:r,...i})}catch(u){const c=i.account?te(i.account):void 0;throw Ct(u,{abi:n,address:r,args:a,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:c==null?void 0:c.address})}}const ua="/docs/contract/decodeEventLog";function vr(e){const{abi:t,data:n,strict:r,topics:a}=e,s=r??!0,[i,...o]=a;if(!i)throw new eo({docsPath:ua});const u=t.find(f=>f.type==="event"&&i===sr(me(f)));if(!(u&&"name"in u)||u.type!=="event")throw new ka(i,{docsPath:ua});const{name:c,inputs:d}=u,l=d==null?void 0:d.some(f=>!("name"in f&&f.name));let p=l?[]:{};const b=d.filter(f=>"indexed"in f&&f.indexed);for(let f=0;f<b.length;f++){const m=b[f],h=o[f];if(!h)throw new en({abiItem:u,param:m});p[l?f:m.name||f]=ec({param:m,value:h})}const y=d.filter(f=>!("indexed"in f&&f.indexed));if(y.length>0){if(n&&n!=="0x")try{const f=sn(y,n);if(f)if(l)p=[...p,...f];else for(let m=0;m<y.length;m++)p[y[m].name]=f[m]}catch(f){if(s)throw f instanceof Oa||f instanceof Ja?new pt({abiItem:u,data:n,params:y,size:D(n)}):f}else if(s)throw new pt({abiItem:u,data:"0x",params:y,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function ec({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(sn([e],t)||[])[0]}function Tr({abi:e,eventName:t,logs:n,strict:r=!0}){return n.map(a=>{var s;try{const i=vr({...a,abi:e,strict:r});return t&&!t.includes(i.eventName)?null:{...i,...a}}catch(i){let o,u;if(i instanceof ka)return null;if(i instanceof pt||i instanceof en){if(r)return null;o=i.abiItem.name,u=(s=i.abiItem.inputs)==null?void 0:s.some(c=>!("name"in c&&c.name))}return{...a,args:u?[]:{},eventName:o}}}).filter(Boolean)}function Ce(e,{args:t,eventName:n}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...n?{args:t,eventName:n}:{}}}async function xr(e,{address:t,blockHash:n,fromBlock:r,toBlock:a,event:s,events:i,args:o,strict:u}={}){const c=u??!1,d=i??(s?[s]:void 0);let l=[];d&&(l=[d.flatMap(y=>$t({abi:[y],eventName:y.name,args:o}))],s&&(l=l[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:l,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:l,fromBlock:typeof r=="bigint"?O(r):r,toBlock:typeof a=="bigint"?O(a):a}]});const b=p.map(y=>Ce(y));return d?Tr({abi:d,logs:b,strict:c}):b}async function Er(e,t){const{abi:n,address:r,args:a,blockHash:s,eventName:i,fromBlock:o,toBlock:u,strict:c}=t,d=i?Mt({abi:n,name:i}):void 0,l=d?void 0:n.filter(p=>p.type==="event");return S(e,xr,"getLogs")({address:r,args:a,blockHash:s,event:d,events:l,fromBlock:o,toBlock:u,strict:c})}const xn="/docs/contract/decodeFunctionResult";function st(e){const{abi:t,args:n,functionName:r,data:a}=e;let s=t[0];if(r){const o=Mt({abi:t,args:n,name:r});if(!o)throw new qt(r,{docsPath:xn});s=o}if(s.type!=="function")throw new qt(void 0,{docsPath:xn});if(!s.outputs)throw new to(s.name,{docsPath:xn});const i=sn(s.outputs,a);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const qn=[{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"}],vs=[{inputs:[],name:"ResolverNotFound",type:"error"},{inputs:[],name:"ResolverWildcardNotSupported",type:"error"},{inputs:[],name:"ResolverNotContract",type:"error"},{inputs:[{name:"returnData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{components:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"errors",type:"tuple[]"}],name:"HttpError",type:"error"}],Ts=[...vs,{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]},{name:"resolve",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],tc=[...vs,{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"}]},{name:"reverse",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolvedAddress"},{type:"address",name:"reverseResolver"},{type:"address",name:"resolver"}]}],ca=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],la=[{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"}]}],nc=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],rc="0x82ad56cb",ac="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",sc="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class Gn extends T{constructor({blockNumber:t,chain:n,contract:r}){super(`Chain "${n.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...t&&r.blockCreated&&r.blockCreated>t?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${t}).`]:[`- The chain does not have the contract "${r.name}" configured.`]]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainDoesNotSupportContract"})}}class ic extends T{constructor({chain:t,currentChainId:n}){super(`The current chain of the wallet (id: ${n}) does not match the target chain for the transaction (id: ${t.id} – ${t.name}).`,{metaMessages:[`Current Chain ID: ${n}`,`Expected Chain ID: ${t.id} – ${t.name}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainMismatchError"})}}class oc extends T{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(`
|
|
37
|
-
`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotFoundError"})}}class xs extends T{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}const En="/docs/contract/encodeDeployData";function Pr(e){const{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;const a=t.find(i=>"type"in i&&i.type==="constructor");if(!a)throw new Yi({docsPath:En});if(!("inputs"in a))throw new qr({docsPath:En});if(!a.inputs||a.inputs.length===0)throw new qr({docsPath:En});const s=rt(a.inputs,n);return ir([r,s])}function it({blockNumber:e,chain:t,contract:n}){var a;const r=(a=t==null?void 0:t.contracts)==null?void 0:a[n];if(!r)throw new Gn({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Gn({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function uc(e,{docsPath:t,...n}){const r=(()=>{const a=yr(e,n);return a instanceof on?e:a})();return new as(r,{docsPath:t,...n})}const Pn=new Map;function Es({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:a}){const s=async()=>{const d=u();i();const l=d.map(({args:p})=>p);l.length!==0&&e(l).then(p=>{var b;a&&Array.isArray(p)&&p.sort(a);for(let y=0;y<d.length;y++){const{pendingPromise:f}=d[y];(b=f.resolve)==null||b.call(f,[p[y],p])}}).catch(p=>{var b;for(let y=0;y<d.length;y++){const{pendingPromise:f}=d[y];(b=f.reject)==null||b.call(f,p)}})},i=()=>Pn.delete(t),o=()=>u().map(({args:d})=>d),u=()=>Pn.get(t)||[],c=d=>Pn.set(t,[...u(),d]);return{flush:i,async schedule(d){const l={},p=new Promise((f,m)=>{l.resolve=f,l.reject=m});return(n==null?void 0:n([...o(),d]))&&s(),u().length>0?(c({args:d,pendingPromise:l}),p):(c({args:d,pendingPromise:l}),setTimeout(s,r),p)}}}async function Ft(e,t){var E,B,M,$;const{account:n=e.account,batch:r=!!((E=e.batch)!=null&&E.multicall),blockNumber:a,blockTag:s="latest",accessList:i,blobs:o,data:u,factory:c,factoryData:d,gas:l,gasPrice:p,maxFeePerBlobGas:b,maxFeePerGas:y,maxPriorityFeePerGas:f,nonce:m,to:h,value:g,stateOverride:w,...x}=t,P=n?te(n):void 0,v=c&&d&&h&&u,A=v?dc({data:u,factory:c,factoryData:d,to:h}):u;try{Rt(t);const k=(a?O(a):void 0)||s,q=is(w),I=($=(M=(B=e.chain)==null?void 0:B.formatters)==null?void 0:M.transactionRequest)==null?void 0:$.format,R=(I||un)({...mr(x,{format:I}),from:P==null?void 0:P.address,accessList:i,blobs:o,data:A,gas:l,gasPrice:p,maxFeePerBlobGas:b,maxFeePerGas:y,maxPriorityFeePerGas:f,nonce:m,to:v?void 0:h,value:g});if(r&&cc({request:R})&&!q)try{return await lc(e,{...R,blockNumber:a,blockTag:s})}catch(N){if(!(N instanceof xs)&&!(N instanceof Gn))throw N}const j=await e.request({method:"eth_call",params:q?[R,k,q]:[R,k]});return j==="0x"?{data:void 0}:{data:j}}catch(F){const k=pc(F),{offchainLookup:q,offchainLookupSignature:I}=await Promise.resolve().then(()=>require("./ccip-CsTi3xD2.cjs"));if(e.ccipRead!==!1&&(k==null?void 0:k.slice(0,10))===I&&h)return{data:await q(e,{data:k,to:h})};throw v&&(k==null?void 0:k.slice(0,10))==="0x101bb98d"?new Bu({factory:c}):uc(F,{...t,account:P,chain:e.chain})}}function cc({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(rc)||!n||Object.values(r).filter(a=>typeof a<"u").length>0)}async function lc(e,t){var f;const{batchSize:n=1024,wait:r=0}=typeof((f=e.batch)==null?void 0:f.multicall)=="object"?e.batch.multicall:{},{blockNumber:a,blockTag:s="latest",data:i,multicallAddress:o,to:u}=t;let c=o;if(!c){if(!e.chain)throw new xs;c=it({blockNumber:a,chain:e.chain,contract:"multicall3"})}const l=(a?O(a):void 0)||s,{schedule:p}=Es({id:`${e.uid}.${l}`,wait:r,shouldSplitBatch(m){return m.reduce((g,{data:w})=>g+(w.length-2),0)>n*2},fn:async m=>{const h=m.map(x=>({allowFailure:!0,callData:x.data,target:x.to})),g=$e({abi:qn,args:[h],functionName:"aggregate3"}),w=await e.request({method:"eth_call",params:[{data:g,to:c},l]});return st({abi:qn,args:[h],functionName:"aggregate3",data:w||"0x"})}}),[{returnData:b,success:y}]=await p({data:i,to:u});if(!y)throw new fr({data:b});return b==="0x"?{data:void 0}:{data:b}}function dc(e){const{data:t,factory:n,factoryData:r,to:a}=e;return Pr({abi:Gi(["error CounterfactualDeployFailed(bytes)","constructor(address, bytes, address, bytes)"]),bytecode:ac,args:[a,t,n,r]})}function pc(e){var n;if(!(e instanceof T))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(n=t.data)==null?void 0:n.data:t.data}async function ce(e,t){const{abi:n,address:r,args:a,functionName:s,...i}=t,o=$e({abi:n,args:a,functionName:s});try{const{data:u}=await S(e,Ft,"call")({...i,data:o,to:r});return st({abi:n,args:a,functionName:s,data:u||"0x"})}catch(u){throw Ct(u,{abi:n,address:r,args:a,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ps(e,t){const{abi:n,address:r,args:a,dataSuffix:s,functionName:i,...o}=t,u=o.account?te(o.account):e.account,c=$e({abi:n,args:a,functionName:i});try{const{data:d}=await S(e,Ft,"call")({batch:!1,data:`${c}${s?s.replace("0x",""):""}`,to:r,...o,account:u}),l=st({abi:n,args:a,functionName:i,data:d||"0x"}),p=n.filter(b=>"name"in b&&b.name===t.functionName);return{result:l,request:{abi:p,address:r,args:a,dataSuffix:s,functionName:i,...o,account:u}}}catch(d){throw Ct(d,{abi:n,address:r,args:a,docsPath:"/docs/contract/simulateContract",functionName:i,sender:u==null?void 0:u.address})}}const An=new Map,da=new Map;let fc=0;function Be(e,t,n){const r=++fc,a=()=>An.get(e)||[],s=()=>{const d=a();An.set(e,d.filter(l=>l.id!==r))},i=()=>{const d=da.get(e);a().length===1&&d&&d(),s()},o=a();if(An.set(e,[...o,{id:r,fns:t}]),o&&o.length>0)return i;const u={};for(const d in t)u[d]=(...l)=>{var b,y;const p=a();if(p.length!==0)for(const f of p)(y=(b=f.fns)[d])==null||y.call(b,...l)};const c=n(u);return typeof c=="function"&&da.set(e,c),i}async function Kt(e){return new Promise(t=>setTimeout(t,e))}function Nt(e,{emitOnBegin:t,initialWaitTime:n,interval:r}){let a=!0;const s=()=>a=!1;return(async()=>{let o;t&&(o=await e({unpoll:s}));const u=await(n==null?void 0:n(o))??r;await Kt(u);const c=async()=>{a&&(await e({unpoll:s}),await Kt(r),c())};c()})(),s}const yc=new Map,mc=new Map;function bc(e){const t=(a,s)=>({clear:()=>s.delete(a),get:()=>s.get(a),set:i=>s.set(a,i)}),n=t(e,yc),r=t(e,mc);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function hc(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=bc(t),a=r.response.get();if(a&&n>0&&new Date().getTime()-a.created.getTime()<n)return a.data;let s=r.promise.get();s||(s=e(),r.promise.set(s));try{const i=await s;return r.response.set({created:new Date,data:i}),i}finally{r.promise.clear()}}const gc=e=>`blockNumber.${e}`;async function jt(e,{cacheTime:t=e.cacheTime}={}){const n=await hc(()=>e.request({method:"eth_blockNumber"}),{cacheKey:gc(e.uid),cacheTime:t});return BigInt(n)}async function ln(e,{filter:t}){const n="strict"in t&&t.strict,r=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof r[0]=="string")return r;const a=r.map(s=>Ce(s));return!("abi"in t)||!t.abi?a:Tr({abi:t.abi,logs:a,strict:n})}async function dn(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function As(e,t){const{abi:n,address:r,args:a,batch:s=!0,eventName:i,fromBlock:o,onError:u,onLogs:c,poll:d,pollingInterval:l=e.pollingInterval,strict:p}=t;return(typeof d<"u"?d:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket"))?(()=>{const m=p??!1,h=H(["watchContractEvent",r,a,s,e.uid,i,l,m,o]);return Be(h,{onLogs:c,onError:u},g=>{let w;o!==void 0&&(w=o-1n);let x,P=!1;const v=Nt(async()=>{var A;if(!P){try{x=await S(e,dr,"createContractEventFilter")({abi:n,address:r,args:a,eventName:i,strict:m,fromBlock:o})}catch{}P=!0;return}try{let E;if(x)E=await S(e,ln,"getFilterChanges")({filter:x});else{const B=await S(e,jt,"getBlockNumber")({});w&&w!==B?E=await S(e,Er,"getContractEvents")({abi:n,address:r,args:a,eventName:i,fromBlock:w+1n,toBlock:B,strict:m}):E=[],w=B}if(E.length===0)return;if(s)g.onLogs(E);else for(const B of E)g.onLogs([B])}catch(E){x&&E instanceof Le&&(P=!1),(A=g.onError)==null||A.call(g,E)}},{emitOnBegin:!0,interval:l});return async()=>{x&&await S(e,dn,"uninstallFilter")({filter:x}),v()}})})():(()=>{const m=p??!1,h=H(["watchContractEvent",r,a,s,e.uid,i,l,m]);let g=!0,w=()=>g=!1;return Be(h,{onLogs:c,onError:u},x=>((async()=>{try{const P=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(B=>B.config.type==="webSocket");return E?E.value:e.transport}return e.transport})(),v=i?$t({abi:n,eventName:i,args:a}):[],{unsubscribe:A}=await P.subscribe({params:["logs",{address:r,topics:v}],onData(E){var M;if(!g)return;const B=E.result;try{const{eventName:$,args:F}=vr({abi:n,data:B.data,topics:B.topics,strict:p}),k=Ce(B,{args:F,eventName:$});x.onLogs([k])}catch($){let F,k;if($ instanceof pt||$ instanceof en){if(p)return;F=$.abiItem.name,k=(M=$.abiItem.inputs)==null?void 0:M.some(I=>!("name"in I&&I.name))}const q=Ce(B,{args:k?[]:{},eventName:F});x.onLogs([q])}},onError(E){var B;(B=x.onError)==null||B.call(x,E)}});w=A,g||w()}catch(P){u==null||u(P)}})(),()=>w()))})()}class pn extends T{constructor({docsPath:t}={}){super(["Could not find an Account to execute with this Action.","Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."].join(`
|
|
38
|
-
`),{docsPath:t,docsSlug:"account"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AccountNotFoundError"})}}function Is({chain:e,currentChainId:t}){if(!e)throw new oc;if(t!==e.id)throw new ic({chain:e,currentChainId:t})}function wc(e,{docsPath:t,...n}){const r=(()=>{const a=yr(e,n);return a instanceof on?e:a})();return new Au(r,{docsPath:t,...n})}async function Ar(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}async function Ir(e,t){var h,g,w,x;const{account:n=e.account,chain:r=e.chain,accessList:a,blobs:s,data:i,gas:o,gasPrice:u,maxFeePerBlobGas:c,maxFeePerGas:d,maxPriorityFeePerGas:l,nonce:p,to:b,value:y,...f}=t;if(!n)throw new pn({docsPath:"/docs/actions/wallet/sendTransaction"});const m=te(n);try{Rt(t);let P;if(r!==null&&(P=await S(e,kt,"getChainId")({}),Is({currentChainId:P,chain:r})),m.type==="local"){const B=await S(e,cn,"prepareTransactionRequest")({account:m,accessList:a,blobs:s,chain:r,chainId:P,data:i,gas:o,gasPrice:u,maxFeePerBlobGas:c,maxFeePerGas:d,maxPriorityFeePerGas:l,nonce:p,parameters:[...gs,"sidecars"],to:b,value:y,...f}),M=(h=r==null?void 0:r.serializers)==null?void 0:h.transaction,$=await m.signTransaction(B,{serializer:M});return await S(e,Ar,"sendRawTransaction")({serializedTransaction:$})}const v=(x=(w=(g=e.chain)==null?void 0:g.formatters)==null?void 0:w.transactionRequest)==null?void 0:x.format,E=(v||un)({...mr(f,{format:v}),accessList:a,blobs:s,data:i,from:m.address,gas:o,gasPrice:u,maxFeePerBlobGas:c,maxFeePerGas:d,maxPriorityFeePerGas:l,nonce:p,to:b,value:y});return await e.request({method:"eth_sendTransaction",params:[E]},{retryCount:0})}catch(P){throw wc(P,{...t,account:m,chain:t.chain||void 0})}}async function Cs(e,t){const{abi:n,address:r,args:a,dataSuffix:s,functionName:i,...o}=t,u=$e({abi:n,args:a,functionName:i});return S(e,Ir,"sendTransaction")({data:`${u}${s?s.replace("0x",""):""}`,to:r,...o})}function Cr({abi:e,address:t,client:n}){const r=n,[a,s]=r?"public"in r&&"wallet"in r?[r.public,r.wallet]:"public"in r?[r.public,void 0]:"wallet"in r?[void 0,r.wallet]:[r,r]:[void 0,void 0],i=a!=null,o=s!=null,u={};let c=!1,d=!1,l=!1;for(const p of e)if(p.type==="function"?p.stateMutability==="view"||p.stateMutability==="pure"?c=!0:d=!0:p.type==="event"&&(l=!0),c&&d&&l)break;return i&&(c&&(u.read=new Proxy({},{get(p,b){return(...y)=>{const{args:f,options:m}=Lt(y);return S(a,ce,"readContract")({abi:e,address:t,functionName:b,args:f,...m})}}})),d&&(u.simulate=new Proxy({},{get(p,b){return(...y)=>{const{args:f,options:m}=Lt(y);return S(a,Ps,"simulateContract")({abi:e,address:t,functionName:b,args:f,...m})}}})),l&&(u.createEventFilter=new Proxy({},{get(p,b){return(...y)=>{const f=e.find(g=>g.type==="event"&&g.name===b),{args:m,options:h}=In(y,f);return S(a,dr,"createContractEventFilter")({abi:e,address:t,eventName:b,args:m,...h})}}}),u.getEvents=new Proxy({},{get(p,b){return(...y)=>{const f=e.find(g=>g.type==="event"&&g.name===b),{args:m,options:h}=In(y,f);return S(a,Er,"getContractEvents")({abi:e,address:t,eventName:b,args:m,...h})}}}),u.watchEvent=new Proxy({},{get(p,b){return(...y)=>{const f=e.find(g=>g.type==="event"&&g.name===b),{args:m,options:h}=In(y,f);return S(a,As,"watchContractEvent")({abi:e,address:t,eventName:b,args:m,...h})}}}))),o&&d&&(u.write=new Proxy({},{get(p,b){return(...y)=>{const{args:f,options:m}=Lt(y);return S(s,Cs,"writeContract")({abi:e,address:t,functionName:b,args:f,...m})}}})),(i||o)&&d&&(u.estimateGas=new Proxy({},{get(p,b){return(...y)=>{const{args:f,options:m}=Lt(y);return S(a??s,ws,"estimateContractGas")({abi:e,address:t,functionName:b,args:f,...m,account:m.account??s.account})}}})),u.address=t,u.abi=e,u}function Lt(e){const t=e.length&&Array.isArray(e[0]),n=t?e[0]:[],r=(t?e[1]:e[0])??{};return{args:n,options:r}}function In(e,t){let n=!1;Array.isArray(e[0])?n=!0:e.length===1?n=t.inputs.some(s=>s.indexed):e.length===2&&(n=!0);const r=n?e[0]:void 0,a=(n?e[1]:e[0])??{};return{args:r,options:a}}class vc extends T{constructor({address:t}){super(`No EIP-712 domain found on contract "${t}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${t}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip712DomainNotFoundError"})}}async function Tc(e,t){const{address:n,factory:r,factoryData:a}=t;try{const[s,i,o,u,c,d,l]=await S(e,ce,"readContract")({abi:xc,address:n,functionName:"eip712Domain",factory:r,factoryData:a});return{domain:{name:i,version:o,chainId:Number(u),verifyingContract:c,salt:d},extensions:l,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new vc({address:n}):i}}const xc=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function Ec(e,{chain:t}){const{id:n,name:r,nativeCurrency:a,rpcUrls:s,blockExplorers:i}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:O(n),chainName:r,nativeCurrency:a,rpcUrls:s.default.http,blockExplorerUrls:i?Object.values(i).map(({url:o})=>o):void 0}]},{retryCount:0})}const Vn=256;let zt=Vn,Ht;function Pc(e=11){if(!Ht||zt+e>Vn*2){Ht="",zt=0;for(let t=0;t<Vn;t++)Ht+=(256+Math.random()*256|0).toString(16).substring(1)}return Ht.substring(zt,zt+++e)}function Bs(e){const{batch:t,cacheTime:n=e.pollingInterval??4e3,ccipRead:r,key:a="base",name:s="Base Client",pollingInterval:i=4e3,type:o="base"}=e,u=e.chain,c=e.account?te(e.account):void 0,{config:d,request:l,value:p}=e.transport({chain:u,pollingInterval:i}),b={...d,...p},y={account:c,batch:t,cacheTime:n,ccipRead:r,chain:u,key:a,name:s,pollingInterval:i,request:l,transport:b,type:o,uid:Pc()};function f(m){return h=>{const g=h(m);for(const x in y)delete g[x];const w={...m,...g};return Object.assign(w,{extend:f(w)})}}return Object.assign(y,{extend:f(y)})}function Wn(e,{delay:t=100,retryCount:n=2,shouldRetry:r=()=>!0}={}){return new Promise((a,s)=>{const i=async({count:o=0}={})=>{const u=async({error:c})=>{const d=typeof t=="function"?t({count:o,error:c}):t;d&&await Kt(d),i({count:o+1})};try{const c=await e();a(c)}catch(c){if(o<n&&await r({count:o,error:c}))return u({error:c});s(c)}};i()})}function Ac(e,t={}){return async(n,r={})=>{const{retryDelay:a=150,retryCount:s=3}={...t,...r};return Wn(async()=>{try{return await e(n)}catch(i){const o=i;switch(o.code){case yt.code:throw new yt(o);case mt.code:throw new mt(o);case bt.code:throw new bt(o);case ht.code:throw new ht(o);case De.code:throw new De(o);case Le.code:throw new Le(o);case gt.code:throw new gt(o);case wt.code:throw new wt(o);case Ye.code:throw new Ye(o);case vt.code:throw new vt(o);case Je.code:throw new Je(o);case Tt.code:throw new Tt(o);case Ne.code:throw new Ne(o);case xt.code:throw new xt(o);case Et.code:throw new Et(o);case Pt.code:throw new Pt(o);case At.code:throw new At(o);case It.code:throw new It(o);case 5e3:throw new Ne(o);default:throw i instanceof T?i:new Mu(o)}}},{delay:({count:i,error:o})=>{var u;if(o&&o instanceof We){const c=(u=o==null?void 0:o.headers)==null?void 0:u.get("Retry-After");if(c!=null&&c.match(/\d/))return Number.parseInt(c)*1e3}return~~(1<<i)*a},retryCount:s,shouldRetry:({error:i})=>Ic(i)})}}function Ic(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===Je.code||e.code===De.code:e instanceof We&&e.status?e.status===403||e.status===408||e.status===413||e.status===429||e.status===500||e.status===502||e.status===503||e.status===504:!0}function Br({key:e,name:t,request:n,retryCount:r=3,retryDelay:a=150,timeout:s,type:i},o){return{config:{key:e,name:t,request:n,retryCount:r,retryDelay:a,timeout:s,type:i},request:Ac(n,{retryCount:r,retryDelay:a}),value:o}}function Cc(e,t={}){const{key:n="custom",name:r="Custom Provider",retryDelay:a}=t;return({retryCount:s})=>Br({key:n,name:r,request:e.request.bind(e),retryCount:t.retryCount??s,retryDelay:a,type:"custom"})}function Bc(e,t={}){const{key:n="fallback",name:r="Fallback",rank:a=!1,retryCount:s,retryDelay:i}=t;return({chain:o,pollingInterval:u=4e3,timeout:c,...d})=>{let l=e,p=()=>{};const b=Br({key:n,name:r,async request({method:y,params:f}){const m=async(h=0)=>{const g=l[h]({...d,chain:o,retryCount:0,timeout:c});try{const w=await g.request({method:y,params:f});return p({method:y,params:f,response:w,transport:g,status:"success"}),w}catch(w){if(p({error:w,method:y,params:f,transport:g,status:"error"}),Sc(w)||h===l.length-1)throw w;return m(h+1)}};return m()},retryCount:s,retryDelay:i,type:"fallback"},{onResponse:y=>p=y,transports:l.map(y=>y({chain:o,retryCount:0}))});if(a){const y=typeof a=="object"?a:{};Mc({chain:o,interval:y.interval??u,onTransports:f=>l=f,sampleCount:y.sampleCount,timeout:y.timeout,transports:l,weights:y.weights})}return b}}function Sc(e){return"code"in e&&typeof e.code=="number"&&(e.code===Ye.code||e.code===Ne.code||e.code===5e3)}function Mc({chain:e,interval:t=4e3,onTransports:n,sampleCount:r=10,timeout:a=1e3,transports:s,weights:i={}}){const{stability:o=.7,latency:u=.3}=i,c=[],d=async()=>{const l=await Promise.all(s.map(async y=>{const f=y({chain:e,retryCount:0,timeout:a}),m=Date.now();let h,g;try{await f.request({method:"net_listening"}),g=1}catch{g=0}finally{h=Date.now()}return{latency:h-m,success:g}}));c.push(l),c.length>r&&c.shift();const p=Math.max(...c.map(y=>Math.max(...y.map(({latency:f})=>f)))),b=s.map((y,f)=>{const m=c.map(P=>P[f].latency),g=1-m.reduce((P,v)=>P+v,0)/m.length/p,w=c.map(P=>P[f].success),x=w.reduce((P,v)=>P+v,0)/w.length;return x===0?[0,f]:[u*g+o*x,f]}).sort((y,f)=>f[0]-y[0]);n(b.map(([,y])=>s[y])),await Kt(t),d()};d()}class $c extends T{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Oc(e,{errorInstance:t=new Error("timed out"),timeout:n,signal:r}){return new Promise((a,s)=>{(async()=>{let i;try{const o=new AbortController;n>0&&(i=setTimeout(()=>{r?o.abort():s(t)},n)),a(await e({signal:(o==null?void 0:o.signal)||null}))}catch(o){(o==null?void 0:o.name)==="AbortError"&&s(t),s(o)}finally{clearTimeout(i)}})()})}function Rc(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const pa=Rc();function kc(e,t={}){return{async request(n){var l;const{body:r,onRequest:a=t.onRequest,onResponse:s=t.onResponse,timeout:i=t.timeout??1e4}=n,o={...t.fetchOptions??{},...n.fetchOptions??{}},{headers:u,method:c,signal:d}=o;try{const p=await Oc(async({signal:y})=>{const f={...o,body:Array.isArray(r)?H(r.map(g=>({jsonrpc:"2.0",id:g.id??pa.take(),...g}))):H({jsonrpc:"2.0",id:r.id??pa.take(),...r}),headers:{...u,"Content-Type":"application/json"},method:c||"POST",signal:d||(i>0?y:null)},m=new Request(e,f);return a&&await a(m),await fetch(e,f)},{errorInstance:new aa({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let b;if((l=p.headers.get("Content-Type"))!=null&&l.startsWith("application/json")?b=await p.json():(b=await p.text(),b=JSON.parse(b||"{}")),!p.ok)throw new We({body:r,details:H(b.error)||p.statusText,headers:p.headers,status:p.status,url:e});return b}catch(p){throw p instanceof We||p instanceof aa?p:new We({body:r,details:p.message,url:e})}}}}function Zn(e,t={}){const{batch:n,fetchOptions:r,key:a="http",name:s="HTTP JSON-RPC",onFetchRequest:i,onFetchResponse:o,retryDelay:u}=t;return({chain:c,retryCount:d,timeout:l})=>{const{batchSize:p=1e3,wait:b=0}=typeof n=="object"?n:{},y=t.retryCount??d,f=l??t.timeout??1e4,m=e||(c==null?void 0:c.rpcUrls.default.http[0]);if(!m)throw new $c;const h=kc(m,{fetchOptions:r,onRequest:i,onResponse:o,timeout:f});return Br({key:a,name:s,async request({method:g,params:w}){const x={method:g,params:w},{schedule:P}=Es({id:m,wait:b,shouldSplitBatch(B){return B.length>p},fn:B=>h.request({body:B}),sort:(B,M)=>B.id-M.id}),v=async B=>n?P(B):[await h.request({body:B})],[{error:A,result:E}]=await v(x);if(A)throw new ss({body:x,error:A,url:m});return E},retryCount:y,retryDelay:u,timeout:f,type:"http"},{fetchOptions:r,url:m})}}function Sr(e,t){var r,a,s,i,o,u;if(!(e instanceof T))return!1;const n=e.walk(c=>c instanceof kn);return n instanceof kn?!!(((r=n.data)==null?void 0:r.errorName)==="ResolverNotFound"||((a=n.data)==null?void 0:a.errorName)==="ResolverWildcardNotSupported"||((s=n.data)==null?void 0:s.errorName)==="ResolverNotContract"||((i=n.data)==null?void 0:i.errorName)==="ResolverError"||((o=n.data)==null?void 0:o.errorName)==="HttpError"||(u=n.reason)!=null&&u.includes("Wildcard on non-extended resolvers is not supported")||t==="reverse"&&n.reason===Ya[50]):!1}function Ss(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return se(t)?t:null}function _t(e){let t=new Uint8Array(32).fill(0);if(!e)return _(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const a=Ss(n[r]),s=a?Pe(a):W(fe(n[r]),"bytes");t=W(ue([t,s]),"bytes")}return _(t)}function Fc(e){return`[${e.slice(2)}]`}function Nc(e){const t=new Uint8Array(32).fill(0);return e?Ss(e)||W(fe(e)):_(t)}function fn(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(fe(t).byteLength+2);let r=0;const a=t.split(".");for(let s=0;s<a.length;s++){let i=fe(a[s]);i.byteLength>255&&(i=fe(Fc(Nc(a[s])))),n[r]=i.length,n.set(i,r+1),r+=i.length+1}return n.byteLength!==r+1?n.slice(0,r+1):n}async function jc(e,{blockNumber:t,blockTag:n,coinType:r,name:a,gatewayUrls:s,strict:i,universalResolverAddress:o}){let u=o;if(!u){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");u=it({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const c=$e({abi:la,functionName:"addr",...r!=null?{args:[_t(a),BigInt(r)]}:{args:[_t(a)]}}),d={address:u,abi:Ts,functionName:"resolve",args:[Me(fn(a)),c],blockNumber:t,blockTag:n},l=S(e,ce,"readContract"),p=s?await l({...d,args:[...d.args,s]}):await l(d);if(p[0]==="0x")return null;const b=st({abi:la,args:r!=null?[_t(a),BigInt(r)]:void 0,functionName:"addr",data:p[0]});return b==="0x"||tn(b)==="0x00"?null:b}catch(c){if(i)throw c;if(Sr(c,"resolve"))return null;throw c}}class Uc extends T{constructor({data:t}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidMetadataError"})}}class lt extends T{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class Mr extends T{constructor({uri:t}){super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUriResolutionError"})}}class Dc extends T{constructor({namespace:t}){super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarUnsupportedNamespaceError"})}}const Lc=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,zc=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,Hc=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,_c=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function qc(e){try{const t=await fetch(e,{method:"HEAD"});if(t.status===200){const n=t.headers.get("content-type");return n==null?void 0:n.startsWith("image/")}return!1}catch(t){return typeof t=="object"&&typeof t.response<"u"||!globalThis.hasOwnProperty("Image")?!1:new Promise(n=>{const r=new Image;r.onload=()=>{n(!0)},r.onerror=()=>{n(!1)},r.src=e})}}function fa(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function Ms({uri:e,gatewayUrls:t}){const n=Hc.test(e);if(n)return{uri:e,isOnChain:!0,isEncoded:n};const r=fa(t==null?void 0:t.ipfs,"https://ipfs.io"),a=fa(t==null?void 0:t.arweave,"https://arweave.net"),s=e.match(Lc),{protocol:i,subpath:o,target:u,subtarget:c=""}=(s==null?void 0:s.groups)||{},d=i==="ipns:/"||o==="ipns/",l=i==="ipfs:/"||o==="ipfs/"||zc.test(e);if(e.startsWith("http")&&!d&&!l){let b=e;return t!=null&&t.arweave&&(b=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:b,isOnChain:!1,isEncoded:!1}}if((d||l)&&u)return{uri:`${r}/${d?"ipns":"ipfs"}/${u}${c}`,isOnChain:!1,isEncoded:!1};if(i==="ar:/"&&u)return{uri:`${a}/${u}${c||""}`,isOnChain:!1,isEncoded:!1};let p=e.replace(_c,"");if(p.startsWith("<svg")&&(p=`data:image/svg+xml;base64,${btoa(p)}`),p.startsWith("data:")||p.startsWith("{"))return{uri:p,isOnChain:!0,isEncoded:!1};throw new Mr({uri:e})}function $s(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new Uc({data:e});return e.image||e.image_url||e.image_data}async function Gc({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(a=>a.json());return await $r({gatewayUrls:e,uri:$s(n)})}catch{throw new Mr({uri:t})}}async function $r({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Ms({uri:t,gatewayUrls:e});if(r||await qc(n))return n;throw new Mr({uri:t})}function Vc(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));const[n,r,a]=t.split("/"),[s,i]=n.split(":"),[o,u]=r.split(":");if(!s||s.toLowerCase()!=="eip155")throw new lt({reason:"Only EIP-155 supported"});if(!i)throw new lt({reason:"Chain ID not found"});if(!u)throw new lt({reason:"Contract address not found"});if(!a)throw new lt({reason:"Token ID not found"});if(!o)throw new lt({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:o.toLowerCase(),contractAddress:u,tokenID:a}}async function Wc(e,{nft:t}){if(t.namespace==="erc721")return ce(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if(t.namespace==="erc1155")return ce(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new Dc({namespace:t.namespace})}async function Zc(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Kc(e,{gatewayUrls:t,record:n}):$r({uri:n,gatewayUrls:t})}async function Kc(e,{gatewayUrls:t,record:n}){const r=Vc(n),a=await Wc(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:o}=Ms({uri:a,gatewayUrls:t});if(i&&(s.includes("data:application/json;base64,")||s.startsWith("{"))){const c=o?atob(s.replace("data:application/json;base64,","")):s,d=JSON.parse(c);return $r({uri:$s(d),gatewayUrls:t})}let u=r.tokenID;return r.namespace==="erc1155"&&(u=u.replace("0x","").padStart(64,"0")),Gc({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,u)})}async function Os(e,{blockNumber:t,blockTag:n,name:r,key:a,gatewayUrls:s,strict:i,universalResolverAddress:o}){let u=o;if(!u){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");u=it({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const c={address:u,abi:Ts,functionName:"resolve",args:[Me(fn(r)),$e({abi:ca,functionName:"text",args:[_t(r),a]})],blockNumber:t,blockTag:n},d=S(e,ce,"readContract"),l=s?await d({...c,args:[...c.args,s]}):await d(c);if(l[0]==="0x")return null;const p=st({abi:ca,functionName:"text",data:l[0]});return p===""?null:p}catch(c){if(i)throw c;if(Sr(c,"resolve"))return null;throw c}}async function Yc(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:a,gatewayUrls:s,strict:i,universalResolverAddress:o}){const u=await S(e,Os,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:a,universalResolverAddress:o,gatewayUrls:s,strict:i});if(!u)return null;try{return await Zc(e,{record:u,gatewayUrls:r})}catch{return null}}async function Jc(e,{address:t,blockNumber:n,blockTag:r,gatewayUrls:a,strict:s,universalResolverAddress:i}){let o=i;if(!o){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");o=it({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const u=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const c={address:o,abi:tc,functionName:"reverse",args:[Me(fn(u))],blockNumber:n,blockTag:r},d=S(e,ce,"readContract"),[l,p]=a?await d({...c,args:[...c.args,a]}):await d(c);return t.toLowerCase()!==p.toLowerCase()?null:l}catch(c){if(s)throw c;if(Sr(c,"reverse"))return null;throw c}}async function Xc(e,{blockNumber:t,blockTag:n,name:r,universalResolverAddress:a}){let s=a;if(!s){if(!e.chain)throw new Error("client chain not configured. universalResolverAddress is required.");s=it({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[i]=await S(e,ce,"readContract")({address:s,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Me(fn(r))],blockNumber:t,blockTag:n});return i}async function Qc(e){const t=an(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Rs(e,{address:t,args:n,event:r,events:a,fromBlock:s,strict:i,toBlock:o}={}){const u=a??(r?[r]:void 0),c=an(e,{method:"eth_newFilter"});let d=[];u&&(d=[u.flatMap(p=>$t({abi:[p],eventName:p.name,args:n}))],r&&(d=d[0]));const l=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?O(s):s,toBlock:typeof o=="bigint"?O(o):o,...d.length?{topics:d}:{}}]});return{abi:u,args:n,eventName:r?r.name:void 0,fromBlock:s,id:l,request:c(l),strict:!!i,toBlock:o,type:"event"}}async function ks(e){const t=an(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function el(e,{address:t,blockNumber:n,blockTag:r="latest"}){const a=n?O(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,a||r]});return BigInt(s)}async function tl(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function nl(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const a=n!==void 0?O(n):void 0;let s;return t?s=await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]}):s=await e.request({method:"eth_getBlockTransactionCountByNumber",params:[a||r]}),Ee(s)}async function rl(e,{address:t,blockNumber:n,blockTag:r="latest"}){const a=n!==void 0?O(n):void 0,s=await e.request({method:"eth_getCode",params:[t,a||r]});if(s!=="0x")return s}function al(e){var t;return{baseFeePerGas:e.baseFeePerGas.map(n=>BigInt(n)),gasUsedRatio:e.gasUsedRatio,oldestBlock:BigInt(e.oldestBlock),reward:(t=e.reward)==null?void 0:t.map(n=>n.map(r=>BigInt(r)))}}async function sl(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:a}){const s=n?O(n):void 0,i=await e.request({method:"eth_feeHistory",params:[O(t),s||r,a]});return al(i)}async function il(e,{filter:t}){const n=t.strict??!1,a=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Ce(s));return t.abi?Tr({abi:t.abi,logs:a,strict:n}):a}function Fs(e,t){if(!ie(e,{strict:!1}))throw new Ae({address:e});if(!ie(t,{strict:!1}))throw new Ae({address:t});return e.toLowerCase()===t.toLowerCase()}function Ns(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const ol=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,ul=/^(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 cl(e){const{domain:t={},message:n,primaryType:r}=e,a={EIP712Domain:Hs({domain:t}),...e.types};zs({domain:t,message:n,primaryType:r,types:a});const s=["0x1901"];return t&&s.push(ll({domain:t,types:a})),r!=="EIP712Domain"&&s.push(js({data:n,primaryType:r,types:a})),W(ue(s))}function ll({domain:e,types:t}){return js({data:e,primaryType:"EIP712Domain",types:t})}function js({data:e,primaryType:t,types:n}){const r=Us({data:e,primaryType:t,types:n});return W(r)}function Us({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],a=[dl({primaryType:t,types:n})];for(const s of n[t]){const[i,o]=Ls({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),a.push(o)}return rt(r,a)}function dl({primaryType:e,types:t}){const n=Me(pl({primaryType:e,types:t}));return W(n)}function pl({primaryType:e,types:t}){let n="";const r=Ds({primaryType:e,types:t});r.delete(e);const a=[e,...Array.from(r).sort()];for(const s of a)n+=`${s}(${t[s].map(({name:i,type:o})=>`${o} ${i}`).join(",")})`;return n}function Ds({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u),a=r==null?void 0:r[0];if(n.has(a)||t[a]===void 0)return n;n.add(a);for(const s of t[a])Ds({primaryType:s.type,types:t},n);return n}function Ls({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},W(Us({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},W(r)];if(n==="string")return[{type:"bytes32"},W(Me(r))];if(n.lastIndexOf("]")===n.length-1){const a=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>Ls({name:t,type:a,types:e,value:i}));return[{type:"bytes32"},W(rt(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function fl(e){const{domain:t,message:n,primaryType:r,types:a}=e,s=(u,c)=>{const d={...c};for(const l of u){const{name:p,type:b}=l;b==="address"&&(d[p]=d[p].toLowerCase())}return d},i=a.EIP712Domain?t?s(a.EIP712Domain,t):{}:{},o=(()=>{if(r!=="EIP712Domain")return s(a[r],n)})();return H({domain:i,message:o,primaryType:r,types:a})}function zs(e){const{domain:t,message:n,primaryType:r,types:a}=e,s=(i,o)=>{for(const u of i){const{name:c,type:d}=u,l=o[c],p=d.match(ul);if(p&&(typeof l=="number"||typeof l=="bigint")){const[f,m,h]=p;O(l,{signed:m==="int",size:Number.parseInt(h)/8})}if(d==="address"&&typeof l=="string"&&!ie(l))throw new Ae({address:l});const b=d.match(ol);if(b){const[f,m]=b;if(m&&D(l)!==Number.parseInt(m))throw new ro({expectedSize:Number.parseInt(m),givenSize:D(l)})}const y=a[d];y&&s(y,l)}};a.EIP712Domain&&t&&s(a.EIP712Domain,t),r!=="EIP712Domain"&&s(a[r],n)}function Hs({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},typeof(e==null?void 0:e.chainId)=="number"&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}const yl={"0x0":"reverted","0x1":"success"};function ml(e){const t={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(n=>Ce(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ee(e.transactionIndex):null,status:e.status?yl[e.status]:null,type:e.type?us[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const bl=`Ethereum Signed Message:
|
|
39
|
-
`;function _s(e,t){const n=typeof e=="string"?fe(e):e.raw instanceof Uint8Array?e.raw:Pe(e.raw),r=fe(`${bl}${n.length}`);return W(ue([r,n]),t)}function hl(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function gl(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Ee(e.nonce):void 0,storageProof:e.storageProof?hl(e.storageProof):void 0}}async function wl(e,{address:t,blockNumber:n,blockTag:r,storageKeys:a}){const s=r??"latest",i=n!==void 0?O(n):void 0,o=await e.request({method:"eth_getProof",params:[t,a,i||s]});return gl(o)}async function vl(e,{address:t,blockNumber:n,blockTag:r="latest",slot:a}){const s=n!==void 0?O(n):void 0;return await e.request({method:"eth_getStorageAt",params:[t,a,s||r]})}async function Or(e,{blockHash:t,blockNumber:n,blockTag:r,hash:a,index:s}){var d,l,p;const i=r||"latest",o=n!==void 0?O(n):void 0;let u=null;if(a?u=await e.request({method:"eth_getTransactionByHash",params:[a]}):t?u=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,O(s)]}):(o||i)&&(u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||i,O(s)]})),!u)throw new ns({blockHash:t,blockNumber:n,blockTag:i,hash:a,index:s});return(((p=(l=(d=e.chain)==null?void 0:d.formatters)==null?void 0:l.transaction)==null?void 0:p.format)||cs)(u)}async function Tl(e,{hash:t,transactionReceipt:n}){const[r,a]=await Promise.all([S(e,jt,"getBlockNumber")({}),t?S(e,Or,"getBlockNumber")({hash:t}):void 0]),s=(n==null?void 0:n.blockNumber)||(a==null?void 0:a.blockNumber);return s?r-s+1n:0n}async function Kn(e,{hash:t}){var a,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!n)throw new rs({hash:t});return(((i=(s=(a=e.chain)==null?void 0:a.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||ml)(n)}async function xl(e,t){var m;const{allowFailure:n=!0,batchSize:r,blockNumber:a,blockTag:s,multicallAddress:i,stateOverride:o}=t,u=t.contracts,c=r??(typeof((m=e.batch)==null?void 0:m.multicall)=="object"&&e.batch.multicall.batchSize||1024);let d=i;if(!d){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");d=it({blockNumber:a,chain:e.chain,contract:"multicall3"})}const l=[[]];let p=0,b=0;for(let h=0;h<u.length;h++){const{abi:g,address:w,args:x,functionName:P}=u[h];try{const v=$e({abi:g,args:x,functionName:P});b+=(v.length-2)/2,c>0&&b>c&&l[p].length>0&&(p++,b=(v.length-2)/2,l[p]=[]),l[p]=[...l[p],{allowFailure:!0,callData:v,target:w}]}catch(v){const A=Ct(v,{abi:g,address:w,args:x,docsPath:"/docs/contract/multicall",functionName:P});if(!n)throw A;l[p]=[...l[p],{allowFailure:!0,callData:"0x",target:w}]}}const y=await Promise.allSettled(l.map(h=>S(e,ce,"readContract")({abi:qn,address:d,args:[h],blockNumber:a,blockTag:s,functionName:"aggregate3",stateOverride:o}))),f=[];for(let h=0;h<y.length;h++){const g=y[h];if(g.status==="rejected"){if(!n)throw g.reason;for(let x=0;x<l[h].length;x++)f.push({status:"failure",error:g.reason,result:void 0});continue}const w=g.value;for(let x=0;x<w.length;x++){const{returnData:P,success:v}=w[x],{callData:A}=l[h][x],{abi:E,address:B,functionName:M,args:$}=u[f.length];try{if(A==="0x")throw new Qt;if(!v)throw new fr({data:P});const F=st({abi:E,args:$,data:P,functionName:M});f.push(n?{result:F,status:"success"}:F)}catch(F){const k=Ct(F,{abi:E,address:B,args:$,docsPath:"/docs/contract/multicall",functionName:M});if(!n)throw k;f.push({error:k,result:void 0,status:"failure"})}}}if(f.length!==u.length)throw new T("multicall results mismatch");return f}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qs=BigInt(0),yn=BigInt(1),El=BigInt(2),mn=e=>e instanceof Uint8Array,Pl=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Xe(e){if(!mn(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=Pl[e[n]];return t}function Gs(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function Rr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function Qe(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(t/2);for(let r=0;r<n.length;r++){const a=r*2,s=e.slice(a,a+2),i=Number.parseInt(s,16);if(Number.isNaN(i)||i<0)throw new Error("Invalid byte sequence");n[r]=i}return n}function je(e){return Rr(Xe(e))}function kr(e){if(!mn(e))throw new Error("Uint8Array expected");return Rr(Xe(Uint8Array.from(e).reverse()))}function et(e,t){return Qe(e.toString(16).padStart(t*2,"0"))}function Fr(e,t){return et(e,t).reverse()}function Al(e){return Qe(Gs(e))}function re(e,t,n){let r;if(typeof t=="string")try{r=Qe(t)}catch(s){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${s}`)}else if(mn(t))r=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const a=r.length;if(typeof n=="number"&&a!==n)throw new Error(`${e} expected ${n} bytes, got ${a}`);return r}function Bt(...e){const t=new Uint8Array(e.reduce((r,a)=>r+a.length,0));let n=0;return e.forEach(r=>{if(!mn(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}function Vs(e,t){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function Il(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Cl(e){let t;for(t=0;e>qs;e>>=yn,t+=1);return t}function Bl(e,t){return e>>BigInt(t)&yn}const Sl=(e,t,n)=>e|(n?yn:qs)<<BigInt(t),Nr=e=>(El<<BigInt(e-1))-yn,Cn=e=>new Uint8Array(e),ya=e=>Uint8Array.from(e);function Ws(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");let r=Cn(e),a=Cn(e),s=0;const i=()=>{r.fill(1),a.fill(0),s=0},o=(...l)=>n(a,r,...l),u=(l=Cn())=>{a=o(ya([0]),l),r=o(),l.length!==0&&(a=o(ya([1]),l),r=o())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let l=0;const p=[];for(;l<t;){r=o();const b=r.slice();p.push(b),l+=r.length}return Bt(...p)};return(l,p)=>{i(),u(l);let b;for(;!(b=p(c()));)u();return i(),b}}const Ml={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Ut(e,t,n={}){const r=(a,s,i)=>{const o=Ml[s];if(typeof o!="function")throw new Error(`Invalid validator "${s}", expected function`);const u=e[a];if(!(i&&u===void 0)&&!o(u,e))throw new Error(`Invalid param ${String(a)}=${u} (${typeof u}), expected ${s}`)};for(const[a,s]of Object.entries(t))r(a,s,!1);for(const[a,s]of Object.entries(n))r(a,s,!0);return e}const $l=Object.freeze(Object.defineProperty({__proto__:null,bitGet:Bl,bitLen:Cl,bitMask:Nr,bitSet:Sl,bytesToHex:Xe,bytesToNumberBE:je,bytesToNumberLE:kr,concatBytes:Bt,createHmacDrbg:Ws,ensureBytes:re,equalBytes:Vs,hexToBytes:Qe,hexToNumber:Rr,numberToBytesBE:et,numberToBytesLE:Fr,numberToHexUnpadded:Gs,numberToVarBytesBE:Al,utf8ToBytes:Il,validateObject:Ut},Symbol.toStringTag,{value:"Module"}));function Ol(e,t){const n=se(e)?Pe(e):e,r=se(t)?Pe(t):t;return Vs(n,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z=BigInt(0),U=BigInt(1),ke=BigInt(2),Rl=BigInt(3),Yn=BigInt(4),ma=BigInt(5),ba=BigInt(8);BigInt(9);BigInt(16);function V(e,t){const n=e%t;return n>=z?n:t+n}function kl(e,t,n){if(n<=z||t<z)throw new Error("Expected power/modulo > 0");if(n===U)return z;let r=U;for(;t>z;)t&U&&(r=r*e%n),e=e*e%n,t>>=U;return r}function X(e,t,n){let r=e;for(;t-- >z;)r*=r,r%=n;return r}function Jn(e,t){if(e===z||t<=z)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=V(e,t),r=t,a=z,s=U;for(;n!==z;){const o=r/n,u=r%n,c=a-s*o;r=n,n=u,a=s,s=c}if(r!==U)throw new Error("invert: does not exist");return V(a,t)}function Fl(e){const t=(e-U)/ke;let n,r,a;for(n=e-U,r=0;n%ke===z;n/=ke,r++);for(a=ke;a<e&&kl(a,t,e)!==e-U;a++);if(r===1){const i=(e+U)/Yn;return function(u,c){const d=u.pow(c,i);if(!u.eql(u.sqr(d),c))throw new Error("Cannot find square root");return d}}const s=(n+U)/ke;return function(o,u){if(o.pow(u,t)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,d=o.pow(o.mul(o.ONE,a),n),l=o.pow(u,s),p=o.pow(u,n);for(;!o.eql(p,o.ONE);){if(o.eql(p,o.ZERO))return o.ZERO;let b=1;for(let f=o.sqr(p);b<c&&!o.eql(f,o.ONE);b++)f=o.sqr(f);const y=o.pow(d,U<<BigInt(c-b-1));d=o.sqr(y),l=o.mul(l,y),p=o.mul(p,d),c=b}return l}}function Nl(e){if(e%Yn===Rl){const t=(e+U)/Yn;return function(r,a){const s=r.pow(a,t);if(!r.eql(r.sqr(s),a))throw new Error("Cannot find square root");return s}}if(e%ba===ma){const t=(e-ma)/ba;return function(r,a){const s=r.mul(a,ke),i=r.pow(s,t),o=r.mul(a,i),u=r.mul(r.mul(o,ke),i),c=r.mul(o,r.sub(u,r.ONE));if(!r.eql(r.sqr(c),a))throw new Error("Cannot find square root");return c}}return Fl(e)}const jl=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ul(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=jl.reduce((r,a)=>(r[a]="function",r),t);return Ut(e,n)}function Dl(e,t,n){if(n<z)throw new Error("Expected power > 0");if(n===z)return e.ONE;if(n===U)return t;let r=e.ONE,a=t;for(;n>z;)n&U&&(r=e.mul(r,a)),a=e.sqr(a),n>>=U;return r}function Ll(e,t){const n=new Array(t.length),r=t.reduce((s,i,o)=>e.is0(i)?s:(n[o]=s,e.mul(s,i)),e.ONE),a=e.inv(r);return t.reduceRight((s,i,o)=>e.is0(i)?s:(n[o]=e.mul(s,n[o]),e.mul(s,i)),a),n}function Zs(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function zl(e,t,n=!1,r={}){if(e<=z)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:a,nByteLength:s}=Zs(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=Nl(e),o=Object.freeze({ORDER:e,BITS:a,BYTES:s,MASK:Nr(a),ZERO:z,ONE:U,create:u=>V(u,e),isValid:u=>{if(typeof u!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof u}`);return z<=u&&u<e},is0:u=>u===z,isOdd:u=>(u&U)===U,neg:u=>V(-u,e),eql:(u,c)=>u===c,sqr:u=>V(u*u,e),add:(u,c)=>V(u+c,e),sub:(u,c)=>V(u-c,e),mul:(u,c)=>V(u*c,e),pow:(u,c)=>Dl(o,u,c),div:(u,c)=>V(u*Jn(c,e),e),sqrN:u=>u*u,addN:(u,c)=>u+c,subN:(u,c)=>u-c,mulN:(u,c)=>u*c,inv:u=>Jn(u,e),sqrt:r.sqrt||(u=>i(o,u)),invertBatch:u=>Ll(o,u),cmov:(u,c,d)=>d?c:u,toBytes:u=>n?Fr(u,s):et(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return n?kr(u):je(u)}});return Object.freeze(o)}function Ks(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function Ys(e){const t=Ks(e);return t+Math.ceil(t/2)}function Hl(e,t,n=!1){const r=e.length,a=Ks(t),s=Ys(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const i=n?je(e):kr(e),o=V(i,t-U)+U;return n?Fr(o,a):et(o,a)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _l=BigInt(0),Bn=BigInt(1);function ql(e,t){const n=(a,s)=>{const i=s.negate();return a?i:s},r=a=>{const s=Math.ceil(t/a)+1,i=2**(a-1);return{windows:s,windowSize:i}};return{constTimeNegate:n,unsafeLadder(a,s){let i=e.ZERO,o=a;for(;s>_l;)s&Bn&&(i=i.add(o)),o=o.double(),s>>=Bn;return i},precomputeWindow(a,s){const{windows:i,windowSize:o}=r(s),u=[];let c=a,d=c;for(let l=0;l<i;l++){d=c,u.push(d);for(let p=1;p<o;p++)d=d.add(c),u.push(d);c=d.double()}return u},wNAF(a,s,i){const{windows:o,windowSize:u}=r(a);let c=e.ZERO,d=e.BASE;const l=BigInt(2**a-1),p=2**a,b=BigInt(a);for(let y=0;y<o;y++){const f=y*u;let m=Number(i&l);i>>=b,m>u&&(m-=p,i+=Bn);const h=f,g=f+Math.abs(m)-1,w=y%2!==0,x=m<0;m===0?d=d.add(n(w,s[h])):c=c.add(n(x,s[g]))}return{p:c,f:d}},wNAFCached(a,s,i,o){const u=a._WINDOW_SIZE||1;let c=s.get(a);return c||(c=this.precomputeWindow(a,u),u!==1&&s.set(a,o(c))),this.wNAF(u,c,i)}}}function Js(e){return Ul(e.Fp),Ut(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Zs(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Gl(e){const t=Js(e);Ut(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a}=t;if(n){if(!r.eql(a,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Vl,hexToBytes:Wl}=$l,Fe={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=Fe;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Vl(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=Fe,n=typeof e=="string"?Wl(e):e;if(!(n instanceof Uint8Array))throw new Error("ui8a expected");let r=n.length;if(r<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:a,l:s}=Fe._parseInt(n.subarray(2)),{d:i,l:o}=Fe._parseInt(s);if(o.length)throw new t("Invalid signature: left bytes after parsing");return{r:a,s:i}},hexFromSig(e){const t=c=>Number.parseInt(c[0],16)&8?"00"+c:c,n=c=>{const d=c.toString(16);return d.length&1?`0${d}`:d},r=t(n(e.s)),a=t(n(e.r)),s=r.length/2,i=a.length/2,o=n(s),u=n(i);return`30${n(i+s+4)}02${u}${a}02${o}${r}`}},pe=BigInt(0),Q=BigInt(1);BigInt(2);const ha=BigInt(3);BigInt(4);function Zl(e){const t=Gl(e),{Fp:n}=t,r=t.toBytes||((y,f,m)=>{const h=f.toAffine();return Bt(Uint8Array.from([4]),n.toBytes(h.x),n.toBytes(h.y))}),a=t.fromBytes||(y=>{const f=y.subarray(1),m=n.fromBytes(f.subarray(0,n.BYTES)),h=n.fromBytes(f.subarray(n.BYTES,2*n.BYTES));return{x:m,y:h}});function s(y){const{a:f,b:m}=t,h=n.sqr(y),g=n.mul(h,y);return n.add(n.add(g,n.mul(y,f)),m)}if(!n.eql(n.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(y){return typeof y=="bigint"&&pe<y&&y<t.n}function o(y){if(!i(y))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(y){const{allowedPrivateKeyLengths:f,nByteLength:m,wrapPrivateKey:h,n:g}=t;if(f&&typeof y!="bigint"){if(y instanceof Uint8Array&&(y=Xe(y)),typeof y!="string"||!f.includes(y.length))throw new Error("Invalid key");y=y.padStart(m*2,"0")}let w;try{w=typeof y=="bigint"?y:je(re("private key",y,m))}catch{throw new Error(`private key must be ${m} bytes, hex or bigint, not ${typeof y}`)}return h&&(w=V(w,g)),o(w),w}const c=new Map;function d(y){if(!(y instanceof l))throw new Error("ProjectivePoint expected")}class l{constructor(f,m,h){if(this.px=f,this.py=m,this.pz=h,f==null||!n.isValid(f))throw new Error("x required");if(m==null||!n.isValid(m))throw new Error("y required");if(h==null||!n.isValid(h))throw new Error("z required")}static fromAffine(f){const{x:m,y:h}=f||{};if(!f||!n.isValid(m)||!n.isValid(h))throw new Error("invalid affine point");if(f instanceof l)throw new Error("projective point not allowed");const g=w=>n.eql(w,n.ZERO);return g(m)&&g(h)?l.ZERO:new l(m,h,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(f){const m=n.invertBatch(f.map(h=>h.pz));return f.map((h,g)=>h.toAffine(m[g])).map(l.fromAffine)}static fromHex(f){const m=l.fromAffine(a(re("pointHex",f)));return m.assertValidity(),m}static fromPrivateKey(f){return l.BASE.multiply(u(f))}_setWindowSize(f){this._WINDOW_SIZE=f,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:f,y:m}=this.toAffine();if(!n.isValid(f)||!n.isValid(m))throw new Error("bad point: x or y not FE");const h=n.sqr(m),g=s(f);if(!n.eql(h,g))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:f}=this.toAffine();if(n.isOdd)return!n.isOdd(f);throw new Error("Field doesn't support isOdd")}equals(f){d(f);const{px:m,py:h,pz:g}=this,{px:w,py:x,pz:P}=f,v=n.eql(n.mul(m,P),n.mul(w,g)),A=n.eql(n.mul(h,P),n.mul(x,g));return v&&A}negate(){return new l(this.px,n.neg(this.py),this.pz)}double(){const{a:f,b:m}=t,h=n.mul(m,ha),{px:g,py:w,pz:x}=this;let P=n.ZERO,v=n.ZERO,A=n.ZERO,E=n.mul(g,g),B=n.mul(w,w),M=n.mul(x,x),$=n.mul(g,w);return $=n.add($,$),A=n.mul(g,x),A=n.add(A,A),P=n.mul(f,A),v=n.mul(h,M),v=n.add(P,v),P=n.sub(B,v),v=n.add(B,v),v=n.mul(P,v),P=n.mul($,P),A=n.mul(h,A),M=n.mul(f,M),$=n.sub(E,M),$=n.mul(f,$),$=n.add($,A),A=n.add(E,E),E=n.add(A,E),E=n.add(E,M),E=n.mul(E,$),v=n.add(v,E),M=n.mul(w,x),M=n.add(M,M),E=n.mul(M,$),P=n.sub(P,E),A=n.mul(M,B),A=n.add(A,A),A=n.add(A,A),new l(P,v,A)}add(f){d(f);const{px:m,py:h,pz:g}=this,{px:w,py:x,pz:P}=f;let v=n.ZERO,A=n.ZERO,E=n.ZERO;const B=t.a,M=n.mul(t.b,ha);let $=n.mul(m,w),F=n.mul(h,x),k=n.mul(g,P),q=n.add(m,h),I=n.add(w,x);q=n.mul(q,I),I=n.add($,F),q=n.sub(q,I),I=n.add(m,g);let C=n.add(w,P);return I=n.mul(I,C),C=n.add($,k),I=n.sub(I,C),C=n.add(h,g),v=n.add(x,P),C=n.mul(C,v),v=n.add(F,k),C=n.sub(C,v),E=n.mul(B,I),v=n.mul(M,k),E=n.add(v,E),v=n.sub(F,E),E=n.add(F,E),A=n.mul(v,E),F=n.add($,$),F=n.add(F,$),k=n.mul(B,k),I=n.mul(M,I),F=n.add(F,k),k=n.sub($,k),k=n.mul(B,k),I=n.add(I,k),$=n.mul(F,I),A=n.add(A,$),$=n.mul(C,I),v=n.mul(q,v),v=n.sub(v,$),$=n.mul(q,F),E=n.mul(C,E),E=n.add(E,$),new l(v,A,E)}subtract(f){return this.add(f.negate())}is0(){return this.equals(l.ZERO)}wNAF(f){return b.wNAFCached(this,c,f,m=>{const h=n.invertBatch(m.map(g=>g.pz));return m.map((g,w)=>g.toAffine(h[w])).map(l.fromAffine)})}multiplyUnsafe(f){const m=l.ZERO;if(f===pe)return m;if(o(f),f===Q)return this;const{endo:h}=t;if(!h)return b.unsafeLadder(this,f);let{k1neg:g,k1:w,k2neg:x,k2:P}=h.splitScalar(f),v=m,A=m,E=this;for(;w>pe||P>pe;)w&Q&&(v=v.add(E)),P&Q&&(A=A.add(E)),E=E.double(),w>>=Q,P>>=Q;return g&&(v=v.negate()),x&&(A=A.negate()),A=new l(n.mul(A.px,h.beta),A.py,A.pz),v.add(A)}multiply(f){o(f);let m=f,h,g;const{endo:w}=t;if(w){const{k1neg:x,k1:P,k2neg:v,k2:A}=w.splitScalar(m);let{p:E,f:B}=this.wNAF(P),{p:M,f:$}=this.wNAF(A);E=b.constTimeNegate(x,E),M=b.constTimeNegate(v,M),M=new l(n.mul(M.px,w.beta),M.py,M.pz),h=E.add(M),g=B.add($)}else{const{p:x,f:P}=this.wNAF(m);h=x,g=P}return l.normalizeZ([h,g])[0]}multiplyAndAddUnsafe(f,m,h){const g=l.BASE,w=(P,v)=>v===pe||v===Q||!P.equals(g)?P.multiplyUnsafe(v):P.multiply(v),x=w(this,m).add(w(f,h));return x.is0()?void 0:x}toAffine(f){const{px:m,py:h,pz:g}=this,w=this.is0();f==null&&(f=w?n.ONE:n.inv(g));const x=n.mul(m,f),P=n.mul(h,f),v=n.mul(g,f);if(w)return{x:n.ZERO,y:n.ZERO};if(!n.eql(v,n.ONE))throw new Error("invZ was invalid");return{x,y:P}}isTorsionFree(){const{h:f,isTorsionFree:m}=t;if(f===Q)return!0;if(m)return m(l,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:f,clearCofactor:m}=t;return f===Q?this:m?m(l,this):this.multiplyUnsafe(t.h)}toRawBytes(f=!0){return this.assertValidity(),r(l,this,f)}toHex(f=!0){return Xe(this.toRawBytes(f))}}l.BASE=new l(t.Gx,t.Gy,n.ONE),l.ZERO=new l(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,b=ql(l,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Kl(e){const t=Js(e);return Ut(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Yl(e){const t=Kl(e),{Fp:n,n:r}=t,a=n.BYTES+1,s=2*n.BYTES+1;function i(I){return pe<I&&I<n.ORDER}function o(I){return V(I,r)}function u(I){return Jn(I,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:d,weierstrassEquation:l,isWithinCurveOrder:p}=Zl({...t,toBytes(I,C,R){const j=C.toAffine(),N=n.toBytes(j.x),L=Bt;return R?L(Uint8Array.from([C.hasEvenY()?2:3]),N):L(Uint8Array.from([4]),N,n.toBytes(j.y))},fromBytes(I){const C=I.length,R=I[0],j=I.subarray(1);if(C===a&&(R===2||R===3)){const N=je(j);if(!i(N))throw new Error("Point is not on curve");const L=l(N);let Y=n.sqrt(L);const J=(Y&Q)===Q;return(R&1)===1!==J&&(Y=n.neg(Y)),{x:N,y:Y}}else if(C===s&&R===4){const N=n.fromBytes(j.subarray(0,n.BYTES)),L=n.fromBytes(j.subarray(n.BYTES,2*n.BYTES));return{x:N,y:L}}else throw new Error(`Point of length ${C} was invalid. Expected ${a} compressed bytes or ${s} uncompressed bytes`)}}),b=I=>Xe(et(I,t.nByteLength));function y(I){const C=r>>Q;return I>C}function f(I){return y(I)?o(-I):I}const m=(I,C,R)=>je(I.slice(C,R));class h{constructor(C,R,j){this.r=C,this.s=R,this.recovery=j,this.assertValidity()}static fromCompact(C){const R=t.nByteLength;return C=re("compactSignature",C,R*2),new h(m(C,0,R),m(C,R,2*R))}static fromDER(C){const{r:R,s:j}=Fe.toSig(re("DER",C));return new h(R,j)}assertValidity(){if(!p(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!p(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(C){return new h(this.r,this.s,C)}recoverPublicKey(C){const{r:R,s:j,recovery:N}=this,L=A(re("msgHash",C));if(N==null||![0,1,2,3].includes(N))throw new Error("recovery id invalid");const Y=N===2||N===3?R+t.n:R;if(Y>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const J=N&1?"03":"02",be=c.fromHex(J+b(Y)),he=u(Y),ze=o(-L*he),ot=o(j*he),ge=c.BASE.multiplyAndAddUnsafe(be,ze,ot);if(!ge)throw new Error("point at infinify");return ge.assertValidity(),ge}hasHighS(){return y(this.s)}normalizeS(){return this.hasHighS()?new h(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Qe(this.toDERHex())}toDERHex(){return Fe.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Qe(this.toCompactHex())}toCompactHex(){return b(this.r)+b(this.s)}}const g={isValidPrivateKey(I){try{return d(I),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{const I=Ys(t.n);return Hl(t.randomBytes(I),t.n)},precompute(I=8,C=c.BASE){return C._setWindowSize(I),C.multiply(BigInt(3)),C}};function w(I,C=!0){return c.fromPrivateKey(I).toRawBytes(C)}function x(I){const C=I instanceof Uint8Array,R=typeof I=="string",j=(C||R)&&I.length;return C?j===a||j===s:R?j===2*a||j===2*s:I instanceof c}function P(I,C,R=!0){if(x(I))throw new Error("first arg must be private key");if(!x(C))throw new Error("second arg must be public key");return c.fromHex(C).multiply(d(I)).toRawBytes(R)}const v=t.bits2int||function(I){const C=je(I),R=I.length*8-t.nBitLength;return R>0?C>>BigInt(R):C},A=t.bits2int_modN||function(I){return o(v(I))},E=Nr(t.nBitLength);function B(I){if(typeof I!="bigint")throw new Error("bigint expected");if(!(pe<=I&&I<E))throw new Error(`bigint expected < 2^${t.nBitLength}`);return et(I,t.nByteLength)}function M(I,C,R=$){if(["recovered","canonical"].some(Oe=>Oe in R))throw new Error("sign() legacy options not supported");const{hash:j,randomBytes:N}=t;let{lowS:L,prehash:Y,extraEntropy:J}=R;L==null&&(L=!0),I=re("msgHash",I),Y&&(I=re("prehashed msgHash",j(I)));const be=A(I),he=d(C),ze=[B(he),B(be)];if(J!=null){const Oe=J===!0?N(n.BYTES):J;ze.push(re("extraEntropy",Oe))}const ot=Bt(...ze),ge=be;function bn(Oe){const He=v(Oe);if(!p(He))return;const Lr=u(He),_e=c.BASE.multiply(He).toAffine(),ne=o(_e.x);if(ne===pe)return;const qe=o(Lr*o(ge+ne*he));if(qe===pe)return;let zr=(_e.x===ne?0:2)|Number(_e.y&Q),Hr=qe;return L&&y(qe)&&(Hr=f(qe),zr^=1),new h(ne,Hr,zr)}return{seed:ot,k2sig:bn}}const $={lowS:t.lowS,prehash:!1},F={lowS:t.lowS,prehash:!1};function k(I,C,R=$){const{seed:j,k2sig:N}=M(I,C,R),L=t;return Ws(L.hash.outputLen,L.nByteLength,L.hmac)(j,N)}c.BASE._setWindowSize(8);function q(I,C,R,j=F){var _e;const N=I;if(C=re("msgHash",C),R=re("publicKey",R),"strict"in j)throw new Error("options.strict was renamed to lowS");const{lowS:L,prehash:Y}=j;let J,be;try{if(typeof N=="string"||N instanceof Uint8Array)try{J=h.fromDER(N)}catch(ne){if(!(ne instanceof Fe.Err))throw ne;J=h.fromCompact(N)}else if(typeof N=="object"&&typeof N.r=="bigint"&&typeof N.s=="bigint"){const{r:ne,s:qe}=N;J=new h(ne,qe)}else throw new Error("PARSE");be=c.fromHex(R)}catch(ne){if(ne.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(L&&J.hasHighS())return!1;Y&&(C=t.hash(C));const{r:he,s:ze}=J,ot=A(C),ge=u(ze),bn=o(ot*ge),Oe=o(he*ge),He=(_e=c.BASE.multiplyAndAddUnsafe(be,bn,Oe))==null?void 0:_e.toAffine();return He?o(He.x)===he:!1}return{CURVE:t,getPublicKey:w,getSharedSecret:P,sign:k,verify:q,ProjectivePoint:c,Signature:h,utils:g}}class Xs extends rr{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,wo(t);const r=nn(n);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const a=this.blockLen,s=new Uint8Array(a);s.set(r.length>a?t.create().update(r).digest():r);for(let i=0;i<s.length;i++)s[i]^=54;this.iHash.update(s),this.oHash=t.create();for(let i=0;i<s.length;i++)s[i]^=106;this.oHash.update(s),s.fill(0)}update(t){return Ke(this),this.iHash.update(t),this}digestInto(t){Ke(this),nr(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:a,destroyed:s,blockLen:i,outputLen:o}=this;return t=t,t.finished=a,t.destroyed=s,t.blockLen=i,t.outputLen=o,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Qs=(e,t,n)=>new Xs(e,t).update(n).digest();Qs.create=(e,t)=>new Xs(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Jl(e){return{hash:e,hmac:(t,...n)=>Qs(e,t,So(...n)),randomBytes:Mo}}function Xl(e,t){const n=r=>Yl({...e,...Jl(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ei=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ga=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Ql=BigInt(1),Xn=BigInt(2),wa=(e,t)=>(e+t/Xn)/t;function ed(e){const t=ei,n=BigInt(3),r=BigInt(6),a=BigInt(11),s=BigInt(22),i=BigInt(23),o=BigInt(44),u=BigInt(88),c=e*e*e%t,d=c*c*e%t,l=X(d,n,t)*d%t,p=X(l,n,t)*d%t,b=X(p,Xn,t)*c%t,y=X(b,a,t)*b%t,f=X(y,s,t)*y%t,m=X(f,o,t)*f%t,h=X(m,u,t)*m%t,g=X(h,o,t)*f%t,w=X(g,n,t)*d%t,x=X(w,i,t)*y%t,P=X(x,r,t)*c%t,v=X(P,Xn,t);if(!Qn.eql(Qn.sqr(v),e))throw new Error("Cannot find square root");return v}const Qn=zl(ei,void 0,void 0,{sqrt:ed}),jr=Xl({a:BigInt(0),b:BigInt(7),Fp:Qn,n:ga,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=ga,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Ql*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),o=wa(s*e,t),u=wa(-r*e,t);let c=V(e-o*n-u*a,t),d=V(-o*r-u*s,t);const l=c>i,p=d>i;if(l&&(c=t-c),p&&(d=t-d),c>i||d>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:l,k1:c,k2neg:p,k2:d}}}},ms);BigInt(0);jr.ProjectivePoint;function td({r:e,s:t,v:n,yParity:r}){const a=(()=>{if(r===0||r===1)return r;if(n&&(n===27n||n===28n||n>=35n))return n%2n===0n?1:0;throw new Error("Invalid `v` or `yParity` value")})();return`0x${new jr.Signature(Ze(e),Ze(t)).toCompactHex()}${a===0?"1b":"1c"}`}async function Ur(e,{address:t,hash:n,signature:r,...a}){const s=se(r)?r:typeof r=="object"&&"r"in r&&"s"in r?td(r):_(r);try{const{data:i}=await S(e,Ft,"call")({data:Pr({abi:nc,args:[t,n,s],bytecode:sc}),...a});return Ol(i??"0x0","0x1")}catch(i){if(i instanceof as)return!1;throw i}}async function nd(e,{address:t,message:n,signature:r,...a}){const s=_s(n);return Ur(e,{address:t,hash:s,signature:r,...a})}async function rd(e,t){const{address:n,signature:r,message:a,primaryType:s,types:i,domain:o,...u}=t,c=cl({message:a,primaryType:s,types:i,domain:o});return Ur(e,{address:n,hash:c,signature:r,...u})}function ti(e,{emitOnBegin:t=!1,emitMissed:n=!1,onBlockNumber:r,onError:a,poll:s,pollingInterval:i=e.pollingInterval}){const o=typeof s<"u"?s:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket");let u;return o?(()=>{const l=H(["watchBlockNumber",e.uid,t,n,i]);return Be(l,{onBlockNumber:r,onError:a},p=>Nt(async()=>{var b;try{const y=await S(e,jt,"getBlockNumber")({cacheTime:0});if(u){if(y===u)return;if(y-u>1&&n)for(let f=u+1n;f<y;f++)p.onBlockNumber(f,u),u=f}(!u||y>u)&&(p.onBlockNumber(y,u),u=y)}catch(y){(b=p.onError)==null||b.call(p,y)}},{emitOnBegin:t,interval:i}))})():(()=>{const l=H(["watchBlockNumber",e.uid,t,n]);return Be(l,{onBlockNumber:r,onError:a},p=>{let b=!0,y=()=>b=!1;return(async()=>{try{const f=(()=>{if(e.transport.type==="fallback"){const h=e.transport.transports.find(g=>g.config.type==="webSocket");return h?h.value:e.transport}return e.transport})(),{unsubscribe:m}=await f.subscribe({params:["newHeads"],onData(h){var w;if(!b)return;const g=Ze((w=h.result)==null?void 0:w.number);p.onBlockNumber(g,u),u=g},onError(h){var g;(g=p.onError)==null||g.call(p,h)}});y=m,b||y()}catch(f){a==null||a(f)}})(),()=>y()})})()}async function ad(e,{confirmations:t=1,hash:n,onReplaced:r,pollingInterval:a=e.pollingInterval,retryCount:s=6,retryDelay:i=({count:u})=>~~(1<<u)*200,timeout:o}){const u=H(["waitForTransactionReceipt",e.uid,n]);let c=0,d,l,p,b=!1;return new Promise((y,f)=>{o&&setTimeout(()=>f(new ra({hash:n})),o);const m=Be(u,{onReplaced:r,resolve:y,reject:f},h=>{const g=S(e,ti,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:a,async onBlockNumber(w){const x=v=>{g(),v(),m()};let P=w;if(!b){c>s&&x(()=>h.reject(new ra({hash:n})));try{if(p){if(t>1&&(!p.blockNumber||P-p.blockNumber+1n<t))return;x(()=>h.resolve(p));return}if(d||(b=!0,await Wn(async()=>{d=await S(e,Or,"getTransaction")({hash:n}),d.blockNumber&&(P=d.blockNumber)},{delay:i,retryCount:s}),b=!1),p=await S(e,Kn,"getTransactionReceipt")({hash:n}),t>1&&(!p.blockNumber||P-p.blockNumber+1n<t))return;x(()=>h.resolve(p))}catch(v){if(v instanceof ns||v instanceof rs){if(!d){b=!1;return}try{l=d,b=!0;const A=await Wn(()=>S(e,Ie,"getBlock")({blockNumber:P,includeTransactions:!0}),{delay:i,retryCount:s,shouldRetry:({error:M})=>M instanceof os});b=!1;const E=A.transactions.find(({from:M,nonce:$})=>M===l.from&&$===l.nonce);if(!E||(p=await S(e,Kn,"getTransactionReceipt")({hash:E.hash}),t>1&&(!p.blockNumber||P-p.blockNumber+1n<t)))return;let B="replaced";E.to===l.to&&E.value===l.value?B="repriced":E.from===E.to&&E.value===0n&&(B="cancelled"),x(()=>{var M;(M=h.onReplaced)==null||M.call(h,{reason:B,replacedTransaction:l,transaction:E,transactionReceipt:p}),h.resolve(p)})}catch(A){x(()=>h.reject(A))}}else x(()=>h.reject(v))}finally{c++}}}})})})}function sd(e,{blockTag:t="latest",emitMissed:n=!1,emitOnBegin:r=!1,onBlock:a,onError:s,includeTransactions:i,poll:o,pollingInterval:u=e.pollingInterval}){const c=typeof o<"u"?o:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket"),d=i??!1;let l;return c?(()=>{const y=H(["watchBlocks",e.uid,t,n,r,d,u]);return Be(y,{onBlock:a,onError:s},f=>Nt(async()=>{var m;try{const h=await S(e,Ie,"getBlock")({blockTag:t,includeTransactions:d});if(h.number&&(l!=null&&l.number)){if(h.number===l.number)return;if(h.number-l.number>1&&n)for(let g=(l==null?void 0:l.number)+1n;g<h.number;g++){const w=await S(e,Ie,"getBlock")({blockNumber:g,includeTransactions:d});f.onBlock(w,l),l=w}}(!(l!=null&&l.number)||t==="pending"&&!(h!=null&&h.number)||h.number&&h.number>l.number)&&(f.onBlock(h,l),l=h)}catch(h){(m=f.onError)==null||m.call(f,h)}},{emitOnBegin:r,interval:u}))})():(()=>{let y=!0,f=()=>y=!1;return(async()=>{try{const m=(()=>{if(e.transport.type==="fallback"){const g=e.transport.transports.find(w=>w.config.type==="webSocket");return g?g.value:e.transport}return e.transport})(),{unsubscribe:h}=await m.subscribe({params:["newHeads"],onData(g){var P,v,A;if(!y)return;const x=(((A=(v=(P=e.chain)==null?void 0:P.formatters)==null?void 0:v.block)==null?void 0:A.format)||ls)(g.result);a(x,l),l=x},onError(g){s==null||s(g)}});f=h,y||f()}catch(m){s==null||s(m)}})(),()=>f()})()}function id(e,{address:t,args:n,batch:r=!0,event:a,events:s,fromBlock:i,onError:o,onLogs:u,poll:c,pollingInterval:d=e.pollingInterval,strict:l}){const p=typeof c<"u"?c:typeof i=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket"),b=l??!1;return p?(()=>{const m=H(["watchEvent",t,n,r,e.uid,a,d,i]);return Be(m,{onLogs:u,onError:o},h=>{let g;i!==void 0&&(g=i-1n);let w,x=!1;const P=Nt(async()=>{var v;if(!x){try{w=await S(e,Rs,"createEventFilter")({address:t,args:n,event:a,events:s,strict:b,fromBlock:i})}catch{}x=!0;return}try{let A;if(w)A=await S(e,ln,"getFilterChanges")({filter:w});else{const E=await S(e,jt,"getBlockNumber")({});g&&g!==E?A=await S(e,xr,"getLogs")({address:t,args:n,event:a,events:s,fromBlock:g+1n,toBlock:E}):A=[],g=E}if(A.length===0)return;if(r)h.onLogs(A);else for(const E of A)h.onLogs([E])}catch(A){w&&A instanceof Le&&(x=!1),(v=h.onError)==null||v.call(h,A)}},{emitOnBegin:!0,interval:d});return async()=>{w&&await S(e,dn,"uninstallFilter")({filter:w}),P()}})})():(()=>{let m=!0,h=()=>m=!1;return(async()=>{try{const g=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(A=>A.config.type==="webSocket");return v?v.value:e.transport}return e.transport})(),w=s??(a?[a]:void 0);let x=[];w&&(x=[w.flatMap(v=>$t({abi:[v],eventName:v.name,args:n}))],a&&(x=x[0]));const{unsubscribe:P}=await g.subscribe({params:["logs",{address:t,topics:x}],onData(v){var E;if(!m)return;const A=v.result;try{const{eventName:B,args:M}=vr({abi:w??[],data:A.data,topics:A.topics,strict:b}),$=Ce(A,{args:M,eventName:B});u([$])}catch(B){let M,$;if(B instanceof pt||B instanceof en){if(l)return;M=B.abiItem.name,$=(E=B.abiItem.inputs)==null?void 0:E.some(k=>!("name"in k&&k.name))}const F=Ce(A,{args:$?[]:{},eventName:M});u([F])}},onError(v){o==null||o(v)}});h=P,m||h()}catch(g){o==null||o(g)}})(),()=>h()})()}function od(e,{batch:t=!0,onError:n,onTransactions:r,poll:a,pollingInterval:s=e.pollingInterval}){return(typeof a<"u"?a:e.transport.type!=="webSocket")?(()=>{const c=H(["watchPendingTransactions",e.uid,t,s]);return Be(c,{onTransactions:r,onError:n},d=>{let l;const p=Nt(async()=>{var b;try{if(!l)try{l=await S(e,ks,"createPendingTransactionFilter")({});return}catch(f){throw p(),f}const y=await S(e,ln,"getFilterChanges")({filter:l});if(y.length===0)return;if(t)d.onTransactions(y);else for(const f of y)d.onTransactions([f])}catch(y){(b=d.onError)==null||b.call(d,y)}},{emitOnBegin:!0,interval:s});return async()=>{l&&await S(e,dn,"uninstallFilter")({filter:l}),p()}})})():(()=>{let c=!0,d=()=>c=!1;return(async()=>{try{const{unsubscribe:l}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const b=p.result;r([b])},onError(p){n==null||n(p)}});d=l,c||d()}catch(l){n==null||n(l)}})(),()=>d()})()}function ud(e){var l,p,b;const{scheme:t,statement:n,...r}=((l=e.match(cd))==null?void 0:l.groups)??{},{chainId:a,expirationTime:s,issuedAt:i,notBefore:o,requestId:u,...c}=((p=e.match(ld))==null?void 0:p.groups)??{},d=(b=e.split("Resources:")[1])==null?void 0:b.split(`
|
|
40
|
-
- `).slice(1);return{...r,...c,...a?{chainId:Number(a)}:{},...s?{expirationTime:new Date(s)}:{},...i?{issuedAt:new Date(i)}:{},...o?{notBefore:new Date(o)}:{},...u?{requestId:u}:{},...d?{resources:d}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const cd=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,ld=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;function dd(e){const{address:t,domain:n,message:r,nonce:a,scheme:s,time:i=new Date}=e;if(n&&r.domain!==n||a&&r.nonce!==a||s&&r.scheme!==s||r.expirationTime&&i>=r.expirationTime||r.notBefore&&i<r.notBefore)return!1;try{if(!r.address||t&&!Fs(r.address,t))return!1}catch{return!1}return!0}async function pd(e,t){const{address:n,domain:r,message:a,nonce:s,scheme:i,signature:o,time:u=new Date,...c}=t,d=ud(a);if(!d.address||!dd({address:n,domain:r,message:d,nonce:s,scheme:i,time:u}))return!1;const p=_s(a);return Ur(e,{address:d.address,hash:p,signature:o,...c})}function fd(e){return{call:t=>Ft(e,t),createBlockFilter:()=>Qc(e),createContractEventFilter:t=>dr(e,t),createEventFilter:t=>Rs(e,t),createPendingTransactionFilter:()=>ks(e),estimateContractGas:t=>ws(e,t),estimateGas:t=>wr(e,t),getBalance:t=>el(e,t),getBlobBaseFee:()=>tl(e),getBlock:t=>Ie(e,t),getBlockNumber:t=>jt(e,t),getBlockTransactionCount:t=>nl(e,t),getBytecode:t=>rl(e,t),getChainId:()=>kt(e),getContractEvents:t=>Er(e,t),getEip712Domain:t=>Tc(e,t),getEnsAddress:t=>jc(e,t),getEnsAvatar:t=>Yc(e,t),getEnsName:t=>Jc(e,t),getEnsResolver:t=>Xc(e,t),getEnsText:t=>Os(e,t),getFeeHistory:t=>sl(e,t),estimateFeesPerGas:t=>Du(e,t),getFilterChanges:t=>ln(e,t),getFilterLogs:t=>il(e,t),getGasPrice:()=>hr(e),getLogs:t=>xr(e,t),getProof:t=>wl(e,t),estimateMaxPriorityFeePerGas:t=>Uu(e,t),getStorageAt:t=>vl(e,t),getTransaction:t=>Or(e,t),getTransactionConfirmations:t=>Tl(e,t),getTransactionCount:t=>ps(e,t),getTransactionReceipt:t=>Kn(e,t),multicall:t=>xl(e,t),prepareTransactionRequest:t=>cn(e,t),readContract:t=>ce(e,t),sendRawTransaction:t=>Ar(e,t),simulateContract:t=>Ps(e,t),verifyMessage:t=>nd(e,t),verifySiweMessage:t=>pd(e,t),verifyTypedData:t=>rd(e,t),uninstallFilter:t=>dn(e,t),waitForTransactionReceipt:t=>ad(e,t),watchBlocks:t=>sd(e,t),watchBlockNumber:t=>ti(e,t),watchContractEvent:t=>As(e,t),watchEvent:t=>id(e,t),watchPendingTransactions:t=>od(e,t)}}function ni(e){const{key:t="public",name:n="Public Client"}=e;return Bs({...e,key:t,name:n,type:"publicClient"}).extend(fd)}function yd(e,t){const{abi:n,args:r,bytecode:a,...s}=t,i=Pr({abi:n,args:r,bytecode:a});return Ir(e,{...s,data:i})}async function md(e){var n;return((n=e.account)==null?void 0:n.type)==="local"?[e.account.address]:(await e.request({method:"eth_accounts"})).map(r=>rn(r))}async function bd(e){return await e.request({method:"wallet_getPermissions"})}async function hd(e){return(await e.request({method:"eth_requestAccounts"},{retryCount:0})).map(n=>Go(n))}async function gd(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}async function wd(e,{account:t=e.account,message:n}){if(!t)throw new pn({docsPath:"/docs/actions/wallet/signMessage"});const r=te(t);if(r.type==="local")return r.signMessage({message:n});const a=typeof n=="string"?tr(n):n.raw instanceof Uint8Array?Me(n.raw):n.raw;return e.request({method:"personal_sign",params:[a,r.address]},{retryCount:0})}async function vd(e,t){var c,d,l,p;const{account:n=e.account,chain:r=e.chain,...a}=t;if(!n)throw new pn({docsPath:"/docs/actions/wallet/signTransaction"});const s=te(n);Rt({account:s,...t});const i=await S(e,kt,"getChainId")({});r!==null&&Is({currentChainId:i,chain:r});const o=(r==null?void 0:r.formatters)||((c=e.chain)==null?void 0:c.formatters),u=((d=o==null?void 0:o.transactionRequest)==null?void 0:d.format)||un;return s.type==="local"?s.signTransaction({...a,chainId:i},{serializer:(p=(l=e.chain)==null?void 0:l.serializers)==null?void 0:p.transaction}):await e.request({method:"eth_signTransaction",params:[{...u(a),chainId:O(i),from:s.address}]},{retryCount:0})}async function Td(e,t){const{account:n=e.account,domain:r,message:a,primaryType:s}=t;if(!n)throw new pn({docsPath:"/docs/actions/wallet/signTypedData"});const i=te(n),o={EIP712Domain:Hs({domain:r}),...t.types};if(zs({domain:r,message:a,primaryType:s,types:o}),i.type==="local")return i.signTypedData({domain:r,message:a,primaryType:s,types:o});const u=fl({domain:r,message:a,primaryType:s,types:o});return e.request({method:"eth_signTypedData_v4",params:[i.address,u]},{retryCount:0})}async function xd(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:O(t)}]},{retryCount:0})}async function Ed(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}function Pd(e){return{addChain:t=>Ec(e,t),deployContract:t=>yd(e,t),getAddresses:()=>md(e),getChainId:()=>kt(e),getPermissions:()=>bd(e),prepareTransactionRequest:t=>cn(e,t),requestAddresses:()=>hd(e),requestPermissions:t=>gd(e,t),sendRawTransaction:t=>Ar(e,t),sendTransaction:t=>Ir(e,t),signMessage:t=>wd(e,t),signTransaction:t=>vd(e,t),signTypedData:t=>Td(e,t),switchChain:t=>xd(e,t),watchAsset:t=>Ed(e,t),writeContract:t=>Cs(e,t)}}function ri(e){const{key:t="wallet",name:n="Wallet Client",transport:r}=e;return Bs({...e,key:t,name:n,transport:r,type:"walletClient"}).extend(Pd)}function Ad(e){const{r:t,s:n}=jr.Signature.fromCompact(e.slice(2,130)),r=+`0x${e.slice(130)}`,[a,s]=(()=>{if(r===0||r===1)return[void 0,r];if(r===27)return[BigInt(r),0];if(r===28)return[BigInt(r),1];throw new Error("Invalid yParityOrV value")})();return typeof a<"u"?{r:O(t,{size:32}),s:O(n,{size:32}),v:a,yParity:s}:{r:O(t,{size:32}),s:O(n,{size:32}),yParity:s}}const ai=Ns({id:17e3,name:"Holesky",nativeCurrency:{name:"Holesky Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky-rpc.publicnode.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://holesky.etherscan.io"}},contracts:{multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:77},ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",blockCreated:801613},ensUniversalResolver:{address:"0xa6AC935D4971E3CD133b950aE053bECD16fE7f3b",blockCreated:973484}},testnet:!0}),si=Ns({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://cloudflare-eth.com"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensRegistry:{address:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"},ensUniversalResolver:{address:"0xce01f8eee7E479C928F8919abD53E553a36CeF67",blockCreated:19258213},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var G=(e=>(e[e.Mainnet=si.id]="Mainnet",e[e.Holesky=ai.id]="Holesky",e))(G||{});const tt={[G.Mainnet]:si,[G.Holesky]:ai},Dr={[G.Mainnet]:{PufferVault:"0xD9A442856C234a39a81a089C06451EBAa4306a72",PufferDepositor:"0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff"},[G.Holesky]:{PufferVault:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",PufferDepositor:"0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c"}},Id=[{type:"constructor",inputs:[{name:"stETH",type:"address",internalType:"contract IStETH"},{name:"weth",type:"address",internalType:"contract IWETH"},{name:"lidoWithdrawalQueue",type:"address",internalType:"contract ILidoWithdrawalQueue"},{name:"stETHStrategy",type:"address",internalType:"contract IStrategy"},{name:"eigenStrategyManager",type:"address",internalType:"contract IEigenLayer"},{name:"oracle",type:"address",internalType:"contract IPufferOracle"},{name:"delegationManager",type:"address",internalType:"contract IDelegationManager"}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"PUFFER_ORACLE",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IPufferOracle"}],stateMutability:"view"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"allowance",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"spender",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"asset",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"authority",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"account",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"burn",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"claimWithdrawalFromEigenLayer",inputs:[{name:"queuedWithdrawal",type:"tuple",internalType:"struct IEigenLayer.QueuedWithdrawal",components:[{name:"strategies",type:"address[]",internalType:"contract IStrategy[]"},{name:"shares",type:"uint256[]",internalType:"uint256[]"},{name:"depositor",type:"address",internalType:"address"},{name:"withdrawerAndNonce",type:"tuple",internalType:"struct IEigenLayer.WithdrawerAndNonce",components:[{name:"withdrawer",type:"address",internalType:"address"},{name:"nonce",type:"uint96",internalType:"uint96"}]},{name:"withdrawalStartBlock",type:"uint32",internalType:"uint32"},{name:"delegatedAddress",type:"address",internalType:"address"}]},{name:"tokens",type:"address[]",internalType:"contract IERC20[]"},{name:"middlewareTimesIndex",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"claimWithdrawalFromEigenLayerM2",inputs:[{name:"queuedWithdrawal",type:"tuple",internalType:"struct IEigenLayer.QueuedWithdrawal",components:[{name:"strategies",type:"address[]",internalType:"contract IStrategy[]"},{name:"shares",type:"uint256[]",internalType:"uint256[]"},{name:"depositor",type:"address",internalType:"address"},{name:"withdrawerAndNonce",type:"tuple",internalType:"struct IEigenLayer.WithdrawerAndNonce",components:[{name:"withdrawer",type:"address",internalType:"address"},{name:"nonce",type:"uint96",internalType:"uint96"}]},{name:"withdrawalStartBlock",type:"uint32",internalType:"uint32"},{name:"delegatedAddress",type:"address",internalType:"address"}]},{name:"tokens",type:"address[]",internalType:"contract IERC20[]"},{name:"middlewareTimesIndex",type:"uint256",internalType:"uint256"},{name:"nonce",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"claimWithdrawalsFromLido",inputs:[{name:"requestIds",type:"uint256[]",internalType:"uint256[]"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"convertToAssets",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"convertToShares",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"convertToSharesUp",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"decimals",inputs:[],outputs:[{name:"",type:"uint8",internalType:"uint8"}],stateMutability:"pure"},{type:"function",name:"deposit",inputs:[{name:"assets",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"depositETH",inputs:[{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"payable"},{type:"function",name:"depositStETH",inputs:[{name:"stETHSharesAmount",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"depositToEigenLayer",inputs:[{name:"amount",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"getELBackingEthAmount",inputs:[],outputs:[{name:"ethAmount",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getExitFeeBasisPoints",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getPendingLidoETHAmount",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getRemainingAssetsDailyWithdrawalLimit",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"initialize",inputs:[{name:"accessManager",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"initiateETHWithdrawalsFromLido",inputs:[{name:"amounts",type:"uint256[]",internalType:"uint256[]"}],outputs:[{name:"requestIds",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"nonpayable"},{type:"function",name:"initiateStETHWithdrawalFromEigenLayer",inputs:[{name:"sharesToWithdraw",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isConsumingScheduledOp",inputs:[],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"maxDeposit",inputs:[{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxMint",inputs:[{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxRedeem",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"maxShares",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxWithdraw",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"maxAssets",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"mint",inputs:[{name:"shares",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"nonces",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"permit",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"spender",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"previewDeposit",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"previewMint",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"previewRedeem",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"previewWithdraw",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"redeem",inputs:[{name:"shares",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"setAuthority",inputs:[{name:"newAuthority",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setDailyWithdrawalLimit",inputs:[{name:"newLimit",type:"uint96",internalType:"uint96"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setExitFeeBasisPoints",inputs:[{name:"newExitFeeBasisPoints",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"totalAssets",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"totalSupply",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"transfer",inputs:[{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"transferETH",inputs:[{name:"to",type:"address",internalType:"address"},{name:"ethAmount",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"withdraw",inputs:[{name:"assets",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"spender",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AssetsWithdrawnToday",inputs:[{name:"withdrawalAmount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AuthorityUpdated",inputs:[{name:"authority",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ClaimedWithdrawals",inputs:[{name:"requestIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"DailyWithdrawalLimitReset",inputs:[],anonymous:!1},{type:"event",name:"DailyWithdrawalLimitSet",inputs:[{name:"oldLimit",type:"uint96",indexed:!1,internalType:"uint96"},{name:"newLimit",type:"uint96",indexed:!1,internalType:"uint96"}],anonymous:!1},{type:"event",name:"Deposit",inputs:[{name:"sender",type:"address",indexed:!0,internalType:"address"},{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"assets",type:"uint256",indexed:!1,internalType:"uint256"},{name:"shares",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"EIP712DomainChanged",inputs:[],anonymous:!1},{type:"event",name:"ExitFeeBasisPointsSet",inputs:[{name:"previousFee",type:"uint256",indexed:!1,internalType:"uint256"},{name:"newFee",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"LidoWithdrawal",inputs:[{name:"expectedWithdrawal",type:"uint256",indexed:!1,internalType:"uint256"},{name:"actualWithdrawal",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"RequestedWithdrawals",inputs:[{name:"requestIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"TransferredETH",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Withdraw",inputs:[{name:"sender",type:"address",indexed:!0,internalType:"address"},{name:"receiver",type:"address",indexed:!0,internalType:"address"},{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"assets",type:"uint256",indexed:!1,internalType:"uint256"},{name:"shares",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AccessManagedInvalidAuthority",inputs:[{name:"authority",type:"address",internalType:"address"}]},{type:"error",name:"AccessManagedRequiredDelay",inputs:[{name:"caller",type:"address",internalType:"address"},{name:"delay",type:"uint32",internalType:"uint32"}]},{type:"error",name:"AccessManagedUnauthorized",inputs:[{name:"caller",type:"address",internalType:"address"}]},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"AddressInsufficientBalance",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"DepositAndWithdrawalForbidden",inputs:[]},{type:"error",name:"ECDSAInvalidSignature",inputs:[]},{type:"error",name:"ECDSAInvalidSignatureLength",inputs:[{name:"length",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ECDSAInvalidSignatureS",inputs:[{name:"s",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC20InsufficientAllowance",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"allowance",type:"uint256",internalType:"uint256"},{name:"needed",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC20InsufficientBalance",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"balance",type:"uint256",internalType:"uint256"},{name:"needed",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC20InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidSpender",inputs:[{name:"spender",type:"address",internalType:"address"}]},{type:"error",name:"ERC2612ExpiredSignature",inputs:[{name:"deadline",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC2612InvalidSigner",inputs:[{name:"signer",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC4626ExceededMaxDeposit",inputs:[{name:"receiver",type:"address",internalType:"address"},{name:"assets",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC4626ExceededMaxMint",inputs:[{name:"receiver",type:"address",internalType:"address"},{name:"shares",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC4626ExceededMaxRedeem",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"shares",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC4626ExceededMaxWithdraw",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"assets",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ETHTransferFailed",inputs:[]},{type:"error",name:"EnumerableMapNonexistentKey",inputs:[{name:"key",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidAccountNonce",inputs:[{name:"account",type:"address",internalType:"address"},{name:"currentNonce",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidExitFeeBasisPoints",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidWithdrawal",inputs:[]},{type:"error",name:"MathOverflowedMulDiv",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"WithdrawalsAreDisabled",inputs:[]}],Cd=[{type:"constructor",inputs:[{name:"stETH",type:"address",internalType:"contract IStETH"},{name:"weth",type:"address",internalType:"contract IWETH"},{name:"lidoWithdrawalQueue",type:"address",internalType:"contract ILidoWithdrawalQueue"},{name:"stETHStrategy",type:"address",internalType:"contract IStrategy"},{name:"eigenStrategyManager",type:"address",internalType:"contract IEigenLayer"},{name:"oracle",type:"address",internalType:"contract IPufferOracle"}],stateMutability:"nonpayable"},{type:"receive",stateMutability:"payable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"PUFFER_ORACLE",inputs:[],outputs:[{name:"",type:"address",internalType:"contract IPufferOracle"}],stateMutability:"view"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"allowance",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"spender",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"asset",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"authority",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"balanceOf",inputs:[{name:"account",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"burn",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"claimWithdrawalFromEigenLayer",inputs:[{name:"queuedWithdrawal",type:"tuple",internalType:"struct IEigenLayer.QueuedWithdrawal",components:[{name:"strategies",type:"address[]",internalType:"contract IStrategy[]"},{name:"shares",type:"uint256[]",internalType:"uint256[]"},{name:"depositor",type:"address",internalType:"address"},{name:"withdrawerAndNonce",type:"tuple",internalType:"struct IEigenLayer.WithdrawerAndNonce",components:[{name:"withdrawer",type:"address",internalType:"address"},{name:"nonce",type:"uint96",internalType:"uint96"}]},{name:"withdrawalStartBlock",type:"uint32",internalType:"uint32"},{name:"delegatedAddress",type:"address",internalType:"address"}]},{name:"tokens",type:"address[]",internalType:"contract IERC20[]"},{name:"middlewareTimesIndex",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"claimWithdrawalsFromLido",inputs:[{name:"requestIds",type:"uint256[]",internalType:"uint256[]"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"convertToAssets",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"convertToShares",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"convertToSharesUp",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"decimals",inputs:[],outputs:[{name:"",type:"uint8",internalType:"uint8"}],stateMutability:"pure"},{type:"function",name:"deposit",inputs:[{name:"assets",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"depositETH",inputs:[{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"payable"},{type:"function",name:"depositStETH",inputs:[{name:"stETHSharesAmount",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"depositToEigenLayer",inputs:[{name:"amount",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"getELBackingEthAmount",inputs:[],outputs:[{name:"ethAmount",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getExitFeeBasisPoints",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getPendingLidoETHAmount",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getRemainingAssetsDailyWithdrawalLimit",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"initialize",inputs:[],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"initialize",inputs:[{name:"accessManager",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"initiateETHWithdrawalsFromLido",inputs:[{name:"amounts",type:"uint256[]",internalType:"uint256[]"}],outputs:[{name:"requestIds",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"nonpayable"},{type:"function",name:"initiateStETHWithdrawalFromEigenLayer",inputs:[{name:"sharesToWithdraw",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"isConsumingScheduledOp",inputs:[],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"maxDeposit",inputs:[{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxMint",inputs:[{name:"",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxRedeem",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"maxShares",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"maxWithdraw",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"maxAssets",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"mint",inputs:[{name:"shares",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"nonces",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"permit",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"spender",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"previewDeposit",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"previewMint",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"previewRedeem",inputs:[{name:"shares",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"previewWithdraw",inputs:[{name:"assets",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"redeem",inputs:[{name:"shares",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"setAuthority",inputs:[{name:"newAuthority",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setDailyWithdrawalLimit",inputs:[{name:"newLimit",type:"uint96",internalType:"uint96"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"setExitFeeBasisPoints",inputs:[{name:"newExitFeeBasisPoints",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"totalAssets",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"totalSupply",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"transfer",inputs:[{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"transferETH",inputs:[{name:"to",type:"address",internalType:"address"},{name:"ethAmount",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"withdraw",inputs:[{name:"assets",type:"uint256",internalType:"uint256"},{name:"receiver",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"spender",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AssetsWithdrawnToday",inputs:[{name:"withdrawalAmount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"AuthorityUpdated",inputs:[{name:"authority",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"ClaimedWithdrawals",inputs:[{name:"requestIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"DailyWithdrawalLimitReset",inputs:[],anonymous:!1},{type:"event",name:"DailyWithdrawalLimitSet",inputs:[{name:"oldLimit",type:"uint96",indexed:!1,internalType:"uint96"},{name:"newLimit",type:"uint96",indexed:!1,internalType:"uint96"}],anonymous:!1},{type:"event",name:"Deposit",inputs:[{name:"sender",type:"address",indexed:!0,internalType:"address"},{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"assets",type:"uint256",indexed:!1,internalType:"uint256"},{name:"shares",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"EIP712DomainChanged",inputs:[],anonymous:!1},{type:"event",name:"ExitFeeBasisPointsSet",inputs:[{name:"previousFee",type:"uint256",indexed:!1,internalType:"uint256"},{name:"newFee",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"LidoWithdrawal",inputs:[{name:"expectedWithdrawal",type:"uint256",indexed:!1,internalType:"uint256"},{name:"actualWithdrawal",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"RequestedWithdrawals",inputs:[{name:"requestIds",type:"uint256[]",indexed:!1,internalType:"uint256[]"}],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"TransferredETH",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"event",name:"Withdraw",inputs:[{name:"sender",type:"address",indexed:!0,internalType:"address"},{name:"receiver",type:"address",indexed:!0,internalType:"address"},{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"assets",type:"uint256",indexed:!1,internalType:"uint256"},{name:"shares",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AccessManagedInvalidAuthority",inputs:[{name:"authority",type:"address",internalType:"address"}]},{type:"error",name:"AccessManagedRequiredDelay",inputs:[{name:"caller",type:"address",internalType:"address"},{name:"delay",type:"uint32",internalType:"uint32"}]},{type:"error",name:"AccessManagedUnauthorized",inputs:[{name:"caller",type:"address",internalType:"address"}]},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"AddressInsufficientBalance",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"DepositAndWithdrawalForbidden",inputs:[]},{type:"error",name:"ECDSAInvalidSignature",inputs:[]},{type:"error",name:"ECDSAInvalidSignatureLength",inputs:[{name:"length",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ECDSAInvalidSignatureS",inputs:[{name:"s",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"ERC20InsufficientAllowance",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"allowance",type:"uint256",internalType:"uint256"},{name:"needed",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC20InsufficientBalance",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"balance",type:"uint256",internalType:"uint256"},{name:"needed",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC20InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidSpender",inputs:[{name:"spender",type:"address",internalType:"address"}]},{type:"error",name:"ERC2612ExpiredSignature",inputs:[{name:"deadline",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC2612InvalidSigner",inputs:[{name:"signer",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"ERC4626ExceededMaxDeposit",inputs:[{name:"receiver",type:"address",internalType:"address"},{name:"assets",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC4626ExceededMaxMint",inputs:[{name:"receiver",type:"address",internalType:"address"},{name:"shares",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC4626ExceededMaxRedeem",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"shares",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC4626ExceededMaxWithdraw",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"assets",type:"uint256",internalType:"uint256"},{name:"max",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ETHTransferFailed",inputs:[]},{type:"error",name:"EnumerableMapNonexistentKey",inputs:[{name:"key",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidAccountNonce",inputs:[{name:"account",type:"address",internalType:"address"},{name:"currentNonce",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidExitFeeBasisPoints",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"InvalidWithdrawal",inputs:[]},{type:"error",name:"MathOverflowedMulDiv",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"WithdrawalsAreDisabled",inputs:[]}],Bd={[G.Mainnet]:{PufferVaultV2:Id},[G.Holesky]:{PufferVaultV2:Cd}};class Sd{constructor(t,n,r){we(this,"viemChain");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=tt[t]}getContract(){return Cr({address:Dr[this.chain].PufferVault,abi:Bd[this.chain].PufferVaultV2,client:{wallet:this.walletClient,public:this.publicClient}})}depositETH(t){return{transact:async a=>await this.getContract().write.depositETH([t],{account:t,chain:this.viemChain,value:a}),estimate:async()=>await this.getContract().estimateGas.depositETH([t],{account:t})}}async balanceOf(t){return await this.getContract().read.balanceOf([t])}async getPufETHRate(){const t=BigInt(1e18);return await this.getContract().read.previewDeposit([t])}async getAllowance(t,n){return await this.getContract().read.allowance([t,n])}}const Md=[{type:"constructor",inputs:[{name:"pufferVault",type:"address",internalType:"contract PufferVaultV2"},{name:"stETH",type:"address",internalType:"contract IStETH"}],stateMutability:"payable"},{type:"function",name:"PUFFER_VAULT",inputs:[],outputs:[{name:"",type:"address",internalType:"contract PufferVaultV2"}],stateMutability:"view"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"authority",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"depositStETH",inputs:[{name:"permitData",type:"tuple",internalType:"struct Permit",components:[{name:"deadline",type:"uint256",internalType:"uint256"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}]},{name:"recipient",type:"address",internalType:"address"}],outputs:[{name:"pufETHAmount",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"depositWstETH",inputs:[{name:"permitData",type:"tuple",internalType:"struct Permit",components:[{name:"deadline",type:"uint256",internalType:"uint256"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}]},{name:"recipient",type:"address",internalType:"address"}],outputs:[{name:"pufETHAmount",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"isConsumingScheduledOp",inputs:[],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"setAuthority",inputs:[{name:"newAuthority",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AuthorityUpdated",inputs:[{name:"authority",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AccessManagedInvalidAuthority",inputs:[{name:"authority",type:"address",internalType:"address"}]},{type:"error",name:"AccessManagedRequiredDelay",inputs:[{name:"caller",type:"address",internalType:"address"},{name:"delay",type:"uint32",internalType:"uint32"}]},{type:"error",name:"AccessManagedUnauthorized",inputs:[{name:"caller",type:"address",internalType:"address"}]},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"AddressInsufficientBalance",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]}],$d=[{type:"constructor",inputs:[{name:"pufferVault",type:"address",internalType:"contract PufferVaultV2"},{name:"stETH",type:"address",internalType:"contract IStETH"}],stateMutability:"payable"},{type:"function",name:"PUFFER_VAULT",inputs:[],outputs:[{name:"",type:"address",internalType:"contract PufferVaultV2"}],stateMutability:"view"},{type:"function",name:"UPGRADE_INTERFACE_VERSION",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"authority",inputs:[],outputs:[{name:"",type:"address",internalType:"address"}],stateMutability:"view"},{type:"function",name:"depositStETH",inputs:[{name:"permitData",type:"tuple",internalType:"struct Permit",components:[{name:"deadline",type:"uint256",internalType:"uint256"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}]},{name:"recipient",type:"address",internalType:"address"}],outputs:[{name:"pufETHAmount",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"depositWstETH",inputs:[{name:"permitData",type:"tuple",internalType:"struct Permit",components:[{name:"deadline",type:"uint256",internalType:"uint256"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}]},{name:"recipient",type:"address",internalType:"address"}],outputs:[{name:"pufETHAmount",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"isConsumingScheduledOp",inputs:[],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"view"},{type:"function",name:"proxiableUUID",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"setAuthority",inputs:[{name:"newAuthority",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"upgradeToAndCall",inputs:[{name:"newImplementation",type:"address",internalType:"address"},{name:"data",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"event",name:"AuthorityUpdated",inputs:[{name:"authority",type:"address",indexed:!1,internalType:"address"}],anonymous:!1},{type:"event",name:"Initialized",inputs:[{name:"version",type:"uint64",indexed:!1,internalType:"uint64"}],anonymous:!1},{type:"event",name:"Upgraded",inputs:[{name:"implementation",type:"address",indexed:!0,internalType:"address"}],anonymous:!1},{type:"error",name:"AccessManagedInvalidAuthority",inputs:[{name:"authority",type:"address",internalType:"address"}]},{type:"error",name:"AccessManagedRequiredDelay",inputs:[{name:"caller",type:"address",internalType:"address"},{name:"delay",type:"uint32",internalType:"uint32"}]},{type:"error",name:"AccessManagedUnauthorized",inputs:[{name:"caller",type:"address",internalType:"address"}]},{type:"error",name:"AddressEmptyCode",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"AddressInsufficientBalance",inputs:[{name:"account",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967InvalidImplementation",inputs:[{name:"implementation",type:"address",internalType:"address"}]},{type:"error",name:"ERC1967NonPayable",inputs:[]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidInitialization",inputs:[]},{type:"error",name:"NotInitializing",inputs:[]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"UUPSUnauthorizedCallContext",inputs:[]},{type:"error",name:"UUPSUnsupportedProxiableUUID",inputs:[{name:"slot",type:"bytes32",internalType:"bytes32"}]}],Od={[G.Mainnet]:{PufferDepositor:Md},[G.Holesky]:{PufferDepositor:$d}},Rd=[{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"allowance",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"spender",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"approve",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"balanceOf",inputs:[{name:"account",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"decimals",inputs:[],outputs:[{name:"",type:"uint8",internalType:"uint8"}],stateMutability:"view"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"name",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"nonces",inputs:[{name:"owner",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"permit",inputs:[{name:"owner",type:"address",internalType:"address"},{name:"spender",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"deadline",type:"uint256",internalType:"uint256"},{name:"v",type:"uint8",internalType:"uint8"},{name:"r",type:"bytes32",internalType:"bytes32"},{name:"s",type:"bytes32",internalType:"bytes32"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"totalSupply",inputs:[],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"transfer",inputs:[{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"function",name:"transferFrom",inputs:[{name:"from",type:"address",internalType:"address"},{name:"to",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"nonpayable"},{type:"event",name:"Approval",inputs:[{name:"owner",type:"address",indexed:!0,internalType:"address"},{name:"spender",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"EIP712DomainChanged",inputs:[],anonymous:!1},{type:"event",name:"Transfer",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"ECDSAInvalidSignature",inputs:[]},{type:"error",name:"ECDSAInvalidSignatureLength",inputs:[{name:"length",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ECDSAInvalidSignatureS",inputs:[{name:"s",type:"bytes32",internalType:"bytes32"}]},{type:"error",name:"ERC20InsufficientAllowance",inputs:[{name:"spender",type:"address",internalType:"address"},{name:"allowance",type:"uint256",internalType:"uint256"},{name:"needed",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC20InsufficientBalance",inputs:[{name:"sender",type:"address",internalType:"address"},{name:"balance",type:"uint256",internalType:"uint256"},{name:"needed",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC20InvalidApprover",inputs:[{name:"approver",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidReceiver",inputs:[{name:"receiver",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidSender",inputs:[{name:"sender",type:"address",internalType:"address"}]},{type:"error",name:"ERC20InvalidSpender",inputs:[{name:"spender",type:"address",internalType:"address"}]},{type:"error",name:"ERC2612ExpiredSignature",inputs:[{name:"deadline",type:"uint256",internalType:"uint256"}]},{type:"error",name:"ERC2612InvalidSigner",inputs:[{name:"signer",type:"address",internalType:"address"},{name:"owner",type:"address",internalType:"address"}]},{type:"error",name:"InvalidAccountNonce",inputs:[{name:"account",type:"address",internalType:"address"},{name:"currentNonce",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidShortString",inputs:[]},{type:"error",name:"StringTooLong",inputs:[{name:"str",type:"string",internalType:"string"}]}],kd=Rd;var St=(e=>(e.ETH="ETH",e.stETH="stETH",e.wstETH="wstETH",e.pufETH="pufETH",e))(St||{});const er={stETH:{[G.Mainnet]:"0xae7ab96520de3a18e5e111b5eaab095312d7fe84",[G.Holesky]:"0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034"},wstETH:{[G.Mainnet]:"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",[G.Holesky]:"0x8d09a4502Cc8Cf1547aD300E066060D043f6982D"},pufETH:{[G.Mainnet]:"0xd9a442856c234a39a81a089c06451ebaa4306a72",[G.Holesky]:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9"},ETH:{}},Fd=()=>Math.floor(Date.now()/1e3);class Nd{constructor(t,n,r){this.chain=t,this.walletClient=n,this.publicClient=r}getContract(t){return Cr({address:er[t][this.chain],abi:kd,client:{wallet:this.walletClient,public:this.publicClient}})}async getPermitSignature(t,n,r){const a=this.getContract(t),s=await a.read.nonces([n]),o={name:await a.read.name(),version:this.getPermitVersion(t),chainId:this.chain,verifyingContract:er[t][this.chain]},u={Permit:[{name:"owner",type:"address"},{name:"spender",type:"address"},{name:"value",type:"uint256"},{name:"nonce",type:"uint256"},{name:"deadline",type:"uint256"}]},c=BigInt(Fd()+60*60*2),d=await this.walletClient.signTypedData({account:n,domain:o,types:u,primaryType:"Permit",message:{owner:n,spender:Dr[this.chain].PufferDepositor,value:r,nonce:s,deadline:c}});return{...Ad(d),deadline:c}}getPermitVersion(t){return t===St.stETH?"2":"1"}}class jd{constructor(t,n,r){we(this,"viemChain");we(this,"tokensHandler");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=tt[t],this.tokensHandler=new Nd(t,n,r)}getContract(){return Cr({address:Dr[this.chain].PufferDepositor,abi:Od[this.chain].PufferDepositor,client:{wallet:this.walletClient,public:this.publicClient}})}async depositStETH(t,n){const{r,s:a,v:s,yParity:i,deadline:o}=await this.tokensHandler.getPermitSignature(St.stETH,t,n),u={r,s:a,v:Number(s??i),deadline:o,amount:n};return{transact:async()=>await this.getContract().write.depositStETH([u,t],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.depositStETH([u,t],{account:t})}}async depositWstETH(t,n){const{r,s:a,v:s,yParity:i,deadline:o}=await this.tokensHandler.getPermitSignature(St.wstETH,t,n),u={r,s:a,v:Number(s??i),deadline:o,amount:n};return{transact:async()=>await this.getContract().write.depositWstETH([u,t],{account:t,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.depositWstETH([u,t],{account:t})}}}class Ud{constructor(t,n,r){we(this,"walletClient");we(this,"publicClient");we(this,"vault");we(this,"depositor");const a=tt[t];this.walletClient=n??ri({chain:a,transport:Zn()}),this.publicClient=r??ni({chain:a,transport:Zn()}),this.vault=new Sd(t,this.walletClient,this.publicClient),this.depositor=new jd(t,this.walletClient,this.publicClient)}async requestAddresses(){return await this.walletClient.requestAddresses()}}class Yt{static createPublicClient(t){return ni({chain:tt[t.chain],transport:Yt.extractTransportConfig(t)})}static createWalletClient(t){return ri({chain:tt[t.chain],transport:Yt.extractTransportConfig(t)})}static extractTransportConfig(t){return"rpcUrls"in t?Bc(t.rpcUrls.map(n=>Zn(n))):Cc(t.provider,t.config)}}exports.BaseError=T;exports.Chain=G;exports.HttpRequestError=We;exports.PufferClient=Ud;exports.PufferClientHelpers=Yt;exports.TOKENS_ADDRESSES=er;exports.Token=St;exports.VIEM_CHAINS=tt;exports.call=Ft;exports.concat=ue;exports.decodeErrorResult=Qa;exports.encodeAbiParameters=rt;exports.getUrl=Xt;exports.isAddressEqual=Fs;exports.isHex=se;exports.stringify=H;
|
|
41
|
-
//# sourceMappingURL=main-C4aA8dQe.cjs.map
|