@pufferfinance/puffer-sdk 1.25.1 → 1.25.2
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/api/puffer-client-helpers.cjs +1 -1
- package/dist/api/puffer-client-helpers.js +3 -3
- package/dist/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.js +2 -2
- package/dist/{ccip-w5ez1DCx.js → ccip-C76-YhQK.js} +4 -4
- package/dist/{ccip-w5ez1DCx.js.map → ccip-C76-YhQK.js.map} +1 -1
- package/dist/{ccip-FdkpGaX4.cjs → ccip-CEodLZ4s.cjs} +2 -2
- package/dist/{ccip-FdkpGaX4.cjs.map → ccip-CEodLZ4s.cjs.map} +1 -1
- package/dist/chains/constants.cjs +1 -1
- package/dist/chains/constants.d.ts +2 -1
- package/dist/chains/constants.js +1 -1
- package/dist/{constants-BweLzNUt.js → constants-C9YZ6Ewc.js} +302 -274
- package/dist/constants-C9YZ6Ewc.js.map +1 -0
- package/dist/{constants-JN89aXws.cjs → constants-CxSgz27h.cjs} +6 -6
- package/dist/constants-CxSgz27h.cjs.map +1 -0
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.js +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.cjs +1 -1
- package/dist/contracts/handlers/carrot-staking-handler.js +2 -2
- package/dist/contracts/handlers/concrete-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/concrete-vault-handler.js +2 -2
- package/dist/contracts/handlers/distributor-handler.cjs +1 -1
- package/dist/contracts/handlers/distributor-handler.js +2 -2
- package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
- package/dist/contracts/handlers/guardian-module-handler.cjs +1 -1
- package/dist/contracts/handlers/guardian-module-handler.js +2 -2
- package/dist/contracts/handlers/institutional-access-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/institutional-access-manager-handler.js +3 -3
- package/dist/contracts/handlers/institutional-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/institutional-vault-handler.js +2 -2
- package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
- package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
- package/dist/contracts/handlers/lagoon-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/lagoon-vault-handler.js +2 -2
- package/dist/contracts/handlers/mtw-carrot-handler.cjs +1 -1
- package/dist/contracts/handlers/mtw-carrot-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.js +2 -2
- package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
- package/dist/contracts/handlers/puf-locker-handler.js +2 -2
- package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
- package/dist/contracts/handlers/puffer-oracle-v2-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-oracle-v2-handler.js +2 -2
- package/dist/contracts/handlers/puffer-protocol-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-protocol-handler.js +2 -2
- package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
- package/dist/contracts/handlers/validator-ticket-handler.cjs +1 -1
- package/dist/contracts/handlers/validator-ticket-handler.js +2 -2
- package/dist/contracts/tokens.cjs +1 -1
- package/dist/contracts/tokens.js +1 -1
- package/dist/contracts/vaults-addresses.cjs +1 -1
- package/dist/contracts/vaults-addresses.cjs.map +1 -1
- package/dist/contracts/vaults-addresses.d.ts +3 -0
- package/dist/contracts/vaults-addresses.js +4 -1
- package/dist/contracts/vaults-addresses.js.map +1 -1
- package/dist/{createWalletClient-LeyDLKOH.cjs → createWalletClient-Cct6ojqI.cjs} +2 -2
- package/dist/{createWalletClient-LeyDLKOH.cjs.map → createWalletClient-Cct6ojqI.cjs.map} +1 -1
- package/dist/{createWalletClient-CYva1_XM.js → createWalletClient-DAuQCrLq.js} +5 -5
- package/dist/{createWalletClient-CYva1_XM.js.map → createWalletClient-DAuQCrLq.js.map} +1 -1
- package/dist/{getContract-BES7gSby.js → getContract-DEPNMZxg.js} +2 -2
- package/dist/{getContract-BES7gSby.js.map → getContract-DEPNMZxg.js.map} +1 -1
- package/dist/{getContract-F-fd_vf7.cjs → getContract-DUA3M2pm.cjs} +2 -2
- package/dist/{getContract-F-fd_vf7.cjs.map → getContract-DUA3M2pm.cjs.map} +1 -1
- package/dist/{localBatchGatewayRequest-CCdxn5t3.js → localBatchGatewayRequest-C0QtijkB.js} +3 -3
- package/dist/{localBatchGatewayRequest-CCdxn5t3.js.map → localBatchGatewayRequest-C0QtijkB.js.map} +1 -1
- package/dist/{localBatchGatewayRequest-DCWU6kQW.cjs → localBatchGatewayRequest-CKLnLqib.cjs} +2 -2
- package/dist/{localBatchGatewayRequest-DCWU6kQW.cjs.map → localBatchGatewayRequest-CKLnLqib.cjs.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/dist/{secp256k1-DGP4Y7VW.js → secp256k1-ClOw2ksU.js} +2 -2
- package/dist/{secp256k1-DGP4Y7VW.js.map → secp256k1-ClOw2ksU.js.map} +1 -1
- package/dist/{secp256k1-QOxLqUEc.cjs → secp256k1-YUzyTLhP.cjs} +2 -2
- package/dist/{secp256k1-QOxLqUEc.cjs.map → secp256k1-YUzyTLhP.cjs.map} +1 -1
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/{writeContract-Cqc9vxbU.cjs → writeContract-BfAYISeL.cjs} +4 -4
- package/dist/{writeContract-Cqc9vxbU.cjs.map → writeContract-BfAYISeL.cjs.map} +1 -1
- package/dist/{writeContract-QAArm5iD.js → writeContract-DkC9wV5p.js} +4 -4
- package/dist/{writeContract-QAArm5iD.js.map → writeContract-DkC9wV5p.js.map} +1 -1
- package/package.json +1 -1
- package/dist/constants-BweLzNUt.js.map +0 -1
- package/dist/constants-JN89aXws.cjs.map +0 -1
package/dist/utils/version.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.25.
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e="1.25.1",o=e;exports.version=o;
|
|
2
2
|
//# sourceMappingURL=version.cjs.map
|
package/dist/utils/version.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const i=require("./constants-
|
|
1
|
+
"use strict";const i=require("./constants-CxSgz27h.cjs"),nn="1.0.8";let k=class rt extends Error{constructor(t,r={}){var a;const n=r.cause instanceof rt?r.cause.details:(a=r.cause)!=null&&a.message?r.cause.message:r.details,o=r.cause instanceof rt&&r.cause.docsPath||r.docsPath,s=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${nn}`].join(`
|
|
2
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"}),r.cause&&(this.cause=r.cause),this.details=n,this.docsPath=o,this.metaMessages=r.metaMessages,this.shortMessage=t}};function Z(e,t){const r=e.exec(t);return r==null?void 0:r.groups}const Wt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Zt=/^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)?$/,Kt=/^\(.+?\).*?$/,Mt=/^tuple(?<array>(\[(\d*)\])*)$/;function nt(e){let t=e.type;if(Mt.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let o=0;o<r;o++){const s=e.components[o];t+=nt(s),o<r-1&&(t+=", ")}const n=Z(Mt,e.type);return t+=`)${(n==null?void 0:n.array)??""}`,nt({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function ne(e){let t="";const r=e.length;for(let n=0;n<r;n++){const o=e[n];t+=nt(o),n!==r-1&&(t+=", ")}return t}function Jt(e){var t;return e.type==="function"?`function ${e.name}(${ne(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${ne(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${ne(e.inputs)})`:e.type==="error"?`error ${e.name}(${ne(e.inputs)})`:e.type==="constructor"?`constructor(${ne(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Yt=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function on(e){return Yt.test(e)}function sn(e){return Z(Yt,e)}const Xt=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function an(e){return Xt.test(e)}function cn(e){return Z(Xt,e)}const Qt=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function un(e){return Qt.test(e)}function dn(e){return Z(Qt,e)}const er=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function lt(e){return er.test(e)}function ln(e){return Z(er,e)}const tr=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function fn(e){return tr.test(e)}function pn(e){return Z(tr,e)}const rr=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function bn(e){return rr.test(e)}function yn(e){return Z(rr,e)}const mn=/^receive\(\) external payable$/;function hn(e){return mn.test(e)}const gn=new Set(["indexed"]),ot=new Set(["calldata","memory","storage"]);class wn extends k{constructor({signature:t}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(t,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class vn extends k{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 En extends k{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 xn extends k{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Pn extends k{constructor({param:t,name:r}){super("Invalid ABI parameter.",{details:t,metaMessages:[`"${r}" 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 An extends k{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class $n extends k{constructor({param:t,type:r,modifier:n}){super("Invalid ABI parameter.",{details:t,metaMessages:[`Modifier "${n}" not allowed${r?` in "${r}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${n}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class Bn extends k{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 ee extends k{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class Tn extends k{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class Fn extends k{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 Sn extends k{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 In extends k{constructor({current:t,depth:r}){super("Unbalanced parentheses.",{metaMessages:[`"${t.trim()}" has too many ${r>0?"opening":"closing"} parentheses.`],details:`Depth "${r}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}function Rn(e,t,r){let n="";if(r)for(const o of Object.entries(r)){if(!o)continue;let s="";for(const a of o[1])s+=`[${a.type}${a.name?`:${a.name}`:""}]`;n+=`(${o[0]}{${s}})`}return t?`${t}:${e}${n}`:e}const Je=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 nr(e,t={}){if(un(e))return Mn(e,t);if(an(e))return Cn(e,t);if(on(e))return kn(e,t);if(fn(e))return Nn(e,t);if(bn(e))return jn(e);if(hn(e))return{type:"receive",stateMutability:"payable"};throw new Tn({signature:e})}function Mn(e,t={}){const r=dn(e);if(!r)throw new ee({signature:e,type:"function"});const n=O(r.parameters),o=[],s=n.length;for(let c=0;c<s;c++)o.push(J(n[c],{modifiers:ot,structs:t,type:"function"}));const a=[];if(r.returns){const c=O(r.returns),u=c.length;for(let d=0;d<u;d++)a.push(J(c[d],{modifiers:ot,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:o,outputs:a}}function Cn(e,t={}){const r=cn(e);if(!r)throw new ee({signature:e,type:"event"});const n=O(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(J(n[a],{modifiers:gn,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:o}}function kn(e,t={}){const r=sn(e);if(!r)throw new ee({signature:e,type:"error"});const n=O(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(J(n[a],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:o}}function Nn(e,t={}){const r=pn(e);if(!r)throw new ee({signature:e,type:"constructor"});const n=O(r.parameters),o=[],s=n.length;for(let a=0;a<s;a++)o.push(J(n[a],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:o}}function jn(e){const t=yn(e);if(!t)throw new ee({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}const On=/^(?<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$_]*))?$/,zn=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Hn=/^u?int$/;function J(e,t){var p,f;const r=Rn(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Je.has(r))return Je.get(r);const n=Kt.test(e),o=Z(n?zn:On,e);if(!o)throw new xn({param:e});if(o.name&&Dn(o.name))throw new Pn({param:e,name:o.name});const s=o.name?{name:o.name}:{},a=o.modifier==="indexed"?{indexed:!0}:{},c=(t==null?void 0:t.structs)??{};let u,d={};if(n){u="tuple";const y=O(o.type),b=[],m=y.length;for(let g=0;g<m;g++)b.push(J(y[g],{structs:c}));d={components:b}}else if(o.type in c)u="tuple",d={components:c[o.type]};else if(Hn.test(o.type))u=`${o.type}256`;else if(u=o.type,(t==null?void 0:t.type)!=="struct"&&!or(u))throw new En({type:u});if(o.modifier){if(!((f=(p=t==null?void 0:t.modifiers)==null?void 0:p.has)!=null&&f.call(p,o.modifier)))throw new An({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(ot.has(o.modifier)&&!Ln(u,!!o.array))throw new $n({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${u}${o.array??""}`,...s,...a,...d};return Je.set(r,l),l}function O(e,t=[],r="",n=0){const o=e.trim().length;for(let s=0;s<o;s++){const a=e[s],c=e.slice(s+1);switch(a){case",":return n===0?O(c,[...t,r.trim()]):O(c,t,`${r}${a}`,n);case"(":return O(c,t,`${r}${a}`,n+1);case")":return O(c,t,`${r}${a}`,n-1);default:return O(c,t,`${r}${a}`,n)}}if(r==="")return t;if(n!==0)throw new In({current:r,depth:n});return t.push(r.trim()),t}function or(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Wt.test(e)||Zt.test(e)}const Gn=/^(?: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 Dn(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Wt.test(e)||Zt.test(e)||Gn.test(e)}function Ln(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function sr(e){const t={},r=e.length;for(let a=0;a<r;a++){const c=e[a];if(!lt(c))continue;const u=ln(c);if(!u)throw new ee({signature:c,type:"struct"});const d=u.properties.split(";"),l=[],p=d.length;for(let f=0;f<p;f++){const b=d[f].trim();if(!b)continue;const m=J(b,{type:"struct"});l.push(m)}if(!l.length)throw new Fn({signature:c});t[u.name]=l}const n={},o=Object.entries(t),s=o.length;for(let a=0;a<s;a++){const[c,u]=o[a];n[c]=ar(u,t)}return n}const _n=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function ar(e,t,r=new Set){const n=[],o=e.length;for(let s=0;s<o;s++){const a=e[s];if(Kt.test(a.type))n.push(a);else{const u=Z(_n,a.type);if(!(u!=null&&u.type))throw new Bn({abiParameter:a});const{array:d,type:l}=u;if(l in t){if(r.has(l))throw new Sn({type:l});n.push({...a,type:`tuple${d??""}`,components:ar(t[l]??[],t,new Set([...r,l]))})}else if(or(l))n.push(a);else throw new vn({type:l})}}return n}function ir(e){const t=sr(e),r=[],n=e.length;for(let o=0;o<n;o++){const s=e[o];lt(s)||r.push(nr(s,t))}return r}function A(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const o=e[r];return typeof o=="function"?o:s=>t(e,s)}function D(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new no(e.type);return`${e.name}(${be(e.inputs,{includeName:t})})`}function be(e,{includeName:t=!1}={}){return e?e.map(r=>qn(r,{includeName:t})).join(t?", ":","):""}function qn(e,{includeName:t}){return e.type.startsWith("tuple")?`(${be(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class Un extends i.BaseError{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(`
|
|
3
3
|
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class Ct extends i.BaseError{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(`
|
|
4
4
|
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class cr extends i.BaseError{constructor({data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(`
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
${Mo(y)}`),super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Raw Call Arguments:",m].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}class ko extends i.BaseError{constructor(t,{abi:r,args:n,contractAddress:o,docsPath:s,functionName:a,sender:c}){const u=te({abi:r,args:n,name:a}),d=u?xr({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,l=u?D(u,{includeName:!0}):void 0,p=i.prettyPrint({address:o&&Co(o),function:l,args:d&&d!=="()"&&`${[...Array((a==null?void 0:a.length)??0).keys()].map(()=>" ").join("")}${d}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${a}".`,{cause:t,docsPath:s,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],p&&"Contract Call:",p].filter(Boolean),name:"ContractFunctionExecutionError"}),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}),this.abi=r,this.args=n,this.cause=t,this.contractAddress=o,this.functionName=a,this.sender=c}}class Ar extends i.BaseError{constructor({abi:t,data:r,functionName:n,message:o}){let s,a,c,u;if(r&&r!=="0x")try{a=Er({abi:t,data:r});const{abiItem:l,errorName:p,args:f}=a;if(p==="Error")u=f[0];else if(p==="Panic"){const[y]=f;u=gr[y]}else{const y=l?D(l,{includeName:!0}):void 0,b=l&&f?xr({abiItem:l,args:f,includeFunctionName:!1,includeName:!1}):void 0;c=[y?`Error: ${y}`:"",b&&b!=="()"?` ${[...Array((p==null?void 0:p.length)??0).keys()].map(()=>" ").join("")}${b}`:""]}}catch(l){s=l}else o&&(u=o);let d;s instanceof ur&&(d=s.signature,c=[`Unable to decode signature "${d}" 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=${d}.`]),super(u&&u!=="execution reverted"||d?[`The contract function "${n}" reverted with the following ${d?"signature":"reason"}:`,u||d].join(`
|
|
31
31
|
`):`The contract function "${n}" reverted.`,{cause:s,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{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=a,this.raw=r,this.reason=u,this.signature=d}}class No extends i.BaseError{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."],name:"ContractFunctionZeroDataError"})}}class jo extends i.BaseError{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"})}}class yt extends i.BaseError{constructor({data:t,message:r}){super(r||"",{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}}class Oo extends i.BaseError{constructor({body:t,cause:r,details:n,headers:o,status:s,url:a}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[s&&`Status: ${s}`,`URL: ${Ee(a)}`,t&&`Request body: ${Y(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=s,this.url=a}}class mt extends i.BaseError{constructor({body:t,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${Ee(n)}`,`Request body: ${Y(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code,this.data=r.data}}class zo extends i.BaseError{constructor({body:t,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${Ee(r)}`,`Request body: ${Y(t)}`],name:"TimeoutError"})}}const Ho=-1;class R extends i.BaseError{constructor(t,{code:r,docsPath:n,metaMessages:o,name:s,shortMessage:a}){super(a,{cause:t,docsPath:n,metaMessages:o||(t==null?void 0:t.metaMessages),name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||t.name,this.code=t instanceof mt?t.code:r??Ho}}class N extends R{constructor(t,r){super(t,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class xe extends R{constructor(t){super(t,{code:xe.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(xe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class Pe extends R{constructor(t){super(t,{code:Pe.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(Pe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class Ae extends R{constructor(t,{method:r}={}){super(t,{code:Ae.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(Ae,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class $e extends R{constructor(t){super(t,{code:$e.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
32
32
|
`)})}}Object.defineProperty($e,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ue extends R{constructor(t){super(t,{code:ue.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(ue,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class de extends R{constructor(t){super(t,{code:de.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
33
|
-
`)})}}Object.defineProperty(de,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Be extends R{constructor(t){super(t,{code:Be.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Be,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Te extends R{constructor(t){super(t,{code:Te.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Te,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Fe extends R{constructor(t){super(t,{code:Fe.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Fe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Se extends R{constructor(t,{method:r}={}){super(t,{code:Se.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Se,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Ie extends R{constructor(t){super(t,{code:Ie.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Ie,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Re extends R{constructor(t){super(t,{code:Re.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Re,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Me extends N{constructor(t){super(t,{code:Me.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Me,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Ce extends N{constructor(t){super(t,{code:Ce.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Ce,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ke extends N{constructor(t,{method:r}={}){super(t,{code:ke.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(ke,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ne extends N{constructor(t){super(t,{code:Ne.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ne,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class je extends N{constructor(t){super(t,{code:je.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(je,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Oe extends N{constructor(t){super(t,{code:Oe.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Oe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ze extends N{constructor(t){super(t,{code:ze.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ze,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class He extends N{constructor(t){super(t,{code:He.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(He,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Ge extends N{constructor(t){super(t,{code:Ge.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class De extends N{constructor(t){super(t,{code:De.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(De,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Le extends N{constructor(t){super(t,{code:Le.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Le,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class _e extends N{constructor(t){super(t,{code:_e.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(_e,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class qe extends N{constructor(t){super(t,{code:qe.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(qe,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Go extends R{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Do=3;function le(e,{abi:t,address:r,args:n,docsPath:o,functionName:s,sender:a}){const c=e instanceof yt?e:e instanceof i.BaseError?e.walk(b=>"data"in b)||e.walk():{},{code:u,data:d,details:l,message:p,shortMessage:f}=c,y=e instanceof ye?new No({functionName:s}):[Do,ue.code].includes(u)&&(d||l||p||f)?new Ar({abi:t,data:typeof d=="object"?d.data:d,functionName:s,message:c instanceof mt?l:f??p}):e;return new ko(y,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:s,sender:a})}function Lo(e){const t=i.keccak256(`0x${e.substring(4)}`).substring(26);return i.checksumAddress(`0x${t}`)}async function _o({hash:e,signature:t}){const r=i.isHex(e)?e:i.toHex(e),{secp256k1:n}=await Promise.resolve().then(()=>require("./secp256k1-QOxLqUEc.cjs"));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:d,s:l,v:p,yParity:f}=t,y=Number(f??p),b=Gt(y);return new n.Signature(i.hexToBigInt(d),i.hexToBigInt(l)).addRecoveryBit(b)}const a=i.isHex(t)?t:i.toHex(t);if(i.size(a)!==65)throw new Error("invalid signature length");const c=i.hexToNumber(`0x${a.slice(130)}`),u=Gt(c);return n.Signature.fromCompact(a.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Gt(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function $r({hash:e,signature:t}){return Lo(await _o({hash:e,signature:t}))}function qo(e){const{chainId:t,nonce:r,to:n}=e,o=e.contractAddress??e.address,s=i.keccak256(i.concatHex(["0x05",i.toRlp([t?i.numberToHex(t):"0x",o,r?i.numberToHex(r):"0x"])]));return n==="bytes"?i.hexToBytes$1(s):s}async function Br(e){const{authorization:t,signature:r}=e;return $r({hash:qo(t),signature:r??t})}class Uo extends i.BaseError{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:a,gasPrice:c,maxFeePerGas:u,maxPriorityFeePerGas:d,nonce:l,to:p,value:f}){var b;const y=i.prettyPrint({from:r==null?void 0:r.address,to:p,value:typeof f<"u"&&`${i.formatEther(f)} ${((b=o==null?void 0:o.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:s,gas:a,gasPrice:typeof c<"u"&&`${i.formatGwei(c)} gwei`,maxFeePerGas:typeof u<"u"&&`${i.formatGwei(u)} gwei`,maxPriorityFeePerGas:typeof d<"u"&&`${i.formatGwei(d)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",y].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function Ue(e,t){const r=(e.details||"").toLowerCase(),n=e instanceof i.BaseError?e.walk(o=>(o==null?void 0:o.code)===i.ExecutionRevertedError.code):e;return n instanceof i.BaseError?new i.ExecutionRevertedError({cause:e,message:n.details}):i.ExecutionRevertedError.nodeMessage.test(r)?new i.ExecutionRevertedError({cause:e,message:e.details}):i.FeeCapTooHighError.nodeMessage.test(r)?new i.FeeCapTooHighError({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):i.FeeCapTooLowError.nodeMessage.test(r)?new i.FeeCapTooLowError({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):i.NonceTooHighError.nodeMessage.test(r)?new i.NonceTooHighError({cause:e,nonce:t==null?void 0:t.nonce}):i.NonceTooLowError.nodeMessage.test(r)?new i.NonceTooLowError({cause:e,nonce:t==null?void 0:t.nonce}):i.NonceMaxValueError.nodeMessage.test(r)?new i.NonceMaxValueError({cause:e,nonce:t==null?void 0:t.nonce}):i.InsufficientFundsError.nodeMessage.test(r)?new i.InsufficientFundsError({cause:e}):i.IntrinsicGasTooHighError.nodeMessage.test(r)?new i.IntrinsicGasTooHighError({cause:e,gas:t==null?void 0:t.gas}):i.IntrinsicGasTooLowError.nodeMessage.test(r)?new i.IntrinsicGasTooLowError({cause:e,gas:t==null?void 0:t.gas}):i.TransactionTypeNotSupportedError.nodeMessage.test(r)?new i.TransactionTypeNotSupportedError({cause:e}):i.TipAboveFeeCapError.nodeMessage.test(r)?new i.TipAboveFeeCapError({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new i.UnknownNodeError({cause:e})}function Vo(e,{docsPath:t,...r}){const n=(()=>{const o=Ue(e,r);return o instanceof i.UnknownNodeError?e:o})();return new Uo(n,{docsPath:t,...r})}function Ve(e,{format:t}){if(!t)return{};const r={};function n(s){const a=Object.keys(s);for(const c of a)c in e&&(r[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&n(s[c])}const o=t(e||{});return n(o),r}const Wo={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function We(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Zo(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(r=>i.bytesToHex(r)):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=i.numberToHex(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=i.numberToHex(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=i.numberToHex(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=i.numberToHex(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=i.numberToHex(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=i.numberToHex(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Wo[e.type]),typeof e.value<"u"&&(t.value=i.numberToHex(e.value)),t}function Zo(e){return e.map(t=>({address:t.address,r:t.r?i.numberToHex(BigInt(t.r)):t.r,s:t.s?i.numberToHex(BigInt(t.s)):t.s,chainId:i.numberToHex(t.chainId),nonce:i.numberToHex(t.nonce),...typeof t.yParity<"u"?{yParity:i.numberToHex(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:i.numberToHex(t.v)}:{}}))}function Dt(e){if(!(!e||e.length===0))return e.reduce((t,{slot:r,value:n})=>{if(r.length!==66)throw new i.InvalidBytesLengthError({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new i.InvalidBytesLengthError({size:n.length,targetSize:66,type:"hex"});return t[r]=n,t},{})}function Ko(e){const{balance:t,nonce:r,state:n,stateDiff:o,code:s}=e,a={};if(s!==void 0&&(a.code=s),t!==void 0&&(a.balance=i.numberToHex(t)),r!==void 0&&(a.nonce=i.numberToHex(r)),n!==void 0&&(a.state=Dt(n)),o!==void 0){if(a.state)throw new Ro;a.stateDiff=Dt(o)}return a}function ht(e){if(!e)return;const t={};for(const{address:r,...n}of e){if(!i.isAddress(r,{strict:!1}))throw new i.InvalidAddressError({address:r});if(t[r])throw new Io({address:r});t[r]=Ko(n)}return t}function fe(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:o,to:s}=e,a=t?_(t):void 0;if(a&&!i.isAddress(a.address))throw new i.InvalidAddressError({address:a.address});if(s&&!i.isAddress(s))throw new i.InvalidAddressError({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof o<"u"))throw new i.FeeConflictError;if(n&&n>i.maxUint256)throw new i.FeeCapTooHighError({maxFeePerGas:n});if(o&&n&&o>n)throw new i.TipAboveFeeCapError({maxFeePerGas:n,maxPriorityFeePerGas:o})}class Jo extends i.BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class gt extends i.BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Yo extends i.BaseError{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${i.formatGwei(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Tr extends i.BaseError{constructor({blockHash:t,blockNumber:r}){let n="Block";t&&(n=`Block at hash "${t}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}async function ie(e,{blockHash:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",includeTransactions:o}={}){var d,l,p;const s=o??!1,a=r!==void 0?i.numberToHex(r):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[a||n,s]},{dedupe:!!a}),!c)throw new Tr({blockHash:t,blockNumber:r});return(((p=(l=(d=e.chain)==null?void 0:d.formatters)==null?void 0:l.block)==null?void 0:p.format)||i.formatBlock)(c)}async function wt(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Xo(e,t){return Fr(e,t)}async function Fr(e,t){var s,a;const{block:r,chain:n=e.chain,request:o}=t||{};try{const c=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee);if(typeof c=="function"){const d=r||await A(e,ie,"getBlock")({}),l=await c({block:d,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const u=await e.request({method:"eth_maxPriorityFeePerGas"});return i.hexToBigInt(u)}catch{const[c,u]=await Promise.all([r?Promise.resolve(r):A(e,ie,"getBlock")({}),A(e,wt,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new gt;const d=u-c.baseFeePerGas;return d<0n?0n:d}}async function Qo(e,t){return it(e,t)}async function it(e,t){var f,y;const{block:r,chain:n=e.chain,request:o,type:s="eip1559"}=t||{},a=await(async()=>{var b,m;return typeof((b=n==null?void 0:n.fees)==null?void 0:b.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:e,request:o}):((m=n==null?void 0:n.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(a<1)throw new Jo;const u=10**(((f=a.toString().split(".")[1])==null?void 0:f.length)??0),d=b=>b*BigInt(Math.ceil(a*u))/BigInt(u),l=r||await A(e,ie,"getBlock")({});if(typeof((y=n==null?void 0:n.fees)==null?void 0:y.estimateFeesPerGas)=="function"){const b=await n.fees.estimateFeesPerGas({block:r,client:e,multiply:d,request:o,type:s});if(b!==null)return b}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new gt;const b=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Fr(e,{block:l,chain:n,request:o}),m=d(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+b,maxPriorityFeePerGas:b}}return{gasPrice:(o==null?void 0:o.gasPrice)??d(await A(e,wt,"getGasPrice")({}))}}async function Sr(e,{address:t,blockTag:r="latest",blockNumber:n}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof n=="bigint"?i.numberToHex(n):r]},{dedupe:!!n});return i.hexToNumber(o)}async function vt(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return i.hexToNumber(t)}const Ir=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Lt=new Map;async function Et(e,t){const{account:r=e.account,blobs:n,chain:o,gas:s,kzg:a,nonce:c,nonceManager:u,parameters:d=Ir,type:l}=t,p=r&&_(r),f={...t,...p?{from:p==null?void 0:p.address}:{}};let y;async function b(){return y||(y=await A(e,ie,"getBlock")({blockTag:"latest"}),y)}let m;async function g(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await A(e,vt,"getChainId")({}),m))}if(d.includes("nonce")&&typeof c>"u"&&p)if(u){const h=await g();f.nonce=await u.consume({address:p.address,chainId:h,client:e})}else f.nonce=await A(e,Sr,"getTransactionCount")({address:p.address,blockTag:"pending"});if((d.includes("blobVersionedHashes")||d.includes("sidecars"))&&n&&a){const h=i.blobsToCommitments({blobs:n,kzg:a});if(d.includes("blobVersionedHashes")){const w=i.commitmentsToVersionedHashes({commitments:h,to:"hex"});f.blobVersionedHashes=w}if(d.includes("sidecars")){const w=i.blobsToProofs({blobs:n,commitments:h,kzg:a}),x=i.toBlobSidecars({blobs:n,commitments:h,proofs:w,to:"hex"});f.sidecars=x}}if(d.includes("chainId")&&(f.chainId=await g()),(d.includes("fees")||d.includes("type"))&&typeof l>"u")try{f.type=i.getTransactionType(f)}catch{let h=Lt.get(e.uid);if(typeof h>"u"){const w=await b();h=typeof(w==null?void 0:w.baseFeePerGas)=="bigint",Lt.set(e.uid,h)}f.type=h?"eip1559":"legacy"}if(d.includes("fees"))if(f.type!=="legacy"&&f.type!=="eip2930"){if(typeof f.maxFeePerGas>"u"||typeof f.maxPriorityFeePerGas>"u"){const h=await b(),{maxFeePerGas:w,maxPriorityFeePerGas:x}=await it(e,{block:h,chain:o,request:f});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<x)throw new Yo({maxPriorityFeePerGas:x});f.maxPriorityFeePerGas=x,f.maxFeePerGas=w}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new gt;if(typeof t.gasPrice>"u"){const h=await b(),{gasPrice:w}=await it(e,{block:h,chain:o,request:f,type:"legacy"});f.gasPrice=w}}return d.includes("gas")&&typeof s>"u"&&(f.gas=await A(e,xt,"estimateGas")({...f,account:p&&{address:p.address,type:"json-rpc"}})),fe(f),delete f.parameters,f}async function Rr(e,{address:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest"}){const o=typeof r=="bigint"?i.numberToHex(r):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||n]});return BigInt(s)}async function xt(e,t){var o,s,a;const{account:r=e.account}=t,n=r?_(r):void 0;try{let S=function(H){const{block:U,request:$,rpcStateOverride:I}=H;return e.request({method:"eth_estimateGas",params:I?[$,U??e.experimental_blockTag??"latest",I]:U?[$,U]:[$]})};const{accessList:c,authorizationList:u,blobs:d,blobVersionedHashes:l,blockNumber:p,blockTag:f,data:y,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,value:E,stateOverride:F,...B}=await Et(e,{...t,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),v=(typeof p=="bigint"?i.numberToHex(p):void 0)||f,P=ht(F),z=await(async()=>{if(B.to)return B.to;if(u&&u.length>0)return await Br({authorization:u[0]}).catch(()=>{throw new i.BaseError("`to` is required. Could not infer from `authorizationList`")})})();fe(t);const T=(a=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:a.format,C=(T||We)({...Ve(B,{format:T}),from:n==null?void 0:n.address,accessList:c,authorizationList:u,blobs:d,blobVersionedHashes:l,data:y,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,to:z,value:E});let j=BigInt(await S({block:v,request:C,rpcStateOverride:P}));if(u){const H=await Rr(e,{address:C.from}),U=await Promise.all(u.map(async $=>{const{address:I}=$,V=await S({block:v,request:{authorizationList:void 0,data:y,from:n==null?void 0:n.address,to:I,value:i.numberToHex(H)},rpcStateOverride:P}).catch(()=>100000n);return 2n*BigInt(V)}));j+=U.reduce(($,I)=>$+I,0n)}return j}catch(c){throw Vo(c,{...t,account:n,chain:e.chain})}}async function es(e,t){const{abi:r,address:n,args:o,functionName:s,dataSuffix:a,...c}=t,u=re({abi:r,args:o,functionName:s});try{return await A(e,xt,"estimateGas")({data:`${u}${a?a.replace("0x",""):""}`,to:n,...c})}catch(d){const l=c.account?_(c.account):void 0;throw le(d,{abi:r,address:n,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Mr(e,t){if(!i.isAddress(e,{strict:!1}))throw new i.InvalidAddressError({address:e});if(!i.isAddress(t,{strict:!1}))throw new i.InvalidAddressError({address:t});return e.toLowerCase()===t.toLowerCase()}const _t="/docs/contract/decodeEventLog";function Pt(e){const{abi:t,data:r,strict:n,topics:o}=e,s=n??!0,[a,...c]=o;if(!a)throw new Yn({docsPath:_t});const u=t.find(m=>m.type==="event"&&a===he(D(m)));if(!(u&&"name"in u)||u.type!=="event")throw new dr(a,{docsPath:_t});const{name:d,inputs:l}=u,p=l==null?void 0:l.some(m=>!("name"in m&&m.name)),f=p?[]:{},y=l.map((m,g)=>[m,g]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<y.length;m++){const[g,h]=y[m],w=c[m];if(!w)throw new me({abiItem:u,param:g});f[p?h:g.name||h]=ts({param:g,value:w})}const b=l.filter(m=>!("indexed"in m&&m.indexed));if(b.length>0){if(r&&r!=="0x")try{const m=ce(b,r);if(m)if(p)for(let g=0;g<l.length;g++)f[g]=f[g]??m.shift();else for(let g=0;g<b.length;g++)f[b[g].name]=m[g]}catch(m){if(s)throw m instanceof cr||m instanceof i.PositionOutOfBoundsError?new se({abiItem:u,data:r,params:b,size:i.size(r)}):m}else if(s)throw new se({abiItem:u,data:"0x",params:b,size:0})}return{eventName:d,args:Object.values(f).length>0?f:void 0}}function ts({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(ce([e],t)||[])[0]}function At(e){const{abi:t,args:r,logs:n,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return n.map(a=>{var c;try{const u=t.find(l=>l.type==="event"&&a.topics[0]===he(l));if(!u)return null;const d=Pt({...a,abi:[u],strict:o});return s&&!s.includes(d.eventName)||!rs({args:d.args,inputs:u.inputs,matchArgs:r})?null:{...d,...a}}catch(u){let d,l;if(u instanceof dr)return null;if(u instanceof se||u instanceof me){if(o)return null;d=u.abiItem.name,l=(c=u.abiItem.inputs)==null?void 0:c.some(p=>!("name"in p&&p.name))}return{...a,args:l?[]:{},eventName:d}}}).filter(Boolean)}function rs(e){const{args:t,inputs:r,matchArgs:n}=e;if(!n)return!0;if(!t)return!1;function o(s,a,c){try{return s.type==="address"?Mr(a,c):s.type==="string"||s.type==="bytes"?i.keccak256(i.toBytes(a))===c:a===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(n)?n.every((s,a)=>{if(s==null)return!0;const c=r[a];return c?(Array.isArray(s)?s:[s]).some(d=>o(c,d,t[a])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof n=="object"&&!Array.isArray(n)?Object.entries(n).every(([s,a])=>{if(a==null)return!0;const c=r.find(d=>d.name===s);return c?(Array.isArray(a)?a:[a]).some(d=>o(c,d,t[s])):!1}):!1}async function Cr(e,{address:t,blockHash:r,fromBlock:n,toBlock:o,event:s,events:a,args:c,strict:u}={}){const d=u??!1,l=a??(s?[s]:void 0);let p=[];l&&(p=[l.flatMap(m=>ve({abi:[m],eventName:m.name,args:a?void 0:c}))],s&&(p=p[0]));let f;r?f=await e.request({method:"eth_getLogs",params:[{address:t,topics:p,blockHash:r}]}):f=await e.request({method:"eth_getLogs",params:[{address:t,topics:p,fromBlock:typeof n=="bigint"?i.numberToHex(n):n,toBlock:typeof o=="bigint"?i.numberToHex(o):o}]});const y=f.map(b=>i.formatLog(b));return l?At({abi:l,args:c,logs:y,strict:d}):y}async function kr(e,t){const{abi:r,address:n,args:o,blockHash:s,eventName:a,fromBlock:c,toBlock:u,strict:d}=t,l=a?te({abi:r,name:a}):void 0,p=l?void 0:r.filter(f=>f.type==="event");return A(e,Cr,"getLogs")({address:n,args:o,blockHash:s,event:l,events:p,fromBlock:c,toBlock:u,strict:d})}const Ye="/docs/contract/decodeFunctionResult";function Ze(e){const{abi:t,args:r,functionName:n,data:o}=e;let s=t[0];if(n){const c=te({abi:t,args:r,name:n});if(!c)throw new oe(n,{docsPath:Ye});s=c}if(s.type!=="function")throw new oe(void 0,{docsPath:Ye});if(!s.outputs)throw new lr(s.name,{docsPath:Ye});const a=ce(s.outputs,o);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const ns="0.1.1";function os(){return ns}class L extends Error{constructor(t,r={}){const n=(()=>{var u;if(r.cause instanceof L){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),o=r.cause instanceof L&&r.cause.docsPath||r.docsPath,a=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n||o?["",n?`Details: ${n}`:void 0,o?`See: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
|
|
34
|
-
`);super(c,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{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,"shortMessage",{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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${os()}`}),this.cause=r.cause,this.details=n,this.docs=a,this.docsPath=o,this.shortMessage=t}walk(t){return Nr(this,t)}}function Nr(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Nr(e.cause,t):t?null:e}const ss="#__bigint";function as(e,t,r){return JSON.stringify(e,(n,o)=>typeof o=="bigint"?o.toString()+ss:o,r)}function $t(e,t){if(X(e)>t)throw new hs({givenSize:X(e),maxSize:t})}function is(e,t){if(typeof t=="number"&&t>0&&t>X(e)-1)throw new Gr({offset:t,position:"start",size:X(e)})}function cs(e,t,r){if(typeof t=="number"&&typeof r=="number"&&X(e)!==r-t)throw new Gr({offset:r,position:"end",size:X(e)})}function jr(e,t={}){const{dir:r,size:n=32}=t;if(n===0)return e;const o=e.replace("0x","");if(o.length>n*2)throw new gs({size:Math.ceil(o.length/2),targetSize:n,type:"Hex"});return`0x${o[r==="right"?"padEnd":"padStart"](n*2,"0")}`}const us=new TextEncoder,ds=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ls(e,t={}){const{strict:r=!1}=t;if(!e)throw new qt(e);if(typeof e!="string")throw new qt(e);if(r&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Ut(e);if(!e.startsWith("0x"))throw new Ut(e)}function fs(...e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}function ps(e,t={}){const r=`0x${Number(e)}`;return typeof t.size=="number"?($t(r,t.size),Bt(r,t.size)):r}function Or(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=ds[e[o]];const n=`0x${r}`;return typeof t.size=="number"?($t(n,t.size),zr(n,t.size)):n}function G(e,t={}){const{signed:r,size:n}=t,o=BigInt(e);let s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<a){const d=typeof e=="bigint"?"n":"";throw new Hr({max:s?`${s}${d}`:void 0,min:`${a}${d}`,signed:r,size:n,value:`${e}${d}`})}const u=`0x${(r&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?Bt(u,n):u}function bs(e,t={}){return Or(us.encode(e),t)}function Bt(e,t){return jr(e,{dir:"left",size:t})}function zr(e,t){return jr(e,{dir:"right",size:t})}function ys(e,t,r,n={}){const{strict:o}=n;is(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&cs(s,t,r),s}function X(e){return Math.ceil((e.length-2)/2)}function ms(e,t={}){const{strict:r=!1}=t;try{return ls(e,{strict:r}),!0}catch{return!1}}class Hr extends L{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${n?" signed":" unsigned"} integer range ${t?`(\`${r}\` to \`${t}\`)`:`(above \`${r}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class qt extends L{constructor(t){super(`Value \`${typeof t=="object"?as(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Ut extends L{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class hs extends L{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class Gr extends L{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class gs extends L{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function ws(e){return{address:e.address,amount:G(e.amount),index:G(e.index),validatorIndex:G(e.validatorIndex)}}function Dr(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:G(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:G(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:G(e.gasLimit)},...typeof e.number=="bigint"&&{number:G(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:G(e.prevRandao)},...typeof e.time=="bigint"&&{time:G(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ws)}}}const ct=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],vs=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],Lr=[{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"}],Es=[...Lr,{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"}]}],xs=[...Lr,{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"}]}],Ps=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],As=[{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"}]}],$s=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Bs="0x82ad56cb",_r="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Ts="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Fs="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Xe="/docs/contract/encodeDeployData";function Tt(e){const{abi:t,args:r,bytecode:n}=e;if(!r||r.length===0)return n;const o=t.find(a=>"type"in a&&a.type==="constructor");if(!o)throw new Un({docsPath:Xe});if(!("inputs"in o))throw new Ct({docsPath:Xe});if(!o.inputs||o.inputs.length===0)throw new Ct({docsPath:Xe});const s=ge(o.inputs,r);return i.concatHex([n,s])}function qr({blockNumber:e,chain:t,contract:r}){var o;const n=(o=t==null?void 0:t.contracts)==null?void 0:o[r];if(!n)throw new i.ChainDoesNotSupportContract({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new i.ChainDoesNotSupportContract({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}function Ur(e,{docsPath:t,...r}){const n=(()=>{const o=Ue(e,r);return o instanceof i.UnknownNodeError?e:o})();return new Pr(n,{docsPath:t,...r})}function Vr(){let e=()=>{},t=()=>{};return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}const Qe=new Map;function Wr({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:o}){const s=async()=>{const l=u();a();const p=l.map(({args:f})=>f);p.length!==0&&e(p).then(f=>{o&&Array.isArray(f)&&f.sort(o);for(let y=0;y<l.length;y++){const{resolve:b}=l[y];b==null||b([f[y],f])}}).catch(f=>{for(let y=0;y<l.length;y++){const{reject:b}=l[y];b==null||b(f)}})},a=()=>Qe.delete(t),c=()=>u().map(({args:l})=>l),u=()=>Qe.get(t)||[],d=l=>Qe.set(t,[...u(),l]);return{flush:a,async schedule(l){const{promise:p,resolve:f,reject:y}=Vr();return(r==null?void 0:r([...c(),l]))&&s(),u().length>0?(d({args:l,resolve:f,reject:y}),p):(d({args:l,resolve:f,reject:y}),setTimeout(s,n),p)}}}async function Ft(e,t){var C,S,j,H;const{account:r=e.account,authorizationList:n,batch:o=!!((C=e.batch)!=null&&C.multicall),blockNumber:s,blockTag:a=e.experimental_blockTag??"latest",accessList:c,blobs:u,blockOverrides:d,code:l,data:p,factory:f,factoryData:y,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,to:E,value:F,stateOverride:B,...M}=t,v=r?_(r):void 0;if(l&&(f||y))throw new i.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&E)throw new i.BaseError("Cannot provide both `code` & `to` as parameters.");const P=l&&p,z=f&&y&&E&&p,T=P||z,q=P?Rs({code:l,data:p}):z?Ms({data:p,factory:f,factoryData:y,to:E}):p;try{fe(t);const $=(typeof s=="bigint"?i.numberToHex(s):void 0)||a,I=d?Dr(d):void 0,V=ht(B),It=(H=(j=(S=e.chain)==null?void 0:S.formatters)==null?void 0:j.transactionRequest)==null?void 0:H.format,Ke=(It||We)({...Ve(M,{format:It}),from:v==null?void 0:v.address,accessList:c,authorizationList:n,blobs:u,data:q,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,to:T?void 0:E,value:F});if(o&&Ss({request:Ke})&&!V&&!I)try{return await Is(e,{...Ke,blockNumber:s,blockTag:a})}catch(K){if(!(K instanceof i.ClientChainNotConfiguredError)&&!(K instanceof i.ChainDoesNotSupportContract))throw K}const rn=(()=>{const K=[Ke,$];return V&&I?[...K,V,I]:V?[...K,V]:I?[...K,{},I]:K})(),Rt=await e.request({method:"eth_call",params:rn});return Rt==="0x"?{data:void 0}:{data:Rt}}catch(U){const $=Cs(U),{offchainLookup:I,offchainLookupSignature:V}=await Promise.resolve().then(()=>require("./ccip-FdkpGaX4.cjs"));if(e.ccipRead!==!1&&($==null?void 0:$.slice(0,10))===V&&E)return{data:await I(e,{data:$,to:E})};throw T&&($==null?void 0:$.slice(0,10))==="0x101bb98d"?new jo({factory:f}):Ur(U,{...t,account:v,chain:e.chain})}}function Ss({request:e}){const{data:t,to:r,...n}=e;return!(!t||t.startsWith(Bs)||!r||Object.values(n).filter(o=>typeof o<"u").length>0)}async function Is(e,t){var m;const{batchSize:r=1024,wait:n=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:a,multicallAddress:c,to:u}=t;let d=c;if(!d){if(!e.chain)throw new i.ClientChainNotConfiguredError;d=qr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const p=(typeof o=="bigint"?i.numberToHex(o):void 0)||s,{schedule:f}=Wr({id:`${e.uid}.${p}`,wait:n,shouldSplitBatch(g){return g.reduce((w,{data:x})=>w+(x.length-2),0)>r*2},fn:async g=>{const h=g.map(E=>({allowFailure:!0,callData:E.data,target:E.to})),w=re({abi:ct,args:[h],functionName:"aggregate3"}),x=await e.request({method:"eth_call",params:[{data:w,to:d},p]});return Ze({abi:ct,args:[h],functionName:"aggregate3",data:x||"0x"})}}),[{returnData:y,success:b}]=await f({data:a,to:u});if(!b)throw new yt({data:y});return y==="0x"?{data:void 0}:{data:y}}function Rs(e){const{code:t,data:r}=e;return Tt({abi:ir(["constructor(bytes, bytes)"]),bytecode:_r,args:[t,r]})}function Ms(e){const{data:t,factory:r,factoryData:n,to:o}=e;return Tt({abi:ir(["constructor(address, bytes, address, bytes)"]),bytecode:Ts,args:[o,t,r,n]})}function Cs(e){var r;if(!(e instanceof i.BaseError))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(r=t.data)==null?void 0:r.data:t.data}async function ks(e,t){const{abi:r,address:n,args:o,functionName:s,...a}=t,c=re({abi:r,args:o,functionName:s});try{const{data:u}=await A(e,Ft,"call")({...a,data:c,to:n});return Ze({abi:r,args:o,functionName:s,data:u||"0x"})}catch(u){throw le(u,{abi:r,address:n,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ns(e,t){const{abi:r,address:n,args:o,dataSuffix:s,functionName:a,...c}=t,u=c.account?_(c.account):e.account,d=re({abi:r,args:o,functionName:a});try{const{data:l}=await A(e,Ft,"call")({batch:!1,data:`${d}${s?s.replace("0x",""):""}`,to:n,...c,account:u}),p=Ze({abi:r,args:o,functionName:a,data:l||"0x"}),f=r.filter(y=>"name"in y&&y.name===t.functionName);return{result:p,request:{abi:f,address:n,args:o,dataSuffix:s,functionName:a,...c,account:u}}}catch(l){throw le(l,{abi:r,address:n,args:o,docsPath:"/docs/contract/simulateContract",functionName:a,sender:u==null?void 0:u.address})}}const et=new Map,Vt=new Map;let js=0;function ut(e,t,r){const n=++js,o=()=>et.get(e)||[],s=()=>{const l=o();et.set(e,l.filter(p=>p.id!==n))},a=()=>{const l=o();if(!l.some(f=>f.id===n))return;const p=Vt.get(e);if(l.length===1&&p){const f=p();f instanceof Promise&&f.catch(()=>{})}s()},c=o();if(et.set(e,[...c,{id:n,fns:t}]),c&&c.length>0)return a;const u={};for(const l in t)u[l]=(...p)=>{var y,b;const f=o();if(f.length!==0)for(const m of f)(b=(y=m.fns)[l])==null||b.call(y,...p)};const d=r(u);return typeof d=="function"&&Vt.set(e,d),a}async function dt(e){return new Promise(t=>setTimeout(t,e))}function Zr(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const u=await(r==null?void 0:r(c))??n;await dt(u);const d=async()=>{o&&(await e({unpoll:s}),await dt(n),d())};d()})(),s}const Os=new Map,zs=new Map;function Hs(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:a=>s.set(o,a)}),r=t(e,Os),n=t(e,zs);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function Gs(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=Hs(t),o=n.response.get();if(o&&r>0&&new Date().getTime()-o.created.getTime()<r)return o.data;let s=n.promise.get();s||(s=e(),n.promise.set(s));try{const a=await s;return n.response.set({created:new Date,data:a}),a}finally{n.promise.clear()}}const Ds=e=>`blockNumber.${e}`;async function Kr(e,{cacheTime:t=e.cacheTime}={}){const r=await Gs(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Ds(e.uid),cacheTime:t});return BigInt(r)}async function Jr(e,{filter:t}){const r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof n[0]=="string")return n;const o=n.map(s=>i.formatLog(s));return!("abi"in t)||!t.abi?o:At({abi:t.abi,logs:o,strict:r})}async function Yr(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Ls(e,t){const{abi:r,address:n,args:o,batch:s=!0,eventName:a,fromBlock:c,onError:u,onLogs:d,poll:l,pollingInterval:p=e.pollingInterval,strict:f}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const g=f??!1,h=Y(["watchContractEvent",n,o,s,e.uid,a,p,g,c]);return ut(h,{onLogs:d,onError:u},w=>{let x;c!==void 0&&(x=c-1n);let E,F=!1;const B=Zr(async()=>{var M;if(!F){try{E=await A(e,hr,"createContractEventFilter")({abi:r,address:n,args:o,eventName:a,strict:g,fromBlock:c})}catch{}F=!0;return}try{let v;if(E)v=await A(e,Jr,"getFilterChanges")({filter:E});else{const P=await A(e,Kr,"getBlockNumber")({});x&&x<P?v=await A(e,kr,"getContractEvents")({abi:r,address:n,args:o,eventName:a,fromBlock:x+1n,toBlock:P,strict:g}):v=[],x=P}if(v.length===0)return;if(s)w.onLogs(v);else for(const P of v)w.onLogs([P])}catch(v){E&&v instanceof de&&(F=!1),(M=w.onError)==null||M.call(w,v)}},{emitOnBegin:!0,interval:p});return async()=>{E&&await A(e,Yr,"uninstallFilter")({filter:E}),B()}})})():(()=>{const g=f??!1,h=Y(["watchContractEvent",n,o,s,e.uid,a,p,g]);let w=!0,x=()=>w=!1;return ut(h,{onLogs:d,onError:u},E=>((async()=>{try{const F=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(P=>P.config.type==="webSocket"||P.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),B=a?ve({abi:r,eventName:a,args:o}):[],{unsubscribe:M}=await F.subscribe({params:["logs",{address:n,topics:B}],onData(v){var z;if(!w)return;const P=v.result;try{const{eventName:T,args:q}=Pt({abi:r,data:P.data,topics:P.topics,strict:f}),C=i.formatLog(P,{args:q,eventName:T});E.onLogs([C])}catch(T){let q,C;if(T instanceof se||T instanceof me){if(f)return;q=T.abiItem.name,C=(z=T.abiItem.inputs)==null?void 0:z.some(j=>!("name"in j&&j.name))}const S=i.formatLog(P,{args:C?[]:{},eventName:q});E.onLogs([S])}},onError(v){var P;(P=E.onError)==null||P.call(E,v)}});x=M,w||x()}catch(F){u==null||u(F)}})(),()=>x()))})()}class St extends i.BaseError{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 Client."].join(`
|
|
33
|
+
`)})}}Object.defineProperty(de,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class Be extends R{constructor(t){super(t,{code:Be.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(Be,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Te extends R{constructor(t){super(t,{code:Te.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Te,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class Fe extends R{constructor(t){super(t,{code:Fe.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(Fe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Se extends R{constructor(t,{method:r}={}){super(t,{code:Se.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not supported.`})}}Object.defineProperty(Se,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Ie extends R{constructor(t){super(t,{code:Ie.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Ie,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class Re extends R{constructor(t){super(t,{code:Re.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(Re,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Me extends N{constructor(t){super(t,{code:Me.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Me,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Ce extends N{constructor(t){super(t,{code:Ce.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Ce,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class ke extends N{constructor(t,{method:r}={}){super(t,{code:ke.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(ke,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ne extends N{constructor(t){super(t,{code:Ne.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ne,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class je extends N{constructor(t){super(t,{code:je.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(je,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Oe extends N{constructor(t){super(t,{code:Oe.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Oe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class ze extends N{constructor(t){super(t,{code:ze.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(ze,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class He extends N{constructor(t){super(t,{code:He.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(He,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Ge extends N{constructor(t){super(t,{code:Ge.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class De extends N{constructor(t){super(t,{code:De.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(De,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class Le extends N{constructor(t){super(t,{code:Le.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(Le,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class _e extends N{constructor(t){super(t,{code:_e.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(_e,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class qe extends N{constructor(t){super(t,{code:qe.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(qe,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class Go extends R{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const Do=3;function le(e,{abi:t,address:r,args:n,docsPath:o,functionName:s,sender:a}){const c=e instanceof yt?e:e instanceof i.BaseError?e.walk(b=>"data"in b)||e.walk():{},{code:u,data:d,details:l,message:p,shortMessage:f}=c,y=e instanceof ye?new No({functionName:s}):[Do,ue.code].includes(u)&&(d||l||p||f)?new Ar({abi:t,data:typeof d=="object"?d.data:d,functionName:s,message:c instanceof mt?l:f??p}):e;return new ko(y,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:s,sender:a})}function Lo(e){const t=i.keccak256(`0x${e.substring(4)}`).substring(26);return i.checksumAddress(`0x${t}`)}async function _o({hash:e,signature:t}){const r=i.isHex(e)?e:i.toHex(e),{secp256k1:n}=await Promise.resolve().then(()=>require("./secp256k1-YUzyTLhP.cjs"));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:d,s:l,v:p,yParity:f}=t,y=Number(f??p),b=Gt(y);return new n.Signature(i.hexToBigInt(d),i.hexToBigInt(l)).addRecoveryBit(b)}const a=i.isHex(t)?t:i.toHex(t);if(i.size(a)!==65)throw new Error("invalid signature length");const c=i.hexToNumber(`0x${a.slice(130)}`),u=Gt(c);return n.Signature.fromCompact(a.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function Gt(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw new Error("Invalid yParityOrV value")}async function $r({hash:e,signature:t}){return Lo(await _o({hash:e,signature:t}))}function qo(e){const{chainId:t,nonce:r,to:n}=e,o=e.contractAddress??e.address,s=i.keccak256(i.concatHex(["0x05",i.toRlp([t?i.numberToHex(t):"0x",o,r?i.numberToHex(r):"0x"])]));return n==="bytes"?i.hexToBytes$1(s):s}async function Br(e){const{authorization:t,signature:r}=e;return $r({hash:qo(t),signature:r??t})}class Uo extends i.BaseError{constructor(t,{account:r,docsPath:n,chain:o,data:s,gas:a,gasPrice:c,maxFeePerGas:u,maxPriorityFeePerGas:d,nonce:l,to:p,value:f}){var b;const y=i.prettyPrint({from:r==null?void 0:r.address,to:p,value:typeof f<"u"&&`${i.formatEther(f)} ${((b=o==null?void 0:o.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:s,gas:a,gasPrice:typeof c<"u"&&`${i.formatGwei(c)} gwei`,maxFeePerGas:typeof u<"u"&&`${i.formatGwei(u)} gwei`,maxPriorityFeePerGas:typeof d<"u"&&`${i.formatGwei(d)} gwei`,nonce:l});super(t.shortMessage,{cause:t,docsPath:n,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],"Estimate Gas Arguments:",y].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=t}}function Ue(e,t){const r=(e.details||"").toLowerCase(),n=e instanceof i.BaseError?e.walk(o=>(o==null?void 0:o.code)===i.ExecutionRevertedError.code):e;return n instanceof i.BaseError?new i.ExecutionRevertedError({cause:e,message:n.details}):i.ExecutionRevertedError.nodeMessage.test(r)?new i.ExecutionRevertedError({cause:e,message:e.details}):i.FeeCapTooHighError.nodeMessage.test(r)?new i.FeeCapTooHighError({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):i.FeeCapTooLowError.nodeMessage.test(r)?new i.FeeCapTooLowError({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas}):i.NonceTooHighError.nodeMessage.test(r)?new i.NonceTooHighError({cause:e,nonce:t==null?void 0:t.nonce}):i.NonceTooLowError.nodeMessage.test(r)?new i.NonceTooLowError({cause:e,nonce:t==null?void 0:t.nonce}):i.NonceMaxValueError.nodeMessage.test(r)?new i.NonceMaxValueError({cause:e,nonce:t==null?void 0:t.nonce}):i.InsufficientFundsError.nodeMessage.test(r)?new i.InsufficientFundsError({cause:e}):i.IntrinsicGasTooHighError.nodeMessage.test(r)?new i.IntrinsicGasTooHighError({cause:e,gas:t==null?void 0:t.gas}):i.IntrinsicGasTooLowError.nodeMessage.test(r)?new i.IntrinsicGasTooLowError({cause:e,gas:t==null?void 0:t.gas}):i.TransactionTypeNotSupportedError.nodeMessage.test(r)?new i.TransactionTypeNotSupportedError({cause:e}):i.TipAboveFeeCapError.nodeMessage.test(r)?new i.TipAboveFeeCapError({cause:e,maxFeePerGas:t==null?void 0:t.maxFeePerGas,maxPriorityFeePerGas:t==null?void 0:t.maxPriorityFeePerGas}):new i.UnknownNodeError({cause:e})}function Vo(e,{docsPath:t,...r}){const n=(()=>{const o=Ue(e,r);return o instanceof i.UnknownNodeError?e:o})();return new Uo(n,{docsPath:t,...r})}function Ve(e,{format:t}){if(!t)return{};const r={};function n(s){const a=Object.keys(s);for(const c of a)c in e&&(r[c]=e[c]),s[c]&&typeof s[c]=="object"&&!Array.isArray(s[c])&&n(s[c])}const o=t(e||{});return n(o),r}const Wo={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function We(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=Zo(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(r=>i.bytesToHex(r)):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=i.numberToHex(e.gas)),typeof e.gasPrice<"u"&&(t.gasPrice=i.numberToHex(e.gasPrice)),typeof e.maxFeePerBlobGas<"u"&&(t.maxFeePerBlobGas=i.numberToHex(e.maxFeePerBlobGas)),typeof e.maxFeePerGas<"u"&&(t.maxFeePerGas=i.numberToHex(e.maxFeePerGas)),typeof e.maxPriorityFeePerGas<"u"&&(t.maxPriorityFeePerGas=i.numberToHex(e.maxPriorityFeePerGas)),typeof e.nonce<"u"&&(t.nonce=i.numberToHex(e.nonce)),typeof e.to<"u"&&(t.to=e.to),typeof e.type<"u"&&(t.type=Wo[e.type]),typeof e.value<"u"&&(t.value=i.numberToHex(e.value)),t}function Zo(e){return e.map(t=>({address:t.address,r:t.r?i.numberToHex(BigInt(t.r)):t.r,s:t.s?i.numberToHex(BigInt(t.s)):t.s,chainId:i.numberToHex(t.chainId),nonce:i.numberToHex(t.nonce),...typeof t.yParity<"u"?{yParity:i.numberToHex(t.yParity)}:{},...typeof t.v<"u"&&typeof t.yParity>"u"?{v:i.numberToHex(t.v)}:{}}))}function Dt(e){if(!(!e||e.length===0))return e.reduce((t,{slot:r,value:n})=>{if(r.length!==66)throw new i.InvalidBytesLengthError({size:r.length,targetSize:66,type:"hex"});if(n.length!==66)throw new i.InvalidBytesLengthError({size:n.length,targetSize:66,type:"hex"});return t[r]=n,t},{})}function Ko(e){const{balance:t,nonce:r,state:n,stateDiff:o,code:s}=e,a={};if(s!==void 0&&(a.code=s),t!==void 0&&(a.balance=i.numberToHex(t)),r!==void 0&&(a.nonce=i.numberToHex(r)),n!==void 0&&(a.state=Dt(n)),o!==void 0){if(a.state)throw new Ro;a.stateDiff=Dt(o)}return a}function ht(e){if(!e)return;const t={};for(const{address:r,...n}of e){if(!i.isAddress(r,{strict:!1}))throw new i.InvalidAddressError({address:r});if(t[r])throw new Io({address:r});t[r]=Ko(n)}return t}function fe(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:o,to:s}=e,a=t?_(t):void 0;if(a&&!i.isAddress(a.address))throw new i.InvalidAddressError({address:a.address});if(s&&!i.isAddress(s))throw new i.InvalidAddressError({address:s});if(typeof r<"u"&&(typeof n<"u"||typeof o<"u"))throw new i.FeeConflictError;if(n&&n>i.maxUint256)throw new i.FeeCapTooHighError({maxFeePerGas:n});if(o&&n&&o>n)throw new i.TipAboveFeeCapError({maxFeePerGas:n,maxPriorityFeePerGas:o})}class Jo extends i.BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class gt extends i.BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class Yo extends i.BaseError{constructor({maxPriorityFeePerGas:t}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${i.formatGwei(t)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}class Tr extends i.BaseError{constructor({blockHash:t,blockNumber:r}){let n="Block";t&&(n=`Block at hash "${t}"`),r&&(n=`Block at number "${r}"`),super(`${n} could not be found.`,{name:"BlockNotFoundError"})}}async function ie(e,{blockHash:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",includeTransactions:o}={}){var d,l,p;const s=o??!1,a=r!==void 0?i.numberToHex(r):void 0;let c=null;if(t?c=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):c=await e.request({method:"eth_getBlockByNumber",params:[a||n,s]},{dedupe:!!a}),!c)throw new Tr({blockHash:t,blockNumber:r});return(((p=(l=(d=e.chain)==null?void 0:d.formatters)==null?void 0:l.block)==null?void 0:p.format)||i.formatBlock)(c)}async function wt(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function Xo(e,t){return Fr(e,t)}async function Fr(e,t){var s,a;const{block:r,chain:n=e.chain,request:o}=t||{};try{const c=((s=n==null?void 0:n.fees)==null?void 0:s.maxPriorityFeePerGas)??((a=n==null?void 0:n.fees)==null?void 0:a.defaultPriorityFee);if(typeof c=="function"){const d=r||await A(e,ie,"getBlock")({}),l=await c({block:d,client:e,request:o});if(l===null)throw new Error;return l}if(typeof c<"u")return c;const u=await e.request({method:"eth_maxPriorityFeePerGas"});return i.hexToBigInt(u)}catch{const[c,u]=await Promise.all([r?Promise.resolve(r):A(e,ie,"getBlock")({}),A(e,wt,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new gt;const d=u-c.baseFeePerGas;return d<0n?0n:d}}async function Qo(e,t){return it(e,t)}async function it(e,t){var f,y;const{block:r,chain:n=e.chain,request:o,type:s="eip1559"}=t||{},a=await(async()=>{var b,m;return typeof((b=n==null?void 0:n.fees)==null?void 0:b.baseFeeMultiplier)=="function"?n.fees.baseFeeMultiplier({block:r,client:e,request:o}):((m=n==null?void 0:n.fees)==null?void 0:m.baseFeeMultiplier)??1.2})();if(a<1)throw new Jo;const u=10**(((f=a.toString().split(".")[1])==null?void 0:f.length)??0),d=b=>b*BigInt(Math.ceil(a*u))/BigInt(u),l=r||await A(e,ie,"getBlock")({});if(typeof((y=n==null?void 0:n.fees)==null?void 0:y.estimateFeesPerGas)=="function"){const b=await n.fees.estimateFeesPerGas({block:r,client:e,multiply:d,request:o,type:s});if(b!==null)return b}if(s==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new gt;const b=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await Fr(e,{block:l,chain:n,request:o}),m=d(l.baseFeePerGas);return{maxFeePerGas:(o==null?void 0:o.maxFeePerGas)??m+b,maxPriorityFeePerGas:b}}return{gasPrice:(o==null?void 0:o.gasPrice)??d(await A(e,wt,"getGasPrice")({}))}}async function Sr(e,{address:t,blockTag:r="latest",blockNumber:n}){const o=await e.request({method:"eth_getTransactionCount",params:[t,typeof n=="bigint"?i.numberToHex(n):r]},{dedupe:!!n});return i.hexToNumber(o)}async function vt(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return i.hexToNumber(t)}const Ir=["blobVersionedHashes","chainId","fees","gas","nonce","type"],Lt=new Map;async function Et(e,t){const{account:r=e.account,blobs:n,chain:o,gas:s,kzg:a,nonce:c,nonceManager:u,parameters:d=Ir,type:l}=t,p=r&&_(r),f={...t,...p?{from:p==null?void 0:p.address}:{}};let y;async function b(){return y||(y=await A(e,ie,"getBlock")({blockTag:"latest"}),y)}let m;async function g(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await A(e,vt,"getChainId")({}),m))}if(d.includes("nonce")&&typeof c>"u"&&p)if(u){const h=await g();f.nonce=await u.consume({address:p.address,chainId:h,client:e})}else f.nonce=await A(e,Sr,"getTransactionCount")({address:p.address,blockTag:"pending"});if((d.includes("blobVersionedHashes")||d.includes("sidecars"))&&n&&a){const h=i.blobsToCommitments({blobs:n,kzg:a});if(d.includes("blobVersionedHashes")){const w=i.commitmentsToVersionedHashes({commitments:h,to:"hex"});f.blobVersionedHashes=w}if(d.includes("sidecars")){const w=i.blobsToProofs({blobs:n,commitments:h,kzg:a}),x=i.toBlobSidecars({blobs:n,commitments:h,proofs:w,to:"hex"});f.sidecars=x}}if(d.includes("chainId")&&(f.chainId=await g()),(d.includes("fees")||d.includes("type"))&&typeof l>"u")try{f.type=i.getTransactionType(f)}catch{let h=Lt.get(e.uid);if(typeof h>"u"){const w=await b();h=typeof(w==null?void 0:w.baseFeePerGas)=="bigint",Lt.set(e.uid,h)}f.type=h?"eip1559":"legacy"}if(d.includes("fees"))if(f.type!=="legacy"&&f.type!=="eip2930"){if(typeof f.maxFeePerGas>"u"||typeof f.maxPriorityFeePerGas>"u"){const h=await b(),{maxFeePerGas:w,maxPriorityFeePerGas:x}=await it(e,{block:h,chain:o,request:f});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<x)throw new Yo({maxPriorityFeePerGas:x});f.maxPriorityFeePerGas=x,f.maxFeePerGas=w}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new gt;if(typeof t.gasPrice>"u"){const h=await b(),{gasPrice:w}=await it(e,{block:h,chain:o,request:f,type:"legacy"});f.gasPrice=w}}return d.includes("gas")&&typeof s>"u"&&(f.gas=await A(e,xt,"estimateGas")({...f,account:p&&{address:p.address,type:"json-rpc"}})),fe(f),delete f.parameters,f}async function Rr(e,{address:t,blockNumber:r,blockTag:n=e.experimental_blockTag??"latest"}){const o=typeof r=="bigint"?i.numberToHex(r):void 0,s=await e.request({method:"eth_getBalance",params:[t,o||n]});return BigInt(s)}async function xt(e,t){var o,s,a;const{account:r=e.account}=t,n=r?_(r):void 0;try{let S=function(H){const{block:U,request:$,rpcStateOverride:I}=H;return e.request({method:"eth_estimateGas",params:I?[$,U??e.experimental_blockTag??"latest",I]:U?[$,U]:[$]})};const{accessList:c,authorizationList:u,blobs:d,blobVersionedHashes:l,blockNumber:p,blockTag:f,data:y,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,value:E,stateOverride:F,...B}=await Et(e,{...t,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),v=(typeof p=="bigint"?i.numberToHex(p):void 0)||f,P=ht(F),z=await(async()=>{if(B.to)return B.to;if(u&&u.length>0)return await Br({authorization:u[0]}).catch(()=>{throw new i.BaseError("`to` is required. Could not infer from `authorizationList`")})})();fe(t);const T=(a=(s=(o=e.chain)==null?void 0:o.formatters)==null?void 0:s.transactionRequest)==null?void 0:a.format,C=(T||We)({...Ve(B,{format:T}),from:n==null?void 0:n.address,accessList:c,authorizationList:u,blobs:d,blobVersionedHashes:l,data:y,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,to:z,value:E});let j=BigInt(await S({block:v,request:C,rpcStateOverride:P}));if(u){const H=await Rr(e,{address:C.from}),U=await Promise.all(u.map(async $=>{const{address:I}=$,V=await S({block:v,request:{authorizationList:void 0,data:y,from:n==null?void 0:n.address,to:I,value:i.numberToHex(H)},rpcStateOverride:P}).catch(()=>100000n);return 2n*BigInt(V)}));j+=U.reduce(($,I)=>$+I,0n)}return j}catch(c){throw Vo(c,{...t,account:n,chain:e.chain})}}async function es(e,t){const{abi:r,address:n,args:o,functionName:s,dataSuffix:a,...c}=t,u=re({abi:r,args:o,functionName:s});try{return await A(e,xt,"estimateGas")({data:`${u}${a?a.replace("0x",""):""}`,to:n,...c})}catch(d){const l=c.account?_(c.account):void 0;throw le(d,{abi:r,address:n,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:s,sender:l==null?void 0:l.address})}}function Mr(e,t){if(!i.isAddress(e,{strict:!1}))throw new i.InvalidAddressError({address:e});if(!i.isAddress(t,{strict:!1}))throw new i.InvalidAddressError({address:t});return e.toLowerCase()===t.toLowerCase()}const _t="/docs/contract/decodeEventLog";function Pt(e){const{abi:t,data:r,strict:n,topics:o}=e,s=n??!0,[a,...c]=o;if(!a)throw new Yn({docsPath:_t});const u=t.find(m=>m.type==="event"&&a===he(D(m)));if(!(u&&"name"in u)||u.type!=="event")throw new dr(a,{docsPath:_t});const{name:d,inputs:l}=u,p=l==null?void 0:l.some(m=>!("name"in m&&m.name)),f=p?[]:{},y=l.map((m,g)=>[m,g]).filter(([m])=>"indexed"in m&&m.indexed);for(let m=0;m<y.length;m++){const[g,h]=y[m],w=c[m];if(!w)throw new me({abiItem:u,param:g});f[p?h:g.name||h]=ts({param:g,value:w})}const b=l.filter(m=>!("indexed"in m&&m.indexed));if(b.length>0){if(r&&r!=="0x")try{const m=ce(b,r);if(m)if(p)for(let g=0;g<l.length;g++)f[g]=f[g]??m.shift();else for(let g=0;g<b.length;g++)f[b[g].name]=m[g]}catch(m){if(s)throw m instanceof cr||m instanceof i.PositionOutOfBoundsError?new se({abiItem:u,data:r,params:b,size:i.size(r)}):m}else if(s)throw new se({abiItem:u,data:"0x",params:b,size:0})}return{eventName:d,args:Object.values(f).length>0?f:void 0}}function ts({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(ce([e],t)||[])[0]}function At(e){const{abi:t,args:r,logs:n,strict:o=!0}=e,s=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return n.map(a=>{var c;try{const u=t.find(l=>l.type==="event"&&a.topics[0]===he(l));if(!u)return null;const d=Pt({...a,abi:[u],strict:o});return s&&!s.includes(d.eventName)||!rs({args:d.args,inputs:u.inputs,matchArgs:r})?null:{...d,...a}}catch(u){let d,l;if(u instanceof dr)return null;if(u instanceof se||u instanceof me){if(o)return null;d=u.abiItem.name,l=(c=u.abiItem.inputs)==null?void 0:c.some(p=>!("name"in p&&p.name))}return{...a,args:l?[]:{},eventName:d}}}).filter(Boolean)}function rs(e){const{args:t,inputs:r,matchArgs:n}=e;if(!n)return!0;if(!t)return!1;function o(s,a,c){try{return s.type==="address"?Mr(a,c):s.type==="string"||s.type==="bytes"?i.keccak256(i.toBytes(a))===c:a===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(n)?n.every((s,a)=>{if(s==null)return!0;const c=r[a];return c?(Array.isArray(s)?s:[s]).some(d=>o(c,d,t[a])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof n=="object"&&!Array.isArray(n)?Object.entries(n).every(([s,a])=>{if(a==null)return!0;const c=r.find(d=>d.name===s);return c?(Array.isArray(a)?a:[a]).some(d=>o(c,d,t[s])):!1}):!1}async function Cr(e,{address:t,blockHash:r,fromBlock:n,toBlock:o,event:s,events:a,args:c,strict:u}={}){const d=u??!1,l=a??(s?[s]:void 0);let p=[];l&&(p=[l.flatMap(m=>ve({abi:[m],eventName:m.name,args:a?void 0:c}))],s&&(p=p[0]));let f;r?f=await e.request({method:"eth_getLogs",params:[{address:t,topics:p,blockHash:r}]}):f=await e.request({method:"eth_getLogs",params:[{address:t,topics:p,fromBlock:typeof n=="bigint"?i.numberToHex(n):n,toBlock:typeof o=="bigint"?i.numberToHex(o):o}]});const y=f.map(b=>i.formatLog(b));return l?At({abi:l,args:c,logs:y,strict:d}):y}async function kr(e,t){const{abi:r,address:n,args:o,blockHash:s,eventName:a,fromBlock:c,toBlock:u,strict:d}=t,l=a?te({abi:r,name:a}):void 0,p=l?void 0:r.filter(f=>f.type==="event");return A(e,Cr,"getLogs")({address:n,args:o,blockHash:s,event:l,events:p,fromBlock:c,toBlock:u,strict:d})}const Ye="/docs/contract/decodeFunctionResult";function Ze(e){const{abi:t,args:r,functionName:n,data:o}=e;let s=t[0];if(n){const c=te({abi:t,args:r,name:n});if(!c)throw new oe(n,{docsPath:Ye});s=c}if(s.type!=="function")throw new oe(void 0,{docsPath:Ye});if(!s.outputs)throw new lr(s.name,{docsPath:Ye});const a=ce(s.outputs,o);if(a&&a.length>1)return a;if(a&&a.length===1)return a[0]}const ns="0.1.1";function os(){return ns}class L extends Error{constructor(t,r={}){const n=(()=>{var u;if(r.cause instanceof L){if(r.cause.details)return r.cause.details;if(r.cause.shortMessage)return r.cause.shortMessage}return r.cause&&"details"in r.cause&&typeof r.cause.details=="string"?r.cause.details:(u=r.cause)!=null&&u.message?r.cause.message:r.details})(),o=r.cause instanceof L&&r.cause.docsPath||r.docsPath,a=`https://oxlib.sh${o??""}`,c=[t||"An error occurred.",...r.metaMessages?["",...r.metaMessages]:[],...n||o?["",n?`Details: ${n}`:void 0,o?`See: ${a}`:void 0]:[]].filter(u=>typeof u=="string").join(`
|
|
34
|
+
`);super(c,r.cause?{cause:r.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{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,"shortMessage",{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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:`ox@${os()}`}),this.cause=r.cause,this.details=n,this.docs=a,this.docsPath=o,this.shortMessage=t}walk(t){return Nr(this,t)}}function Nr(e,t){return t!=null&&t(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause?Nr(e.cause,t):t?null:e}const ss="#__bigint";function as(e,t,r){return JSON.stringify(e,(n,o)=>typeof o=="bigint"?o.toString()+ss:o,r)}function $t(e,t){if(X(e)>t)throw new hs({givenSize:X(e),maxSize:t})}function is(e,t){if(typeof t=="number"&&t>0&&t>X(e)-1)throw new Gr({offset:t,position:"start",size:X(e)})}function cs(e,t,r){if(typeof t=="number"&&typeof r=="number"&&X(e)!==r-t)throw new Gr({offset:r,position:"end",size:X(e)})}function jr(e,t={}){const{dir:r,size:n=32}=t;if(n===0)return e;const o=e.replace("0x","");if(o.length>n*2)throw new gs({size:Math.ceil(o.length/2),targetSize:n,type:"Hex"});return`0x${o[r==="right"?"padEnd":"padStart"](n*2,"0")}`}const us=new TextEncoder,ds=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ls(e,t={}){const{strict:r=!1}=t;if(!e)throw new qt(e);if(typeof e!="string")throw new qt(e);if(r&&!/^0x[0-9a-fA-F]*$/.test(e))throw new Ut(e);if(!e.startsWith("0x"))throw new Ut(e)}function fs(...e){return`0x${e.reduce((t,r)=>t+r.replace("0x",""),"")}`}function ps(e,t={}){const r=`0x${Number(e)}`;return typeof t.size=="number"?($t(r,t.size),Bt(r,t.size)):r}function Or(e,t={}){let r="";for(let o=0;o<e.length;o++)r+=ds[e[o]];const n=`0x${r}`;return typeof t.size=="number"?($t(n,t.size),zr(n,t.size)):n}function G(e,t={}){const{signed:r,size:n}=t,o=BigInt(e);let s;n?r?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const a=typeof s=="bigint"&&r?-s-1n:0;if(s&&o>s||o<a){const d=typeof e=="bigint"?"n":"";throw new Hr({max:s?`${s}${d}`:void 0,min:`${a}${d}`,signed:r,size:n,value:`${e}${d}`})}const u=`0x${(r&&o<0?(1n<<BigInt(n*8))+BigInt(o):o).toString(16)}`;return n?Bt(u,n):u}function bs(e,t={}){return Or(us.encode(e),t)}function Bt(e,t){return jr(e,{dir:"left",size:t})}function zr(e,t){return jr(e,{dir:"right",size:t})}function ys(e,t,r,n={}){const{strict:o}=n;is(e,t);const s=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return o&&cs(s,t,r),s}function X(e){return Math.ceil((e.length-2)/2)}function ms(e,t={}){const{strict:r=!1}=t;try{return ls(e,{strict:r}),!0}catch{return!1}}class Hr extends L{constructor({max:t,min:r,signed:n,size:o,value:s}){super(`Number \`${s}\` is not in safe${o?` ${o*8}-bit`:""}${n?" signed":" unsigned"} integer range ${t?`(\`${r}\` to \`${t}\`)`:`(above \`${r}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class qt extends L{constructor(t){super(`Value \`${typeof t=="object"?as(t):t}\` of type \`${typeof t}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class Ut extends L{constructor(t){super(`Value \`${t}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class hs extends L{constructor({givenSize:t,maxSize:r}){super(`Size cannot exceed \`${r}\` bytes. Given size: \`${t}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class Gr extends L{constructor({offset:t,position:r,size:n}){super(`Slice ${r==="start"?"starting":"ending"} at offset \`${t}\` is out-of-bounds (size: \`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class gs extends L{constructor({size:t,targetSize:r,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (\`${t}\`) exceeds padding size (\`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function ws(e){return{address:e.address,amount:G(e.amount),index:G(e.index),validatorIndex:G(e.validatorIndex)}}function Dr(e){return{...typeof e.baseFeePerGas=="bigint"&&{baseFeePerGas:G(e.baseFeePerGas)},...typeof e.blobBaseFee=="bigint"&&{blobBaseFee:G(e.blobBaseFee)},...typeof e.feeRecipient=="string"&&{feeRecipient:e.feeRecipient},...typeof e.gasLimit=="bigint"&&{gasLimit:G(e.gasLimit)},...typeof e.number=="bigint"&&{number:G(e.number)},...typeof e.prevRandao=="bigint"&&{prevRandao:G(e.prevRandao)},...typeof e.time=="bigint"&&{time:G(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(ws)}}}const ct=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"}],vs=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],Lr=[{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"}],Es=[...Lr,{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"}]}],xs=[...Lr,{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"}]}],Ps=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],As=[{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"}]}],$s=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}],Bs="0x82ad56cb",_r="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",Ts="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",Fs="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",Xe="/docs/contract/encodeDeployData";function Tt(e){const{abi:t,args:r,bytecode:n}=e;if(!r||r.length===0)return n;const o=t.find(a=>"type"in a&&a.type==="constructor");if(!o)throw new Un({docsPath:Xe});if(!("inputs"in o))throw new Ct({docsPath:Xe});if(!o.inputs||o.inputs.length===0)throw new Ct({docsPath:Xe});const s=ge(o.inputs,r);return i.concatHex([n,s])}function qr({blockNumber:e,chain:t,contract:r}){var o;const n=(o=t==null?void 0:t.contracts)==null?void 0:o[r];if(!n)throw new i.ChainDoesNotSupportContract({chain:t,contract:{name:r}});if(e&&n.blockCreated&&n.blockCreated>e)throw new i.ChainDoesNotSupportContract({blockNumber:e,chain:t,contract:{name:r,blockCreated:n.blockCreated}});return n.address}function Ur(e,{docsPath:t,...r}){const n=(()=>{const o=Ue(e,r);return o instanceof i.UnknownNodeError?e:o})();return new Pr(n,{docsPath:t,...r})}function Vr(){let e=()=>{},t=()=>{};return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}const Qe=new Map;function Wr({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:o}){const s=async()=>{const l=u();a();const p=l.map(({args:f})=>f);p.length!==0&&e(p).then(f=>{o&&Array.isArray(f)&&f.sort(o);for(let y=0;y<l.length;y++){const{resolve:b}=l[y];b==null||b([f[y],f])}}).catch(f=>{for(let y=0;y<l.length;y++){const{reject:b}=l[y];b==null||b(f)}})},a=()=>Qe.delete(t),c=()=>u().map(({args:l})=>l),u=()=>Qe.get(t)||[],d=l=>Qe.set(t,[...u(),l]);return{flush:a,async schedule(l){const{promise:p,resolve:f,reject:y}=Vr();return(r==null?void 0:r([...c(),l]))&&s(),u().length>0?(d({args:l,resolve:f,reject:y}),p):(d({args:l,resolve:f,reject:y}),setTimeout(s,n),p)}}}async function Ft(e,t){var C,S,j,H;const{account:r=e.account,authorizationList:n,batch:o=!!((C=e.batch)!=null&&C.multicall),blockNumber:s,blockTag:a=e.experimental_blockTag??"latest",accessList:c,blobs:u,blockOverrides:d,code:l,data:p,factory:f,factoryData:y,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,to:E,value:F,stateOverride:B,...M}=t,v=r?_(r):void 0;if(l&&(f||y))throw new i.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(l&&E)throw new i.BaseError("Cannot provide both `code` & `to` as parameters.");const P=l&&p,z=f&&y&&E&&p,T=P||z,q=P?Rs({code:l,data:p}):z?Ms({data:p,factory:f,factoryData:y,to:E}):p;try{fe(t);const $=(typeof s=="bigint"?i.numberToHex(s):void 0)||a,I=d?Dr(d):void 0,V=ht(B),It=(H=(j=(S=e.chain)==null?void 0:S.formatters)==null?void 0:j.transactionRequest)==null?void 0:H.format,Ke=(It||We)({...Ve(M,{format:It}),from:v==null?void 0:v.address,accessList:c,authorizationList:n,blobs:u,data:q,gas:b,gasPrice:m,maxFeePerBlobGas:g,maxFeePerGas:h,maxPriorityFeePerGas:w,nonce:x,to:T?void 0:E,value:F});if(o&&Ss({request:Ke})&&!V&&!I)try{return await Is(e,{...Ke,blockNumber:s,blockTag:a})}catch(K){if(!(K instanceof i.ClientChainNotConfiguredError)&&!(K instanceof i.ChainDoesNotSupportContract))throw K}const rn=(()=>{const K=[Ke,$];return V&&I?[...K,V,I]:V?[...K,V]:I?[...K,{},I]:K})(),Rt=await e.request({method:"eth_call",params:rn});return Rt==="0x"?{data:void 0}:{data:Rt}}catch(U){const $=Cs(U),{offchainLookup:I,offchainLookupSignature:V}=await Promise.resolve().then(()=>require("./ccip-CEodLZ4s.cjs"));if(e.ccipRead!==!1&&($==null?void 0:$.slice(0,10))===V&&E)return{data:await I(e,{data:$,to:E})};throw T&&($==null?void 0:$.slice(0,10))==="0x101bb98d"?new jo({factory:f}):Ur(U,{...t,account:v,chain:e.chain})}}function Ss({request:e}){const{data:t,to:r,...n}=e;return!(!t||t.startsWith(Bs)||!r||Object.values(n).filter(o=>typeof o<"u").length>0)}async function Is(e,t){var m;const{batchSize:r=1024,wait:n=0}=typeof((m=e.batch)==null?void 0:m.multicall)=="object"?e.batch.multicall:{},{blockNumber:o,blockTag:s=e.experimental_blockTag??"latest",data:a,multicallAddress:c,to:u}=t;let d=c;if(!d){if(!e.chain)throw new i.ClientChainNotConfiguredError;d=qr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const p=(typeof o=="bigint"?i.numberToHex(o):void 0)||s,{schedule:f}=Wr({id:`${e.uid}.${p}`,wait:n,shouldSplitBatch(g){return g.reduce((w,{data:x})=>w+(x.length-2),0)>r*2},fn:async g=>{const h=g.map(E=>({allowFailure:!0,callData:E.data,target:E.to})),w=re({abi:ct,args:[h],functionName:"aggregate3"}),x=await e.request({method:"eth_call",params:[{data:w,to:d},p]});return Ze({abi:ct,args:[h],functionName:"aggregate3",data:x||"0x"})}}),[{returnData:y,success:b}]=await f({data:a,to:u});if(!b)throw new yt({data:y});return y==="0x"?{data:void 0}:{data:y}}function Rs(e){const{code:t,data:r}=e;return Tt({abi:ir(["constructor(bytes, bytes)"]),bytecode:_r,args:[t,r]})}function Ms(e){const{data:t,factory:r,factoryData:n,to:o}=e;return Tt({abi:ir(["constructor(address, bytes, address, bytes)"]),bytecode:Ts,args:[o,t,r,n]})}function Cs(e){var r;if(!(e instanceof i.BaseError))return;const t=e.walk();return typeof(t==null?void 0:t.data)=="object"?(r=t.data)==null?void 0:r.data:t.data}async function ks(e,t){const{abi:r,address:n,args:o,functionName:s,...a}=t,c=re({abi:r,args:o,functionName:s});try{const{data:u}=await A(e,Ft,"call")({...a,data:c,to:n});return Ze({abi:r,args:o,functionName:s,data:u||"0x"})}catch(u){throw le(u,{abi:r,address:n,args:o,docsPath:"/docs/contract/readContract",functionName:s})}}async function Ns(e,t){const{abi:r,address:n,args:o,dataSuffix:s,functionName:a,...c}=t,u=c.account?_(c.account):e.account,d=re({abi:r,args:o,functionName:a});try{const{data:l}=await A(e,Ft,"call")({batch:!1,data:`${d}${s?s.replace("0x",""):""}`,to:n,...c,account:u}),p=Ze({abi:r,args:o,functionName:a,data:l||"0x"}),f=r.filter(y=>"name"in y&&y.name===t.functionName);return{result:p,request:{abi:f,address:n,args:o,dataSuffix:s,functionName:a,...c,account:u}}}catch(l){throw le(l,{abi:r,address:n,args:o,docsPath:"/docs/contract/simulateContract",functionName:a,sender:u==null?void 0:u.address})}}const et=new Map,Vt=new Map;let js=0;function ut(e,t,r){const n=++js,o=()=>et.get(e)||[],s=()=>{const l=o();et.set(e,l.filter(p=>p.id!==n))},a=()=>{const l=o();if(!l.some(f=>f.id===n))return;const p=Vt.get(e);if(l.length===1&&p){const f=p();f instanceof Promise&&f.catch(()=>{})}s()},c=o();if(et.set(e,[...c,{id:n,fns:t}]),c&&c.length>0)return a;const u={};for(const l in t)u[l]=(...p)=>{var y,b;const f=o();if(f.length!==0)for(const m of f)(b=(y=m.fns)[l])==null||b.call(y,...p)};const d=r(u);return typeof d=="function"&&Vt.set(e,d),a}async function dt(e){return new Promise(t=>setTimeout(t,e))}function Zr(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let o=!0;const s=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:s}));const u=await(r==null?void 0:r(c))??n;await dt(u);const d=async()=>{o&&(await e({unpoll:s}),await dt(n),d())};d()})(),s}const Os=new Map,zs=new Map;function Hs(e){const t=(o,s)=>({clear:()=>s.delete(o),get:()=>s.get(o),set:a=>s.set(o,a)}),r=t(e,Os),n=t(e,zs);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function Gs(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=Hs(t),o=n.response.get();if(o&&r>0&&new Date().getTime()-o.created.getTime()<r)return o.data;let s=n.promise.get();s||(s=e(),n.promise.set(s));try{const a=await s;return n.response.set({created:new Date,data:a}),a}finally{n.promise.clear()}}const Ds=e=>`blockNumber.${e}`;async function Kr(e,{cacheTime:t=e.cacheTime}={}){const r=await Gs(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Ds(e.uid),cacheTime:t});return BigInt(r)}async function Jr(e,{filter:t}){const r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if(typeof n[0]=="string")return n;const o=n.map(s=>i.formatLog(s));return!("abi"in t)||!t.abi?o:At({abi:t.abi,logs:o,strict:r})}async function Yr(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Ls(e,t){const{abi:r,address:n,args:o,batch:s=!0,eventName:a,fromBlock:c,onError:u,onLogs:d,poll:l,pollingInterval:p=e.pollingInterval,strict:f}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="ipc"||e.transport.type==="fallback"&&(e.transport.transports[0].config.type==="webSocket"||e.transport.transports[0].config.type==="ipc")))?(()=>{const g=f??!1,h=Y(["watchContractEvent",n,o,s,e.uid,a,p,g,c]);return ut(h,{onLogs:d,onError:u},w=>{let x;c!==void 0&&(x=c-1n);let E,F=!1;const B=Zr(async()=>{var M;if(!F){try{E=await A(e,hr,"createContractEventFilter")({abi:r,address:n,args:o,eventName:a,strict:g,fromBlock:c})}catch{}F=!0;return}try{let v;if(E)v=await A(e,Jr,"getFilterChanges")({filter:E});else{const P=await A(e,Kr,"getBlockNumber")({});x&&x<P?v=await A(e,kr,"getContractEvents")({abi:r,address:n,args:o,eventName:a,fromBlock:x+1n,toBlock:P,strict:g}):v=[],x=P}if(v.length===0)return;if(s)w.onLogs(v);else for(const P of v)w.onLogs([P])}catch(v){E&&v instanceof de&&(F=!1),(M=w.onError)==null||M.call(w,v)}},{emitOnBegin:!0,interval:p});return async()=>{E&&await A(e,Yr,"uninstallFilter")({filter:E}),B()}})})():(()=>{const g=f??!1,h=Y(["watchContractEvent",n,o,s,e.uid,a,p,g]);let w=!0,x=()=>w=!1;return ut(h,{onLogs:d,onError:u},E=>((async()=>{try{const F=(()=>{if(e.transport.type==="fallback"){const v=e.transport.transports.find(P=>P.config.type==="webSocket"||P.config.type==="ipc");return v?v.value:e.transport}return e.transport})(),B=a?ve({abi:r,eventName:a,args:o}):[],{unsubscribe:M}=await F.subscribe({params:["logs",{address:n,topics:B}],onData(v){var z;if(!w)return;const P=v.result;try{const{eventName:T,args:q}=Pt({abi:r,data:P.data,topics:P.topics,strict:f}),C=i.formatLog(P,{args:q,eventName:T});E.onLogs([C])}catch(T){let q,C;if(T instanceof se||T instanceof me){if(f)return;q=T.abiItem.name,C=(z=T.abiItem.inputs)==null?void 0:z.some(j=>!("name"in j&&j.name))}const S=i.formatLog(P,{args:C?[]:{},eventName:q});E.onLogs([S])}},onError(v){var P;(P=E.onError)==null||P.call(E,v)}});x=M,w||x()}catch(F){u==null||u(F)}})(),()=>x()))})()}class St extends i.BaseError{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 Client."].join(`
|
|
35
35
|
`),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}class pe extends i.BaseError{constructor({docsPath:t,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:t,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function Xr({chain:e,currentChainId:t}){if(!e)throw new i.ChainNotFoundError;if(t!==e.id)throw new i.ChainMismatchError({chain:e,currentChainId:t})}function Qr(e,{docsPath:t,...r}){const n=(()=>{const o=Ue(e,r);return o instanceof i.UnknownNodeError?e:o})();return new i.TransactionExecutionError(n,{docsPath:t,...r})}async function en(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}const tt=new i.LruMap(128);async function tn(e,t){var w,x,E,F;const{account:r=e.account,chain:n=e.chain,accessList:o,authorizationList:s,blobs:a,data:c,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:y,type:b,value:m,...g}=t;if(typeof r>"u")throw new St({docsPath:"/docs/actions/wallet/sendTransaction"});const h=r?_(r):null;try{fe(t);const B=await(async()=>{if(t.to)return t.to;if(t.to!==null&&s&&s.length>0)return await Br({authorization:s[0]}).catch(()=>{throw new i.BaseError("`to` is required. Could not infer from `authorizationList`.")})})();if((h==null?void 0:h.type)==="json-rpc"||h===null){let M;n!==null&&(M=await A(e,vt,"getChainId")({}),Xr({currentChainId:M,chain:n}));const v=(E=(x=(w=e.chain)==null?void 0:w.formatters)==null?void 0:x.transactionRequest)==null?void 0:E.format,z=(v||We)({...Ve(g,{format:v}),accessList:o,authorizationList:s,blobs:a,chainId:M,data:c,from:h==null?void 0:h.address,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:y,to:B,type:b,value:m}),T=tt.get(e.uid),q=T?"wallet_sendTransaction":"eth_sendTransaction";try{return await e.request({method:q,params:[z]},{retryCount:0})}catch(C){if(T===!1)throw C;const S=C;if(S.name==="InvalidInputRpcError"||S.name==="InvalidParamsRpcError"||S.name==="MethodNotFoundRpcError"||S.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[z]},{retryCount:0}).then(j=>(tt.set(e.uid,!0),j)).catch(j=>{const H=j;throw H.name==="MethodNotFoundRpcError"||H.name==="MethodNotSupportedRpcError"?(tt.set(e.uid,!1),S):H});throw S}}if((h==null?void 0:h.type)==="local"){const M=await A(e,Et,"prepareTransactionRequest")({account:h,accessList:o,authorizationList:s,blobs:a,chain:n,data:c,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:p,maxPriorityFeePerGas:f,nonce:y,nonceManager:h.nonceManager,parameters:[...Ir,"sidecars"],type:b,value:m,...g,to:B}),v=(F=n==null?void 0:n.serializers)==null?void 0:F.transaction,P=await h.signTransaction(M,{serializer:v});return await A(e,en,"sendRawTransaction")({serializedTransaction:P})}throw(h==null?void 0:h.type)==="smart"?new pe({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new pe({docsPath:"/docs/actions/wallet/sendTransaction",type:h==null?void 0:h.type})}catch(B){throw B instanceof pe?B:Qr(B,{...t,account:h,chain:t.chain||void 0})}}async function _s(e,t){const{abi:r,account:n=e.account,address:o,args:s,dataSuffix:a,functionName:c,...u}=t;if(typeof n>"u")throw new St({docsPath:"/docs/contract/writeContract"});const d=n?_(n):null,l=re({abi:r,args:s,functionName:c});try{return await A(e,tn,"sendTransaction")({data:`${l}${a?a.replace("0x",""):""}`,to:o,account:d,...u})}catch(p){throw le(p,{abi:r,address:o,args:s,docsPath:"/docs/contract/writeContract",functionName:c,sender:d==null?void 0:d.address})}}exports.AbiDecodingZeroDataError=ye;exports.AbiErrorInputsNotFoundError=Kn;exports.AbiErrorNotFoundError=Jn;exports.AbiFunctionNotFoundError=oe;exports.AbiFunctionOutputsNotFoundError=lr;exports.AbiFunctionSignatureNotFoundError=Xn;exports.AccountNotFoundError=St;exports.AccountTypeNotSupportedError=pe;exports.AtomicReadyWalletRejectedUpgradeError=_e;exports.AtomicityNotSupportedError=qe;exports.BaseError=L;exports.BlockNotFoundError=Tr;exports.BundleTooLargeError=Le;exports.BytesSizeMismatchError=eo;exports.CallExecutionError=Pr;exports.ChainDisconnectedError=je;exports.ContractFunctionRevertedError=Ar;exports.DecodeLogDataMismatch=se;exports.DecodeLogTopicsMismatch=me;exports.DuplicateIdError=Ge;exports.HttpRequestError=Oo;exports.IntegerOutOfRangeError=Hr;exports.InternalRpcError=ue;exports.InvalidAbiItemError=wn;exports.InvalidArrayError=fr;exports.InvalidInputRpcError=de;exports.InvalidParamsRpcError=$e;exports.InvalidRequestRpcError=Pe;exports.JsonRpcVersionUnsupportedError=Re;exports.LimitExceededRpcError=Ie;exports.MethodNotFoundRpcError=Ae;exports.MethodNotSupportedRpcError=Se;exports.ParseRpcError=xe;exports.ProviderDisconnectedError=Ne;exports.RawContractError=yt;exports.ResourceNotFoundRpcError=Be;exports.ResourceUnavailableRpcError=Te;exports.RpcRequestError=mt;exports.SwitchChainError=Oe;exports.TimeoutError=zo;exports.TransactionRejectedRpcError=Fe;exports.UnauthorizedProviderError=Ce;exports.UnknownBundleIdError=De;exports.UnknownRpcError=Go;exports.UnsupportedChainIdError=He;exports.UnsupportedNonOptionalCapabilityError=ze;exports.UnsupportedProviderMethodError=ke;exports.UserRejectedRequestError=Me;exports.addressResolverAbi=As;exports.assertCurrentChain=Xr;exports.assertRequest=fe;exports.assertSize=$t;exports.batchGatewayAbi=vs;exports.bytesRegex=uo;exports.bytesToString=vr;exports.call=Ft;exports.concat=fs;exports.createBatchScheduler=Wr;exports.createContractEventFilter=hr;exports.createFilterRequestScope=mr;exports.decodeAbiParameters=ce;exports.decodeErrorResult=Er;exports.decodeEventLog=Pt;exports.decodeFunctionResult=Ze;exports.deploylessCallViaBytecodeBytecode=_r;exports.encodeAbiParameters=ge;exports.encodeDeployData=Tt;exports.encodeEventTopics=ve;exports.encodeFunctionData=re;exports.estimateContractGas=es;exports.estimateFeesPerGas=Qo;exports.estimateGas=xt;exports.estimateMaxPriorityFeePerGas=Xo;exports.extract=Ve;exports.formatAbiItem=D;exports.formatAbiItem$1=Jt;exports.formatTransactionRequest=We;exports.fromBoolean=ps;exports.fromBytes=Or;exports.fromNumber=G;exports.fromString=bs;exports.getAbiItem=te;exports.getAction=A;exports.getBalance=Rr;exports.getBlock=ie;exports.getBlockNumber=Kr;exports.getCallError=Ur;exports.getChainContractAddress=qr;exports.getChainId=vt;exports.getContractError=le;exports.getContractEvents=kr;exports.getFilterChanges=Jr;exports.getGasPrice=wt;exports.getLogs=Cr;exports.getNodeError=Ue;exports.getTransactionCount=Sr;exports.getTransactionError=Qr;exports.getUrl=Ee;exports.integerRegex=br;exports.isAddressEqual=Mr;exports.isStructSignature=lt;exports.multicall3Abi=ct;exports.observe=ut;exports.padLeft=Bt;exports.padRight=zr;exports.panicReasons=gr;exports.parseAccount=_;exports.parseEventLogs=At;exports.parseSignature=nr;exports.parseStructs=sr;exports.poll=Zr;exports.prepareTransactionRequest=Et;exports.readContract=ks;exports.recoverAddress=$r;exports.sendRawTransaction=en;exports.sendTransaction=tn;exports.serializeStateOverride=ht;exports.simulateContract=Ns;exports.size=X;exports.slice=ys;exports.solidityError=wr;exports.stringify=Y;exports.textResolverAbi=Ps;exports.toFunctionSelector=we;exports.toRpc=Dr;exports.uninstallFilter=Yr;exports.universalResolverResolveAbi=Es;exports.universalResolverReverseAbi=xs;exports.universalSignatureValidatorAbi=$s;exports.universalSignatureValidatorByteCode=Fs;exports.validate=ms;exports.wait=dt;exports.watchContractEvent=Ls;exports.withResolvers=Vr;exports.writeContract=_s;
|
|
36
|
-
//# sourceMappingURL=writeContract-
|
|
36
|
+
//# sourceMappingURL=writeContract-BfAYISeL.cjs.map
|