@vechain/vechain-kit 0.9.2 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +27 -50
- package/dist/index.js +4 -5
- package/dist/index.js.map +1 -1
- package/package.json +7 -3
- package/dist/_esm-6CXN4N54.js +0 -8
- package/dist/_esm-6CXN4N54.js.map +0 -1
- package/dist/ccip-D55W35AK.js +0 -2
- package/dist/ccip-D55W35AK.js.map +0 -1
- package/dist/chunk-LURIOADG.js +0 -2
- package/dist/chunk-LURIOADG.js.map +0 -1
- package/dist/chunk-M3DCSJHB.js +0 -22
- package/dist/chunk-M3DCSJHB.js.map +0 -1
- package/dist/chunk-URCDOYB6.js +0 -7
- package/dist/chunk-URCDOYB6.js.map +0 -1
- package/dist/chunk-YUJRW7ZE.js +0 -30
- package/dist/chunk-YUJRW7ZE.js.map +0 -1
- package/dist/secp256k1-A6TZ3QZN.js +0 -2
- package/dist/secp256k1-A6TZ3QZN.js.map +0 -1
package/dist/chunk-YUJRW7ZE.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{a as Tt,b as un,d as Bt,e as cn,f as pn,i as kt,j as zt,k as dn,m as fn,n as mn,o as ln}from"./chunk-URCDOYB6.js";var yn="1.0.6";var x=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof e&&n.cause.docsPath||n.docsPath,i=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...r?[`Details: ${r}`]:[],`Version: abitype@${yn}`].join(`
|
|
2
|
-
`);super(i),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),n.cause&&(this.cause=n.cause),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.shortMessage=t}};function $(e,t){return e.exec(t)?.groups}var Ot=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Ct=/^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)?$/,Me=/^\(.+?\).*?$/;var bn=/^tuple(?<array>(\[(\d*)\])*)$/;function Se(e){let t=e.type;if(bn.test(e.type)&&"components"in e){t="(";let n=e.components.length;for(let o=0;o<n;o++){let i=e.components[o];t+=Se(i),o<n-1&&(t+=", ")}let r=$(bn,e.type);return t+=`)${r?.array??""}`,Se({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function V(e){let t="",n=e.length;for(let r=0;r<n;r++){let o=e[r];t+=Se(o),r!==n-1&&(t+=", ")}return t}function Rt(e){return e.type==="function"?`function ${e.name}(${V(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${V(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${V(e.inputs)})`:e.type==="error"?`error ${e.name}(${V(e.inputs)})`:e.type==="constructor"?`constructor(${V(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?"fallback()":"receive() external payable"}var hn=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xn(e){return hn.test(e)}function gn(e){return $(hn,e)}var wn=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function vn(e){return wn.test(e)}function $n(e){return $(wn,e)}var An=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Pn(e){return An.test(e)}function In(e){return $(An,e)}var Mn=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function Ee(e){return Mn.test(e)}function Sn(e){return $(Mn,e)}var En=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Tn(e){return En.test(e)}function Bn(e){return $(En,e)}var Jr=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function kn(e){return Jr.test(e)}var Yr=/^receive\(\) external payable$/;function zn(e){return Yr.test(e)}var On=new Set(["indexed"]),Te=new Set(["calldata","memory","storage"]);var Be=class extends x{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"})}},ke=class extends x{constructor({type:t}){super("Unknown type.",{metaMessages:[`Type "${t}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}};var ze=class extends x{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}},Oe=class extends x{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"})}},Ce=class extends x{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"})}},Re=class extends x{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"})}},je=class extends x{constructor({abiParameter:t}){super("Invalid ABI parameter.",{details:JSON.stringify(t,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}};var T=class extends x{constructor({signature:t,type:n}){super(`Invalid ${n} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}},Ue=class extends x{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}},Fe=class extends x{constructor({signature:t}){super("Invalid struct signature.",{details:t,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}};var Le=class extends x{constructor({type:t}){super("Circular reference detected.",{metaMessages:[`Struct "${t}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}};var De=class extends x{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 Cn(e,t){return t?`${t}:${e}`:e}var Ne=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 Rn(e,t={}){if(Pn(e)){let n=In(e);if(!n)throw new T({signature:e,type:"function"});let r=M(n.parameters),o=[],i=r.length;for(let a=0;a<i;a++)o.push(R(r[a],{modifiers:Te,structs:t,type:"function"}));let s=[];if(n.returns){let a=M(n.returns),c=a.length;for(let p=0;p<c;p++)s.push(R(a[p],{modifiers:Te,structs:t,type:"function"}))}return{name:n.name,type:"function",stateMutability:n.stateMutability??"nonpayable",inputs:o,outputs:s}}if(vn(e)){let n=$n(e);if(!n)throw new T({signature:e,type:"event"});let r=M(n.parameters),o=[],i=r.length;for(let s=0;s<i;s++)o.push(R(r[s],{modifiers:On,structs:t,type:"event"}));return{name:n.name,type:"event",inputs:o}}if(xn(e)){let n=gn(e);if(!n)throw new T({signature:e,type:"error"});let r=M(n.parameters),o=[],i=r.length;for(let s=0;s<i;s++)o.push(R(r[s],{structs:t,type:"error"}));return{name:n.name,type:"error",inputs:o}}if(Tn(e)){let n=Bn(e);if(!n)throw new T({signature:e,type:"constructor"});let r=M(n.parameters),o=[],i=r.length;for(let s=0;s<i;s++)o.push(R(r[s],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:n.stateMutability??"nonpayable",inputs:o}}if(kn(e))return{type:"fallback"};if(zn(e))return{type:"receive",stateMutability:"payable"};throw new Ue({signature:e})}var qr=/^(?<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$_]*))?$/,Qr=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,eo=/^u?int$/;function R(e,t){let n=Cn(e,t?.type);if(Ne.has(n))return Ne.get(n);let r=Me.test(e),o=$(r?Qr:qr,e);if(!o)throw new ze({param:e});if(o.name&&no(o.name))throw new Oe({param:e,name:o.name});let i=o.name?{name:o.name}:{},s=o.modifier==="indexed"?{indexed:!0}:{},a=t?.structs??{},c,p={};if(r){c="tuple";let m=M(o.type),l=[],f=m.length;for(let b=0;b<f;b++)l.push(R(m[b],{structs:a}));p={components:l}}else if(o.type in a)c="tuple",p={components:a[o.type]};else if(eo.test(o.type))c=`${o.type}256`;else if(c=o.type,t?.type!=="struct"&&!jt(c))throw new ke({type:c});if(o.modifier){if(!t?.modifiers?.has?.(o.modifier))throw new Ce({param:e,type:t?.type,modifier:o.modifier});if(Te.has(o.modifier)&&!ro(c,!!o.array))throw new Re({param:e,type:t?.type,modifier:o.modifier})}let d={type:`${c}${o.array??""}`,...i,...s,...p};return Ne.set(n,d),d}function M(e,t=[],n="",r=0){let o=e.trim().length;for(let i=0;i<o;i++){let s=e[i],a=e.slice(i+1);switch(s){case",":return r===0?M(a,[...t,n.trim()]):M(a,t,`${n}${s}`,r);case"(":return M(a,t,`${n}${s}`,r+1);case")":return M(a,t,`${n}${s}`,r-1);default:return M(a,t,`${n}${s}`,r)}}if(n==="")return t;if(r!==0)throw new De({current:n,depth:r});return t.push(n.trim()),t}function jt(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Ot.test(e)||Ct.test(e)}var to=/^(?: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 no(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Ot.test(e)||Ct.test(e)||to.test(e)}function ro(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function jn(e){let t={},n=e.length;for(let s=0;s<n;s++){let a=e[s];if(!Ee(a))continue;let c=Sn(a);if(!c)throw new T({signature:a,type:"struct"});let p=c.properties.split(";"),d=[],m=p.length;for(let l=0;l<m;l++){let b=p[l].trim();if(!b)continue;let w=R(b,{type:"struct"});d.push(w)}if(!d.length)throw new Fe({signature:a});t[c.name]=d}let r={},o=Object.entries(t),i=o.length;for(let s=0;s<i;s++){let[a,c]=o[s];r[a]=Un(c,t)}return r}var oo=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function Un(e,t,n=new Set){let r=[],o=e.length;for(let i=0;i<o;i++){let s=e[i];if(Me.test(s.type))r.push(s);else{let c=$(oo,s.type);if(!c?.type)throw new je({abiParameter:s});let{array:p,type:d}=c;if(d in t){if(n.has(d))throw new Le({type:d});r.push({...s,type:`tuple${p??""}`,components:Un(t[d]??[],t,new Set([...n,d]))})}else if(jt(d))r.push(s);else throw new Be({type:d})}}return r}function He(e){let t=jn(e),n=[],r=e.length;for(let o=0;o<r;o++){let i=e[o];Ee(i)||n.push(Rn(i,t))}return n}function W(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}var Ut=[{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"}],Fn=[{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"}],Ws=[...Fn,{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"}]}],Zs=[...Fn,{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"}]}];var Ln="0x82ad56cb";var Dn="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Nn="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe";var Ft="2.21.49";var Lt={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${Ft}`};var u=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof e&&n.cause.docsPath||n.docsPath,i=Lt.getDocsUrl?.({...n,docsPath:o}),s=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...i?[`Docs: ${i}`]:[],...r?[`Details: ${r}`]:[],...Lt.version?[`Version: ${Lt.version}`]:[]].join(`
|
|
3
|
-
`);super(s,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=Ft}walk(t){return Hn(this,t)}};function Hn(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Hn(e.cause,t):t?null:e}var N=class extends u{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.`]],name:"ChainDoesNotSupportContract"})}};var de=class extends u{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}},_n=class extends u{constructor({chainId:t}){super(typeof t=="number"?`Chain ID "${t}" is invalid.`:"Chain ID is invalid.",{name:"InvalidChainIdError"})}};var Gn={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},Vn={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function H(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Ge(e.type);return`${e.name}(${_e(e.inputs,{includeName:t})})`}function _e(e,{includeName:t=!1}={}){return e?e.map(n=>so(n,{includeName:t})).join(t?", ":","):""}function so(e,{includeName:t}){return e.type.startsWith("tuple")?`(${_e(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function A(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 A(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var Ve=class extends u{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,name:"AbiConstructorNotFoundError"})}},fe=class extends u{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,name:"AbiConstructorParamsNotFoundError"})}};var We=class extends u{constructor({data:t,params:n,size:r}){super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
6
|
-
`),{metaMessages:[`Params: (${_e(n,{includeName:!0})})`,`Data: ${t} (${r} bytes)`],name:"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}},Z=class extends u{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}},Ze=class extends u{constructor({expectedLength:t,givenLength:n,type:r}){super([`ABI encoding array length mismatch for type ${r}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
|
|
7
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}},Ke=class extends u{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${h(n)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}},Xe=class extends u{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
|
|
8
|
-
`),{name:"AbiEncodingLengthMismatchError"})}};var Je=class extends u{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,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}};var j=class extends u{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(`
|
|
10
|
-
`),{docsPath:n,name:"AbiFunctionNotFoundError"})}},Ye=class extends u{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(`
|
|
11
|
-
`),{docsPath:n,name:"AbiFunctionOutputsNotFoundError"})}};var qe=class extends u{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${H(t.abiItem)}\`, and`,`\`${n.type}\` in \`${H(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}},Wn=class extends u{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`,{name:"BytesSizeMismatchError"})}};var Qe=class extends u{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
12
|
-
`),{docsPath:n,name:"InvalidAbiEncodingType"})}},et=class extends u{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
13
|
-
`),{docsPath:n,name:"InvalidAbiDecodingType"})}},tt=class extends u{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
14
|
-
`),{name:"InvalidArrayError"})}},Ge=class extends u{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
15
|
-
`),{name:"InvalidDefinitionTypeError"})}};var me=class extends u{constructor({offset:t,position:n,size:r}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}},le=class extends u{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}},ye=class extends u{constructor({size:t,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${n} ${r} long, but is ${t} ${r} long.`,{name:"InvalidBytesLengthError"})}};function _(e,t,n,{strict:r}={}){return A(e,{strict:!1})?io(e,t,n,{strict:r}):Dt(e,t,n,{strict:r})}function Zn(e,t){if(typeof t=="number"&&t>0&&t>h(e)-1)throw new me({offset:t,position:"start",size:h(e)})}function Kn(e,t,n){if(typeof t=="number"&&typeof n=="number"&&h(e)!==n-t)throw new me({offset:n,position:"end",size:h(e)})}function Dt(e,t,n,{strict:r}={}){Zn(e,t);let o=e.slice(t,n);return r&&Kn(o,t,n),o}function io(e,t,n,{strict:r}={}){Zn(e,t);let o=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return r&&Kn(o,t,n),o}function U(e,{dir:t,size:n=32}={}){return typeof e=="string"?B(e,{dir:t,size:n}):ao(e,{dir:t,size:n})}function B(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace("0x","");if(r.length>n*2)throw new le({size:Math.ceil(r.length/2),targetSize:n,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function ao(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new le({size:e.length,targetSize:n,type:"bytes"});let r=new Uint8Array(n);for(let o=0;o<n;o++){let i=t==="right";r[i?o:n-o-1]=e[i?o:e.length-o-1]}return r}var nt=class extends u{constructor({max:t,min:n,signed:r,size:o,value:i}){super(`Number "${i}" is not in safe ${o?`${o*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}},rt=class extends u{constructor(t){super(`Bytes value "${t}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}};var ot=class extends u{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}};function be(e,{dir:t="left"}={}){let n=typeof e=="string"?e.replace("0x",""):e,r=0;for(let o=0;o<n.length-1&&n[t==="left"?o:n.length-o-1].toString()==="0";o++)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 v(e,{size:t}){if(h(e)>t)throw new ot({givenSize:h(e),maxSize:t})}function Nt(e,t={}){let{signed:n}=t;t.size&&v(e,{size:t.size});let r=BigInt(e);if(!n)return r;let o=(e.length-2)/2,i=(1n<<BigInt(o)*8n-1n)-1n;return r<=i?r:r-BigInt(`0x${"f".padStart(o*2,"f")}`)-1n}function Xn(e,t={}){return Number(Nt(e,t))}var uo=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Jn(e,t={}){return typeof e=="number"||typeof e=="bigint"?y(e,t):typeof e=="string"?_t(e,t):typeof e=="boolean"?Ht(e,t):P(e,t)}function Ht(e,t={}){let n=`0x${Number(e)}`;return typeof t.size=="number"?(v(n,{size:t.size}),U(n,{size:t.size})):n}function P(e,t={}){let n="";for(let o=0;o<e.length;o++)n+=uo[e[o]];let r=`0x${n}`;return typeof t.size=="number"?(v(r,{size:t.size}),U(r,{dir:"right",size:t.size})):r}function y(e,t={}){let{signed:n,size:r}=t,o=BigInt(e),i;r?n?i=(1n<<BigInt(r)*8n-1n)-1n:i=2n**(BigInt(r)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));let s=typeof i=="bigint"&&n?-i-1n:0;if(i&&o>i||o<s){let c=typeof e=="bigint"?"n":"";throw new nt({max:i?`${i}${c}`:void 0,min:`${s}${c}`,signed:n,size:r,value:`${e}${c}`})}let a=`0x${(n&&o<0?(1n<<BigInt(r*8))+BigInt(o):o).toString(16)}`;return r?U(a,{size:r}):a}var co=new TextEncoder;function _t(e,t={}){let n=co.encode(e);return P(n,t)}var po=new TextEncoder;function st(e,t={}){return typeof e=="number"||typeof e=="bigint"?mo(e,t):typeof e=="boolean"?fo(e,t):A(e)?it(e,t):Gt(e,t)}function fo(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(v(n,{size:t.size}),U(n,{size:t.size})):n}var k={zero:48,nine:57,A:65,F:70,a:97,f:102};function Yn(e){if(e>=k.zero&&e<=k.nine)return e-k.zero;if(e>=k.A&&e<=k.F)return e-(k.A-10);if(e>=k.a&&e<=k.f)return e-(k.a-10)}function it(e,t={}){let n=e;t.size&&(v(n,{size:t.size}),n=U(n,{dir:"right",size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let o=r.length/2,i=new Uint8Array(o);for(let s=0,a=0;s<o;s++){let c=Yn(r.charCodeAt(a++)),p=Yn(r.charCodeAt(a++));if(c===void 0||p===void 0)throw new u(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);i[s]=c*16+p}return i}function mo(e,t){let n=y(e,t);return it(n)}function Gt(e,t={}){let n=po.encode(e);return typeof t.size=="number"?(v(n,{size:t.size}),U(n,{dir:"right",size:t.size})):n}var at=BigInt(4294967295),qn=BigInt(32);function lo(e,t=!1){return t?{h:Number(e&at),l:Number(e>>qn&at)}:{h:Number(e>>qn&at)|0,l:Number(e&at)|0}}function Qn(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let o=0;o<e.length;o++){let{h:i,l:s}=lo(e[o],t);[n[o],r[o]]=[i,s]}return[n,r]}var er=(e,t,n)=>e<<n|t>>>32-n,tr=(e,t,n)=>t<<n|e>>>32-n,nr=(e,t,n)=>t<<n-32|e>>>64-n,rr=(e,t,n)=>e<<n-32|t>>>64-n;var ir=[],ar=[],ur=[],yo=BigInt(0),he=BigInt(1),bo=BigInt(2),ho=BigInt(7),xo=BigInt(256),go=BigInt(113);for(let e=0,t=he,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],ir.push(2*(5*r+n)),ar.push((e+1)*(e+2)/2%64);let o=yo;for(let i=0;i<7;i++)t=(t<<he^(t>>ho)*go)%xo,t&bo&&(o^=he<<(he<<BigInt(i))-he);ur.push(o)}var[wo,vo]=Qn(ur,!0),or=(e,t,n)=>n>32?nr(e,t,n):er(e,t,n),sr=(e,t,n)=>n>32?rr(e,t,n):tr(e,t,n);function $o(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let s=0;s<10;s++)n[s]=e[s]^e[s+10]^e[s+20]^e[s+30]^e[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,c=(s+2)%10,p=n[c],d=n[c+1],m=or(p,d,1)^n[a],l=sr(p,d,1)^n[a+1];for(let f=0;f<50;f+=10)e[s+f]^=m,e[s+f+1]^=l}let o=e[2],i=e[3];for(let s=0;s<24;s++){let a=ar[s],c=or(o,i,a),p=sr(o,i,a),d=ir[s];o=e[d],i=e[d+1],e[d]=c,e[d+1]=p}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)n[a]=e[s+a];for(let a=0;a<10;a++)e[s+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=wo[r],e[1]^=vo[r]}n.fill(0)}var ut=class e extends fn{constructor(t,n,r,o=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=r,this.enableXOF=o,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Tt(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=pn(this.state)}keccak(){kt||zt(this.state32),$o(this.state32,this.rounds),kt||zt(this.state32),this.posOut=0,this.pos=0}update(t){Bt(this);let{blockLen:n,state:r}=this;t=dn(t);let o=t.length;for(let i=0;i<o;){let s=Math.min(n-this.pos,o-i);for(let a=0;a<s;a++)r[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:n,pos:r,blockLen:o}=this;t[r]^=n,n&128&&r===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){Bt(this,!1),un(t),this.finish();let n=this.state,{blockLen:r}=this;for(let o=0,i=t.length;o<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-o);t.set(n.subarray(this.posOut,this.posOut+s),o),this.posOut+=s,o+=s}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Tt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(cn(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:o,rounds:i,enableXOF:s}=this;return t||(t=new e(n,r,o,s,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=o,t.enableXOF=s,t.destroyed=this.destroyed,t}},F=(e,t,n)=>mn(()=>new ut(t,e,n)),Ni=F(6,144,224/8),Hi=F(6,136,256/8),_i=F(6,104,384/8),Gi=F(6,72,512/8),Vi=F(1,144,224/8),cr=F(1,136,256/8),Wi=F(1,104,384/8),Zi=F(1,72,512/8),pr=(e,t,n)=>ln((r={})=>new ut(t,e,r.dkLen===void 0?n:r.dkLen,!0)),Ki=pr(31,168,128/8),Xi=pr(31,136,256/8);function ct(e,t){let n=t||"hex",r=cr(A(e,{strict:!1})?st(e):e);return n==="bytes"?r:Jn(r)}var Ao=e=>ct(st(e));function dr(e){return Ao(e)}function fr(e){let t=!0,n="",r=0,o="",i=!1;for(let s=0;s<e.length;s++){let a=e[s];if(["(",")",","].includes(a)&&(t=!0),a==="("&&r++,a===")"&&r--,!!t){if(r===0){if(a===" "&&["event","function",""].includes(o))o="";else if(o+=a,a===")"){i=!0;break}continue}if(a===" "){e[s-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}o+=a,n+=a}}if(!i)throw new u("Unable to normalize signature.");return o}var mr=e=>{let t=typeof e=="string"?e:Rt(e);return fr(t)};function pt(e){return dr(mr(e))}var K=e=>_(pt(e),0,4);var I=class extends u{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}};var X=class extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){let n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){let r=this.keys().next().value;r&&this.delete(r)}return this}};var Po=/^0x[a-fA-F0-9]{40}$/,Vt=new X(8192);function g(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(Vt.has(r))return Vt.get(r);let o=Po.test(e)?e.toLowerCase()===e?!0:n?dt(e)===e:!0:!1;return Vt.set(r,o),o}var Wt=new X(8192);function dt(e,t){if(Wt.has(`${e}.${t}`))return Wt.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=ct(Gt(n),"bytes"),o=(t?n.substring(`${t}0x`.length):n).split("");for(let s=0;s<40;s+=2)r[s>>1]>>4>=8&&o[s]&&(o[s]=o[s].toUpperCase()),(r[s>>1]&15)>=8&&o[s+1]&&(o[s+1]=o[s+1].toUpperCase());let i=`0x${o.join("")}`;return Wt.set(`${e}.${t}`,i),i}var xe=class extends u{constructor({offset:t}){super(`Offset \`${t}\` cannot be negative.`,{name:"NegativeOffsetError"})}},ft=class extends u{constructor({length:t,position:n}){super(`Position \`${n}\` is out of bounds (\`0 < position < ${t}\`).`,{name:"PositionOutOfBoundsError"})}},mt=class extends u{constructor({count:t,limit:n}){super(`Recursive read limit of \`${n}\` exceeded (recursive read count: \`${t}\`).`,{name:"RecursiveReadLimitExceededError"})}};var Io={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 mt({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new ft({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new xe({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new xe({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let n=t??this.position;return this.assertPosition(n+e-1),this.bytes.subarray(n,n+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,e&255),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let n=this.inspectBytes(e);return this.position+=t??e,n},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function lr(e,{recursiveReadLimit:t=8192}={}){let n=Object.create(Io);return n.bytes=e,n.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),n.positionReadCount=new Map,n.recursiveReadLimit=t,n}function yr(e,t={}){typeof t.size<"u"&&v(e,{size:t.size});let n=P(e,t);return Nt(n,t)}function br(e,t={}){let n=e;if(typeof t.size<"u"&&(v(n,{size:t.size}),n=be(n)),n.length>1||n[0]>1)throw new rt(n);return!!n[0]}function E(e,t={}){typeof t.size<"u"&&v(e,{size:t.size});let n=P(e,t);return Xn(n,t)}function hr(e,t={}){let n=e;return typeof t.size<"u"&&(v(n,{size:t.size}),n=be(n,{dir:"right"})),new TextDecoder().decode(n)}function z(e){return typeof e[0]=="string"?ge(e):Mo(e)}function Mo(e){let t=0;for(let o of e)t+=o.length;let n=new Uint8Array(t),r=0;for(let o of e)n.set(o,r),r+=o.length;return n}function ge(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function J(e,t){if(e.length!==t.length)throw new Xe({expectedLength:e.length,givenLength:t.length});let n=So({params:e,values:t}),r=Kt(n);return r.length===0?"0x":r}function So({params:e,values:t}){let n=[];for(let r=0;r<e.length;r++)n.push(Zt({param:e[r],value:t[r]}));return n}function Zt({param:e,value:t}){let n=lt(e.type);if(n){let[r,o]=n;return To(t,{length:r,param:{...e,type:o}})}if(e.type==="tuple")return Co(t,{param:e});if(e.type==="address")return Eo(t);if(e.type==="bool")return ko(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){let r=e.type.startsWith("int");return zo(t,{signed:r})}if(e.type.startsWith("bytes"))return Bo(t,{param:e});if(e.type==="string")return Oo(t);throw new Qe(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Kt(e){let t=0;for(let i=0;i<e.length;i++){let{dynamic:s,encoded:a}=e[i];s?t+=32:t+=h(a)}let n=[],r=[],o=0;for(let i=0;i<e.length;i++){let{dynamic:s,encoded:a}=e[i];s?(n.push(y(t+o,{size:32})),r.push(a),o+=h(a)):n.push(a)}return z([...n,...r])}function Eo(e){if(!g(e))throw new I({address:e});return{dynamic:!1,encoded:B(e.toLowerCase())}}function To(e,{length:t,param:n}){let r=t===null;if(!Array.isArray(e))throw new tt(e);if(!r&&e.length!==t)throw new Ze({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let o=!1,i=[];for(let s=0;s<e.length;s++){let a=Zt({param:n,value:e[s]});a.dynamic&&(o=!0),i.push(a)}if(r||o){let s=Kt(i);if(r){let a=y(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?z([a,s]):a}}if(o)return{dynamic:!0,encoded:s}}return{dynamic:!1,encoded:z(i.map(({encoded:s})=>s))}}function Bo(e,{param:t}){let[,n]=t.type.split("bytes"),r=h(e);if(!n){let o=e;return r%32!==0&&(o=B(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:z([B(y(r,{size:32})),o])}}if(r!==Number.parseInt(n))throw new Ke({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:B(e,{dir:"right"})}}function ko(e){if(typeof e!="boolean")throw new u(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:B(Ht(e))}}function zo(e,{signed:t}){return{dynamic:!1,encoded:y(e,{size:32,signed:t})}}function Oo(e){let t=_t(e),n=Math.ceil(h(t)/32),r=[];for(let o=0;o<n;o++)r.push(B(_(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:z([B(y(h(t),{size:32})),...r])}}function Co(e,{param:t}){let n=!1,r=[];for(let o=0;o<t.components.length;o++){let i=t.components[o],s=Array.isArray(e)?o:i.name,a=Zt({param:i,value:e[s]});r.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?Kt(r):z(r.map(({encoded:o})=>o))}}function lt(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function yt(e,t){let n=typeof t=="string"?it(t):t,r=lr(n);if(h(n)===0&&e.length>0)throw new Z;if(h(t)&&h(t)<32)throw new We({data:typeof t=="string"?t:P(t),params:e,size:h(t)});let o=0,i=[];for(let s=0;s<e.length;++s){let a=e[s];r.setPosition(o);let[c,p]=Y(r,a,{staticPosition:0});o+=p,i.push(c)}return i}function Y(e,t,{staticPosition:n}){let r=lt(t.type);if(r){let[o,i]=r;return jo(e,{...t,type:i},{length:o,staticPosition:n})}if(t.type==="tuple")return Do(e,t,{staticPosition:n});if(t.type==="address")return Ro(e);if(t.type==="bool")return Uo(e);if(t.type.startsWith("bytes"))return Fo(e,t,{staticPosition:n});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Lo(e,t);if(t.type==="string")return No(e,{staticPosition:n});throw new et(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}var xr=32,Xt=32;function Ro(e){let t=e.readBytes(32);return[dt(P(Dt(t,-20))),32]}function jo(e,t,{length:n,staticPosition:r}){if(!n){let s=E(e.readBytes(Xt)),a=r+s,c=a+xr;e.setPosition(a);let p=E(e.readBytes(xr)),d=we(t),m=0,l=[];for(let f=0;f<p;++f){e.setPosition(c+(d?f*32:m));let[b,w]=Y(e,t,{staticPosition:c});m+=w,l.push(b)}return e.setPosition(r+32),[l,32]}if(we(t)){let s=E(e.readBytes(Xt)),a=r+s,c=[];for(let p=0;p<n;++p){e.setPosition(a+p*32);let[d]=Y(e,t,{staticPosition:a});c.push(d)}return e.setPosition(r+32),[c,32]}let o=0,i=[];for(let s=0;s<n;++s){let[a,c]=Y(e,t,{staticPosition:r+o});o+=c,i.push(a)}return[i,o]}function Uo(e){return[br(e.readBytes(32),{size:32}),32]}function Fo(e,t,{staticPosition:n}){let[r,o]=t.type.split("bytes");if(!o){let s=E(e.readBytes(32));e.setPosition(n+s);let a=E(e.readBytes(32));if(a===0)return e.setPosition(n+32),["0x",32];let c=e.readBytes(a);return e.setPosition(n+32),[P(c),32]}return[P(e.readBytes(Number.parseInt(o),32)),32]}function Lo(e,t){let n=t.type.startsWith("int"),r=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[r>48?yr(o,{signed:n}):E(o,{signed:n}),32]}function Do(e,t,{staticPosition:n}){let r=t.components.length===0||t.components.some(({name:s})=>!s),o=r?[]:{},i=0;if(we(t)){let s=E(e.readBytes(Xt)),a=n+s;for(let c=0;c<t.components.length;++c){let p=t.components[c];e.setPosition(a+i);let[d,m]=Y(e,p,{staticPosition:a});i+=m,o[r?c:p?.name]=d}return e.setPosition(n+32),[o,32]}for(let s=0;s<t.components.length;++s){let a=t.components[s],[c,p]=Y(e,a,{staticPosition:n});o[r?s:a?.name]=c,i+=p}return[o,i]}function No(e,{staticPosition:t}){let n=E(e.readBytes(32)),r=t+n;e.setPosition(r);let o=E(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];let i=e.readBytes(o,32),s=hr(be(i));return e.setPosition(t+32),[s,32]}function we(e){let{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return e.components?.some(we);let n=lt(e.type);return!!(n&&we({...e,type:n[1]}))}function gr(e){let{abi:t,data:n}=e,r=_(n,0,4);if(r==="0x")throw new Z;let i=[...t||[],Gn,Vn].find(s=>s.type==="error"&&r===K(H(s)));if(!i)throw new Je(r,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:i,args:"inputs"in i&&i.inputs&&i.inputs.length>0?yt(i.inputs,_(n,4)):void 0,errorName:i.name}}var q=(e,t,n)=>JSON.stringify(e,(r,o)=>{let i=typeof o=="bigint"?o.toString():o;return typeof t=="function"?t(r,i):i},n);var wr=pt;function bt(e){let{abi:t,args:n=[],name:r}=e,o=A(r,{strict:!1}),i=t.filter(a=>o?a.type==="function"?K(a)===r:a.type==="event"?wr(a)===r:!1:"name"in a&&a.name===r);if(i.length===0)return;if(i.length===1)return i[0];let s;for(let a of i){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((p,d)=>{let m="inputs"in a&&a.inputs[d];return m?Jt(p,m):!1})){if(s&&"inputs"in s&&s.inputs){let p=vr(a.inputs,s.inputs,n);if(p)throw new qe({abiItem:a,type:p[0]},{abiItem:s,type:p[1]})}s=a}}return s||i[0]}function Jt(e,t){let n=typeof e,r=t.type;switch(r){case"address":return g(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((o,i)=>Jt(Object.values(e)[i],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(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(o=>Jt(o,{...t,type:r.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function vr(e,t,n){for(let r in e){let o=e[r],i=t[r];if(o.type==="tuple"&&i.type==="tuple"&&"components"in o&&"components"in i)return vr(o.components,i.components,n[r]);let s=[o.type,i.type];if(s.includes("address")&&s.includes("bytes20")?!0:s.includes("address")&&s.includes("string")?g(n[r],{strict:!1}):s.includes("address")&&s.includes("bytes")?g(n[r],{strict:!1}):!1)return s}}var $r={gwei:9,wei:18},Ar={ether:-9,wei:9};function ht(e,t){let n=e.toString(),r=n.startsWith("-");r&&(n=n.slice(1)),n=n.padStart(t,"0");let[o,i]=[n.slice(0,n.length-t),n.slice(n.length-t)];return i=i.replace(/(0+)$/,""),`${r?"-":""}${o||"0"}${i?`.${i}`:""}`}function Pr(e,t="wei"){return ht(e,$r[t])}function O(e,t="wei"){return ht(e,Ar[t])}var xt=class extends u{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}},gt=class extends u{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}};function Ir(e){return e.reduce((t,{slot:n,value:r})=>`${t} ${n}: ${r}
|
|
16
|
-
`,"")}function Mr(e){return e.reduce((t,{address:n,...r})=>{let o=`${t} ${n}:
|
|
17
|
-
`;return r.nonce&&(o+=` nonce: ${r.nonce}
|
|
18
|
-
`),r.balance&&(o+=` balance: ${r.balance}
|
|
19
|
-
`),r.code&&(o+=` code: ${r.code}
|
|
20
|
-
`),r.state&&(o+=` state:
|
|
21
|
-
`,o+=Ir(r.state)),r.stateDiff&&(o+=` stateDiff:
|
|
22
|
-
`,o+=Ir(r.stateDiff)),o},` State Override:
|
|
23
|
-
`).slice(0,-1)}function Yt(e){let t=Object.entries(e).map(([r,o])=>o===void 0||o===!1?null:[r,o]).filter(Boolean),n=t.reduce((r,[o])=>Math.max(r,o.length),0);return t.map(([r,o])=>` ${`${r}:`.padEnd(n+1)} ${o}`).join(`
|
|
24
|
-
`)}var wt=class extends u{constructor(){super(["Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.","Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."].join(`
|
|
25
|
-
`),{name:"FeeConflictError"})}},Sr=class extends u{constructor({v:t}){super(`Invalid \`v\` value "${t}". Expected 27 or 28.`,{name:"InvalidLegacyVError"})}},Er=class extends u{constructor({transaction:t}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",Yt(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","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}};var Tr=class extends u{constructor({storageKey:t}){super(`Size for storage key "${t}" is invalid. Expected 32 bytes. Got ${Math.floor((t.length-2)/2)} bytes.`,{name:"InvalidStorageKeySizeError"})}};var ve=e=>e;var vt=class extends u{constructor(t,{account:n,docsPath:r,chain:o,data:i,gas:s,gasPrice:a,maxFeePerGas:c,maxPriorityFeePerGas:p,nonce:d,to:m,value:l,stateOverride:f}){let b=n?W(n):void 0,w=Yt({from:b?.address,to:m,value:typeof l<"u"&&`${Pr(l)} ${o?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:typeof a<"u"&&`${O(a)} gwei`,maxFeePerGas:typeof c<"u"&&`${O(c)} gwei`,maxPriorityFeePerGas:typeof p<"u"&&`${O(p)} gwei`,nonce:d});f&&(w+=`
|
|
26
|
-
${Mr(f)}`),super(t.shortMessage,{cause:t,docsPath:r,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",w].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}};var $t=class extends u{constructor({factory:t}){super(`Deployment for counterfactual contract call failed${t?` 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."],name:"CounterfactualDeploymentFailedError"})}},At=class extends u{constructor({data:t,message:n}){super(n||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t}};var qt="/docs/contract/decodeFunctionResult";function Br(e){let{abi:t,args:n,functionName:r,data:o}=e,i=t[0];if(r){let a=bt({abi:t,args:n,name:r});if(!a)throw new j(r,{docsPath:qt});i=a}if(i.type!=="function")throw new j(void 0,{docsPath:qt});if(!i.outputs)throw new Ye(i.name,{docsPath:qt});let s=yt(i.outputs,o);if(s&&s.length>1)return s;if(s&&s.length===1)return s[0]}var Qt="/docs/contract/encodeDeployData";function en(e){let{abi:t,args:n,bytecode:r}=e;if(!n||n.length===0)return r;let o=t.find(s=>"type"in s&&s.type==="constructor");if(!o)throw new Ve({docsPath:Qt});if(!("inputs"in o))throw new fe({docsPath:Qt});if(!o.inputs||o.inputs.length===0)throw new fe({docsPath:Qt});let i=J(o.inputs,n);return ge([r,i])}var kr="/docs/contract/encodeFunctionData";function zr(e){let{abi:t,args:n,functionName:r}=e,o=t[0];if(r){let i=bt({abi:t,args:n,name:r});if(!i)throw new j(r,{docsPath:kr});o=i}if(o.type!=="function")throw new j(void 0,{docsPath:kr});return{abi:[o],functionName:K(H(o))}}function Or(e){let{args:t}=e,{abi:n,functionName:r}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:zr(e),o=n[0],i=r,s="inputs"in o&&o.inputs?J(o.inputs,t??[]):void 0;return ge([i,s??"0x"])}function Cr({blockNumber:e,chain:t,contract:n}){let r=t?.contracts?.[n];if(!r)throw new N({chain:t,contract:{name:n}});if(e&&r.blockCreated&&r.blockCreated>e)throw new N({blockNumber:e,chain:t,contract:{name:n,blockCreated:r.blockCreated}});return r.address}var C=class extends u{constructor({cause:t,message:n}={}){let r=n?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:t,name:"ExecutionRevertedError"})}};Object.defineProperty(C,"code",{enumerable:!0,configurable:!0,writable:!0,value:3});Object.defineProperty(C,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});var L=class extends u{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${O(n)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:t,name:"FeeCapTooHighError"})}};Object.defineProperty(L,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});var Q=class extends u{constructor({cause:t,maxFeePerGas:n}={}){super(`The fee cap (\`maxFeePerGas\`${n?` = ${O(n)}`:""} gwei) cannot be lower than the block base fee.`,{cause:t,name:"FeeCapTooLowError"})}};Object.defineProperty(Q,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});var ee=class extends u{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}is higher than the next one expected.`,{cause:t,name:"NonceTooHighError"})}};Object.defineProperty(ee,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});var te=class extends u{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(`
|
|
27
|
-
`),{cause:t,name:"NonceTooLowError"})}};Object.defineProperty(te,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});var ne=class extends u{constructor({cause:t,nonce:n}={}){super(`Nonce provided for the transaction ${n?`(${n}) `:""}exceeds the maximum allowed nonce.`,{cause:t,name:"NonceMaxValueError"})}};Object.defineProperty(ne,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});var re=class extends u{constructor({cause:t}={}){super(["The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."].join(`
|
|
28
|
-
`),{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."],name:"InsufficientFundsError"})}};Object.defineProperty(re,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});var oe=class extends u{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,name:"IntrinsicGasTooHighError"})}};Object.defineProperty(oe,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});var se=class extends u{constructor({cause:t,gas:n}={}){super(`The amount of gas ${n?`(${n}) `:""}provided for the transaction is too low.`,{cause:t,name:"IntrinsicGasTooLowError"})}};Object.defineProperty(se,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});var ie=class extends u{constructor({cause:t}){super("The transaction type is not supported for this chain.",{cause:t,name:"TransactionTypeNotSupportedError"})}};Object.defineProperty(ie,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});var D=class extends u{constructor({cause:t,maxPriorityFeePerGas:n,maxFeePerGas:r}={}){super([`The provided tip (\`maxPriorityFeePerGas\`${n?` = ${O(n)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${O(r)} gwei`:""}).`].join(`
|
|
29
|
-
`),{cause:t,name:"TipAboveFeeCapError"})}};Object.defineProperty(D,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});var ae=class extends u{constructor({cause:t}){super(`An error occurred while executing: ${t?.shortMessage}`,{cause:t,name:"UnknownNodeError"})}};var $e=class extends u{constructor({body:t,cause:n,details:r,headers:o,status:i,url:s}){super("HTTP request failed.",{cause:n,details:r,metaMessages:[i&&`Status: ${i}`,`URL: ${ve(s)}`,t&&`Request body: ${q(t)}`].filter(Boolean),name:"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=o,this.status=i,this.url=s}};function Rr(e,t){let n=(e.details||"").toLowerCase(),r=e instanceof u?e.walk(o=>o?.code===C.code):e;return r instanceof u?new C({cause:e,message:r.details}):C.nodeMessage.test(n)?new C({cause:e,message:e.details}):L.nodeMessage.test(n)?new L({cause:e,maxFeePerGas:t?.maxFeePerGas}):Q.nodeMessage.test(n)?new Q({cause:e,maxFeePerGas:t?.maxFeePerGas}):ee.nodeMessage.test(n)?new ee({cause:e,nonce:t?.nonce}):te.nodeMessage.test(n)?new te({cause:e,nonce:t?.nonce}):ne.nodeMessage.test(n)?new ne({cause:e,nonce:t?.nonce}):re.nodeMessage.test(n)?new re({cause:e}):oe.nodeMessage.test(n)?new oe({cause:e,gas:t?.gas}):se.nodeMessage.test(n)?new se({cause:e,gas:t?.gas}):ie.nodeMessage.test(n)?new ie({cause:e}):D.nodeMessage.test(n)?new D({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new ae({cause:e})}function jr(e,{docsPath:t,...n}){let r=(()=>{let o=Rr(e,n);return o instanceof ae?e:o})();return new vt(r,{docsPath:t,...n})}function Ur(e,{format:t}){if(!t)return{};let n={};function r(i){let s=Object.keys(i);for(let a of s)a in e&&(n[a]=e[a]),i[a]&&typeof i[a]=="object"&&!Array.isArray(i[a])&&r(i[a])}let o=t(e||{});return r(o),n}var Ho={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Fr(e){let t={};return typeof e.authorizationList<"u"&&(t.authorizationList=_o(e.authorizationList)),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=>P(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=y(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=y(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=y(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=y(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=y(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=y(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Ho[e.type]),typeof e.value<"u"&&(t.value=y(e.value)),t}function _o(e){return e.map(t=>({address:t.contractAddress,r:t.r,s:t.s,chainId:y(t.chainId),nonce:y(t.nonce),...typeof t.yParity<"u"?{yParity:y(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:y(t.v)}:{}}))}function Lr(){let e=()=>{},t=()=>{};return{promise:new Promise((r,o)=>{e=r,t=o}),resolve:e,reject:t}}var tn=new Map;function Dr({fn:e,id:t,shouldSplitBatch:n,wait:r=0,sort:o}){let i=async()=>{let d=c();s();let m=d.map(({args:l})=>l);m.length!==0&&e(m).then(l=>{o&&Array.isArray(l)&&l.sort(o);for(let f=0;f<d.length;f++){let{resolve:b}=d[f];b?.([l[f],l])}}).catch(l=>{for(let f=0;f<d.length;f++){let{reject:b}=d[f];b?.(l)}})},s=()=>tn.delete(t),a=()=>c().map(({args:d})=>d),c=()=>tn.get(t)||[],p=d=>tn.set(t,[...c(),d]);return{flush:s,async schedule(d){let{promise:m,resolve:l,reject:f}=Lr();return n?.([...a(),d])&&i(),c().length>0?(p({args:d,resolve:l,reject:f}),m):(p({args:d,resolve:l,reject:f}),setTimeout(i,r),m)}}}function Nr(e){if(!(!e||e.length===0))return e.reduce((t,{slot:n,value:r})=>{if(n.length!==66)throw new ye({size:n.length,targetSize:66,type:"hex"});if(r.length!==66)throw new ye({size:r.length,targetSize:66,type:"hex"});return t[n]=r,t},{})}function Go(e){let{balance:t,nonce:n,state:r,stateDiff:o,code:i}=e,s={};if(i!==void 0&&(s.code=i),t!==void 0&&(s.balance=y(t)),n!==void 0&&(s.nonce=y(n)),r!==void 0&&(s.state=Nr(r)),o!==void 0){if(s.state)throw new gt;s.stateDiff=Nr(o)}return s}function Hr(e){if(!e)return;let t={};for(let{address:n,...r}of e){if(!g(n,{strict:!1}))throw new I({address:n});if(t[n])throw new xt({address:n});t[n]=Go(r)}return t}var Bc=2n**(8n-1n)-1n,kc=2n**(16n-1n)-1n,zc=2n**(24n-1n)-1n,Oc=2n**(32n-1n)-1n,Cc=2n**(40n-1n)-1n,Rc=2n**(48n-1n)-1n,jc=2n**(56n-1n)-1n,Uc=2n**(64n-1n)-1n,Fc=2n**(72n-1n)-1n,Lc=2n**(80n-1n)-1n,Dc=2n**(88n-1n)-1n,Nc=2n**(96n-1n)-1n,Hc=2n**(104n-1n)-1n,_c=2n**(112n-1n)-1n,Gc=2n**(120n-1n)-1n,Vc=2n**(128n-1n)-1n,Wc=2n**(136n-1n)-1n,Zc=2n**(144n-1n)-1n,Kc=2n**(152n-1n)-1n,Xc=2n**(160n-1n)-1n,Jc=2n**(168n-1n)-1n,Yc=2n**(176n-1n)-1n,qc=2n**(184n-1n)-1n,Qc=2n**(192n-1n)-1n,ep=2n**(200n-1n)-1n,tp=2n**(208n-1n)-1n,np=2n**(216n-1n)-1n,rp=2n**(224n-1n)-1n,op=2n**(232n-1n)-1n,sp=2n**(240n-1n)-1n,ip=2n**(248n-1n)-1n,ap=2n**(256n-1n)-1n,up=-(2n**(8n-1n)),cp=-(2n**(16n-1n)),pp=-(2n**(24n-1n)),dp=-(2n**(32n-1n)),fp=-(2n**(40n-1n)),mp=-(2n**(48n-1n)),lp=-(2n**(56n-1n)),yp=-(2n**(64n-1n)),bp=-(2n**(72n-1n)),hp=-(2n**(80n-1n)),xp=-(2n**(88n-1n)),gp=-(2n**(96n-1n)),wp=-(2n**(104n-1n)),vp=-(2n**(112n-1n)),$p=-(2n**(120n-1n)),Ap=-(2n**(128n-1n)),Pp=-(2n**(136n-1n)),Ip=-(2n**(144n-1n)),Mp=-(2n**(152n-1n)),Sp=-(2n**(160n-1n)),Ep=-(2n**(168n-1n)),Tp=-(2n**(176n-1n)),Bp=-(2n**(184n-1n)),kp=-(2n**(192n-1n)),zp=-(2n**(200n-1n)),Op=-(2n**(208n-1n)),Cp=-(2n**(216n-1n)),Rp=-(2n**(224n-1n)),jp=-(2n**(232n-1n)),Up=-(2n**(240n-1n)),Fp=-(2n**(248n-1n)),Lp=-(2n**(256n-1n)),Dp=2n**8n-1n,Np=2n**16n-1n,Hp=2n**24n-1n,_p=2n**32n-1n,Gp=2n**40n-1n,Vp=2n**48n-1n,Wp=2n**56n-1n,Zp=2n**64n-1n,Kp=2n**72n-1n,Xp=2n**80n-1n,Jp=2n**88n-1n,Yp=2n**96n-1n,qp=2n**104n-1n,Qp=2n**112n-1n,ed=2n**120n-1n,td=2n**128n-1n,nd=2n**136n-1n,rd=2n**144n-1n,od=2n**152n-1n,sd=2n**160n-1n,id=2n**168n-1n,ad=2n**176n-1n,ud=2n**184n-1n,cd=2n**192n-1n,pd=2n**200n-1n,dd=2n**208n-1n,fd=2n**216n-1n,md=2n**224n-1n,ld=2n**232n-1n,yd=2n**240n-1n,bd=2n**248n-1n,_r=2n**256n-1n;function Gr(e){let{account:t,gasPrice:n,maxFeePerGas:r,maxPriorityFeePerGas:o,to:i}=e,s=t?W(t):void 0;if(s&&!g(s.address))throw new I({address:s.address});if(i&&!g(i))throw new I({address:i});if(typeof n<"u"&&(typeof r<"u"||typeof o<"u"))throw new wt;if(r&&r>_r)throw new L({maxFeePerGas:r});if(o&&r&&o>r)throw new D({maxFeePerGas:r,maxPriorityFeePerGas:o})}async function Vr(e,t){let{account:n=e.account,batch:r=!!e.batch?.multicall,blockNumber:o,blockTag:i="latest",accessList:s,blobs:a,code:c,data:p,factory:d,factoryData:m,gas:l,gasPrice:f,maxFeePerBlobGas:b,maxFeePerGas:w,maxPriorityFeePerGas:ue,nonce:ce,to:S,value:Ae,stateOverride:Zr,...Kr}=t,nn=n?W(n):void 0;if(c&&(d||m))throw new u("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(c&&S)throw new u("Cannot provide both `code` & `to` as parameters.");let rn=c&&p,on=d&&m&&S&&p,sn=rn||on,Xr=rn?Zo({code:c,data:p}):on?Ko({data:p,factory:d,factoryData:m,to:S}):p;try{Gr(t);let G=(o?y(o):void 0)||i,pe=Hr(Zr),Pe=e.chain?.formatters?.transactionRequest?.format,Ie=(Pe||Fr)({...Ur(Kr,{format:Pe}),from:nn?.address,accessList:s,blobs:a,data:Xr,gas:l,gasPrice:f,maxFeePerBlobGas:b,maxFeePerGas:w,maxPriorityFeePerGas:ue,nonce:ce,to:sn?void 0:S,value:Ae});if(r&&Vo({request:Ie})&&!pe)try{return await Wo(e,{...Ie,blockNumber:o,blockTag:i})}catch(Et){if(!(Et instanceof de)&&!(Et instanceof N))throw Et}let an=await e.request({method:"eth_call",params:pe?[Ie,G,pe]:[Ie,G]});return an==="0x"?{data:void 0}:{data:an}}catch(St){let G=Xo(St),{offchainLookup:pe,offchainLookupSignature:Pe}=await import("./ccip-D55W35AK.js");if(e.ccipRead!==!1&&G?.slice(0,10)===Pe&&S)return{data:await pe(e,{data:G,to:S})};throw sn&&G?.slice(0,10)==="0x101bb98d"?new $t({factory:d}):jr(St,{...t,account:nn,chain:e.chain})}}function Vo({request:e}){let{data:t,to:n,...r}=e;return!(!t||t.startsWith(Ln)||!n||Object.values(r).filter(o=>typeof o<"u").length>0)}async function Wo(e,t){let{batchSize:n=1024,wait:r=0}=typeof e.batch?.multicall=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:i="latest",data:s,multicallAddress:a,to:c}=t,p=a;if(!p){if(!e.chain)throw new de;p=Cr({blockNumber:o,chain:e.chain,contract:"multicall3"})}let m=(o?y(o):void 0)||i,{schedule:l}=Dr({id:`${e.uid}.${m}`,wait:r,shouldSplitBatch(w){return w.reduce((ce,{data:S})=>ce+(S.length-2),0)>n*2},fn:async w=>{let ue=w.map(Ae=>({allowFailure:!0,callData:Ae.data,target:Ae.to})),ce=Or({abi:Ut,args:[ue],functionName:"aggregate3"}),S=await e.request({method:"eth_call",params:[{data:ce,to:p},m]});return Br({abi:Ut,args:[ue],functionName:"aggregate3",data:S||"0x"})}}),[{returnData:f,success:b}]=await l({data:s,to:c});if(!b)throw new At({data:f});return f==="0x"?{data:void 0}:{data:f}}function Zo(e){let{code:t,data:n}=e;return en({abi:He(["constructor(bytes, bytes)"]),bytecode:Dn,args:[t,n]})}function Ko(e){let{data:t,factory:n,factoryData:r,to:o}=e;return en({abi:He(["constructor(address, bytes, address, bytes)"]),bytecode:Nn,args:[o,t,n,r]})}function Xo(e){if(!(e instanceof u))return;let t=e.walk();return typeof t?.data=="object"?t.data?.data:t.data}var Pt=class extends u{constructor({callbackSelector:t,cause:n,data:r,extraData:o,sender:i,urls:s}){super(n.shortMessage||"An error occurred while fetching for an offchain result.",{cause:n,metaMessages:[...n.metaMessages||[],n.metaMessages?.length?"":[],"Offchain Gateway Call:",s&&[" Gateway URL(s):",...s.map(a=>` ${ve(a)}`)],` Sender: ${i}`,` Data: ${r}`,` Callback selector: ${t}`,` Extra data: ${o}`].flat(),name:"OffchainLookupError"})}},It=class extends u{constructor({result:t,url:n}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${ve(n)}`,`Response: ${q(t)}`],name:"OffchainLookupResponseMalformedError"})}},Mt=class extends u{constructor({sender:t,to:n}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${n}`,`OffchainLookup sender address: ${t}`],name:"OffchainLookupSenderMismatchError"})}};function Wr(e,t){if(!g(e,{strict:!1}))throw new I({address:e});if(!g(t,{strict:!1}))throw new I({address:t});return e.toLowerCase()===t.toLowerCase()}var a0="0x556f1830",Jo={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function u0(e,{blockNumber:t,blockTag:n,data:r,to:o}){let{args:i}=gr({data:r,abi:[Jo]}),[s,a,c,p,d]=i,{ccipRead:m}=e,l=m&&typeof m?.request=="function"?m.request:Yo;try{if(!Wr(o,s))throw new Mt({sender:s,to:o});let f=await l({data:c,sender:s,urls:a}),{data:b}=await Vr(e,{blockNumber:t,blockTag:n,data:z([p,J([{type:"bytes"},{type:"bytes"}],[f,d])]),to:o});return b}catch(f){throw new Pt({callbackSelector:p,cause:f,data:r,extraData:d,sender:s,urls:a})}}async function Yo({data:e,sender:t,urls:n}){let r=new Error("An unknown error occurred.");for(let o=0;o<n.length;o++){let i=n[o],s=i.includes("{data}")?"GET":"POST",a=s==="POST"?{data:e,sender:t}:void 0,c=s==="POST"?{"Content-Type":"application/json"}:{};try{let p=await fetch(i.replace("{sender}",t).replace("{data}",e),{body:JSON.stringify(a),headers:c,method:s}),d;if(p.headers.get("Content-Type")?.startsWith("application/json")?d=(await p.json()).data:d=await p.text(),!p.ok){r=new $e({body:a,details:d?.error?q(d.error):p.statusText,headers:p.headers,status:p.status,url:i});continue}if(!A(d)){r=new It({result:d,url:i});continue}return d}catch(p){r=new $e({body:a,details:p.message,url:i})}}throw r}export{A as a,h as b,u as c,Wn as d,be as e,Nt as f,Xn as g,Jn as h,P as i,y as j,_t as k,st as l,it as m,ct as n,I as o,dt as p,g as q,z as r,ge as s,_ as t,J as u,Or as v,lr as w,q as x,Sr as y,Er as z,Tr as A,L as B,D as C,_r as D,_n as E,a0 as F,Jo as G,u0 as H,Yo as I};
|
|
30
|
-
//# sourceMappingURL=chunk-YUJRW7ZE.js.map
|