@pufferfinance/puffer-sdk 1.0.2 → 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.
Files changed (47) hide show
  1. package/README.md +8 -7
  2. package/dist/api/puffer-client.d.ts +16 -0
  3. package/dist/ccip-CzWPognK.js +158 -0
  4. package/dist/ccip-CzWPognK.js.map +1 -0
  5. package/dist/ccip-DNUqn1xf.cjs +2 -0
  6. package/dist/ccip-DNUqn1xf.cjs.map +1 -0
  7. package/dist/chains/constants.d.ts +2 -3
  8. package/dist/contracts/abis/holesky/PufferDepositor.d.ts +283 -0
  9. package/dist/contracts/abis/mainnet/ERC20Permit.d.ts +396 -0
  10. package/dist/contracts/abis/mainnet/PufLocker.d.ts +476 -0
  11. package/dist/contracts/abis/mainnet/PufToken.d.ts +676 -0
  12. package/dist/contracts/abis/mainnet/PufferDepositor.d.ts +283 -0
  13. package/dist/contracts/abis/mainnet/PufferL2Depositor.d.ts +351 -0
  14. package/dist/contracts/abis/puf-locker-abis.d.ts +480 -0
  15. package/dist/contracts/abis/puf-token-abis.d.ts +680 -0
  16. package/dist/contracts/abis/puffer-depositor-abis.d.ts +642 -0
  17. package/dist/contracts/abis/{abis.d.ts → puffer-vault-abis.d.ts} +3 -1367
  18. package/dist/contracts/abis/tokens-abis.d.ts +396 -0
  19. package/dist/contracts/addresses.d.ts +4 -7
  20. package/dist/contracts/handlers/erc20-permit-handler.d.ts +13705 -0
  21. package/dist/contracts/handlers/puf-locker-handler.d.ts +31064 -0
  22. package/dist/contracts/handlers/puffer-depositor-handler.d.ts +9923 -0
  23. package/dist/contracts/handlers/puffer-depositor-handler.test.d.ts +1 -0
  24. package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +22867 -0
  25. package/dist/contracts/handlers/puffer-l2-depositor-handler.test.d.ts +1 -0
  26. package/dist/contracts/tokens.d.ts +27 -0
  27. package/dist/main--Ww95s5e.cjs +41 -0
  28. package/dist/main--Ww95s5e.cjs.map +1 -0
  29. package/dist/{main-CiwlneBr.js → main-Cl9ZFxdC.js} +5939 -3509
  30. package/dist/main-Cl9ZFxdC.js.map +1 -0
  31. package/dist/main.cjs +1 -1
  32. package/dist/main.d.ts +2 -0
  33. package/dist/main.js +8 -5
  34. package/dist/utils/time.d.ts +1 -0
  35. package/package.json +12 -10
  36. package/dist/ccip-Bv7jv7p7.cjs +0 -2
  37. package/dist/ccip-Bv7jv7p7.cjs.map +0 -1
  38. package/dist/ccip-n5cHM2-q.js +0 -165
  39. package/dist/ccip-n5cHM2-q.js.map +0 -1
  40. package/dist/contracts/abis/anvil/PufferVaultV2.d.ts +0 -1361
  41. package/dist/contracts/handlers/puffer-vault-handler.d.ts +0 -79
  42. package/dist/main-CiwlneBr.js.map +0 -1
  43. package/dist/main-DY0whdxp.cjs +0 -39
  44. package/dist/main-DY0whdxp.cjs.map +0 -1
  45. /package/dist/{api/puffer-client-helpers.test.d.ts → contracts/handlers/erc20-permit-handler.test.d.ts} +0 -0
  46. /package/dist/{api/puffer-client.test.d.ts → contracts/handlers/puf-locker-handler.test.d.ts} +0 -0
  47. /package/dist/{errors/validation-errors.test.d.ts → contracts/handlers/puf-token-handler.test.d.ts} +0 -0
