@pufferfinance/puffer-sdk 1.12.2 → 1.13.1
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.cjs.map +1 -1
- package/dist/api/puffer-client-helpers.js +70 -65
- package/dist/api/puffer-client-helpers.js.map +1 -1
- package/dist/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.cjs.map +1 -1
- package/dist/api/puffer-client.d.ts +3 -0
- package/dist/api/puffer-client.js +20 -13
- package/dist/api/puffer-client.js.map +1 -1
- package/dist/{ccip-BO_b9tFc.cjs → ccip-C0xwQhXU.cjs} +2 -2
- package/dist/ccip-C0xwQhXU.cjs.map +1 -0
- package/dist/{ccip-DLDO0_x2.js → ccip-K-z2PL4P.js} +3 -3
- package/dist/ccip-K-z2PL4P.js.map +1 -0
- package/dist/chains/constants.cjs +1 -1
- package/dist/chains/constants.js +1 -1
- package/dist/constants-BcPRVxdH.cjs +9 -0
- package/dist/constants-BcPRVxdH.cjs.map +1 -0
- package/dist/{constants-BjRNQpT2.js → constants-CH7Tz5jz.js} +745 -694
- package/dist/constants-CH7Tz5jz.js.map +1 -0
- package/dist/contracts/abis/l1-reward-manager-abis.cjs +1 -1
- package/dist/contracts/abis/l1-reward-manager-abis.d.ts +527 -1
- package/dist/contracts/abis/l1-reward-manager-abis.js +1 -1
- package/dist/contracts/abis/l2-reward-manager-abis.cjs +1 -1
- package/dist/contracts/abis/l2-reward-manager-abis.d.ts +1416 -1
- package/dist/contracts/abis/l2-reward-manager-abis.js +1 -1
- package/dist/contracts/abis/mainnet/Distributor.cjs +2 -0
- package/dist/contracts/abis/mainnet/Distributor.cjs.map +1 -0
- package/dist/contracts/abis/mainnet/Distributor.d.ts +618 -0
- package/dist/contracts/abis/mainnet/Distributor.js +492 -0
- package/dist/contracts/abis/mainnet/Distributor.js.map +1 -0
- package/dist/contracts/abis/nucleus-accountant-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-accountant-abis.d.ts +2 -1
- package/dist/contracts/abis/nucleus-accountant-abis.js +1 -1
- package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-atomic-queue-abis.d.ts +2 -1
- package/dist/contracts/abis/nucleus-atomic-queue-abis.js +1 -1
- package/dist/contracts/abis/nucleus-boring-vault-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-boring-vault-abis.d.ts +2 -1
- package/dist/contracts/abis/nucleus-boring-vault-abis.js +1 -1
- package/dist/contracts/abis/nucleus-teller-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-teller-abis.d.ts +2 -1
- package/dist/contracts/abis/nucleus-teller-abis.js +1 -1
- package/dist/contracts/abis/puf-locker-abis.cjs +1 -1
- package/dist/contracts/abis/puf-locker-abis.d.ts +484 -1
- package/dist/contracts/abis/puf-locker-abis.js +1 -1
- package/dist/contracts/abis/puffer-depositor-abis.cjs +1 -1
- package/dist/contracts/abis/puffer-depositor-abis.d.ts +663 -2
- package/dist/contracts/abis/puffer-depositor-abis.js +1 -1
- package/dist/contracts/abis/puffer-vault-abis.cjs +1 -1
- package/dist/contracts/abis/puffer-vault-abis.d.ts +4 -2
- package/dist/contracts/abis/puffer-vault-abis.js +1 -1
- package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs +1 -1
- package/dist/contracts/abis/puffer-withdrawal-manager-abis.d.ts +514 -1
- package/dist/contracts/abis/puffer-withdrawal-manager-abis.js +1 -1
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.cjs.map +1 -1
- package/dist/contracts/addresses.d.ts +7 -13
- package/dist/contracts/addresses.js +6 -5
- package/dist/contracts/addresses.js.map +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/distributor-handler.cjs +2 -0
- package/dist/contracts/handlers/distributor-handler.cjs.map +1 -0
- package/dist/contracts/handlers/distributor-handler.js +318 -0
- package/dist/contracts/handlers/distributor-handler.js.map +1 -0
- package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.d.ts +17101 -14898
- package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
- package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
- 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/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.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +7619 -14812
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -1
- 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.cjs.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.js +2 -2
- package/dist/contracts/handlers/puf-locker-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.d.ts +11215 -14794
- 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-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/tokens.cjs +1 -1
- package/dist/contracts/tokens.js +1 -1
- package/dist/contracts/vaults-addresses.cjs +1 -1
- package/dist/contracts/vaults-addresses.d.ts +5 -4
- package/dist/contracts/vaults-addresses.js +1 -1
- package/dist/createWalletClient-DNLhBkOd.js +3289 -0
- package/dist/createWalletClient-DNLhBkOd.js.map +1 -0
- package/dist/createWalletClient-Di5of07E.cjs +6 -0
- package/dist/createWalletClient-Di5of07E.cjs.map +1 -0
- package/dist/{getContract-CezEyDf-.js → getContract-6ajhFbP2.js} +2 -2
- package/dist/getContract-6ajhFbP2.js.map +1 -0
- package/dist/{getContract-3QbyfZBF.cjs → getContract-ChPFzc5y.cjs} +2 -2
- package/dist/{getContract-CezEyDf-.js.map → getContract-ChPFzc5y.cjs.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.d.ts +1 -0
- package/dist/main.js +13 -11
- package/dist/main.js.map +1 -1
- package/dist/secp256k1-B8plqpXf.cjs +2 -0
- package/dist/secp256k1-B8plqpXf.cjs.map +1 -0
- package/dist/secp256k1-Ev0s9Yr6.js +1340 -0
- package/dist/secp256k1-Ev0s9Yr6.js.map +1 -0
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/writeContract-BatuNuTe.cjs +32 -0
- package/dist/writeContract-BatuNuTe.cjs.map +1 -0
- package/dist/{writeContract-ChuHpJLC.js → writeContract-CjcOEtWX.js} +822 -763
- package/dist/writeContract-CjcOEtWX.js.map +1 -0
- package/package.json +15 -15
- package/dist/ccip-BO_b9tFc.cjs.map +0 -1
- package/dist/ccip-DLDO0_x2.js.map +0 -1
- package/dist/constants-BjRNQpT2.js.map +0 -1
- package/dist/constants-DA2xUb9r.cjs +0 -9
- package/dist/constants-DA2xUb9r.cjs.map +0 -1
- package/dist/contracts/handlers/carrot-staking-handler.d.ts +0 -15063
- package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +0 -15107
- package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +0 -15353
- package/dist/contracts/handlers/mtw-carrot-handler.d.ts +0 -15293
- package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +0 -15126
- package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +0 -15284
- package/dist/contracts/handlers/nucleus-teller-handler.d.ts +0 -15201
- package/dist/contracts/handlers/puf-locker-handler.d.ts +0 -15116
- package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +0 -14969
- package/dist/contracts/handlers/puffer-vault-handler.d.ts +0 -17452
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +0 -15111
- package/dist/createWalletClient-BuLYysrp.cjs +0 -4
- package/dist/createWalletClient-BuLYysrp.cjs.map +0 -1
- package/dist/createWalletClient-DNcW-ENe.js +0 -2028
- package/dist/createWalletClient-DNcW-ENe.js.map +0 -1
- package/dist/getContract-3QbyfZBF.cjs.map +0 -1
- package/dist/secp256k1-3OC5y4qp.js +0 -1579
- package/dist/secp256k1-3OC5y4qp.js.map +0 -1
- package/dist/secp256k1-bcahnPX9.cjs +0 -2
- package/dist/secp256k1-bcahnPX9.cjs.map +0 -1
- package/dist/writeContract-ChuHpJLC.js.map +0 -1
- package/dist/writeContract-D97dSJQe.cjs +0 -32
- package/dist/writeContract-D97dSJQe.cjs.map +0 -1
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";const i=require("./constants-DA2xUb9r.cjs"),vr="1.0.7";class F extends Error{constructor(t,r={}){var s;const n=r.cause instanceof F?r.cause.details:(s=r.cause)!=null&&s.message?r.cause.message:r.details,o=r.cause instanceof F&&r.cause.docsPath||r.docsPath,a=[t||"An error occurred.","",...r.metaMessages?[...r.metaMessages,""]:[],...o?[`Docs: https://abitype.dev${o}`]:[],...n?[`Details: ${n}`]:[],`Version: abitype@${vr}`].join(`
|
|
2
|
-
`);super(a),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 _(e,t){const r=e.exec(t);return r==null?void 0:r.groups}const Tt=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Bt=/^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)?$/,Ft=/^\(.+?\).*?$/,bt=/^tuple(?<array>(\[(\d*)\])*)$/;function Le(e){let t=e.type;if(bt.test(e.type)&&"components"in e){t="(";const r=e.components.length;for(let o=0;o<r;o++){const a=e.components[o];t+=Le(a),o<r-1&&(t+=", ")}const n=_(bt,e.type);return t+=`)${(n==null?void 0:n.array)??""}`,Le({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function Y(e){let t="";const r=e.length;for(let n=0;n<r;n++){const o=e[n];t+=Le(o),n!==r-1&&(t+=", ")}return t}function Er(e){var t;return e.type==="function"?`function ${e.name}(${Y(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${(t=e.outputs)!=null&&t.length?` returns (${Y(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${Y(e.inputs)})`:e.type==="error"?`error ${e.name}(${Y(e.inputs)})`:e.type==="constructor"?`constructor(${Y(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?`fallback() external${e.stateMutability==="payable"?" payable":""}`:"receive() external payable"}const Ct=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function xr(e){return Ct.test(e)}function Pr(e){return _(Ct,e)}const Rt=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function Ar(e){return Rt.test(e)}function $r(e){return _(Rt,e)}const Mt=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function Tr(e){return Mt.test(e)}function Br(e){return _(Mt,e)}const St=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function kt(e){return St.test(e)}function Fr(e){return _(St,e)}const It=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function Cr(e){return It.test(e)}function Rr(e){return _(It,e)}const Mr=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function Sr(e){return Mr.test(e)}const kr=/^receive\(\) external payable$/;function Ir(e){return kr.test(e)}const Nr=new Set(["indexed"]),_e=new Set(["calldata","memory","storage"]);class jr extends F{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 zr extends F{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 Or extends F{constructor({param:t}){super("Invalid ABI parameter.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class Gr extends F{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 Hr extends F{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 Dr extends F{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 Lr extends F{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 X extends F{constructor({signature:t,type:r}){super(`Invalid ${r} signature.`,{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class _r extends F{constructor({signature:t}){super("Unknown signature.",{details:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class qr extends F{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 Ur extends F{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 Vr extends F{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 Zr(e,t,r){let n="";if(r)for(const o of Object.entries(r)){if(!o)continue;let a="";for(const s of o[1])a+=`[${s.type}${s.name?`:${s.name}`:""}]`;n+=`(${o[0]}{${a}})`}return t?`${t}:${e}${n}`:e}const Ne=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);function Wr(e,t={}){if(Tr(e)){const r=Br(e);if(!r)throw new X({signature:e,type:"function"});const n=O(r.parameters),o=[],a=n.length;for(let c=0;c<a;c++)o.push(U(n[c],{modifiers:_e,structs:t,type:"function"}));const s=[];if(r.returns){const c=O(r.returns),u=c.length;for(let d=0;d<u;d++)s.push(U(c[d],{modifiers:_e,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:o,outputs:s}}if(Ar(e)){const r=$r(e);if(!r)throw new X({signature:e,type:"event"});const n=O(r.parameters),o=[],a=n.length;for(let s=0;s<a;s++)o.push(U(n[s],{modifiers:Nr,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:o}}if(xr(e)){const r=Pr(e);if(!r)throw new X({signature:e,type:"error"});const n=O(r.parameters),o=[],a=n.length;for(let s=0;s<a;s++)o.push(U(n[s],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:o}}if(Cr(e)){const r=Rr(e);if(!r)throw new X({signature:e,type:"constructor"});const n=O(r.parameters),o=[],a=n.length;for(let s=0;s<a;s++)o.push(U(n[s],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:o}}if(Sr(e))return{type:"fallback"};if(Ir(e))return{type:"receive",stateMutability:"payable"};throw new _r({signature:e})}const Kr=/^(?<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$_]*))?$/,Jr=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,Yr=/^u?int$/;function U(e,t){var f,p;const r=Zr(e,t==null?void 0:t.type,t==null?void 0:t.structs);if(Ne.has(r))return Ne.get(r);const n=Ft.test(e),o=_(n?Jr:Kr,e);if(!o)throw new Or({param:e});if(o.name&&Qr(o.name))throw new Gr({param:e,name:o.name});const a=o.name?{name:o.name}:{},s=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 h=0;h<m;h++)b.push(U(y[h],{structs:c}));d={components:b}}else if(o.type in c)u="tuple",d={components:c[o.type]};else if(Yr.test(o.type))u=`${o.type}256`;else if(u=o.type,(t==null?void 0:t.type)!=="struct"&&!Nt(u))throw new zr({type:u});if(o.modifier){if(!((p=(f=t==null?void 0:t.modifiers)==null?void 0:f.has)!=null&&p.call(f,o.modifier)))throw new Hr({param:e,type:t==null?void 0:t.type,modifier:o.modifier});if(_e.has(o.modifier)&&!en(u,!!o.array))throw new Dr({param:e,type:t==null?void 0:t.type,modifier:o.modifier})}const l={type:`${u}${o.array??""}`,...a,...s,...d};return Ne.set(r,l),l}function O(e,t=[],r="",n=0){const o=e.trim().length;for(let a=0;a<o;a++){const s=e[a],c=e.slice(a+1);switch(s){case",":return n===0?O(c,[...t,r.trim()]):O(c,t,`${r}${s}`,n);case"(":return O(c,t,`${r}${s}`,n+1);case")":return O(c,t,`${r}${s}`,n-1);default:return O(c,t,`${r}${s}`,n)}}if(r==="")return t;if(n!==0)throw new Vr({current:r,depth:n});return t.push(r.trim()),t}function Nt(e){return e==="address"||e==="bool"||e==="function"||e==="string"||Tt.test(e)||Bt.test(e)}const Xr=/^(?: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 Qr(e){return e==="address"||e==="bool"||e==="function"||e==="string"||e==="tuple"||Tt.test(e)||Bt.test(e)||Xr.test(e)}function en(e,t){return t||e==="bytes"||e==="string"||e==="tuple"}function tn(e){const t={},r=e.length;for(let s=0;s<r;s++){const c=e[s];if(!kt(c))continue;const u=Fr(c);if(!u)throw new X({signature:c,type:"struct"});const d=u.properties.split(";"),l=[],f=d.length;for(let p=0;p<f;p++){const b=d[p].trim();if(!b)continue;const m=U(b,{type:"struct"});l.push(m)}if(!l.length)throw new qr({signature:c});t[u.name]=l}const n={},o=Object.entries(t),a=o.length;for(let s=0;s<a;s++){const[c,u]=o[s];n[c]=jt(u,t)}return n}const rn=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;function jt(e,t,r=new Set){const n=[],o=e.length;for(let a=0;a<o;a++){const s=e[a];if(Ft.test(s.type))n.push(s);else{const u=_(rn,s.type);if(!(u!=null&&u.type))throw new Lr({abiParameter:s});const{array:d,type:l}=u;if(l in t){if(r.has(l))throw new Ur({type:l});n.push({...s,type:`tuple${d??""}`,components:jt(t[l]??[],t,new Set([...r,l]))})}else if(Nt(l))n.push(s);else throw new jr({type:l})}}return n}function zt(e){const t=tn(e),r=[],n=e.length;for(let o=0;o<n;o++){const a=e[o];kt(a)||r.push(Wr(a,t))}return r}function P(e,t,r){const n=e[t.name];if(typeof n=="function")return n;const o=e[r];return typeof o=="function"?o:a=>t(e,a)}function L(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new mn(e.type);return`${e.name}(${ce(e.inputs,{includeName:t})})`}function ce(e,{includeName:t=!1}={}){return e?e.map(r=>nn(r,{includeName:t})).join(t?", ":","):""}function nn(e,{includeName:t}){return e.type.startsWith("tuple")?`(${ce(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}class on 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
|
-
`),{docsPath:t,name:"AbiConstructorNotFoundError"})}}class yt 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
|
-
`),{docsPath:t,name:"AbiConstructorParamsNotFoundError"})}}class Ot extends i.BaseError{constructor({data:t,params:r,size:n}){super([`Data size of ${n} bytes is too small for given parameters.`].join(`
|
|
5
|
-
`),{metaMessages:[`Params: (${ce(r,{includeName:!0})})`,`Data: ${t} (${n} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t,this.params=r,this.size=n}}class ue extends i.BaseError{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError"})}}class sn extends i.BaseError{constructor({expectedLength:t,givenLength:r,type:n}){super([`ABI encoding array length mismatch for type ${n}.`,`Expected length: ${t}`,`Given length: ${r}`].join(`
|
|
6
|
-
`),{name:"AbiEncodingArrayLengthMismatchError"})}}class an extends i.BaseError{constructor({expectedSize:t,value:r}){super(`Size of bytes "${r}" (bytes${i.size(r)}) does not match expected size (bytes${t}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class cn extends i.BaseError{constructor({expectedLength:t,givenLength:r}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${r}`].join(`
|
|
7
|
-
`),{name:"AbiEncodingLengthMismatchError"})}}class Gt extends i.BaseError{constructor(t,{docsPath:r}){super([`Encoded error signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
8
|
-
`),{docsPath:r,name:"AbiErrorSignatureNotFoundError"}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=t}}class un extends i.BaseError{constructor({docsPath:t}){super("Cannot extract event signature from empty topics.",{docsPath:t,name:"AbiEventSignatureEmptyTopicsError"})}}class Ht extends i.BaseError{constructor(t,{docsPath:r}){super([`Encoded event signature "${t}" not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it.",`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`].join(`
|
|
9
|
-
`),{docsPath:r,name:"AbiEventSignatureNotFoundError"})}}class mt extends i.BaseError{constructor(t,{docsPath:r}={}){super([`Event ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the event exists on it."].join(`
|
|
10
|
-
`),{docsPath:r,name:"AbiEventNotFoundError"})}}class ie extends i.BaseError{constructor(t,{docsPath:r}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
11
|
-
`),{docsPath:r,name:"AbiFunctionNotFoundError"})}}class dn extends i.BaseError{constructor(t,{docsPath:r}){super([`Function "${t}" does not contain any \`outputs\` on ABI.`,"Cannot decode function result without knowing what the parameter types are.","Make sure you are using the correct ABI and that the function exists on it."].join(`
|
|
12
|
-
`),{docsPath:r,name:"AbiFunctionOutputsNotFoundError"})}}class ln extends i.BaseError{constructor(t,r){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${L(t.abiItem)}\`, and`,`\`${r.type}\` in \`${L(r.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class fn extends i.BaseError{constructor({expectedSize:t,givenSize:r}){super(`Expected bytes${t}, got bytes${r}.`,{name:"BytesSizeMismatchError"})}}class Q extends i.BaseError{constructor({abiItem:t,data:r,params:n,size:o}){super([`Data size of ${o} bytes is too small for non-indexed event parameters.`].join(`
|
|
13
|
-
`),{metaMessages:[`Params: (${ce(n,{includeName:!0})})`,`Data: ${r} (${o} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t,this.data=r,this.params=n,this.size=o}}class de extends i.BaseError{constructor({abiItem:t,param:r}){super([`Expected a topic for indexed event parameter${r.name?` "${r.name}"`:""} on event "${L(t,{includeName:!0})}".`].join(`
|
|
14
|
-
`),{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=t}}class pn extends i.BaseError{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
|
|
15
|
-
`),{docsPath:r,name:"InvalidAbiEncodingType"})}}class bn extends i.BaseError{constructor(t,{docsPath:r}){super([`Type "${t}" is not a valid decoding type.`,"Please provide a valid ABI type."].join(`
|
|
16
|
-
`),{docsPath:r,name:"InvalidAbiDecodingType"})}}class yn extends i.BaseError{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
|
|
17
|
-
`),{name:"InvalidArrayError"})}}class mn extends i.BaseError{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
|
|
18
|
-
`),{name:"InvalidDefinitionTypeError"})}}class hn extends i.BaseError{constructor(t){super(`Filter type "${t}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}const gn=e=>i.keccak256(i.toBytes(e));function wn(e){return gn(e)}function vn(e){let t=!0,r="",n=0,o="",a=!1;for(let s=0;s<e.length;s++){const c=e[s];if(["(",")",","].includes(c)&&(t=!0),c==="("&&n++,c===")"&&n--,!!t){if(n===0){if(c===" "&&["event","function",""].includes(o))o="";else if(o+=c,c===")"){a=!0;break}continue}if(c===" "){e[s-1]!==","&&r!==","&&r!==",("&&(r="",t=!1);continue}o+=c,r+=c}}if(!a)throw new i.BaseError("Unable to normalize signature.");return o}const En=e=>{const t=typeof e=="string"?e:Er(e);return vn(t)};function Dt(e){return wn(En(e))}const le=Dt,xn=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,Lt=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function fe(e,t){if(e.length!==t.length)throw new cn({expectedLength:e.length,givenLength:t.length});const r=Pn({params:e,values:t}),n=Ye(r);return n.length===0?"0x":n}function Pn({params:e,values:t}){const r=[];for(let n=0;n<e.length;n++)r.push(Je({param:e[n],value:t[n]}));return r}function Je({param:e,value:t}){const r=Xe(e.type);if(r){const[n,o]=r;return $n(t,{length:n,param:{...e,type:o}})}if(e.type==="tuple")return Rn(t,{param:e});if(e.type==="address")return An(t);if(e.type==="bool")return Bn(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const n=e.type.startsWith("int"),[,,o="256"]=Lt.exec(e.type)??[];return Fn(t,{signed:n,size:Number(o)})}if(e.type.startsWith("bytes"))return Tn(t,{param:e});if(e.type==="string")return Cn(t);throw new pn(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function Ye(e){let t=0;for(let a=0;a<e.length;a++){const{dynamic:s,encoded:c}=e[a];s?t+=32:t+=i.size(c)}const r=[],n=[];let o=0;for(let a=0;a<e.length;a++){const{dynamic:s,encoded:c}=e[a];s?(r.push(i.numberToHex(t+o,{size:32})),n.push(c),o+=i.size(c)):r.push(c)}return i.concat([...r,...n])}function An(e){if(!i.isAddress(e))throw new i.InvalidAddressError({address:e});return{dynamic:!1,encoded:i.padHex(e.toLowerCase())}}function $n(e,{length:t,param:r}){const n=t===null;if(!Array.isArray(e))throw new yn(e);if(!n&&e.length!==t)throw new sn({expectedLength:t,givenLength:e.length,type:`${r.type}[${t}]`});let o=!1;const a=[];for(let s=0;s<e.length;s++){const c=Je({param:r,value:e[s]});c.dynamic&&(o=!0),a.push(c)}if(n||o){const s=Ye(a);if(n){const c=i.numberToHex(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?i.concat([c,s]):c}}if(o)return{dynamic:!0,encoded:s}}return{dynamic:!1,encoded:i.concat(a.map(({encoded:s})=>s))}}function Tn(e,{param:t}){const[,r]=t.type.split("bytes"),n=i.size(e);if(!r){let o=e;return n%32!==0&&(o=i.padHex(o,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:i.concat([i.padHex(i.numberToHex(n,{size:32})),o])}}if(n!==Number.parseInt(r))throw new an({expectedSize:Number.parseInt(r),value:e});return{dynamic:!1,encoded:i.padHex(e,{dir:"right"})}}function Bn(e){if(typeof e!="boolean")throw new i.BaseError(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:i.padHex(i.boolToHex(e))}}function Fn(e,{signed:t,size:r=256}){if(typeof r=="number"){const n=2n**(BigInt(r)-(t?1n:0n))-1n,o=t?-n-1n:0n;if(e>n||e<o)throw new i.IntegerOutOfRangeError({max:n.toString(),min:o.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:i.numberToHex(e,{size:32,signed:t})}}function Cn(e){const t=i.stringToHex(e),r=Math.ceil(i.size(t)/32),n=[];for(let o=0;o<r;o++)n.push(i.padHex(i.slice(t,o*32,(o+1)*32),{dir:"right"}));return{dynamic:!0,encoded:i.concat([i.padHex(i.numberToHex(i.size(t),{size:32})),...n])}}function Rn(e,{param:t}){let r=!1;const n=[];for(let o=0;o<t.components.length;o++){const a=t.components[o],s=Array.isArray(e)?o:a.name,c=Je({param:a,value:e[s]});n.push(c),c.dynamic&&(r=!0)}return{dynamic:r,encoded:r?Ye(n):i.concat(n.map(({encoded:o})=>o))}}function Xe(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Qe=e=>i.slice(Dt(e),0,4);function re(e){const{abi:t,args:r=[],name:n}=e,o=i.isHex(n,{strict:!1}),a=t.filter(c=>o?c.type==="function"?Qe(c)===n:c.type==="event"?le(c)===n:!1:"name"in c&&c.name===n);if(a.length===0)return;if(a.length===1)return a[0];let s;for(const c of a){if(!("inputs"in c))continue;if(!r||r.length===0){if(!c.inputs||c.inputs.length===0)return c;continue}if(!c.inputs||c.inputs.length===0||c.inputs.length!==r.length)continue;if(r.every((d,l)=>{const f="inputs"in c&&c.inputs[l];return f?qe(d,f):!1})){if(s&&"inputs"in s&&s.inputs){const d=_t(c.inputs,s.inputs,r);if(d)throw new ln({abiItem:c,type:d[0]},{abiItem:s,type:d[1]})}s=c}}return s||a[0]}function qe(e,t){const r=typeof e,n=t.type;switch(n){case"address":return i.isAddress(e,{strict:!1});case"bool":return r==="boolean";case"function":return r==="string";case"string":return r==="string";default:return n==="tuple"&&"components"in t?Object.values(t.components).every((o,a)=>qe(Object.values(e)[a],o)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(n)?r==="number"||r==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(n)?r==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(n)?Array.isArray(e)&&e.every(o=>qe(o,{...t,type:n.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function _t(e,t,r){for(const n in e){const o=e[n],a=t[n];if(o.type==="tuple"&&a.type==="tuple"&&"components"in o&&"components"in a)return _t(o.components,a.components,r[n]);const s=[o.type,a.type];if(s.includes("address")&&s.includes("bytes20")?!0:s.includes("address")&&s.includes("string")?i.isAddress(r[n],{strict:!1}):s.includes("address")&&s.includes("bytes")?i.isAddress(r[n],{strict:!1}):!1)return s}}const ht="/docs/contract/encodeEventTopics";function pe(e){var u;const{abi:t,eventName:r,args:n}=e;let o=t[0];if(r){const d=re({abi:t,name:r});if(!d)throw new mt(r,{docsPath:ht});o=d}if(o.type!=="event")throw new mt(void 0,{docsPath:ht});const a=L(o),s=le(a);let c=[];if(n&&"inputs"in o){const d=(u=o.inputs)==null?void 0:u.filter(f=>"indexed"in f&&f.indexed),l=Array.isArray(n)?n:Object.values(n).length>0?(d==null?void 0:d.map(f=>n[f.name]))??[]:[];l.length>0&&(c=(d==null?void 0:d.map((f,p)=>Array.isArray(l[p])?l[p].map((y,b)=>gt({param:f,value:l[p][b]})):l[p]?gt({param:f,value:l[p]}):null))??[])}return[s,...c]}function gt({param:e,value:t}){if(e.type==="string"||e.type==="bytes")return i.keccak256(i.toBytes(t));if(e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/))throw new hn(e.type);return fe([e],[t])}function qt(e,{method:t}){var n,o;const r={};return e.transport.type==="fallback"&&((o=(n=e.transport).onResponse)==null||o.call(n,({method:a,response:s,status:c,transport:u})=>{c==="success"&&t===a&&(r[s]=u.request)})),a=>r[a]||e.request}async function Ut(e,t){const{address:r,abi:n,args:o,eventName:a,fromBlock:s,strict:c,toBlock:u}=t,d=qt(e,{method:"eth_newFilter"}),l=a?pe({abi:n,args:o,eventName:a}):void 0,f=await e.request({method:"eth_newFilter",params:[{address:r,fromBlock:typeof s=="bigint"?i.numberToHex(s):s,toBlock:typeof u=="bigint"?i.numberToHex(u):u,topics:l}]});return{abi:n,args:o,eventName:a,id:f,request:d(f),strict:!!c,type:"event"}}function G(e){return typeof e=="string"?{address:e,type:"json-rpc"}:e}const wt="/docs/contract/encodeFunctionData";function Mn(e){const{abi:t,args:r,functionName:n}=e;let o=t[0];if(n){const a=re({abi:t,args:r,name:n});if(!a)throw new ie(n,{docsPath:wt});o=a}if(o.type!=="function")throw new ie(void 0,{docsPath:wt});return{abi:[o],functionName:Qe(L(o))}}function K(e){const{args:t}=e,{abi:r,functionName:n}=(()=>{var c;return e.abi.length===1&&((c=e.functionName)!=null&&c.startsWith("0x"))?e:Mn(e)})(),o=r[0],a=n,s="inputs"in o&&o.inputs?fe(o.inputs,t??[]):void 0;return i.concatHex([a,s??"0x"])}const Vt={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},Sn={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},kn={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"};function In(e,t={}){typeof t.size<"u"&&i.assertSize(e,{size:t.size});const r=i.bytesToHex(e,t);return i.hexToBigInt(r,t)}function Nn(e,t={}){let r=e;if(typeof t.size<"u"&&(i.assertSize(r,{size:t.size}),r=i.trim(r)),r.length>1||r[0]>1)throw new i.InvalidBytesBooleanError(r);return!!r[0]}function D(e,t={}){typeof t.size<"u"&&i.assertSize(e,{size:t.size});const r=i.bytesToHex(e,t);return i.hexToNumber(r,t)}function jn(e,t={}){let r=e;return typeof t.size<"u"&&(i.assertSize(r,{size:t.size}),r=i.trim(r,{dir:"right"})),new TextDecoder().decode(r)}function be(e,t){const r=typeof t=="string"?i.hexToBytes(t):t,n=i.createCursor(r);if(i.size(r)===0&&e.length>0)throw new ue;if(i.size(t)&&i.size(t)<32)throw new Ot({data:typeof t=="string"?t:i.bytesToHex(t),params:e,size:i.size(t)});let o=0;const a=[];for(let s=0;s<e.length;++s){const c=e[s];n.setPosition(o);const[u,d]=W(n,c,{staticPosition:0});o+=d,a.push(u)}return a}function W(e,t,{staticPosition:r}){const n=Xe(t.type);if(n){const[o,a]=n;return On(e,{...t,type:a},{length:o,staticPosition:r})}if(t.type==="tuple")return Ln(e,t,{staticPosition:r});if(t.type==="address")return zn(e);if(t.type==="bool")return Gn(e);if(t.type.startsWith("bytes"))return Hn(e,t,{staticPosition:r});if(t.type.startsWith("uint")||t.type.startsWith("int"))return Dn(e,t);if(t.type==="string")return _n(e,{staticPosition:r});throw new bn(t.type,{docsPath:"/docs/contract/decodeAbiParameters"})}const vt=32,Ue=32;function zn(e){const t=e.readBytes(32);return[i.checksumAddress(i.bytesToHex(i.sliceBytes(t,-20))),32]}function On(e,t,{length:r,staticPosition:n}){if(!r){const s=D(e.readBytes(Ue)),c=n+s,u=c+vt;e.setPosition(c);const d=D(e.readBytes(vt)),l=ee(t);let f=0;const p=[];for(let y=0;y<d;++y){e.setPosition(u+(l?y*32:f));const[b,m]=W(e,t,{staticPosition:u});f+=m,p.push(b)}return e.setPosition(n+32),[p,32]}if(ee(t)){const s=D(e.readBytes(Ue)),c=n+s,u=[];for(let d=0;d<r;++d){e.setPosition(c+d*32);const[l]=W(e,t,{staticPosition:c});u.push(l)}return e.setPosition(n+32),[u,32]}let o=0;const a=[];for(let s=0;s<r;++s){const[c,u]=W(e,t,{staticPosition:n+o});o+=u,a.push(c)}return[a,o]}function Gn(e){return[Nn(e.readBytes(32),{size:32}),32]}function Hn(e,t,{staticPosition:r}){const[n,o]=t.type.split("bytes");if(!o){const s=D(e.readBytes(32));e.setPosition(r+s);const c=D(e.readBytes(32));if(c===0)return e.setPosition(r+32),["0x",32];const u=e.readBytes(c);return e.setPosition(r+32),[i.bytesToHex(u),32]}return[i.bytesToHex(e.readBytes(Number.parseInt(o),32)),32]}function Dn(e,t){const r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256"),o=e.readBytes(32);return[n>48?In(o,{signed:r}):D(o,{signed:r}),32]}function Ln(e,t,{staticPosition:r}){const n=t.components.length===0||t.components.some(({name:s})=>!s),o=n?[]:{};let a=0;if(ee(t)){const s=D(e.readBytes(Ue)),c=r+s;for(let u=0;u<t.components.length;++u){const d=t.components[u];e.setPosition(c+a);const[l,f]=W(e,d,{staticPosition:c});a+=f,o[n?u:d==null?void 0:d.name]=l}return e.setPosition(r+32),[o,32]}for(let s=0;s<t.components.length;++s){const c=t.components[s],[u,d]=W(e,c,{staticPosition:r});o[n?s:c==null?void 0:c.name]=u,a+=d}return[o,a]}function _n(e,{staticPosition:t}){const r=D(e.readBytes(32)),n=t+r;e.setPosition(n);const o=D(e.readBytes(32));if(o===0)return e.setPosition(t+32),["",32];const a=e.readBytes(o,32),s=jn(i.trim(a));return e.setPosition(t+32),[s,32]}function ee(e){var n;const{type:t}=e;if(t==="string"||t==="bytes"||t.endsWith("[]"))return!0;if(t==="tuple")return(n=e.components)==null?void 0:n.some(ee);const r=Xe(e.type);return!!(r&&ee({...e,type:r[1]}))}function Zt(e){const{abi:t,data:r}=e,n=i.slice(r,0,4);if(n==="0x")throw new ue;const a=[...t||[],Sn,kn].find(s=>s.type==="error"&&n===Qe(L(s)));if(!a)throw new Gt(n,{docsPath:"/docs/contract/decodeErrorResult"});return{abiItem:a,args:"inputs"in a&&a.inputs&&a.inputs.length>0?be(a.inputs,i.slice(r,4)):void 0,errorName:a.name}}const V=(e,t,r)=>JSON.stringify(e,(n,o)=>typeof o=="bigint"?o.toString():o,r);function Wt({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map((o,a)=>`${n&&o.name?`${o.name}: `:""}${typeof t[a]=="object"?V(t[a]):t[a]}`).join(", ")})`}class qn extends i.BaseError{constructor({address:t}){super(`State for account "${t}" is set multiple times.`,{name:"AccountStateConflictError"})}}class Un extends i.BaseError{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function Et(e){return e.reduce((t,{slot:r,value:n})=>`${t} ${r}: ${n}
|
|
19
|
-
`,"")}function Vn(e){return e.reduce((t,{address:r,...n})=>{let o=`${t} ${r}:
|
|
20
|
-
`;return n.nonce&&(o+=` nonce: ${n.nonce}
|
|
21
|
-
`),n.balance&&(o+=` balance: ${n.balance}
|
|
22
|
-
`),n.code&&(o+=` code: ${n.code}
|
|
23
|
-
`),n.state&&(o+=` state:
|
|
24
|
-
`,o+=Et(n.state)),n.stateDiff&&(o+=` stateDiff:
|
|
25
|
-
`,o+=Et(n.stateDiff)),o},` State Override:
|
|
26
|
-
`).slice(0,-1)}const Zn=e=>e,ye=e=>e;class Kt extends i.BaseError{constructor(t,{account:r,docsPath:n,chain:o,data:a,gas:s,gasPrice:c,maxFeePerGas:u,maxPriorityFeePerGas:d,nonce:l,to:f,value:p,stateOverride:y}){var h;const b=r?G(r):void 0;let m=i.prettyPrint({from:b==null?void 0:b.address,to:f,value:typeof p<"u"&&`${i.formatEther(p)} ${((h=o==null?void 0:o.nativeCurrency)==null?void 0:h.symbol)||"ETH"}`,data:a,gas:s,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});y&&(m+=`
|
|
27
|
-
${Vn(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 Wn extends i.BaseError{constructor(t,{abi:r,args:n,contractAddress:o,docsPath:a,functionName:s,sender:c}){const u=re({abi:r,args:n,name:s}),d=u?Wt({abiItem:u,args:n,includeFunctionName:!1,includeName:!1}):void 0,l=u?L(u,{includeName:!0}):void 0,f=i.prettyPrint({address:o&&Zn(o),function:l,args:d&&d!=="()"&&`${[...Array((s==null?void 0:s.length)??0).keys()].map(()=>" ").join("")}${d}`,sender:c});super(t.shortMessage||`An unknown error occurred while executing the contract function "${s}".`,{cause:t,docsPath:a,metaMessages:[...t.metaMessages?[...t.metaMessages," "]:[],f&&"Contract Call:",f].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=s,this.sender=c}}class Jt extends i.BaseError{constructor({abi:t,data:r,functionName:n,message:o}){let a,s,c,u;if(r&&r!=="0x")try{s=Zt({abi:t,data:r});const{abiItem:l,errorName:f,args:p}=s;if(f==="Error")u=p[0];else if(f==="Panic"){const[y]=p;u=Vt[y]}else{const y=l?L(l,{includeName:!0}):void 0,b=l&&p?Wt({abiItem:l,args:p,includeFunctionName:!1,includeName:!1}):void 0;c=[y?`Error: ${y}`:"",b&&b!=="()"?` ${[...Array((f==null?void 0:f.length)??0).keys()].map(()=>" ").join("")}${b}`:""]}}catch(l){a=l}else o&&(u=o);let d;a instanceof Gt&&(d=a.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(`
|
|
28
|
-
`):`The contract function "${n}" reverted.`,{cause:a,metaMessages:c,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=s,this.reason=u,this.signature=d}}class Kn 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 Jn 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 et 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 Yn extends i.BaseError{constructor({body:t,cause:r,details:n,headers:o,status:a,url:s}){super("HTTP request failed.",{cause:r,details:n,metaMessages:[a&&`Status: ${a}`,`URL: ${ye(s)}`,t&&`Request body: ${V(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=a,this.url=s}}class Yt extends i.BaseError{constructor({body:t,error:r,url:n}){super("RPC Request failed.",{cause:r,details:r.message,metaMessages:[`URL: ${ye(n)}`,`Request body: ${V(t)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=r.code}}class Xn extends i.BaseError{constructor({body:t,url:r}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${ye(r)}`,`Request body: ${V(t)}`],name:"TimeoutError"})}}const Qn=-1;class M extends i.BaseError{constructor(t,{code:r,docsPath:n,metaMessages:o,name:a,shortMessage:s}){super(s,{cause:t,docsPath:n,metaMessages:o||(t==null?void 0:t.metaMessages),name:a||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=a||t.name,this.code=t instanceof Yt?t.code:r??Qn}}class J extends M{constructor(t,r){super(t,r),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=r.data}}class me extends M{constructor(t){super(t,{code:me.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(me,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class he extends M{constructor(t){super(t,{code:he.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(he,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class ge extends M{constructor(t,{method:r}={}){super(t,{code:ge.code,name:"MethodNotFoundRpcError",shortMessage:`The method${r?` "${r}"`:""} does not exist / is not available.`})}}Object.defineProperty(ge,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class we extends M{constructor(t){super(t,{code:we.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
|
|
29
|
-
`)})}}Object.defineProperty(we,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ne extends M{constructor(t){super(t,{code:ne.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(ne,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class oe extends M{constructor(t){super(t,{code:oe.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
|
|
30
|
-
`)})}}Object.defineProperty(oe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ve extends M{constructor(t){super(t,{code:ve.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ve,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class Ee extends M{constructor(t){super(t,{code:Ee.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(Ee,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class xe extends M{constructor(t){super(t,{code:xe.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(xe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Pe extends M{constructor(t,{method:r}={}){super(t,{code:Pe.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${r?` "${r}"`:""} is not implemented.`})}}Object.defineProperty(Pe,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class Ae extends M{constructor(t){super(t,{code:Ae.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(Ae,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class $e extends M{constructor(t){super(t,{code:$e.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty($e,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Te extends J{constructor(t){super(t,{code:Te.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Te,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Be extends J{constructor(t){super(t,{code:Be.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Be,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class Fe extends J{constructor(t,{method:r}={}){super(t,{code:Fe.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${r?` " ${r}"`:""}.`})}}Object.defineProperty(Fe,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class Ce extends J{constructor(t){super(t,{code:Ce.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(Ce,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class Re extends J{constructor(t){super(t,{code:Re.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(Re,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class Me extends J{constructor(t){super(t,{code:Me.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(Me,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class eo extends M{constructor(t){super(t,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}const to=3;function se(e,{abi:t,address:r,args:n,docsPath:o,functionName:a,sender:s}){const{code:c,data:u,message:d,shortMessage:l}=e instanceof et?e:e instanceof i.BaseError?e.walk(p=>"data"in p)||e.walk():{},f=e instanceof ue?new Kn({functionName:a}):[to,ne.code].includes(c)&&(u||d||l)?new Jt({abi:t,data:typeof u=="object"?u.data:u,functionName:a,message:l??d}):e;return new Wn(f,{abi:t,args:n,contractAddress:r,docsPath:o,functionName:a,sender:s})}function ro(e){const t=i.keccak256(`0x${e.substring(4)}`).substring(26);return i.checksumAddress(`0x${t}`)}async function no({hash:e,signature:t}){const r=i.isHex(e)?e:i.toHex(e),{secp256k1:n}=await Promise.resolve().then(()=>require("./secp256k1-bcahnPX9.cjs"));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:d,s:l,v:f,yParity:p}=t,y=Number(p??f),b=xt(y);return new n.Signature(i.hexToBigInt(d),i.hexToBigInt(l)).addRecoveryBit(b)}const s=i.isHex(t)?t:i.toHex(t),c=i.hexToNumber(`0x${s.slice(130)}`),u=xt(c);return n.Signature.fromCompact(s.substring(2,130)).addRecoveryBit(u)})().recoverPublicKey(r.substring(2)).toHex(!1)}`}function xt(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 Xt({hash:e,signature:t}){return ro(await no({hash:e,signature:t}))}function oo(e){const{chainId:t,contractAddress:r,nonce:n,to:o}=e,a=i.keccak256(i.concatHex(["0x05",i.toRlp([t?i.numberToHex(t):"0x",r,n?i.numberToHex(n):"0x"])]));return o==="bytes"?i.hexToBytes(a):a}async function Qt(e){const{authorization:t,signature:r}=e;return Xt({hash:oo(t),signature:r??t})}class so extends i.BaseError{constructor(t,{account:r,docsPath:n,chain:o,data:a,gas:s,gasPrice:c,maxFeePerGas:u,maxPriorityFeePerGas:d,nonce:l,to:f,value:p}){var b;const y=i.prettyPrint({from:r==null?void 0:r.address,to:f,value:typeof p<"u"&&`${i.formatEther(p)} ${((b=o==null?void 0:o.nativeCurrency)==null?void 0:b.symbol)||"ETH"}`,data:a,gas:s,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 tt(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 ao(e,{docsPath:t,...r}){const n=(()=>{const o=tt(e,r);return o instanceof i.UnknownNodeError?e:o})();return new so(n,{docsPath:t,...r})}function rt(e,{format:t}){if(!t)return{};const r={};function n(a){const s=Object.keys(a);for(const c of s)c in e&&(r[c]=e[c]),a[c]&&typeof a[c]=="object"&&!Array.isArray(a[c])&&n(a[c])}const o=t(e||{});return n(o),r}const io={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function Se(e){const t={};return typeof e.authorizationList<"u"&&(t.authorizationList=co(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=io[e.type]),typeof e.value<"u"&&(t.value=i.numberToHex(e.value)),t}function co(e){return e.map(t=>({address:t.contractAddress,r:t.r,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 Pt(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 uo(e){const{balance:t,nonce:r,state:n,stateDiff:o,code:a}=e,s={};if(a!==void 0&&(s.code=a),t!==void 0&&(s.balance=i.numberToHex(t)),r!==void 0&&(s.nonce=i.numberToHex(r)),n!==void 0&&(s.state=Pt(n)),o!==void 0){if(s.state)throw new Un;s.stateDiff=Pt(o)}return s}function er(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 qn({address:r});t[r]=uo(n)}return t}function ae(e){const{account:t,gasPrice:r,maxFeePerGas:n,maxPriorityFeePerGas:o,to:a}=e,s=t?G(t):void 0;if(s&&!i.isAddress(s.address))throw new i.InvalidAddressError({address:s.address});if(a&&!i.isAddress(a))throw new i.InvalidAddressError({address:a});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 lo extends i.BaseError{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class nt extends i.BaseError{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class fo 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 te(e,{blockHash:t,blockNumber:r,blockTag:n,includeTransactions:o}={}){var l,f,p;const a=n??"latest",s=o??!1,c=r!==void 0?i.numberToHex(r):void 0;let u=null;if(t?u=await e.request({method:"eth_getBlockByHash",params:[t,s]},{dedupe:!0}):u=await e.request({method:"eth_getBlockByNumber",params:[c||a,s]},{dedupe:!!c}),!u)throw new tr({blockHash:t,blockNumber:r});return(((p=(f=(l=e.chain)==null?void 0:l.formatters)==null?void 0:f.block)==null?void 0:p.format)||i.formatBlock)(u)}async function ot(e){const t=await e.request({method:"eth_gasPrice"});return BigInt(t)}async function po(e,t){return rr(e,t)}async function rr(e,t){var a,s;const{block:r,chain:n=e.chain,request:o}=t||{};try{const c=((a=n==null?void 0:n.fees)==null?void 0:a.maxPriorityFeePerGas)??((s=n==null?void 0:n.fees)==null?void 0:s.defaultPriorityFee);if(typeof c=="function"){const d=r||await P(e,te,"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):P(e,te,"getBlock")({}),P(e,ot,"getGasPrice")({})]);if(typeof c.baseFeePerGas!="bigint")throw new nt;const d=u-c.baseFeePerGas;return d<0n?0n:d}}async function bo(e,t){return Ve(e,t)}async function Ve(e,t){var p,y;const{block:r,chain:n=e.chain,request:o,type:a="eip1559"}=t||{},s=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(s<1)throw new lo;const u=10**(((p=s.toString().split(".")[1])==null?void 0:p.length)??0),d=b=>b*BigInt(Math.ceil(s*u))/BigInt(u),l=r||await P(e,te,"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:a});if(b!==null)return b}if(a==="eip1559"){if(typeof l.baseFeePerGas!="bigint")throw new nt;const b=typeof(o==null?void 0:o.maxPriorityFeePerGas)=="bigint"?o.maxPriorityFeePerGas:await rr(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 P(e,ot,"getGasPrice")({}))}}async function nr(e,{address:t,blockTag:r="latest",blockNumber:n}){const o=await e.request({method:"eth_getTransactionCount",params:[t,n?i.numberToHex(n):r]},{dedupe:!!n});return i.hexToNumber(o)}async function st(e){const t=await e.request({method:"eth_chainId"},{dedupe:!0});return i.hexToNumber(t)}const or=["blobVersionedHashes","chainId","fees","gas","nonce","type"];async function at(e,t){const{account:r=e.account,blobs:n,chain:o,gas:a,kzg:s,nonce:c,nonceManager:u,parameters:d=or,type:l}=t,f=r&&G(r),p={...t,...f?{from:f==null?void 0:f.address}:{}};let y;async function b(){return y||(y=await P(e,te,"getBlock")({blockTag:"latest"}),y)}let m;async function h(){return m||(o?o.id:typeof t.chainId<"u"?t.chainId:(m=await P(e,st,"getChainId")({}),m))}if((d.includes("blobVersionedHashes")||d.includes("sidecars"))&&n&&s){const w=i.blobsToCommitments({blobs:n,kzg:s});if(d.includes("blobVersionedHashes")){const g=i.commitmentsToVersionedHashes({commitments:w,to:"hex"});p.blobVersionedHashes=g}if(d.includes("sidecars")){const g=i.blobsToProofs({blobs:n,commitments:w,kzg:s}),v=i.toBlobSidecars({blobs:n,commitments:w,proofs:g,to:"hex"});p.sidecars=v}}if(d.includes("chainId")&&(p.chainId=await h()),d.includes("nonce")&&typeof c>"u"&&f)if(u){const w=await h();p.nonce=await u.consume({address:f.address,chainId:w,client:e})}else p.nonce=await P(e,nr,"getTransactionCount")({address:f.address,blockTag:"pending"});if((d.includes("fees")||d.includes("type"))&&typeof l>"u")try{p.type=i.getTransactionType(p)}catch{const w=await b();p.type=typeof(w==null?void 0:w.baseFeePerGas)=="bigint"?"eip1559":"legacy"}if(d.includes("fees"))if(p.type!=="legacy"&&p.type!=="eip2930"){if(typeof p.maxFeePerGas>"u"||typeof p.maxPriorityFeePerGas>"u"){const w=await b(),{maxFeePerGas:g,maxPriorityFeePerGas:v}=await Ve(e,{block:w,chain:o,request:p});if(typeof t.maxPriorityFeePerGas>"u"&&t.maxFeePerGas&&t.maxFeePerGas<v)throw new fo({maxPriorityFeePerGas:v});p.maxPriorityFeePerGas=v,p.maxFeePerGas=g}}else{if(typeof t.maxFeePerGas<"u"||typeof t.maxPriorityFeePerGas<"u")throw new nt;const w=await b(),{gasPrice:g}=await Ve(e,{block:w,chain:o,request:p,type:"legacy"});p.gasPrice=g}return d.includes("gas")&&typeof a>"u"&&(p.gas=await P(e,it,"estimateGas")({...p,account:f&&{address:f.address,type:"json-rpc"}})),ae(p),delete p.parameters,p}async function sr(e,{address:t,blockNumber:r,blockTag:n="latest"}){const o=r?i.numberToHex(r):void 0,a=await e.request({method:"eth_getBalance",params:[t,o||n]});return BigInt(a)}async function it(e,t){var o,a,s;const{account:r=e.account}=t,n=r?G(r):void 0;try{let j=function(R){const{block:z,request:I,rpcStateOverride:q}=R;return e.request({method:"eth_estimateGas",params:q?[I,z??"latest",q]:z?[I,z]:[I]})};const{accessList:c,authorizationList:u,blobs:d,blobVersionedHashes:l,blockNumber:f,blockTag:p,data:y,gas:b,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:w,maxPriorityFeePerGas:g,nonce:v,value:A,stateOverride:$,...T}=await at(e,{...t,parameters:(n==null?void 0:n.type)==="local"?void 0:["blobVersionedHashes"]}),E=(f?i.numberToHex(f):void 0)||p,x=er($),H=await(async()=>{if(T.to)return T.to;if(u&&u.length>0)return await Qt({authorization:u[0]}).catch(()=>{throw new i.BaseError("`to` is required. Could not infer from `authorizationList`")})})();ae(t);const C=(s=(a=(o=e.chain)==null?void 0:o.formatters)==null?void 0:a.transactionRequest)==null?void 0:s.format,B=(C||Se)({...rt(T,{format:C}),from:n==null?void 0:n.address,accessList:c,authorizationList:u,blobs:d,blobVersionedHashes:l,data:y,gas:b,gasPrice:m,maxFeePerBlobGas:h,maxFeePerGas:w,maxPriorityFeePerGas:g,nonce:v,to:H,value:A});let k=BigInt(await j({block:E,request:B,rpcStateOverride:x}));if(u){const R=await sr(e,{address:B.from}),z=await Promise.all(u.map(async I=>{const{contractAddress:q}=I,Z=await j({block:E,request:{authorizationList:void 0,data:y,from:n==null?void 0:n.address,to:q,value:i.numberToHex(R)},rpcStateOverride:x}).catch(()=>100000n);return 2n*BigInt(Z)}));k+=z.reduce((I,q)=>I+q,0n)}return k}catch(c){throw ao(c,{...t,account:n,chain:e.chain})}}async function yo(e,t){const{abi:r,address:n,args:o,functionName:a,dataSuffix:s,...c}=t,u=K({abi:r,args:o,functionName:a});try{return await P(e,it,"estimateGas")({data:`${u}${s?s.replace("0x",""):""}`,to:n,...c})}catch(d){const l=c.account?G(c.account):void 0;throw se(d,{abi:r,address:n,args:o,docsPath:"/docs/contract/estimateContractGas",functionName:a,sender:l==null?void 0:l.address})}}function ar(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 At="/docs/contract/decodeEventLog";function ct(e){const{abi:t,data:r,strict:n,topics:o}=e,a=n??!0,[s,...c]=o;if(!s)throw new un({docsPath:At});const u=t.length===1?t[0]:t.find(m=>m.type==="event"&&s===le(L(m)));if(!(u&&"name"in u)||u.type!=="event")throw new Ht(s,{docsPath:At});const{name:d,inputs:l}=u,f=l==null?void 0:l.some(m=>!("name"in m&&m.name));let p=f?[]:{};const y=l.filter(m=>"indexed"in m&&m.indexed);for(let m=0;m<y.length;m++){const h=y[m],w=c[m];if(!w)throw new de({abiItem:u,param:h});p[f?m:h.name||m]=mo({param:h,value:w})}const b=l.filter(m=>!("indexed"in m&&m.indexed));if(b.length>0){if(r&&r!=="0x")try{const m=be(b,r);if(m)if(f)p=[...p,...m];else for(let h=0;h<b.length;h++)p[b[h].name]=m[h]}catch(m){if(a)throw m instanceof Ot||m instanceof i.PositionOutOfBoundsError?new Q({abiItem:u,data:r,params:b,size:i.size(r)}):m}else if(a)throw new Q({abiItem:u,data:"0x",params:b,size:0})}return{eventName:d,args:Object.values(p).length>0?p:void 0}}function mo({param:e,value:t}){return e.type==="string"||e.type==="bytes"||e.type==="tuple"||e.type.match(/^(.*)\[(\d+)?\]$/)?t:(be([e],t)||[])[0]}function ut(e){const{abi:t,args:r,logs:n,strict:o=!0}=e,a=(()=>{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})();return n.map(s=>{var c;try{const u=t.find(l=>l.type==="event"&&s.topics[0]===le(l));if(!u)return null;const d=ct({...s,abi:[u],strict:o});return a&&!a.includes(d.eventName)||!ho({args:d.args,inputs:u.inputs,matchArgs:r})?null:{...d,...s}}catch(u){let d,l;if(u instanceof Ht)return null;if(u instanceof Q||u instanceof de){if(o)return null;d=u.abiItem.name,l=(c=u.abiItem.inputs)==null?void 0:c.some(f=>!("name"in f&&f.name))}return{...s,args:l?[]:{},eventName:d}}}).filter(Boolean)}function ho(e){const{args:t,inputs:r,matchArgs:n}=e;if(!n)return!0;if(!t)return!1;function o(a,s,c){try{return a.type==="address"?ar(s,c):a.type==="string"||a.type==="bytes"?i.keccak256(i.toBytes(s))===c:s===c}catch{return!1}}return Array.isArray(t)&&Array.isArray(n)?n.every((a,s)=>{if(a==null)return!0;const c=r[s];return c?(Array.isArray(a)?a:[a]).some(d=>o(c,d,t[s])):!1}):typeof t=="object"&&!Array.isArray(t)&&typeof n=="object"&&!Array.isArray(n)?Object.entries(n).every(([a,s])=>{if(s==null)return!0;const c=r.find(d=>d.name===a);return c?(Array.isArray(s)?s:[s]).some(d=>o(c,d,t[a])):!1}):!1}async function ir(e,{address:t,blockHash:r,fromBlock:n,toBlock:o,event:a,events:s,args:c,strict:u}={}){const d=u??!1,l=s??(a?[a]:void 0);let f=[];l&&(f=[l.flatMap(m=>pe({abi:[m],eventName:m.name,args:s?void 0:c}))],a&&(f=f[0]));let p;r?p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:r}]}):p=await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:typeof n=="bigint"?i.numberToHex(n):n,toBlock:typeof o=="bigint"?i.numberToHex(o):o}]});const y=p.map(b=>i.formatLog(b));return l?ut({abi:l,args:c,logs:y,strict:d}):y}async function cr(e,t){const{abi:r,address:n,args:o,blockHash:a,eventName:s,fromBlock:c,toBlock:u,strict:d}=t,l=s?re({abi:r,name:s}):void 0,f=l?void 0:r.filter(p=>p.type==="event");return P(e,ir,"getLogs")({address:n,args:o,blockHash:a,event:l,events:f,fromBlock:c,toBlock:u,strict:d})}const je="/docs/contract/decodeFunctionResult";function ke(e){const{abi:t,args:r,functionName:n,data:o}=e;let a=t[0];if(n){const c=re({abi:t,args:r,name:n});if(!c)throw new ie(n,{docsPath:je});a=c}if(a.type!=="function")throw new ie(void 0,{docsPath:je});if(!a.outputs)throw new dn(a.name,{docsPath:je});const s=be(a.outputs,o);if(s&&s.length>1)return s;if(s&&s.length===1)return s[0]}const Ze=[{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"}],ur=[{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"}],go=[...ur,{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"}]}],wo=[...ur,{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"}]}],vo=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],Eo=[{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"}]}],xo=[{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"}],Po="0x82ad56cb",Ao="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",$o="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",To="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",ze="/docs/contract/encodeDeployData";function dt(e){const{abi:t,args:r,bytecode:n}=e;if(!r||r.length===0)return n;const o=t.find(s=>"type"in s&&s.type==="constructor");if(!o)throw new on({docsPath:ze});if(!("inputs"in o))throw new yt({docsPath:ze});if(!o.inputs||o.inputs.length===0)throw new yt({docsPath:ze});const a=fe(o.inputs,r);return i.concatHex([n,a])}function dr({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 Bo(e,{docsPath:t,...r}){const n=(()=>{const o=tt(e,r);return o instanceof i.UnknownNodeError?e:o})();return new Kt(n,{docsPath:t,...r})}function lr(){let e=()=>{},t=()=>{};return{promise:new Promise((n,o)=>{e=n,t=o}),resolve:e,reject:t}}const Oe=new Map;function fr({fn:e,id:t,shouldSplitBatch:r,wait:n=0,sort:o}){const a=async()=>{const l=u();s();const f=l.map(({args:p})=>p);f.length!==0&&e(f).then(p=>{o&&Array.isArray(p)&&p.sort(o);for(let y=0;y<l.length;y++){const{resolve:b}=l[y];b==null||b([p[y],p])}}).catch(p=>{for(let y=0;y<l.length;y++){const{reject:b}=l[y];b==null||b(p)}})},s=()=>Oe.delete(t),c=()=>u().map(({args:l})=>l),u=()=>Oe.get(t)||[],d=l=>Oe.set(t,[...u(),l]);return{flush:s,async schedule(l){const{promise:f,resolve:p,reject:y}=lr();return(r==null?void 0:r([...c(),l]))&&a(),u().length>0?(d({args:l,resolve:p,reject:y}),f):(d({args:l,resolve:p,reject:y}),setTimeout(a,n),f)}}}async function lt(e,t){var C,N,B,j;const{account:r=e.account,batch:n=!!((C=e.batch)!=null&&C.multicall),blockNumber:o,blockTag:a="latest",accessList:s,blobs:c,code:u,data:d,factory:l,factoryData:f,gas:p,gasPrice:y,maxFeePerBlobGas:b,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:w,to:g,value:v,stateOverride:A,...$}=t,T=r?G(r):void 0;if(u&&(l||f))throw new i.BaseError("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(u&&g)throw new i.BaseError("Cannot provide both `code` & `to` as parameters.");const S=u&&d,E=l&&f&&g&&d,x=S||E,H=S?Ro({code:u,data:d}):E?Mo({data:d,factory:l,factoryData:f,to:g}):d;try{ae(t);const R=(o?i.numberToHex(o):void 0)||a,z=er(A),I=(j=(B=(N=e.chain)==null?void 0:N.formatters)==null?void 0:B.transactionRequest)==null?void 0:j.format,Z=(I||Se)({...rt($,{format:I}),from:T==null?void 0:T.address,accessList:s,blobs:c,data:H,gas:p,gasPrice:y,maxFeePerBlobGas:b,maxFeePerGas:m,maxPriorityFeePerGas:h,nonce:w,to:x?void 0:g,value:v});if(n&&Fo({request:Z})&&!z)try{return await Co(e,{...Z,blockNumber:o,blockTag:a})}catch(Ie){if(!(Ie instanceof i.ClientChainNotConfiguredError)&&!(Ie instanceof i.ChainDoesNotSupportContract))throw Ie}const pt=await e.request({method:"eth_call",params:z?[Z,R,z]:[Z,R]});return pt==="0x"?{data:void 0}:{data:pt}}catch(k){const R=So(k),{offchainLookup:z,offchainLookupSignature:I}=await Promise.resolve().then(()=>require("./ccip-BO_b9tFc.cjs"));if(e.ccipRead!==!1&&(R==null?void 0:R.slice(0,10))===I&&g)return{data:await z(e,{data:R,to:g})};throw x&&(R==null?void 0:R.slice(0,10))==="0x101bb98d"?new Jn({factory:l}):Bo(k,{...t,account:T,chain:e.chain})}}function Fo({request:e}){const{data:t,to:r,...n}=e;return!(!t||t.startsWith(Po)||!r||Object.values(n).filter(o=>typeof o<"u").length>0)}async function Co(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:a="latest",data:s,multicallAddress:c,to:u}=t;let d=c;if(!d){if(!e.chain)throw new i.ClientChainNotConfiguredError;d=dr({blockNumber:o,chain:e.chain,contract:"multicall3"})}const f=(o?i.numberToHex(o):void 0)||a,{schedule:p}=fr({id:`${e.uid}.${f}`,wait:n,shouldSplitBatch(h){return h.reduce((g,{data:v})=>g+(v.length-2),0)>r*2},fn:async h=>{const w=h.map(A=>({allowFailure:!0,callData:A.data,target:A.to})),g=K({abi:Ze,args:[w],functionName:"aggregate3"}),v=await e.request({method:"eth_call",params:[{data:g,to:d},f]});return ke({abi:Ze,args:[w],functionName:"aggregate3",data:v||"0x"})}}),[{returnData:y,success:b}]=await p({data:s,to:u});if(!b)throw new et({data:y});return y==="0x"?{data:void 0}:{data:y}}function Ro(e){const{code:t,data:r}=e;return dt({abi:zt(["constructor(bytes, bytes)"]),bytecode:Ao,args:[t,r]})}function Mo(e){const{data:t,factory:r,factoryData:n,to:o}=e;return dt({abi:zt(["constructor(address, bytes, address, bytes)"]),bytecode:$o,args:[o,t,r,n]})}function So(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 ko(e,t){const{abi:r,address:n,args:o,functionName:a,...s}=t,c=K({abi:r,args:o,functionName:a});try{const{data:u}=await P(e,lt,"call")({...s,data:c,to:n});return ke({abi:r,args:o,functionName:a,data:u||"0x"})}catch(u){throw se(u,{abi:r,address:n,args:o,docsPath:"/docs/contract/readContract",functionName:a})}}async function Io(e,t){const{abi:r,address:n,args:o,dataSuffix:a,functionName:s,...c}=t,u=c.account?G(c.account):e.account,d=K({abi:r,args:o,functionName:s});try{const{data:l}=await P(e,lt,"call")({batch:!1,data:`${d}${a?a.replace("0x",""):""}`,to:n,...c,account:u}),f=ke({abi:r,args:o,functionName:s,data:l||"0x"}),p=r.filter(y=>"name"in y&&y.name===t.functionName);return{result:f,request:{abi:p,address:n,args:o,dataSuffix:a,functionName:s,...c,account:u}}}catch(l){throw se(l,{abi:r,address:n,args:o,docsPath:"/docs/contract/simulateContract",functionName:s,sender:u==null?void 0:u.address})}}const Ge=new Map,$t=new Map;let No=0;function We(e,t,r){const n=++No,o=()=>Ge.get(e)||[],a=()=>{const l=o();Ge.set(e,l.filter(f=>f.id!==n))},s=()=>{const l=o();if(!l.some(p=>p.id===n))return;const f=$t.get(e);l.length===1&&f&&f(),a()},c=o();if(Ge.set(e,[...c,{id:n,fns:t}]),c&&c.length>0)return s;const u={};for(const l in t)u[l]=(...f)=>{var y,b;const p=o();if(p.length!==0)for(const m of p)(b=(y=m.fns)[l])==null||b.call(y,...f)};const d=r(u);return typeof d=="function"&&$t.set(e,d),s}async function Ke(e){return new Promise(t=>setTimeout(t,e))}function pr(e,{emitOnBegin:t,initialWaitTime:r,interval:n}){let o=!0;const a=()=>o=!1;return(async()=>{let c;t&&(c=await e({unpoll:a}));const u=await(r==null?void 0:r(c))??n;await Ke(u);const d=async()=>{o&&(await e({unpoll:a}),await Ke(n),d())};d()})(),a}const jo=new Map,zo=new Map;function Oo(e){const t=(o,a)=>({clear:()=>a.delete(o),get:()=>a.get(o),set:s=>a.set(o,s)}),r=t(e,jo),n=t(e,zo);return{clear:()=>{r.clear(),n.clear()},promise:r,response:n}}async function Go(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){const n=Oo(t),o=n.response.get();if(o&&r>0&&new Date().getTime()-o.created.getTime()<r)return o.data;let a=n.promise.get();a||(a=e(),n.promise.set(a));try{const s=await a;return n.response.set({created:new Date,data:s}),s}finally{n.promise.clear()}}const Ho=e=>`blockNumber.${e}`;async function br(e,{cacheTime:t=e.cacheTime}={}){const r=await Go(()=>e.request({method:"eth_blockNumber"}),{cacheKey:Ho(e.uid),cacheTime:t});return BigInt(r)}async function yr(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(a=>i.formatLog(a));return!("abi"in t)||!t.abi?o:ut({abi:t.abi,logs:o,strict:r})}async function mr(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}function Do(e,t){const{abi:r,address:n,args:o,batch:a=!0,eventName:s,fromBlock:c,onError:u,onLogs:d,poll:l,pollingInterval:f=e.pollingInterval,strict:p}=t;return(typeof l<"u"?l:typeof c=="bigint"?!0:!(e.transport.type==="webSocket"||e.transport.type==="fallback"&&e.transport.transports[0].config.type==="webSocket"))?(()=>{const h=p??!1,w=V(["watchContractEvent",n,o,a,e.uid,s,f,h,c]);return We(w,{onLogs:d,onError:u},g=>{let v;c!==void 0&&(v=c-1n);let A,$=!1;const T=pr(async()=>{var S;if(!$){try{A=await P(e,Ut,"createContractEventFilter")({abi:r,address:n,args:o,eventName:s,strict:h,fromBlock:c})}catch{}$=!0;return}try{let E;if(A)E=await P(e,yr,"getFilterChanges")({filter:A});else{const x=await P(e,br,"getBlockNumber")({});v&&v<x?E=await P(e,cr,"getContractEvents")({abi:r,address:n,args:o,eventName:s,fromBlock:v+1n,toBlock:x,strict:h}):E=[],v=x}if(E.length===0)return;if(a)g.onLogs(E);else for(const x of E)g.onLogs([x])}catch(E){A&&E instanceof oe&&($=!1),(S=g.onError)==null||S.call(g,E)}},{emitOnBegin:!0,interval:f});return async()=>{A&&await P(e,mr,"uninstallFilter")({filter:A}),T()}})})():(()=>{const h=p??!1,w=V(["watchContractEvent",n,o,a,e.uid,s,f,h]);let g=!0,v=()=>g=!1;return We(w,{onLogs:d,onError:u},A=>((async()=>{try{const $=(()=>{if(e.transport.type==="fallback"){const E=e.transport.transports.find(x=>x.config.type==="webSocket");return E?E.value:e.transport}return e.transport})(),T=s?pe({abi:r,eventName:s,args:o}):[],{unsubscribe:S}=await $.subscribe({params:["logs",{address:n,topics:T}],onData(E){var H;if(!g)return;const x=E.result;try{const{eventName:C,args:N}=ct({abi:r,data:x.data,topics:x.topics,strict:p}),B=i.formatLog(x,{args:N,eventName:C});A.onLogs([B])}catch(C){let N,B;if(C instanceof Q||C instanceof de){if(p)return;N=C.abiItem.name,B=(H=C.abiItem.inputs)==null?void 0:H.some(k=>!("name"in k&&k.name))}const j=i.formatLog(x,{args:B?[]:{},eventName:N});A.onLogs([j])}},onError(E){var x;(x=A.onError)==null||x.call(A,E)}});v=S,g||v()}catch($){u==null||u($)}})(),()=>v()))})()}class ft 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(`
|
|
31
|
-
`),{docsPath:t,docsSlug:"account",name:"AccountNotFoundError"})}}class He extends i.BaseError{constructor({docsPath:t,metaMessages:r,type:n}){super(`Account type "${n}" is not supported.`,{docsPath:t,metaMessages:r,name:"AccountTypeNotSupportedError"})}}function hr({chain:e,currentChainId:t}){if(!e)throw new i.ChainNotFoundError;if(t!==e.id)throw new i.ChainMismatchError({chain:e,currentChainId:t})}function Lo(e,{docsPath:t,...r}){const n=(()=>{const o=tt(e,r);return o instanceof i.UnknownNodeError?e:o})();return new i.TransactionExecutionError(n,{docsPath:t,...r})}async function gr(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}const De=new i.LruMap(128);async function wr(e,t){var w,g,v,A;const{account:r=e.account,chain:n=e.chain,accessList:o,authorizationList:a,blobs:s,data:c,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:y,value:b,...m}=t;if(typeof r>"u")throw new ft({docsPath:"/docs/actions/wallet/sendTransaction"});const h=r?G(r):null;try{ae(t);const $=await(async()=>{if(t.to)return t.to;if(a&&a.length>0)return await Qt({authorization:a[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 T;n!==null&&(T=await P(e,st,"getChainId")({}),hr({currentChainId:T,chain:n}));const S=(v=(g=(w=e.chain)==null?void 0:w.formatters)==null?void 0:g.transactionRequest)==null?void 0:v.format,x=(S||Se)({...rt(m,{format:S}),accessList:o,authorizationList:a,blobs:s,chainId:T,data:c,from:h==null?void 0:h.address,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:y,to:$,value:b}),H=De.get(e.uid),C=H?"wallet_sendTransaction":"eth_sendTransaction";try{return await e.request({method:C,params:[x]},{retryCount:0})}catch(N){if(H===!1)throw N;const B=N;if(B.name==="InvalidInputRpcError"||B.name==="InvalidParamsRpcError"||B.name==="MethodNotFoundRpcError"||B.name==="MethodNotSupportedRpcError")return await e.request({method:"wallet_sendTransaction",params:[x]},{retryCount:0}).then(j=>(De.set(e.uid,!0),j)).catch(j=>{const k=j;throw k.name==="MethodNotFoundRpcError"||k.name==="MethodNotSupportedRpcError"?(De.set(e.uid,!1),B):k});throw B}}if((h==null?void 0:h.type)==="local"){const T=await P(e,at,"prepareTransactionRequest")({account:h,accessList:o,authorizationList:a,blobs:s,chain:n,data:c,gas:u,gasPrice:d,maxFeePerBlobGas:l,maxFeePerGas:f,maxPriorityFeePerGas:p,nonce:y,nonceManager:h.nonceManager,parameters:[...or,"sidecars"],value:b,...m,to:$}),S=(A=n==null?void 0:n.serializers)==null?void 0:A.transaction,E=await h.signTransaction(T,{serializer:S});return await P(e,gr,"sendRawTransaction")({serializedTransaction:E})}throw(h==null?void 0:h.type)==="smart"?new He({metaMessages:["Consider using the `sendUserOperation` Action instead."],docsPath:"/docs/actions/bundler/sendUserOperation",type:"smart"}):new He({docsPath:"/docs/actions/wallet/sendTransaction",type:h==null?void 0:h.type})}catch($){throw $ instanceof He?$:Lo($,{...t,account:h,chain:t.chain||void 0})}}async function _o(e,t){const{abi:r,account:n=e.account,address:o,args:a,dataSuffix:s,functionName:c,...u}=t;if(typeof n>"u")throw new ft({docsPath:"/docs/contract/writeContract"});const d=n?G(n):null,l=K({abi:r,args:a,functionName:c});try{return await P(e,wr,"sendTransaction")({data:`${l}${s?s.replace("0x",""):""}`,to:o,account:d,...u})}catch(f){throw se(f,{abi:r,address:o,args:a,docsPath:"/docs/contract/writeContract",functionName:c,sender:d==null?void 0:d.address})}}exports.AbiDecodingZeroDataError=ue;exports.AccountNotFoundError=ft;exports.BlockNotFoundError=tr;exports.BytesSizeMismatchError=fn;exports.CallExecutionError=Kt;exports.ChainDisconnectedError=Re;exports.ContractFunctionRevertedError=Jt;exports.DecodeLogDataMismatch=Q;exports.DecodeLogTopicsMismatch=de;exports.HttpRequestError=Yn;exports.InternalRpcError=ne;exports.InvalidInputRpcError=oe;exports.InvalidParamsRpcError=we;exports.InvalidRequestRpcError=he;exports.JsonRpcVersionUnsupportedError=$e;exports.LimitExceededRpcError=Ae;exports.MethodNotFoundRpcError=ge;exports.MethodNotSupportedRpcError=Pe;exports.ParseRpcError=me;exports.ProviderDisconnectedError=Ce;exports.RawContractError=et;exports.ResourceNotFoundRpcError=ve;exports.ResourceUnavailableRpcError=Ee;exports.RpcRequestError=Yt;exports.SwitchChainError=Me;exports.TimeoutError=Xn;exports.TransactionRejectedRpcError=xe;exports.UnauthorizedProviderError=Be;exports.UnknownRpcError=eo;exports.UnsupportedProviderMethodError=Fe;exports.UserRejectedRequestError=Te;exports.addressResolverAbi=Eo;exports.assertCurrentChain=hr;exports.assertRequest=ae;exports.bytesRegex=xn;exports.call=lt;exports.createBatchScheduler=fr;exports.createContractEventFilter=Ut;exports.createFilterRequestScope=qt;exports.decodeErrorResult=Zt;exports.decodeEventLog=ct;exports.decodeFunctionResult=ke;exports.encodeAbiParameters=fe;exports.encodeDeployData=dt;exports.encodeEventTopics=pe;exports.encodeFunctionData=K;exports.estimateContractGas=yo;exports.estimateFeesPerGas=bo;exports.estimateGas=it;exports.estimateMaxPriorityFeePerGas=po;exports.formatTransactionRequest=Se;exports.getAction=P;exports.getBalance=sr;exports.getBlock=te;exports.getBlockNumber=br;exports.getChainContractAddress=dr;exports.getChainId=st;exports.getContractError=se;exports.getContractEvents=cr;exports.getFilterChanges=yr;exports.getGasPrice=ot;exports.getLogs=ir;exports.getTransactionCount=nr;exports.getUrl=ye;exports.integerRegex=Lt;exports.isAddressEqual=ar;exports.multicall3Abi=Ze;exports.observe=We;exports.panicReasons=Vt;exports.parseAccount=G;exports.parseEventLogs=ut;exports.poll=pr;exports.prepareTransactionRequest=at;exports.readContract=ko;exports.recoverAddress=Xt;exports.sendRawTransaction=gr;exports.sendTransaction=wr;exports.simulateContract=Io;exports.stringify=V;exports.textResolverAbi=vo;exports.uninstallFilter=mr;exports.universalResolverResolveAbi=go;exports.universalResolverReverseAbi=wo;exports.universalSignatureValidatorAbi=xo;exports.universalSignatureValidatorByteCode=To;exports.wait=Ke;exports.watchContractEvent=Do;exports.withResolvers=lr;exports.writeContract=_o;
|
|
32
|
-
//# sourceMappingURL=writeContract-D97dSJQe.cjs.map
|