@@ -0,0 +1,41 @@
1
+ "use strict";var di=Object.defineProperty;var li=(e,t,n)=>t in e?di(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var L=(e,t,n)=>li(e,typeof t!="symbol"?t+"":t,n);const pi="1.0.0";let te=class Rn extends Error{constructor(t,n={}){var i;const r=n.cause instanceof Rn?n.cause.details:(i=n.cause)!=null&&i.message?n.cause.message:n.details,a=n.cause instanceof Rn&&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@${pi}`].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 ke(e,t){const n=e.exec(t);return n==null?void 0:n.groups}const Pa=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ca=/^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)?$/,Aa=/^\(.+?\).*?$/,qr=/^tuple(?<array>(\[(\d*)\])*)$/;function On(e){let t=e.type;if(qr.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+=On(s),a<n-1&&(t+=", ")}const r=ke(qr,e.type);return t+=`)${(r==null?void 0:r.array)??""}`,On({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function pt(e){let t="";const n=e.length;for(let r=0;r<n;r++){const a=e[r];t+=On(a),r!==n-1&&(t+=", ")}return t}function yi(e){return e.type==="function"?`function ${e.name}(${pt(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${pt(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${pt(e.inputs)})`:e.type==="error"?`error ${e.name}(${pt(e.inputs)})`:e.type==="constructor"?`constructor(${pt(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?"fallback()":"receive() external payable"}const Ia=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function fi(e){return Ia.test(e)}function mi(e){return ke(Ia,e)}const Ma=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function bi(e){return Ma.test(e)}function hi(e){return ke(Ma,e)}const Sa=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function gi(e){return Sa.test(e)}function wi(e){return ke(Sa,e)}const Ba=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function $a(e){return Ba.test(e)}function Ti(e){return ke(Ba,e)}const ka=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function vi(e){return ka.test(e)}function xi(e){return ke(ka,e)}const Ei=/^fallback\(\)$/;function Pi(e){return Ei.test(e)}const Ci=/^receive\(\) external payable$/;function Ai(e){return Ci.test(e)}const Ii=new Set(["indexed"]),Fn=new Set(["calldata","memory","storage"]);class Mi extends te{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 Si extends te{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 Bi extends te{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class $i extends te{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 ki extends te{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 Ri extends te{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 Oi extends te{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 mt extends te{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Fi extends te{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Ni extends te{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 Di extends te{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 ji extends te{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 Ui(e,t){return t?`${t}:${e}`:e}const vn=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 Li(e,t={}){if(gi(e)){const n=wi(e);if(!n)throw new mt({signature:e,type:"function"});const r=se(n.parameters),a=[],s=r.length;for(let o=0;o<s;o++)a.push(Ne(r[o],{modifiers:Fn,structs:t,type:"function"}));const i=[];if(n.returns){const o=se(n.returns),u=o.length;for(let c=0;c<u;c++)i.push(Ne(o[c],{modifiers:Fn,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:a,outputs:i}}if(bi(e)){const n=hi(e);if(!n)throw new mt({signature:e,type:"event"});const r=se(n.parameters),a=[],s=r.length;for(let i=0;i<s;i++)a.push(Ne(r[i],{modifiers:Ii,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:a}}if(fi(e)){const n=mi(e);if(!n)throw new mt({signature:e,type:"error"});const r=se(n.parameters),a=[],s=r.length;for(let i=0;i<s;i++)a.push(Ne(r[i],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:a}}if(vi(e)){const n=xi(e);if(!n)throw new mt({signature:e,type:"constructor"});const r=se(n.parameters),a=[],s=r.length;for(let i=0;i<s;i++)a.push(Ne(r[i],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:a}}if(Pi(e))return{type:"fallback"};if(Ai(e))return{type:"receive",stateMutability:"payable"};throw new Fi({signature:e})}const Hi=/^(?<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$_]*))?$/,zi=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,_i=/^u?int$/;function Ne(e,t){var d,p;const n=Ui(e,t==null?void 0:t.type);if(vn.has(n))return vn.get(n);const r=Aa.test(e),a=ke(r?zi:Hi,e);if(!a)throw new Bi({param:e});if(a.name&&Gi(a.name))throw new $i({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 m=se(a.type),f=[],y=m.length;for(let b=0;b<y;b++)f.push(Ne(m[b],{structs:o}));c={components:f}}else if(a.type in o)u="tuple",c={components:o[a.type]};else if(_i.test(a.type))u=`${a.type}256`;else if(u=a.type,(t==null?void 0:t.type)!=="struct"&&!Ra(u))throw new Si({type:u});if(a.modifier){if(!((p=(d=t==null?void 0:t.modifiers)==null?void 0:d.has)!=null&&p.call(d,a.modifier)))throw new ki({param:e,type:t==null?void 0:t.type,modifier:a.modifier});if(Fn.has(a.modifier)&&!Wi(u,!!a.array))throw new Ri({param:e,type:t==null?void 0:t.type,modifier:a.modifier})}const l={type:`${u}${a.array??""}`,...s,...i,...c};return vn.set(n,l),l}function se(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?se(o,[...t,n.trim()]):se(o,t,`${n}${i}`,r);case"(":return se(o,t,`${n}${i}`,r+1);case")":return se(o,t,`${n}${i}`,r-1);default:return se(o,t,`${n}${i}`,r)}}if(n==="")return t;if(r!==0)throw new ji({current:n,depth:r});return t.push(n.trim()),t}function Ra(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Pa.test(e)||Ca.test(e)}const qi=/^(?: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 Gi(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Pa.test(e)||Ca.test(e)||qi.test(e)}function Wi(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function Vi(e){const t={},n=e.length;for(let i=0;i<n;i++){const o=e[i];if(!$a(o))continue;const u=Ti(o);if(!u)throw new mt({signature:o,type:"struct"});const c=u.properties.split(";"),l=[],d=c.length;for(let p=0;p<d;p++){const f=c[p].trim();if(!f)continue;const y=Ne(f,{type:"struct"});l.push(y)}if(!l.length)throw new Ni({signature:o});t[u.name]=l}const r={},a=Object.entries(t),s=a.length;for(let i=0;i<s;i++){const[o,u]=a[i];r[o]=Oa(u,t)}return r}const Zi=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Oa(e,t,n=new Set){const r=[],a=e.length;for(let s=0;s<a;s++){const i=e[s];if(Aa.test(i.type))r.push(i);else{const u=ke(Zi,i.type);if(!(u!=null&&u.type))throw new Oi({abiParameter:i});const{array:c,type:l}=u;if(l in t){if(n.has(l))throw new Di({type:l});r.push({...i,type:`tuple${c??""}`,components:Oa(t[l]??[],t,new Set([...n,l]))})}else if(Ra(l))r.push(i);else throw new Mi({type:l})}}return r}function Ki(e){const t=Vi(e),n=[],r=e.length;for(let a=0;a<r;a++){const s=e[a];$a(s)||n.push(Li(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 Te(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new po(e.type);return`${e.name}(${en(e.inputs,{includeName:t})})`}function en(e,{includeName:t=!1}={}){return e?e.map(n=>Yi(n,{includeName:t})).join(t?", ":","):""}function Yi(e,{includeName:t}){return e.type.startsWith("tuple")?`(${en(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function ie(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function H(e){return ie(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const Ji="2.14.0",Xi=e=>e,tn=e=>e,Qi=()=>`viem@${Ji}`;class v 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:Qi()});const r=n.cause instanceof v?n.cause.details:(s=n.cause)!=null&&s.message?n.cause.message:n.details,a=n.cause instanceof v&&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 Fa(this,t)}}function Fa(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e?Fa(e.cause,t):t?null:e}class eo extends v{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 Gr extends v{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 Na extends v{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
6
+ `),{metaMessages:[`Params: (${en(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 nn extends v{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiDecodingZeroDataError"})}}class to extends v{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 no extends v{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${H(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class ro extends v{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 Da extends v{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 ao extends v{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 ja extends v{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 Wr extends v{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 Vt extends v{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 so extends v{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 io extends v{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${Te(t.abiItem)}\`, and`,`\`${n.type}\` in \`${Te(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 oo extends v{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 bt extends v{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: (${en(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 rn extends v{constructor({abiItem:t,param:n}){super([`Expected a topic for indexed event parameter${n.name?` "${n.name}"`:""} on event "${Te(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 uo extends v{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 co extends v{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 lo extends v{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 po extends v{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 yo extends v{constructor(t){super(`Filter type "${t}" is not supported.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"FilterTypeNotSupportedError"})}}class Ua extends v{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 La extends v{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 v{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 st(e,{dir:t,size:n=32}={}){return typeof e=="string"?de(e,{dir:t,size:n}):fo(e,{dir:t,size:n})}function de(e,{dir:t,size:n=32}={}){if(n===null)return e;const r=e.replace("0x","");if(r.length>n*2)throw new La({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function fo(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new La({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 mo extends v{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 bo extends v{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 ho extends v{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 an(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 fe(e,{size:t}){if(H(e)>t)throw new ho({givenSize:H(e),maxSize:t})}function Xe(e,t={}){const{signed:n}=t;t.size&&fe(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 Ae(e,t={}){return Number(Xe(e,t))}const go=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Re(e,t={}){return typeof e=="number"||typeof e=="bigint"?k(e,t):typeof e=="string"?ar(e,t):typeof e=="boolean"?Ha(e,t):G(e,t)}function Ha(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(fe(n,{size:t.size}),st(n,{size:t.size})):n}function G(e,t={}){let n="";for(let a=0;a<e.length;a++)n+=go[e[a]];const r=`0x${n}`;return typeof t.size=="number"?(fe(r,{size:t.size}),st(r,{dir:"right",size:t.size})):r}function k(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 mo({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?st(o,{size:r}):o}const wo=new TextEncoder;function ar(e,t={}){const n=wo.encode(e);return G(n,t)}const To=new TextEncoder;function Ie(e,t={}){return typeof e=="number"||typeof e=="bigint"?xo(e,t):typeof e=="boolean"?vo(e,t):ie(e)?He(e,t):he(e,t)}function vo(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(fe(n,{size:t.size}),st(n,{size:t.size})):n}const me={zero:48,nine:57,A:65,F:70,a:97,f:102};function Zr(e){if(e>=me.zero&&e<=me.nine)return e-me.zero;if(e>=me.A&&e<=me.F)return e-(me.A-10);if(e>=me.a&&e<=me.f)return e-(me.a-10)}function He(e,t={}){let n=e;t.size&&(fe(n,{size:t.size}),n=st(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=Zr(r.charCodeAt(o++)),c=Zr(r.charCodeAt(o++));if(u===void 0||c===void 0)throw new v(`Invalid byte sequence ("${r[o-2]}${r[o-1]}" in "${r}").`);s[i]=u*16+c}return s}function xo(e,t){const n=k(e,t);return He(n)}function he(e,t={}){const n=To.encode(e);return typeof t.size=="number"?(fe(n,{size:t.size}),st(n,{dir:"right",size:t.size})):n}function Zt(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function sr(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 Eo(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Zt(e.outputLen),Zt(e.blockLen)}function Qe(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 za(e,t){sr(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const zt=BigInt(2**32-1),Kr=BigInt(32);function Po(e,t=!1){return t?{h:Number(e&zt),l:Number(e>>Kr&zt)}:{h:Number(e>>Kr&zt)|0,l:Number(e&zt)|0}}function Co(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}=Po(e[a],t);[n[a],r[a]]=[s,i]}return[n,r]}const Ao=(e,t,n)=>e<<n|t>>>32-n,Io=(e,t,n)=>t<<n|e>>>32-n,Mo=(e,t,n)=>t<<n-32|e>>>64-n,So=(e,t,n)=>e<<n-32|t>>>64-n,xn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _a=e=>e instanceof Uint8Array,Bo=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),En=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),ue=(e,t)=>e<<32-t|e>>>t,$o=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!$o)throw new Error("Non little-endian hardware is not supported");function ko(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function sn(e){if(typeof e=="string"&&(e=ko(e)),!_a(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}function Ro(...e){const t=new Uint8Array(e.reduce((r,a)=>r+a.length,0));let n=0;return e.forEach(r=>{if(!_a(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}class ir{clone(){return this._cloneInto()}}function qa(e){const t=r=>e().update(sn(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Oo(e=32){if(xn&&typeof xn.getRandomValues=="function")return xn.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}const[Ga,Wa,Va]=[[],[],[]],Fo=BigInt(0),yt=BigInt(1),No=BigInt(2),Do=BigInt(7),jo=BigInt(256),Uo=BigInt(113);for(let e=0,t=yt,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Ga.push(2*(5*r+n)),Wa.push((e+1)*(e+2)/2%64);let a=Fo;for(let s=0;s<7;s++)t=(t<<yt^(t>>Do)*Uo)%jo,t&No&&(a^=yt<<(yt<<BigInt(s))-yt);Va.push(a)}const[Lo,Ho]=Co(Va,!0),Yr=(e,t,n)=>n>32?Mo(e,t,n):Ao(e,t,n),Jr=(e,t,n)=>n>32?So(e,t,n):Io(e,t,n);function zo(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],l=n[u+1],d=Yr(c,l,1)^n[o],p=Jr(c,l,1)^n[o+1];for(let m=0;m<50;m+=10)e[i+m]^=d,e[i+m+1]^=p}let a=e[2],s=e[3];for(let i=0;i<24;i++){const o=Wa[i],u=Yr(a,s,o),c=Jr(a,s,o),l=Ga[i];a=e[l],s=e[l+1],e[l]=u,e[l+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]^=Lo[r],e[1]^=Ho[r]}n.fill(0)}class or extends ir{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,Zt(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=Bo(this.state)}keccak(){zo(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){Qe(this);const{blockLen:n,state:r}=this;t=sn(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){Qe(this,!1),sr(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 Zt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(za(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 or(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 _o=(e,t,n)=>qa(()=>new or(t,e,n)),qo=_o(1,136,256/8);function Z(e,t){const n=t||"hex",r=qo(ie(e,{strict:!1})?Ie(e):e);return n==="bytes"?r:Re(r)}const Go=e=>Z(Ie(e));function Wo(e){return Go(e)}function Vo(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 v("Unable to normalize signature.");return a}const Zo=e=>{const t=typeof e=="string"?e:yi(e);return Vo(t)};function Za(e){return Wo(Zo(e))}const ur=Za;class Me extends v{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 Ka 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 Pn=new Ka(8192);function on(e,t){if(Pn.has(`${e}.${t}`))return Pn.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),r=Z(he(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 Pn.set(`${e}.${t}`,s),s}function Ko(e,t){if(!oe(e,{strict:!1}))throw new Me({address:e});return on(e,t)}const Yo=/^0x[a-fA-F0-9]{40}$/,Cn=new Ka(8192);function oe(e,t){const{strict:n=!0}=t??{},r=`${e}.${n}`;if(Cn.has(r))return Cn.get(r);const a=Yo.test(e)?e.toLowerCase()===e?!0:n?on(e)===e:!0:!1;return Cn.set(r,a),a}function le(e){return typeof e[0]=="string"?cr(e):Jo(e)}function Jo(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 cr(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Kt(e,t,n,{strict:r}={}){return ie(e,{strict:!1})?Xo(e,t,n,{strict:r}):Xa(e,t,n,{strict:r})}function Ya(e,t){if(typeof t=="number"&&t>0&&t>H(e)-1)throw new Ua({offset:t,position:"start",size:H(e)})}function Ja(e,t,n){if(typeof t=="number"&&typeof n=="number"&&H(e)!==n-t)throw new Ua({offset:n,position:"end",size:H(e)})}function Xa(e,t,n,{strict:r}={}){Ya(e,t);const a=e.slice(t,n);return r&&Ja(a,t,n),a}function Xo(e,t,n,{strict:r}={}){Ya(e,t);const a=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Ja(a,t,n),a}function it(e,t){if(e.length!==t.length)throw new ro({expectedLength:e.length,givenLength:t.length});const n=Qo({params:e,values:t}),r=lr(n);return r.length===0?"0x":r}function Qo({params:e,values:t}){const n=[];for(let r=0;r<e.length;r++)n.push(dr({param:e[r],value:t[r]}));return n}function dr({param:e,value:t}){const n=pr(e.type);if(n){const[r,a]=n;return tu(t,{length:r,param:{...e,type:a}})}if(e.type==="tuple")return iu(t,{param:e});if(e.type==="address")return eu(t);if(e.type==="bool")return ru(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const r=e.type.startsWith("int");return au(t,{signed:r})}if(e.type.startsWith("bytes"))return nu(t,{param:e});if(e.type==="string")return su(t);throw new uo(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function lr(e){let t=0;for(let s=0;s<e.length;s++){const{dynamic:i,encoded:o}=e[s];i?t+=32:t+=H(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(k(t+a,{size:32})),r.push(o),a+=H(o)):n.push(o)}return le([...n,...r])}function eu(e){if(!oe(e))throw new Me({address:e});return{dynamic:!1,encoded:de(e.toLowerCase())}}function tu(e,{length:t,param:n}){const r=t===null;if(!Array.isArray(e))throw new lo(e);if(!r&&e.length!==t)throw new to({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let a=!1;const s=[];for(let i=0;i<e.length;i++){const o=dr({param:n,value:e[i]});o.dynamic&&(a=!0),s.push(o)}if(r||a){const i=lr(s);if(r){const o=k(s.length,{size:32});return{dynamic:!0,encoded:s.length>0?le([o,i]):o}}if(a)return{dynamic:!0,encoded:i}}return{dynamic:!1,encoded:le(s.map(({encoded:i})=>i))}}function nu(e,{param:t}){const[,n]=t.type.split("bytes"),r=H(e);if(!n){let a=e;return r%32!==0&&(a=de(a,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:le([de(k(r,{size:32})),a])}}if(r!==Number.parseInt(n))throw new no({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:de(e,{dir:"right"})}}function ru(e){if(typeof e!="boolean")throw new v(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:de(Ha(e))}}function au(e,{signed:t}){return{dynamic:!1,encoded:k(e,{size:32,signed:t})}}function su(e){const t=ar(e),n=Math.ceil(H(t)/32),r=[];for(let a=0;a<n;a++)r.push(de(Kt(t,a*32,(a+1)*32),{dir:"right"}));return{dynamic:!0,encoded:le([de(k(H(t),{size:32})),...r])}}function iu(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=dr({param:s,value:e[i]});r.push(o),o.dynamic&&(n=!0)}return{dynamic:n,encoded:n?lr(r):le(r.map(({encoded:a})=>a))}}function pr(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const yr=e=>Kt(Za(e),0,4);function Rt(e){const{abi:t,args:n=[],name:r}=e,a=ie(r,{strict:!1}),s=t.filter(o=>a?o.type==="function"?yr(o)===r:o.type==="event"?ur(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,l)=>{const d="inputs"in o&&o.inputs[l];return d?Nn(c,d):!1})){if(i&&"inputs"in i&&i.inputs){const c=Qa(o.inputs,i.inputs,n);if(c)throw new io({abiItem:o,type:c[0]},{abiItem:i,type:c[1]})}i=o}}return i||s[0]}function Nn(e,t){const n=typeof e,r=t.type;switch(r){case"address":return oe(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)=>Nn(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=>Nn(a,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Qa(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 Qa(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")?oe(n[r],{strict:!1}):i.includes("address")&&i.includes("bytes")?oe(n[r],{strict:!1}):!1)return i}}const Xr="/docs/contract/encodeEventTopics";function Ot(e){var u;const{abi:t,eventName:n,args:r}=e;let a=t[0];if(n){const c=Rt({abi:t,name:n});if(!c)throw new Wr(n,{docsPath:Xr});a=c}if(a.type!=="event")throw new Wr(void 0,{docsPath:Xr});const s=Te(a),i=ur(s);let o=[];if(r&&"inputs"in a){const c=(u=a.inputs)==null?void 0:u.filter(d=>"indexed"in d&&d.indexed),l=Array.isArray(r)?r:Object.values(r).length>0?(c==null?void 0:c.map(d=>r[d.name]))??[]:[];l.length>0&&(o=(c==null?void 0:c.map((d,p)=>Array.isArray(l[p])?l[p].map((m,f)=>Qr({param:d,value:l[p][f]})):l[p]?Qr({param:d,value:l[p]}):null))??[])}return[i,...o]}function Qr({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return Z(Ie(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new yo(e.type);return it([e],[t])}function un(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 fr(e,t){const{address:n,abi:r,args:a,eventName:s,fromBlock:i,strict:o,toBlock:u}=t,c=un(e,{method:"eth_newFilter"}),l=s?Ot({abi:r,args:a,eventName:s}):void 0,d=await e.request({method:"eth_newFilter",params:[{address:n,fromBlock:typeof i=="bigint"?k(i):i,toBlock:typeof u=="bigint"?k(u):u,topics:l}]});return{abi:r,args:a,eventName:s,id:d,request:c(d),strict:!!o,type:"event"}}function ne(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const ea="/docs/contract/encodeFunctionData";function ou(e){const{abi:t,args:n,functionName:r}=e;let a=t[0];if(r){const s=Rt({abi:t,args:n,name:r});if(!s)throw new Vt(r,{docsPath:ea});a=s}if(a.type!=="function")throw new Vt(void 0,{docsPath:ea});return{abi:[a],functionName:yr(Te(a))}}function Oe(e){const{args:t}=e,{abi:n,functionName:r}=(()=>{var o;return e.abi.length===1&&((o=e.functionName)!=null&&o.startsWith("0x"))?e:ou(e)})(),a=n[0],s=r,i="inputs"in a&&a.inputs?it(a.inputs,t??[]):void 0;return cr([s,i??"0x"])}const es={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."},uu={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},cu={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};class ta extends v{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"NegativeOffsetError"})}}class ts extends v{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 du extends v{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 lu={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 du({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ts({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new ta({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 ta({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 ns(e,{recursiveReadLimit:t=8192}={}){const n=Object.create(lu);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function pu(e,t={}){typeof t.size<"u"&&fe(e,{size:t.size});const n=G(e,t);return Xe(n,t)}function yu(e,t={}){let n=e;if(typeof t.size<"u"&&(fe(n,{size:t.size}),n=an(n)),n.length>1||n[0]>1)throw new bo(n);return!!n[0]}function ge(e,t={}){typeof t.size<"u"&&fe(e,{size:t.size});const n=G(e,t);return Ae(n,t)}function fu(e,t={}){let n=e;return typeof t.size<"u"&&(fe(n,{size:t.size}),n=an(n,{dir:"right"})),new TextDecoder().decode(n)}function cn(e,t){const n=typeof t=="string"?He(t):t,r=ns(n);if(H(n)===0&&e.length>0)throw new nn;if(H(t)&&H(t)<32)throw new Na({data:typeof t=="string"?t:G(t),params:e,size:H(t)});let a=0;const s=[];for(let i=0;i<e.length;++i){const o=e[i];r.setPosition(a);const[u,c]=Ye(r,o,{staticPosition:0});a+=c,s.push(u)}return s}function Ye(e,t,{staticPosition:n}){const r=pr(t.type);if(r){const[a,s]=r;return bu(e,{...t,type:s},{length:a,staticPosition:n})}if(t.type==="tuple")return Tu(e,t,{staticPosition:n});if(t.type==="address")return mu(e);if(t.type==="bool")return hu(e);if(t.type.startsWith("bytes"))return gu(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return wu(e,t);if(t.type==="string")return vu(e,{staticPosition:n});throw new co(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const na=32,Dn=32;function mu(e){const t=e.readBytes(32);return[on(G(Xa(t,-20))),32]}function bu(e,t,{length:n,staticPosition:r}){if(!n){const i=ge(e.readBytes(Dn)),o=r+i,u=o+na;e.setPosition(o);const c=ge(e.readBytes(na)),l=ht(t);let d=0;const p=[];for(let m=0;m<c;++m){e.setPosition(u+(l?m*32:d));const[f,y]=Ye(e,t,{staticPosition:u});d+=y,p.push(f)}return e.setPosition(r+32),[p,32]}if(ht(t)){const i=ge(e.readBytes(Dn)),o=r+i,u=[];for(let c=0;c<n;++c){e.setPosition(o+c*32);const[l]=Ye(e,t,{staticPosition:o});u.push(l)}return e.setPosition(r+32),[u,32]}let a=0;const s=[];for(let i=0;i<n;++i){const[o,u]=Ye(e,t,{staticPosition:r+a});a+=u,s.push(o)}return[s,a]}function hu(e){return[yu(e.readBytes(32),{size:32}),32]}function gu(e,t,{staticPosition:n}){const[r,a]=t.type.split("bytes");if(!a){const i=ge(e.readBytes(32));e.setPosition(n+i);const o=ge(e.readBytes(32));if(o===0)return e.setPosition(n+32),["0x",32];const u=e.readBytes(o);return e.setPosition(n+32),[G(u),32]}return[G(e.readBytes(Number.parseInt(a),32)),32]}function wu(e,t){const n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),a=e.readBytes(32);return[r>48?pu(a,{signed:n}):ge(a,{signed:n}),32]}function Tu(e,t,{staticPosition:n}){const r=t.components.length===0||t.components.some(({name:i})=>!i),a=r?[]:{};let s=0;if(ht(t)){const i=ge(e.readBytes(Dn)),o=n+i;for(let u=0;u<t.components.length;++u){const c=t.components[u];e.setPosition(o+s);const[l,d]=Ye(e,c,{staticPosition:o});s+=d,a[r?u:c==null?void 0:c.name]=l}return e.setPosition(n+32),[a,32]}for(let i=0;i<t.components.length;++i){const o=t.components[i],[u,c]=Ye(e,o,{staticPosition:n});a[r?i:o==null?void 0:o.name]=u,s+=c}return[a,s]}function vu(e,{staticPosition:t}){const n=ge(e.readBytes(32)),r=t+n;e.setPosition(r);const a=ge(e.readBytes(32));if(a===0)return e.setPosition(t+32),["",32];const s=e.readBytes(a,32),i=fu(an(s));return e.setPosition(t+32),[i,32]}function ht(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(ht);const n=pr(e.type);return!!(n&&ht({...e,type:n[1]}))}function rs(e){const{abi:t,data:n}=e,r=Kt(n,0,4);if(r==="0x")throw new nn;const s=[...t||[],uu,cu].find(i=>i.type==="error"&&r===yr(Te(i)));if(!s)throw new Da(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:s,args:"inputs"in s&&s.inputs&&s.inputs.length>0?cn(s.inputs,Kt(n,4)):void 0,errorName:s.name}}const q=(e,t,n)=>JSON.stringify(e,(r,a)=>typeof a=="bigint"?a.toString():a,n);function as({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"?q(t[s]):t[s]}`).join(", ")})`}const xu={gwei:9,wei:18},Eu={ether:-9,wei:9};function ss(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 mr(e,t="wei"){return ss(e,xu[t])}function K(e,t="wei"){return ss(e,Eu[t])}class Pu extends v{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 Cu extends v{constructor(){super("state and stateDiff are set on the same account."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"StateAssignmentConflictError"})}}function ra(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
20
+ `,"")}function Au(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+=ra(r.state)),r.stateDiff&&(a+=` stateDiff:
26
+ `,a+=ra(r.stateDiff)),a},` State Override:
27
+ `).slice(0,-1)}function Ft(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 Iu extends v{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 Mu extends v{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Ft(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 Su extends v{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:l,to:d,value:p}){var f;const m=Ft({chain:a&&`${a==null?void 0:a.name} (id: ${a==null?void 0:a.id})`,from:n==null?void 0:n.address,to:d,value:typeof p<"u"&&`${mr(p)} ${((f=a==null?void 0:a.nativeCurrency)==null?void 0:f.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof o<"u"&&`${K(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${K(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${K(c)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Request Arguments:",m].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 is extends v{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 os extends v{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 aa extends v{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 us extends v{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:l,to:d,value:p,stateOverride:m}){var b;const f=n?ne(n):void 0;let y=Ft({from:f==null?void 0:f.address,to:d,value:typeof p<"u"&&`${mr(p)} ${((b=a==null?void 0:a.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof o<"u"&&`${K(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${K(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${K(c)} gwei`,nonce:l});m&&(y+=`
30
+ ${Au(m)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",y].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 Bu extends v{constructor(t,{abi:n,args:r,contractAddress:a,docsPath:s,functionName:i,sender:o}){const u=Rt({abi:n,args:r,name:i}),c=u?as({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,l=u?Te(u,{includeName:!0}):void 0,d=Ft({address:a&&Xi(a),function:l,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:",d].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 jn extends v{constructor({abi:t,data:n,functionName:r,message:a}){let s,i,o,u;if(n&&n!=="0x")try{i=rs({abi:t,data:n});const{abiItem:l,errorName:d,args:p}=i;if(d==="Error")u=p[0];else if(d==="Panic"){const[m]=p;u=es[m]}else{const m=l?Te(l,{includeName:!0}):void 0,f=l&&p?as({abiItem:l,args:p,includeFunctionName:!1,includeName:!1}):void 0;o=[m?`Error: ${m}`:"",f&&f!=="()"?` ${[...Array((d==null?void 0:d.length)??0).keys()].map(()=>" ").join("")}${f}`:""]}}catch(l){s=l}else a&&(u=a);let c;s instanceof Da&&(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 $u extends v{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 ku extends v{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 br extends v{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 Je extends v{constructor({body:t,details:n,headers:r,status:a,url:s}){super("HTTP request failed.",{details:n,metaMessages:[a&&`Status: ${a}`,`URL: ${tn(s)}`,t&&`Request body: ${q(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 cs extends v{constructor({body:t,error:n,url:r}){super("RPC Request failed.",{cause:n,details:n.message,metaMessages:[`URL: ${tn(r)}`,`Request body: ${q(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 sa extends v{constructor({body:t,url:n}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${tn(n)}`,`Request body: ${q(t)}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TimeoutError"})}}const Ru=-1;class Y extends v{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 cs?t.code:n??Ru}}class ot extends Y{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 gt extends Y{constructor(t){super(t,{code:gt.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(gt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class wt extends Y{constructor(t){super(t,{code:wt.code,shortMessage:"JSON is not a valid request object."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidRequestRpcError"})}}Object.defineProperty(wt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Tt extends Y{constructor(t){super(t,{code:Tt.code,shortMessage:"The method does not exist / is not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotFoundRpcError"})}}Object.defineProperty(Tt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class vt extends Y{constructor(t){super(t,{code:vt.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(vt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ze extends Y{constructor(t){super(t,{code:ze.code,shortMessage:"An internal error was received."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InternalRpcError"})}}Object.defineProperty(ze,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class _e extends Y{constructor(t){super(t,{code:_e.code,shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
33
+ `)}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidInputRpcError"})}}Object.defineProperty(_e,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class xt extends Y{constructor(t){super(t,{code:xt.code,shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(xt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Et extends Y{constructor(t){super(t,{code:Et.code,shortMessage:"Requested resource not available."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceUnavailableRpcError"})}}Object.defineProperty(Et,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class et extends Y{constructor(t){super(t,{code:et.code,shortMessage:"Transaction creation failed."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TransactionRejectedRpcError"})}}Object.defineProperty(et,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Pt extends Y{constructor(t){super(t,{code:Pt.code,shortMessage:"Method is not implemented."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MethodNotSupportedRpcError"})}}Object.defineProperty(Pt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class tt extends Y{constructor(t){super(t,{code:tt.code,shortMessage:"Request exceeds defined limit."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"LimitExceededRpcError"})}}Object.defineProperty(tt,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Ct extends Y{constructor(t){super(t,{code:Ct.code,shortMessage:"Version of JSON-RPC protocol is not supported."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"JsonRpcVersionUnsupportedError"})}}Object.defineProperty(Ct,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Ue extends ot{constructor(t){super(t,{code:Ue.code,shortMessage:"User rejected the request."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UserRejectedRequestError"})}}Object.defineProperty(Ue,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class At extends ot{constructor(t){super(t,{code:At.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(At,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class It extends ot{constructor(t){super(t,{code:It.code,shortMessage:"The Provider does not support the requested method."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnsupportedProviderMethodError"})}}Object.defineProperty(It,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Mt extends ot{constructor(t){super(t,{code:Mt.code,shortMessage:"The Provider is disconnected from all chains."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderDisconnectedError"})}}Object.defineProperty(Mt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class St extends ot{constructor(t){super(t,{code:St.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(St,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Bt extends ot{constructor(t){super(t,{code:Bt.code,shortMessage:"An error occurred when attempting to switch chain."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainError"})}}Object.defineProperty(Bt,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class Ou extends Y{constructor(t){super(t,{shortMessage:"An unknown RPC error occurred."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownRpcError"})}}const Fu=3;function $t(e,{abi:t,address:n,args:r,docsPath:a,functionName:s,sender:i}){const{code:o,data:u,message:c,shortMessage:l}=e instanceof br?e:e instanceof v?e.walk(p=>"data"in p)||e.walk():{},d=e instanceof nn?new $u({functionName:s}):[Fu,ze.code].includes(o)&&(u||c||l)?new jn({abi:t,data:typeof u=="object"?u.data:u,functionName:s,message:l??c}):e;return new Bu(d,{abi:t,args:r,contractAddress:n,docsPath:a,functionName:s,sender:i})}class Nu extends v{constructor(t,{account:n,docsPath:r,chain:a,data:s,gas:i,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:c,nonce:l,to:d,value:p}){var f;const m=Ft({from:n==null?void 0:n.address,to:d,value:typeof p<"u"&&`${mr(p)} ${((f=a==null?void 0:a.nativeCurrency)==null?void 0:f.symbol)||"ETH"}`,data:s,gas:i,gasPrice:typeof o<"u"&&`${K(o)} gwei`,maxFeePerGas:typeof u<"u"&&`${K(u)} gwei`,maxPriorityFeePerGas:typeof c<"u"&&`${K(c)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",m].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 Ke extends v{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(Ke,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(Ke,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class Yt extends v{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${K(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(Yt,"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 Un extends v{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${K(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(Un,"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 Ln extends v{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(Ln,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class Hn extends v{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(Hn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class zn extends v{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(zn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class _n extends v{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(_n,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds/});class qn extends v{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(qn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class Gn extends v{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(Gn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class Wn extends v{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(Wn,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class Jt extends v{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${K(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${K(r)} gwei`:""}).`].join(`
36
+ `),{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"TipAboveFeeCapError"})}}Object.defineProperty(Jt,"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 dn extends v{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 hr(e,t){const n=(e.details||"").toLowerCase(),r=e instanceof v?e.walk(a=>a.code===Ke.code):e;return r instanceof v?new Ke({cause:e,message:r.details}):Ke.nodeMessage.test(n)?new Ke({cause:e,message:e.details}):Yt.nodeMessage.test(n)?new Yt({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Un.nodeMessage.test(n)?new Un({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):Ln.nodeMessage.test(n)?new Ln({cause:e,nonce:t==null?void 0:t.nonce}):Hn.nodeMessage.test(n)?new Hn({cause:e,nonce:t==null?void 0:t.nonce}):zn.nodeMessage.test(n)?new zn({cause:e,nonce:t==null?void 0:t.nonce}):_n.nodeMessage.test(n)?new _n({cause:e}):qn.nodeMessage.test(n)?new qn({cause:e,gas:t==null?void 0:t.gas}):Gn.nodeMessage.test(n)?new Gn({cause:e,gas:t==null?void 0:t.gas}):Wn.nodeMessage.test(n)?new Wn({cause:e}):Jt.nodeMessage.test(n)?new Jt({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new dn({cause:e})}function Du(e,{docsPath:t,...n}){const r=(()=>{const a=hr(e,n);return a instanceof dn?e:a})();return new Nu(r,{docsPath:t,...n})}function gr(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 ju={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3"};function ln(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=>G(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=k(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=k(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=k(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=k(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=k(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=k(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=ju[e.type]),typeof e.value<"u"&&(t.value=k(e.value)),t}function ia(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 Uu(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=k(t)),n!==void 0&&(i.nonce=k(n)),r!==void 0&&(i.state=ia(r)),a!==void 0){if(i.state)throw new Cu;i.stateDiff=ia(a)}return i}function ds(e){if(!e)return;const t={};for(const{address:n,...r}of e){if(!oe(n,{strict:!1}))throw new Me({address:n});if(t[n])throw new Pu({address:n});t[n]=Uu(r)}return t}function Nt(e){const{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:a,to:s}=e,i=t?ne(t):void 0;if(i&&!oe(i.address))throw new Me({address:i.address});if(s&&!oe(s))throw new Me({address:s});if(typeof n<"u"&&(typeof r<"u"||typeof a<"u"))throw new Iu;if(r&&r>2n**256n-1n)throw new Yt({maxFeePerGas:r});if(a&&r&&a>r)throw new Jt({maxFeePerGas:r,maxPriorityFeePerGas:a})}class Lu extends v{constructor(){super("`baseFeeMultiplier` must be greater than 1."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseFeeScalarError"})}}class wr extends v{constructor(){super("Chain does not support EIP-1559 fees."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Eip1559FeesNotSupportedError"})}}class Hu extends v{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${K(t)} gwei).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"MaxFeePerGasTooLowError"})}}class ls extends v{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 ps={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844"};function ys(e){const t={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?Ae(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?Ae(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?ps[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 fs(e){var n;const t=(n=e.transactions)==null?void 0:n.map(r=>typeof r=="string"?r:ys(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 Se(e,{blockHash:t,blockNumber:n,blockTag:r,includeTransactions:a}={}){var l,d,p;const s=r??"latest",i=a??!1,o=n!==void 0?k(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 ls({blockHash:t,blockNumber:n});return(((p=(d=(l=e.chain)==null?void 0:l.formatters)==null?void 0:d.block)==null?void 0:p.format)||fs)(u)}async function Tr(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function zu(e,t){return ms(e,t)}async function ms(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,Se,"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 Xe(u)}catch{const[u,c]=await Promise.all([n?Promise.resolve(n):S(e,Se,"getBlock")({}),S(e,Tr,"getGasPrice")({})]);if(typeof u.baseFeePerGas!="bigint")throw new wr;const l=c-u.baseFeePerGas;return l<0n?0n:l}}async function _u(e,t){return Vn(e,t)}async function Vn(e,t){var p,m;const{block:n,chain:r=e.chain,request:a,type:s="eip1559"}=t||{},i=await(async()=>{var f,y;return typeof((f=r==null?void 0:r.fees)==null?void 0:f.baseFeeMultiplier)=="function"?r.fees.baseFeeMultiplier({block:n,client:e,request:a}):((y=r==null?void 0:r.fees)==null?void 0:y.baseFeeMultiplier)??1.2})();if(i<1)throw new Lu;const u=10**(((p=i.toString().split(".")[1])==null?void 0:p.length)??0),c=f=>f*BigInt(Math.ceil(i*u))/BigInt(u),l=n||await S(e,Se,"getBlock")({});if(typeof((m=r==null?void 0:r.fees)==null?void 0:m.estimateFeesPerGas)=="function"){const f=await r.fees.estimateFeesPerGas({block:n,client:e,multiply:c,request:a,type:s});if(f!==null)return f}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new wr;const f=typeof(a==null?void 0:a.maxPriorityFeePerGas)=="bigint"?a.maxPriorityFeePerGas:await ms(e,{block:l,chain:r,request:a}),y=c(l.baseFeePerGas);return{maxFeePerGas:(a==null?void 0:a.maxFeePerGas)??y+f,maxPriorityFeePerGas:f}}return{gasPrice:(a==null?void 0:a.gasPrice)??c(await S(e,Tr,"getGasPrice")({}))}}async function bs(e,{address:t,blockTag:n="latest",blockNumber:r}){const a=await e.request({method:"eth_getTransactionCount",params:[t,r?k(r):n]});return Ae(a)}function hs(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=>He(s)):e.blobs,a=[];for(const s of r)a.push(Uint8Array.from(t.blobToKzgCommitment(s)));return n==="bytes"?a:a.map(s=>G(s))}function gs(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=>He(i)):e.blobs,a=typeof e.commitments[0]=="string"?e.commitments.map(i=>He(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=>G(i))}function qu(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 Gu extends ir{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=En(this.buffer)}update(t){Qe(this);const{view:n,buffer:r,blockLen:a}=this;t=sn(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=En(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){Qe(this),za(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 d=i;d<a;d++)n[d]=0;qu(r,a-8,BigInt(this.length*8),s),this.process(r,0);const o=En(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=u/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<c;d++)o.setUint32(4*d,l[d],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 Wu=(e,t,n)=>e&t^~e&n,Vu=(e,t,n)=>e&t^e&n^t&n,Zu=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]),Pe=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ce=new Uint32Array(64);class Ku extends Gu{constructor(){super(64,32,8,!1),this.A=Pe[0]|0,this.B=Pe[1]|0,this.C=Pe[2]|0,this.D=Pe[3]|0,this.E=Pe[4]|0,this.F=Pe[5]|0,this.G=Pe[6]|0,this.H=Pe[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 d=0;d<16;d++,n+=4)Ce[d]=t.getUint32(n,!1);for(let d=16;d<64;d++){const p=Ce[d-15],m=Ce[d-2],f=ue(p,7)^ue(p,18)^p>>>3,y=ue(m,17)^ue(m,19)^m>>>10;Ce[d]=y+Ce[d-7]+f+Ce[d-16]|0}let{A:r,B:a,C:s,D:i,E:o,F:u,G:c,H:l}=this;for(let d=0;d<64;d++){const p=ue(o,6)^ue(o,11)^ue(o,25),m=l+p+Wu(o,u,c)+Zu[d]+Ce[d]|0,y=(ue(r,2)^ue(r,13)^ue(r,22))+Vu(r,a,s)|0;l=c,c=u,u=o,o=i+m|0,i=s,s=a,a=r,r=m+y|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,l=l+this.H|0,this.set(r,a,s,i,o,u,c,l)}roundClean(){Ce.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ws=qa(()=>new Ku);function Yu(e,t){return ws(ie(e,{strict:!1})?Ie(e):e)}function Ju(e){const{commitment:t,version:n=1}=e,r=e.to??(typeof t=="string"?"hex":"bytes"),a=Yu(t);return a.set([n],0),r==="bytes"?a:G(a)}function Xu(e){const{commitments:t,version:n}=e,r=e.to??(typeof t[0]=="string"?"hex":"bytes"),a=[];for(const s of t)a.push(Ju({commitment:s,to:r,version:n}));return a}const oa=6,Ts=32,vr=4096,vs=Ts*vr,ua=vs*oa-1-1*vr*oa;class Qu extends v{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 ec extends v{constructor(){super("Blob data must not be empty."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EmptyBlobError"})}}function tc(e){const t=e.to??(typeof e.data=="string"?"hex":"bytes"),n=typeof e.data=="string"?He(e.data):e.data,r=H(n);if(!r)throw new ec;if(r>ua)throw new Qu({maxSize:ua,size:r});const a=[];let s=!0,i=0;for(;s;){const o=ns(new Uint8Array(vs));let u=0;for(;u<vr;){const c=n.slice(i,i+(Ts-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=>G(o.bytes))}function nc(e){const{data:t,kzg:n,to:r}=e,a=e.blobs??tc({data:t,to:r}),s=e.commitments??hs({blobs:a,kzg:n,to:r}),i=e.proofs??gs({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 rc(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 Mu({transaction:e})}async function Dt(e){const t=await e.request({method:"eth_chainId"});return Ae(t)}const xs=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function pn(e,t){const{account:n=e.account,blobs:r,chain:a,chainId:s,gas:i,kzg:o,nonce:u,parameters:c=xs,type:l}=t,d=n?ne(n):void 0,p={...t,...d?{from:d==null?void 0:d.address}:{}};let m;async function f(){return m||(m=await S(e,Se,"getBlock")({blockTag:"latest"}),m)}if((c.includes("blobVersionedHashes")||c.includes("sidecars"))&&r&&o){const y=hs({blobs:r,kzg:o});if(c.includes("blobVersionedHashes")){const b=Xu({commitments:y,to:"hex"});p.blobVersionedHashes=b}if(c.includes("sidecars")){const b=gs({blobs:r,commitments:y,kzg:o}),h=nc({blobs:r,commitments:y,proofs:b,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,Dt,"getChainId")({})),c.includes("nonce")&&typeof u>"u"&&d&&(p.nonce=await S(e,bs,"getTransactionCount")({address:d.address,blockTag:"pending"})),(c.includes("fees")||c.includes("type"))&&typeof l>"u")try{p.type=rc(p)}catch{const y=await f();p.type=typeof(y==null?void 0:y.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 y=await f(),{maxFeePerGas:b,maxPriorityFeePerGas:h}=await Vn(e,{block:y,chain:a,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<h)throw new Hu({maxPriorityFeePerGas:h});p.maxPriorityFeePerGas=h,p.maxFeePerGas=b}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new wr;const y=await f(),{gasPrice:b}=await Vn(e,{block:y,chain:a,request:p,type:"legacy"});p.gasPrice=b}return c.includes("gas")&&typeof i>"u"&&(p.gas=await S(e,xr,"estimateGas")({...p,account:d?{address:d.address,type:"json-rpc"}:void 0})),Nt(p),delete p.parameters,p}async function xr(e,t){var a,s,i;const n=t.account??e.account,r=n?ne(n):void 0;try{const{accessList:o,blobs:u,blobVersionedHashes:c,blockNumber:l,blockTag:d,data:p,gas:m,gasPrice:f,maxFeePerBlobGas:y,maxFeePerGas:b,maxPriorityFeePerGas:h,nonce:g,to:w,value:x,stateOverride:P,...T}=await pn(e,{...t,parameters:(r==null?void 0:r.type)==="local"?void 0:["blobVersionedHashes"]}),E=(l?k(l):void 0)||d,M=ds(P);Nt(t);const B=(i=(s=(a=e.chain)==null?void 0:a.formatters)==null?void 0:s.transactionRequest)==null?void 0:i.format,N=(B||ln)({...gr(T,{format:B}),from:r==null?void 0:r.address,accessList:o,blobs:u,blobVersionedHashes:c,data:p,gas:m,gasPrice:f,maxFeePerBlobGas:y,maxFeePerGas:b,maxPriorityFeePerGas:h,nonce:g,to:w,value:x}),F=await e.request({method:"eth_estimateGas",params:M?[N,E??"latest",M]:E?[N,E]:[N]});return BigInt(F)}catch(o){throw Du(o,{...t,account:r,chain:e.chain})}}async function Es(e,t){const{abi:n,address:r,args:a,functionName:s,...i}=t,o=Oe({abi:n,args:a,functionName:s});try{return await S(e,xr,"estimateGas")({data:o,to:r,...i})}catch(u){const c=i.account?ne(i.account):void 0;throw $t(u,{abi:n,address:r,args:a,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:c==null?void 0:c.address})}}const ca="/docs/contract/decodeEventLog";function Er(e){const{abi:t,data:n,strict:r,topics:a}=e,s=r??!0,[i,...o]=a;if(!i)throw new ao({docsPath:ca});const u=t.find(y=>y.type==="event"&&i===ur(Te(y)));if(!(u&&"name"in u)||u.type!=="event")throw new ja(i,{docsPath:ca});const{name:c,inputs:l}=u,d=l==null?void 0:l.some(y=>!("name"in y&&y.name));let p=d?[]:{};const m=l.filter(y=>"indexed"in y&&y.indexed);for(let y=0;y<m.length;y++){const b=m[y],h=o[y];if(!h)throw new rn({abiItem:u,param:b});p[d?y:b.name||y]=ac({param:b,value:h})}const f=l.filter(y=>!("indexed"in y&&y.indexed));if(f.length>0){if(n&&n!=="0x")try{const y=cn(f,n);if(y)if(d)p=[...p,...y];else for(let b=0;b<f.length;b++)p[f[b].name]=y[b]}catch(y){if(s)throw y instanceof Na||y instanceof ts?new bt({abiItem:u,data:n,params:f,size:H(n)}):y}else if(s)throw new bt({abiItem:u,data:"0x",params:f,size:0})}return{eventName:c,args:Object.values(p).length>0?p:void 0}}function ac({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(cn([e],t)||[])[0]}function Pr({abi:e,eventName:t,logs:n,strict:r=!0}){return n.map(a=>{var s;try{const i=Er({...a,abi:e,strict:r});return t&&!t.includes(i.eventName)?null:{...i,...a}}catch(i){let o,u;if(i instanceof ja)return null;if(i instanceof bt||i instanceof rn){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 Be(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 Cr(e,{address:t,blockHash:n,fromBlock:r,toBlock:a,event:s,events:i,args:o,strict:u}={}){const c=u??!1,l=i??(s?[s]:void 0);let d=[];l&&(d=[l.flatMap(f=>Ot({abi:[f],eventName:f.name,args:o}))],s&&(d=d[0]));let p;n?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,blockHash:n}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:d,fromBlock:typeof r=="bigint"?k(r):r,toBlock:typeof a=="bigint"?k(a):a}]});const m=p.map(f=>Be(f));return l?Pr({abi:l,logs:m,strict:c}):m}async function Ar(e,t){const{abi:n,address:r,args:a,blockHash:s,eventName:i,fromBlock:o,toBlock:u,strict:c}=t,l=i?Rt({abi:n,name:i}):void 0,d=l?void 0:n.filter(p=>p.type==="event");return S(e,Cr,"getLogs")({address:r,args:a,blockHash:s,event:l,events:d,fromBlock:o,toBlock:u,strict:c})}const An="/docs/contract/decodeFunctionResult";function ut(e){const{abi:t,args:n,functionName:r,data:a}=e;let s=t[0];if(r){const o=Rt({abi:t,args:n,name:r});if(!o)throw new Vt(r,{docsPath:An});s=o}if(s.type!=="function")throw new Vt(void 0,{docsPath:An});if(!s.outputs)throw new so(s.name,{docsPath:An});const i=cn(s.outputs,a);if(i&&i.length>1)return i;if(i&&i.length===1)return i[0]}const Zn=[{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"}],Ps=[{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"}],Cs=[...Ps,{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"}]}],sc=[...Ps,{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"}]}],da=[{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"}]}],ic=[{inputs:[{internalType:"address",name:"_signer",type:"address"},{internalType:"bytes32",name:"_hash",type:"bytes32"},{internalType:"bytes",name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"}],oc="0x82ad56cb",uc="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",cc="0x60806040523480156200001157600080fd5b50604051620007003803806200070083398101604081905262000034916200056f565b6000620000438484846200004f565b9050806000526001601ff35b600080846001600160a01b0316803b806020016040519081016040528181526000908060200190933c90507f6492649264926492649264926492649264926492649264926492649264926492620000a68462000451565b036200021f57600060608085806020019051810190620000c79190620005ce565b8651929550909350915060000362000192576000836001600160a01b031683604051620000f5919062000643565b6000604051808303816000865af19150503d806000811462000134576040519150601f19603f3d011682016040523d82523d6000602084013e62000139565b606091505b5050905080620001905760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b505b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90620001c4908b90869060040162000661565b602060405180830381865afa158015620001e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200020891906200069d565b6001600160e01b031916149450505050506200044a565b805115620002b157604051630b135d3f60e11b808252906001600160a01b03871690631626ba7e9062000259908890889060040162000661565b602060405180830381865afa15801562000277573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200029d91906200069d565b6001600160e01b031916149150506200044a565b8251604114620003195760405162461bcd60e51b815260206004820152603a6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e677468000000000000606482015260840162000187565b620003236200046b565b506020830151604080850151855186939260009185919081106200034b576200034b620006c9565b016020015160f81c9050601b81148015906200036b57508060ff16601c14155b15620003cf5760405162461bcd60e51b815260206004820152603b6024820152600080516020620006e083398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c75650000000000606482015260840162000187565b6040805160008152602081018083528a905260ff83169181019190915260608101849052608081018390526001600160a01b038a169060019060a0016020604051602081039080840390855afa1580156200042e573d6000803e3d6000fd5b505050602060405103516001600160a01b031614955050505050505b9392505050565b60006020825110156200046357600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b03811681146200049f57600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004d5578181015183820152602001620004bb565b50506000910152565b600082601f830112620004f057600080fd5b81516001600160401b03808211156200050d576200050d620004a2565b604051601f8301601f19908116603f01168101908282118183101715620005385762000538620004a2565b816040528381528660208588010111156200055257600080fd5b62000565846020830160208901620004b8565b9695505050505050565b6000806000606084860312156200058557600080fd5b8351620005928162000489565b6020850151604086015191945092506001600160401b03811115620005b657600080fd5b620005c486828701620004de565b9150509250925092565b600080600060608486031215620005e457600080fd5b8351620005f18162000489565b60208501519093506001600160401b03808211156200060f57600080fd5b6200061d87838801620004de565b935060408601519150808211156200063457600080fd5b50620005c486828701620004de565b6000825162000657818460208701620004b8565b9190910192915050565b828152604060208201526000825180604084015262000688816060850160208701620004b8565b601f01601f1916919091016060019392505050565b600060208284031215620006b057600080fd5b81516001600160e01b0319811681146200044a57600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572";class Kn extends v{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 dc extends v{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 lc extends v{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 As extends v{constructor(){super("No chain was provided to the Client."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ClientChainNotConfiguredError"})}}const In="/docs/contract/encodeDeployData";function Ir(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 eo({docsPath:In});if(!("inputs"in a))throw new Gr({docsPath:In});if(!a.inputs||a.inputs.length===0)throw new Gr({docsPath:In});const s=it(a.inputs,n);return cr([r,s])}function ct({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 Kn({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new Kn({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}function pc(e,{docsPath:t,...n}){const r=(()=>{const a=hr(e,n);return a instanceof dn?e:a})();return new us(r,{docsPath:t,...n})}const Mn=new Map;function Is({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:a}){const s=async()=>{const l=u();i();const d=l.map(({args:p})=>p);d.length!==0&&e(d).then(p=>{var m;a&&Array.isArray(p)&&p.sort(a);for(let f=0;f<l.length;f++){const{pendingPromise:y}=l[f];(m=y.resolve)==null||m.call(y,[p[f],p])}}).catch(p=>{var m;for(let f=0;f<l.length;f++){const{pendingPromise:y}=l[f];(m=y.reject)==null||m.call(y,p)}})},i=()=>Mn.delete(t),o=()=>u().map(({args:l})=>l),u=()=>Mn.get(t)||[],c=l=>Mn.set(t,[...u(),l]);return{flush:i,async schedule(l){const d={},p=new Promise((y,b)=>{d.resolve=y,d.reject=b});return(n==null?void 0:n([...o(),l]))&&s(),u().length>0?(c({args:l,pendingPromise:d}),p):(c({args:l,pendingPromise:d}),setTimeout(s,r),p)}}}async function jt(e,t){var E,M,B,$;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:l,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:f,maxPriorityFeePerGas:y,nonce:b,to:h,value:g,stateOverride:w,...x}=t,P=n?ne(n):void 0,T=c&&l&&h&&u,C=T?mc({data:u,factory:c,factoryData:l,to:h}):u;try{Nt(t);const F=(a?k(a):void 0)||s,W=ds(w),A=($=(B=(M=e.chain)==null?void 0:M.formatters)==null?void 0:B.transactionRequest)==null?void 0:$.format,O=(A||ln)({...gr(x,{format:A}),from:P==null?void 0:P.address,accessList:i,blobs:o,data:C,gas:d,gasPrice:p,maxFeePerBlobGas:m,maxFeePerGas:f,maxPriorityFeePerGas:y,nonce:b,to:T?void 0:h,value:g});if(r&&yc({request:O})&&!W)try{return await fc(e,{...O,blockNumber:a,blockTag:s})}catch(D){if(!(D instanceof As)&&!(D instanceof Kn))throw D}const j=await e.request({method:"eth_call",params:W?[O,F,W]:[O,F]});return j==="0x"?{data:void 0}:{data:j}}catch(N){const F=bc(N),{offchainLookup:W,offchainLookupSignature:A}=await Promise.resolve().then(()=>require("./ccip-DNUqn1xf.cjs"));if(e.ccipRead!==!1&&(F==null?void 0:F.slice(0,10))===A&&h)return{data:await W(e,{data:F,to:h})};throw T&&(F==null?void 0:F.slice(0,10))==="0x101bb98d"?new ku({factory:c}):pc(N,{...t,account:P,chain:e.chain})}}function yc({request:e}){const{data:t,to:n,...r}=e;return!(!t||t.startsWith(oc)||!n||Object.values(r).filter(a=>typeof a<"u").length>0)}async function fc(e,t){var y;const{batchSize:n=1024,wait:r=0}=typeof((y=e.batch)==null?void 0:y.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 As;c=ct({blockNumber:a,chain:e.chain,contract:"multicall3"})}const d=(a?k(a):void 0)||s,{schedule:p}=Is({id:`${e.uid}.${d}`,wait:r,shouldSplitBatch(b){return b.reduce((g,{data:w})=>g+(w.length-2),0)>n*2},fn:async b=>{const h=b.map(x=>({allowFailure:!0,callData:x.data,target:x.to})),g=Oe({abi:Zn,args:[h],functionName:"aggregate3"}),w=await e.request({method:"eth_call",params:[{data:g,to:c},d]});return ut({abi:Zn,args:[h],functionName:"aggregate3",data:w||"0x"})}}),[{returnData:m,success:f}]=await p({data:i,to:u});if(!f)throw new br({data:m});return m==="0x"?{data:void 0}:{data:m}}function mc(e){const{data:t,factory:n,factoryData:r,to:a}=e;return Ir({abi:Ki(["error CounterfactualDeployFailed(bytes)","constructor(address, bytes, address, bytes)"]),bytecode:uc,args:[a,t,n,r]})}function bc(e){var n;if(!(e instanceof v))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 pe(e,t){const{abi:n,address:r,args:a,functionName:s,...i}=t,o=Oe({abi:n,args:a,functionName:s});try{const{data:u}=await S(e,jt,"call")({...i,data:o,to:r});return ut({abi:n,args:a,functionName:s,data:u||"0x"})}catch(u){throw $t(u,{abi:n,address:r,args:a,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ms(e,t){const{abi:n,address:r,args:a,dataSuffix:s,functionName:i,...o}=t,u=o.account?ne(o.account):e.account,c=Oe({abi:n,args:a,functionName:i});try{const{data:l}=await S(e,jt,"call")({batch:!1,data:`${c}${s?s.replace("0x",""):""}`,to:r,...o,account:u}),d=ut({abi:n,args:a,functionName:i,data:l||"0x"}),p=n.filter(m=>"name"in m&&m.name===t.functionName);return{result:d,request:{abi:p,address:r,args:a,dataSuffix:s,functionName:i,...o,account:u}}}catch(l){throw $t(l,{abi:n,address:r,args:a,docsPath:"/docs/contract/simulateContract",functionName:i,sender:u==null?void 0:u.address})}}const Sn=new Map,pa=new Map;let hc=0;function $e(e,t,n){const r=++hc,a=()=>Sn.get(e)||[],s=()=>{const l=a();Sn.set(e,l.filter(d=>d.id!==r))},i=()=>{const l=pa.get(e);a().length===1&&l&&l(),s()},o=a();if(Sn.set(e,[...o,{id:r,fns:t}]),o&&o.length>0)return i;const u={};for(const l in t)u[l]=(...d)=>{var m,f;const p=a();if(p.length!==0)for(const y of p)(f=(m=y.fns)[l])==null||f.call(m,...d)};const c=n(u);return typeof c=="function"&&pa.set(e,c),i}async function Xt(e){return new Promise(t=>setTimeout(t,e))}function Ut(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 Xt(u);const c=async()=>{a&&(await e({unpoll:s}),await Xt(r),c())};c()})(),s}const gc=new Map,wc=new Map;function Tc(e){const t=(a,s)=>({clear:()=>s.delete(a),get:()=>s.get(a),set:i=>s.set(a,i)}),n=t(e,gc),r=t(e,wc);return{clear:()=>{n.clear(),r.clear()},promise:n,response:r}}async function vc(e,{cacheKey:t,cacheTime:n=Number.POSITIVE_INFINITY}){const r=Tc(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 xc=e=>`blockNumber.${e}`;async function Lt(e,{cacheTime:t=e.cacheTime}={}){const n=await vc(()=>e.request({method:"eth_blockNumber"}),{cacheKey:xc(e.uid),cacheTime:t});return BigInt(n)}async function yn(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=>Be(s));return!("abi"in t)||!t.abi?a:Pr({abi:t.abi,logs:a,strict:n})}async function fn(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Ss(e,t){const{abi:n,address:r,args:a,batch:s=!0,eventName:i,fromBlock:o,onError:u,onLogs:c,poll:l,pollingInterval:d=e.pollingInterval,strict:p}=t;return(typeof l<"u"?l:typeof o=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket"))?(()=>{const b=p??!1,h=q(["watchContractEvent",r,a,s,e.uid,i,d,b,o]);return $e(h,{onLogs:c,onError:u},g=>{let w;o!==void 0&&(w=o-1n);let x,P=!1;const T=Ut(async()=>{var C;if(!P){try{x=await S(e,fr,"createContractEventFilter")({abi:n,address:r,args:a,eventName:i,strict:b,fromBlock:o})}catch{}P=!0;return}try{let E;if(x)E=await S(e,yn,"getFilterChanges")({filter:x});else{const M=await S(e,Lt,"getBlockNumber")({});w&&w!==M?E=await S(e,Ar,"getContractEvents")({abi:n,address:r,args:a,eventName:i,fromBlock:w+1n,toBlock:M,strict:b}):E=[],w=M}if(E.length===0)return;if(s)g.onLogs(E);else for(const M of E)g.onLogs([M])}catch(E){x&&E instanceof _e&&(P=!1),(C=g.onError)==null||C.call(g,E)}},{emitOnBegin:!0,interval:d});return async()=>{x&&await S(e,fn,"uninstallFilter")({filter:x}),T()}})})():(()=>{const b=p??!1,h=q(["watchContractEvent",r,a,s,e.uid,i,d,b]);let g=!0,w=()=>g=!1;return $e(h,{onLogs:c,onError:u},x=>((async()=>{try{const P=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(M=>M.config.type==="webSocket");return E?E.value:e.transport}return e.transport})(),T=i?Ot({abi:n,eventName:i,args:a}):[],{unsubscribe:C}=await P.subscribe({params:["logs",{address:r,topics:T}],onData(E){var B;if(!g)return;const M=E.result;try{const{eventName:$,args:N}=Er({abi:n,data:M.data,topics:M.topics,strict:p}),F=Be(M,{args:N,eventName:$});x.onLogs([F])}catch($){let N,F;if($ instanceof bt||$ instanceof rn){if(p)return;N=$.abiItem.name,F=(B=$.abiItem.inputs)==null?void 0:B.some(A=>!("name"in A&&A.name))}const W=Be(M,{args:F?[]:{},eventName:N});x.onLogs([W])}},onError(E){var M;(M=x.onError)==null||M.call(x,E)}});w=C,g||w()}catch(P){u==null||u(P)}})(),()=>w()))})()}class mn extends v{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 Bs({chain:e,currentChainId:t}){if(!e)throw new lc;if(t!==e.id)throw new dc({chain:e,currentChainId:t})}function Ec(e,{docsPath:t,...n}){const r=(()=>{const a=hr(e,n);return a instanceof dn?e:a})();return new Su(r,{docsPath:t,...n})}async function Mr(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}async function Sr(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:l,maxPriorityFeePerGas:d,nonce:p,to:m,value:f,...y}=t;if(!n)throw new mn({docsPath:"/docs/actions/wallet/sendTransaction"});const b=ne(n);try{Nt(t);let P;if(r!==null&&(P=await S(e,Dt,"getChainId")({}),Bs({currentChainId:P,chain:r})),b.type==="local"){const M=await S(e,pn,"prepareTransactionRequest")({account:b,accessList:a,blobs:s,chain:r,chainId:P,data:i,gas:o,gasPrice:u,maxFeePerBlobGas:c,maxFeePerGas:l,maxPriorityFeePerGas:d,nonce:p,parameters:[...xs,"sidecars"],to:m,value:f,...y}),B=(h=r==null?void 0:r.serializers)==null?void 0:h.transaction,$=await b.signTransaction(M,{serializer:B});return await S(e,Mr,"sendRawTransaction")({serializedTransaction:$})}const T=(x=(w=(g=e.chain)==null?void 0:g.formatters)==null?void 0:w.transactionRequest)==null?void 0:x.format,E=(T||ln)({...gr(y,{format:T}),accessList:a,blobs:s,data:i,from:b.address,gas:o,gasPrice:u,maxFeePerBlobGas:c,maxFeePerGas:l,maxPriorityFeePerGas:d,nonce:p,to:m,value:f});return await e.request({method:"eth_sendTransaction",params:[E]},{retryCount:0})}catch(P){throw Ec(P,{...t,account:b,chain:t.chain||void 0})}}async function $s(e,t){const{abi:n,address:r,args:a,dataSuffix:s,functionName:i,...o}=t,u=Oe({abi:n,args:a,functionName:i});return S(e,Sr,"sendTransaction")({data:`${u}${s?s.replace("0x",""):""}`,to:r,...o})}function dt({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,l=!1,d=!1;for(const p of e)if(p.type==="function"?p.stateMutability==="view"||p.stateMutability==="pure"?c=!0:l=!0:p.type==="event"&&(d=!0),c&&l&&d)break;return i&&(c&&(u.read=new Proxy({},{get(p,m){return(...f)=>{const{args:y,options:b}=_t(f);return S(a,pe,"readContract")({abi:e,address:t,functionName:m,args:y,...b})}}})),l&&(u.simulate=new Proxy({},{get(p,m){return(...f)=>{const{args:y,options:b}=_t(f);return S(a,Ms,"simulateContract")({abi:e,address:t,functionName:m,args:y,...b})}}})),d&&(u.createEventFilter=new Proxy({},{get(p,m){return(...f)=>{const y=e.find(g=>g.type==="event"&&g.name===m),{args:b,options:h}=Bn(f,y);return S(a,fr,"createContractEventFilter")({abi:e,address:t,eventName:m,args:b,...h})}}}),u.getEvents=new Proxy({},{get(p,m){return(...f)=>{const y=e.find(g=>g.type==="event"&&g.name===m),{args:b,options:h}=Bn(f,y);return S(a,Ar,"getContractEvents")({abi:e,address:t,eventName:m,args:b,...h})}}}),u.watchEvent=new Proxy({},{get(p,m){return(...f)=>{const y=e.find(g=>g.type==="event"&&g.name===m),{args:b,options:h}=Bn(f,y);return S(a,Ss,"watchContractEvent")({abi:e,address:t,eventName:m,args:b,...h})}}}))),o&&l&&(u.write=new Proxy({},{get(p,m){return(...f)=>{const{args:y,options:b}=_t(f);return S(s,$s,"writeContract")({abi:e,address:t,functionName:m,args:y,...b})}}})),(i||o)&&l&&(u.estimateGas=new Proxy({},{get(p,m){return(...f)=>{const{args:y,options:b}=_t(f);return S(a??s,Es,"estimateContractGas")({abi:e,address:t,functionName:m,args:y,...b,account:b.account??s.account})}}})),u.address=t,u.abi=e,u}function _t(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 Bn(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 Pc extends v{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 Cc(e,t){const{address:n,factory:r,factoryData:a}=t;try{const[s,i,o,u,c,l,d]=await S(e,pe,"readContract")({abi:Ac,address:n,functionName:"eip712Domain",factory:r,factoryData:a});return{domain:{name:i,version:o,chainId:Number(u),verifyingContract:c,salt:l},extensions:d,fields:s}}catch(s){const i=s;throw i.name==="ContractFunctionExecutionError"&&i.cause.name==="ContractFunctionZeroDataError"?new Pc({address:n}):i}}const Ac=[{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 Ic(e,{chain:t}){const{id:n,name:r,nativeCurrency:a,rpcUrls:s,blockExplorers:i}=t;await e.request({method:"wallet_addEthereumChain",params:[{chainId:k(n),chainName:r,nativeCurrency:a,rpcUrls:s.default.http,blockExplorerUrls:i?Object.values(i).map(({url:o})=>o):void 0}]},{retryCount:0})}const Yn=256;let qt=Yn,Gt;function Mc(e=11){if(!Gt||qt+e>Yn*2){Gt="",qt=0;for(let t=0;t<Yn;t++)Gt+=(256+Math.random()*256|0).toString(16).substring(1)}return Gt.substring(qt,qt+++e)}function ks(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?ne(e.account):void 0,{config:l,request:d,value:p}=e.transport({chain:u,pollingInterval:i}),m={...l,...p},f={account:c,batch:t,cacheTime:n,ccipRead:r,chain:u,key:a,name:s,pollingInterval:i,request:d,transport:m,type:o,uid:Mc()};function y(b){return h=>{const g=h(b);for(const x in f)delete g[x];const w={...b,...g};return Object.assign(w,{extend:y(w)})}}return Object.assign(f,{extend:y(f)})}function Jn(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 l=typeof t=="function"?t({count:o,error:c}):t;l&&await Xt(l),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 Sc(e,t={}){return async(n,r={})=>{const{retryDelay:a=150,retryCount:s=3}={...t,...r};return Jn(async()=>{try{return await e(n)}catch(i){const o=i;switch(o.code){case gt.code:throw new gt(o);case wt.code:throw new wt(o);case Tt.code:throw new Tt(o);case vt.code:throw new vt(o);case ze.code:throw new ze(o);case _e.code:throw new _e(o);case xt.code:throw new xt(o);case Et.code:throw new Et(o);case et.code:throw new et(o);case Pt.code:throw new Pt(o);case tt.code:throw new tt(o);case Ct.code:throw new Ct(o);case Ue.code:throw new Ue(o);case At.code:throw new At(o);case It.code:throw new It(o);case Mt.code:throw new Mt(o);case St.code:throw new St(o);case Bt.code:throw new Bt(o);case 5e3:throw new Ue(o);default:throw i instanceof v?i:new Ou(o)}}},{delay:({count:i,error:o})=>{var u;if(o&&o instanceof Je){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})=>Bc(i)})}}function Bc(e){return"code"in e&&typeof e.code=="number"?e.code===-1||e.code===tt.code||e.code===ze.code:e instanceof Je&&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:Sc(n,{retryCount:r,retryDelay:a}),value:o}}function $c(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 kc(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,...l})=>{let d=e,p=()=>{};const m=Br({key:n,name:r,async request({method:f,params:y}){const b=async(h=0)=>{const g=d[h]({...l,chain:o,retryCount:0,timeout:c});try{const w=await g.request({method:f,params:y});return p({method:f,params:y,response:w,transport:g,status:"success"}),w}catch(w){if(p({error:w,method:f,params:y,transport:g,status:"error"}),Rc(w)||h===d.length-1)throw w;return b(h+1)}};return b()},retryCount:s,retryDelay:i,type:"fallback"},{onResponse:f=>p=f,transports:d.map(f=>f({chain:o,retryCount:0}))});if(a){const f=typeof a=="object"?a:{};Oc({chain:o,interval:f.interval??u,onTransports:y=>d=y,sampleCount:f.sampleCount,timeout:f.timeout,transports:d,weights:f.weights})}return m}}function Rc(e){return"code"in e&&typeof e.code=="number"&&(e.code===et.code||e.code===Ue.code||e.code===5e3)}function Oc({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=[],l=async()=>{const d=await Promise.all(s.map(async f=>{const y=f({chain:e,retryCount:0,timeout:a}),b=Date.now();let h,g;try{await y.request({method:"net_listening"}),g=1}catch{g=0}finally{h=Date.now()}return{latency:h-b,success:g}}));c.push(d),c.length>r&&c.shift();const p=Math.max(...c.map(f=>Math.max(...f.map(({latency:y})=>y)))),m=s.map((f,y)=>{const b=c.map(P=>P[y].latency),g=1-b.reduce((P,T)=>P+T,0)/b.length/p,w=c.map(P=>P[y].success),x=w.reduce((P,T)=>P+T,0)/w.length;return x===0?[0,y]:[u*g+o*x,y]}).sort((f,y)=>y[0]-f[0]);n(m.map(([,f])=>s[f])),await Xt(t),l()};l()}class Fc extends v{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro"})}}function Nc(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 Dc(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const ya=Dc();function jc(e,t={}){return{async request(n){var d;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:l}=o;try{const p=await Nc(async({signal:f})=>{const y={...o,body:Array.isArray(r)?q(r.map(g=>({jsonrpc:"2.0",id:g.id??ya.take(),...g}))):q({jsonrpc:"2.0",id:r.id??ya.take(),...r}),headers:{...u,"Content-Type":"application/json"},method:c||"POST",signal:l||(i>0?f:null)},b=new Request(e,y);return a&&await a(b),await fetch(e,y)},{errorInstance:new sa({body:r,url:e}),timeout:i,signal:!0});s&&await s(p);let m;if((d=p.headers.get("Content-Type"))!=null&&d.startsWith("application/json")?m=await p.json():(m=await p.text(),m=JSON.parse(m||"{}")),!p.ok)throw new Je({body:r,details:q(m.error)||p.statusText,headers:p.headers,status:p.status,url:e});return m}catch(p){throw p instanceof Je||p instanceof sa?p:new Je({body:r,details:p.message,url:e})}}}}function Xn(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:l,timeout:d})=>{const{batchSize:p=1e3,wait:m=0}=typeof n=="object"?n:{},f=t.retryCount??l,y=d??t.timeout??1e4,b=e||(c==null?void 0:c.rpcUrls.default.http[0]);if(!b)throw new Fc;const h=jc(b,{fetchOptions:r,onRequest:i,onResponse:o,timeout:y});return Br({key:a,name:s,async request({method:g,params:w}){const x={method:g,params:w},{schedule:P}=Is({id:b,wait:m,shouldSplitBatch(M){return M.length>p},fn:M=>h.request({body:M}),sort:(M,B)=>M.id-B.id}),T=async M=>n?P(M):[await h.request({body:M})],[{error:C,result:E}]=await T(x);if(C)throw new cs({body:x,error:C,url:b});return E},retryCount:f,retryDelay:u,timeout:y,type:"http"},{fetchOptions:r,url:b})}}function $r(e,t){var r,a,s,i,o,u;if(!(e instanceof v))return!1;const n=e.walk(c=>c instanceof jn);return n instanceof jn?!!(((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===es[50]):!1}function Rs(e){if(e.length!==66||e.indexOf("[")!==0||e.indexOf("]")!==65)return null;const t=`0x${e.slice(1,65)}`;return ie(t)?t:null}function Wt(e){let t=new Uint8Array(32).fill(0);if(!e)return G(t);const n=e.split(".");for(let r=n.length-1;r>=0;r-=1){const a=Rs(n[r]),s=a?Ie(a):Z(he(n[r]),"bytes");t=Z(le([t,s]),"bytes")}return G(t)}function Uc(e){return`[${e.slice(2)}]`}function Lc(e){const t=new Uint8Array(32).fill(0);return e?Rs(e)||Z(he(e)):G(t)}function bn(e){const t=e.replace(/^\.|\.$/gm,"");if(t.length===0)return new Uint8Array(1);const n=new Uint8Array(he(t).byteLength+2);let r=0;const a=t.split(".");for(let s=0;s<a.length;s++){let i=he(a[s]);i.byteLength>255&&(i=he(Uc(Lc(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 Hc(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=ct({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const c=Oe({abi:la,functionName:"addr",...r!=null?{args:[Wt(a),BigInt(r)]}:{args:[Wt(a)]}}),l={address:u,abi:Cs,functionName:"resolve",args:[Re(bn(a)),c],blockNumber:t,blockTag:n},d=S(e,pe,"readContract"),p=s?await d({...l,args:[...l.args,s]}):await d(l);if(p[0]==="0x")return null;const m=ut({abi:la,args:r!=null?[Wt(a),BigInt(r)]:void 0,functionName:"addr",data:p[0]});return m==="0x"||an(m)==="0x00"?null:m}catch(c){if(i)throw c;if($r(c,"resolve"))return null;throw c}}class zc extends v{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 ft extends v{constructor({reason:t}){super(`ENS NFT avatar URI is invalid. ${t}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"EnsAvatarInvalidNftUriError"})}}class kr extends v{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 _c extends v{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 qc=/(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,Gc=/^(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>\/.*)?$/,Wc=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,Vc=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function Zc(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 Os({uri:e,gatewayUrls:t}){const n=Wc.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(qc),{protocol:i,subpath:o,target:u,subtarget:c=""}=(s==null?void 0:s.groups)||{},l=i==="ipns:/"||o==="ipns/",d=i==="ipfs:/"||o==="ipfs/"||Gc.test(e);if(e.startsWith("http")&&!l&&!d){let m=e;return t!=null&&t.arweave&&(m=e.replace(/https:\/\/arweave.net/g,t==null?void 0:t.arweave)),{uri:m,isOnChain:!1,isEncoded:!1}}if((l||d)&&u)return{uri:`${r}/${l?"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(Vc,"");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 kr({uri:e})}function Fs(e){if(typeof e!="object"||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new zc({data:e});return e.image||e.image_url||e.image_data}async function Kc({gatewayUrls:e,uri:t}){try{const n=await fetch(t).then(a=>a.json());return await Rr({gatewayUrls:e,uri:Fs(n)})}catch{throw new kr({uri:t})}}async function Rr({gatewayUrls:e,uri:t}){const{uri:n,isOnChain:r}=Os({uri:t,gatewayUrls:e});if(r||await Zc(n))return n;throw new kr({uri:t})}function Yc(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 ft({reason:"Only EIP-155 supported"});if(!i)throw new ft({reason:"Chain ID not found"});if(!u)throw new ft({reason:"Contract address not found"});if(!a)throw new ft({reason:"Token ID not found"});if(!o)throw new ft({reason:"ERC namespace not found"});return{chainID:Number.parseInt(i),namespace:o.toLowerCase(),contractAddress:u,tokenID:a}}async function Jc(e,{nft:t}){if(t.namespace==="erc721")return pe(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 pe(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 _c({namespace:t.namespace})}async function Xc(e,{gatewayUrls:t,record:n}){return/eip155:/i.test(n)?Qc(e,{gatewayUrls:t,record:n}):Rr({uri:n,gatewayUrls:t})}async function Qc(e,{gatewayUrls:t,record:n}){const r=Yc(n),a=await Jc(e,{nft:r}),{uri:s,isOnChain:i,isEncoded:o}=Os({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,l=JSON.parse(c);return Rr({uri:Fs(l),gatewayUrls:t})}let u=r.tokenID;return r.namespace==="erc1155"&&(u=u.replace("0x","").padStart(64,"0")),Kc({gatewayUrls:t,uri:s.replace(/(?:0x)?{id}/,u)})}async function Ns(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=ct({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}try{const c={address:u,abi:Cs,functionName:"resolve",args:[Re(bn(r)),Oe({abi:da,functionName:"text",args:[Wt(r),a]})],blockNumber:t,blockTag:n},l=S(e,pe,"readContract"),d=s?await l({...c,args:[...c.args,s]}):await l(c);if(d[0]==="0x")return null;const p=ut({abi:da,functionName:"text",data:d[0]});return p===""?null:p}catch(c){if(i)throw c;if($r(c,"resolve"))return null;throw c}}async function ed(e,{blockNumber:t,blockTag:n,assetGatewayUrls:r,name:a,gatewayUrls:s,strict:i,universalResolverAddress:o}){const u=await S(e,Ns,"getEnsText")({blockNumber:t,blockTag:n,key:"avatar",name:a,universalResolverAddress:o,gatewayUrls:s,strict:i});if(!u)return null;try{return await Xc(e,{record:u,gatewayUrls:r})}catch{return null}}async function td(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=ct({blockNumber:n,chain:e.chain,contract:"ensUniversalResolver"})}const u=`${t.toLowerCase().substring(2)}.addr.reverse`;try{const c={address:o,abi:sc,functionName:"reverse",args:[Re(bn(u))],blockNumber:n,blockTag:r},l=S(e,pe,"readContract"),[d,p]=a?await l({...c,args:[...c.args,a]}):await l(c);return t.toLowerCase()!==p.toLowerCase()?null:d}catch(c){if(s)throw c;if($r(c,"reverse"))return null;throw c}}async function nd(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=ct({blockNumber:t,chain:e.chain,contract:"ensUniversalResolver"})}const[i]=await S(e,pe,"readContract")({address:s,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[Re(bn(r))],blockNumber:t,blockTag:n});return i}async function rd(e){const t=un(e,{method:"eth_newBlockFilter"}),n=await e.request({method:"eth_newBlockFilter"});return{id:n,request:t(n),type:"block"}}async function Ds(e,{address:t,args:n,event:r,events:a,fromBlock:s,strict:i,toBlock:o}={}){const u=a??(r?[r]:void 0),c=un(e,{method:"eth_newFilter"});let l=[];u&&(l=[u.flatMap(p=>Ot({abi:[p],eventName:p.name,args:n}))],r&&(l=l[0]));const d=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:typeof s=="bigint"?k(s):s,toBlock:typeof o=="bigint"?k(o):o,...l.length?{topics:l}:{}}]});return{abi:u,args:n,eventName:r?r.name:void 0,fromBlock:s,id:d,request:c(d),strict:!!i,toBlock:o,type:"event"}}async function js(e){const t=un(e,{method:"eth_newPendingTransactionFilter"}),n=await e.request({method:"eth_newPendingTransactionFilter"});return{id:n,request:t(n),type:"transaction"}}async function ad(e,{address:t,blockNumber:n,blockTag:r="latest"}){const a=n?k(n):void 0,s=await e.request({method:"eth_getBalance",params:[t,a||r]});return BigInt(s)}async function sd(e){const t=await e.request({method:"eth_blobBaseFee"});return BigInt(t)}async function id(e,{blockHash:t,blockNumber:n,blockTag:r="latest"}={}){const a=n!==void 0?k(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]}),Ae(s)}async function od(e,{address:t,blockNumber:n,blockTag:r="latest"}){const a=n!==void 0?k(n):void 0,s=await e.request({method:"eth_getCode",params:[t,a||r]});if(s!=="0x")return s}function ud(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 cd(e,{blockCount:t,blockNumber:n,blockTag:r="latest",rewardPercentiles:a}){const s=n?k(n):void 0,i=await e.request({method:"eth_feeHistory",params:[k(t),s||r,a]});return ud(i)}async function dd(e,{filter:t}){const n=t.strict??!1,a=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(s=>Be(s));return t.abi?Pr({abi:t.abi,logs:a,strict:n}):a}function Us(e,t){if(!oe(e,{strict:!1}))throw new Me({address:e});if(!oe(t,{strict:!1}))throw new Me({address:t});return e.toLowerCase()===t.toLowerCase()}function Ls(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}const ld=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,pd=/^(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 yd(e){const{domain:t={},message:n,primaryType:r}=e,a={EIP712Domain:Ws({domain:t}),...e.types};Gs({domain:t,message:n,primaryType:r,types:a});const s=["0x1901"];return t&&s.push(fd({domain:t,types:a})),r!=="EIP712Domain"&&s.push(Hs({data:n,primaryType:r,types:a})),Z(le(s))}function fd({domain:e,types:t}){return Hs({data:e,primaryType:"EIP712Domain",types:t})}function Hs({data:e,primaryType:t,types:n}){const r=zs({data:e,primaryType:t,types:n});return Z(r)}function zs({data:e,primaryType:t,types:n}){const r=[{type:"bytes32"}],a=[md({primaryType:t,types:n})];for(const s of n[t]){const[i,o]=qs({types:n,name:s.name,type:s.type,value:e[s.name]});r.push(i),a.push(o)}return it(r,a)}function md({primaryType:e,types:t}){const n=Re(bd({primaryType:e,types:t}));return Z(n)}function bd({primaryType:e,types:t}){let n="";const r=_s({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 _s({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])_s({primaryType:s.type,types:t},n);return n}function qs({types:e,name:t,type:n,value:r}){if(e[n]!==void 0)return[{type:"bytes32"},Z(zs({data:r,primaryType:n,types:e}))];if(n==="bytes")return r=`0x${(r.length%2?"0":"")+r.slice(2)}`,[{type:"bytes32"},Z(r)];if(n==="string")return[{type:"bytes32"},Z(Re(r))];if(n.lastIndexOf("]")===n.length-1){const a=n.slice(0,n.lastIndexOf("[")),s=r.map(i=>qs({name:t,type:a,types:e,value:i}));return[{type:"bytes32"},Z(it(s.map(([i])=>i),s.map(([,i])=>i)))]}return[{type:n},r]}function hd(e){const{domain:t,message:n,primaryType:r,types:a}=e,s=(u,c)=>{const l={...c};for(const d of u){const{name:p,type:m}=d;m==="address"&&(l[p]=l[p].toLowerCase())}return l},i=a.EIP712Domain?t?s(a.EIP712Domain,t):{}:{},o=(()=>{if(r!=="EIP712Domain")return s(a[r],n)})();return q({domain:i,message:o,primaryType:r,types:a})}function Gs(e){const{domain:t,message:n,primaryType:r,types:a}=e,s=(i,o)=>{for(const u of i){const{name:c,type:l}=u,d=o[c],p=l.match(pd);if(p&&(typeof d=="number"||typeof d=="bigint")){const[y,b,h]=p;k(d,{signed:b==="int",size:Number.parseInt(h)/8})}if(l==="address"&&typeof d=="string"&&!oe(d))throw new Me({address:d});const m=l.match(ld);if(m){const[y,b]=m;if(b&&H(d)!==Number.parseInt(b))throw new oo({expectedSize:Number.parseInt(b),givenSize:H(d)})}const f=a[l];f&&s(f,d)}};a.EIP712Domain&&t&&s(a.EIP712Domain,t),r!=="EIP712Domain"&&s(a[r],n)}function Ws({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 gd={"0x0":"reverted","0x1":"success"};function wd(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=>Be(n)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Ae(e.transactionIndex):null,status:e.status?gd[e.status]:null,type:e.type?ps[e.type]||e.type:null};return e.blobGasPrice&&(t.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(t.blobGasUsed=BigInt(e.blobGasUsed)),t}const Td=`Ethereum Signed Message:
39
+ `;function Vs(e,t){const n=typeof e=="string"?he(e):e.raw instanceof Uint8Array?e.raw:Ie(e.raw),r=he(`${Td}${n.length}`);return Z(le([r,n]),t)}function vd(e){return e.map(t=>({...t,value:BigInt(t.value)}))}function xd(e){return{...e,balance:e.balance?BigInt(e.balance):void 0,nonce:e.nonce?Ae(e.nonce):void 0,storageProof:e.storageProof?vd(e.storageProof):void 0}}async function Ed(e,{address:t,blockNumber:n,blockTag:r,storageKeys:a}){const s=r??"latest",i=n!==void 0?k(n):void 0,o=await e.request({method:"eth_getProof",params:[t,a,i||s]});return xd(o)}async function Pd(e,{address:t,blockNumber:n,blockTag:r="latest",slot:a}){const s=n!==void 0?k(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 l,d,p;const i=r||"latest",o=n!==void 0?k(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,k(s)]}):(o||i)&&(u=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[o||i,k(s)]})),!u)throw new is({blockHash:t,blockNumber:n,blockTag:i,hash:a,index:s});return(((p=(d=(l=e.chain)==null?void 0:l.formatters)==null?void 0:d.transaction)==null?void 0:p.format)||ys)(u)}async function Cd(e,{hash:t,transactionReceipt:n}){const[r,a]=await Promise.all([S(e,Lt,"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 Qn(e,{hash:t}){var a,s,i;const n=await e.request({method:"eth_getTransactionReceipt",params:[t]});if(!n)throw new os({hash:t});return(((i=(s=(a=e.chain)==null?void 0:a.formatters)==null?void 0:s.transactionReceipt)==null?void 0:i.format)||wd)(n)}async function Ad(e,t){var b;const{allowFailure:n=!0,batchSize:r,blockNumber:a,blockTag:s,multicallAddress:i,stateOverride:o}=t,u=t.contracts,c=r??(typeof((b=e.batch)==null?void 0:b.multicall)=="object"&&e.batch.multicall.batchSize||1024);let l=i;if(!l){if(!e.chain)throw new Error("client chain not configured. multicallAddress is required.");l=ct({blockNumber:a,chain:e.chain,contract:"multicall3"})}const d=[[]];let p=0,m=0;for(let h=0;h<u.length;h++){const{abi:g,address:w,args:x,functionName:P}=u[h];try{const T=Oe({abi:g,args:x,functionName:P});m+=(T.length-2)/2,c>0&&m>c&&d[p].length>0&&(p++,m=(T.length-2)/2,d[p]=[]),d[p]=[...d[p],{allowFailure:!0,callData:T,target:w}]}catch(T){const C=$t(T,{abi:g,address:w,args:x,docsPath:"/docs/contract/multicall",functionName:P});if(!n)throw C;d[p]=[...d[p],{allowFailure:!0,callData:"0x",target:w}]}}const f=await Promise.allSettled(d.map(h=>S(e,pe,"readContract")({abi:Zn,address:l,args:[h],blockNumber:a,blockTag:s,functionName:"aggregate3",stateOverride:o}))),y=[];for(let h=0;h<f.length;h++){const g=f[h];if(g.status==="rejected"){if(!n)throw g.reason;for(let x=0;x<d[h].length;x++)y.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:T}=w[x],{callData:C}=d[h][x],{abi:E,address:M,functionName:B,args:$}=u[y.length];try{if(C==="0x")throw new nn;if(!T)throw new br({data:P});const N=ut({abi:E,args:$,data:P,functionName:B});y.push(n?{result:N,status:"success"}:N)}catch(N){const F=$t(N,{abi:E,address:M,args:$,docsPath:"/docs/contract/multicall",functionName:B});if(!n)throw F;y.push({error:F,result:void 0,status:"failure"})}}}if(y.length!==u.length)throw new v("multicall results mismatch");return y}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zs=BigInt(0),hn=BigInt(1),Id=BigInt(2),gn=e=>e instanceof Uint8Array,Md=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nt(e){if(!gn(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=Md[e[n]];return t}function Ks(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function Fr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}function rt(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 Le(e){return Fr(nt(e))}function Nr(e){if(!gn(e))throw new Error("Uint8Array expected");return Fr(nt(Uint8Array.from(e).reverse()))}function at(e,t){return rt(e.toString(16).padStart(t*2,"0"))}function Dr(e,t){return at(e,t).reverse()}function Sd(e){return rt(Ks(e))}function ae(e,t,n){let r;if(typeof t=="string")try{r=rt(t)}catch(s){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${s}`)}else if(gn(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 kt(...e){const t=new Uint8Array(e.reduce((r,a)=>r+a.length,0));let n=0;return e.forEach(r=>{if(!gn(r))throw new Error("Uint8Array expected");t.set(r,n),n+=r.length}),t}function Ys(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 Bd(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function $d(e){let t;for(t=0;e>Zs;e>>=hn,t+=1);return t}function kd(e,t){return e>>BigInt(t)&hn}const Rd=(e,t,n)=>e|(n?hn:Zs)<<BigInt(t),jr=e=>(Id<<BigInt(e-1))-hn,$n=e=>new Uint8Array(e),ma=e=>Uint8Array.from(e);function Js(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=$n(e),a=$n(e),s=0;const i=()=>{r.fill(1),a.fill(0),s=0},o=(...d)=>n(a,r,...d),u=(d=$n())=>{a=o(ma([0]),d),r=o(),d.length!==0&&(a=o(ma([1]),d),r=o())},c=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const p=[];for(;d<t;){r=o();const m=r.slice();p.push(m),d+=r.length}return kt(...p)};return(d,p)=>{i(),u(d);let m;for(;!(m=p(c()));)u();return i(),m}}const Od={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 Ht(e,t,n={}){const r=(a,s,i)=>{const o=Od[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 Fd=Object.freeze(Object.defineProperty({__proto__:null,bitGet:kd,bitLen:$d,bitMask:jr,bitSet:Rd,bytesToHex:nt,bytesToNumberBE:Le,bytesToNumberLE:Nr,concatBytes:kt,createHmacDrbg:Js,ensureBytes:ae,equalBytes:Ys,hexToBytes:rt,hexToNumber:Fr,numberToBytesBE:at,numberToBytesLE:Dr,numberToHexUnpadded:Ks,numberToVarBytesBE:Sd,utf8ToBytes:Bd,validateObject:Ht},Symbol.toStringTag,{value:"Module"}));function Nd(e,t){const n=ie(e)?Ie(e):e,r=ie(t)?Ie(t):t;return Ys(n,r)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const _=BigInt(0),U=BigInt(1),De=BigInt(2),Dd=BigInt(3),er=BigInt(4),ba=BigInt(5),ha=BigInt(8);BigInt(9);BigInt(16);function V(e,t){const n=e%t;return n>=_?n:t+n}function jd(e,t,n){if(n<=_||t<_)throw new Error("Expected power/modulo > 0");if(n===U)return _;let r=U;for(;t>_;)t&U&&(r=r*e%n),e=e*e%n,t>>=U;return r}function Q(e,t,n){let r=e;for(;t-- >_;)r*=r,r%=n;return r}function tr(e,t){if(e===_||t<=_)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=V(e,t),r=t,a=_,s=U;for(;n!==_;){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 Ud(e){const t=(e-U)/De;let n,r,a;for(n=e-U,r=0;n%De===_;n/=De,r++);for(a=De;a<e&&jd(a,t,e)!==e-U;a++);if(r===1){const i=(e+U)/er;return function(u,c){const l=u.pow(c,i);if(!u.eql(u.sqr(l),c))throw new Error("Cannot find square root");return l}}const s=(n+U)/De;return function(o,u){if(o.pow(u,t)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,l=o.pow(o.mul(o.ONE,a),n),d=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 m=1;for(let y=o.sqr(p);m<c&&!o.eql(y,o.ONE);m++)y=o.sqr(y);const f=o.pow(l,U<<BigInt(c-m-1));l=o.sqr(f),d=o.mul(d,f),p=o.mul(p,l),c=m}return d}}function Ld(e){if(e%er===Dd){const t=(e+U)/er;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%ha===ba){const t=(e-ba)/ha;return function(r,a){const s=r.mul(a,De),i=r.pow(s,t),o=r.mul(a,i),u=r.mul(r.mul(o,De),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 Ud(e)}const Hd=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function zd(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=Hd.reduce((r,a)=>(r[a]="function",r),t);return Ht(e,n)}function _d(e,t,n){if(n<_)throw new Error("Expected power > 0");if(n===_)return e.ONE;if(n===U)return t;let r=e.ONE,a=t;for(;n>_;)n&U&&(r=e.mul(r,a)),a=e.sqr(a),n>>=U;return r}function qd(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 Xs(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Gd(e,t,n=!1,r={}){if(e<=_)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:a,nByteLength:s}=Xs(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const i=Ld(e),o=Object.freeze({ORDER:e,BITS:a,BYTES:s,MASK:jr(a),ZERO:_,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 _<=u&&u<e},is0:u=>u===_,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)=>_d(o,u,c),div:(u,c)=>V(u*tr(c,e),e),sqrN:u=>u*u,addN:(u,c)=>u+c,subN:(u,c)=>u-c,mulN:(u,c)=>u*c,inv:u=>tr(u,e),sqrt:r.sqrt||(u=>i(o,u)),invertBatch:u=>qd(o,u),cmov:(u,c,l)=>l?c:u,toBytes:u=>n?Dr(u,s):at(u,s),fromBytes:u=>{if(u.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${u.length}`);return n?Nr(u):Le(u)}});return Object.freeze(o)}function Qs(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 ei(e){const t=Qs(e);return t+Math.ceil(t/2)}function Wd(e,t,n=!1){const r=e.length,a=Qs(t),s=ei(t);if(r<16||r<s||r>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${r}`);const i=n?Le(e):Nr(e),o=V(i,t-U)+U;return n?Dr(o,a):at(o,a)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Vd=BigInt(0),kn=BigInt(1);function Zd(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>Vd;)s&kn&&(i=i.add(o)),o=o.double(),s>>=kn;return i},precomputeWindow(a,s){const{windows:i,windowSize:o}=r(s),u=[];let c=a,l=c;for(let d=0;d<i;d++){l=c,u.push(l);for(let p=1;p<o;p++)l=l.add(c),u.push(l);c=l.double()}return u},wNAF(a,s,i){const{windows:o,windowSize:u}=r(a);let c=e.ZERO,l=e.BASE;const d=BigInt(2**a-1),p=2**a,m=BigInt(a);for(let f=0;f<o;f++){const y=f*u;let b=Number(i&d);i>>=m,b>u&&(b-=p,i+=kn);const h=y,g=y+Math.abs(b)-1,w=f%2!==0,x=b<0;b===0?l=l.add(n(w,s[h])):c=c.add(n(x,s[g]))}return{p:c,f:l}},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 ti(e){return zd(e.Fp),Ht(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Xs(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Kd(e){const t=ti(e);Ht(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:Yd,hexToBytes:Jd}=Fd,je={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=je;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:Yd(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=je,n=typeof e=="string"?Jd(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}=je._parseInt(n.subarray(2)),{d:i,l:o}=je._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 l=c.toString(16);return l.length&1?`0${l}`:l},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}`}},be=BigInt(0),ee=BigInt(1);BigInt(2);const ga=BigInt(3);BigInt(4);function Xd(e){const t=Kd(e),{Fp:n}=t,r=t.toBytes||((f,y,b)=>{const h=y.toAffine();return kt(Uint8Array.from([4]),n.toBytes(h.x),n.toBytes(h.y))}),a=t.fromBytes||(f=>{const y=f.subarray(1),b=n.fromBytes(y.subarray(0,n.BYTES)),h=n.fromBytes(y.subarray(n.BYTES,2*n.BYTES));return{x:b,y:h}});function s(f){const{a:y,b}=t,h=n.sqr(f),g=n.mul(h,f);return n.add(n.add(g,n.mul(f,y)),b)}if(!n.eql(n.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function i(f){return typeof f=="bigint"&&be<f&&f<t.n}function o(f){if(!i(f))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(f){const{allowedPrivateKeyLengths:y,nByteLength:b,wrapPrivateKey:h,n:g}=t;if(y&&typeof f!="bigint"){if(f instanceof Uint8Array&&(f=nt(f)),typeof f!="string"||!y.includes(f.length))throw new Error("Invalid key");f=f.padStart(b*2,"0")}let w;try{w=typeof f=="bigint"?f:Le(ae("private key",f,b))}catch{throw new Error(`private key must be ${b} bytes, hex or bigint, not ${typeof f}`)}return h&&(w=V(w,g)),o(w),w}const c=new Map;function l(f){if(!(f instanceof d))throw new Error("ProjectivePoint expected")}class d{constructor(y,b,h){if(this.px=y,this.py=b,this.pz=h,y==null||!n.isValid(y))throw new Error("x required");if(b==null||!n.isValid(b))throw new Error("y required");if(h==null||!n.isValid(h))throw new Error("z required")}static fromAffine(y){const{x:b,y:h}=y||{};if(!y||!n.isValid(b)||!n.isValid(h))throw new Error("invalid affine point");if(y instanceof d)throw new Error("projective point not allowed");const g=w=>n.eql(w,n.ZERO);return g(b)&&g(h)?d.ZERO:new d(b,h,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(y){const b=n.invertBatch(y.map(h=>h.pz));return y.map((h,g)=>h.toAffine(b[g])).map(d.fromAffine)}static fromHex(y){const b=d.fromAffine(a(ae("pointHex",y)));return b.assertValidity(),b}static fromPrivateKey(y){return d.BASE.multiply(u(y))}_setWindowSize(y){this._WINDOW_SIZE=y,c.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:y,y:b}=this.toAffine();if(!n.isValid(y)||!n.isValid(b))throw new Error("bad point: x or y not FE");const h=n.sqr(b),g=s(y);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}=this.toAffine();if(n.isOdd)return!n.isOdd(y);throw new Error("Field doesn't support isOdd")}equals(y){l(y);const{px:b,py:h,pz:g}=this,{px:w,py:x,pz:P}=y,T=n.eql(n.mul(b,P),n.mul(w,g)),C=n.eql(n.mul(h,P),n.mul(x,g));return T&&C}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){const{a:y,b}=t,h=n.mul(b,ga),{px:g,py:w,pz:x}=this;let P=n.ZERO,T=n.ZERO,C=n.ZERO,E=n.mul(g,g),M=n.mul(w,w),B=n.mul(x,x),$=n.mul(g,w);return $=n.add($,$),C=n.mul(g,x),C=n.add(C,C),P=n.mul(y,C),T=n.mul(h,B),T=n.add(P,T),P=n.sub(M,T),T=n.add(M,T),T=n.mul(P,T),P=n.mul($,P),C=n.mul(h,C),B=n.mul(y,B),$=n.sub(E,B),$=n.mul(y,$),$=n.add($,C),C=n.add(E,E),E=n.add(C,E),E=n.add(E,B),E=n.mul(E,$),T=n.add(T,E),B=n.mul(w,x),B=n.add(B,B),E=n.mul(B,$),P=n.sub(P,E),C=n.mul(B,M),C=n.add(C,C),C=n.add(C,C),new d(P,T,C)}add(y){l(y);const{px:b,py:h,pz:g}=this,{px:w,py:x,pz:P}=y;let T=n.ZERO,C=n.ZERO,E=n.ZERO;const M=t.a,B=n.mul(t.b,ga);let $=n.mul(b,w),N=n.mul(h,x),F=n.mul(g,P),W=n.add(b,h),A=n.add(w,x);W=n.mul(W,A),A=n.add($,N),W=n.sub(W,A),A=n.add(b,g);let I=n.add(w,P);return A=n.mul(A,I),I=n.add($,F),A=n.sub(A,I),I=n.add(h,g),T=n.add(x,P),I=n.mul(I,T),T=n.add(N,F),I=n.sub(I,T),E=n.mul(M,A),T=n.mul(B,F),E=n.add(T,E),T=n.sub(N,E),E=n.add(N,E),C=n.mul(T,E),N=n.add($,$),N=n.add(N,$),F=n.mul(M,F),A=n.mul(B,A),N=n.add(N,F),F=n.sub($,F),F=n.mul(M,F),A=n.add(A,F),$=n.mul(N,A),C=n.add(C,$),$=n.mul(I,A),T=n.mul(W,T),T=n.sub(T,$),$=n.mul(W,N),E=n.mul(I,E),E=n.add(E,$),new d(T,C,E)}subtract(y){return this.add(y.negate())}is0(){return this.equals(d.ZERO)}wNAF(y){return m.wNAFCached(this,c,y,b=>{const h=n.invertBatch(b.map(g=>g.pz));return b.map((g,w)=>g.toAffine(h[w])).map(d.fromAffine)})}multiplyUnsafe(y){const b=d.ZERO;if(y===be)return b;if(o(y),y===ee)return this;const{endo:h}=t;if(!h)return m.unsafeLadder(this,y);let{k1neg:g,k1:w,k2neg:x,k2:P}=h.splitScalar(y),T=b,C=b,E=this;for(;w>be||P>be;)w&ee&&(T=T.add(E)),P&ee&&(C=C.add(E)),E=E.double(),w>>=ee,P>>=ee;return g&&(T=T.negate()),x&&(C=C.negate()),C=new d(n.mul(C.px,h.beta),C.py,C.pz),T.add(C)}multiply(y){o(y);let b=y,h,g;const{endo:w}=t;if(w){const{k1neg:x,k1:P,k2neg:T,k2:C}=w.splitScalar(b);let{p:E,f:M}=this.wNAF(P),{p:B,f:$}=this.wNAF(C);E=m.constTimeNegate(x,E),B=m.constTimeNegate(T,B),B=new d(n.mul(B.px,w.beta),B.py,B.pz),h=E.add(B),g=M.add($)}else{const{p:x,f:P}=this.wNAF(b);h=x,g=P}return d.normalizeZ([h,g])[0]}multiplyAndAddUnsafe(y,b,h){const g=d.BASE,w=(P,T)=>T===be||T===ee||!P.equals(g)?P.multiplyUnsafe(T):P.multiply(T),x=w(this,b).add(w(y,h));return x.is0()?void 0:x}toAffine(y){const{px:b,py:h,pz:g}=this,w=this.is0();y==null&&(y=w?n.ONE:n.inv(g));const x=n.mul(b,y),P=n.mul(h,y),T=n.mul(g,y);if(w)return{x:n.ZERO,y:n.ZERO};if(!n.eql(T,n.ONE))throw new Error("invZ was invalid");return{x,y:P}}isTorsionFree(){const{h:y,isTorsionFree:b}=t;if(y===ee)return!0;if(b)return b(d,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:y,clearCofactor:b}=t;return y===ee?this:b?b(d,this):this.multiplyUnsafe(t.h)}toRawBytes(y=!0){return this.assertValidity(),r(d,this,y)}toHex(y=!0){return nt(this.toRawBytes(y))}}d.BASE=new d(t.Gx,t.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);const p=t.nBitLength,m=Zd(d,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:d,normPrivateKeyToScalar:u,weierstrassEquation:s,isWithinCurveOrder:i}}function Qd(e){const t=ti(e);return Ht(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function el(e){const t=Qd(e),{Fp:n,n:r}=t,a=n.BYTES+1,s=2*n.BYTES+1;function i(A){return be<A&&A<n.ORDER}function o(A){return V(A,r)}function u(A){return tr(A,r)}const{ProjectivePoint:c,normPrivateKeyToScalar:l,weierstrassEquation:d,isWithinCurveOrder:p}=Xd({...t,toBytes(A,I,O){const j=I.toAffine(),D=n.toBytes(j.x),z=kt;return O?z(Uint8Array.from([I.hasEvenY()?2:3]),D):z(Uint8Array.from([4]),D,n.toBytes(j.y))},fromBytes(A){const I=A.length,O=A[0],j=A.subarray(1);if(I===a&&(O===2||O===3)){const D=Le(j);if(!i(D))throw new Error("Point is not on curve");const z=d(D);let J=n.sqrt(z);const X=(J&ee)===ee;return(O&1)===1!==X&&(J=n.neg(J)),{x:D,y:J}}else if(I===s&&O===4){const D=n.fromBytes(j.subarray(0,n.BYTES)),z=n.fromBytes(j.subarray(n.BYTES,2*n.BYTES));return{x:D,y:z}}else throw new Error(`Point of length ${I} was invalid. Expected ${a} compressed bytes or ${s} uncompressed bytes`)}}),m=A=>nt(at(A,t.nByteLength));function f(A){const I=r>>ee;return A>I}function y(A){return f(A)?o(-A):A}const b=(A,I,O)=>Le(A.slice(I,O));class h{constructor(I,O,j){this.r=I,this.s=O,this.recovery=j,this.assertValidity()}static fromCompact(I){const O=t.nByteLength;return I=ae("compactSignature",I,O*2),new h(b(I,0,O),b(I,O,2*O))}static fromDER(I){const{r:O,s:j}=je.toSig(ae("DER",I));return new h(O,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(I){return new h(this.r,this.s,I)}recoverPublicKey(I){const{r:O,s:j,recovery:D}=this,z=C(ae("msgHash",I));if(D==null||![0,1,2,3].includes(D))throw new Error("recovery id invalid");const J=D===2||D===3?O+t.n:O;if(J>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const X=D&1?"03":"02",ve=c.fromHex(X+m(J)),xe=u(J),Ge=o(-z*xe),lt=o(j*xe),Ee=c.BASE.multiplyAndAddUnsafe(ve,Ge,lt);if(!Ee)throw new Error("point at infinify");return Ee.assertValidity(),Ee}hasHighS(){return f(this.s)}normalizeS(){return this.hasHighS()?new h(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return rt(this.toDERHex())}toDERHex(){return je.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return rt(this.toCompactHex())}toCompactHex(){return m(this.r)+m(this.s)}}const g={isValidPrivateKey(A){try{return l(A),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const A=ei(t.n);return Wd(t.randomBytes(A),t.n)},precompute(A=8,I=c.BASE){return I._setWindowSize(A),I.multiply(BigInt(3)),I}};function w(A,I=!0){return c.fromPrivateKey(A).toRawBytes(I)}function x(A){const I=A instanceof Uint8Array,O=typeof A=="string",j=(I||O)&&A.length;return I?j===a||j===s:O?j===2*a||j===2*s:A instanceof c}function P(A,I,O=!0){if(x(A))throw new Error("first arg must be private key");if(!x(I))throw new Error("second arg must be public key");return c.fromHex(I).multiply(l(A)).toRawBytes(O)}const T=t.bits2int||function(A){const I=Le(A),O=A.length*8-t.nBitLength;return O>0?I>>BigInt(O):I},C=t.bits2int_modN||function(A){return o(T(A))},E=jr(t.nBitLength);function M(A){if(typeof A!="bigint")throw new Error("bigint expected");if(!(be<=A&&A<E))throw new Error(`bigint expected < 2^${t.nBitLength}`);return at(A,t.nByteLength)}function B(A,I,O=$){if(["recovered","canonical"].some(Fe=>Fe in O))throw new Error("sign() legacy options not supported");const{hash:j,randomBytes:D}=t;let{lowS:z,prehash:J,extraEntropy:X}=O;z==null&&(z=!0),A=ae("msgHash",A),J&&(A=ae("prehashed msgHash",j(A)));const ve=C(A),xe=l(I),Ge=[M(xe),M(ve)];if(X!=null){const Fe=X===!0?D(n.BYTES):X;Ge.push(ae("extraEntropy",Fe))}const lt=kt(...Ge),Ee=ve;function Tn(Fe){const We=T(Fe);if(!p(We))return;const Hr=u(We),Ve=c.BASE.multiply(We).toAffine(),re=o(Ve.x);if(re===be)return;const Ze=o(Hr*o(Ee+re*xe));if(Ze===be)return;let zr=(Ve.x===re?0:2)|Number(Ve.y&ee),_r=Ze;return z&&f(Ze)&&(_r=y(Ze),zr^=1),new h(re,_r,zr)}return{seed:lt,k2sig:Tn}}const $={lowS:t.lowS,prehash:!1},N={lowS:t.lowS,prehash:!1};function F(A,I,O=$){const{seed:j,k2sig:D}=B(A,I,O),z=t;return Js(z.hash.outputLen,z.nByteLength,z.hmac)(j,D)}c.BASE._setWindowSize(8);function W(A,I,O,j=N){var Ve;const D=A;if(I=ae("msgHash",I),O=ae("publicKey",O),"strict"in j)throw new Error("options.strict was renamed to lowS");const{lowS:z,prehash:J}=j;let X,ve;try{if(typeof D=="string"||D instanceof Uint8Array)try{X=h.fromDER(D)}catch(re){if(!(re instanceof je.Err))throw re;X=h.fromCompact(D)}else if(typeof D=="object"&&typeof D.r=="bigint"&&typeof D.s=="bigint"){const{r:re,s:Ze}=D;X=new h(re,Ze)}else throw new Error("PARSE");ve=c.fromHex(O)}catch(re){if(re.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(z&&X.hasHighS())return!1;J&&(I=t.hash(I));const{r:xe,s:Ge}=X,lt=C(I),Ee=u(Ge),Tn=o(lt*Ee),Fe=o(xe*Ee),We=(Ve=c.BASE.multiplyAndAddUnsafe(ve,Tn,Fe))==null?void 0:Ve.toAffine();return We?o(We.x)===xe:!1}return{CURVE:t,getPublicKey:w,getSharedSecret:P,sign:F,verify:W,ProjectivePoint:c,Signature:h,utils:g}}class ni extends ir{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Eo(t);const r=sn(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 Qe(this),this.iHash.update(t),this}digestInto(t){Qe(this),sr(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 ri=(e,t,n)=>new ni(e,t).update(n).digest();ri.create=(e,t)=>new ni(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function tl(e){return{hash:e,hmac:(t,...n)=>ri(e,t,Ro(...n)),randomBytes:Oo}}function nl(e,t){const n=r=>el({...e,...tl(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ai=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),wa=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),rl=BigInt(1),nr=BigInt(2),Ta=(e,t)=>(e+t/nr)/t;function al(e){const t=ai,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,l=c*c*e%t,d=Q(l,n,t)*l%t,p=Q(d,n,t)*l%t,m=Q(p,nr,t)*c%t,f=Q(m,a,t)*m%t,y=Q(f,s,t)*f%t,b=Q(y,o,t)*y%t,h=Q(b,u,t)*b%t,g=Q(h,o,t)*y%t,w=Q(g,n,t)*l%t,x=Q(w,i,t)*f%t,P=Q(x,r,t)*c%t,T=Q(P,nr,t);if(!rr.eql(rr.sqr(T),e))throw new Error("Cannot find square root");return T}const rr=Gd(ai,void 0,void 0,{sqrt:al}),Ur=nl({a:BigInt(0),b:BigInt(7),Fp:rr,n:wa,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=wa,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rl*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),a=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=n,i=BigInt("0x100000000000000000000000000000000"),o=Ta(s*e,t),u=Ta(-r*e,t);let c=V(e-o*n-u*a,t),l=V(-o*r-u*s,t);const d=c>i,p=l>i;if(d&&(c=t-c),p&&(l=t-l),c>i||l>i)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:d,k1:c,k2neg:p,k2:l}}}},ws);BigInt(0);Ur.ProjectivePoint;function sl({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 Ur.Signature(Xe(e),Xe(t)).toCompactHex()}${a===0?"1b":"1c"}`}async function Lr(e,{address:t,hash:n,signature:r,...a}){const s=ie(r)?r:typeof r=="object"&&"r"in r&&"s"in r?sl(r):G(r);try{const{data:i}=await S(e,jt,"call")({data:Ir({abi:ic,args:[t,n,s],bytecode:cc}),...a});return Nd(i??"0x0","0x1")}catch(i){if(i instanceof us)return!1;throw i}}async function il(e,{address:t,message:n,signature:r,...a}){const s=Vs(n);return Lr(e,{address:t,hash:s,signature:r,...a})}async function ol(e,t){const{address:n,signature:r,message:a,primaryType:s,types:i,domain:o,...u}=t,c=yd({message:a,primaryType:s,types:i,domain:o});return Lr(e,{address:n,hash:c,signature:r,...u})}function si(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 d=q(["watchBlockNumber",e.uid,t,n,i]);return $e(d,{onBlockNumber:r,onError:a},p=>Ut(async()=>{var m;try{const f=await S(e,Lt,"getBlockNumber")({cacheTime:0});if(u){if(f===u)return;if(f-u>1&&n)for(let y=u+1n;y<f;y++)p.onBlockNumber(y,u),u=y}(!u||f>u)&&(p.onBlockNumber(f,u),u=f)}catch(f){(m=p.onError)==null||m.call(p,f)}},{emitOnBegin:t,interval:i}))})():(()=>{const d=q(["watchBlockNumber",e.uid,t,n]);return $e(d,{onBlockNumber:r,onError:a},p=>{let m=!0,f=()=>m=!1;return(async()=>{try{const y=(()=>{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:b}=await y.subscribe({params:["newHeads"],onData(h){var w;if(!m)return;const g=Xe((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)}});f=b,m||f()}catch(y){a==null||a(y)}})(),()=>f()})})()}async function ul(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=q(["waitForTransactionReceipt",e.uid,n]);let c=0,l,d,p,m=!1;return new Promise((f,y)=>{o&&setTimeout(()=>y(new aa({hash:n})),o);const b=$e(u,{onReplaced:r,resolve:f,reject:y},h=>{const g=S(e,si,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:a,async onBlockNumber(w){const x=T=>{g(),T(),b()};let P=w;if(!m){c>s&&x(()=>h.reject(new aa({hash:n})));try{if(p){if(t>1&&(!p.blockNumber||P-p.blockNumber+1n<t))return;x(()=>h.resolve(p));return}if(l||(m=!0,await Jn(async()=>{l=await S(e,Or,"getTransaction")({hash:n}),l.blockNumber&&(P=l.blockNumber)},{delay:i,retryCount:s}),m=!1),p=await S(e,Qn,"getTransactionReceipt")({hash:n}),t>1&&(!p.blockNumber||P-p.blockNumber+1n<t))return;x(()=>h.resolve(p))}catch(T){if(T instanceof is||T instanceof os){if(!l){m=!1;return}try{d=l,m=!0;const C=await Jn(()=>S(e,Se,"getBlock")({blockNumber:P,includeTransactions:!0}),{delay:i,retryCount:s,shouldRetry:({error:B})=>B instanceof ls});m=!1;const E=C.transactions.find(({from:B,nonce:$})=>B===d.from&&$===d.nonce);if(!E||(p=await S(e,Qn,"getTransactionReceipt")({hash:E.hash}),t>1&&(!p.blockNumber||P-p.blockNumber+1n<t)))return;let M="replaced";E.to===d.to&&E.value===d.value?M="repriced":E.from===E.to&&E.value===0n&&(M="cancelled"),x(()=>{var B;(B=h.onReplaced)==null||B.call(h,{reason:M,replacedTransaction:d,transaction:E,transactionReceipt:p}),h.resolve(p)})}catch(C){x(()=>h.reject(C))}}else x(()=>h.reject(T))}finally{c++}}}})})})}function cl(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"),l=i??!1;let d;return c?(()=>{const f=q(["watchBlocks",e.uid,t,n,r,l,u]);return $e(f,{onBlock:a,onError:s},y=>Ut(async()=>{var b;try{const h=await S(e,Se,"getBlock")({blockTag:t,includeTransactions:l});if(h.number&&(d!=null&&d.number)){if(h.number===d.number)return;if(h.number-d.number>1&&n)for(let g=(d==null?void 0:d.number)+1n;g<h.number;g++){const w=await S(e,Se,"getBlock")({blockNumber:g,includeTransactions:l});y.onBlock(w,d),d=w}}(!(d!=null&&d.number)||t==="pending"&&!(h!=null&&h.number)||h.number&&h.number>d.number)&&(y.onBlock(h,d),d=h)}catch(h){(b=y.onError)==null||b.call(y,h)}},{emitOnBegin:r,interval:u}))})():(()=>{let f=!0,y=()=>f=!1;return(async()=>{try{const b=(()=>{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 b.subscribe({params:["newHeads"],onData(g){var P,T,C;if(!f)return;const x=(((C=(T=(P=e.chain)==null?void 0:P.formatters)==null?void 0:T.block)==null?void 0:C.format)||fs)(g.result);a(x,d),d=x},onError(g){s==null||s(g)}});y=h,f||y()}catch(b){s==null||s(b)}})(),()=>y()})()}function dl(e,{address:t,args:n,batch:r=!0,event:a,events:s,fromBlock:i,onError:o,onLogs:u,poll:c,pollingInterval:l=e.pollingInterval,strict:d}){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"),m=d??!1;return p?(()=>{const b=q(["watchEvent",t,n,r,e.uid,a,l,i]);return $e(b,{onLogs:u,onError:o},h=>{let g;i!==void 0&&(g=i-1n);let w,x=!1;const P=Ut(async()=>{var T;if(!x){try{w=await S(e,Ds,"createEventFilter")({address:t,args:n,event:a,events:s,strict:m,fromBlock:i})}catch{}x=!0;return}try{let C;if(w)C=await S(e,yn,"getFilterChanges")({filter:w});else{const E=await S(e,Lt,"getBlockNumber")({});g&&g!==E?C=await S(e,Cr,"getLogs")({address:t,args:n,event:a,events:s,fromBlock:g+1n,toBlock:E}):C=[],g=E}if(C.length===0)return;if(r)h.onLogs(C);else for(const E of C)h.onLogs([E])}catch(C){w&&C instanceof _e&&(x=!1),(T=h.onError)==null||T.call(h,C)}},{emitOnBegin:!0,interval:l});return async()=>{w&&await S(e,fn,"uninstallFilter")({filter:w}),P()}})})():(()=>{let b=!0,h=()=>b=!1;return(async()=>{try{const g=(()=>{if(e.transport.type==="fallback"){const T=e.transport.transports.find(C=>C.config.type==="webSocket");return T?T.value:e.transport}return e.transport})(),w=s??(a?[a]:void 0);let x=[];w&&(x=[w.flatMap(T=>Ot({abi:[T],eventName:T.name,args:n}))],a&&(x=x[0]));const{unsubscribe:P}=await g.subscribe({params:["logs",{address:t,topics:x}],onData(T){var E;if(!b)return;const C=T.result;try{const{eventName:M,args:B}=Er({abi:w??[],data:C.data,topics:C.topics,strict:m}),$=Be(C,{args:B,eventName:M});u([$])}catch(M){let B,$;if(M instanceof bt||M instanceof rn){if(d)return;B=M.abiItem.name,$=(E=M.abiItem.inputs)==null?void 0:E.some(F=>!("name"in F&&F.name))}const N=Be(C,{args:$?[]:{},eventName:B});u([N])}},onError(T){o==null||o(T)}});h=P,b||h()}catch(g){o==null||o(g)}})(),()=>h()})()}function ll(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=q(["watchPendingTransactions",e.uid,t,s]);return $e(c,{onTransactions:r,onError:n},l=>{let d;const p=Ut(async()=>{var m;try{if(!d)try{d=await S(e,js,"createPendingTransactionFilter")({});return}catch(y){throw p(),y}const f=await S(e,yn,"getFilterChanges")({filter:d});if(f.length===0)return;if(t)l.onTransactions(f);else for(const y of f)l.onTransactions([y])}catch(f){(m=l.onError)==null||m.call(l,f)}},{emitOnBegin:!0,interval:s});return async()=>{d&&await S(e,fn,"uninstallFilter")({filter:d}),p()}})})():(()=>{let c=!0,l=()=>c=!1;return(async()=>{try{const{unsubscribe:d}=await e.transport.subscribe({params:["newPendingTransactions"],onData(p){if(!c)return;const m=p.result;r([m])},onError(p){n==null||n(p)}});l=d,c||l()}catch(d){n==null||n(d)}})(),()=>l()})()}function pl(e){var d,p,m;const{scheme:t,statement:n,...r}=((d=e.match(yl))==null?void 0:d.groups)??{},{chainId:a,expirationTime:s,issuedAt:i,notBefore:o,requestId:u,...c}=((p=e.match(fl))==null?void 0:p.groups)??{},l=(m=e.split("Resources:")[1])==null?void 0:m.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}:{},...l?{resources:l}:{},...t?{scheme:t}:{},...n?{statement:n}:{}}}const yl=/^(?:(?<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)?/,fl=/(?: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 ml(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&&!Us(r.address,t))return!1}catch{return!1}return!0}async function bl(e,t){const{address:n,domain:r,message:a,nonce:s,scheme:i,signature:o,time:u=new Date,...c}=t,l=pl(a);if(!l.address||!ml({address:n,domain:r,message:l,nonce:s,scheme:i,time:u}))return!1;const p=Vs(a);return Lr(e,{address:l.address,hash:p,signature:o,...c})}function hl(e){return{call:t=>jt(e,t),createBlockFilter:()=>rd(e),createContractEventFilter:t=>fr(e,t),createEventFilter:t=>Ds(e,t),createPendingTransactionFilter:()=>js(e),estimateContractGas:t=>Es(e,t),estimateGas:t=>xr(e,t),getBalance:t=>ad(e,t),getBlobBaseFee:()=>sd(e),getBlock:t=>Se(e,t),getBlockNumber:t=>Lt(e,t),getBlockTransactionCount:t=>id(e,t),getBytecode:t=>od(e,t),getChainId:()=>Dt(e),getContractEvents:t=>Ar(e,t),getEip712Domain:t=>Cc(e,t),getEnsAddress:t=>Hc(e,t),getEnsAvatar:t=>ed(e,t),getEnsName:t=>td(e,t),getEnsResolver:t=>nd(e,t),getEnsText:t=>Ns(e,t),getFeeHistory:t=>cd(e,t),estimateFeesPerGas:t=>_u(e,t),getFilterChanges:t=>yn(e,t),getFilterLogs:t=>dd(e,t),getGasPrice:()=>Tr(e),getLogs:t=>Cr(e,t),getProof:t=>Ed(e,t),estimateMaxPriorityFeePerGas:t=>zu(e,t),getStorageAt:t=>Pd(e,t),getTransaction:t=>Or(e,t),getTransactionConfirmations:t=>Cd(e,t),getTransactionCount:t=>bs(e,t),getTransactionReceipt:t=>Qn(e,t),multicall:t=>Ad(e,t),prepareTransactionRequest:t=>pn(e,t),readContract:t=>pe(e,t),sendRawTransaction:t=>Mr(e,t),simulateContract:t=>Ms(e,t),verifyMessage:t=>il(e,t),verifySiweMessage:t=>bl(e,t),verifyTypedData:t=>ol(e,t),uninstallFilter:t=>fn(e,t),waitForTransactionReceipt:t=>ul(e,t),watchBlocks:t=>cl(e,t),watchBlockNumber:t=>si(e,t),watchContractEvent:t=>Ss(e,t),watchEvent:t=>dl(e,t),watchPendingTransactions:t=>ll(e,t)}}function ii(e){const{key:t="public",name:n="Public Client"}=e;return ks({...e,key:t,name:n,type:"publicClient"}).extend(hl)}function gl(e,t){const{abi:n,args:r,bytecode:a,...s}=t,i=Ir({abi:n,args:r,bytecode:a});return Sr(e,{...s,data:i})}async function wl(e){var n;return((n=e.account)==null?void 0:n.type)==="local"?[e.account.address]:(await e.request({method:"eth_accounts"})).map(r=>on(r))}async function Tl(e){return await e.request({method:"wallet_getPermissions"})}async function vl(e){return(await e.request({method:"eth_requestAccounts"},{retryCount:0})).map(n=>Ko(n))}async function xl(e,t){return e.request({method:"wallet_requestPermissions",params:[t]},{retryCount:0})}async function El(e,{account:t=e.account,message:n}){if(!t)throw new mn({docsPath:"/docs/actions/wallet/signMessage"});const r=ne(t);if(r.type==="local")return r.signMessage({message:n});const a=typeof n=="string"?ar(n):n.raw instanceof Uint8Array?Re(n.raw):n.raw;return e.request({method:"personal_sign",params:[a,r.address]},{retryCount:0})}async function Pl(e,t){var c,l,d,p;const{account:n=e.account,chain:r=e.chain,...a}=t;if(!n)throw new mn({docsPath:"/docs/actions/wallet/signTransaction"});const s=ne(n);Nt({account:s,...t});const i=await S(e,Dt,"getChainId")({});r!==null&&Bs({currentChainId:i,chain:r});const o=(r==null?void 0:r.formatters)||((c=e.chain)==null?void 0:c.formatters),u=((l=o==null?void 0:o.transactionRequest)==null?void 0:l.format)||ln;return s.type==="local"?s.signTransaction({...a,chainId:i},{serializer:(p=(d=e.chain)==null?void 0:d.serializers)==null?void 0:p.transaction}):await e.request({method:"eth_signTransaction",params:[{...u(a),chainId:k(i),from:s.address}]},{retryCount:0})}async function Cl(e,t){const{account:n=e.account,domain:r,message:a,primaryType:s}=t;if(!n)throw new mn({docsPath:"/docs/actions/wallet/signTypedData"});const i=ne(n),o={EIP712Domain:Ws({domain:r}),...t.types};if(Gs({domain:r,message:a,primaryType:s,types:o}),i.type==="local")return i.signTypedData({domain:r,message:a,primaryType:s,types:o});const u=hd({domain:r,message:a,primaryType:s,types:o});return e.request({method:"eth_signTypedData_v4",params:[i.address,u]},{retryCount:0})}async function Al(e,{id:t}){await e.request({method:"wallet_switchEthereumChain",params:[{chainId:k(t)}]},{retryCount:0})}async function Il(e,t){return await e.request({method:"wallet_watchAsset",params:t},{retryCount:0})}function Ml(e){return{addChain:t=>Ic(e,t),deployContract:t=>gl(e,t),getAddresses:()=>wl(e),getChainId:()=>Dt(e),getPermissions:()=>Tl(e),prepareTransactionRequest:t=>pn(e,t),requestAddresses:()=>vl(e),requestPermissions:t=>xl(e,t),sendRawTransaction:t=>Mr(e,t),sendTransaction:t=>Sr(e,t),signMessage:t=>El(e,t),signTransaction:t=>Pl(e,t),signTypedData:t=>Cl(e,t),switchChain:t=>Al(e,t),watchAsset:t=>Il(e,t),writeContract:t=>$s(e,t)}}function oi(e){const{key:t="wallet",name:n="Wallet Client",transport:r}=e;return ks({...e,key:t,name:n,transport:r,type:"walletClient"}).extend(Ml)}function Sl(e){const{r:t,s:n}=Ur.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:k(t,{size:32}),s:k(n,{size:32}),v:a,yParity:s}:{r:k(t,{size:32}),s:k(n,{size:32}),yParity:s}}const ui=Ls({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}),ci=Ls({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 R=(e=>(e[e.Mainnet=ci.id]="Mainnet",e[e.Holesky=ui.id]="Holesky",e))(R||{});const ye={[R.Mainnet]:ci,[R.Holesky]:ui},we={[R.Mainnet]:{PufferVault:"0xD9A442856C234a39a81a089C06451EBAa4306a72",PufferDepositor:"0x4aa799c5dfc01ee7d790e3bf1a7c2257ce1dceff",PufferL2Depositor:"0x0000000000000000000000000000000000000000",PufLocker:"0x0000000000000000000000000000000000000000"},[R.Holesky]:{PufferVault:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9",PufferDepositor:"0x824AC05aeb86A0aD770b8acDe0906d2d4a6c4A8c",PufferL2Depositor:"0x03D8bE7CaAD9A95cef9800249eC663Aa28A2F776",PufLocker:"0x3fc7a526de9fc3c5e3a28f33d24d4401a6a7b65d"}},Bl=[{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:[]}],$l=[{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:[]}],kl={[R.Mainnet]:{PufferVaultV2:Bl},[R.Holesky]:{PufferVaultV2:$l}};class Rl{constructor(t,n,r){L(this,"viemChain");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=ye[t]}getContract(){return dt({address:we[this.chain].PufferVault,abi:kl[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])}withdraw(t,n,r){return{transact:async()=>await this.getContract().write.withdraw([r,n,t],{account:n,chain:this.viemChain}),estimate:async()=>await this.getContract().estimateGas.withdraw([r,n,t],{account:n})}}}const Ol=[{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"}]}],Fl=[{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"}]}],va=[{inputs:[{internalType:"address",name:"accessManager",type:"address"},{internalType:"address",name:"weth",type:"address"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"authority",type:"address"}],name:"AccessManagedInvalidAuthority",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"},{internalType:"uint32",name:"delay",type:"uint32"}],name:"AccessManagedRequiredDelay",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"}],name:"AccessManagedUnauthorized",type:"error"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"AddressInsufficientBalance",type:"error"},{inputs:[],name:"FailedInnerCall",type:"error"},{inputs:[],name:"InvalidAccount",type:"error"},{inputs:[],name:"InvalidToken",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"SafeERC20FailedOperation",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"authority",type:"address"}],name:"AuthorityUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint256",name:"oldDepositCap",type:"uint256"},{indexed:!1,internalType:"uint256",name:"newDepositCap",type:"uint256"}],name:"DepositCapUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!0,internalType:"address",name:"depositor",type:"address"},{indexed:!0,internalType:"address",name:"account",type:"address"},{indexed:!1,internalType:"uint256",name:"tokenAmount",type:"uint256"},{indexed:!1,internalType:"uint256",name:"referralCode",type:"uint256"}],name:"DepositedToken",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"migrator",type:"address"},{indexed:!1,internalType:"bool",name:"isAllowed",type:"bool"}],name:"SetIsMigratorAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"address",name:"pufToken",type:"address"}],name:"TokenAdded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"address",name:"pufToken",type:"address"}],name:"TokenRemoved",type:"event"},{inputs:[],name:"WETH",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"addNewToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"authority",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"account",type:"address"},{components:[{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct Permit",name:"permitData",type:"tuple"},{internalType:"uint256",name:"referralCode",type:"uint256"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"account",type:"address"},{internalType:"uint256",name:"referralCode",type:"uint256"}],name:"depositETH",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"migrator",type:"address"}],name:"isAllowedMigrator",outputs:[{internalType:"bool",name:"isAllowed",type:"bool"}],stateMutability:"view",type:"function"},{inputs:[],name:"isConsumingScheduledOp",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"revertIfPaused",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newAuthority",type:"address"}],name:"setAuthority",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"newDepositCap",type:"uint256"}],name:"setDepositCap",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"migrator",type:"address"},{internalType:"bool",name:"allowed",type:"bool"}],name:"setMigrator",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"tokens",outputs:[{internalType:"address",name:"pufToken",type:"address"}],stateMutability:"view",type:"function"}],Nl={[R.Mainnet]:{PufferDepositor:Ol},[R.Holesky]:{PufferDepositor:Fl}},Dl={[R.Mainnet]:{PufferL2Depositor:va},[R.Holesky]:{PufferL2Depositor:va}},jl=[{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"}]}],Ul=jl;var qe=(e=>(e.USDC="USDC",e.DAI="DAI",e.ETH="ETH",e.WETH="wETH",e.stETH="stETH",e.wstETH="wstETH",e.pufETH="pufETH",e.pufUSDC="pufUSDC",e.pufDAI="pufDAI",e.pufpufETH="pufpufETH",e.pufWETH="pufWETH",e.pufStETH="pufStETH",e.pufWstETH="pufWstETH",e.pufALT="pufALT",e.pufEETH="pufEETH",e))(qe||{});const ce={USDC:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x64Cc0de0429bcb87e875905a0c313ec88f6d1d3E"},DAI:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x4478905505ddfb7eA1c8A9f46eAEC3695cE542ac"},ETH:{},wETH:{[R.Mainnet]:"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",[R.Holesky]:"0x94373a4919b3240d86ea41593d5eba789fef3848"},stETH:{[R.Mainnet]:"0xae7ab96520de3a18e5e111b5eaab095312d7fe84",[R.Holesky]:"0x3F1c547b21f65e10480dE3ad8E19fAAC46C95034"},wstETH:{[R.Mainnet]:"0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0",[R.Holesky]:"0x8d09a4502Cc8Cf1547aD300E066060D043f6982D"},pufETH:{[R.Mainnet]:"0xd9a442856c234a39a81a089c06451ebaa4306a72",[R.Holesky]:"0x9196830bB4c05504E0A8475A0aD566AceEB6BeC9"},pufUSDC:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x6D900a9f5784A2cA0004B5c3D3e08D7A9cE4A1b3"},pufDAI:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x3aDeeC5151FA881e76A3F42256CD78052372b362"},pufpufETH:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x083b6321F213C993B81a54BF4D6Cb38e175EFE68"},pufWETH:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0xfcF6c4e0387A523b73691D5604e5a6dA1607C8A0"},pufStETH:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x0000000000000000000000000000000000000000"},pufWstETH:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x0000000000000000000000000000000000000000"},pufALT:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x0000000000000000000000000000000000000000"},pufEETH:{[R.Mainnet]:"0x0000000000000000000000000000000000000000",[R.Holesky]:"0x0000000000000000000000000000000000000000"}},Ll=()=>Math.floor(Date.now()/1e3);class wn{constructor(t,n,r){L(this,"viemChain");L(this,"token");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=ye[t],this.token=qe.ETH}withToken(t){return this.token=t,this}getContract(){return dt({address:ce[this.token][this.chain],abi:Ul,client:{wallet:this.walletClient,public:this.publicClient}})}async getPermitSignature(t,n,r){const a=this.getContract(),s=await a.read.nonces([t]),o={name:await a.read.name(),version:this.getPermitVersion(this.token),chainId:this.chain,verifyingContract:ce[this.token][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(Ll()+60*60*2),l=await this.walletClient.signTypedData({account:t,domain:o,types:u,primaryType:"Permit",message:{owner:t,spender:n,value:r,nonce:s,deadline:c}});return{...Sl(l),deadline:c}}getPermitVersion(t){return t===qe.stETH?"2":"1"}approve(t,n,r){return this.getContract().write.approve([n,r],{account:t,chain:this.viemChain})}}class Hl{constructor(t,n,r){L(this,"viemChain");L(this,"erc20PermitHandler");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=ye[t],this.erc20PermitHandler=new wn(t,n,r)}getContract(){return dt({address:we[this.chain].PufferDepositor,abi:Nl[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.erc20PermitHandler.withToken(qe.stETH).getPermitSignature(t,we[this.chain].PufferDepositor,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.erc20PermitHandler.withToken(qe.wstETH).getPermitSignature(t,we[this.chain].PufferDepositor,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})}}}const xa=[{type:"constructor",inputs:[{name:"token",type:"address",internalType:"address"},{name:"tokenName",type:"string",internalType:"string"},{name:"tokenSymbol",type:"string",internalType:"string"},{name:"depositCap",type:"uint256",internalType:"uint256"}],stateMutability:"nonpayable"},{type:"function",name:"DOMAIN_SEPARATOR",inputs:[],outputs:[{name:"",type:"bytes32",internalType:"bytes32"}],stateMutability:"view"},{type:"function",name:"PUFFER_FACTORY",inputs:[],outputs:[{name:"",type:"address",internalType:"contract PufferL2Depositor"}],stateMutability:"view"},{type:"function",name:"TOKEN",inputs:[],outputs:[{name:"",type:"address",internalType:"contract ERC20"}],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:"deposit",inputs:[{name:"from",type:"address",internalType:"address"},{name:"account",type:"address",internalType:"address"},{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:"migrate",inputs:[{name:"amount",type:"uint256",internalType:"uint256"},{name:"migratorContract",type:"address",internalType:"address"},{name:"destination",type:"address",internalType:"address"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"migrateWithSignature",inputs:[{name:"depositor",type:"address",internalType:"address"},{name:"migratorContract",type:"address",internalType:"address"},{name:"destination",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"},{name:"signatureExpiry",type:"uint256",internalType:"uint256"},{name:"stakerSignature",type:"bytes",internalType:"bytes"}],outputs:[],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:"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:"setDepositCap",inputs:[{name:"newDepositCap",type:"uint256",internalType:"uint256"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"symbol",inputs:[],outputs:[{name:"",type:"string",internalType:"string"}],stateMutability:"view"},{type:"function",name:"totalDepositCap",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:"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:"withdraw",inputs:[{name:"recipient",type:"address",internalType:"address"},{name:"amount",type:"uint256",internalType:"uint256"}],outputs:[],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:"DepositCapChanged",inputs:[{name:"oldDepositCap",type:"uint256",indexed:!1,internalType:"uint256"},{name:"newDepositCap",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"Deposited",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"event",name:"EIP712DomainChanged",inputs:[],anonymous:!1},{type:"event",name:"Migrated",inputs:[{name:"depositor",type:"address",indexed:!0,internalType:"address"},{name:"destination",type:"address",indexed:!0,internalType:"address"},{name:"migratorContract",type:"address",indexed:!0,internalType:"address"},{name:"amount",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:"Withdrawn",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"amount",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{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:"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:"ExpiredSignature",inputs:[]},{type:"error",name:"FailedInnerCall",inputs:[]},{type:"error",name:"InvalidAccount",inputs:[]},{type:"error",name:"InvalidAccountNonce",inputs:[{name:"account",type:"address",internalType:"address"},{name:"currentNonce",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidAmount",inputs:[]},{type:"error",name:"InvalidShortString",inputs:[]},{type:"error",name:"InvalidSignature",inputs:[]},{type:"error",name:"MigratorContractNotAllowed",inputs:[{name:"migrator",type:"address",internalType:"address"}]},{type:"error",name:"SafeERC20FailedOperation",inputs:[{name:"token",type:"address",internalType:"address"}]},{type:"error",name:"StringTooLong",inputs:[{name:"str",type:"string",internalType:"string"}]},{type:"error",name:"TotalDepositCapReached",inputs:[]},{type:"error",name:"Unauthorized",inputs:[]}],zl={[R.Mainnet]:{PufToken:xa},[R.Holesky]:{PufToken:xa}};class _l{constructor(t,n,r){L(this,"viemChain");L(this,"pufToken");this.chain=t,this.walletClient=n,this.publicClient=r,this.pufToken=qe.pufWETH,this.viemChain=ye[t]}withPufToken(t){return this.pufToken=t,this}getContract(){return dt({address:ce[this.pufToken][this.chain],abi:zl[this.chain].PufToken,client:{wallet:this.walletClient,public:this.publicClient}})}balanceOf(t){return this.getContract().read.balanceOf([t])}getAllowance(t,n){return this.getContract().read.allowance([t,n])}getTotalDepositCap(){return this.getContract().read.totalDepositCap()}getTotalSupply(){return this.getContract().read.totalSupply()}withdraw(t,n){return{transact:()=>this.getContract().write.withdraw([t,n],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.withdraw([t,n],{account:t})}}deposit(t,n,r){return{transact:()=>this.getContract().write.deposit([t,n,r],{account:n,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit([t,n,r],{account:n})}}migrate(t,n,r){return{transact:()=>this.getContract().write.migrate([r,n,t],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.migrate([r,n,t],{account:t})}}approve(t,n,r){return this.getContract().write.approve([n,r],{account:t,chain:this.viemChain})}}class ql{constructor(t,n,r){L(this,"viemChain");L(this,"erc20PermitHandler");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=ye[t],this.erc20PermitHandler=new wn(t,n,r)}getContract(){return dt({address:we[this.chain].PufferL2Depositor,abi:Dl[this.chain].PufferL2Depositor,client:{wallet:this.walletClient,public:this.publicClient}})}depositAfterApproval(t,n,r){const a=[ce[t][this.chain],n,{r:de("0x",{size:32}),s:de("0x",{size:32}),v:0,deadline:0n,amount:r},r];return{transact:()=>this.getContract().write.deposit(a,{account:n,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit(a,{account:n})}}async deposit(t,n,r,a=0n){const{r:s,s:i,v:o,yParity:u,deadline:c}=await this.erc20PermitHandler.withToken(t).getPermitSignature(n,we[this.chain].PufferL2Depositor,r),l={r:s,s:i,v:Number(o??u),deadline:c,amount:r},d=[ce[t][this.chain],n,l,a];return{transact:()=>this.getContract().write.deposit(d,{account:n,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit(d,{account:n})}}}const Ea=[{inputs:[],stateMutability:"nonpayable",type:"constructor"},{inputs:[{internalType:"address",name:"authority",type:"address"}],name:"AccessManagedInvalidAuthority",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"},{internalType:"uint32",name:"delay",type:"uint32"}],name:"AccessManagedRequiredDelay",type:"error"},{inputs:[{internalType:"address",name:"caller",type:"address"}],name:"AccessManagedUnauthorized",type:"error"},{inputs:[{internalType:"address",name:"target",type:"address"}],name:"AddressEmptyCode",type:"error"},{inputs:[{internalType:"address",name:"account",type:"address"}],name:"AddressInsufficientBalance",type:"error"},{inputs:[],name:"DepositLocked",type:"error"},{inputs:[{internalType:"address",name:"implementation",type:"address"}],name:"ERC1967InvalidImplementation",type:"error"},{inputs:[],name:"ERC1967NonPayable",type:"error"},{inputs:[],name:"FailedInnerCall",type:"error"},{inputs:[],name:"InvalidAmount",type:"error"},{inputs:[],name:"InvalidDepositIndex",type:"error"},{inputs:[],name:"InvalidInitialization",type:"error"},{inputs:[],name:"InvalidLockPeriod",type:"error"},{inputs:[],name:"InvalidRecipientAddress",type:"error"},{inputs:[],name:"NoWithdrawableAmount",type:"error"},{inputs:[],name:"NotInitializing",type:"error"},{inputs:[{internalType:"address",name:"token",type:"address"}],name:"SafeERC20FailedOperation",type:"error"},{inputs:[],name:"TokenNotAllowed",type:"error"},{inputs:[],name:"UUPSUnauthorizedCallContext",type:"error"},{inputs:[{internalType:"bytes32",name:"slot",type:"bytes32"}],name:"UUPSUnsupportedProxiableUUID",type:"error"},{anonymous:!1,inputs:[{indexed:!1,internalType:"address",name:"authority",type:"address"}],name:"AuthorityUpdated",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!1,internalType:"uint128",name:"releaseTime",type:"uint128"}],name:"Deposited",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint64",name:"version",type:"uint64"}],name:"Initialized",type:"event"},{anonymous:!1,inputs:[{indexed:!1,internalType:"uint128",name:"previousMinLock",type:"uint128"},{indexed:!1,internalType:"uint128",name:"newMinLock",type:"uint128"},{indexed:!1,internalType:"uint128",name:"previousMaxLock",type:"uint128"},{indexed:!1,internalType:"uint128",name:"newMaxLock",type:"uint128"}],name:"LockPeriodsChanged",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"bool",name:"allowed",type:"bool"}],name:"SetTokenIsAllowed",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"implementation",type:"address"}],name:"Upgraded",type:"event"},{anonymous:!1,inputs:[{indexed:!0,internalType:"address",name:"user",type:"address"},{indexed:!0,internalType:"address",name:"token",type:"address"},{indexed:!1,internalType:"uint128",name:"amount",type:"uint128"},{indexed:!0,internalType:"address",name:"recipient",type:"address"}],name:"Withdrawn",type:"event"},{inputs:[],name:"UPGRADE_INTERFACE_VERSION",outputs:[{internalType:"string",name:"",type:"string"}],stateMutability:"view",type:"function"},{inputs:[],name:"authority",outputs:[{internalType:"address",name:"",type:"address"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint128",name:"lockPeriod",type:"uint128"},{components:[{internalType:"uint256",name:"deadline",type:"uint256"},{internalType:"uint256",name:"amount",type:"uint256"},{internalType:"uint8",name:"v",type:"uint8"},{internalType:"bytes32",name:"r",type:"bytes32"},{internalType:"bytes32",name:"s",type:"bytes32"}],internalType:"struct Permit",name:"permitData",type:"tuple"}],name:"deposit",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"address",name:"depositor",type:"address"}],name:"getAllDeposits",outputs:[{components:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint128",name:"releaseTime",type:"uint128"}],internalType:"struct IPufLocker.Deposit[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"user",type:"address"},{internalType:"address",name:"token",type:"address"},{internalType:"uint256",name:"start",type:"uint256"},{internalType:"uint256",name:"limit",type:"uint256"}],name:"getDeposits",outputs:[{components:[{internalType:"uint128",name:"amount",type:"uint128"},{internalType:"uint128",name:"releaseTime",type:"uint128"}],internalType:"struct IPufLocker.Deposit[]",name:"",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[],name:"getLockPeriods",outputs:[{internalType:"uint128",name:"",type:"uint128"},{internalType:"uint128",name:"",type:"uint128"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"accessManager",type:"address"}],name:"initialize",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[],name:"isConsumingScheduledOp",outputs:[{internalType:"bytes4",name:"",type:"bytes4"}],stateMutability:"view",type:"function"},{inputs:[],name:"proxiableUUID",outputs:[{internalType:"bytes32",name:"",type:"bytes32"}],stateMutability:"view",type:"function"},{inputs:[{internalType:"address",name:"newAuthority",type:"address"}],name:"setAuthority",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"bool",name:"allowed",type:"bool"}],name:"setIsAllowedToken",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"uint128",name:"minLock",type:"uint128"},{internalType:"uint128",name:"maxLock",type:"uint128"}],name:"setLockPeriods",outputs:[],stateMutability:"nonpayable",type:"function"},{inputs:[{internalType:"address",name:"newImplementation",type:"address"},{internalType:"bytes",name:"data",type:"bytes"}],name:"upgradeToAndCall",outputs:[],stateMutability:"payable",type:"function"},{inputs:[{internalType:"address",name:"token",type:"address"},{internalType:"uint256[]",name:"depositIndexes",type:"uint256[]"},{internalType:"address",name:"recipient",type:"address"}],name:"withdraw",outputs:[],stateMutability:"nonpayable",type:"function"}],Gl={[R.Mainnet]:{PufLocker:Ea},[R.Holesky]:{PufLocker:Ea}};class Wl{constructor(t,n,r){L(this,"viemChain");L(this,"erc20PermitHandler");this.chain=t,this.walletClient=n,this.publicClient=r,this.viemChain=ye[t],this.erc20PermitHandler=new wn(t,n,r)}getContract(){return dt({address:we[this.chain].PufLocker,abi:Gl[this.chain].PufLocker,client:{wallet:this.walletClient,public:this.publicClient}})}getAllDeposits(t,n){return this.getContract().read.getAllDeposits([ce[t][this.chain],n])}getDeposits(t,n,r,a){return this.getContract().read.getDeposits([n,ce[t][this.chain],r,a])}getLockPeriods(){return this.getContract().read.getLockPeriods()}async deposit(t,n,r,a){const{r:s,s:i,v:o,yParity:u,deadline:c}=await this.erc20PermitHandler.withToken(t).getPermitSignature(n,we[this.chain].PufLocker,r),l={r:s,s:i,v:Number(o??u),deadline:c,amount:r},d=[ce[t][this.chain],a,l];return{transact:()=>this.getContract().write.deposit(d,{account:n,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit(d,{account:n})}}withdraw(t,n,r,a){const s=[ce[t][this.chain],a,r];return{transact:()=>this.getContract().write.withdraw(s,{account:n,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.withdraw(s,{account:n})}}}class Vl{constructor(t,n,r){L(this,"walletClient");L(this,"publicClient");L(this,"erc20Permit");L(this,"vault");L(this,"depositor");L(this,"l2Depositor");L(this,"pufToken");L(this,"pufLocker");const a=ye[t];this.walletClient=n??oi({chain:a,transport:Xn()}),this.publicClient=r??ii({chain:a,transport:Xn()}),this.erc20Permit=new wn(t,this.walletClient,this.publicClient),this.vault=new Rl(t,this.walletClient,this.publicClient),this.depositor=new Hl(t,this.walletClient,this.publicClient),this.pufToken=new _l(t,this.walletClient,this.publicClient),this.l2Depositor=new ql(t,this.walletClient,this.publicClient),this.pufLocker=new Wl(t,this.walletClient,this.publicClient)}async requestAddresses(){return await this.walletClient.requestAddresses()}}class Qt{static createPublicClient(t){return ii({chain:ye[t.chain],transport:Qt.extractTransportConfig(t)})}static createWalletClient(t){return oi({chain:ye[t.chain],transport:Qt.extractTransportConfig(t)})}static extractTransportConfig(t){return"rpcUrls"in t?kc(t.rpcUrls.map(n=>Xn(n))):$c(t.provider,t.config)}}exports.BaseError=v;exports.CHAIN_ADDRESSES=we;exports.Chain=R;exports.HttpRequestError=Je;exports.PufferClient=Vl;exports.PufferClientHelpers=Qt;exports.TOKENS_ADDRESSES=ce;exports.Token=qe;exports.VIEM_CHAINS=ye;exports.call=jt;exports.concat=le;exports.decodeErrorResult=rs;exports.encodeAbiParameters=it;exports.getUrl=tn;exports.isAddressEqual=Us;exports.isHex=ie;exports.stringify=q;
41
+ //# sourceMappingURL=main--Ww95s5e.cjs.map